:root {
  color-scheme: dark;
  --bg: #14101c;
  --text: #f7efff;
  --muted: #b7a9c5;
  --purple: #caa3fb;
  --line: #ffffff19;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(ellipse at 42% 0, #24152f, transparent 53%), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.bar { min-height: 67px; padding: 0 max(5%, calc((100% - 1150px) / 2)); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand, .bar-actions { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 750; white-space: nowrap; letter-spacing: -.025em; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #d7afff; color: #28123a; font-size: 23px; }
main { max-width: 1150px; margin: auto; padding: 28px 22px 12px; }
.heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 17px; }
.eyebrow, .occupancy, .caption, .hand-header, footer { font-size: 13px; color: var(--muted); }
.eyebrow { margin: 0 0 3px; display: flex; gap: 7px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #f9ba6c; }
.dot.online { background: #79e4b7; box-shadow: 0 0 10px #79e4b777; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); letter-spacing: -.065em; line-height: 1.02; }
.occupancy { border: 1px solid var(--line); border-radius: 100px; padding: 8px 13px; margin: 0 0 2px; white-space: nowrap; }
.table-shell { padding: clamp(8px, 1.6vw, 17px); border: 1px solid #9a72c666; border-radius: clamp(30px, 7vw, 100px); background: linear-gradient(160deg, #553566, #261936 60%, #40274f); box-shadow: 0 16px 55px #08050cb0, inset 0 0 0 4px #150f214a; }
.felt { position: relative; isolation: isolate; min-height: clamp(330px, 43vw, 445px); border: 1px solid #d5a1ff39; border-radius: clamp(24px, 6vw, 85px); background: radial-gradient(ellipse at 50% 46%, #5b3b73, #3c2754 52%, #2c1e41 89%); box-shadow: inset 0 10px 24px #10092084; }
.felt::before { content: ""; z-index: -1; position: absolute; inset: 12%; border: 1px solid #d8c0fb20; border-radius: 45%; background: repeating-linear-gradient(45deg, transparent 0 5px, #ffffff06 6px 7px); mask-image: radial-gradient(ellipse, #000 50%, #0009); }
.seats { position: absolute; inset: 0; list-style: none; margin: 0; padding: 0; }
.seat { position: absolute; min-width: 115px; max-width: 150px; display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 100px; background: #21172e; border: 1px solid #ae89d042; box-shadow: 0 4px 12px #10081866; font-size: 13px; }
.seat:nth-child(1) { left: 50%; bottom: 10px; transform: translateX(-50%); }
.seat:nth-child(2) { left: 3%; top: 54%; }
.seat:nth-child(3) { left: 17%; top: 15px; }
.seat:nth-child(4) { right: 17%; top: 15px; }
.seat:nth-child(5) { right: 3%; top: 54%; }
.avatar { flex: 0 0 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #20172a; background: var(--seat-tint, #43344d); font-weight: 800; }
.seat.empty .avatar { color: #a590b7; }
.seat-copy { min-width: 0; }
.seat-copy strong, .seat-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-copy small { color: var(--muted); font-size: 11px; }
.seat.active { border-color: #efc1ff; box-shadow: 0 0 18px #eeacff55; }
.seat.last { border-color: #ffb595; }
.table-center { position: absolute; left: 50%; top: 50%; width: min(390px, 68%); transform: translate(-50%, -50%); text-align: center; }
.fan { --width: clamp(57px, 8.6vw, 101px); display: flex; width: max-content; margin: 0 auto 15px; padding-left: calc(var(--width) * .34); }
.fan .card { width: var(--width); margin-left: calc(var(--width) * -.34); box-shadow: 4px 9px 16px #100b18b5; }
.fan .card:nth-child(1) { transform: translateY(11px) rotate(-23deg); }
.fan .card:nth-child(2) { transform: translateY(-4px) rotate(-8deg); }
.fan .card:nth-child(3) { transform: translateY(-4px) rotate(9deg); }
.fan .card:nth-child(4) { transform: translateY(12px) rotate(23deg); }
.card { --ink: #c69bf5; width: 87px; aspect-ratio: 0.72; display: inline-block; vertical-align: middle; position: relative; overflow: hidden; border: 2px solid var(--ink); border-radius: 12px; background-color: #2a1740; color: #fff; font-weight: 900; box-shadow: 0 5px 11px #0f0818ab; padding: 0; flex: none; }
.card.art, .card.preview { background-image: url("./portraits.png"); background-size: 400% 400%; background-position: calc(100% * var(--col) / 3) calc(100% * var(--row) / 3); }
.card.art::before, .card.preview::before { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 46%, #130b1dcf); }
.card i, .card b { position: absolute; font-style: normal; text-shadow: 0 2px 6px #000; }
.card b { top: 3px; left: 5px; font-size: 15px; }
.card i { bottom: 2px; right: 7px; line-height: 1; font-size: 32px; }
.card.back { background: repeating-linear-gradient(130deg, #322044 0 6px, #392650 6px 12px); border-color: #9c79c7; }
.card.back span { position: absolute; display: grid; place-items: center; inset: 12%; border: 1px solid #b78be593; border-radius: 50%; color: #e2bcff; font-size: 37px; }
.card.wild { background: conic-gradient(from 25deg, #334d9e, #245244, #9b652e, #8b305e, #334d9e); }
.card.wild::before { content: ""; position: absolute; inset: 12%; border: 1px solid #ffffff70; border-radius: 50%; background: #1e1532aa; }
.card.wild i { inset: 0; display: grid; place-items: center; font-size: 48px; }
.stacks { display: flex; gap: 26px; justify-content: center; }
.caption { display: block; margin-top: 6px; white-space: nowrap; }
.table-status { min-height: 20px; margin: 13px 0 10px; font-size: 15px; font-weight: 650; }
.primary, .quiet { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; font-weight: 650; background: #ffffff0a; }
.quiet:hover { background: #ffffff18; }
.primary { padding: 10px 21px; border-color: transparent; background: #d7afff; color: #271238; box-shadow: 0 4px 17px #e0b2ff3f; }
.primary:hover { background: #ead2ff; }
.primary:disabled { opacity: .48; }
#deck:not(:disabled):hover { filter: brightness(1.28); }
.hand-area { margin-top: 18px; border-top: 1px solid var(--line); }
.hand-header { display: flex; justify-content: space-between; gap: 8px; }
.hand-header p { margin: 11px 0 3px; }
.hand { min-height: 135px; display: flex; justify-content: safe center; align-items: end; gap: 7px; overflow-x: auto; padding: 13px 4px 8px; }
.hand .card { width: clamp(58px, 8.2vw, 91px); transition: transform .18s ease, filter .18s ease; }
.hand .card:disabled { filter: saturate(.72) brightness(.8); }
.hand .card:not(:disabled):hover, .hand .card:not(:disabled):focus-visible { transform: translateY(-9px); filter: brightness(1.15); }
.hand.dealing .card { animation: deal .45s cubic-bezier(.16,.76,.26,1) both; animation-delay: calc(var(--i) * 70ms); }
.hand .new-card { animation: deal .38s ease-out both; }
@keyframes deal { from { opacity: 0; transform: translate(35px, -100px) rotate(14deg) scale(.7); } to { opacity: 1; transform: none; } }
.flying { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; border-radius: inherit; }
.flying > .card { position: absolute; left: var(--from-x); top: var(--from-y); margin: 0; animation: drop .36s ease-in both; }
@keyframes drop { from { opacity: .6; transform: translate(-50%, -50%) rotate(-24deg) scale(.53); } to { opacity: 1; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(0) scale(1); } }
.callout, .notice { z-index: 5; border: 1px solid #ffb587a8; background: #342032; box-shadow: 0 8px 30px #130a1bab; color: #fff3e2; padding: 10px 14px; border-radius: 11px; font-weight: 750; text-align: center; }
.callout { position: absolute; left: 50%; bottom: 65px; width: max-content; max-width: 90%; transform: translateX(-50%); animation: callout .24s ease-out both; }
.notice { position: fixed; bottom: 20px; right: 20px; max-width: min(380px, 90vw); }
@keyframes callout { from { opacity: 0; margin-bottom: -10px; } to { opacity: 1; margin-bottom: 0; } }
footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 45px; padding: 10px 0; }
dialog { color: var(--text); border: 1px solid #7d62a2; border-radius: 16px; max-width: min(440px, 92vw); width: 100%; padding: 20px; background: #261b35; box-shadow: 0 24px 65px #08040ca8; }
dialog::backdrop { background: #0c0815b0; }
dialog h2 { margin: 0 30px 12px 0; }
dialog p, dialog dd { color: var(--muted); line-height: 1.43; }
dialog dt { font-weight: 700; }
dialog dd { margin: 0 0 8px 0; }
.close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 25px; }
label { display: block; margin-bottom: 5px; }
input { width: 100%; background: #171020; color: var(--text); border: 1px solid #8463a2; border-radius: 8px; padding: 11px; margin-bottom: 10px; }
#join-error { color: #ffb3af; margin: 0 0 10px; }
.color-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.color-options button { background: var(--ink); color: #120e1c; }
.watch-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border: 1px solid #d5a1ff60; border-radius: 50%; color: #e7c6ff; font-size: 24px; }
.watch-status { margin: 0 0 12px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.exit-screen { min-height: 100dvh; display: grid; align-content: center; justify-items: center; gap: 24px; padding: 22px; text-align: center; }
.victory {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: 0; border: 0; border-radius: 0; overflow: auto;
  background: radial-gradient(ellipse at 50% 35%, #4f2b68, #21152e 50%, #130d1c 82%);
}
.victory[open] { display: grid; }
.victory::backdrop { background: #130d1c; }
.victory-panel {
  width: min(100%, 560px); margin: auto; padding: clamp(24px, 6vw, 56px) 20px;
  text-align: center; animation: victory-reveal .38s cubic-bezier(.16,.76,.26,1) both;
}
.victory-emblem {
  display: inline-grid; place-items: center; width: 72px; height: 72px; margin-bottom: 16px;
  border: 1px solid #f4cb8373; border-radius: 50%; color: #ffda95;
  background: #f3b35a14; box-shadow: 0 0 55px #ffbc5344; font-size: 41px;
}
.victory h2 { margin: 0; font-size: clamp(38px, 10vw, 78px); line-height: 1; letter-spacing: -.065em; }
.victory .victory-name { margin: 12px 0 20px; font-size: clamp(23px, 6vw, 42px); font-weight: 750; color: #ffdc9c; overflow-wrap: anywhere; }
.victory .victory-ready { margin: 0 0 16px; font-size: 13px; }
.victory-actions { display: grid; gap: 8px; width: min(100%, 320px); margin: 0 auto; padding: 0; border: 0; }
.victory-actions button { min-height: 44px; }
.victory-actions:disabled { opacity: .7; }
.victory-actions .victory-exit { color: #ffc4c4; }
.victory .victory-error { margin: 12px 0 0; color: #ffc4c4; }
@keyframes victory-reveal { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@media (max-width: 650px) {
  main { padding: 19px 10px 8px; }
  .bar { min-height: 55px; padding: 0 10px; }
  .bar-actions, .brand { gap: 5px; }
  .bar-actions button { padding: 7px; font-size: 11px; }
  .brand { font-size: 13px; }
  .seat { min-width: 0; max-width: 100px; gap: 4px; padding: 4px; font-size: 11px; }
  .avatar { flex-basis: 21px; height: 21px; }
  .seat-copy small { font-size: 9px; }
  .seat:nth-child(2) { left: 4px; top: 30%; }
  .seat:nth-child(3) { left: 11%; top: 13px; }
  .seat:nth-child(4) { right: 11%; top: 13px; }
  .seat:nth-child(5) { right: 4px; top: 30%; }
  .table-center { top: 57%; }
  .table-status { font-size: 13px; }
  .stacks { gap: 16px; }
  .stacks .card, .flying .card { width: 62px; }
  .hand { min-height: 105px; }
  .hand-header { font-size: 11px; }
  .callout { bottom: 48px; font-size: 12px; padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
}
