@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Serif+SC:wght@500;600;700;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --ink: #11131b;
  --ink-2: #181b27;
  --ink-3: #222736;
  --paper: #f7f0e9;
  --paper-muted: #c9c0b3;
  --paper-soft: #ede4da;
  --red: #d84858;
  --red-deep: #8f2039;
  --red-dark: #59182b;
  --gold: #e7bb7a;
  --gold-bright: #f5d59c;
  --pink: #ff8996;
  --mint: #9fe2c3;
  --line: rgba(247, 240, 233, 0.14);
  --line-gold: rgba(231, 187, 122, 0.42);
  --display: 'Noto Serif SC', 'Songti SC', SimSun, serif;
  --sans: 'Plus Jakarta Sans', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 72% 6%, rgba(136, 45, 67, 0.28), transparent 31rem),
    radial-gradient(circle at 14% 76%, rgba(42, 68, 92, 0.28), transparent 28rem),
    var(--ink);
  font-family: var(--sans);
}

body::before {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  content: '';
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.75'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 5px;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 22rem;
  height: 22rem;
  border: 1px solid rgba(231, 187, 122, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.ambient::after {
  position: absolute;
  inset: 1.25rem;
  border: 1px solid rgba(231, 187, 122, 0.08);
  border-radius: inherit;
  content: '';
}

.ambient--one {
  top: -10rem;
  right: -6rem;
}

.ambient--two {
  bottom: -12rem;
  left: -8rem;
  transform: scale(1.35);
}

.game-app {
  width: min(1440px, calc(100% - 72px));
  min-height: 100svh;
  margin: 0 auto;
}

.topbar {
  display: flex;
  min-height: 96px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--paper);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  color: var(--ink);
  background: var(--gold);
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(45deg);
}

.brand-mark::first-letter {
  transform: rotate(-45deg);
}

.brand-copy {
  display: grid;
  gap: 0.16rem;
}

.brand-title {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.brand-subtitle,
.eyebrow,
.stage-ticker,
.stage-side-label,
.playfield-meta,
.camera-card__header,
.camera-card__footer,
.control-mode,
.app-footer,
.connection-pill,
.score-caption,
.timer-value small {
  font-family: var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.brand-subtitle {
  color: var(--paper-muted);
  font-size: 0.52rem;
}

.connection-pill {
  display: inline-flex;
  min-height: 2.15rem;
  align-items: center;
  gap: 0.52rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--paper-muted);
  font-size: 0.57rem;
}

.connection-pill[data-state='ready'] {
  border-color: rgba(159, 226, 195, 0.34);
  color: var(--mint);
}

.connection-pill[data-state='fallback'] {
  border-color: rgba(231, 187, 122, 0.38);
  color: var(--gold-bright);
}

.connection-dot,
.meta-dot,
.camera-live-dot {
  display: block;
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--paper-muted);
}

.connection-pill[data-state='ready'] .connection-dot,
.camera-live-dot[data-state='ready'] {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(159, 226, 195, 0.09), 0 0 15px rgba(159, 226, 195, 0.8);
}

.connection-pill[data-state='fallback'] .connection-dot {
  background: var(--gold);
}

.screen[hidden] {
  display: none !important;
}

.screen.is-active {
  animation: screen-in 0.52s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen--intro {
  display: grid;
  min-height: calc(100svh - 144px);
  grid-template-columns: minmax(0, 1.01fr) minmax(420px, 0.99fr);
  gap: clamp(3rem, 7vw, 8rem);
  align-items: center;
  padding: clamp(3.5rem, 8vh, 7rem) 0 clamp(3rem, 8vh, 6.5rem);
}

.intro-copy {
  position: relative;
  z-index: 1;
  max-width: 650px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--gold);
  font-size: 0.6rem;
  line-height: 1.4;
}

.eyebrow > span {
  display: block;
  width: 1.6rem;
  height: 1px;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(231, 187, 122, 0.8);
}

.intro-copy h1 {
  max-width: 690px;
  margin: 1.45rem 0 1.35rem;
  font-family: var(--display);
  font-size: clamp(3.9rem, 7.7vw, 7.6rem);
  font-weight: 600;
  letter-spacing: -0.075em;
  line-height: 0.98;
}

.intro-copy h1 span,
.intro-copy h1 strong {
  display: block;
}

.intro-copy h1 strong {
  color: var(--red);
  font-weight: 900;
  letter-spacing: -0.1em;
  text-shadow: 0 0 34px rgba(216, 72, 88, 0.18);
}

.intro-description {
  max-width: 34rem;
  margin: 0;
  color: var(--paper-muted);
  font-size: clamp(0.92rem, 1.2vw, 1.06rem);
  line-height: 1.95;
}

.rule-strip {
  display: flex;
  max-width: 34rem;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.5rem);
  margin: 2.4rem 0 2.8rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.rule-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.62rem;
}

.rule-item > span:last-child {
  display: grid;
  gap: 0.2rem;
}

.rule-item small {
  color: var(--paper-muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.rule-item strong {
  font-family: var(--mono);
  font-size: 1.06rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.rule-item--positive strong {
  color: var(--gold-bright);
}

.rule-item--negative strong {
  color: var(--pink);
}

.rule-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-gold);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.9rem;
}

.rule-item--negative .rule-icon {
  border-color: rgba(255, 137, 150, 0.55);
  color: var(--pink);
  font-family: var(--mono);
}

.rule-icon--time {
  font-family: var(--mono);
  font-size: 0.55rem;
}

.rule-divider {
  width: 1px;
  height: 2rem;
  flex: 0 0 auto;
  background: var(--line);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.15rem;
}

.primary-button {
  display: inline-flex;
  min-width: 12.3rem;
  min-height: 3.7rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.6rem 0.7rem 0.6rem 1.35rem;
  border: 1px solid var(--gold-bright);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(115deg, var(--gold-bright), var(--gold));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2), 0 0 0 5px rgba(231, 187, 122, 0.08);
  cursor: pointer;
  font-family: var(--display);
  font-size: 1.03rem;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.primary-button:hover {
  filter: brightness(1.06);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28), 0 0 0 7px rgba(231, 187, 122, 0.1);
  transform: translateY(-2px);
}

.primary-button:active {
  transform: translateY(1px) scale(0.985);
}

.primary-button:disabled {
  cursor: wait;
  filter: saturate(0.65);
  opacity: 0.7;
  transform: none;
}

.button-arrow {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--sans);
  font-size: 1.15rem;
  transition: transform 180ms ease;
}

.primary-button:hover .button-arrow {
  transform: rotate(8deg) translate(1px, -1px);
}

.fallback-note,
.privacy-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--paper-muted);
  font-size: 0.66rem;
  line-height: 1.6;
}

.fallback-key {
  padding: 0.28rem 0.38rem;
  border: 1px solid var(--line);
  border-radius: 0.25rem;
  color: var(--paper-soft);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.privacy-note {
  margin-top: 2rem;
  color: rgba(201, 192, 179, 0.7);
  font-size: 0.6rem;
}

.privacy-lock {
  color: var(--gold);
}

.intro-stage {
  position: relative;
  min-height: min(640px, 66vh);
  overflow: hidden;
  border: 1px solid var(--line-gold);
  background:
    linear-gradient(145deg, rgba(34, 39, 54, 0.82), rgba(12, 15, 24, 0.92)),
    var(--ink-2);
  box-shadow: 0 34px 65px rgba(0, 0, 0, 0.24), inset 0 0 0 9px rgba(255, 255, 255, 0.015);
}

.intro-stage::before,
.intro-stage::after {
  position: absolute;
  z-index: 2;
  width: 2.3rem;
  height: 2.3rem;
  content: '';
  pointer-events: none;
}

.intro-stage::before {
  top: 1.05rem;
  left: 1.05rem;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
}

.intro-stage::after {
  right: 1.05rem;
  bottom: 1.05rem;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}

.stage-ticker {
  position: absolute;
  z-index: 4;
  top: 1.5rem;
  right: 1.55rem;
  left: 1.55rem;
  display: flex;
  justify-content: space-between;
  color: rgba(247, 240, 233, 0.52);
  font-size: 0.51rem;
}

.stage-ticker span:first-child {
  color: var(--pink);
}

.stage-spotlight {
  position: absolute;
  top: -18%;
  left: 31%;
  width: 45%;
  height: 85%;
  background: linear-gradient(180deg, rgba(231, 187, 122, 0.18), transparent 76%);
  clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%);
  filter: blur(5px);
  opacity: 0.85;
}

