:root {
  color-scheme: dark;
  font: 16px/1.45 system-ui, sans-serif;
  color: #f5f6ff;
  background: #080b1b;
  --muted: #bdc5e3;
  --edge: #ffffff28;
  --accent: #bdcaff;
  --brand-accent: #ffc078;
  --card-width: clamp(80px, 12vw, 155px);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; isolation: isolate; overflow-x: hidden; }
[hidden] { display: none !important; }
.aurora {
  position: fixed; z-index: -1; inset: -18%; pointer-events: none;
  background: radial-gradient(ellipse at 68% 28%, #36399087, transparent 42%),
    radial-gradient(ellipse at 83% 75%, #69367276, transparent 42%),
    radial-gradient(ellipse at 27% 53%, #101942, transparent 58%), #080b1b;
  animation: drift 21s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(-4%, 4%, 0) scale(1.09); } }
button, input { font: inherit; color: inherit; }
button {
  background: #ffffff0f; border: 1px solid var(--edge); border-radius: 12px;
  padding: .62rem 1rem; cursor: pointer; transition: background .2s, border-color .2s, translate .2s;
}
button:hover:not(:disabled) { background: #ffffff22; border-color: #b6c4ff85; translate: 0 -2px; }
button:active:not(:disabled) { translate: 0 1px; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid #c1ccff; outline-offset: 4px; }
input { width: 100%; min-width: 0; padding: .72rem .85rem; border: 1px solid var(--edge); border-radius: 11px; background: #0306177a; }
input::placeholder { color: #a7afcc; opacity: 1; }
.primary, .primary:hover:not(:disabled) { background: #bdcaff; color: #10183b; font-weight: 750; }
.primary:hover:not(:disabled) { background: #d7dfff; }
.top {
  min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: .55rem; padding: .8rem clamp(.8rem, 3.2vw, 3rem); position: relative; z-index: 4;
  border-bottom: 1px solid #ffffff0e; background: #080b1b46;
}
.brand { font-weight: 900; letter-spacing: -.055em; display: flex; align-items: center; gap: .55rem; white-space: nowrap; }
.brand-much { color: var(--brand-accent); }
.brand-mark { width: 28px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 6px; background: var(--brand-accent); color: #28182b; font-size: 1.18rem; transform: rotate(9deg); }
.pill { border-radius: 999px; font-size: .88rem; color: var(--muted); white-space: nowrap; grid-column: 2; }
.pill strong { color: white; margin-left: .4rem; letter-spacing: .14em; }
.quiet { grid-column: 3; justify-self: end; color: #ffd3da; background: #6d25442c; }
.home {
  width: min(940px, 100%); margin: auto; min-height: calc(100svh - 68px); display: grid;
  grid-template-columns: 1fr 1fr; align-items: center; gap: 4rem; padding: 2rem 2.5rem 4rem;
}
h1 { margin: 0; font-size: clamp(3rem, 7vw, 6.25rem); letter-spacing: -.085em; line-height: .96; }
h1 span { color: #9babff; }
.wordmark { display: flex; align-items: center; gap: .09em; font-size: clamp(2.7rem, 6.7vw, 6rem); font-weight: 950; white-space: nowrap; }
.wordmark > span { color: inherit; }
.wordmark .wordmark-accent {
  display: inline-block; padding: .035em .13em .10em .09em; border-radius: .13em;
  color: #182312; background: var(--brand-accent); transform: translateY(-.06em) rotate(-8deg);
  box-shadow: .06em .07em 0 #182348; line-height: .92;
}
p, small { color: var(--muted); }
.intro p { margin: 1.15rem 0 2rem; max-width: 30ch; font-size: 1.12rem; }
form { display: grid; gap: .7rem; max-width: 360px; }
form label { font-size: .9rem; font-weight: 650; }
.code-field { display: grid; gap: .45rem; }
.mode-switch { width: 100%; margin-top: .18rem; color: var(--muted); background: transparent; }
#join-code { text-transform: uppercase; }
#join-code::placeholder { text-transform: none; }
.intro small { display: block; margin-top: 1.2rem; }
.showcase { height: clamp(210px, 40vw, 430px); position: relative; display: grid; place-items: center; }
.card {
  overflow: hidden; position: relative; flex: none; width: var(--card-width); aspect-ratio: 0.7;
  border: 1px solid #7089b976; border-radius: clamp(8px, 1.15vw, 17px);
  display: grid; place-items: center; color: #f6f7ff;
  background-color: #0e1933;
  background-image: linear-gradient(139deg, #455d9a37, transparent 62%),
    repeating-linear-gradient(45deg, #ffffff05 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, #00000018 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 0 3px #a9bdff0a, 0 10px 24px #0204158a;
}
.card span { position: absolute; top: 6%; left: 9%; color: #d8e0ff; font-size: clamp(.78rem, 1.55vw, 1.4rem); font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.card span:last-child { transform: rotate(180deg); top: auto; left: auto; bottom: 5%; right: 8%; }
.card b { font-size: clamp(1.6rem, 5vw, 4.65rem); line-height: 1; letter-spacing: -.075em; font-variant-numeric: tabular-nums; padding-right: .07em; }
.showcase .card { position: absolute; --card-width: clamp(112px, 23vw, 235px); }
.showcase-back { transform: translateX(-23%) rotate(-16deg); }
.showcase-front { transform: translateX(17%) rotate(9deg); animation: float 5s ease-in-out infinite alternate; }
.showcase-front span { color: var(--brand-accent); }
@keyframes float { to { transform: translate(17%, -3%) rotate(12deg); } }
.lobby { max-width: 500px; margin: min(13vh, 105px) auto 2rem; padding: 2rem; }
.lobby h1 { font-size: clamp(3rem, 8vw, 5rem); }
.lobby ul { padding: 0; display: grid; gap: .55rem; margin: 1.4rem 0; list-style: none; }
.lobby li { display: flex; justify-content: space-between; align-items: center; min-height: 46px; gap: .5rem; border: 1px solid var(--edge); border-radius: 10px; padding: .6rem .85rem; background: #080b1b70; overflow-wrap: anywhere; }
.lobby li span { color: var(--muted); font-size: .875rem; white-space: nowrap; }
#notice {
  position: fixed; z-index: 10; bottom: 18px; left: 50%; translate: -50% 0; width: max-content; max-width: 90vw;
  padding: .66rem 1rem; background: #151d3c; border: 1px solid #a1aef18c; border-radius: 12px; box-shadow: 0 4px 20px #0007;
}
@media (max-width: 650px) {
  .home { grid-template-columns: 1fr; gap: .8rem; align-content: center; padding: 1.5rem 1.6rem 3rem; }
  .showcase { height: 180px; }
  .intro { max-width: 360px; width: 100%; margin: auto; }
  .intro p { margin: .8rem 0 1.1rem; }
  .card b { font-size: clamp(1.65rem, 7vw, 3.25rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}

.wordmark { font-size: clamp(2.2rem, 5.2vw, 4.65rem); }
.wordmark .wordmark-accent { color: #281a24; }
.showcase-front b { color: var(--brand-accent); font-size: clamp(3rem, 8vw, 7rem); }
fieldset {
  display: grid; gap: .55rem; min-width: 0; margin: 0 0 1.15rem; padding: .8rem 1rem 1rem;
  border: 1px solid var(--edge); border-radius: 12px; background: #080b1b66;
}
legend { padding: 0 .4rem; font-weight: 750; color: var(--brand-accent); }
fieldset label { color: var(--muted); font-size: .9rem; }
select { width: 100%; padding: .65rem .75rem; background: #111731; color: inherit; border: 1px solid var(--edge); border-radius: 9px; font: inherit; }
.range-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; margin-top: .35rem; }
.range-fields input { display: block; margin-top: .2rem; }
.guess-table { width: min(1050px, 100%); margin: auto; padding: clamp(1.5rem, 5vh, 3.9rem) 1rem 2rem; text-align: center; }
.range-label { margin: 0 0 1.25rem; font-size: .9rem; }
.number-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(.55rem, 2.5vw, 1.6rem); }
.number-tile { width: min(43%, 200px); min-width: 122px; display: grid; align-content: start; gap: .55rem; }
.number-tile h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.number-tile.active h3 { color: var(--brand-accent); }
.number-face { width: 100%; aspect-ratio: .76; transition: border-color .25s, box-shadow .25s; }
.number-face b { font-size: clamp(1.4rem, 4.4vw, 2.9rem); }
.number-tile.active .number-face { border-color: var(--brand-accent); box-shadow: 0 0 25px #ffc07838, 0 12px 25px #0204158a; }
.number-tile.dealt { animation: deal-in .5s both cubic-bezier(.15,.7,.25,1); }
.number-tile.dealt:nth-child(2) { animation-delay: 65ms; }
.number-tile.dealt:nth-child(3) { animation-delay: 130ms; }
.number-tile.dealt:nth-child(4) { animation-delay: 195ms; }
@keyframes deal-in { from { opacity: 0; transform: translateY(18px) rotate(-5deg); } }
.turn-panel { margin: 1.6rem auto 0; }
.turn-panel h2 { font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 0; letter-spacing: -.05em; }
#turn-message { margin: .45rem auto 1rem; max-width: 52ch; }
#turn-controls { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: .8rem; }
#guess-form { display: flex; gap: .45rem; }
#guess-form input { width: min(140px, 36vw); }
@media (max-width: 430px) {
  .top { gap: .35rem; padding-inline: .5rem; }
  .brand { gap: .25rem; font-size: .75rem; }
  .brand-mark { width: 25px; }
  .pill, .quiet { padding-inline: .55rem; font-size: .8rem; }
  .number-face { aspect-ratio: 1; }
  .number-face b { font-size: clamp(1.35rem, 6vw, 2.4rem); }
}

.showcase-back b { font-size: clamp(1.05rem, 3.3vw, 2.85rem); }
.showcase-back span { font-size: clamp(.55rem, 1.05vw, .95rem); letter-spacing: .13em; }
.showcase-front {
  border-color: #ffc0788c;
  background-color: #211b36;
  background-image: radial-gradient(ellipse at 75% 12%, #dd865b38, transparent 70%),
    repeating-linear-gradient(45deg, #ffffff06 0 1px, transparent 1px 3px);
}
.wordmark .wordmark-accent { transform: translateY(-.05em) rotate(-5deg); }
