:root {
  color-scheme: light;
  --ink: #3e3329;
  --ink-soft: rgba(62, 51, 41, 0.72);
  --gold: #b69260;
  --gold-soft: rgba(182, 146, 96, 0.24);
  --panel: rgba(255, 250, 244, 0.72);
  --panel-strong: rgba(255, 251, 247, 0.84);
  --border: rgba(255, 255, 255, 0.72);
  --shadow: 0 30px 80px rgba(72, 45, 18, 0.18);
  --shadow-card: 0 28px 50px rgba(77, 54, 29, 0.22);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --stage-pad: clamp(16px, 2vw, 28px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: #e7d8c2;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100svh;
}

.stage {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  padding: var(--stage-pad);
  background:
    linear-gradient(180deg, rgba(255, 250, 244, 0.44), rgba(245, 234, 221, 0.56)),
    url("BG.png") center center / cover no-repeat;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.34), transparent 26%),
    radial-gradient(circle at 80% 24%, rgba(255, 224, 185, 0.18), transparent 24%),
    radial-gradient(circle at 56% 66%, rgba(255, 255, 255, 0.15), transparent 34%);
  pointer-events: none;
}

.stage__bg,
.stage__overlay,
.stage__grain,
.stage__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.stage__bg {
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 248, 240, 0.58), transparent 32%),
    radial-gradient(circle at 10% 82%, rgba(196, 149, 98, 0.24), transparent 30%),
    radial-gradient(circle at 88% 78%, rgba(255, 242, 223, 0.28), transparent 26%);
  mix-blend-mode: screen;
}

.stage__overlay {
  background:
    linear-gradient(90deg, rgba(255, 248, 240, 0.14), rgba(255, 248, 240, 0.02) 18%, rgba(255, 248, 240, 0.02) 82%, rgba(255, 248, 240, 0.14)),
    linear-gradient(180deg, rgba(38, 26, 14, 0.08), rgba(38, 26, 14, 0.02) 30%, rgba(38, 26, 14, 0.1));
}

.stage__grain {
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: soft-light;
}

.stage__vignette {
  background: radial-gradient(circle at center, transparent 52%, rgba(50, 31, 14, 0.22) 100%);
}

.glass {
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 248, 240, 0.58));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-panel {
  position: absolute;
  left: max(24px, env(safe-area-inset-left));
  top: max(24px, env(safe-area-inset-top));
  z-index: 8;
  width: min(600px, calc(100vw - 48px));
  padding: clamp(18px, 2.6vw, 28px);
  border-radius: var(--radius-xl);
}

.hero-panel__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(92, 69, 42, 0.8);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(180, 142, 98, 0.2);
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, #f6d9a6, #b48c58);
  box-shadow: 0 0 18px rgba(182, 146, 96, 0.55);
}

.hero-panel h1 {
  margin: 14px 0 10px;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  font-size: clamp(30px, 4.4vw, 58px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #4d3b28;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.36);
}

.hero-panel p {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(14px, 1.6vw, 17px);
  line-height: 1.8;
  color: var(--ink-soft);
}

.hero-panel__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-panel__meta span {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: rgba(70, 50, 30, 0.88);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(182, 146, 96, 0.16);
}

.control-dock {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  top: max(24px, env(safe-area-inset-top));
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(440px, calc(100vw - 48px));
  padding: 18px 18px 18px 20px;
  border-radius: var(--radius-lg);
}

.control-dock__info {
  display: grid;
  gap: 4px;
}

.control-dock__info strong {
  font-size: 32px;
  line-height: 1;
  color: #4b3828;
}

.control-dock__info span {
  font-size: 13px;
  color: var(--ink-soft);
}

.control-dock__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-progress {
  width: 100%;
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.upload-progress__track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(112, 83, 55, 0.1);
  border: 1px solid rgba(180, 142, 98, 0.18);
}

.upload-progress__bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d7b27f, #b88953 52%, #7f5a31);
  box-shadow: 0 0 20px rgba(184, 137, 83, 0.34);
  transition: width 120ms linear;
}

.upload-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--ink-soft);
}

.upload-progress__meta strong {
  font-size: 12px;
  color: #6d4e2d;
  letter-spacing: 0.08em;
}

.upload-progress.is-hidden {
  display: none;
}

