:root {
  color-scheme: dark;
  font: 16px/1.45 system-ui, sans-serif;
  color: #f5f6ff;
  background: #080b1b;
  --muted: #bdc5e3;
  --edge: #ffffff28;
  --accent: #bdcaff;
  --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%, #2646ab83, transparent 42%),
    radial-gradient(ellipse at 83% 75%, #54309269, 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: 760; display: flex; align-items: center; gap: .65rem; }
.mark { color: #c4cfff; font-size: 1.15rem; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid #aebeff56; border-radius: 9px; transform: rotate(-8deg); }
.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; }
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; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: .6rem; }
#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: 5%; left: 8%; color: #bfcaf3; font-size: clamp(.85rem, 2vw, 1.75rem); line-height: 1; }
.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; }
@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; }
.table { position: relative; min-height: max(540px, calc(100svh - 68px)); overflow: hidden; }
.round-label { position: absolute; top: 13px; left: clamp(.8rem, 3.2vw, 3rem); font-size: .88rem; color: var(--muted); }
.center { position: absolute; z-index: 1; left: 50%; top: 45%; translate: -50% -50%; display: grid; justify-items: center; }
.pile {
  --card-width: clamp(100px, min(15vw, 23vh), 180px);
  width: var(--card-width); aspect-ratio: .7; position: relative; border: 1px dashed #b6c4ff56;
  border-radius: 15px; display: grid; place-items: center; background: #0d15384d; color: #c2cbec; font-size: .85rem;
}
.pile .card { position: absolute; }
.pile .card:nth-last-child(3) { transform: translate(-8%, 2%) rotate(-10deg); }
.pile .card:nth-last-child(2) { transform: translate(-5%, -2%) rotate(-4deg); }
.pile .card:last-child { transform: rotate(7deg); }
#round-message { position: absolute; top: 100%; margin-top: 1.15rem; width: max-content; max-width: min(56vw, 360px); min-height: 2.9em; text-align: center; font-weight: 600; }
#round-message[data-tone="failed"] { color: #ffc2ce; }
#round-message[data-tone="cleared"], #round-message[data-tone="won"] { color: #bcf6db; }
#again { position: absolute; top: calc(100% + 4.5rem); white-space: nowrap; }
.your-seat { position: absolute; bottom: clamp(.6rem, 3vh, 2rem); left: 50%; translate: -50% 0; width: min(88vw, 1040px); text-align: center; }
.your-seat > span { display: block; margin-bottom: .65rem; color: var(--muted); font-size: .875rem; }
.hand { display: flex; justify-content: center; gap: clamp(.35rem, 1.3vw, 1rem); overflow-x: auto; padding: .85rem .65rem .6rem; }
.hand.dense { justify-content: safe center; }
.hand.dense .card { --card-width: clamp(60px, 8vw, 90px); }
.hand.dense .card b { font-size: clamp(1.45rem, 4vw, 2.5rem); }
.hand .card { --card-width: clamp(66px, min(12vw, 17vh), 145px); padding: 0; transition: transform .18s ease, box-shadow .18s, border-color .18s, opacity .18s; }
.hand .card:hover:not(:disabled), .hand .card:focus-visible {
  translate: none; transform: translateY(-8px) rotate(var(--tilt, 0deg)) scale(1.035);
  border-color: #d0daff; box-shadow: 0 1px 18px #98aeff60, 0 14px 28px #0204159e;
}
.hand .card.pending { opacity: .55; transform: translateY(-5px); }
.hand .card:disabled:not(.pending) { opacity: .78; }
.seat { position: absolute; display: grid; justify-items: center; gap: .42rem; color: var(--muted); font-size: .875rem; text-align: center; }
.seat strong { color: #f1f3ff; font-weight: 650; overflow-wrap: anywhere; max-width: 18ch; }
.seat.north { top: 12px; left: 50%; translate: -50% 0; }
.seat.west { left: clamp(.4rem, 3vw, 3rem); top: 43%; translate: 0 -50%; }
.seat.east { right: clamp(.4rem, 3vw, 3rem); top: 43%; translate: 0 -50%; }
.backs { display: flex; flex-direction: row; gap: 4px; align-items: center; }
.west .backs, .east .backs { flex-direction: column; }
.backs .card { --card-width: clamp(24px, 4vw, 46px); border-radius: 6px; box-shadow: 0 4px 12px #0204158a; }
.west .backs .card, .east .backs .card { aspect-ratio: 1.4; width: clamp(32px, 5vw, 61px); }
.backs .card b { font-size: clamp(.78rem, 1.9vw, 1.25rem); color: #b9c9f8; }
.flying { position: fixed; z-index: 8; pointer-events: none; margin: 0; }
.flying.miss { border-color: #f894a9; box-shadow: 0 0 28px #e8688570; }
#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; }
  .seat strong { max-width: 10ch; }
  .seat.north { top: 27px; }
  .table { min-height: max(500px, calc(100svh - 68px)); }
  .card b { font-size: clamp(1.65rem, 7vw, 3.25rem); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}
