*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background-color: #eef1f5;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background-color: #f4f6f9;
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.08);
}

.page {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ==================== Loading Page ==================== */
.page-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: #f4f6f9;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dbe4f0;
  border-top-color: #1989fa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.light {
  border-color: rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  color: #888;
  font-size: 14px;
}

.retry-btn {
  background: #1989fa;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 14px;
  padding: 9px 24px;
  cursor: pointer;
}

/* ==================== Index / Guide Page ==================== */
.index-container {
  padding-bottom: 32px;
}

.hero {
  background: linear-gradient(135deg, #1989fa, #0f6fd8);
  overflow: hidden;
  padding: 40px 20px 52px;
  position: relative;
}

.hero::after {
  background: #f4f6f9;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  bottom: -20px;
  content: "";
  height: 40px;
  left: 0;
  position: absolute;
  right: 0;
}

.hero-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.hero-title {
  margin: 0 0 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hero-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13.5px;
  line-height: 1.6;
  text-align: center;
}

.section-label {
  color: #999;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 16px 18px 8px;
}

.feature-list {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
  margin: 0 12px 12px;
  overflow: hidden;
}

.feature-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f5f5f5;
}

.feature-item:last-child {
  border-bottom: none;
}

.feature-left {
  margin-right: 12px;
}

.ficon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ficon-photo {
  background: #fff3e0;
}

.ficon-video {
  background: #fce4ec;
}

.ficon-audio {
  background: #e8f5e9;
}

.ficon-text {
  background: #e3f2fd;
}

.feature-name {
  color: #1a1a1a;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}

.feature-sub {
  color: #999;
  font-size: 12px;
}

.tip-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
  margin: 0 12px 20px;
  padding: 14px 16px;
}

.tip-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 7px;
}

.tip-row:last-child {
  margin-bottom: 0;
}

.tip-dot {
  color: #1989fa;
  font-size: 14px;
  line-height: 1.6;
  margin-right: 6px;
}

.tip-text {
  color: #666;
  font-size: 13.5px;
  line-height: 1.6;
}

.index-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 12px;
}

.demo-btn {
  width: 100%;
  border: none;
  background: linear-gradient(135deg, #1989fa, #0f6fd8);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(25, 137, 250, 0.3);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 14px 0;
  text-align: center;
  cursor: pointer;
}

.demo-btn-secondary {
  background: linear-gradient(135deg, #8b1a1a, #640d0d);
  box-shadow: 0 4px 12px rgba(120, 18, 18, 0.28);
}

/* ==================== Upload Page ==================== */
.upload-container {
  padding-top: 12px;
  padding-bottom: 40px;
}

.notice-bar {
  background: #fff7e6;
  border-left: 3px solid #ffa940;
  border-radius: 4px;
  color: #d46b08;
  font-size: 13px;
  line-height: 1.6;
  margin: 0 12px 12px;
  padding: 10px 16px;
}

.upload-section {
  background: #fff;
  border-radius: 8px;
  margin: 0 12px 10px;
  padding: 16px;
}

.upload-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.upload-section-title {
  color: #1a1a1a;
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.upload-section-header .upload-section-title {
  margin-bottom: 0;
}

.upload-section-hint {
  color: #999;
  flex: 1;
  font-size: 11.5px;
  margin-left: 8px;
}

.add-btn {
  background: #fff;
  border: 1px solid #1989fa;
  border-radius: 20px;
  color: #1989fa;
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
}

.hidden-file-input {
  display: none;
}

.text-input {
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 10px;
  color: #333;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  min-height: 96px;
  width: 100%;
  resize: vertical;
  outline: none;
}

.text-input:focus {
  border-color: #1989fa;
}

.char-count {
  color: #bbb;
  font-size: 12px;
  margin-top: 6px;
  text-align: right;
}

.field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f2f2f2;
  padding-bottom: 8px;
}

.field-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.field-label {
  flex-shrink: 0;
  width: 66px;
  color: #555;
  font-size: 14px;
  font-weight: 500;
}

.field-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #efefef;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  color: #222;
  background: #fafafa;
  outline: none;
}

.field-input:focus {
  border-color: #1989fa;
  background: #fff;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1 / 1;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.remove-icon {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  padding: 0;
  cursor: pointer;
}

.video-item {
  margin-bottom: 8px;
}

.video-player {
  background: #000;
  border-radius: 6px;
  height: 180px;
  width: 100%;
}

.remove-row {
  color: #e53935;
  font-size: 13px;
  padding-top: 6px;
  text-align: right;
  cursor: pointer;
}

.audio-list {
  margin-top: 4px;
}

.audio-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f2f2f2;
}

