/* Layout: a grimy basement table — opponents along the top edge, the three decks in the middle,
   your hand at the bottom, the event log pinned on the right. Deliberately one dark look. */
:root {
  color-scheme: dark;
  --floor: #17110e; --floor-2: #2a1d16; --line: #4a382c;
  --paper: #ebdfc6; --paper-2: #d6c3a1; --ink: #1d1512;
  --blood: #b8322a; --blood-dk: #6e1a13;
  --gold: #e3b23c; --soul: #9fd8e8; --curse: #9b6bd1;
  --fg: #efe4d0; --muted: #a8957f; --good: #bfe3a5; --bad: #ff9c8f;
  --loot-back: #3e4c5c; --mon-back: #5a2230; --tre-back: #6f521a;
  --f-display: "Underdog", "Comic Sans MS", cursive;
  --f-body: "Nunito", "Segoe UI", system-ui, sans-serif;
  --cw: 116px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(ellipse at 50% 35%, var(--floor-2), var(--floor) 72%) fixed var(--floor); color: var(--fg); font-family: var(--f-body); font-size: 14px; line-height: 1.4; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.app { padding-block: 14px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.game { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr) 270px; grid-template-areas: "top top" "opp log" "board log" "me log"; align-items: start; }
@media (max-width: 980px) { .game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "opp" "board" "me" "log"; } }

