@font-face { font-family: 'Cinzel'; src: url(/fonts/cinzel.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Nunito'; src: url(/fonts/nunito.woff2) format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
  --bg1: #3a1670;
  --bg2: #150a32;
  --panel: rgba(28, 14, 62, 0.82);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(246, 201, 69, 0.28);
  --gold: #f6c945;
  --gold-2: #ffe8a0;
  --gold-3: #b8780f;
  --text: #f7f2ff;
  --muted: #b9acd9;
  --felt1: #22479e;
  --felt2: #0f2461;
  --danger: #ff5d6c;
  --ok: #43d17a;
  --cw: 92px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #5a2aa0 0%, var(--bg1) 35%, var(--bg2) 100%) fixed;
  color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { min-height: 100%; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 0.85rem; }
.small-caps { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; }
.warn { color: #ffb4a8; }
kbd { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: .8em; }

/* ---------- logo ---------- */
.logo { display: flex; flex-direction: column; align-items: center; user-select: none; }
.logo-crown { width: 150px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
.logo-word { display: flex; flex-direction: column; align-items: center; line-height: .9; margin-top: 10px; }
.logo-five { font-family: 'Cinzel'; font-weight: 700; letter-spacing: .6em; margin-right: -.6em; font-size: 1.05rem; color: var(--gold-2); }
.logo-crowns {
  font-family: 'Cinzel'; font-weight: 900; font-size: 4rem; letter-spacing: .04em;
  background: linear-gradient(180deg, #fff6cf 0%, #f6c945 45%, #c98a12 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5b3406) drop-shadow(0 8px 16px rgba(0,0,0,.5));
}
.logo-md .logo-crown { width: 96px; }
.logo-md .logo-crowns { font-size: 2.6rem; }
.logo-md .logo-five { font-size: .8rem; }
.logo-sm { flex-direction: row; gap: 6px; }
.logo-sm .logo-crown { width: 34px; }
.logo-sm .logo-word { margin: 0; align-items: flex-start; }
.logo-sm .logo-five { font-size: .5rem; letter-spacing: .4em; }
.logo-sm .logo-crowns { font-size: 1.15rem; filter: drop-shadow(0 1px 0 #5b3406); }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); border-radius: 12px;
  padding: 10px 18px; font-weight: 800; transition: transform .1s, background .15s, box-shadow .15s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #ffe38a, #f2b705 55%, #c98a12); color: #3a2104; border-color: #fff0b3;
  box-shadow: 0 4px 0 #7a4a05, 0 10px 24px rgba(242,183,5,.25); text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #fff0b3, #f6c945 55%, #d99a1e); }
.btn.primary:active:not(:disabled) { box-shadow: 0 2px 0 #7a4a05; transform: translateY(2px); }
.btn.big { padding: 13px 26px; font-size: 1.08rem; }
.btn.small { padding: 6px 12px; font-size: .9rem; border-radius: 9px; }
.btn.danger { border-color: rgba(255,93,108,.5); color: #ffc2c8; }
.link { background: none; border: 0; color: var(--gold-2); text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.icon-btn { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; font-size: 1.05rem; }
.icon-btn:hover { background: rgba(255,255,255,.15); }
.chip { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 4px 12px; font-size: .85rem; font-weight: 800; }
.chip.on { background: var(--gold); color: #3a2104; border-color: var(--gold-2); }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--muted); font-weight: 800; }
.tag.gold { background: rgba(246,201,69,.18); color: var(--gold-2); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field span { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
input, select {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 11px 14px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,201,69,.2); }
select { padding: 6px 10px; border-radius: 9px; }

/* ---------- home ---------- */
.home { max-width: 1040px; margin: 0 auto; padding: 36px 16px 30px; }
.home.narrow { max-width: 460px; }
.hero { text-align: center; margin-bottom: 26px; animation: rise .6s both; }
.hero.small { margin-bottom: 16px; }
.tagline { font-family: 'Cinzel'; font-weight: 700; color: var(--gold-2); opacity: .9; margin: 12px 0 0; font-size: 1.05rem; letter-spacing: .02em; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(8px);
}
.panel h2 { font-family: 'Cinzel'; font-weight: 900; margin: 0 0 14px; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.home-grid > * { min-width: 0; }
.home-grid > .panel:first-child { grid-column: 1 / -1; display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.home-grid > .panel:first-child .field { flex: 1; min-width: 220px; margin: 0; }
.mode { display: flex; flex-direction: column; gap: 14px; animation: rise .6s .1s both; }
.mode .btn.big { margin-top: auto; }
.mode-icon { font-size: 1.5rem; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.label { min-width: 88px; color: var(--muted); font-size: .9rem; }
.stepper { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 0; background: rgba(255,255,255,.1); font-size: 1.2rem; font-weight: 800; }
.stepper button:disabled { opacity: .3; }
.stepper b { width: 30px; text-align: center; font-size: 1.15rem; }
.opp-preview { display: flex; gap: 2px; font-size: 1.35rem; }
.opp-preview span { animation: pop .3s both; }
.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 800; color: var(--muted); }
.seg button.on { background: var(--gold); color: #3a2104; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.15); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: .4em; font-weight: 900; font-size: 1.2rem; text-align: center; min-width: 0; }
.resume { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; border-color: var(--gold); }
.resume small { color: var(--muted); font-weight: 600; }
.home-foot { text-align: center; margin-top: 20px; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,255,255,.15); border-top-color: var(--gold); margin: 30px auto 12px; animation: spin 0.9s linear infinite; }
.code-inline { font-family: 'Cinzel'; letter-spacing: .2em; color: var(--gold-2); }

/* ---------- lobby ---------- */
.lobby { max-width: 760px; margin: 0 auto; padding: 26px 16px; }
.lobby-head { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.big-code { font-family: 'Cinzel'; font-weight: 900; font-size: 3rem; letter-spacing: .18em; color: var(--gold); line-height: 1; text-shadow: 0 3px 0 #5b3406; }
.invite { flex: 1; min-width: 260px; }
.invite-row { display: flex; gap: 8px; margin-top: 6px; }
.invite-row input { flex: 1; min-width: 0; font-size: .9rem; }
.seat-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.seat-row { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 8px 12px; animation: rise .3s both; }
.seat-row.me { border-color: var(--line); }
.seat-row.open { opacity: .45; border-style: dashed; }
.seat-row .av { font-size: 1.6rem; width: 40px; height: 40px; display: grid; place-items: center; background: rgba(0,0,0,.25); border-radius: 50%; }
.seat-row .nm { flex: 1; font-weight: 800; }
.seat-row em { color: var(--muted); font-style: normal; font-weight: 600; }
.bot-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.lobby-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* ---------- dots ---------- */
.dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }

/* ---------- game layout ---------- */
.game { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
.game > * { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: rgba(10,4,28,.45); border-bottom: 1px solid var(--line); }
.logo-btn { background: none; border: 0; padding: 0; }
.pills { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.pill { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 999px; padding: 5px 14px; font-size: .92rem; white-space: nowrap; }
.pill b { font-size: 1.05rem; }
.wild-pill { background: linear-gradient(180deg, rgba(246,201,69,.3), rgba(246,201,69,.12)); border-color: var(--gold); }
.wild-pill b { color: var(--gold-2); }
.round-track { display: flex; gap: 4px; }
.round-track i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.15); }
.round-track i.done { background: var(--gold-3); }
.round-track i.now { background: var(--gold); box-shadow: 0 0 0 3px rgba(246,201,69,.3); }
.top-actions { display: flex; gap: 6px; }

.seats { display: flex; justify-content: center; gap: 10px; padding: 12px 12px 0; flex-wrap: wrap; }
.seat {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 8px 12px 8px 8px; min-width: 150px;
  transition: box-shadow .25s, border-color .25s, transform .25s;
}
.seat.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(246,201,69,.5), 0 0 28px rgba(246,201,69,.35); transform: translateY(2px) scale(1.03); }
.seat.out { border-color: #8ef0b3; }
.seat-av { position: relative; font-size: 1.7rem; width: 46px; height: 46px; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #6d3fc0, #2a1060); border-radius: 50%; border: 2px solid rgba(246,201,69,.55); grid-row: span 2; }
.seat-av.sm { width: 40px; height: 40px; font-size: 1.45rem; }
.dealer { position: absolute; bottom: -4px; right: -6px; font-size: .62rem; font-weight: 900; background: #fff; color: #3a1670; border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; border: 2px solid var(--gold); }
.out-crown { position: absolute; top: -14px; font-size: 1.1rem; animation: bob 1.4s ease-in-out infinite; }
.seat-name { font-weight: 900; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.seat-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.seat-fan { grid-column: 1 / -1; display: flex; justify-content: center; height: 32px; margin-top: 6px; padding-left: 14px; }
.seat-fan .card.mini { --cw: 22px; margin-left: -14px; transform: rotate(calc((var(--i) - var(--n) / 2) * 3deg)); transform-origin: 50% 120%; flex: none; }
.seat-count { display: none; }
.thinking { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #3a2104; font-size: .68rem; font-weight: 900; padding: 1px 9px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: .06em; }
.bubble { position: absolute; top: -18px; right: -6px; font-size: 1.8rem; background: #fff; border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: pop .35s cubic-bezier(.2,1.6,.4,1) both; z-index: 5; }
.me-bubble { top: -26px; left: 50%; right: auto; }

.table { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px; min-height: 0; }
.felt {
  position: relative; width: min(760px, 100%); height: 100%; max-height: 420px; min-height: 210px;
  background: radial-gradient(ellipse at 50% 40%, var(--felt1), var(--felt2) 75%);
  border-radius: 180px; border: 6px solid #2b1257; box-shadow: 0 0 0 3px var(--gold-3), inset 0 0 60px rgba(0,0,0,.5), 0 24px 50px rgba(0,0,0,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px 30px;
}
.felt::before { content: ''; position: absolute; inset: 10px; border-radius: 170px; border: 1px dashed rgba(246,201,69,.2); pointer-events: none; }
.piles { display: flex; gap: 36px; align-items: flex-end; --cw: clamp(64px, 12vh, 104px); }
.pile-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pile-label { font-size: .75rem; color: rgba(255,255,255,.7); letter-spacing: .08em; text-transform: uppercase; }
.deck, .discard { position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * .09); }
.deck .card, .discard .card { position: absolute; inset: 0; }
.deck .under2 { transform: translate(4px, 4px); }
.deck .under1 { transform: translate(2px, 2px); }
.discard .under { transform: rotate(-7deg) translate(-4px, 2px); filter: brightness(.85); }
.card.empty { background: rgba(0,0,0,.2); border: 2px dashed rgba(255,255,255,.25); box-shadow: none; }
.can-draw { cursor: pointer; }
.can-draw .top, .can-draw > .card:last-child { animation: glow 1.6s ease-in-out infinite; }
.can-draw:hover .top { transform: translateY(-6px); }
.discard.drop-target { outline: 2px dashed rgba(246,201,69,.6); outline-offset: 8px; border-radius: 12px; }
.discard.drop-hover { outline: 3px solid var(--gold); outline-offset: 10px; }
.status { font-size: 1rem; text-align: center; min-height: 1.5em; padding: 4px 14px; border-radius: 999px; background: rgba(0,0,0,.25); max-width: 100%; }
.status.mine { background: rgba(246,201,69,.2); color: var(--gold-2); box-shadow: 0 0 0 1px rgba(246,201,69,.4); }
.status.final { background: rgba(67,209,122,.16); }
.out-melds { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.out-title { font-size: .8rem; color: var(--gold-2); font-weight: 800; }
.melds { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.meld { display: flex; }
.meld .card.tiny + .card.tiny { margin-left: -14px; }
.log { position: absolute; right: 16px; bottom: 14px; width: 240px; font-size: .76rem; color: rgba(255,255,255,.6); display: flex; flex-direction: column; gap: 2px; pointer-events: none; text-align: right; }
.log div:last-child { color: rgba(255,255,255,.9); }

.me-area { position: relative; padding: 8px 12px 10px; background: linear-gradient(180deg, rgba(10,4,28,0), rgba(10,4,28,.6) 30%); border-top: 1px solid rgba(246,201,69,.15); }
.me-bar { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.me-id { display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 999px; }
.me-id.active { background: rgba(246,201,69,.18); box-shadow: 0 0 0 2px rgba(246,201,69,.5); }
.meter { font-size: .9rem; background: rgba(0,0,0,.3); padding: 5px 14px; border-radius: 999px; }
.meter b { color: var(--gold-2); }
.meter .go { color: #8ef0b3; }
.sorts { display: flex; gap: 6px; align-items: center; font-size: .85rem; }
.hand { --step: calc(var(--cw) * .5); --gap: 0px; min-width: 0; position: relative; display: flex; justify-content: center; align-items: flex-end; padding: 26px 12px 6px; min-height: calc(var(--cw) * 1.42 + 34px); touch-action: none; user-select: none; }
.hand .card { flex: none; margin-left: calc(var(--step) - var(--cw)); cursor: grab; transition: transform .16s ease, box-shadow .16s ease; }
.hand .card:first-child { margin-left: 0; }
.hand .card.group-start { margin-left: calc(var(--step) - var(--cw) + var(--gap)); }
.hand .card:hover { transform: translateY(-10px); z-index: 2; }
.hand .card.selected { transform: translateY(-24px); box-shadow: 0 0 0 3px var(--gold), 0 14px 26px rgba(0,0,0,.5); z-index: 3; }
.hand .card.fresh::before { content: 'NEW'; position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #43d17a; color: #062b14; font: 900 .6rem 'Nunito'; padding: 1px 6px; border-radius: 999px; z-index: 2; letter-spacing: .08em; }
.hand .card.goout::after { content: '👑'; position: absolute; top: -16px; right: -6px; font-size: 1.1rem; animation: bob 1.2s ease-in-out infinite; }
.hand .card.grouped { box-shadow: 0 5px 0 -1px var(--gold-3), 0 6px 14px rgba(0,0,0,.35); }
.hand .card.dragging { transition: none; z-index: 60; cursor: grabbing; box-shadow: 0 24px 40px rgba(0,0,0,.55); }
.hand.dealing .card { animation: deal .45s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 55ms); }
.insert-marker { position: absolute; top: 18px; bottom: 4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 12px var(--gold); pointer-events: none; }
.hand-actions { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 40px; flex-wrap: wrap; }
.hint-line { font-size: .82rem; }
.emotes { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 2px; background: rgba(0,0,0,.3); border-radius: 999px; padding: 3px; }
.emotes button { background: none; border: 0; font-size: 1.15rem; width: 32px; height: 32px; border-radius: 50%; }
.emotes button:hover { background: rgba(255,255,255,.12); transform: scale(1.15); }

/* ---------- cards ---------- */
.card {
  --r: calc(var(--cw) * .09);
  position: relative; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: var(--r);
  background: linear-gradient(160deg, #ffffff 0%, #fbf7ee 60%, #efe6d2 100%);
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.35); color: var(--sc, #222);
  border: 1px solid rgba(0,0,0,.15); overflow: visible;
}
.card .suit-icon { fill: currentColor; display: block; }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .9; }
.card .corner.tl { top: 5%; left: 6%; }
.card .corner.br { bottom: 5%; right: 6%; transform: rotate(180deg); }
.card .rank { font-family: 'Cinzel'; font-weight: 900; font-size: calc(var(--cw) * .25); letter-spacing: -.04em; }
.card .corner .suit-icon { width: calc(var(--cw) * .15); height: calc(var(--cw) * .15); margin-top: 2px; }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; }
.card .pip .suit-icon { width: 46%; height: 46%; filter: drop-shadow(0 2px 1px rgba(0,0,0,.18)); }
.card.s-stars .pip .suit-icon { stroke: #b27d00; stroke-width: 3; }
.card .face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card .face-crown { width: 46%; fill: currentColor; opacity: .92; }
.card .face-letter { font-family: 'Cinzel'; font-weight: 900; font-size: calc(var(--cw) * .38); line-height: 1; margin-top: -2%; }
.card.wild { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(246,201,69,.55), 0 6px 14px rgba(0,0,0,.35); background: linear-gradient(160deg, #fffdf2 0%, #fff4cf 70%, #f8e2a0 100%); }
.card .ribbon {
  position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); white-space: nowrap;
  background: linear-gradient(180deg, #ffe38a, #f2b705); color: #3a2104; font: 900 calc(var(--cw) * .085) 'Nunito';
  padding: 1px calc(var(--cw) * .06); border-radius: 999px; letter-spacing: .04em; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.card.joker { background: radial-gradient(circle at 50% 35%, #fff 0%, #f4ecff 60%, #e2d3ff 100%); color: #5b2aa8; }
.card.joker .jk { font-size: calc(var(--cw) * .13); color: #f2b705; }
.card.joker .rank { font-size: calc(var(--cw) * .2); }
.card .joker-art { position: absolute; left: 18%; right: 18%; top: 14%; }
.card .joker-art svg { width: 100%; display: block; }
.card .joker-word { position: absolute; left: 0; right: 0; top: 64%; text-align: center; font-family: 'Cinzel'; font-weight: 900; font-size: calc(var(--cw) * .14); letter-spacing: .08em; color: #5b2aa8; }
.card.joker .ribbon { bottom: 9%; }
.card.joker .corner.br { display: none; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(246,201,69,.22) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(246,201,69,.22) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 50% 45%, #6a35c4, #2b0f63 80%);
  border: calc(var(--cw) * .05) solid #fdf6e3; color: var(--gold);
}
.back-inner { position: absolute; inset: 5%; border: 1px solid rgba(246,201,69,.6); border-radius: calc(var(--r) * .6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%; }
.back-crown { width: 52%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.back-word { font-family: 'Cinzel'; font-weight: 900; font-size: calc(var(--cw) * .12); letter-spacing: .06em; white-space: nowrap; color: var(--gold-2); }
.card.mini { border-width: 1.5px; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.card.mini .back-inner { display: none; }
.card.tiny { --cw: 40px; box-shadow: 0 2px 5px rgba(0,0,0,.35); }
.card.tiny .ribbon { display: none; }
.card.tiny .joker-word { display: none; }
.card.tiny .corner.br { display: none; }

.flyer { position: fixed; z-index: 100; pointer-events: none; will-change: transform; }
.flyer > .card { width: 100%; height: 100%; }
#fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* ---------- modals ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(8,3,22,.7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s both; }
.modal {
  width: min(920px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: linear-gradient(180deg, #2c1461, #1b0b40);
  border: 1px solid var(--gold-3); border-radius: 22px; padding: 22px 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
  animation: rise .3s both;
}
.modal-title { font-family: 'Cinzel'; font-weight: 900; text-align: center; margin: 0 0 6px; font-size: 1.7rem; color: var(--gold-2); }
.modal-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.results { display: grid; gap: 8px; margin-top: 14px; }
.res-row { display: grid; grid-template-columns: 180px 1fr 70px; align-items: center; gap: 12px; background: var(--panel-2); border-radius: 14px; padding: 8px 12px; animation: rise .35s both; }
.res-row:nth-child(2) { animation-delay: .05s; } .res-row:nth-child(3) { animation-delay: .1s; } .res-row:nth-child(4) { animation-delay: .15s; }
.res-row:nth-child(5) { animation-delay: .2s; } .res-row:nth-child(6) { animation-delay: .25s; } .res-row:nth-child(7) { animation-delay: .3s; }
.res-row.me { box-shadow: 0 0 0 1px var(--line); }
.res-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.res-who .seat-av { grid-row: auto; }
.res-melds { display: flex; flex-wrap: wrap; gap: 10px; }
.res-melds .meld.leftover { opacity: .9; }
.res-melds .meld.leftover .card { filter: saturate(.6); box-shadow: 0 0 0 2px var(--danger), 0 2px 5px rgba(0,0,0,.35); }
.res-pts { font-family: 'Cinzel'; font-weight: 900; font-size: 1.4rem; text-align: right; color: #ffb4a8; }
.res-pts.zero { color: #8ef0b3; }
.trophy { text-align: center; font-size: 4rem; animation: bob 1.6s ease-in-out infinite; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 22px 0 6px; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 130px; }
.podium .seat-av { grid-row: auto; }
.podium .pts { font-family: 'Cinzel'; font-weight: 900; color: var(--gold-2); }
.podium .block { width: 100%; border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-family: 'Cinzel'; font-weight: 900; font-size: 2rem; color: #3a2104; background: linear-gradient(180deg, #ffe38a, #c98a12); }
.podium .p1 .block { height: 110px; }
.podium .p2 .block { height: 78px; background: linear-gradient(180deg, #f1f1f6, #9ea3b5); }
.podium .p3 .block { height: 56px; background: linear-gradient(180deg, #f3c19a, #a8653a); }
.podium .step { animation: rise .5s both; }
.podium .p1 { animation-delay: .35s; } .podium .p2 { animation-delay: .15s; }
.rest { max-width: 320px; margin: 8px auto 0; color: var(--muted); }
.rest b { float: right; color: var(--text); }
.table-scroll { overflow-x: auto; }
table.scores { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .92rem; }
.scores th, .scores td { padding: 6px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
.scores th { font-size: .8rem; color: var(--muted); font-weight: 800; }
.scores td:first-child, .scores th:first-child { text-align: left; }
.scores td.zero { color: #8ef0b3; font-weight: 900; }
.scores tr.now td { background: rgba(246,201,69,.08); }
.scores tfoot td { font-family: 'Cinzel'; font-weight: 900; font-size: 1.1rem; border-bottom: 0; padding-top: 10px; }
.scores td.lead { color: var(--gold); }
.menu-list { display: flex; flex-direction: column; gap: 10px; max-width: 420px; margin: 14px auto; }
.toggle { display: flex; align-items: center; gap: 10px; background: var(--panel-2); padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.rules { max-width: 640px; margin: 0 auto; line-height: 1.55; font-weight: 500; }
.rules h3 { font-family: 'Cinzel'; color: var(--gold-2); margin: 16px 0 4px; font-size: 1.05rem; }
.rules p { margin: 4px 0; }

/* ---------- toasts / banners ---------- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #fff; color: #2a1060; padding: 9px 18px; border-radius: 999px; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: drop .3s both; transition: opacity .4s, transform .4s; }
.toast.error { background: #ffe0e3; color: #8a0d1d; }
.toast.hide { opacity: 0; transform: translateY(-8px); }
.banner { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 90; text-align: center; pointer-events: none; animation: zoom .45s cubic-bezier(.2,1.5,.4,1) both; transition: opacity .5s; }
.banner.hide { opacity: 0; }
.banner-title { font-family: 'Cinzel'; font-weight: 900; font-size: clamp(2rem, 6vw, 3.6rem); color: var(--gold); text-shadow: 0 4px 0 #5b3406, 0 10px 40px rgba(0,0,0,.7); }
.banner-sub { font-weight: 800; background: rgba(0,0,0,.55); display: inline-block; padding: 6px 16px; border-radius: 999px; margin-top: 8px; }
.conn-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #b8780f; color: #fff; text-align: center; padding: 6px; z-index: 300; font-weight: 800; }
.conn-banner.bad { background: #8a0d1d; }
.conn-banner .link { color: #fff; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 150; }

/* ---------- keyframes ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
@keyframes zoom { from { opacity: 0; transform: translate(-50%, -50%) scale(.5); } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-4px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(246,201,69,.8); } }
@keyframes deal { from { opacity: 0; transform: translateY(-38vh) scale(.5) rotate(-25deg); } }

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

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .log { display: none; }
  .round-track { display: none; }
}
@media (max-width: 760px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .logo-crowns { font-size: 2.8rem; }
  .logo-crown { width: 110px; }
  .topbar { padding: 6px 8px; gap: 6px; }
  .logo-sm .logo-word { display: none; }
  .pill { padding: 3px 10px; font-size: .8rem; }
  .wild-pill .muted:last-child { display: none; }
  .top-actions .icon-btn { width: 32px; height: 32px; font-size: .9rem; }
  .top-actions [data-act="rules"] { display: none; }
  .seats { gap: 6px; padding: 8px 6px 0; }
  .seat { min-width: 0; padding: 5px 8px 5px 5px; column-gap: 6px; border-radius: 12px; }
  .seat-av { width: 34px; height: 34px; font-size: 1.2rem; }
  .seat-name { font-size: .8rem; max-width: 84px; }
  .seat-meta { font-size: .68rem; }
  .seat-fan { height: 22px; margin-top: 3px; }
  .seat-fan .card.mini { --cw: 15px; margin-left: -10px; }
  .felt { border-radius: 60px; padding: 10px 12px; min-height: 180px; }
  .felt::before { border-radius: 52px; }
  .piles { gap: 22px; }
  .status { font-size: .85rem; }
  .res-row { grid-template-columns: 1fr 60px; }
  .res-melds { grid-column: 1 / -1; grid-row: 2; }
  .card.tiny { --cw: 32px; }
  .emotes { position: static; justify-content: center; margin-top: 4px; width: max-content; margin-inline: auto; }
  .hint-line { display: none; }
  .me-bar { gap: 8px; }
  .big-code { font-size: 2.3rem; }
  .seats:is(.seats-4, .seats-5, .seats-6) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat { grid-template-columns: auto minmax(0, 1fr); }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat-fan { display: none; }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat-count { display: block; grid-column: 2; font-size: .7rem; color: var(--muted); }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat-av { width: 30px; height: 30px; font-size: 1.05rem; }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat-name { max-width: 100%; }
  .seats:is(.seats-4, .seats-5, .seats-6) .seat-meta { overflow: hidden; text-overflow: ellipsis; }
}