.audio-item:last-child {
  border-bottom: none;
}

.audio-name {
  color: #555;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}

.remove-text {
  color: #e53935;
  font-size: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

.empty-hint {
  color: #c8c8c8;
  font-size: 13px;
  padding: 8px 0;
  text-align: center;
}

.submit-area {
  padding: 8px 12px 0;
}

.submit-btn {
  width: 100%;
  border: none;
  background: #1989fa;
  border-radius: 8px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 14px 0;
  text-align: center;
  cursor: pointer;
}

.submit-btn.disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

/* ==================== Pure Black Gallery Display Page ==================== */
.page-view {
  background: #000;
  color: #fff;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.gallery-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.gallery-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  pointer-events: none;
}

.gallery-back-btn,
.gallery-badge {
  pointer-events: auto;
}

.gallery-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid rgba(232, 200, 136, 0.36);
  background: rgba(28, 4, 4, 0.56);
  backdrop-filter: blur(10px);
  color: #f6e2b8;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 13px 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.gallery-back-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.gallery-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(232, 200, 136, 0.36);
  background: rgba(28, 4, 4, 0.56);
  backdrop-filter: blur(10px);
  color: #f6e2b8;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.6px;
  font-variant-numeric: tabular-nums;
  padding: 5px 13px;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.gallery-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8c888;
  box-shadow: 0 0 6px rgba(232, 200, 136, 0.75);
}

.gallery-banner-wrap {
  position: absolute;
  top: calc(44px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  height: 18vh;
  max-height: 150px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  pointer-events: none;
}

.gallery-banner-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}

.gallery-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.gallery-viewport.dragging {
  cursor: grabbing;
}

.gallery-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-track.no-transition {
  transition: none;
}

.gallery-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0;
}

/* Slide Type: Cover Slide (Fixed background image + 5 positioned fields) */
.slide-cover-wrap {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 1216 / 1204;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide-cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}

.slide-cover-field {
  position: absolute;
  left: 30.8%;
  right: 6%;
  transform: translateY(-50%);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "KaiTi", "STKaiti", Georgia, serif;
  font-size: clamp(10.5px, 2.75vw, 13.2px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.4px;
  color: #f2d8a4;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Slide Type: Photo Slide (Full screen width, aspect-ratio preserved, centered on black) */
.slide-photo-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.slide-photo-img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: auto;
  -webkit-user-drag: none;
}

/* Slide Type: Video Slide (Last slide, full width centered on black) */
.slide-video-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 0;
}

.slide-video-player {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  outline: none;
}

/* Footer Dots & Audio Bar */
.gallery-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.swipe-hint {
  font-size: 12px;
  color: rgba(245, 223, 178, 0.78);
  letter-spacing: 1px;
  transition: opacity 0.4s ease;
}

.swipe-hint.fade-out {
  opacity: 0;
}

.gallery-dots {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(20, 4, 4, 0.45);
  backdrop-filter: blur(6px);
}

.gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(245, 223, 178, 0.35);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.gallery-dot.active {
  width: 20px;
  background: #e8c888;
}

.gallery-dot.is-video {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: rgba(245, 223, 178, 0.5);
}

.gallery-dot.is-video.active {
  width: 20px;
  border-radius: 999px;
  background: #e8c888;
}

.gallery-audio-btn {
  position: absolute;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(232, 200, 136, 0.35);
  background: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(8px);
  color: rgba(243, 213, 155, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

.gallery-audio-btn:active {
  transform: scale(0.92);
}

.gallery-audio-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.gallery-audio-btn.playing {
  color: #f3d59b;
  border-color: rgba(232, 200, 136, 0.75);
  box-shadow: 0 0 12px rgba(232, 200, 136, 0.32);
}

.gallery-audio-btn.playing svg {
  animation: musicSpin 4s linear infinite;
}

.gallery-audio-btn.playing .audio-slash {
  display: none;
}

.gallery-audio-btn:not(.playing) .audio-slash {
  display: block;
}

@keyframes musicSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.lightbox-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  z-index: 105;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.lightbox-img {
  max-width: 100%;
  max-height: 96vh;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  -webkit-user-drag: none;
}

/* ==================== Global Toast & Loading ==================== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  max-width: 78%;
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

.global-loading {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-loading-box {
  background: rgba(0, 0, 0, 0.78);
  border-radius: 10px;
  padding: 18px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.global-loading-text {
  color: #fff;
  font-size: 13.5px;
}