.action-btn {
  appearance: none;
  border: 1px solid rgba(180, 142, 98, 0.24);
  color: #4b3828;
  background: rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  padding: 12px 16px;
  min-height: 46px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(107, 71, 31, 0.16);
  border-color: rgba(180, 142, 98, 0.42);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn--primary {
  color: #fffdf9;
  background: linear-gradient(135deg, #c59e71, #9f7747);
  border-color: transparent;
  box-shadow: 0 16px 34px rgba(156, 116, 69, 0.28);
}

.dropzone {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  width: min(520px, calc(100vw - 32px));
  border-radius: 999px;
  border: 1px dashed rgba(170, 130, 82, 0.26);
  background: rgba(255, 252, 248, 0.58);
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.dropzone.is-dragover {
  transform: translateX(-50%) scale(1.02);
  background: rgba(255, 250, 242, 0.88);
  border-color: rgba(171, 130, 81, 0.52);
}

.dropzone__icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fffdf9;
  font-size: 22px;
  font-weight: 600;
  background: linear-gradient(135deg, #d0aa7d, #9d7546);
  box-shadow: 0 12px 24px rgba(136, 95, 47, 0.24);
}

.dropzone__text {
  display: grid;
  gap: 3px;
}

.dropzone__text strong {
  font-size: 15px;
  color: #4a3728;
}

.dropzone__text span {
  font-size: 12px;
  color: var(--ink-soft);
}

.center-title {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  min-width: min(580px, calc(100vw - 40px));
  padding: clamp(20px, 3vw, 32px) clamp(24px, 4vw, 42px);
  border-radius: 28px;
  text-align: center;
  pointer-events: none;
  overflow: hidden;
}

.center-title__top {
  font-size: clamp(14px, 1.7vw, 18px);
  letter-spacing: 0.34em;
  color: rgba(112, 84, 49, 0.74);
}

.center-title__main {
  margin: 10px 0 6px;
  font-family: "STKaiti", "KaiTi", "Kaiti SC", serif;
  font-size: clamp(30px, 5vw, 72px);
  letter-spacing: 0.18em;
  color: #5a452d;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85),
    0 12px 30px rgba(102, 74, 42, 0.18);
}

.center-title__sub {
  font-size: clamp(12px, 1.4vw, 15px);
  letter-spacing: 0.34em;
  color: rgba(117, 92, 63, 0.66);
}

.stage__layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.photo-card {
  position: absolute;
  top: 0;
  left: 0;
  width: min(34vw, 360px);
  min-width: 190px;
  aspect-ratio: 3 / 4;
  transform-origin: center center;
  will-change: transform, opacity, filter;
  contain: layout paint style;
  transition:
    filter 360ms ease,
    opacity 360ms ease;
}

.photo-card__frame {
  position: relative;
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1.2vw, 14px);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 241, 232, 0.94));
  box-shadow:
    0 25px 45px rgba(76, 50, 24, 0.22),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
  overflow: hidden;
  background-clip: padding-box;
}

.photo-card__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.22));
  mix-blend-mode: screen;
  pointer-events: none;
}

.photo-card__frame::after {
  content: "";
  position: absolute;
  inset: auto 8% 10px 8%;
  height: 16px;
  border-radius: 999px;
  background: rgba(116, 79, 44, 0.22);
  filter: blur(10px);
  opacity: 0.55;
  pointer-events: none;
}

.photo-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  user-select: none;
  -webkit-user-drag: none;
  transform: translateZ(0);
}

.photo-card.is-portrait {
  width: min(28vw, 290px);
}

.photo-card.is-wide {
  width: min(40vw, 420px);
  aspect-ratio: 4 / 3;
}

.photo-card.is-small {
  width: min(24vw, 240px);
}

.photo-card.is-faded {
  opacity: 0.78;
  filter: saturate(0.98) contrast(0.98) brightness(0.99);
}

.toast {
  position: absolute;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  z-index: 12;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0;
  padding: 12px 16px;
  border-radius: 999px;
  color: #fffdf8;
  background: rgba(61, 42, 22, 0.82);
  box-shadow: 0 20px 40px rgba(53, 34, 17, 0.28);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 16, 10, 0.56);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.photo-viewer.is-open {
  opacity: 1;
  visibility: visible;
}

.photo-viewer__stage {
  position: relative;
  width: min(92vw, 980px);
  max-height: 86vh;
  display: grid;
  place-items: center;
}

.photo-viewer__img {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.photo-viewer__caption {
  margin-top: 14px;
  max-width: min(92vw, 980px);
  color: rgba(255, 248, 240, 0.9);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-align: center;
}

.photo-viewer__close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
}

.photo-viewer__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .stage {
    height: auto;
    min-height: 100svh;
    padding-bottom: calc(140px + env(safe-area-inset-bottom));
    background-attachment: scroll;
  }

  .hero-panel,
  .control-dock {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    max-width: none;
    margin: 0 0 14px;
  }

  .hero-panel {
    z-index: 8;
  }

  .control-dock {
    z-index: 8;
    justify-content: space-between;
  }

  .dropzone {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .center-title {
    min-width: min(520px, calc(100vw - 24px));
    padding: 18px 18px 20px;
  }

  .photo-card {
    width: min(34vw, 320px);
  }

  .photo-card.is-small {
    width: min(24vw, 220px);
  }

  .photo-card.is-wide {
    width: min(42vw, 340px);
  }

  .photo-card.is-portrait {
    width: min(28vw, 240px);
  }

  .hero-panel,
  .control-dock {
    display: none;
  }

  .stage {
    padding-top: 12px;
  }

  .center-title {
    top: 38%;
    transform: translateX(-50%);
    min-width: min(560px, calc(100vw - 24px));
  }
}

@media (max-width: 640px) {
  .hero-panel,
  .control-dock {
    display: none;
  }

  .dropzone {
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .hero-panel h1 {
    letter-spacing: 0.03em;
  }

  .control-dock {
    gap: 12px;
  }

  .control-dock__actions {
    width: 100%;
  }

  .action-btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .center-title {
    min-width: calc(100vw - 24px);
  }

  .center-title__main {
    letter-spacing: 0.1em;
  }

  .center-title {
    top: 38%;
    padding: 14px 16px 16px;
  }

  .photo-viewer {
    padding: 14px;
  }

  .photo-viewer__close {
    width: 42px;
    height: 42px;
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-btn,
  .dropzone,
  .toast {
    transition: none;
  }
}
