:root {
  --felt-0: #061f17;
  --felt-1: #0a3226;
  --felt-2: #0e4534;
  --gold: #d8b25a;
  --gold-2: #f0d58a;
  --cream: #f6edd9;
  --ink: #101a16;
  --red: #b3202a;
  --muted: rgba(246, 237, 217, 0.62);
  --line: rgba(216, 178, 90, 0.22);
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(0, 0, 0, 0.22);
  --card-w: 84px;
  --card-h: 120px;
  --play-advance: clamp(40px, 5.5vw, 76px);
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--cream);
  background:
    radial-gradient(1200px 700px at 50% -10%, #14553f 0%, transparent 60%),
    radial-gradient(900px 600px at 10% 110%, #0d3b2d 0%, transparent 55%),
    linear-gradient(160deg, var(--felt-0), #04140f 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.16em; }

#app { min-height: 100%; }
.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* ---------- generic ---------- */
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.panel h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0.02em; }
.panel h3 { margin: 0 0 10px; font-size: 15px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }

.btn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.055);
  border-radius: 12px;
  padding: 11px 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, opacity .12s;
}
.btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(216,178,90,0.45); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: rgba(0,0,0,0.2);
  color: #241b07;
  box-shadow: 0 10px 24px rgba(216,178,90,0.22), inset 0 1px 0 rgba(255,255,255,0.45);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffe6a8, #e2bf6c); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
input, select {
  background: #071c15;
  border: 1px solid rgba(216,178,90,0.28);
  border-radius: 11px;
  padding: 12px 13px;
  outline: none;
  min-width: 0;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(216,178,90,0.14); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
option { background: #0a241b; color: var(--cream); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; margin: 8px 0 0; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(216,178,90,0.16); color: var(--gold-2); border: 1px solid var(--line); vertical-align: middle; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.actions-center { justify-content: center; }
.hint.inline { margin: 0; }

/* ---------- language ---------- */
.lang-bar {
  width: min(920px, 100%); display: flex; justify-content: flex-end; align-items: center;
  gap: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
}
.lang-select { padding-top: 7px; padding-bottom: 7px; border-radius: 9px; font-size: 12.5px; }
.mini-lang { padding: 6px 26px 6px 8px; font-size: 12px; border-radius: 9px; }

/* ---------- home ---------- */
#screen-home { align-items: center; padding: 24px 20px 60px; overflow-y: auto; }
.hero { text-align: center; margin: 8px 0 28px; }
.hero-logo { width: 92px; height: 92px; filter: drop-shadow(0 12px 26px rgba(0,0,0,.45)); }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(44px, 9vw, 78px);
  letter-spacing: .18em;
  margin: 6px 0 2px 0.18em;
  background: linear-gradient(180deg, #fff3cf, var(--gold) 55%, #9c7524);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.tagline { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; width: min(920px, 100%); }
.rules-panel { width: min(920px, 100%); margin-top: 18px; }
.rules-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 26px; }
.rules-grid div { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; line-height: 1.45; }
.rules-grid b { color: var(--gold-2); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.rules-grid span { color: var(--muted); }

/* ---------- room ---------- */
#screen-room { padding: 18px clamp(14px, 4vw, 40px) 40px; overflow-y: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.room-code { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.room-code .label { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.code-btn {
  background: rgba(216,178,90,0.1); border: 1px dashed rgba(216,178,90,0.5); color: var(--gold-2);
  font-size: 26px; font-weight: 700; letter-spacing: .32em; padding: 6px 16px 6px 22px; border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.room-wrap { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.player-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.05);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(160deg, #d8b25a, #7d5a1c); color: #1d1505; font-weight: 800; font-size: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
}
.avatar.bot { background: linear-gradient(160deg, #8fb7a8, #315e4e); color: #06140f; }
.player-row .who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.player-row .who b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row .who span { font-size: 11.5px; color: var(--muted); }
.player-row .tag { margin-left: auto; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-2); border: 1px solid var(--line); padding: 3px 8px; border-radius: 999px; }
.player-row .kick { margin-left: 6px; }
.settings-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; font-size: 13px; }
.settings-summary div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,0.07); }
.settings-summary span:first-child { color: var(--muted); }
.settings-summary span:last-child { text-align: right; font-weight: 600; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.settings-form .field { margin-bottom: 12px; }
.settings-form .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 9px; padding: 9px 0; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.chat-panel { margin-top: 18px; }
.chat-log { height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,0.2); font-size: 13.5px; }
.chat-line b { color: var(--gold-2); font-weight: 600; }
.chat-line.system { color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { flex: 1; }

/* ---------- game ---------- */
#screen-game { height: 100dvh; overflow: hidden; touch-action: manipulation; }
.game-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px clamp(10px, 2.4vw, 22px); border-bottom: 1px solid rgba(216,178,90,0.14);
  background: rgba(3, 15, 11, 0.55); backdrop-filter: blur(10px); z-index: 20;
}
.game-room { display: flex; align-items: center; gap: 10px; }
.game-room .mono { color: var(--gold-2); font-weight: 700; font-size: 14px; }
.turn-banner {
  position: relative; text-align: center; font-size: 13px; letter-spacing: .04em; color: var(--muted);
  padding: 7px 18px; border-radius: 999px; border: 1px solid transparent; min-width: 170px;
}
.turn-banner.mine {
  color: #241b07; background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: rgba(0,0,0,.25); font-weight: 700;
  box-shadow: 0 0 0 6px rgba(216,178,90,0.09);
}
.turn-banner .timerbar { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 3px; border-radius: 3px; background: rgba(0,0,0,.18); overflow: hidden; }
.turn-banner .timerbar i { display: block; height: 100%; background: currentColor; opacity: .7; transition: width .4s linear; }
.game-tools { display: flex; gap: 8px; }

.table {
  position: relative; flex: 1; min-height: 0;
  background:
    radial-gradient(ellipse at 50% 45%, #12634a 0%, #0a3a2b 55%, #06231a 100%);
  overflow: hidden;
}
.table::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.018) 0 2px, transparent 2px 6px);
  pointer-events: none;
}
.table::after {
  content: "♠"; position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  font-size: clamp(180px, 24vw, 340px); line-height: 1;
  color: rgba(216, 178, 90, 0.045); pointer-events: none; z-index: 0;
}
.table-felt {
  position: absolute; inset: clamp(10px, 2.2vw, 30px); z-index: 1;
  border-radius: 50% / 46%;
  border: 1px solid rgba(216,178,90,0.25);
  box-shadow: inset 0 0 90px rgba(0,0,0,0.42), inset 0 0 0 10px rgba(0,0,0,0.08);
  pointer-events: none;
}

