:root {
  --bg: #0d2528;
  --felt: #17474a;
  --panel: #12363a;
  --panel2: #184449;
  --line: #2f6466;
  --ink: #f3ecd8;
  --muted: #9fbab4;
  --gold: #efc04f;
  --red: #dc5a45;
  --pts: #62b0ea;
  --mult: #f47a55;
  --green: #4fbf8b;
  --ivory: #f8f1de;
  --tw: clamp(30px, 5.6vw, 54px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
@media (max-width: 620px) {
  :root { --tw: min(50px, calc((100vw - 30px) / 7.5)); }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body {
  background: radial-gradient(ellipse at 50% 30%, var(--felt), var(--bg) 75%) fixed;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { line-height: 1.5; margin: .5em 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
small { font-size: .8rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.gold { color: var(--gold); }
.center { text-align: center; justify-content: center; }
.error { color: #ffb4a6; background: #5b241c; padding: 8px 12px; border-radius: 8px; }
.c-pts { color: var(--pts); }
.c-mult { color: var(--mult); }

.screen { max-width: 900px; margin: 0 auto; padding: 8px 8px 24px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 10px; }
.center-screen { justify-content: center; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; box-shadow: 0 12px 40px #0006; }
.card label { display: block; margin: 14px 0 6px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; color: var(--muted); }

input[type=text] { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c2326; color: var(--ink); width: 100%; min-width: 0; flex: 1; }
input.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 700; }

/* Buttons */
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; font-weight: 600; transition: transform .08s, background .15s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover:not(:disabled) { background: #1f565b; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn.primary { background: linear-gradient(#f3c95c, #dba630); color: #2b1d04; border-color: #f7dc8d; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(#f8d573, #e3b03c); }
.btn.big { padding: 12px 22px; font-size: 1.05rem; }
.btn.wide { width: 100%; justify-content: center; margin-top: 14px; }
.btn.danger { background: #6b2a20; border-color: #a04a3b; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: #ffffff12; color: var(--ink); }
.btn.call { background: #7b2f24; border-color: #c96a55; }
.btn.call:hover:not(:disabled) { background: #93392c; }
.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #efc04f33; } }
.icon-btn { background: none; border: 0; font-size: 1.3rem; width: 40px; height: 40px; border-radius: 10px; }
.icon-btn:hover { background: #ffffff14; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg-btn { flex: 1; background: #0c2326; border: 0; padding: 10px 6px; font-weight: 600; color: var(--muted); }
.seg-btn.on { background: var(--gold); color: #2b1d04; }

/* Tiles */
.tile {
  position: relative; flex: none; padding: 0; border: 0;
  width: var(--w); height: calc(var(--w) * 1.42);
  --w: var(--tw);
  background: linear-gradient(160deg, #fffaf0, var(--ivory) 60%, #e9dfc4);
  border-radius: calc(var(--w) * .13);
  box-shadow: 0 calc(var(--w) * .07) 0 #1c7a58, 0 calc(var(--w) * .1) calc(var(--w) * .12) #0007;
  display: flex; flex-direction: column; align-items: center;
  transition: transform .12s, box-shadow .12s;
  user-select: none;
}
.tile.lg { --w: calc(var(--tw) * 1.12); }
.tile.sm { --w: calc(var(--tw) * .68); }
.tile.xs { --w: clamp(17px, calc(var(--tw) * .46), 26px); height: calc(var(--w) * 1.36); }
.tile svg { width: 86%; flex: 1; min-height: 0; margin-bottom: 5%; }
.tile svg text { font-family: "Noto Serif CJK SC", "Songti SC", "SimSun", "MS Mincho", "Hiragino Mincho ProN", serif; }
.tile .idx { font-size: calc(var(--w) * .25); line-height: 1; font-weight: 800; align-self: flex-start; margin: 7% 0 0 9%; color: #555; height: calc(var(--w) * .25); }
.tile .idx.s-d { color: #22577a; } .tile .idx.s-b { color: #1d6b4f; } .tile .idx.s-c { color: #b23a2b; }
.tile.xs .idx, .tile.sm .idx { display: none; }
.tile.xs svg, .tile.sm svg { margin: 6% 0; }
.tile.clickable:hover { transform: translateY(-4px); }
.tile.selected { transform: translateY(calc(var(--w) * -.28)); box-shadow: 0 calc(var(--w) * .07) 0 #1c7a58, 0 0 0 3px var(--gold), 0 14px 18px #0008; }
.tile.selected:hover { transform: translateY(calc(var(--w) * -.28)); }
.tile.glow { box-shadow: 0 calc(var(--w) * .07) 0 #1c7a58, 0 0 0 3px var(--gold), 0 0 16px 3px #efc04faa; }
.tile.dim { opacity: .35; }
.tile.drawn { margin-left: calc(var(--w) * .3); }
.tile.back { background: linear-gradient(160deg, #2a9a72, #1c7a58); }
.tile.e-gold { background: linear-gradient(160deg, #fff6c9, #f2d472 70%, #d9ae3a); }
.tile.e-jade { background: linear-gradient(160deg, #eafff3, #a9e6c5 70%, #6fc79b); }
.tile.e-lacquer { background: linear-gradient(160deg, #fff0ea, #f6b8a6 70%, #e58a72); }
.tile .gem { position: absolute; right: 6%; top: 5%; width: 18%; aspect-ratio: 1; border-radius: 50%; border: 1px solid #0005; }
.e-gold .gem { background: #e0a100; } .e-jade .gem { background: #159a5e; } .e-lacquer .gem { background: #c62f1a; }
.tiles { display: flex; flex-wrap: wrap; gap: calc(var(--tw) * .07); row-gap: calc(var(--tw) * .2); justify-content: center; align-items: flex-end; }
.tiles.inline { display: inline-flex; gap: 2px; vertical-align: middle; }
.tiles.river { gap: 2px; row-gap: 5px; justify-content: flex-start; min-height: 30px; }
.tiles.ex { justify-content: flex-start; gap: 2px; margin-top: 6px; }
.melds { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.meld { display: flex; gap: 2px; padding: 4px 5px 7px; background: #0003; border-radius: 8px; }

/* Top bar & HUD */
.topbar { display: flex; align-items: center; gap: 8px; background: #0b2022cc; border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px 4px 4px; }
.topbar .title { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.topbar .title small { color: var(--muted); }
.topbar .coins { font-weight: 700; font-size: 1.05rem; }
.hud { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.goal { flex: 1 1 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.bar { height: 12px; background: #0a1d1f; border-radius: 6px; overflow: hidden; }
.fill { height: 100%; background: linear-gradient(90deg, #dba630, #f7dc8d); border-radius: 6px; transition: width .6s; }
.goal-text { margin-top: 6px; font-size: .95rem; }
.goal-text b { font-size: 1.2rem; color: var(--gold); }
.counters { display: flex; gap: 8px; }
.counter { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 62px; }
.counter small { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .68rem; }
.counter b { font-size: 1.35rem; }
.counter.low b { color: var(--red); }
.counter.btnish:hover { background: var(--panel2); }
.boss-banner { background: #4a1f2c; border: 1px solid #94495b; border-radius: 10px; padding: 7px 12px; font-size: .9rem; }
.boss-banner.lucky { background: #1f4a2e; border-color: #4b9462; }

.relics { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; align-items: center; }
.charm-row { display: flex; gap: 6px; justify-content: center; }
.charm { position: relative; width: 44px; height: 44px; border-radius: 11px; background: linear-gradient(#27595d, #1a4347); border: 1px solid #4b8a8a; display: grid; place-items: center; padding: 0; }
.charm .icon { font-size: 1.45rem; line-height: 1; }
.charm.empty { background: #0002; border: 1px dashed #3d6c6c; }
.charm.round { border-radius: 50%; }
.charm:not(.empty):hover { border-color: var(--gold); }
.charm .badge { position: absolute; right: -5px; bottom: -5px; background: var(--mult); color: #fff; font-size: .68rem; font-weight: 800; border-radius: 8px; padding: 1px 5px; }

.mid { flex: 1; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 6px 0; }
.mid h3 { margin: 0; }
.ready-tag { background: #1f4a2e; border: 1px solid #4b9462; color: #bff0cf; border-radius: 20px; padding: 3px 12px; font-size: .78rem; font-weight: 700; letter-spacing: .03em; }
.tiles.offer { gap: calc(var(--tw) * .22); padding: 8px 0 4px; }
.offer-slot { position: relative; animation: drop .25s backwards; }
.offer-slot:nth-child(2) { animation-delay: .04s; } .offer-slot:nth-child(3) { animation-delay: .08s; }
.offer-slot:nth-child(4) { animation-delay: .12s; } .offer-slot:nth-child(5) { animation-delay: .16s; } .offer-slot:nth-child(6) { animation-delay: .2s; }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
.win-tag { position: absolute; left: 50%; top: -10px; transform: translateX(-50%); background: var(--gold); color: #2b1d04; font-size: .65rem; font-weight: 800; border-radius: 6px; padding: 1px 6px; }

.mine { background: #0b202299; border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; position: relative; }
.mine.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tiles.hand { padding-top: calc(var(--tw) * .3); }
.status { font-size: .88rem; color: var(--muted); display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: center; }
.status.ready { color: #bff0cf; font-weight: 600; }
.status.win { color: var(--gold); font-weight: 700; }
.actions { display: flex; justify-content: center; gap: 6px; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: #041012c4; display: flex; align-items: center; justify-content: center; padding: 10px; z-index: 20; animation: fade .18s; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 100%; max-width: 560px; max-height: calc(100dvh - 20px); overflow-y: auto; position: relative; box-shadow: 0 20px 60px #000a; }
.modal.small { max-width: 400px; }
.modal.wide { max-width: 720px; }
.modal.score-modal { max-width: 640px; }
.modal .close { position: absolute; right: 10px; top: 10px; background: none; border: 0; font-size: 1.1rem; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); }
.modal .close:hover { background: #ffffff14; }
#toast-root { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 40; pointer-events: none; }
.toast { background: #06181a; border: 1px solid var(--line); padding: 8px 16px; border-radius: 20px; animation: fade .2s; transition: opacity .4s; }
.toast.out { opacity: 0; }
.info-head { display: flex; gap: 12px; align-items: center; padding-right: 30px; }
.info-head h3 { margin: 0; }
.big-icon { font-size: 2rem; line-height: 1; }

/* Score tally */
.tally { margin: 12px 0; cursor: pointer; }
.tally-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.tally-box { border-radius: 12px; padding: 6px 16px; min-width: 110px; text-align: center; color: #fff; }
.tally-box small { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .65rem; opacity: .85; }
.tally-box.pts { background: #1f6aa5; } .tally-box.mult { background: #c24a2a; }
.tally-box .num { font-size: 1.7rem; font-weight: 800; display: inline-block; }
.num.bump { animation: bump .25s; }
@keyframes bump { 40% { transform: scale(1.35); } }
.times { font-size: 1.6rem; font-weight: 800; }
.tally-lines { margin: 10px auto; max-height: 190px; overflow-y: auto; max-width: 420px; }
.tally-line { display: flex; justify-content: space-between; gap: 10px; padding: 3px 4px; border-bottom: 1px dashed #ffffff14; animation: slide .2s; font-size: .93rem; }
.tally-line.pattern span:first-child { font-weight: 700; }
.tally-line.charm span:first-child { color: var(--gold); }
@keyframes slide { from { opacity: 0; transform: translateX(-10px); } }
.tally-total { text-align: center; font-size: 2.6rem; font-weight: 800; color: var(--gold); font-family: Georgia, serif; min-height: 3.2rem; opacity: 0; transform: scale(.6); transition: all .3s cubic-bezier(.2, 1.6, .4, 1); }
.tally-total.show { opacity: 1; transform: none; }
.chip { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: .78rem; font-weight: 800; margin-left: 4px; color: #fff; white-space: nowrap; }
.chip.pts { background: #1f6aa5; } .chip.mult { background: #c24a2a; } .chip.xmult { background: #a3248f; } .chip.coin { background: #8a6a12; }
.tiles.result-hand { gap: 3px; row-gap: 8px; align-items: center; }
.result-hand .meld { margin-right: 6px; }

/* Shop */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.shop-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.shop-card h4 { margin: 4px 0 0; font-size: 1rem; }
.shop-card p { font-size: .85rem; color: var(--muted); margin: 0 0 8px; flex: 1; }
.shop-card .kind { font-size: .65rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.shop-card.k-charm { border-color: #b08d2e; } .shop-card.k-scroll { border-color: #5a86b8; }
.shop-card.k-work { border-color: #5fa37e; } .shop-card.k-talisman { border-color: #a568b3; }
.shop-card.sold { opacity: .4; }
.shop-card .buy { width: 100%; justify-content: center; font-size: .9rem; }
.sold-tag { font-weight: 700; color: var(--muted); padding: 9px; }
.reward { background: #1f4a2e; border: 1px solid #4b9462; border-radius: 10px; padding: 8px 12px; text-align: center; font-weight: 600; }
.owned { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 8px; }
.next-gate { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: auto; }
.next-gate.boss, .gate-card.boss { border-color: #94495b; }
.boss-desc { color: #f3b6c1; font-size: .9rem; }

/* Gate card */
.gate-card { text-align: center; }
.gate-title { font-size: 1.1rem; color: var(--muted); }
.target { margin: 16px 0; }
.target small { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.target .big { font-size: 3rem; font-weight: 800; font-family: Georgia, serif; color: var(--gold); line-height: 1.1; }
.gate-stats { display: flex; gap: 8px 18px; justify-content: center; flex-wrap: wrap; margin: 10px 0 16px; color: var(--muted); }
.gate-stats b { color: var(--ink); font-size: 1.1rem; }

/* Patterns / wall modals */
.pattern-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.pattern-row { background: #0003; border-radius: 10px; padding: 8px 10px; }
.pattern-top { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pattern-top b { margin-right: auto; }
.pattern-desc { color: var(--muted); font-size: .85rem; }
.lv { color: var(--gold); font-size: .78rem; font-weight: 700; }
.wall-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; justify-content: center; }
.wall-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700; font-size: .85rem; }
.wall-cell.none { opacity: .3; }

/* Table */
.opps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.opp { background: #0b202299; border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 5px; position: relative; min-width: 0; }
.opp.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.opp-head { display: flex; align-items: center; gap: 5px; min-width: 0; }
.opp-head .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }
.score { font-weight: 800; color: var(--gold); }
.wind { font-family: serif; background: #0a1d1f; border: 1px solid var(--line); border-radius: 6px; width: 24px; height: 24px; display: grid; place-items: center; font-size: .9rem; flex: none; }
.wind.dealer { background: var(--red); border-color: #f3a595; color: #fff; }
.opp-sub { display: flex; gap: 8px; align-items: center; font-size: .78rem; flex-wrap: wrap; }
.mini-charms { display: flex; gap: 1px; }
.mini { background: none; border: 0; padding: 0 1px; font-size: .95rem; }
.opp .melds { justify-content: flex-start; gap: 4px; }
.opp .meld { padding: 2px 3px 5px; }
.callout { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--red); color: #fff; font-weight: 800; font-size: 1.2rem; padding: 6px 16px; border-radius: 20px; box-shadow: 0 6px 20px #000a; animation: pop .3s cubic-bezier(.2, 1.8, .4, 1); z-index: 5; white-space: nowrap; font-family: Georgia, serif; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }
.centre { flex: 1; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.centre .row { margin-top: 0; }
.last-discard { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.prompt { font-size: .95rem; }
.timer { background: #0a1d1f; border-radius: 8px; padding: 1px 7px; font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 700; }
.table-mine .river { align-self: stretch; padding: 0 6px; }
.me-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.me-bar .charm { width: 34px; height: 34px; border-radius: 9px; }
.me-bar .charm .icon { font-size: 1.1rem; }
.standings { margin: 10px auto; max-width: 380px; display: grid; gap: 4px; }
.stand-row { display: grid; grid-template-columns: 1fr auto 80px; gap: 10px; padding: 5px 10px; background: #0003; border-radius: 8px; }
.stand-row b { text-align: right; }
.stand-row.me { outline: 1px solid var(--gold); }
.standings.final .stand-row { grid-template-columns: 1fr auto; font-size: 1.1rem; padding: 9px 12px; }
.up { color: var(--green); font-weight: 700; } .down { color: #ff9d8a; font-weight: 700; }

/* Menu */
.menu { justify-content: center; max-width: 560px; }
.logo { text-align: center; margin: 10px 0 4px; }
.logo h1 { font-size: clamp(2.6rem, 12vw, 4rem); margin: 10px 0 0; color: var(--gold); text-shadow: 0 3px 0 #7a5a12, 0 8px 24px #0008; }
.tagline { color: var(--muted); margin: 0; }
.logo-tiles { gap: 6px; }
.tilt0 { transform: rotate(-9deg) translateY(6px); } .tilt1 { transform: rotate(-3deg); } .tilt2 { transform: rotate(3deg); } .tilt3 { transform: rotate(9deg) translateY(6px); }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.menu-item { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; transition: transform .1s, background .15s; }
.menu-item:hover { background: var(--panel2); transform: translateX(3px); }
.menu-item span:last-child { display: flex; flex-direction: column; }
.menu-item b { font-size: 1.08rem; }
.menu-item small { color: var(--muted); }
.menu-item.primary { border-color: var(--gold); background: linear-gradient(90deg, #3a3413, var(--panel) 70%); }
.menu-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .85rem; }

/* Lobby */
.or { text-align: center; color: var(--muted); margin: 14px 0 0; font-size: .85rem; }
.room-code { display: block; margin: 4px auto; background: #0a1d1f; border: 1px dashed var(--gold); border-radius: 12px; font-size: 2.6rem; font-weight: 800; letter-spacing: .3em; padding: 6px 10px 6px 26px; color: var(--gold); font-family: Georgia, serif; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.seat { display: flex; align-items: center; gap: 8px; background: #0003; border-radius: 10px; padding: 8px 10px; font-weight: 600; min-width: 0; }
.seat .big-icon { font-size: 1.4rem; }
.seat.bot { color: var(--muted); font-weight: 400; }

/* Tutorial */
.tutorial { max-width: 680px; }
.tut-card { max-width: none; flex: 1; }
.tut-card .tiles { margin: 10px 0; }
.dots { display: flex; gap: 4px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: #2f6466; }
.dots span.past { background: var(--muted); } .dots span.on { background: var(--gold); }
.tut-hand { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: center; margin: 12px 0; }
.tut-group { display: flex; flex-direction: column; align-items: center; color: var(--muted); }
.tut-group .tiles { margin: 0 0 4px; gap: 2px; }
.tut-suit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.tut-suit b { min-width: 86px; }
.tut-suit .tiles { margin: 0; gap: 2px; }
.tut-msg { text-align: center; padding: 8px 12px; border-radius: 10px; background: #0003; margin: 10px 0; font-weight: 600; }
.tut-msg.ok { background: #1f4a2e; color: #bff0cf; } .tut-msg.bad { background: #5b241c; color: #ffd0c6; }
.tiles.task { gap: calc(var(--tw) * .2); padding-top: calc(var(--tw) * .35); }
.tut-pats { display: grid; gap: 10px; margin: 10px 0; }
.tut-pats > div { background: #0003; border-radius: 10px; padding: 8px 10px; }
.tut-pats .tiles { justify-content: flex-start; margin: 6px 0 0; gap: 2px; }
.tut-list { display: grid; gap: 8px; margin: 10px 0; }
.tut-list > div { display: flex; gap: 12px; align-items: center; background: #0003; border-radius: 10px; padding: 8px 12px; }
.tut-list.small > div { display: block; font-size: .92rem; }
.tut-nav { margin-top: 0; }

@media (max-width: 620px) {
  .screen { padding: 6px 6px 18px; gap: 8px; }
  .card { padding: 16px; }
  .counter { min-width: 52px; padding: 4px 8px; }
  .tally-box { min-width: 90px; }
  .opp-head .name { font-size: .8rem; }
  .mid { min-height: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Phones with notches / home indicators, and app-like touch behaviour */
.screen {
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}
.overlay { padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#toast-root { bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); }
html.native, html.native body { overscroll-behavior: none; }
html.native body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.native input { -webkit-user-select: text; user-select: text; }
