:root {
  color-scheme: light;
  --forest: #173a30;
  --forest-deep: #102b24;
  --cream: #f7f4ec;
  --paper: #fffefa;
  --red: #bd5b49;
  --gold: #c69a55;
  --muted: #8d9286;
  --line: #e9e7dc;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--forest);
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255,255,255,.82), transparent 49%),
    var(--cream);
  font-family: "DM Sans", sans-serif;
}
button, input { font: inherit; }
.page-shell { min-height: 100vh; overflow: hidden; position: relative; }
.topbar {
  height: 74px; padding: 0 7.1%; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid rgba(23,58,48,.08);
}
.brand { color: var(--forest); display: inline-flex; gap: 9px; align-items: center; text-decoration: none; font-size: 19px; letter-spacing: -.7px; }
.brand strong { font-weight: 700; }
.brand-mark { color: var(--red); font-size: 25px; }
.season-label { color: #788078; font-size: 9px; font-weight: 700; letter-spacing: 1.8px; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #83a474; vertical-align: 1px; margin-right: 7px; box-shadow: 0 0 0 3px #83a47422; }
main { width: min(100% - 32px, 600px); margin: 0 auto; padding: 61px 0 44px; }
.intro { text-align: center; margin-bottom: 31px; }
.eyebrow { color: var(--red); font-size: 9px; line-height: 1.5; letter-spacing: 2px; font-weight: 700; margin: 0 0 14px; }
h1 { color: var(--forest); font: 600 clamp(45px, 8vw, 64px)/.99 "Playfair Display", Georgia, serif; letter-spacing: -2px; margin: 0; }
h1 em { color: var(--red); font-weight: 500; }
.intro-copy { color: #717970; font-size: 13px; line-height: 1.7; margin: 17px 0 0; }
.game-card {
  width: min(100%, 458px); margin: 0 auto; background: var(--paper); border: 1px solid #eeece4;
  border-radius: 9px; padding: 23px 27px 0; box-shadow: 0 16px 46px #213c2910, 0 2px 6px #213c2908;
}
.card-topline { display: flex; justify-content: space-between; align-items: center; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.step-label, .card-footer { color: #9a9d92; font-size: 8px; letter-spacing: 1.6px; font-weight: 700; }
.lock-mark { color: var(--gold); font-size: 16px; }
h2 { font: 600 26px/1.2 "Playfair Display", Georgia, serif; letter-spacing: -.45px; margin: 22px 0 8px; }
.card-copy { color: #7d8279; font-size: 12px; line-height: 1.7; margin: 0; }
form { margin-top: 21px; }
label { display: block; color: var(--forest); font-weight: 700; font-size: 10px; letter-spacing: .2px; margin-bottom: 8px; }
.input-row { display: flex; gap: 9px; }
input {
  width: 100%; color: var(--forest); border: 1px solid #e6e5dc; background: #fff;
  border-radius: 5px; padding: 12px 13px; font-size: 12px; outline: none; transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: #b2b4ac; }
input:focus { border-color: #93a69a; box-shadow: 0 0 0 3px #173a3010; }
.join-button, .start-button {
  flex: 0 0 auto; color: #fff; background: var(--forest); border: 0; border-radius: 5px;
  padding: 0 17px; min-height: 40px; font-size: 11px; font-weight: 700; cursor: pointer;
  transition: background .2s, transform .2s;
}
.join-button:hover, .start-button:hover { background: #285447; transform: translateY(-1px); }
.join-button span, .start-button span { margin-left: 11px; }
.form-note { color: #a0a39a; font-size: 9px; margin: 10px 0 0; }
.card-footer { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 24px; padding: 15px 0 16px; font-size: 7px; letter-spacing: 1.35px; }
.card-footer span:last-child { color: var(--red); font-size: 12px; margin-top: -3px; }
.hidden { display: none !important; }
.welcome-row { display: flex; align-items: center; gap: 12px; margin-top: 23px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #f5e9d8; color: var(--red); font: 600 17px "Playfair Display", Georgia, serif; }
.welcome-row h2 { margin: 0; font-size: 23px; }
.small-muted { color: #92958b; font-size: 10px; margin: 0 0 3px; }
.checkmark { display: grid; place-items: center; width: 22px; height: 22px; margin-left: auto; border-radius: 50%; background: #eaf1e7; color: #62815c; font-size: 12px; }
.wait-copy { margin-top: 17px; }
.shuffle-board {
  position: relative; display: grid; place-items: center; min-height: 166px;
  margin: 9px -5px 5px;
}
.name-deck-stage {
  position: relative; width: min(100%, 304px); outline: none; isolation: isolate;
}
.name-deck-stage:focus-visible { border-radius: 8px; outline: 2px solid #c69a55; outline-offset: 3px; }
.name-deck { width: 100%; }
.deck-label {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #8e927f; font-size: 8px; letter-spacing: 1.7px; font-weight: 700;
  margin: 0 0 5px;
}
.deck-label span { color: var(--gold); font-size: 10px; }
.card-stack {
  position: relative; width: min(100%, 270px); height: 139px; margin: 0 auto;
  transform-style: flat;
}
.deck-playing-card {
  position: absolute; top: 50%; left: 50%; width: min(78%, 218px); height: 116px;
  transform-origin: 50% 50%;
  transition: transform .68s cubic-bezier(.22,.72,.24,1);
  will-change: transform;
}
.deck-card-face {
  position: absolute; inset: 0; overflow: hidden; border-radius: 8px;
  border: 1px solid #c8b783; pointer-events: none; transition: opacity .16s ease;
}
.deck-card-back {
  z-index: 1; opacity: 1;
  background-color: #244c3e;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 8px, #ffffff10 8px 9px),
    repeating-linear-gradient(-45deg, transparent 0 8px, #ffffff10 8px 9px);
  box-shadow: 0 4px 8px #173a3020;
}
.deck-card-back::before {
  content: "✳"; position: absolute; inset: 6px; display: grid; place-items: center;
  border: 1px solid #d9c99b77; border-radius: 5px; color: #ddcca066; font-size: 20px;
}
.deck-card-front {
  z-index: 2; opacity: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 30px 17px; border-color: #d8c99f;
  background: linear-gradient(145deg, #fffefa, #f6f1e5);
  box-shadow: 0 6px 13px #173a3025, inset 0 0 0 4px #ffffffa6;
}
.deck-card-front::before {
  content: ""; position: absolute; inset: 8px; border: 1px solid #e8e1d3; border-radius: 4px;
  pointer-events: none;
}
.deck-card-pip { position: absolute; top: 13px; left: 16px; color: var(--red); font: 700 12px Georgia, serif; }
.deck-card-kicker {
  position: relative; z-index: 1; color: #9c947f; font-size: 7px; letter-spacing: 1.4px; font-weight: 700;
}
.deck-card-name {
  position: relative; z-index: 1; max-width: 100%; margin: 8px 0 6px; overflow: hidden;
  color: var(--forest); font: 600 22px/1.1 "Playfair Display", Georgia, serif;
  text-align: center; text-overflow: ellipsis; white-space: nowrap;
}
.deck-card-footer { position: relative; z-index: 1; color: #b0a78e; font-size: 7px; letter-spacing: 1.3px; }
.deck-position-0 { z-index: 5; transform: translate(-50%, -50%) translate(-3px, -1px) rotate(-1deg); }
.deck-position-0 .deck-card-front { opacity: 1; }
.deck-position-0 .deck-card-back { opacity: 0; }
.deck-position-1 { z-index: 4; transform: translate(-50%, -50%) translate(5px, 5px) rotate(1deg); }
.deck-position-2 { z-index: 3; transform: translate(-50%, -50%) translate(10px, 10px) rotate(2.5deg); }
.deck-position-3 { z-index: 2; transform: translate(-50%, -50%) translate(15px, 15px) rotate(4deg); }
.deck-position-4 { z-index: 1; transform: translate(-50%, -50%) translate(20px, 20px) rotate(5.5deg); }
.deck-playing-card.moving-from-depth { animation: deep-card-travel 1.45s cubic-bezier(.3,.05,.22,1) both; }
.deck-playing-card.moving-from-depth .deck-card-back { animation: hide-card-back 1.45s ease both; }
.deck-playing-card.moving-from-depth .deck-card-front { animation: reveal-card-front 1.45s ease both; }
.name-deck-tooltip {
  position: absolute; z-index: 12; left: 50%; bottom: calc(100% - 8px);
  width: min(280px, calc(100vw - 76px)); padding: 12px 14px 13px;
  color: #f8f5e9; background: #173a30; border: 1px solid #31574b;
  border-radius: 7px; box-shadow: 0 10px 24px #102b2438;
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, 7px); transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.name-deck-tooltip::after {
  content: ""; position: absolute; left: 50%; bottom: -5px; width: 9px; height: 9px;
  background: #173a30; border-right: 1px solid #31574b; border-bottom: 1px solid #31574b;
  transform: translateX(-50%) rotate(45deg);
}
.name-deck-stage:hover .name-deck-tooltip, .name-deck-stage:focus .name-deck-tooltip {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.tooltip-heading { display: block; color: #d7bd85; font-size: 8px; font-weight: 700; letter-spacing: 1.5px; margin-bottom: 8px; }
.tooltip-names { display: flex; flex-wrap: wrap; gap: 5px; max-height: 135px; overflow: auto; }
.tooltip-name { padding: 4px 7px; border-radius: 20px; color: #edf0e7; background: #ffffff12; font-size: 9px; }
.tooltip-empty { color: #d5d9ce; font: italic 11px "Playfair Display", Georgia, serif; }
.people-count { text-align: center; color: #969a91; font-size: 9px; padding-bottom: 1px; }
.people-icon { color: var(--red); margin-right: 5px; font-size: 13px; }
.draw-heading { text-align: center; padding: 26px 0 17px; }
.draw-sparkle { display: block; color: var(--gold); font-size: 27px; margin-bottom: 9px; }
.draw-heading .small-muted { letter-spacing: 1.5px; font-size: 8px; font-weight: 700; }
.draw-heading h2 { margin: 7px 0 0; font-size: 24px; }
.reveal-card {
  isolation: isolate; position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; width: min(100%, 218px); min-height: 116px;
  margin: 0 auto; border: 1px solid #d8c99f; border-radius: 8px;
  background: linear-gradient(145deg, #fffefa, #f6f1e5);
  box-shadow: 3px 4px 0 #e4dece, 6px 8px 0 #d6cfbf, 9px 12px 0 #eee9dc, 0 10px 20px #173a3020;
  animation: card-arrive .55s cubic-bezier(.2,.8,.2,1) both;
}
.reveal-card::before, .reveal-card::after {
  content: ""; position: absolute; z-index: 1; pointer-events: none;
}
.reveal-card::before {
  inset: 7px; border: 1px solid #e8e1d3; border-radius: 4px;
}
.reveal-card::after {
  content: "♦"; top: 13px; left: 15px; color: var(--red); font: 700 11px Georgia, serif;
}
.reveal-card > * {
  position: relative; z-index: 2;
}
.reveal-card.shuffling { animation: reveal-riffle .34s ease-in-out infinite alternate; }
.reveal-card.shuffling .reveal-name { color: #a8834d; filter: blur(.35px); }
.reveal-star { color: var(--gold); font-size: 12px; }
.reveal-name { color: var(--forest); font: 600 29px "Playfair Display", Georgia, serif; margin: 4px 0; }
.reveal-caption { color: #898b7d; font-size: 9px; }
.secret-note { color: #8e8f83; text-align: center; font-size: 9px; margin: 14px 0 1px; }
.secret-note span { color: var(--red); margin-right: 4px; }
.bottom-note { text-align: center; margin: 19px 0; color: #999b91; font: italic 12px "Playfair Display", Georgia, serif; }
.admin-key {
  position: fixed; right: 24px; bottom: 23px; display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid #deded3; border-radius: 50%; background: #fffefa; color: #748176; cursor: pointer;
  box-shadow: 0 4px 14px #18352b13; transition: transform .2s, color .2s, box-shadow .2s;
}
.admin-key:hover { color: var(--red); transform: rotate(-10deg); box-shadow: 0 6px 18px #18352b20; }
.admin-key svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; padding: 20px; background: #10241fc2; backdrop-filter: blur(4px); animation: fade-in .2s both; }
.admin-panel { position: relative; width: min(100%, 410px); padding: 29px; border-radius: 9px; background: var(--paper); box-shadow: 0 24px 80px #0003; animation: panel-in .25s cubic-bezier(.2,.8,.2,1) both; }
.modal-close { position: absolute; top: 14px; right: 16px; color: #8a9188; border: 0; background: none; font-size: 23px; cursor: pointer; }
.admin-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; margin-bottom: 17px; background: #f7eee2; color: var(--gold); font-size: 18px; }
.admin-panel .eyebrow { margin-bottom: 7px; font-size: 8px; }
.admin-panel h2 { font-size: 23px; margin: 0 0 8px; }
.admin-panel .card-copy { font-size: 11px; }
.admin-roster { margin: 19px 0 18px; border: 1px solid var(--line); border-radius: 5px; padding: 12px; }
.roster-head { display: flex; justify-content: space-between; color: #969a91; font-size: 8px; letter-spacing: 1.3px; font-weight: 700; }
.roster-head span:last-child { color: var(--red); }
.roster-list { color: #7d8279; font-size: 10px; line-height: 1.9; margin-top: 7px; max-height: 100px; overflow: auto; }
.roster-name { display: inline-block; color: #64746a; background: #f2f3ed; border-radius: 20px; padding: 4px 9px; margin: 4px 4px 0 0; }
.admin-panel form { margin-top: 0; }
.admin-panel input { min-height: 40px; }
.start-button { width: 100%; margin-top: 10px; min-height: 42px; }
.error-message { color: #b5473e; font-size: 10px; margin: 7px 0 0; }
.admin-footnote { color: #a0a39a; font-size: 9px; text-align: center; margin: 12px 0 0; }
.toast { position: fixed; z-index: 10; top: 20px; left: 50%; transform: translateX(-50%); background: var(--forest-deep); color: white; border-radius: 5px; padding: 11px 16px; font-size: 11px; box-shadow: 0 8px 24px #0002; }
@keyframes float-in { from { opacity: 0; transform: translateY(7px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes card-arrive { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes deep-card-travel {
  0% { z-index: 2; transform: translate(-50%, -50%) translate(15px, 15px) rotate(4deg); }
  24% { z-index: 2; transform: translate(-50%, -50%) translate(50px, 13px) rotate(6deg); }
  34% { z-index: 20; transform: translate(-50%, -50%) translate(76px, 7px) rotate(7deg); }
  52% { z-index: 20; transform: translate(-50%, -50%) translate(88px, -26px) rotate(4deg); }
  76% { z-index: 20; transform: translate(-50%, -50%) translate(36px, -42px) rotate(-2deg); }
  100% { z-index: 20; transform: translate(-50%, -50%) translate(-3px, -1px) rotate(-1deg); }
}
@keyframes hide-card-back {
  0%, 38% { opacity: 1; }
  52%, 100% { opacity: 0; }
}
@keyframes reveal-card-front {
  0%, 42% { opacity: 0; }
  56%, 100% { opacity: 1; }
}
@keyframes reveal-riffle {
  from { transform: translateY(-2px) rotate(-1deg); }
  to { transform: translateY(2px) rotate(1deg); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes shuffle-glow { 50% { box-shadow: inset 0 0 32px #c69a5526; } }
@media (max-width: 540px) {
  .topbar { height: 62px; padding: 0 20px; }
  main { padding-top: 45px; }
  .game-card { padding: 19px 20px 0; }
  .admin-key { right: 15px; bottom: 15px; }
  .admin-panel { padding: 24px 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