h1 { font-family: var(--f-display); font-weight: 400; font-size: 32px; margin: 0; color: var(--paper); letter-spacing: .5px; text-wrap: balance; line-height: 1.05; }
h1 span { color: var(--blood); }
h2 { font-family: var(--f-display); font-weight: 400; font-size: 18px; margin: 0 0 8px; color: var(--muted); letter-spacing: .3px; }
h2 small { font-family: var(--f-body); font-size: 12px; margin-left: 6px; }
.label { font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.hint { color: var(--muted); font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }

.btn { font-weight: 800; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 7px 12px; cursor: pointer; box-shadow: 2px 2px 0 #000; transition: transform .08s; }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
.btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
.btn.red { background: var(--blood); color: #fff7ee; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); box-shadow: none; }
.btn.big { font-size: 17px; padding: 10px 18px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.field { background: #fff8ea; color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 8px 10px; min-width: 0; }
.field.code { text-transform: uppercase; letter-spacing: 3px; font-weight: 800; width: 12ch; }

/* ---------- home & lobby ---------- */
.home, .lobby { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.home h1 { font-size: clamp(40px, 8vw, 72px); }
.lede { max-width: 62ch; color: var(--muted); font-size: 15px; margin: 0; }
.panel { background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.roomcode { font-family: var(--f-display); font-size: 44px; letter-spacing: 6px; color: var(--gold); line-height: 1; }
.seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.seat { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 76px; }
.seat.free { border-style: dashed; color: var(--muted); grid-template-columns: 1fr auto; }
.seat .who { font-family: var(--f-display); font-size: 18px; line-height: 1.1; overflow-wrap: anywhere; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.badge { font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; border: 1.5px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.badge.host { border-color: var(--gold); color: var(--gold); }
.badge.you { border-color: var(--soul); color: var(--soul); }
.badge.off { border-color: var(--bad); color: var(--bad); }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; box-shadow: 2px 2px 0 #000; flex-wrap: wrap; }
.seg button { background: var(--paper-2); color: var(--ink); border: 0; border-right: 2px solid var(--ink); padding: 6px 12px; font-weight: 800; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--gold); }
.seg button:disabled { cursor: default; }

/* ---------- players ---------- */
.top { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.turninfo { color: var(--muted); }
.turninfo b { color: var(--fg); }
.timer { font-family: var(--f-display); font-size: 22px; color: var(--fg); font-variant-numeric: tabular-nums; min-width: 3.2ch; display: inline-block; }
.timer.low { color: var(--bad); }
.tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.opps { grid-area: opp; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.pl { background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px 10px; align-content: start; }
.pl.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 26px rgba(227, 178, 60, .14); }
.pl.dead { opacity: .55; }
.pl .who { font-family: var(--f-display); font-size: 18px; line-height: 1.1; overflow-wrap: anywhere; }
.pl .chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.portrait { width: 52px; height: 52px; background: var(--paper); border: 2px solid var(--ink); border-radius: 50%; overflow: hidden; display: block; flex: none; }
.portrait svg, .portrait img { width: 100%; height: 100%; display: block; }
.stat { display: inline-flex; align-items: center; gap: 3px; }
.stat svg { width: 18px; height: 18px; }
.hp svg { width: 17px; height: 17px; }
.hp.lost svg { filter: grayscale(1) brightness(.45); }
.chip { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 999px; padding: 1px 8px 1px 3px; }
.chip svg { width: 16px; height: 16px; }
.chip img { width: 18px; height: 18px; object-fit: contain; }
.chip.tapped { opacity: .5; text-decoration: line-through; }
.chip.curse { background: #d9c8ef; }
.chip.minor { background: transparent; color: var(--muted); border-color: var(--line); }
button.chip { cursor: pointer; font: inherit; font-size: 11.5px; }
button.chip:hover { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.chip.threat { border-color: var(--blood); box-shadow: 0 0 0 1px var(--blood); }
.pl { cursor: pointer; transition: border-color .12s; }
.pl:hover { border-color: var(--muted); }

/* ---------- board ---------- */
.board { grid-area: board; display: grid; gap: 12px; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: "coach coach" "fight fight" "mon mon" "shop loot"; }
.zone h2 .btn { margin-left: 10px; font-family: var(--f-body); vertical-align: middle; }
.coach { grid-area: coach; background: var(--paper); color: var(--ink); border: 2px solid var(--gold); border-radius: 12px; box-shadow: 3px 4px 0 rgba(0, 0, 0, .5); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.coach .label { color: var(--blood-dk); }
.coach p { margin: 0; font-size: 14.5px; max-width: 70ch; }
.coach .btn.ghost { color: var(--ink); border-color: var(--ink); }
.zone { background: rgba(0, 0, 0, .2); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.zmon { grid-area: mon; } .zshop { grid-area: shop; } .zloot { grid-area: loot; }

/* ---------- cards ---------- */
.card { width: var(--cw); min-height: calc(var(--cw) * 1.42); background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 3px; position: relative; box-shadow: 2px 3px 0 rgba(0, 0, 0, .5); font-size: calc(var(--cw) * .095); line-height: 1.2; text-align: left; transform: rotate(var(--r, 0deg)); transition: transform .12s, box-shadow .12s; }
.card > span { display: block; }
.card .nm { font-family: var(--f-display); font-size: calc(var(--cw) * .12); line-height: 1.05; min-height: 2.1em; }
.card .art { height: calc(var(--cw) * .64); display: grid; place-items: center; }
.card .art svg { height: 100%; width: auto; max-width: 100%; }
.card .art:has(img) { position: relative; }
.card .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.card .txt { font-size: calc(var(--cw) * .09); flex: 1; }
.card .foot { display: flex; justify-content: space-between; gap: 2px; font-weight: 800; font-size: calc(var(--cw) * .1); font-variant-numeric: tabular-nums; border-top: 1.5px dashed rgba(29, 21, 18, .35); padding-top: 3px; }
.card .foot span { display: inline-flex; align-items: center; gap: 1px; }
.card .foot svg { width: calc(var(--cw) * .12); height: calc(var(--cw) * .12); }
.card .tag { position: absolute; top: -.85em; right: .6em; background: var(--ink); color: var(--paper); font-size: calc(var(--cw) * .082); font-weight: 800; letter-spacing: .6px; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }
.card.boss { background: linear-gradient(#efd2c4, #d9a99a); border-color: var(--blood-dk); }
.card.boss .tag { background: var(--blood); }
.card.tre { background: linear-gradient(#f1e2b8, #d9bf82); }
.card.ev { background: linear-gradient(#dfe3e6, #b9c2c9); }
.card.cu { background: linear-gradient(#e2d4f2, #bda6db); }
.card.loot { width: calc(var(--cw) * .86); min-height: calc(var(--cw) * 1.18); }
.card.loot .art { height: calc(var(--cw) * .46); }
.card.small { width: calc(var(--cw) * .86); min-height: 0; }
.card.small .art { height: calc(var(--cw) * .4); }
.card.small .nm { min-height: 0; }
.card.tapped { transform: rotate(8deg); filter: saturate(.3) brightness(.75); }
button.card { cursor: pointer; }
button.card:hover { transform: translateY(-5px) rotate(-1.5deg); box-shadow: 0 0 0 3px var(--gold), 3px 7px 0 rgba(0, 0, 0, .5); }
.card.dim { opacity: .6; }
.card.threat { box-shadow: 0 0 0 3px var(--blood), 2px 3px 0 rgba(0, 0, 0, .5); }
@media (hover: hover) { div.card[data-cid] { cursor: zoom-in; } }
.card.sel { box-shadow: 0 0 0 4px var(--gold), 3px 5px 0 rgba(0, 0, 0, .5); }
.card.taken { opacity: .45; }
.price { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; font-weight: 800; font-size: 12px; padding: 0 8px; white-space: nowrap; }
.hpbar { height: 6px; background: rgba(29, 21, 18, .25); border-radius: 3px; overflow: hidden; }
.hpbar i { display: block; height: 100%; background: var(--blood); transition: width .25s; }
.back { width: var(--cw); min-height: calc(var(--cw) * 1.42); border: 2px solid var(--ink); border-radius: 8px; display: grid; place-items: center; text-align: center; padding: 8px; color: var(--paper); font-family: var(--f-display); font-size: 16px; line-height: 1.1; box-shadow: 3px 4px 0 rgba(0, 0, 0, .5), 6px 7px 0 rgba(0, 0, 0, .25); background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 6px, transparent 6px 12px); }
.back small { display: block; font-family: var(--f-body); font-size: 11px; opacity: .8; margin-top: 4px; }
.back.loot { background-color: var(--loot-back); } .back.mon { background-color: var(--mon-back); } .back.tre { background-color: var(--tre-back); }
.back.art { background-size: cover; background-position: center; place-items: end center; padding: 6px; }
.back.art span { background: rgba(29, 21, 18, .85); border-radius: 6px; padding: 3px 7px; font-size: 13px; }
button.back { cursor: pointer; }
button.back:hover { box-shadow: 0 0 0 3px var(--gold), 3px 4px 0 rgba(0, 0, 0, .5); }
.empty { width: var(--cw); min-height: calc(var(--cw) * 1.42); border: 2px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

/* ---------- fight ---------- */
.fight { grid-area: fight; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; background: linear-gradient(90deg, rgba(110, 26, 19, .45), rgba(0, 0, 0, .35)); border: 2px solid var(--blood-dk); border-radius: 12px; padding: 12px 16px; }
.fside { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.fside .who { font-family: var(--f-display); font-size: 18px; }
.fmid { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.die { width: 76px; height: 76px; }
.die svg { width: 100%; height: 100%; }
.die.spin { animation: wob .12s linear infinite; }
@keyframes wob { 0% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } 100% { transform: rotate(-12deg); } }
.fmsg { font-family: var(--f-display); font-size: 20px; line-height: 1.15; text-wrap: balance; }
.fmsg.hit { color: var(--gold); } .fmsg.miss { color: #ff8f80; }
.fneed { color: var(--muted); font-size: 13px; }

/* ---------- me ---------- */
.me { grid-area: me; background: rgba(0, 0, 0, .32); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 16px; }
.me.active { border-color: var(--gold); }
.mehead { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mehead .who { font-family: var(--f-display); font-size: 22px; line-height: 1; }
.meright { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.counters { display: flex; flex-wrap: wrap; gap: 6px; }
.counter { border: 1.5px solid var(--line); border-radius: 6px; padding: 2px 8px; font-weight: 800; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.counter.off { opacity: .45; }
.endrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- log ---------- */
.log { grid-area: log; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; position: sticky; top: max(14px, env(safe-area-inset-top, 0px)); max-height: calc(100vh - 28px); overflow: auto; }
@media (max-width: 980px) { .log { position: static; max-height: 260px; } }
.log ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.log li { border-bottom: 1px solid rgba(74, 56, 44, .5); padding-bottom: 3px; }
.log li.sep { color: var(--gold); font-weight: 800; border: 0; margin-top: 6px; }
.log li.good { color: var(--good); } .log li.bad { color: var(--bad); } .log li.soul { color: var(--soul); font-weight: 800; }

/* ---------- modal, toast, connection ---------- */
#modal { position: fixed; inset: 0; background: rgba(10, 6, 4, .7); display: grid; place-items: center; z-index: 50; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.dlg { background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 12px; box-shadow: 6px 8px 0 #000; padding: 18px; max-width: 560px; width: 100%; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg h3 { font-family: var(--f-display); font-weight: 400; font-size: 24px; margin: 0; line-height: 1.1; }
.dlg .opts { display: flex; flex-direction: column; gap: 6px; }
.opt { text-align: left; background: #fff8ea; border: 2px solid var(--ink); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-weight: 800; color: var(--ink); }
.opt:hover { background: var(--gold); }
.opt small { display: block; font-weight: 400; font-size: 12px; }
.dlg .btn.ghost { color: var(--ink); border-color: var(--ink); align-self: flex-start; }
.dlg .timer { color: var(--ink); font-size: 18px; }
.rules { font-size: 14px; line-height: 1.5; }
.rules h4 { font-family: var(--f-display); font-weight: 400; font-size: 18px; margin: 8px 0 2px; }
.rules p, .rules ul { margin: 0 0 4px; }
.rules ul { padding-left: 20px; }
#toast { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); border: 2px solid var(--gold); border-radius: 8px; padding: 8px 14px; font-weight: 800; z-index: 60; max-width: calc(100% - 32px); }
#conn { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--blood); color: #fff7ee; text-align: center; font-weight: 800; padding: max(8px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
/* ---------- телефон: нижня панель, каруселі, шторки ---------- */
.mbar { display: none; }
button, .card, .back { touch-action: manipulation; }
.log ol, .sheetlog ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.sheetlog { overflow: auto; min-height: 0; }
.sheetlog li { border-bottom: 1px solid rgba(74, 56, 44, .5); padding-bottom: 3px; }
.sheetlog li.sep { color: var(--gold); font-weight: 800; border: 0; margin-top: 6px; }
.sheetlog li.good { color: var(--good); } .sheetlog li.bad { color: var(--bad); } .sheetlog li.soul { color: var(--soul); font-weight: 800; }
.dlg.dark { background: var(--floor-2); color: var(--fg); border-color: var(--line); }
.dlg.dark .btn.ghost { color: var(--fg); border-color: var(--line); }
.dlg .card { --cw: 128px; }
.zoom { display: grid; place-items: center; padding: 10px 0 4px; }
.row.peek { padding-top: 8px; row-gap: 18px; }
.reacts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.reacts .opt { text-align: center; padding: 8px 4px; }
.reacts .opt.emoji { font-size: 26px; line-height: 1.1; }
.reacts .opt:not(.emoji) { grid-column: span 5; }
@media (min-width: 701px) { .reacts .opt:not(.emoji) { grid-column: span 1; font-size: 13px; } }

/* ---------- анімації: числа над картками, плашка, реакції ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.float { position: fixed; transform: translate(-50%, -50%); font-family: var(--f-display); font-size: 22px; font-weight: 400; white-space: nowrap; color: var(--paper); text-shadow: 0 2px 0 #000, 0 0 6px #000; animation: rise 1.3s ease-out forwards; }
.float.bad { color: #ff7a6b; } .float.good { color: var(--good); } .float.gold { color: var(--gold); } .float.dim { color: var(--muted); }
.float.loot { color: #b9cde3; font-size: 17px; } .float.soul { color: var(--soul); }
.float.big { font-size: 34px; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.bubble { position: fixed; transform: translate(-50%, -100%); background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; padding: 4px 12px; font-weight: 800; font-size: 15px; white-space: nowrap; box-shadow: 2px 3px 0 #000; animation: pop 3s ease-out forwards; }
.bubble.emoji { font-size: 30px; padding: 2px 10px; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -9px; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--ink); border-bottom: 0; }
@keyframes pop { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); } 8% { opacity: 1; transform: translate(-50%, -100%) scale(1.08); } 14% { transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -115%); } }
#banner { position: fixed; top: max(62px, calc(env(safe-area-inset-top, 0px) + 52px)); left: 50%; transform: translateX(-50%); z-index: 46; display: flex; align-items: center; gap: 10px; background: rgba(29, 21, 18, .95); color: var(--paper); border: 2px solid var(--gold); border-radius: 12px; padding: 6px 14px 6px 6px; font-weight: 800; font-size: 15px; box-shadow: 0 6px 18px rgba(0, 0, 0, .55); max-width: calc(100% - 32px); pointer-events: none; }
#banner.show { animation: drop .25s ease-out; }
#banner .bpic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
#banner .bpic img { width: 100%; height: 100%; object-fit: contain; }
#banner .bpic .portrait { width: 40px; height: 40px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dlg .zoom .card { --cw: min(230px, 62vw); --r: 0deg; }
.dlg .zoom .card.tapped { transform: none; filter: none; }

@media (max-width: 700px) {
  :root { --cw: 104px; }
  .game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "opp" "board" "me"; gap: 10px; padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  .game .log { display: none; }
  .game .top h1 { display: none; }
  .game .top { gap: 6px 10px; }
  .game .turninfo { font-size: 13px; flex: 1 1 100%; min-width: 0; }
  .game .tools { margin-left: 0; }
  .game .tools .btn { padding: 4px 9px; font-size: 12.5px; }
  .lobby h1, .home h1 { font-size: 34px; }
  .roomcode { font-size: 36px; }
  .lobby, .home { gap: 14px; }
  .panel { padding: 12px; gap: 10px; }
  .seats { gap: 8px; }
  .seat { min-height: 0; padding: 8px 10px; grid-template-columns: 40px minmax(0, 1fr) auto; }
  .seat .portrait { width: 40px; height: 40px; }
  .seat .who { font-size: 16px; }
  .seat.free { min-height: 48px; }

  .opps { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 4px; scroll-snap-type: x proximity; }
  .pl { flex: none; width: 172px; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 8px; padding: 8px; cursor: pointer; scroll-snap-align: start; }
  .pl .portrait { width: 36px; height: 36px; }
  .pl .who { font-size: 15px; }
  .pl .who .hint { display: none; }
  .pl .chips { display: none; }
  .pl .stats { gap: 2px 8px; font-size: 12.5px; }
  .pl .stat svg, .pl .hp svg { width: 14px; height: 14px; }

  .row.scroll, .opps { scrollbar-width: thin; }
  .row.scroll { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 12px 4px 14px; margin: -8px -4px -6px; }
  .row.scroll > * { flex: none; scroll-snap-align: start; }
  .board { grid-template-columns: minmax(0, 1fr); grid-template-areas: "coach" "fight" "mon" "shop"; gap: 10px; }
  .coach p { font-size: 13.5px; }
  #banner { font-size: 13.5px; }
  .zloot { display: none; }
  .zone { padding: 8px 10px; }
  .zone h2 { margin-bottom: 2px; }

  .fight { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding: 10px; }
  .fight .portrait { width: 40px; height: 40px; }
  .fight .fside .who { font-size: 15px; }
  .fight .fside > .hint { display: none; }
  .fight .card { --cw: 86px; }
  .fmid { gap: 6px; }
  .die { width: 54px; height: 54px; }
  .fmsg { font-size: 16px; }
  .fneed { font-size: 11.5px; }
  .fctl { display: none; }

  .me { grid-template-columns: minmax(0, 1fr); padding: 10px; gap: 8px; }
  .mehead { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
  .mehead .portrait { width: 40px; height: 40px; }
  .mehead .who { font-size: 19px; }
  .endrow .hint { display: none; }
  .desk-only { display: none !important; }

  .mbar { display: flex; flex-direction: column; gap: 6px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(23, 17, 14, .97); border-top: 2px solid var(--line); box-shadow: 0 -8px 20px rgba(0, 0, 0, .45); padding: 6px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .ticker { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
  .ticker.good { color: var(--good); } .ticker.bad { color: var(--bad); } .ticker.soul { color: var(--soul); } .ticker.sep { color: var(--gold); }
  .mbar-row { display: flex; align-items: center; gap: 10px; min-height: 46px; }
  .mbar-row .stats { flex: none; gap: 2px 8px; font-size: 13px; flex-wrap: nowrap; }
  .mbar-row .stat svg, .mbar-row .hp svg { width: 15px; height: 15px; }
  .mact { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; text-align: right; }
  .mact .btn { min-height: 44px; }
  .mact .btn.big { font-size: 16px; padding: 8px 14px; }

  #modal { place-items: end stretch; padding: 0; }
  .dlg { max-width: none; border-radius: 16px 16px 0 0; border-bottom: 0; box-shadow: 0 -6px 0 rgba(0, 0, 0, .6); max-height: 88vh; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .dlg .card { --cw: 112px; }
  .dlg .btn { min-height: 44px; }
  .opt { padding: 11px 12px; }
  #toast { bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