.stage-grid {
  position: absolute;
  inset: 20% -10% -10%;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(231, 187, 122, 0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(231, 187, 122, 0.22) 1px, transparent 1px);
  background-position: center;
  background-size: 3.9rem 3.9rem;
  transform: perspective(240px) rotateX(60deg) scale(1.6);
}

.stage-side-label {
  position: absolute;
  z-index: 3;
  top: 23%;
  left: 1.35rem;
  color: rgba(231, 187, 122, 0.6);
  font-size: 0.52rem;
  line-height: 1.75;
}

.stage-number {
  position: absolute;
  right: 1.35rem;
  bottom: 1.5rem;
  color: rgba(247, 240, 233, 0.14);
  font-family: var(--display);
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
}

.preview-envelope {
  position: absolute;
  z-index: 3;
  display: grid;
  width: clamp(5.5rem, 11vw, 8.7rem);
  height: clamp(4.2rem, 8.5vw, 6.6rem);
  place-items: center;
  border: 1px solid rgba(245, 213, 156, 0.85);
  background: linear-gradient(145deg, #ec5966, #a92240 75%);
  box-shadow: 0 22px 30px rgba(0, 0, 0, 0.35), inset 0 0 0 4px rgba(115, 25, 46, 0.25);
  transform: rotate(-16deg);
}

.preview-envelope::before {
  position: absolute;
  inset: 0;
  border-top: 1px solid rgba(255, 228, 181, 0.72);
  background: linear-gradient(145deg, transparent 49%, rgba(95, 17, 36, 0.38) 50%, transparent 51%);
  clip-path: polygon(0 0, 50% 57%, 100% 0, 100% 100%, 0 100%);
  content: '';
}

.preview-envelope::after {
  position: absolute;
  width: 1.4rem;
  height: 1.4rem;
  border: 1px solid var(--gold-bright);
  border-radius: 50%;
  background: var(--red-deep);
  content: '';
}

.preview-envelope__seal {
  position: relative;
  z-index: 1;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.66rem;
}

.preview-envelope--one {
  top: 28%;
  left: 16%;
  animation: float-one 4.8s ease-in-out infinite;
}

.preview-envelope--two {
  top: 16%;
  right: 11%;
  width: clamp(4.5rem, 8vw, 6.5rem);
  height: clamp(3.4rem, 6.2vw, 4.8rem);
  opacity: 0.72;
  transform: rotate(17deg) scale(0.82);
  animation: float-two 5.5s 0.8s ease-in-out infinite;
}

.preview-envelope--two .preview-envelope__seal {
  font-size: 0.52rem;
}

.preview-bomb {
  position: absolute;
  z-index: 3;
  top: 37%;
  right: 23%;
  display: grid;
  width: clamp(3.5rem, 6.5vw, 5rem);
  height: clamp(3.5rem, 6.5vw, 5rem);
  place-items: center;
  border: 2px solid rgba(255, 137, 150, 0.75);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 25%, #424456, #171925 52%, #0e1018);
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.35), 0 0 22px rgba(255, 137, 150, 0.14);
  animation: float-two 4.2s 0.4s ease-in-out infinite;
}

.preview-bomb__fuse {
  position: absolute;
  top: -0.9rem;
  left: 57%;
  width: 1.35rem;
  height: 1rem;
  border-top: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
  border-radius: 0 1rem 0 0;
  transform: rotate(-20deg);
}

.preview-bomb__fuse::after {
  position: absolute;
  top: -0.28rem;
  right: -0.28rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px var(--pink);
  content: '';
}

.preview-bomb__shine {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  width: 0.55rem;
  height: 0.36rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  transform: rotate(-35deg);
}

.preview-bomb__mark {
  color: var(--pink);
  font-family: var(--mono);
  font-size: 1.3rem;
}

.preview-basket {
  position: absolute;
  z-index: 4;
  bottom: 15%;
  left: 50%;
  display: grid;
  width: clamp(10rem, 19vw, 15rem);
  height: clamp(4.5rem, 8vw, 6rem);
  place-items: center;
  border: 2px solid var(--gold-bright);
  border-top: 0;
  border-radius: 0 0 1.15rem 1.15rem;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  box-shadow: 0 22px 30px rgba(0, 0, 0, 0.38), inset 0 -12px 18px rgba(74, 12, 31, 0.35);
  transform: translateX(-50%);
  animation: basket-sway 4s ease-in-out infinite;
}

.preview-basket__handle {
  position: absolute;
  top: -2.35rem;
  width: 61%;
  height: 3rem;
  border: 2px solid var(--gold);
  border-bottom: 0;
  border-radius: 5rem 5rem 0 0;
  opacity: 0.78;
}

.preview-basket__rim {
  position: absolute;
  top: -0.38rem;
  left: -0.17rem;
  width: calc(100% + 0.34rem);
  height: 0.72rem;
  border: 2px solid var(--gold-bright);
  border-radius: 0.8rem;
  background: var(--red-dark);
}

