:root {
  --felt: #0f5132;
  --felt-dark: #0a3a24;
  --ink: #f4f1e8;
  --muted: #b9cbbf;
  --accent: #ffd54f;
  --panel: rgba(0, 0, 0, 0.25);
  --cw: clamp(40px, 11vw, 80px);
  --ch: calc(var(--cw) * 1.4);
  --uno-red: #d32f2f;
  --uno-yellow: #f9a825;
  --uno-green: #2e7d32;
  --uno-blue: #1565c0;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, #16704a 0%, var(--felt) 45%, var(--felt-dark) 100%) fixed;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }

/* ---------- Header / chrome ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar h1 { font-size: 1.3rem; margin: 0; flex: 1; white-space: nowrap; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn, .select {
  font: inherit; font-size: 0.9rem; padding: 7px 14px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.1); color: var(--ink);
  cursor: pointer;
}
.select option { color: #000; }
.btn:hover { background: rgba(255, 255, 255, 0.2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); color: #2b2100; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.status {
  text-align: center; padding: 8px 16px; font-size: 1rem; background: rgba(0, 0, 0, 0.18);
  min-height: 2.2em; white-space: pre-wrap;
}
main { padding: 16px; }

/* ---------- Hub ---------- */
.hub {
  display: grid; gap: 16px; max-width: 1000px; margin: 12px auto;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.hub-tile {
  display: block; text-decoration: none; color: var(--ink); padding: 22px 18px;
  background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px;
  transition: transform 0.15s, background 0.15s;
}
.hub-tile:hover { transform: translateY(-3px); background: rgba(0, 0, 0, 0.38); }
.hub-icon { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.hub-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.hub-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }

/* ---------- Dialog ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: grid; place-items: center;
  z-index: 100000; padding: 16px;
}
.dialog {
  background: #fdfbf5; color: #222; border-radius: 14px; padding: 20px 22px; min-width: 260px; max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.dialog h2 { margin: 0 0 10px; font-size: 1.3rem; }
.dialog-body { margin-bottom: 16px; line-height: 1.5; }
.dialog-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dialog .btn { color: #222; border-color: #ccc; background: #f0ede4; text-transform: capitalize; }
.dialog .btn.primary { background: #f9b800; border-color: #f9b800; }
.score-table { border-collapse: collapse; width: 100%; }
.score-table th, .score-table td { padding: 4px 10px; text-align: right; border-bottom: 1px solid #ddd; }
.score-table th:first-child, .score-table td:first-child { text-align: left; }

/* ---------- Playing cards ---------- */
.card {
  width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * 0.09);
  background: #fff; border: 1px solid #b9b9b9; position: relative; flex: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); user-select: none; font-family: Georgia, "Times New Roman", serif;
  transition: transform 0.12s;
}
.card.red { color: #c62828; }
.card.black { color: #1b1b1b; }
.card .corner { position: absolute; font-size: calc(var(--cw) * 0.21); line-height: 1; text-align: center; font-weight: 700; }
.card .tl { top: 4%; left: 7%; }
.card .br { bottom: 4%; right: 7%; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--cw) * 0.5); }
.card.back {
  background: repeating-linear-gradient(45deg, #b71c1c 0 5px, #d84343 5px 10px);
  border: calc(var(--cw) * 0.05) solid #fff;
}
.card.selected { box-shadow: 0 0 0 3px var(--accent), 0 4px 10px rgba(0, 0, 0, 0.5); }
.hand .card.selected { transform: translateY(-12px); }
.card.playable { cursor: pointer; }
.hand .card.playable:hover { transform: translateY(-8px); }
.hand .card.selected:hover { transform: translateY(-12px); }
.card.dim { filter: brightness(0.6); }
.card.new { box-shadow: 0 0 0 3px #4fc3f7; }
.card.small { --cw: 26px; border-width: 2px; }

.slot {
  width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * 0.09); flex: none;
  border: 2px dashed rgba(255, 255, 255, 0.25); position: relative; display: grid; place-items: center;
}
.slot > .card { position: absolute; top: -2px; left: -2px; }
.slot-label { color: rgba(255, 255, 255, 0.3); font-size: calc(var(--cw) * 0.35); }

/* ---------- Card tables (Hearts / Uno / Go Fish) ---------- */
.table {
  display: grid; gap: 10px; max-width: 1000px; margin: 0 auto;
  grid-template-columns: minmax(70px, 1fr) minmax(0, 3fr) minmax(70px, 1fr);
  grid-template-areas: ". north ." "west center east" "south south south";
}
.seat { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.seat-north { grid-area: north; }
.seat-west { grid-area: west; justify-content: center; }
.seat-east { grid-area: east; justify-content: center; }
.seat-south { grid-area: south; margin-top: 8px; }
.center { grid-area: center; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: calc(var(--ch) * 2.6); justify-content: center; }
.seat-label { font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--panel); white-space: nowrap; }
.seat-label.active { background: var(--accent); color: #2b2100; }
.seat-label .score { font-weight: 400; opacity: 0.85; }
.seat-label .taken { color: #ff8a80; }
.seat-label.active .taken { color: #b71c1c; }
.hand { display: flex; justify-content: center; flex-wrap: wrap; row-gap: 8px; padding-top: 14px; max-width: 100%; }
.hand > * + * { margin-left: calc(var(--cw) * -0.42); }
.hand.mini { padding-top: 0; max-width: 140px; }
.hand.mini > * + * { margin-left: -18px; }
.action-bar { min-height: 38px; }

/* Hearts trick */
.trick { position: relative; width: calc(var(--cw) * 3.4); height: calc(var(--ch) * 2.2); }
.trick-card { position: absolute; left: 50%; top: 50%; }
.trick-card.at-south { transform: translate(-50%, -10%); }
.trick-card.at-north { transform: translate(-50%, -90%); }
.trick-card.at-west { transform: translate(-115%, -50%); }
.trick-card.at-east { transform: translate(15%, -50%); }

/* ---------- Uno ---------- */
.uno-card {
  width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * 0.12); flex: none; position: relative;
  border: calc(var(--cw) * 0.06) solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); user-select: none;
  display: grid; place-items: center; color: #fff; font-weight: 800; transition: transform 0.12s;
}
.uno-card.red { background: var(--uno-red); }
.uno-card.yellow { background: var(--uno-yellow); }
.uno-card.green { background: var(--uno-green); }
.uno-card.blue { background: var(--uno-blue); }
.uno-card.wild, .uno-card.back { background: #1a1a1a; }
.uno-oval {
  width: 78%; height: 62%; border-radius: 50%; background: #fff; transform: rotate(-25deg);
  display: grid; place-items: center; font-size: calc(var(--cw) * 0.36); text-shadow: none;
}
.uno-card.red .uno-oval { color: var(--uno-red); }
.uno-card.yellow .uno-oval { color: var(--uno-yellow); }
.uno-card.green .uno-oval { color: var(--uno-green); }
.uno-card.blue .uno-oval { color: var(--uno-blue); }
.uno-card.wild .uno-oval {
  background: conic-gradient(var(--uno-red) 0 25%, var(--uno-blue) 0 50%, var(--uno-yellow) 0 75%, var(--uno-green) 0);
  color: #fff; text-shadow: 0 1px 3px #000;
}
.uno-card.back .uno-oval { background: var(--uno-red); color: var(--uno-yellow); font-size: calc(var(--cw) * 0.22); font-style: italic; }
.uno-corner { position: absolute; top: 3%; left: 7%; font-size: calc(var(--cw) * 0.2); }
.uno-card.small { --cw: 26px; border-width: 2px; }
.uno-card.small .uno-oval { display: none; }
.uno-card.back.small { background: linear-gradient(135deg, #1a1a1a 40%, var(--uno-red) 40% 60%, #1a1a1a 60%); }
.uno-card.playable { cursor: pointer; }
.uno-hand .uno-card.playable:hover { transform: translateY(-10px); }
.uno-card.playable.pile:hover { transform: translateY(-4px); }
.uno-card.dim { filter: brightness(0.55); }
.uno-hand > * + * { margin-left: calc(var(--cw) * -0.3); }
.uno-piles { display: flex; gap: 18px; }
.uno-info { display: flex; align-items: center; gap: 4px; font-size: 1.05rem; text-transform: capitalize; }
.uno-info .dir { font-size: 1.5rem; margin-left: 8px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; border: 2px solid #fff; }
.color-dot.red { background: var(--uno-red); }
.color-dot.yellow { background: var(--uno-yellow); }
.color-dot.green { background: var(--uno-green); }
.color-dot.blue { background: var(--uno-blue); }
.uno-msg { text-align: center; color: var(--muted); min-height: 2.6em; max-width: 340px; }
.uno-badge { margin-left: 6px; background: var(--uno-red); color: #fff; border-radius: 6px; padding: 0 6px; font-size: 0.8rem; }

/* ---------- Go Fish ---------- */
.gf-stock { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.gf-log { width: 100%; max-width: 420px; font-size: 0.92rem; text-align: center; min-height: 8em; }
.gf-log .old { opacity: 0.55; font-size: 0.85rem; }
.gf-books { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; max-width: 220px; }
.gf-book { background: #fff; color: #222; border-radius: 4px; padding: 1px 6px; font-weight: 700; font-size: 0.85rem; }
.seat-btn {
  font: inherit; color: inherit; background: none; border: 2px solid transparent; border-radius: 12px;
  padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: default;
}
.seat-btn.askable { border-color: var(--accent); cursor: pointer; animation: pulse 1.4s infinite; }
.ask-hint { font-size: 0.8rem; color: var(--accent); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 213, 79, 0.2); } }

/* ---------- Board games ---------- */
.board-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.chess-board, .checkers-board {
  display: grid; grid-template-columns: repeat(8, 1fr);
  width: min(92vw, calc(100vh - 210px), 600px); min-width: 280px; aspect-ratio: 1;
  border: 6px solid #3e2a14; border-radius: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.sq { position: relative; display: grid; place-items: center; cursor: pointer; aspect-ratio: 1; }
.chess-board .light { background: #eeeed2; }
.chess-board .dark { background: #769656; }
.checkers-board .light { background: #e8d0aa; }
.checkers-board .dark { background: #8b5a2b; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(255, 235, 59, 0.35); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(255, 213, 79, 0.6); }
.sq.check { background: radial-gradient(circle, #ff3d3d 0%, #d32f2f 40%, transparent 75%) !important; }
.sq.target::after {
  content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(0, 0, 0, 0.25);
}
.sq.target.cap::after { width: 86%; height: 86%; background: none; border: 5px solid rgba(0, 0, 0, 0.25); }
.piece { font-size: min(9vw, calc((100vh - 210px) / 9.5), 62px); line-height: 1; z-index: 1; user-select: none; }
.piece.w { color: #fff; text-shadow: 0 0 2px #000, 0 0 1px #000, 0 2px 3px rgba(0, 0, 0, 0.6); }
.piece.b { color: #1d1d1d; text-shadow: 0 0 1px #fff, 0 2px 3px rgba(0, 0, 0, 0.4); }
.coord { position: absolute; font-size: 10px; font-weight: 700; opacity: 0.6; color: #333; }
.coord.rank { top: 2px; left: 3px; }
.coord.file { bottom: 1px; right: 3px; }
.captured { min-height: 1.6em; font-size: 1.4rem; letter-spacing: -2px; }
.captured.w { color: #fff; text-shadow: 0 0 2px #000; }
.captured.b { color: #111; text-shadow: 0 0 1px #fff; }

.checker {
  width: 78%; height: 78%; border-radius: 50%; display: grid; place-items: center;
  font-size: min(5vw, 30px); z-index: 1; transition: transform 0.1s;
}
.checker.r { background: radial-gradient(circle at 35% 30%, #ff6b6b, #c62828 60%, #8e1b1b); box-shadow: 0 3px 0 #5d0f0f, 0 5px 6px rgba(0, 0, 0, 0.4); color: #ffd54f; }
.checker.b { background: radial-gradient(circle at 35% 30%, #666, #222 60%, #000); box-shadow: 0 3px 0 #000, 0 5px 6px rgba(0, 0, 0, 0.4); color: #ffd54f; }
.sq.movable .checker { box-shadow: 0 0 0 3px var(--accent), 0 3px 0 #5d0f0f; }
.sq.sel .checker { transform: scale(1.08); }

/* ---------- Tic Tac Toe ---------- */
.ttt-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.ttt-score { display: flex; gap: 22px; font-weight: 600; flex-wrap: wrap; justify-content: center; }
.ttt-score .x { color: #80d8ff; }
.ttt-score .o { color: #ff9e80; }
.ttt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(88vw, 360px); aspect-ratio: 1; }
.ttt-cell {
  font: 800 min(18vw, 76px) / 1 system-ui, sans-serif; border: none; border-radius: 12px;
  background: rgba(0, 0, 0, 0.28); color: var(--ink); cursor: pointer;
}
.ttt-cell:hover { background: rgba(0, 0, 0, 0.38); }
.ttt-cell.x { color: #80d8ff; }
.ttt-cell.o { color: #ff9e80; }
.ttt-cell.win { background: rgba(255, 213, 79, 0.35); }

/* ---------- Solitaire ---------- */
.sol-wrap { max-width: 760px; margin: 0 auto; --gap: calc(var(--cw) * 0.15); }
.sol-top, .sol-tableau { display: flex; gap: var(--gap); justify-content: center; }
.sol-top { margin-bottom: 18px; }
.sol-top .slot { cursor: pointer; }
.sol-top .spacer { width: var(--cw); flex: none; }
.slot.waste { border-color: transparent; }
.sol-col { position: relative; width: var(--cw); flex: none; cursor: pointer; }
.sol-col > .card { position: absolute; left: 0; cursor: pointer; }
.sol-col > .slot { position: absolute; top: 0; }

/* ---------- Mahjong ---------- */
.mj-wrap { width: 100%; max-width: 1000px; margin: 0 auto; display: flex; justify-content: center; }
.mj-board { position: relative; transform-origin: top center; flex: none; }
.mj-tile {
  position: absolute; width: 46px; height: 60px; border-radius: 6px;
  background: linear-gradient(145deg, #fffdf6, #efe6cf); border: 1px solid #9d8a64;
  box-shadow: 3px 3px 0 #c4ae7d, 4px 4px 0 #8b7550, 5px 6px 6px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-family: "Noto Serif CJK SC", "Noto Sans CJK SC", "SimSun", serif; cursor: default; user-select: none;
  color: #222;
}
.mj-tile.free { cursor: pointer; }
.mj-tile.free:hover { background: linear-gradient(145deg, #fffef9, #f7f0dc); }
.mj-tile.sel { background: linear-gradient(145deg, #fff3a8, #ffd54f); }
.mj-tile.hint { background: linear-gradient(145deg, #b3e5fc, #81d4fa); }
.mj-top { font-size: 22px; font-weight: 700; line-height: 1; }
.mj-sub { font-size: 14px; line-height: 1; }
.mj-tile.big .mj-top { font-size: 30px; }
.mj-tile.dots { color: #1565c0; }
.mj-tile.bamboo { color: #2e7d32; }
.mj-tile.chars .mj-top { color: #222; }
.mj-tile.chars .mj-sub { color: #c62828; font-size: 18px; }
.mj-tile.wind { color: #222; }
.mj-tile.red { color: #c62828; }
.mj-tile.green { color: #2e7d32; }
.mj-tile.white .mj-top { color: #1565c0; border: 3px double #1565c0; width: 28px; height: 36px; font-size: 0; }
.mj-tile.flower { color: #ad1457; }
.mj-tile.season { color: #e65100; }

/* ---------- Card tables (shared layout for online-capable card games) ---------- */
.table .area { display: flex; gap: 14px; min-width: 0; }
.area-north { grid-area: north; justify-content: space-evenly; flex-wrap: wrap; }
.area-west { grid-area: west; align-items: center; justify-content: center; }
.area-east { grid-area: east; align-items: center; justify-content: center; }
.area-south { grid-area: south; justify-content: center; margin-top: 8px; }
.area-south > .seat { width: 100%; }
.result-panel {
  background: #fdfbf5; color: #222; border-radius: 12px; padding: 14px 18px; min-width: 240px; text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.result-panel h3 { margin: 0; }
.result-panel p { margin: 0; }
.result-panel .muted { color: #666; }
.card.mid, .slot.mid { --cw: clamp(34px, 7.5vw, 54px); }
.card.mid .pip { font-size: calc(var(--cw) * 0.42); }
.dot.bot { background: #90a4ae; }
.waiting-room h2 { margin-top: 0; }
.player-list { margin: 8px 0 14px; padding-left: 20px; line-height: 1.7; }

/* ---------- Poker ---------- */
.poker-table { grid-template-areas: "north north north" "west center east" "south south south"; }
.pk-seat {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 12px;
  border: 2px solid transparent; transition: opacity 0.2s;
}
.pk-seat.folded .pk-hole { opacity: 0.35; }
.pk-seat.out { opacity: 0.45; }
.pk-seat.winner { border-color: var(--accent); background: rgba(255, 213, 79, 0.12); }
.pk-hole { display: flex; gap: 4px; }
.pk-tags { display: flex; gap: 6px; align-items: center; min-height: 22px; flex-wrap: wrap; justify-content: center; }
.dealer-btn { background: #fff; color: #222; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-weight: 800; font-size: 0.75rem; }
.act-tag { font-size: 0.8rem; background: rgba(0, 0, 0, 0.3); padding: 1px 8px; border-radius: 99px; }
.act-tag.fold { opacity: 0.6; }
.bet-chip { font-size: 0.8rem; font-weight: 700; background: #ffd54f; color: #2b2100; padding: 1px 8px; border-radius: 99px; }
.bet-chip::before { content: '● '; color: #c62828; }
.pk-handname { font-size: 0.8rem; color: var(--accent); }
.pk-board { display: flex; gap: 6px; }
.pk-pot { font-weight: 700; font-size: 1.1rem; }
.pk-myhand { color: var(--accent); font-weight: 600; }
.pk-actions { display: flex; flex-direction: column; gap: 8px; align-items: center; background: var(--panel); padding: 10px 14px; border-radius: 12px; }
.pk-raise { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pk-slider { width: min(260px, 70vw); accent-color: var(--accent); }

/* ---------- Blackjack ---------- */
.bj-table { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bj-dealer { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 14px; background: var(--panel); }
.bj-cards { display: flex; min-height: calc(clamp(34px, 7.5vw, 54px) * 1.4); }
.bj-cards > * + * { margin-left: calc(var(--cw) * -0.3); }
.bj-middle { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bj-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.btn.chip { border-radius: 99px; min-width: 52px; font-weight: 700; }
.bj-seats { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; width: 100%; }
.bj-seat {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 14px; min-width: 150px;
  background: rgba(0, 0, 0, 0.15); border: 2px solid transparent;
}
.bj-seat.mine { background: rgba(0, 0, 0, 0.3); }
.bj-seat.active { border-color: var(--accent); }
.bj-hands { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.bj-hand { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border-radius: 10px; }
.bj-hand.current { box-shadow: 0 0 0 2px var(--accent); }
.bj-meta { display: flex; gap: 6px; align-items: center; font-size: 0.85rem; flex-wrap: wrap; justify-content: center; }
.bj-bet { color: var(--muted); }
.badge.win, .badge.blackjack { background: #66bb6a; color: #0b2a0d; }
.badge.lose, .badge.bust { background: #ef5350; color: #fff; }
.badge.push { background: rgba(255, 255, 255, 0.25); }

/* ---------- Multiplayer: lobby + room bar ---------- */
.hub-tile.featured { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: center;
  background: linear-gradient(135deg, rgba(255, 213, 79, 0.18), rgba(0, 0, 0, 0.25)); border-color: rgba(255, 213, 79, 0.45); }
.hub-tile.featured .hub-icon { grid-row: span 2; margin: 0; }
.panel { background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; padding: 16px 18px; }
.panel.narrow { max-width: 520px; margin: 24px auto; line-height: 1.5; }
.panel h2 { margin: 0 0 10px; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }
.lobby { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
.text-input {
  font: inherit; font-size: 1.05rem; padding: 9px 12px; border-radius: 8px; width: 100%; max-width: 320px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.95); color: #222;
}
.dialog .text-input { max-width: none; border-color: #bbb; }
.text-input.code { text-transform: uppercase; letter-spacing: 1px; max-width: 200px; }
.create-row, .join-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.big { font-size: 1.05rem; padding: 12px 18px; display: inline-flex; align-items: center; gap: 8px; }
.btn.big .big-icon { font-size: 1.5rem; line-height: 1; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.conn { font-size: 0.8rem; font-weight: 400; }
.conn.on { color: #a5d6a7; }
.conn.off { color: #ffcc80; }
.muted { color: var(--muted); }
.room-list { display: grid; gap: 8px; }
.room-row {
  display: grid; grid-template-columns: 9em 6.5em 1fr auto auto; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.2);
}
.room-code { font-weight: 700; letter-spacing: 1px; font-family: ui-monospace, monospace; }
.room-players { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; text-transform: capitalize; }
.badge.waiting { background: #ffd54f; color: #2b2100; }
.badge.playing { background: #66bb6a; color: #0b2a0d; }
.badge.finished { background: rgba(255, 255, 255, 0.2); }
.room-bar {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center;
  max-width: 760px; margin: 0 auto 14px; padding: 8px 12px; border-radius: 12px; background: var(--panel);
}
.seat-chip { padding: 3px 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.2); display: inline-flex; align-items: center; gap: 6px; }
.seat-chip.active { box-shadow: 0 0 0 2px var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: #66bb6a; }
.dot.off { background: #ef5350; }
.dot.empty { border: 1px dashed rgba(255, 255, 255, 0.6); }
.room-score { font-weight: 700; font-size: 1.05rem; }
.room-actions { display: inline-flex; gap: 8px; align-items: center; }
.offline { color: #ffcc80; font-weight: 600; }

@media (max-width: 600px) {
  .room-row { grid-template-columns: 1fr auto; }
  .room-row .room-players { grid-column: 1 / -1; order: 5; }
}

@media (max-width: 600px) {
  main { padding: 10px 6px; }
  .topbar { padding: 8px 10px; }
  .topbar h1 { font-size: 1.1rem; }
  .btn, .select { padding: 6px 10px; font-size: 0.85rem; }
  .table { grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 6px; }
  .hand.mini { max-width: 64px; }
  .hand.mini > * + * { margin-left: -20px; }
}