.seat {
  position: absolute; display: block; z-index: 6;
  padding: 8px 10px; border-radius: 14px; border: 1px solid transparent;
  transition: border-color .2s, background .2s, box-shadow .2s;
  max-width: 230px;
}
.seat.active {
  border-color: rgba(216,178,90,0.55); background: rgba(0,0,0,0.24);
  box-shadow: 0 0 0 6px rgba(216,178,90,0.07);
}
.seat.burned {
  border-color: rgba(200,80,80,0.6); background: rgba(66,10,12,0.38);
  box-shadow: 0 0 0 5px rgba(200,80,80,0.08);
}
.seat.burned .seat-info span { color: #e2a1a1; }
.seat.burned .avatar { filter: grayscale(1); opacity: .75; }
.seat.burned .hand-visual { opacity: .28; }
.seat.passed { opacity: .62; }
.seat.passed .seat-info span { color: #d9c08a; }
.seat-box { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.seat-main { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; }
.seat .avatar { width: 42px; height: 42px; }
.seat .seat-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.seat .seat-info b { font-size: 13.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.seat .seat-info span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .count {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex: none;
  background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700;
}
.seat .count .mini-back { width: 12px; height: 17px; border-radius: 3px; background: repeating-linear-gradient(45deg, #7e1d24, #7e1d24 3px, #a32a33 3px, #a32a33 6px); border: 1px solid rgba(255,255,255,.35); }
.seat .offline { color: #e2a1a1; font-size: 10.5px; }

/* card backs showing how many cards an opponent still holds */
.hand-visual { display: flex; align-items: center; padding-left: 1px; max-width: 100%; overflow: hidden; }
.hand-back {
  display: block; width: 11px; height: 17px; flex: none; margin-right: -5px;
  border-radius: 2px; border: 1px solid rgba(246,237,217,0.7);
  background: repeating-linear-gradient(45deg, #7e1d24 0 3px, #a32a33 3px 6px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.hand-back:last-child { margin-right: 0; }
.seat-bottom .hand-visual { display: none; }

/* Side seats: info and points stack vertically under the avatar. */
.seat-left .seat-main, .seat-right .seat-main {
  flex-direction: column; align-items: center; gap: 4px;
}
.seat-left .seat-info, .seat-right .seat-info {
  align-items: center; text-align: center; flex: none; width: 100%;
}
.seat-left .count, .seat-right .count { margin-left: 0; }
.seat-meta { display: inline; }
.seat-meta .seat-points::before { content: " · "; }
.seat-left .seat-meta, .seat-right .seat-meta {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.seat-left .seat-meta .seat-points::before,
.seat-right .seat-meta .seat-points::before { content: ""; }

/* Side seats show their cards as a vertical stack toward the centre. */
.seat-left .hand-visual, .seat-right .hand-visual {
  flex-direction: column; align-items: center; padding-left: 0;
  max-width: none; width: 17px; overflow: visible; align-self: center;
}
.seat-left .hand-back, .seat-right .hand-back { margin-right: 0; margin-bottom: -8px; transform: rotate(90deg); }
.seat-left .hand-back:last-child, .seat-right .hand-back:last-child { margin-bottom: 0; }

/* played cards stay in front of each player until the trick is cleared */
.seat-play {
  position: absolute; display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none; z-index: 2; white-space: nowrap;
}
.seat-top .seat-play { top: 100%; left: 50%; transform: translate(-50%, var(--play-advance)); }
.seat-bottom .seat-play { bottom: 100%; left: 50%; transform: translate(-50%, calc(var(--play-advance) * -1)); }
.seat-left .seat-play { left: 100%; top: 50%; transform: translate(clamp(8px, 2vw, 18px), -50%); }
.seat-right .seat-play { right: 100%; top: 50%; transform: translate(calc(-1 * clamp(8px, 2vw, 18px)), -50%); }
.seat-play .card { margin-right: -20px; }
.seat-play .card:last-child { margin-right: 0; }
.seat-left .seat-play, .seat-right .seat-play { flex-direction: column; align-items: center; }
.seat-left .seat-play .card, .seat-right .seat-play .card { margin-right: 0; margin-bottom: -44px; transform: rotate(90deg); }
.seat-left .seat-play .card:last-child, .seat-right .seat-play .card:last-child { margin-bottom: 0; }

/* dealing animation */
.deal-pending { opacity: 0 !important; pointer-events: none; }
.deal-layer { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.deal-card {
  position: absolute; left: 0; top: 0; width: 22px; height: 32px; border-radius: 3px;
  border: 1px solid rgba(246,237,217,0.7);
  background: repeating-linear-gradient(45deg, #7e1d24 0 3px, #a32a33 3px 6px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}

.seat-top { top: 12px; left: 50%; transform: translateX(-50%); }
.seat-left { left: 16px; top: 50%; transform: translateY(-50%); }
.seat-right { right: 16px; top: 50%; transform: translateY(-50%); }
.seat-bottom { bottom: 10px; left: 50%; transform: translateX(-50%); }

.table-center {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 4;
  width: min(460px, 70%);
}
.last-play { min-height: calc(var(--card-h) * .78); display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.empty-table { color: rgba(246,237,217,0.4); font-size: 13px; text-align: center; }
.combo-label { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-2); min-height: 14px; }

/* cards */
.card {
  position: relative; width: var(--card-w); height: var(--card-h); flex: none;
  border-radius: 9px; background: linear-gradient(160deg, #fffdf6, var(--cream) 70%, #e9dcc2);
  color: var(--ink); border: 1px solid rgba(0,0,0,0.16);
  box-shadow: 0 6px 14px rgba(0,0,0,0.28), inset 0 1px 0 #fff;
  user-select: none;
}
.card .corner {
  position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .92;
  font-weight: 800; font-size: calc(var(--card-w) * .2);
}
.card .corner.tl { top: 5px; left: 6px; }
.card .corner.br { bottom: 5px; right: 6px; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-w) * .58); opacity: .92; }
.card.red { color: var(--red); }
.card.black { color: #1b1b1b; }
.card.back {
  background:
    repeating-linear-gradient(45deg, #7e1d24 0 6px, #a32a33 6px 12px);
  border: 2px solid var(--cream); box-shadow: inset 0 0 0 2px #5f141a, 0 6px 14px rgba(0,0,0,.3);
}
.card.back::after {
  content: ""; position: absolute; inset: 18%;
  border: 1px solid rgba(246,237,217,0.55); border-radius: 5px;
  background: radial-gradient(circle at 50% 50%, rgba(246,237,217,.2), transparent 65%);
}
.card.small { --card-w: 52px; --card-h: 74px; border-radius: 7px; }
.card.mini { --card-w: 58px; --card-h: 82px; border-radius: 8px; }
.card.mini .corner { font-size: calc(var(--card-w) * .27); }
.card.mini .corner.tl { top: 4px; left: 4px; }
.card.mini .corner.br { bottom: 4px; right: 4px; }
.card.mini .pip { font-size: calc(var(--card-w) * .46); }

.hand-wrap {
  position: relative; padding: 6px clamp(8px, 2.4vw, 26px) max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(3,14,10,0.92), rgba(3,14,10,0.55));
  border-top: 1px solid rgba(216,178,90,0.14);
}
.hand {
  display: flex; justify-content: center; justify-content: safe center; align-items: flex-end;
  min-height: calc(var(--card-h) + 16px); padding: 10px 0 4px;
  overflow-x: auto; overflow-y: visible; scrollbar-width: none;
}
.hand::-webkit-scrollbar { display: none; }
.hand .card { margin-right: calc(var(--card-w) * -0.36); transition: transform .14s ease, box-shadow .14s; cursor: pointer; }
.hand .card .corner.br { display: none; }
.hand .card:last-child { margin-right: 0; }
.hand .card.selected { transform: translateY(-18px); box-shadow: 0 0 0 2px var(--gold), 0 14px 22px rgba(0,0,0,.4); z-index: 3; }
@media (hover: hover) and (pointer: fine) {
  .hand .card:hover { transform: translateY(-8px); }
  .hand .card.selected:hover { transform: translateY(-20px); }
}

.action-bar { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 6px 0 8px; flex-wrap: wrap; }
.action-bar .btn { min-width: 96px; }
.sort-select { min-width: 138px; padding: 10px 34px 10px 12px; border-radius: 12px; }
.pick-row { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.combo-select { min-width: 190px; padding: 7px 30px 7px 10px; border-radius: 10px; font-size: 12.5px; text-transform: none; letter-spacing: 0; }
.rule-note { margin: 12px 0 0; padding: 10px; border: 1px dashed rgba(216,178,90,0.22); border-radius: 10px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.selection-hint { text-align: center; font-size: 12px; min-height: 17px; color: var(--muted); letter-spacing: .02em; }
.selection-hint.good { color: var(--gold-2); }
.selection-hint.bad { color: #efb3b3; }
.settings-fixed {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px 14px; padding: 12px 0 14px;
  margin-top: 2px; border-top: 1px dashed rgba(255,255,255,0.09); font-size: 13px;
}
.settings-fixed span { color: var(--muted); }
.settings-fixed b { text-align: right; font-weight: 600; }

/* opponents' played cards */
.played-stack { display: flex; }
.played-stack .card { margin-right: -30px; }
.played-stack .card:last-child { margin-right: 0; }

/* overlays / drawers */
.overlay {
  position: absolute; inset: 0; z-index: 30; display: grid; place-items: center;
  background: rgba(2, 10, 7, 0.62); backdrop-filter: blur(6px); padding: 18px;
}
.overlay-card {
  width: min(520px, 100%); background: linear-gradient(180deg, #0e3a2b, #08241a);
  border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: var(--shadow);
  max-height: 86vh; overflow-y: auto;
}
.overlay-card h2 { margin: 0 0 10px; font-family: var(--serif); letter-spacing: .04em; }
.result-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.result-table th, .result-table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.result-table th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.result-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.score-up { color: #8fe0b8; } .score-down { color: #ef9a9a; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); z-index: 40;
  background: rgba(5, 22, 16, 0.97); border-left: 1px solid var(--line);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
  padding: 16px; box-shadow: -20px 0 50px rgba(0,0,0,.4);
}
.drawer.open { transform: translateX(0); }
#rules-drawer { overflow-y: auto; }
#rules-drawer .settings-summary { grid-template-columns: 1fr; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer .chat-log { flex: 1; height: auto; }
.game-log { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 12px; color: var(--muted); max-height: 32vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #2a1a12; color: #ffe9c9; border: 1px solid rgba(216,178,90,0.4);
  padding: 10px 16px; border-radius: 12px; z-index: 100; font-size: 13.5px;
  box-shadow: var(--shadow); max-width: min(520px, 90vw); text-align: center;
}

.turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.two-low-badge {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(216,178,90,0.16); color: #f0d9a0; border: 1px solid rgba(216,178,90,0.4);
}

/* responsive */
@media (max-width: 760px) {
  :root { --card-w: 64px; --card-h: 92px; }
  .home-grid, .rules-grid { grid-template-columns: 1fr; }
  .room-wrap { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-summary { grid-template-columns: 1fr; }
  .seat .seat-info b { max-width: 84px; font-size: 12px; }
  .seat { gap: 7px; padding: 6px 7px; }
  .seat .avatar { width: 34px; height: 34px; }
  .seat .count { font-size: 11px; padding: 3px 7px; }
  .seat-left { left: 6px; }
  .seat-right { right: 6px; }
  .table-center { width: 78%; top: 45%; }
  .hand .card { margin-right: calc(var(--card-w) * -0.42); }
  .game-tools .btn { padding: 6px 9px; font-size: 12px; }
  .mini-lang { padding: 5px 22px 5px 6px; font-size: 11px; }
  .turn-banner { min-width: 0; font-size: 11.5px; padding: 6px 10px; }
  .action-bar { gap: 8px; }
  .action-bar .btn { min-width: 76px; padding: 10px 12px; }
  .sort-select { min-width: 118px; padding: 9px 30px 9px 10px; font-size: 13px; }
  .pick-row { gap: 5px; font-size: 10px; }
  .combo-select { min-width: 150px; font-size: 12px; }
  .seat .seat-info b { max-width: 78px; }
  .seat-play .card.mini { --card-w: 44px; --card-h: 62px; border-radius: 6px; }
  .seat-play .card { margin-right: -15px; }
  .seat-left .seat-play .card, .seat-right .seat-play .card { margin-right: 0; margin-bottom: -33px; }
  .combo-label.side { display: none; }
}
@media (max-width: 420px) {
  :root { --card-w: 54px; --card-h: 78px; }
  .hand .card { margin-right: calc(var(--card-w) * -0.46); }
  .seat .count { display: none; }
}

.review-bar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  z-index: 15; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 14px; width: min(94%, 640px); padding: 10px 14px;
  border-radius: 12px; background: rgba(12, 22, 19, 0.92);
  border: 1px solid rgba(232, 185, 72, 0.45); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
.review-bar.hidden { display: none; }
.review-info { display: flex; flex-direction: column; gap: 2px; min-width: 160px; flex: 1; }
.review-step { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-weight: 700; }
.review-desc { font-size: 13px; color: var(--cream); }
.review-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.log-head { display: flex; justify-content: flex-end; margin: 8px 0 4px; }

.qr-card { max-width: 340px; text-align: center; }
.qr-card h3 { margin: 0 0 12px; color: var(--gold); }
.qr-box {
  display: inline-flex; padding: 12px; border-radius: 12px;
  background: #ffffff; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}
.qr-box img { display: block; width: 200px; height: 200px; }
.qr-url {
  margin: 10px 0 14px; font-size: 12px; color: rgba(246, 237, 217, 0.78);
  word-break: break-all; user-select: all;
}