.preview-basket__body {
  position: relative;
  z-index: 1;
  margin-top: 0.85rem;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: clamp(0.86rem, 1.4vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.preview-caption {
  position: absolute;
  z-index: 4;
  right: 11%;
  bottom: 7%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: rgba(247, 240, 233, 0.56);
  font-family: var(--display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.preview-caption__line {
  display: block;
  width: 2.4rem;
  height: 1px;
  background: var(--gold);
}

.stage-gesture-status {
  position: absolute;
  z-index: 5;
  bottom: 1.45rem;
  left: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.58rem 0.72rem;
  border: 1px solid rgba(231, 187, 122, 0.25);
  color: rgba(247, 240, 233, 0.62);
  background: rgba(17, 19, 27, 0.46);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.07em;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.stage-gesture-status[data-state='open'] {
  border-color: rgba(159, 226, 195, 0.48);
  color: var(--mint);
  background: rgba(22, 61, 55, 0.34);
}

.stage-gesture-status[data-state='fist'] {
  border-color: rgba(245, 213, 156, 0.62);
  color: var(--gold-bright);
  background: rgba(91, 52, 33, 0.34);
}

.stage-gesture-status[data-state='fallback'] {
  border-color: rgba(255, 137, 150, 0.48);
  color: var(--pink);
}

.stage-gesture-status__dot {
  display: block;
  width: 0.4rem;
  height: 0.4rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

@keyframes float-one {
  0%,
  100% { transform: rotate(-16deg) translateY(0); }
  50% { transform: rotate(-12deg) translateY(-13px); }
}

@keyframes float-two {
  0%,
  100% { transform: rotate(17deg) translateY(0); }
  50% { transform: rotate(11deg) translateY(-11px); }
}

@keyframes basket-sway {
  0%,
  100% { margin-left: -1%; }
  50% { margin-left: 1%; }
}

.screen--game {
  padding: clamp(2rem, 5vh, 4rem) 0 clamp(2rem, 5vh, 4.3rem);
}

.game-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.8rem;
}

.game-heading h2 {
  margin: 0.62rem 0 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.7rem);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
}

.control-mode {
  display: inline-flex;
  min-height: 2rem;
  align-items: center;
  padding: 0.55rem 0.72rem;
  border: 1px solid rgba(231, 187, 122, 0.25);
  color: var(--gold);
  font-size: 0.54rem;
  white-space: nowrap;
}

.control-mode[data-state='ready'] {
  border-color: rgba(159, 226, 195, 0.3);
  color: var(--mint);
}

.control-mode[data-state='paused'] {
  border-color: rgba(255, 137, 150, 0.55);
  color: var(--pink);
  background: rgba(89, 24, 43, 0.25);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17.5rem;
  gap: clamp(1.2rem, 2.5vw, 2.3rem);
  align-items: start;
}

.playfield-card {
  min-width: 0;
}

.playfield-frame {
  position: relative;
  aspect-ratio: 16 / 10;
  min-height: 31rem;
  overflow: hidden;
  border: 1px solid var(--line-gold);
  background: #171b25;
  box-shadow: 0 28px 50px rgba(0, 0, 0, 0.24);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.playfield-meta {
  display: flex;
  position: absolute;
  z-index: 3;
  top: 1.15rem;
  align-items: center;
  gap: 0.45rem;
  color: rgba(247, 240, 233, 0.54);
  font-size: 0.5rem;
  pointer-events: none;
}

.playfield-meta--left {
  left: 1.35rem;
}

.playfield-meta--right {
  right: 1.35rem;
}

.playfield-meta--right span {
  color: var(--gold);
  font-size: 0.9rem;
}

.meta-dot {
  width: 0.36rem;
  height: 0.36rem;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
}

.hand-guide {
  position: absolute;
  top: 43%;
  left: 50%;
  display: grid;
  gap: 0.8rem;
  place-items: center;
  color: rgba(247, 240, 233, 0.5);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 300ms ease, transform 300ms ease;
}

.hand-guide.is-hidden {
  opacity: 0;
  transform: translate(-50%, -45%) scale(0.86);
}

.hand-guide__ring {
  display: block;
  width: 4.8rem;
  height: 4.8rem;
  border: 1px dashed rgba(231, 187, 122, 0.58);
  border-radius: 50%;
  box-shadow: 0 0 0 0.8rem rgba(231, 187, 122, 0.035);
  animation: guide-pulse 2.2s ease-in-out infinite;
}

.arming-fallback-button {
  min-height: 2rem;
  padding: 0.45rem 0.72rem;
  border: 1px solid rgba(255, 137, 150, 0.55);
  border-radius: 999px;
  color: var(--paper);
  background: rgba(89, 24, 43, 0.9);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.66rem;
  pointer-events: auto;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.arming-fallback-button:hover {
  border-color: var(--pink);
  background: rgba(143, 32, 57, 0.94);
  transform: translateY(-1px);
}

.arming-fallback-button[hidden] {
  display: none;
}

body.is-game-mode .hand-guide {
  max-width: min(92%, 34rem);
  padding: 1rem 1.35rem 1.1rem;
  border: 1px solid rgba(231, 187, 122, 0.48);
  color: var(--paper);
  background: rgba(17, 19, 27, 0.68);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2), 0 0 0 7px rgba(231, 187, 122, 0.045);
  backdrop-filter: blur(6px);
  font-size: clamp(1.1rem, 2vw, 1.85rem);
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

body.is-game-mode .hand-guide__ring {
  width: clamp(5.6rem, 9vw, 8.5rem);
  height: clamp(5.6rem, 9vw, 8.5rem);
  border-width: 2px;
  box-shadow: 0 0 0 1rem rgba(231, 187, 122, 0.045), 0 0 24px rgba(231, 187, 122, 0.16);
}

body.is-game-mode .pause-overlay__card {
  max-width: min(88vw, 34rem);
  padding: 2.1rem 2.35rem 1.9rem;
}

body.is-game-mode .pause-overlay__eyebrow,
body.is-game-mode .pause-overlay__hint {
  font-size: clamp(0.62rem, 1vw, 0.78rem);
}

body.is-game-mode .pause-overlay__icon {
  width: clamp(4rem, 8vw, 5.3rem);
  height: clamp(4rem, 8vw, 5.3rem);
  margin-top: 1.25rem;
  font-size: clamp(2.5rem, 5vw, 3.6rem);
}

body.is-game-mode .pause-overlay__card h3 {
  margin-top: 1rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

body.is-game-mode .pause-overlay__card p {
  max-width: 24rem;
  margin: 1rem 0 1.5rem;
  font-size: clamp(0.96rem, 1.65vw, 1.3rem);
  line-height: 1.7;
}

.pause-overlay {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(11, 13, 21, 0.67);
  backdrop-filter: blur(6px);
}

.pause-overlay[hidden] {
  display: none;
}

.pause-overlay__card {
  display: grid;
  max-width: 21rem;
  justify-items: center;
  padding: 1.65rem 1.8rem 1.5rem;
  border: 1px solid rgba(255, 137, 150, 0.55);
  background: linear-gradient(145deg, rgba(71, 27, 46, 0.96), rgba(23, 24, 35, 0.98));
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.34), 0 0 0 7px rgba(255, 137, 150, 0.06);
  text-align: center;
}

.pause-overlay__eyebrow,
.pause-overlay__hint {
  color: var(--pink);
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.12em;
}

.pause-overlay__icon {
  display: grid;
  width: 3.2rem;
  height: 3.2rem;
  margin: 1rem 0 0.35rem;
  place-items: center;
  border: 1px solid rgba(255, 137, 150, 0.62);
  border-radius: 50%;
  color: var(--pink);
  font-family: var(--sans);
  font-size: 2.25rem;
  line-height: 1;
  box-shadow: 0 0 26px rgba(255, 137, 150, 0.16);
}

.pause-overlay__card h3 {
  margin: 0.7rem 0 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.06em;
}

.pause-overlay__card p {
  max-width: 15rem;
  margin: 0.75rem 0 1.2rem;
  color: var(--paper-muted);
  font-size: 0.75rem;
  line-height: 1.75;
}

.pause-overlay__hint {
  color: rgba(247, 240, 233, 0.56);
  letter-spacing: 0.08em;
}

@keyframes guide-pulse {
  0%,
  100% { opacity: 0.45; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

.canvas-corner {
  position: absolute;
  z-index: 2;
  width: 1.15rem;
  height: 1.15rem;
  pointer-events: none;
}

.canvas-corner--tl {
  top: 0.85rem;
  left: 0.85rem;
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
}

.canvas-corner--tr {
  top: 0.85rem;
  right: 0.85rem;
  border-top: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
}

.canvas-corner--bl {
  bottom: 0.85rem;
  left: 0.85rem;
  border-bottom: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
}

.canvas-corner--br {
  right: 0.85rem;
  bottom: 0.85rem;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}

.playfield-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.4rem;
  padding: 1rem 0 0;
  color: var(--paper-muted);
  font-size: 0.67rem;
}

.playfield-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.playfield-footer__hint {
  margin-left: auto;
  color: rgba(201, 192, 179, 0.6);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.playfield-footer__count {
  color: rgba(231, 187, 122, 0.74);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.06em;
}

body.is-mobile-mode .camera-card {
  display: none;
}

body.is-mobile-mode .playfield-footer__hint {
  letter-spacing: 0.03em;
  text-transform: none;
}

.legend-swatch {
  display: block;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 0.16rem;
}

.legend-swatch--envelope {
  background: var(--red);
  box-shadow: 0 0 10px rgba(216, 72, 88, 0.42);
}

.legend-swatch--bomb {
  border: 1px solid var(--pink);
  border-radius: 50%;
  background: #242635;
}

.game-rail {
  display: grid;
  gap: 1rem;
}

.hud-card,
.camera-card {
  border: 1px solid var(--line);
  background: linear-gradient(140deg, rgba(34, 39, 54, 0.76), rgba(20, 23, 33, 0.76));
}

.hud-card {
  padding: 1.3rem 1.35rem;
}

.hud-card--score {
  border-color: rgba(231, 187, 122, 0.38);
  background: linear-gradient(135deg, rgba(110, 31, 50, 0.8), rgba(45, 23, 37, 0.86));
}

.hud-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--paper-muted);
  font-size: 0.68rem;
}

.hud-symbol {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border: 1px solid rgba(231, 187, 122, 0.5);
  border-radius: 50%;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 0.67rem;
}

.hud-symbol--clock {
  color: var(--mint);
  border-color: rgba(159, 226, 195, 0.48);
  font-family: var(--sans);
  font-size: 1rem;
}

.score-value {
  margin-top: 0.56rem;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: clamp(3.2rem, 6vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -0.1em;
  line-height: 0.92;
}

.score-caption {
  margin-top: 1rem;
  color: rgba(247, 240, 233, 0.58);
  font-size: 0.5rem;
}

.timer-value {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.72rem;
  color: var(--paper);
  font-family: var(--mono);
  font-size: 3rem;
  letter-spacing: -0.12em;
  line-height: 0.96;
}

.timer-value small {
  color: var(--paper-muted);
  font-size: 0.51rem;
  letter-spacing: 0.08em;
}

.timer-track {
  height: 0.22rem;
  margin-top: 1.2rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(247, 240, 233, 0.09);
}

.timer-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--gold));
  transform-origin: left center;
  transition: transform 300ms linear, background 220ms ease;
}

.timer-track span.is-warning {
  background: linear-gradient(90deg, var(--pink), var(--red));
}

.camera-card {
  overflow: hidden;
}

.camera-card__header,
.camera-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.78rem 0.9rem;
  color: rgba(247, 240, 233, 0.54);
  font-size: 0.48rem;
}

.camera-card__header {
  border-bottom: 1px solid var(--line);
}

.camera-card__footer {
  min-height: 2.5rem;
  justify-content: flex-start;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: none;
}

.camera-live-dot {
  width: 0.4rem;
  height: 0.4rem;
  background: rgba(247, 240, 233, 0.3);
}

.camera-viewport {
  position: relative;
  aspect-ratio: var(--camera-aspect-ratio, 16 / 9);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(231, 187, 122, 0.13), transparent 32%),
    #0d1018;
}

.camera-viewport::after {
  position: absolute;
  z-index: 5;
  inset: 0;
  border: 1px solid rgba(231, 187, 122, 0.35);
  box-shadow: inset 0 0 0 1px rgba(11, 13, 21, 0.35);
  content: '';
  pointer-events: none;
}

.camera-viewport video,
.camera-viewport canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.camera-viewport video {
  opacity: 0;
  background: #090c14;
  transform: scaleX(-1);
  transition: opacity 300ms ease;
}

.camera-viewport video.is-live {
  opacity: 1;
}

.camera-viewport canvas {
  z-index: 2;
  pointer-events: none;
}

.camera-placeholder {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.65rem;
  color: rgba(247, 240, 233, 0.58);
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  transition: opacity 300ms ease;
}

.camera-placeholder.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.camera-placeholder__icon {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  border: 1px solid rgba(231, 187, 122, 0.5);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 2rem;
  line-height: 1;
}

.camera-scanline {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159, 226, 195, 0.9), transparent);
  box-shadow: 0 0 14px rgba(159, 226, 195, 0.8);
  opacity: 0.26;
  animation: scan 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scan {
  0%,
  100% { transform: translateY(1rem); opacity: 0; }
  15%,
  75% { opacity: 0.5; }
  92% { transform: translateY(calc(100% - 1rem)); opacity: 0; }
}

.screen--result {
  position: relative;
  display: grid;
  min-height: calc(100svh - 144px);
  place-items: center;
  padding: 5rem 0 5.5rem;
  text-align: center;
}

.result-backdrop,
.result-content {
  grid-area: 1 / 1;
}

.result-backdrop {
  position: relative;
  width: min(90vw, 760px);
  height: min(70vw, 560px);
  pointer-events: none;
}

.result-backdrop::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 65%;
  height: 65%;
  border-radius: 50%;
  background: rgba(143, 32, 57, 0.18);
  box-shadow: 0 0 130px rgba(216, 72, 88, 0.18);
  content: '';
  transform: translate(-50%, -50%);
}

