:root {
  color-scheme: dark;
  --wine: #34070c;
  --ink: #190b10;
  --cream: #fff1d4;
  --muted: #d5b6a1;
  --gold: #f0c578;
  --gold-light: #ffe3ac;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'SimSun', Georgia, serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
:focus-visible { outline: 2px solid #ffdf99; outline-offset: 5px; }
.wordmark {
  display: inline-block;
  align-self: flex-start;
  background: #be232d;
  color: #fff9ef;
  padding: .15em .32em .20em;
  font: 800 clamp(1.15rem, 2.05vw, 2.2rem)/1 Arial, sans-serif;
  letter-spacing: -.065em;
}
.kicker { color: var(--gold-light); letter-spacing: .24em; font-weight: 500; }
.minimal {
  color: var(--cream);
  background: transparent;
  border: 1px solid #ffdc9c4d;
  border-radius: .28rem;
  padding: .5rem .82rem;
}

.screen { overflow: hidden; background: #33080c; }
.stage { position: relative; isolation: isolate; width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #33080c; }
#orbit, .stage-finale { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage-finale { display: grid; place-items: center; }
#finale-fallback { text-align: center; color: var(--gold-light); font: 700 clamp(6rem, 29vh, 19rem)/.85 Georgia, serif; text-shadow: 0 0 35px #ffc37390; }
#finale-fallback small { display: block; margin-top: .85em; font-size: .19em; letter-spacing: .12em; }
#finale-control-trigger { position: absolute; z-index: 1; border: 0; padding: 0; background: transparent; cursor: inherit; }
.stage-bar, .stage-footer {
  position: absolute; z-index: 2; left: clamp(1rem, 4vw, 5rem); right: clamp(1rem, 4vw, 5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.stage-bar { top: clamp(1rem, 4.2vh, 3rem); }
.stage-footer { bottom: clamp(.8rem, 3vh, 2.25rem); color: #ffdfb9b8; font-size: .875rem; }
.backup-actions { display: flex; gap: .55rem; }
.backup-actions button:disabled { opacity: .55; }
.stage:fullscreen .stage-footer, .stage:fullscreen #fullscreen { display: none; }
.report-view, .interactive-view, .film-view { position: absolute; inset: 0; text-align: center; pointer-events: none; }
.report-view { display: grid; align-content: center; justify-items: center; gap: clamp(1.2rem, 4vh, 3rem); padding: 3rem 1.4rem; }
.report-view .kicker { font-size: clamp(.92rem, 1.45vw, 1.8rem); }
#control-trigger {
  pointer-events: auto; user-select: none; -webkit-user-select: none;
  border: 0; padding: 0; background: transparent; color: inherit; letter-spacing: inherit; cursor: inherit;
}
.report-view h1 {
  font: 700 clamp(2.9rem, min(7.4vw, 15vh), 12rem)/1.08 var(--serif);
  letter-spacing: .07em; color: var(--gold-light);
  text-shadow: 0 2px 3px #51220a, 0 0 45px #ffab3778;
}
.report-view h1 span { display: block; white-space: nowrap; }
.era { display: flex; align-items: center; gap: .72em; color: #ffdb9a; letter-spacing: .12em; font: 500 clamp(1.1rem, 2.1vw, 2.4rem)/1 Georgia, serif; }
.era span { width: 2.3em; height: 1px; background: #ffc87299; }
.interactive-view h1 {
  position: absolute; top: 9.6%; left: 12%; right: 12%;
  font: 700 clamp(1.45rem, min(5vw, 10vh), 6rem)/1.16 var(--serif); color: var(--gold-light);
  letter-spacing: .055em; text-shadow: 0 3px 18px #50130b, 0 0 20px #fca62b3b;
}
.interactive-view h1 span { white-space: nowrap; }
.counter, .film-view { display: grid; justify-items: center; align-content: center; }
.counter { position: absolute; inset: 19% 0 17%; }
.progress { display: flex; align-items: baseline; justify-content: center; gap: .18em; color: #ffe0a6; }
#count, #year {
  font: 700 clamp(5rem, min(15vw, 29vh), 22rem)/.95 Georgia, 'Times New Roman', serif;
  font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.064em;
  text-shadow: 0 3px 0 #973a15, 0 1px 28px #ffb83d75, 0 0 65px #ff821755;
}
.total { font: 400 clamp(1.4rem, 3vw, 4.25rem)/1 Georgia, serif; color: #ffdc9e; }
#count-label, #caption { color: #ffdfaa; letter-spacing: .22em; font-size: clamp(1.05rem, 2vw, 2.3rem); margin-top: .8em; }
.qr-stand {
  position: absolute; z-index: 2; right: clamp(1rem, 4vw, 5rem); bottom: clamp(3.1rem, 9vh, 6.5rem);
  width: clamp(6rem, min(17vw, 25vh), 18rem); padding: .5rem .5rem .65rem;
  background: #480e10ed; border: 1px solid #dfa763aa; border-radius: .45rem; text-align: center;
  box-shadow: 0 9px 50px #17020499;
}
.qr-stand img { display: block; width: 100%; height: auto; image-rendering: pixelated; background: #fff; }
.qr-stand p { margin-top: .45rem; color: var(--gold-light); font-size: clamp(.82rem, 1.25vw, 1.25rem); }
.film-view { color: #fff0bc; }
#year { font-size: clamp(4.6rem, min(18vw, 28vh), 20rem); }
#caption { min-height: 1.5em; }
.stage-bar .wordmark { transition: opacity .65s ease; }
body[data-phase='playing'] .stage-bar .wordmark { opacity: 0; }
body[data-phase='finale'] .stage-bar .wordmark { visibility: hidden; }
body[data-phase='finale'] .stage { background: #600e0e; }

.phone { min-height: 100vh; background: #20080c; }
.invitation {
  position: relative; isolation: isolate; display: flex; flex-direction: column; width: min(100%, 32rem);
  min-height: 100vh; min-height: 100svh; margin-inline: auto; overflow: hidden;
  background: radial-gradient(ellipse at 50% 48%, #9b2819 0, #591013 42%, #32060d 82%);
}
.invitation-bar { display: flex; flex: none; justify-content: space-between; align-items: start; margin: max(1.5rem, env(safe-area-inset-top)) 1.55rem 0; }
.anniversary { color: var(--gold-light); font: italic 700 2.7rem/.9 Georgia, serif; text-shadow: 0 0 15px #fbae4b75; }
.invitation-title { padding: clamp(2.1rem, 8svh, 5.4rem) 1.25rem 0; text-align: center; z-index: 1; }
.invitation-title .kicker { font-size: .93rem; }
.invitation-title h1 { color: #ffe4ae; font: 700 clamp(2.1rem, 9vw, 3.8rem)/1.19 var(--serif); margin-top: .45em; letter-spacing: .045em; text-shadow: 0 0 24px #ffc47855; }
.invitation-title h1 span { display: block; }
.invitation-art {
  flex: 1 1 14rem; min-height: 12rem; max-height: 21rem; margin: .3rem 0 -1.2rem;
  background: url('/art/horizon.webp') center / cover no-repeat;
  mask-image: linear-gradient(transparent, #000 14%, #000 78%, transparent);
}
.invitation-action { margin: auto 1.55rem 0; flex: none; text-align: center; padding: 1.1rem 0 max(2.75rem, env(safe-area-inset-bottom)); }
#guest-detail { min-height: 1.5rem; color: #fff0d3; line-height: 1.52; }
#join-button {
  display: block; width: 100%; min-height: 3.65rem; margin: .9rem 0 .65rem; border: 1px solid #ffe7b7;
  border-radius: 3rem; background: linear-gradient(180deg, #ffe9b9, #edb764); color: #401009;
  font-size: 1.24rem; font-weight: 800; letter-spacing: .17em; box-shadow: 0 .4rem 2rem #27050788;
}
#join-button:disabled { background: #561218; color: #ffe2ad; border-color: #ca97557d; box-shadow: none; }
.guest-note { color: #f3cba9; font-size: .875rem; min-height: 1.45rem; }

.control { min-height: 100vh; background: linear-gradient(145deg, #30161b, #180d12 55%); color: #fff2dc; }
.control-shell { width: min(100%, 52rem); margin: auto; padding: clamp(1.4rem, 5vw, 4rem) clamp(1rem, 4vw, 2.5rem); }
.control-header { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; }
.control-header .kicker { font-size: .875rem; letter-spacing: .125em; }
.control-header h1 { font: 700 clamp(2rem, 7vw, 3.4rem)/1.14 var(--serif); margin-top: .45rem; }
.control-header nav { display: flex; flex-wrap: wrap; gap: .85rem; color: var(--gold-light); font-size: .9rem; }
.control-header a { text-underline-offset: .32em; }
.control-section { border-top: 1px solid #f1bb895e; padding: 1.3rem 0 1.7rem; }
.control-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.control-section h2 { font-size: 1.15rem; }
.phase { color: var(--gold-light); font-size: .95rem; }
.desk-counter { margin-top: .65rem; color: var(--gold); font: 400 1.5rem/1 Georgia, serif; }
.desk-counter strong { font-size: clamp(3rem, 10vw, 5rem); font-variant-numeric: tabular-nums; }
progress { display: block; margin: .9rem 0 1.35rem; width: 100%; height: .5rem; accent-color: var(--gold); }
.split-progress { display: flex; flex-wrap: wrap; gap: .8rem clamp(1rem, 5vw, 3.55rem); color: var(--muted); }
.split-progress div { display: flex; align-items: baseline; gap: .4rem; }
.split-progress dd { font-weight: 700; color: var(--cream); }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: .9rem 0; }
.actions button, .login-row button, .login-row input {
  min-height: 3rem; padding: .6rem .9rem; border: 1px solid #e6b27680; border-radius: .35rem;
  background: #49232a; color: var(--cream);
}
.actions .primary, .login-row .primary { background: var(--gold); color: #28140d; font-weight: 700; border-color: var(--gold-light); }
.actions button:disabled { opacity: .45; background: #2a1d22; color: var(--muted); border-color: #7c665b; }
.cue, .control-message { color: var(--muted); min-height: 1.5em; line-height: 1.5; }
.backup-instructions { color: var(--muted); margin: .65rem 0 .85rem; line-height: 1.55; }
.backup-instructions kbd { color: var(--cream); font-size: .92em; }
.backup-download { display: inline-block; color: var(--gold-light); padding: .35rem 0; text-underline-offset: .26em; }
.control-bottom { display: flex; gap: .6rem; margin-bottom: .65rem; }
.control-bottom button:disabled { opacity: .5; }
.login-row { display: flex; gap: .65rem; margin-top: .6rem; }
.login-row input { background: #1d1117; flex: 1 1 0; min-width: 0; }
.login-row button { flex: none; }

@media (max-width: 580px) and (orientation: portrait) {
  .qr-stand { right: max(1.25rem, env(safe-area-inset-right)); bottom: 4rem; }
  .interactive-view h1 { top: 17%; }
  .stage-footer { flex-direction: column; align-items: flex-start; gap: .45rem; }
  .control-header { align-items: start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .stage-bar .wordmark { transition: none; }
}