.result-ring {
  position: absolute;
  display: block;
  border: 1px solid rgba(231, 187, 122, 0.28);
  border-radius: 50%;
}

.result-ring--one {
  top: 10%;
  left: 17%;
  width: 66%;
  height: 80%;
  transform: rotate(20deg);
}

.result-ring--two {
  top: 20%;
  left: 20%;
  width: 58%;
  height: 66%;
  border-color: rgba(255, 137, 150, 0.23);
  transform: rotate(-32deg);
}

.result-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
}

.eyebrow--center {
  justify-content: center;
}

.result-kicker {
  margin: 2.5rem 0 0.55rem;
  color: var(--paper-muted);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.result-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
}

.result-score-label {
  color: var(--gold);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.result-score {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: clamp(5.8rem, 13vw, 10.5rem);
  font-weight: 500;
  letter-spacing: -0.14em;
  line-height: 0.86;
  text-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), 0 0 45px rgba(231, 187, 122, 0.16);
}

.result-message {
  margin: 1.6rem 0 2rem;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: 0.1em;
}

.result-stats {
  display: grid;
  min-width: min(92vw, 29rem);
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 2.35rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-stat {
  display: grid;
  gap: 0.38rem;
  padding: 0.95rem 1.1rem;
}

.result-stat + .result-stat {
  border-left: 1px solid var(--line);
}

.result-stat__number {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 1.55rem;
}

.result-stat__label {
  color: var(--paper-muted);
  font-size: 0.65rem;
}

.result-stat--warning .result-stat__number {
  color: var(--pink);
}

.result-gesture-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  max-width: min(92vw, 31rem);
  margin: 0 0 1.15rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(231, 187, 122, 0.28);
  color: var(--gold-bright);
  background: rgba(34, 39, 54, 0.48);
  font-family: var(--display);
  font-size: clamp(0.86rem, 1.5vw, 1.08rem);
  letter-spacing: 0.08em;
  line-height: 1.45;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.result-gesture-hint[data-state='active'] {
  border-color: rgba(159, 226, 195, 0.58);
  color: var(--mint);
  background: rgba(22, 61, 55, 0.4);
}

.result-gesture-hint__icon {
  font-family: var(--sans);
  font-size: 1.35rem;
  line-height: 1;
}

.primary-button--result {
  min-width: 11.4rem;
  margin: 0 auto;
}

.result-signoff {
  max-width: 23rem;
  margin: 1.65rem auto 0;
  color: rgba(201, 192, 179, 0.65);
  font-family: var(--display);
  font-size: 0.72rem;
  line-height: 1.75;
}

.result-confetti {
  position: absolute;
  display: block;
  width: 0.45rem;
  height: 1.3rem;
  background: var(--gold);
  animation: confetti-drift 5s ease-in-out infinite;
}

.result-confetti--one {
  top: 17%;
  left: 18%;
  transform: rotate(36deg);
}

.result-confetti--two {
  top: 26%;
  right: 17%;
  width: 0.35rem;
  height: 1.8rem;
  background: var(--pink);
  animation-delay: -1.5s;
  transform: rotate(-27deg);
}

.result-confetti--three {
  bottom: 20%;
  left: 24%;
  width: 0.35rem;
  height: 1rem;
  background: var(--mint);
  animation-delay: -2.7s;
  transform: rotate(-45deg);
}

.result-confetti--four {
  right: 23%;
  bottom: 18%;
  background: var(--red);
  animation-delay: -3.5s;
  transform: rotate(55deg);
}

@keyframes confetti-drift {
  0%,
  100% { opacity: 0.45; translate: 0 0; }
  50% { opacity: 1; translate: 10px -14px; }
}

.app-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0.85rem;
  color: rgba(201, 192, 179, 0.45);
  font-size: 0.48rem;
}

.app-footer__line {
  display: block;
  width: 2.8rem;
  height: 1px;
  background: var(--line);
}

.toast {
  position: fixed;
  z-index: 30;
  right: 1.5rem;
  bottom: 1.5rem;
  max-width: min(23rem, calc(100vw - 3rem));
  padding: 0.8rem 1rem;
  border: 1px solid rgba(231, 187, 122, 0.4);
  color: var(--paper);
  background: rgba(17, 19, 27, 0.92);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.25);
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

/* The game screen becomes a viewport-filling stage so the live camera and playfield
   stay visible on the reception display without scrolling. */
body.is-game-mode {
  overflow: hidden;
}

body.is-game-mode .game-app {
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  padding-right: clamp(1rem, 1.5vw, 2rem);
  padding-left: clamp(1rem, 1.5vw, 2rem);
}

body.is-game-mode .topbar,
body.is-game-mode .app-footer {
  display: none;
}

body.is-game-mode .screen--game {
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  padding: clamp(1rem, 2.4vh, 2rem) 0 clamp(1rem, 2.4vh, 2rem);
}

body.is-game-mode .game-heading {
  margin-bottom: clamp(0.75rem, 1.8vh, 1.35rem);
}

body.is-game-mode .game-heading h2 {
  font-size: clamp(1.8rem, 3.6vw, 3.3rem);
}

body.is-game-mode .game-layout {
  height: calc(100svh - 8.6rem);
  min-height: 0;
}

body.is-game-mode .playfield-card {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

body.is-game-mode .playfield-frame {
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: auto;
}

body.is-game-mode .playfield-footer {
  flex: 0 0 auto;
  padding-top: 0.7rem;
}

body.is-game-mode .game-rail {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto auto auto;
  align-content: start;
}

body.is-game-mode .hud-card {
  padding: 0.9rem 1.1rem;
}

body.is-game-mode .score-value {
  margin-top: 0.4rem;
  font-size: clamp(2.7rem, 5vw, 4.35rem);
}

body.is-game-mode .score-caption {
  margin-top: 0.6rem;
}

body.is-game-mode .timer-value {
  margin-top: 0.48rem;
  font-size: clamp(2.2rem, 4vw, 3.15rem);
}

body.is-game-mode .timer-track {
  margin-top: 0.7rem;
}

body.is-game-mode .camera-card {
  display: flex;
  height: auto;
  min-height: 0;
  align-self: start;
  flex-direction: column;
}

body.is-game-mode .camera-viewport {
  min-height: 0;
  flex: 0 1 auto;
  aspect-ratio: var(--camera-aspect-ratio, 16 / 9);
}

body.is-game-mode .camera-card__header,
body.is-game-mode .camera-card__footer {
  flex: 0 0 auto;
  padding-top: 0.62rem;
  padding-bottom: 0.62rem;
}

@media (max-width: 1120px) {
  .game-app {
    width: min(100% - 48px, 1440px);
  }

  .screen--intro {
    gap: 3rem;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  }

  .intro-copy h1 {
    font-size: clamp(3.5rem, 7vw, 6rem);
  }

  .playfield-frame {
    min-height: 27rem;
  }
}

@media (max-width: 900px) {
  .screen--intro {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 4rem 0 4rem;
  }

  .intro-copy {
    max-width: 680px;
  }

  .intro-stage {
    min-height: min(600px, 76vh);
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr) 15rem;
  }

  .playfield-frame {
    min-height: 24rem;
  }
}

@media (max-width: 720px) {
  .game-app {
    width: min(100% - 32px, 1440px);
  }

  .topbar {
    min-height: 78px;
  }

  .brand-subtitle {
    display: none;
  }

  .screen--intro {
    padding-top: 3.6rem;
  }

  .intro-copy h1 {
    font-size: clamp(3.25rem, 15vw, 5rem);
  }

  .rule-strip {
    gap: 0.72rem;
  }

  .rule-item {
    gap: 0.4rem;
  }

  .rule-item small {
    font-size: 0.56rem;
  }

  .rule-item strong {
    font-size: 0.92rem;
  }

  .rule-icon {
    width: 1.7rem;
    height: 1.7rem;
  }

  .intro-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro-stage {
    min-height: 29rem;
  }

  .game-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .playfield-frame {
    min-height: 0;
  }

  .game-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .camera-card {
    grid-column: 1 / -1;
    max-width: 22rem;
  }

  body.is-game-mode .screen--game {
    overflow: auto;
  }

  body.is-game-mode .game-layout {
    height: auto;
  }

  body.is-game-mode .playfield-frame {
    aspect-ratio: 16 / 10;
  }

  body.is-game-mode .game-rail {
    height: auto;
  }

  body.is-mobile-mode .screen--game {
    padding-top: 1rem;
    padding-bottom: 1.8rem;
  }

  body.is-mobile-mode .game-heading {
    gap: 0.62rem;
    margin-bottom: 0.9rem;
  }

  body.is-mobile-mode .game-heading h2 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  body.is-mobile-mode .game-layout {
    height: auto;
  }

  body.is-mobile-mode .playfield-card {
    height: auto;
  }

  body.is-mobile-mode .playfield-frame {
    height: min(62svh, 32rem);
    min-height: 24rem;
    aspect-ratio: auto;
    touch-action: none;
  }

  body.is-mobile-mode .game-rail {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  body.is-mobile-mode .hud-card {
    padding: 0.92rem 0.8rem;
  }

  body.is-mobile-mode .score-value {
    font-size: clamp(2.55rem, 13vw, 3.5rem);
  }

  body.is-mobile-mode .timer-value {
    font-size: clamp(2.15rem, 11vw, 2.9rem);
  }

  body.is-mobile-mode .hand-guide {
    max-width: 88%;
    padding: 0.78rem 0.88rem 0.9rem;
    font-size: clamp(1.04rem, 4.5vw, 1.4rem);
  }

  body.is-mobile-mode .hand-guide__ring {
    width: 5.2rem;
    height: 5.2rem;
  }

  body.is-mobile-mode .playfield-footer__hint {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 470px) {
  .game-app {
    width: min(100% - 24px, 1440px);
  }

  .connection-pill {
    max-width: 8.5rem;
    overflow: hidden;
    font-size: 0.49rem;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .rule-strip {
    align-items: flex-start;
    gap: 0.42rem;
  }

  .rule-divider {
    height: 1.7rem;
  }

  .rule-item small {
    white-space: normal;
  }

  .preview-envelope--one {
    left: 7%;
  }

  .preview-bomb {
    right: 12%;
  }

  .preview-caption {
    right: 8%;
    font-size: 0.64rem;
  }

  .playfield-footer__hint {
    width: 100%;
    margin-left: 0;
  }

  .game-rail {
    grid-template-columns: 1fr 1fr;
  }

  .hud-card {
    padding: 1rem;
  }

  .score-value {
    font-size: 3.4rem;
  }

  .timer-value {
    font-size: 2.4rem;
  }

  .result-score-wrap {
    gap: 0.6rem;
  }

  .result-score-label {
    font-size: 0.8rem;
  }

  .result-stats {
    min-width: 100%;
  }

  .result-stat {
    padding: 0.85rem 0.4rem;
  }

  .result-stat__number {
    font-size: 1.2rem;
  }

  .result-stat__label {
    font-size: 0.57rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Wedding invitation palette: warm paper, blush rose, terracotta ink, and sage accents. */
:root {
  --ink: #f8f0e7;
  --ink-2: #fffaf4;
  --ink-3: #f0dfd4;
  --paper: #704b43;
  --paper-muted: #a37e72;
  --paper-soft: #8f685e;
  --red: #ce8b83;
  --red-deep: #ae6966;
  --red-dark: #8d554f;
  --gold: #bd8b6d;
  --gold-bright: #a8665d;
  --pink: #d88e8b;
  --mint: #9aa889;
  --line: rgba(112, 75, 67, 0.16);
  --line-gold: rgba(189, 139, 109, 0.48);
}

html {
  background: #f8f0e7;
}

body {
  color: var(--paper);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(220, 174, 163, 0.26), transparent 22rem),
    radial-gradient(ellipse at 100% 12%, rgba(205, 168, 142, 0.2), transparent 24rem),
    radial-gradient(ellipse at 15% 100%, rgba(164, 180, 145, 0.16), transparent 25rem),
    var(--ink);
}

body::before {
  opacity: 0.045;
  mix-blend-mode: multiply;
}

.ambient {
  border-color: rgba(189, 139, 109, 0.16);
}

.ambient::after {
  border-color: rgba(189, 139, 109, 0.12);
}

.brand-lockup {
  color: var(--paper);
}

.brand-mark {
  color: #fffaf4;
  background: linear-gradient(145deg, #d9a59a, #bd806e);
  box-shadow: 0 8px 18px rgba(163, 91, 83, 0.18);
}

.topbar {
  border-color: var(--line);
}

.connection-pill {
  border-color: rgba(112, 75, 67, 0.18);
  color: var(--paper-muted);
  background: rgba(255, 250, 244, 0.46);
}

.connection-pill[data-state='ready'] {
  border-color: rgba(130, 155, 113, 0.45);
  color: #6e8561;
  background: rgba(225, 235, 214, 0.45);
}

.connection-pill[data-state='fallback'] {
  border-color: rgba(189, 139, 109, 0.45);
  color: var(--gold-bright);
  background: rgba(248, 231, 217, 0.52);
}

.connection-dot,
.meta-dot,
.camera-live-dot {
  background: var(--paper-muted);
}

.connection-pill[data-state='ready'] .connection-dot,
.camera-live-dot[data-state='ready'] {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(154, 168, 137, 0.12), 0 0 15px rgba(154, 168, 137, 0.55);
}

.connection-pill[data-state='fallback'] .connection-dot {
  background: var(--gold);
}

.eyebrow {
  color: var(--gold-bright);
}

.eyebrow > span,
.preview-caption__line {
  background: var(--gold);
}

.intro-description,
.fallback-note,
.privacy-note {
  color: var(--paper-muted);
}

.rule-strip {
  border-color: var(--line);
}

.rule-icon {
  border-color: var(--line-gold);
  color: var(--gold-bright);
}

.rule-item--negative .rule-icon {
  border-color: rgba(216, 142, 139, 0.58);
  color: var(--red-deep);
}

.rule-item--positive strong {
  color: var(--gold-bright);
}

.rule-item--negative strong {
  color: var(--red-deep);
}

.primary-button {
  border-color: #b9766e;
  color: #fffaf4;
  background: linear-gradient(115deg, #d99b91, #b87570);
  box-shadow: 0 14px 30px rgba(130, 76, 67, 0.2), 0 0 0 5px rgba(216, 142, 139, 0.1);
}

.primary-button:hover {
  box-shadow: 0 18px 34px rgba(130, 76, 67, 0.26), 0 0 0 7px rgba(216, 142, 139, 0.13);
}

.button-arrow {
  color: #fffaf4;
  background: var(--paper);
}

.fallback-key {
  border-color: rgba(112, 75, 67, 0.18);
  color: var(--paper-soft);
  background: rgba(255, 250, 244, 0.52);
}

.privacy-lock {
  color: var(--red);
}

.intro-stage {
  border-color: rgba(189, 139, 109, 0.52);
  background:
    radial-gradient(ellipse at 22% 12%, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(145deg, rgba(255, 250, 244, 0.94), rgba(241, 224, 214, 0.92)),
    var(--ink-2);
  box-shadow: 0 34px 65px rgba(130, 76, 67, 0.13), inset 0 0 0 9px rgba(255, 255, 255, 0.3);
}

.intro-stage::before,
.intro-stage::after,
.canvas-corner--tl,
.canvas-corner--tr,
.canvas-corner--bl,
.canvas-corner--br {
  border-color: rgba(169, 105, 93, 0.72);
}

.stage-ticker {
  color: rgba(112, 75, 67, 0.55);
}

.stage-ticker span:first-child {
  color: var(--red-deep);
}

.stage-spotlight {
  background: linear-gradient(180deg, rgba(216, 142, 139, 0.18), transparent 76%);
}

.stage-grid {
  background-image:
    linear-gradient(rgba(169, 105, 93, 0.17) 1px, transparent 1px),
    linear-gradient(90deg, rgba(169, 105, 93, 0.17) 1px, transparent 1px);
}

.stage-side-label {
  color: rgba(169, 105, 93, 0.68);
}

.stage-number {
  color: rgba(112, 75, 67, 0.13);
}

.preview-envelope {
  border-color: rgba(169, 105, 93, 0.72);
  background: linear-gradient(145deg, #e6b7ac, #cb827b 75%);
  box-shadow: 0 22px 30px rgba(130, 76, 67, 0.2), inset 0 0 0 4px rgba(174, 105, 102, 0.18);
}

.preview-envelope::before {
  border-top-color: rgba(255, 250, 244, 0.8);
  background: linear-gradient(145deg, transparent 49%, rgba(141, 85, 79, 0.25) 50%, transparent 51%);
}

.preview-envelope::after {
  border-color: #e8baa5;
  background: var(--red-deep);
}

.preview-envelope__seal,
.preview-basket__body,
.preview-caption {
  color: #fff8f0;
}

.preview-bomb {
  border-color: rgba(169, 105, 93, 0.72);
  background: radial-gradient(circle at 32% 25%, #a08075, #5f4544 52%, #3d3034);
  box-shadow: 0 20px 25px rgba(130, 76, 67, 0.2), 0 0 22px rgba(216, 142, 139, 0.16);
}

.preview-bomb__fuse {
  border-color: var(--gold);
}

.preview-bomb__mark {
  color: #f4c0b5;
}

.preview-basket {
  border-color: #e6b49d;
  background: linear-gradient(180deg, #dd9b91, #b86d6c);
  box-shadow: 0 22px 30px rgba(130, 76, 67, 0.22), inset 0 -12px 18px rgba(141, 85, 79, 0.2);
}

.preview-basket__handle,
.preview-basket__rim {
  border-color: #d2a078;
}

.preview-basket__rim {
  background: #965852;
}

.preview-caption {
  color: rgba(112, 75, 67, 0.65);
}

.stage-gesture-status {
  border-color: rgba(189, 139, 109, 0.34);
  color: rgba(112, 75, 67, 0.7);
  background: rgba(255, 250, 244, 0.68);
}

.stage-gesture-status[data-state='open'] {
  border-color: rgba(130, 155, 113, 0.48);
  color: #718760;
  background: rgba(225, 235, 214, 0.62);
}

.stage-gesture-status[data-state='fist'] {
  border-color: rgba(189, 139, 109, 0.62);
  color: var(--gold-bright);
  background: rgba(248, 231, 217, 0.72);
}

.stage-gesture-status[data-state='fallback'] {
  border-color: rgba(216, 142, 139, 0.48);
  color: var(--red-deep);
}

.game-heading h2 {
  color: var(--paper);
}

.control-mode {
  border-color: rgba(189, 139, 109, 0.35);
  color: var(--gold-bright);
  background: rgba(255, 250, 244, 0.46);
}

.control-mode[data-state='ready'] {
  border-color: rgba(130, 155, 113, 0.42);
  color: #718760;
  background: rgba(225, 235, 214, 0.42);
}

.control-mode[data-state='paused'] {
  border-color: rgba(216, 142, 139, 0.58);
  color: var(--red-deep);
  background: rgba(248, 222, 216, 0.58);
}

.playfield-frame {
  border-color: rgba(189, 139, 109, 0.55);
  background: #f5e8de;
  box-shadow: 0 28px 50px rgba(130, 76, 67, 0.13);
}

.playfield-meta {
  color: rgba(112, 75, 67, 0.6);
}

.meta-dot {
  background: var(--pink);
  box-shadow: 0 0 10px rgba(216, 142, 139, 0.55);
}

.playfield-footer {
  color: var(--paper-muted);
}

.playfield-footer__hint {
  color: rgba(112, 75, 67, 0.58);
}

.playfield-footer__count {
  color: rgba(169, 105, 93, 0.78);
}

.hud-card,
.camera-card {
  border-color: rgba(189, 139, 109, 0.25);
  background: linear-gradient(140deg, rgba(255, 250, 244, 0.9), rgba(246, 231, 222, 0.92));
  box-shadow: 0 18px 30px rgba(130, 76, 67, 0.08);
}

.hud-card--score {
  border-color: rgba(174, 105, 102, 0.48);
  background: linear-gradient(135deg, rgba(219, 163, 153, 0.92), rgba(184, 109, 108, 0.94));
}

.hud-label {
  color: rgba(112, 75, 67, 0.72);
}

.hud-card--score .hud-label,
.hud-card--score .score-caption {
  color: rgba(255, 250, 244, 0.8);
}

.hud-symbol {
  border-color: rgba(189, 139, 109, 0.48);
  color: var(--gold-bright);
}

.hud-symbol--clock {
  border-color: rgba(130, 155, 113, 0.52);
  color: #718760;
}

.score-value {
  color: #fff8f0;
  text-shadow: 0 8px 22px rgba(130, 76, 67, 0.14);
}

.score-caption {
  color: rgba(112, 75, 67, 0.58);
}

.timer-value {
  color: var(--paper);
}

.timer-value small {
  color: var(--paper-muted);
}

.timer-track {
  background: rgba(112, 75, 67, 0.1);
}

.timer-track span {
  background: linear-gradient(90deg, #a7bc91, #d2a078);
}

.timer-track span.is-warning {
  background: linear-gradient(90deg, #d88e8b, #b96c69);
}

.camera-card__header,
.camera-card__footer {
  color: rgba(112, 75, 67, 0.58);
}

.camera-card__header {
  border-color: var(--line);
}

.camera-card__footer {
  color: var(--gold-bright);
}

.camera-live-dot {
  background: rgba(112, 75, 67, 0.24);
}

.camera-viewport {
  background:
    radial-gradient(circle at 50% 45%, rgba(216, 142, 139, 0.15), transparent 32%),
    #efe0d6;
}

.camera-viewport::after {
  border-color: rgba(189, 139, 109, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 250, 244, 0.35);
}

.camera-viewport video {
  background: #ead8cf;
}

.camera-placeholder {
  color: rgba(112, 75, 67, 0.65);
}

.camera-placeholder__icon {
  border-color: rgba(189, 139, 109, 0.52);
  color: var(--gold-bright);
}

.camera-scanline {
  background: linear-gradient(90deg, transparent, rgba(130, 155, 113, 0.78), transparent);
  box-shadow: 0 0 14px rgba(130, 155, 113, 0.52);
}

.pause-overlay {
  background: rgba(255, 250, 244, 0.72);
}

.pause-overlay__card {
  border-color: rgba(174, 105, 102, 0.54);
  background: linear-gradient(145deg, rgba(255, 247, 239, 0.98), rgba(247, 222, 214, 0.98));
  box-shadow: 0 22px 45px rgba(130, 76, 67, 0.16), 0 0 0 7px rgba(216, 142, 139, 0.08);
}

.pause-overlay__eyebrow,
.pause-overlay__hint {
  color: var(--red-deep);
}

.pause-overlay__icon {
  border-color: rgba(216, 142, 139, 0.62);
  color: var(--red-deep);
  box-shadow: 0 0 26px rgba(216, 142, 139, 0.16);
}

.pause-overlay__card h3 {
  color: var(--paper);
}

.pause-overlay__card p {
  color: var(--paper-muted);
}

.pause-overlay__hint {
  color: rgba(112, 75, 67, 0.58);
}

.result-backdrop::before {
  background: rgba(216, 142, 139, 0.14);
  box-shadow: 0 0 130px rgba(216, 142, 139, 0.18);
}

.result-ring {
  border-color: rgba(189, 139, 109, 0.32);
}

.result-ring--two {
  border-color: rgba(216, 142, 139, 0.28);
}

.result-kicker,
.result-signoff,
.result-stat__label {
  color: var(--paper-muted);
}

.result-score-label {
  color: var(--gold-bright);
}

.result-score {
  color: var(--red-deep);
  text-shadow: 0 10px 28px rgba(130, 76, 67, 0.15), 0 0 45px rgba(216, 142, 139, 0.16);
}

.result-message {
  color: var(--paper);
}

.result-stats,
.result-stat + .result-stat {
  border-color: var(--line);
}

.result-stat__number {
  color: var(--gold-bright);
}

.result-stat--warning .result-stat__number {
  color: var(--red-deep);
}

.result-gesture-hint {
  border-color: rgba(189, 139, 109, 0.3);
  color: var(--gold-bright);
  background: rgba(255, 250, 244, 0.62);
}

.result-gesture-hint[data-state='active'] {
  border-color: rgba(130, 155, 113, 0.55);
  color: #718760;
  background: rgba(225, 235, 214, 0.68);
}

.result-signoff {
  color: rgba(112, 75, 67, 0.65);
}

.app-footer {
  color: rgba(112, 75, 67, 0.45);
}

.app-footer__line {
  background: var(--line);
}

.toast {
  border-color: rgba(189, 139, 109, 0.42);
  color: var(--paper);
  background: rgba(255, 250, 244, 0.94);
  box-shadow: 0 18px 36px rgba(130, 76, 67, 0.16);
}

.result-layout {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 1120px);
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
}

.result-backdrop {
  position: absolute;
  top: 50%;
  left: 35%;
  z-index: 0;
  width: min(72vw, 760px);
  height: min(64vw, 560px);
  transform: translate(-50%, -50%);
}

.result-content {
  z-index: 2;
  grid-area: auto;
}

.leaderboard-panel {
  position: relative;
  z-index: 3;
  min-width: 0;
  padding: 1.35rem;
  border: 1px solid rgba(189, 139, 109, 0.36);
  background: rgba(255, 250, 244, 0.74);
  box-shadow: 0 20px 45px rgba(130, 76, 67, 0.1);
  backdrop-filter: blur(10px);
}

.leaderboard-panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.leaderboard-panel__eyebrow,
.leaderboard-panel__status {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.leaderboard-panel__status {
  max-width: 6rem;
  color: var(--paper-muted);
  line-height: 1.5;
  text-align: right;
  text-transform: none;
}

.leaderboard-panel__status[data-state='error'] {
  color: var(--red-deep);
}

.leaderboard-panel h3 {
  margin: 0.45rem 0 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.06em;
}

.leaderboard-list {
  display: grid;
  max-height: 25rem;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.58rem 0.62rem;
  border: 1px solid rgba(112, 75, 67, 0.1);
  background: rgba(255, 255, 255, 0.46);
}

.leaderboard-row--current {
  border-color: rgba(130, 155, 113, 0.46);
  background: rgba(225, 235, 214, 0.58);
}

.leaderboard-row__rank {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.leaderboard-row__name {
  min-width: 0;
  overflow: hidden;
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row__score {
  color: var(--red-deep);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.leaderboard-empty {
  padding: 1.25rem 0.4rem;
  color: var(--paper-muted);
  font-family: var(--display);
  font-size: 0.86rem;
  text-align: center;
}

.confetti-canvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.name-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.name-modal[hidden] {
  display: none;
}

.name-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(112, 75, 67, 0.28);
  backdrop-filter: blur(8px);
}

.name-modal__card {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 30rem);
  padding: clamp(1.6rem, 4vw, 2.5rem);
  border: 1px solid rgba(189, 139, 109, 0.55);
  background: linear-gradient(145deg, #fffaf4, #f5e1d7);
  box-shadow: 0 30px 70px rgba(112, 75, 67, 0.25), 0 0 0 8px rgba(255, 250, 244, 0.18);
}

.name-modal__eyebrow {
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.12em;
}

.name-modal__card h2 {
  margin: 0.8rem 0 0;
  color: var(--paper);
  font-family: var(--display);
  font-size: clamp(1.8rem, 5vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -0.07em;
}

.name-modal__card > p {
  margin: 0.85rem 0 1.55rem;
  color: var(--paper-muted);
  font-size: 0.83rem;
  line-height: 1.75;
}

.name-modal__card label {
  margin-bottom: 0.5rem;
  color: var(--paper-soft);
  font-family: var(--display);
  font-size: 0.85rem;
}

.name-modal__card input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0 1rem;
  border: 1px solid rgba(189, 139, 109, 0.45);
  border-radius: 0;
  outline: 0;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.58);
  font: 500 0.95rem var(--sans);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.name-modal__card input::placeholder {
  color: rgba(163, 126, 114, 0.62);
}

.name-modal__card input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(216, 142, 139, 0.14);
}

.name-modal__error {
  min-height: 1.2rem;
  margin: 0.48rem 0 0 !important;
  color: var(--red-deep) !important;
  font-size: 0.7rem !important;
}

.name-modal__actions {
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1rem;
}

.ghost-button {
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 0;
  color: var(--paper-muted);
  background: transparent;
  cursor: pointer;
  font: 600 0.76rem var(--sans);
}

.ghost-button:hover {
  color: var(--paper);
}

.primary-button--modal {
  min-width: 10.5rem;
  min-height: 3.25rem;
}

@media (max-width: 900px) {
  .result-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .result-content {
    width: min(100%, 38rem);
    margin: 0 auto;
  }

  .leaderboard-panel {
    width: min(100%, 38rem);
    margin: 0 auto;
  }

  .result-backdrop {
    left: 50%;
  }
}

@media (max-width: 470px) {
  .result-gesture-hint {
    max-width: 100%;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
  }

  .leaderboard-panel {
    padding: 1rem;
  }

  .name-modal__actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .ghost-button,
  .primary-button--modal {
    width: 100%;
  }
}

/* High-contrast guidance card for the reception display. */
body.is-game-mode .hand-guide {
  border-color: rgba(174, 105, 102, 0.62);
  color: #704b43;
  background: rgba(255, 250, 244, 0.96);
  box-shadow: 0 16px 32px rgba(112, 75, 67, 0.16), 0 0 0 8px rgba(216, 142, 139, 0.12);
  text-shadow: none;
}

body.is-game-mode .hand-guide__ring {
  border-color: rgba(189, 139, 109, 0.88);
  box-shadow: 0 0 0 1rem rgba(189, 139, 109, 0.12), 0 0 24px rgba(189, 139, 109, 0.2);
}

body.is-game-mode .arming-fallback-button {
  border-color: rgba(174, 105, 102, 0.68);
  color: #fffaf4;
  background: #ae6966;
}

.name-modal__error[data-state='checking'],
.name-modal__error[data-state='warning'] {
  color: var(--gold-bright) !important;
}

.name-modal__error[data-state='success'] {
  color: #718760 !important;
}

/* Homepage live ranking preview and quieter invitation-style hero. */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2.2vw, 2rem);
}

.topbar-link {
  color: var(--paper-muted);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 180ms ease, transform 180ms ease;
}

.topbar-link span {
  display: inline-block;
  margin-left: 0.3rem;
  color: var(--red-deep);
  font-family: var(--sans);
  font-size: 0.9rem;
  transition: transform 180ms ease;
}

.topbar-link:hover {
  color: var(--paper);
  transform: translateY(-1px);
}

.topbar-link:hover span {
  transform: translate(2px, -2px);
}

.intro-copy h1 {
  font-size: clamp(3.1rem, 6.2vw, 6.1rem);
  line-height: 0.96;
}

.stage-leaderboard {
  position: absolute;
  z-index: 6;
  bottom: 1.35rem;
  left: 1.35rem;
  width: min(46%, 18rem);
  padding: 0.95rem 1rem 0.8rem;
  border: 1px solid rgba(189, 139, 109, 0.46);
  background: rgba(255, 250, 244, 0.9);
  box-shadow: 0 16px 28px rgba(112, 75, 67, 0.12);
  backdrop-filter: blur(8px);
}

.stage-leaderboard__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(112, 75, 67, 0.12);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stage-leaderboard__header span:last-child {
  color: var(--paper-muted);
  letter-spacing: 0.04em;
  text-transform: none;
}

.stage-leaderboard__header span:last-child[data-state='error'] {
  color: var(--red-deep);
}

.stage-leaderboard h2 {
  margin: 0.58rem 0 0.4rem;
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.07em;
}

.stage-leaderboard__list {
  display: grid;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage-leaderboard__row {
  display: grid;
  grid-template-columns: 1.45rem minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.24rem 0;
  border-bottom: 1px solid rgba(112, 75, 67, 0.08);
}

.stage-leaderboard__row:last-child {
  border-bottom: 0;
}

.stage-leaderboard__rank,
.stage-leaderboard__score {
  color: var(--red-deep);
  font-family: var(--mono);
  font-size: 0.58rem;
}

.stage-leaderboard__name {
  min-width: 0;
  overflow: hidden;
  color: var(--paper);
  font-family: var(--display);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-leaderboard__empty {
  padding: 0.25rem 0;
  color: var(--paper-muted);
  font-size: 0.65rem;
}

.stage-leaderboard__link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.55rem;
  color: var(--red-deep);
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.stage-leaderboard__link span {
  font-family: var(--sans);
  font-size: 0.76rem;
}

.stage-gesture-status {
  left: auto;
  right: 1.35rem;
}

@media (max-width: 720px) {
  .topbar-actions {
    gap: 0.75rem;
  }

  .topbar-link {
    font-size: 0.5rem;
  }

  .stage-leaderboard {
    width: min(58%, 16rem);
    padding: 0.8rem 0.82rem 0.68rem;
  }

  .stage-gesture-status {
    right: 0.85rem;
    bottom: 0.9rem;
    max-width: 34%;
    overflow: hidden;
    white-space: nowrap;
  }
}
