@import url(/static/fonts/fonts.css);

/* MAHLZEIT!: a slate office at dusk, a light laminate meeting table, cards
   framed in the five department colours, mustard like the coffee mugs. */
:root {
  --night: #1d2733;
  --night-2: #263241;
  --mustard: #f4b942;
  --mustard-dk: #b9821a;
  --ink: #1f2933;
  --muted: #66727f;
  --line: #e2e6ea;
  --paper: #ffffff;
  --table: #e9e4da;
  --table-2: #ddd6c8;
  --good: #2b9348;
  --bad: #d62828;
  --blue: #2f6fd6;
  --radius: 14px;
  --display: Anton, Impact, 'Arial Narrow', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--night); }
body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 60px 60px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 60px 60px,
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(244, 185, 66, .13), transparent 70%),
    var(--night);
  background-attachment: fixed;
  color: var(--ink); font-family: Montserrat, system-ui, sans-serif; font-size: 15px; line-height: 1.45;
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1500px; }
main > h2 { color: #fff; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-weight: 800; }
p { margin: 0 0 .5rem; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center, .center-text { text-align: center; }

/* ---------------------------------------------------------------- logo */
.logo { display: inline-flex; align-items: center; gap: .12em; line-height: 1; white-space: nowrap; user-select: none; color: #fff; }
.logo-cup { width: .95em; height: .95em; color: var(--mustard); transform: translateY(-.04em) rotate(-8deg); }
.logo-cup svg { width: 100%; height: 100%; display: block; }
.logo-cup path:first-child { animation: steam 2.4s ease-in-out infinite; }
@keyframes steam { 50% { opacity: .35; transform: translateY(-1px); } }
.logo-word { font-family: var(--display); letter-spacing: .03em; text-shadow: .04em .05em 0 rgba(0,0,0,.35); }
.logo-bang { color: var(--mustard); display: inline-block; transform: rotate(8deg); margin-left: .02em; }
.hero-logo { font-size: clamp(3.2rem, 14vw, 6.4rem); }
.brand-logo { font-size: 1.5rem; }

/* ---------------------------------------------------------------- topbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(16, 22, 30, .8); color: #fff; flex-wrap: wrap; backdrop-filter: blur(6px); }
.topbar a, .topbar .linkbtn { color: #fff; text-decoration: none; font-weight: 600; }
.brand { display: flex; align-items: center; padding: 2px 6px; }
.topbar nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; box-shadow: none; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 4px; color: var(--ink); }
input, select { width: 100%; padding: 11px 12px; border: 2px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--mustard); box-shadow: 0 0 0 3px rgba(244, 185, 66, .35); }
button, .btn { font: inherit; font-weight: 800; border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer; background: #34465a; color: #fff; text-decoration: none; display: inline-block; box-shadow: 0 3px 0 #16202b; transition: transform .08s, filter .15s; }
button:hover { filter: brightness(1.08); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #16202b; }
button:disabled { opacity: .45; cursor: default; }
.btn-accent, .btn-main { background: var(--mustard); color: #2a1d05; box-shadow: 0 3px 0 var(--mustard-dk); }
.btn-accent:active, .btn-main:active { box-shadow: 0 1px 0 var(--mustard-dk); }
.btn-main.dim { filter: saturate(.4) brightness(.9); }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.sso-btn::before { content: '🔑 '; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 900; font-size: 1.4rem; text-align: center; }

/* ---------------------------------------------------------------- layout */
.panel { background: var(--paper); border-radius: var(--radius); padding: 18px; box-shadow: 0 10px 30px rgba(5, 10, 20, .4); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.notice { padding: 12px 14px; border-radius: 10px; background: #fff; border-left: 5px solid var(--blue); }
.notice.err { border-left-color: var(--bad); }
.notice.ok { border-left-color: var(--good); background: #f1faf2; }
.pill { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #edf0f3; color: var(--ink); margin-right: 4px; }
.pill.off { background: #f3f3f3; color: #888; }
.pill.gold { background: var(--mustard); color: var(--ink); }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,.15); }
.copybox { display: flex; gap: 6px; }
.copybox input { font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; border-left: 5px solid var(--mustard); z-index: 2000; max-width: calc(100vw - 32px); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.spinner { width: 14px; height: 14px; border: 3px solid rgba(255,255,255,.35); border-top-color: var(--mustard); border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 8px; animation: spin .9s linear infinite; }
.panel .spinner { border-color: var(--line); border-top-color: var(--mustard-dk); }
@keyframes spin { to { transform: rotate(360deg); } }
.wait { color: var(--muted); font-weight: 600; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(40px); } }

/* ---------------------------------------------------------------- home */
.hero { text-align: center; margin: 10px 0 26px; color: #fff; }
.hero .subtitle { max-width: 640px; margin: 10px auto 0; color: #d7dee6; }
.hero-cards { display: flex; justify-content: center; margin: 18px 0 18px; --cw: clamp(92px, 19vw, 160px); }
.hero-cards .card { margin: 0 calc(var(--cw) * -.22); transform: rotate(var(--r)) translateY(calc(abs(var(--i) - 2) * 10px)); animation: hero-in .7s cubic-bezier(.2,.8,.3,1.2) backwards; animation-delay: calc(var(--i) * 90ms); box-shadow: 0 10px 22px rgba(0,0,0,.45); transition: transform .2s; }
.hero-cards .card:hover { transform: rotate(0) translateY(-14px) scale(1.06); z-index: 2; }
@keyframes hero-in { from { opacity: 0; transform: translateY(-120px) rotate(-30deg); } }
.rules { padding-left: 1.3rem; margin: 0 0 1rem; }
.rules li { margin-bottom: .55rem; }
.rules li::marker { color: var(--mustard-dk); font-weight: 900; }
.dept-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.dept-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--dc) 10%, #fff); border-left: 5px solid var(--dc); }
.dept-ic { width: 26px; height: 26px; border-radius: 50%; background: var(--dc); display: inline-grid; place-items: center; flex: none; }
.dept-ic svg { width: 80%; height: 80%; }
.kw-list { list-style: none; padding: 0; margin: 0; columns: 2 300px; }
.kw-list li { break-inside: avoid; padding: 4px 0; display: flex; gap: 6px; align-items: baseline; }
.kw-list .kw-ic { width: 16px; height: 16px; flex: none; color: var(--muted); align-self: center; }
.kw-ic svg { width: 100%; height: 100%; display: block; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { background: #34465a; padding: 7px 14px; border-radius: 999px; box-shadow: none; border: 2px solid var(--dc, transparent); }
.tab.on { background: var(--dc, var(--mustard)); color: #fff; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--cw), 1fr)); gap: 14px; --cw: 190px; justify-items: center; }
.gallery.small-cards { --cw: 140px; max-height: 70vh; overflow: auto; padding: 4px; }

/* ---------------------------------------------------------------- lobby */
.code-text { font-family: var(--display); font-size: clamp(2.4rem, 10vw, 3.4rem); letter-spacing: .18em; color: var(--ink); }
.qr { width: 170px; height: 170px; display: block; margin: 0 auto; border-radius: 12px; border: 6px solid #fff; box-shadow: 0 0 0 3px var(--mustard); }
.lobby-player { flex-direction: column; align-items: stretch !important; }
.row-line { display: flex; gap: 10px; align-items: center; }
.players .tags { margin-top: 2px; }
.deck-pick { margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.dept-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--dc, #999) 45%, #fff); }
.dept-chip .dept-ic { width: 22px; height: 22px; }
.dept-chip.on { background: var(--dc, var(--ink)); color: #fff; box-shadow: none; }
.dept-chip.rand { padding-left: 10px; }
.dept-chip.rand.on { background: var(--ink); }
.deck-line { display: flex; gap: 6px; margin-top: 6px; }
.grid-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* ---------------------------------------------------------------- cards */
.card {
  --cw: 150px;
  width: var(--cw); aspect-ratio: 5 / 7; flex: none; position: relative;
  font-size: calc(var(--cw) * .072); border-radius: .55em; padding: .32em;
  display: flex; flex-direction: column; gap: .22em; color: var(--ink);
  background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 82%, #fff), var(--dc) 55%, color-mix(in srgb, var(--dc) 75%, #000));
  box-shadow: 0 .15em .4em rgba(0,0,0,.35), inset 0 0 0 .08em rgba(255,255,255,.35);
  user-select: none; text-align: left; line-height: 1.2;
}
.card.kind-instant::after { content: ''; position: absolute; inset: .14em; border-radius: .48em; border: .1em dashed rgba(255,255,255,.55); pointer-events: none; }
.c-head { display: flex; align-items: center; gap: .2em; background: #fffdf7; border-radius: .32em; padding: .14em .28em; min-height: 1.6em; }
.c-name { font-family: var(--display); font-size: 1.02em; letter-spacing: .01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-cost { display: flex; gap: .08em; flex: none; }
.pip { width: 1.15em; height: 1.15em; border-radius: 50%; background: var(--pc); display: inline-grid; place-items: center; flex: none; box-shadow: 0 .05em 0 rgba(0,0,0,.35); vertical-align: -.2em; }
.pip svg { width: 82%; height: 82%; display: block; }
.pip-n { background: #ced4da; color: var(--ink); font-weight: 900; font-size: .78em; width: 1.45em; height: 1.45em; }
.pip-t { background: #495057; color: #fff; }
.pip-t span, .pip-t svg { width: 78%; height: 78%; display: block; }
.pip-s { width: 1.25em; height: 1.25em; }
.pip-s.pip-n { width: 1.25em; height: 1.25em; font-size: .9em; }
.c-art { border-radius: .28em; overflow: hidden; aspect-ratio: 120 / 84; flex: none; box-shadow: 0 0 0 .1em rgba(0,0,0,.28); background: #fff; }
.c-art svg, .c-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.c-type { font-size: .7em; font-weight: 800; background: color-mix(in srgb, var(--dl, #eee) 75%, #fff); border-radius: .3em; padding: .12em .45em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-text { flex: 1; min-height: 0; background: #fffdf7; border-radius: .32em; padding: .32em .45em; font-size: .72em; line-height: 1.22; overflow: hidden; }
.c-text p { margin: 0 0 .3em; }
.c-text .kw-line b { font-weight: 800; }
.c-flavor { font-style: italic; color: #6b6f76; font-size: .92em; border-top: .06em solid #e5e1d6; padding-top: .25em; }
.c-pt { position: absolute; right: .3em; bottom: .25em; background: #fff; border: .14em solid var(--dc); border-radius: .45em; font-family: var(--display); font-size: 1.22em; padding: .02em .38em; line-height: 1.1; box-shadow: 0 .08em .2em rgba(0,0,0,.3); }
.c-pt .slash { opacity: .5; margin: 0 .06em; }
.c-pt.up { color: var(--good); }
.c-pt.down, .c-pt.hurt { color: var(--bad); }
.card.token { background: linear-gradient(160deg, #f8e6a0, #d9b44a); --dc: #b98c12; }

/* mini: on the board */
.card.mini { --cw: 86px; aspect-ratio: 4 / 5; font-size: calc(var(--cw) * .1); padding: .22em; gap: .16em; }
.card.mini .c-head { padding: .08em .22em; min-height: 1.35em; }
.card.mini .c-name { font-size: .82em; }
.card.mini .c-cost { display: none; }
.card.mini .c-art { flex: 1; aspect-ratio: auto; }
.card.mini .c-type { display: none; }
.card.mini .c-pt { font-size: 1.2em; right: .18em; bottom: .16em; }
.card.mini.kind-instant::after { display: none; }
.c-kws { position: absolute; left: .2em; bottom: .2em; display: flex; gap: .1em; }
.c-kws .kw-ic { width: 1.25em; height: 1.25em; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--ink); display: grid; place-items: center; padding: .14em; box-shadow: 0 .05em .15em rgba(0,0,0,.3); }
.c-badges { position: absolute; top: 1.7em; right: .2em; display: flex; flex-direction: column; gap: .12em; align-items: flex-end; }
.badge { font-size: .8em; font-weight: 900; border-radius: .5em; padding: .04em .35em; color: #fff; box-shadow: 0 .05em .15em rgba(0,0,0,.35); }
.b-plus { background: var(--good); }
.b-stun { background: #495057; }
.b-dmg { background: var(--bad); }
.b-sick { background: rgba(255,255,255,.9); color: var(--ink); }
.card.back { background: #26313d; padding: .2em; }
.back-inner { flex: 1; border-radius: .4em; overflow: hidden; border: .12em solid rgba(255,255,255,.18); }
.back-inner svg { width: 100%; height: 100%; display: block; }
.card.big { --cw: min(300px, 72vw); }

/* ---------------------------------------------------------------- game */
body.in-game { overflow: hidden; }
.game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.gamebar { display: flex; align-items: center; gap: 14px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); color: #fff; background: rgba(16, 22, 30, .85); font-size: .9rem; position: relative; z-index: 30; }
.gamebar .linkbtn { color: #fff; font-weight: 700; }
.gb-code { font-family: var(--display); letter-spacing: .12em; color: var(--mustard); }
.gb-day { font-weight: 700; opacity: .85; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 130%; background: #fff; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 6px; display: flex; flex-direction: column; min-width: 200px; z-index: 50; }
.menu button { background: none; color: var(--ink); box-shadow: none; text-align: left; padding: 9px 12px; border-radius: 8px; font-weight: 600; }
.menu button:hover { background: #f1f3f5; }
.play-area { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 290px; }
.board {
  --bw: clamp(64px, 11.5vh, 124px); --hw: clamp(84px, 16vh, 156px);
  min-height: 0; display: flex; flex-direction: column; padding: 6px 10px 0; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 50% 50%, rgba(255,255,255,.35), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.018) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, var(--table-2), var(--table) 30%, var(--table) 70%, var(--table-2));
  border-radius: 18px 18px 0 0; margin: 6px 0 0 8px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.4), 0 10px 30px rgba(0,0,0,.4);
}
.side { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; justify-content: flex-start; }
.side-me { justify-content: flex-end; }
.board .row { display: flex; gap: 8px; align-items: center; min-height: 0; overflow-x: auto; overflow-y: visible; padding: 8px 4px; scrollbar-width: thin; }
.board .row.units { flex: 1; min-height: calc(var(--bw) * 1.25 + 16px); justify-content: center; }
.board .row.sites { padding: 2px 4px; gap: 10px; min-height: 40px; justify-content: center; }
.board .card.mini { --cw: var(--bw); cursor: pointer; transition: transform .18s, box-shadow .18s, filter .18s; }
.board .row.sites .card.mini { --cw: calc(var(--bw) * .6); }
.board .card.mini:hover { transform: translateY(-3px); }
.card.tapped { transform: rotate(9deg) translateY(4px) !important; filter: saturate(.55) brightness(.86); }
.side-me .card.attacking { transform: translateY(-14px) !important; box-shadow: 0 0 0 3px var(--bad), 0 12px 20px rgba(0,0,0,.35); }
.side-opp .card.attacking { transform: translateY(14px) !important; box-shadow: 0 0 0 3px var(--bad), 0 12px 20px rgba(0,0,0,.35); }
.side-me .card.attacking.tapped, .side-opp .card.attacking.tapped { filter: none; }
.card.blocking { box-shadow: 0 0 0 3px var(--blue), 0 8px 16px rgba(0,0,0,.3); }
.card.can-act { box-shadow: 0 0 0 3px #fff, 0 0 14px 4px rgba(255,255,255,.8); }
.card.can-use { box-shadow: 0 0 0 3px var(--mustard), 0 0 14px 3px rgba(244,185,66,.75); }
.card.selected { box-shadow: 0 0 0 4px var(--bad), 0 0 18px 6px rgba(214,40,40,.55) !important; transform: translateY(-10px) !important; }
.attack-mode .side-me .card.selected { box-shadow: 0 0 0 4px var(--bad), 0 0 18px 6px rgba(214,40,40,.55) !important; }
.block-mode .card.selected { box-shadow: 0 0 0 4px var(--blue), 0 0 18px 6px rgba(47,111,214,.55) !important; }
.can-target { animation: pulse 1s ease-in-out infinite; cursor: crosshair !important; }
.card.can-target { box-shadow: 0 0 0 4px #ffd60a, 0 0 18px 6px rgba(255,214,10,.7); }
@keyframes pulse { 50% { filter: brightness(1.15); transform: scale(1.04); } }
.targeting .card:not(.can-target), .targeting .site { filter: saturate(.5) brightness(.85); }
.card.stunned .c-art::after { content: 'Zzz'; position: absolute; inset: 1.4em .2em auto .2em; text-align: center; font-family: var(--display); color: #fff; font-size: 1.4em; text-shadow: 0 0 .3em #000; }
.card.temp .c-pt { box-shadow: 0 0 0 .12em #ffd60a; }
.combat-tag { position: absolute; top: -.6em; left: 50%; transform: translateX(-50%); font-family: var(--display); font-size: .95rem; color: #fff; background: var(--bad); border-radius: 999px; padding: 0 .5em; line-height: 1.4; box-shadow: 0 2px 4px rgba(0,0,0,.3); z-index: 2; }
.combat-tag.ct-block { background: var(--blue); }

.site-group { display: flex; }
.site { width: 28px; height: 34px; border-radius: 6px; background: linear-gradient(160deg, color-mix(in srgb, var(--dc) 80%, #fff), var(--dc)); display: grid; place-items: center; margin-right: -9px; box-shadow: 0 2px 4px rgba(0,0,0,.3), inset 0 0 0 2px rgba(255,255,255,.4); cursor: pointer; transition: transform .2s, opacity .2s; }
.site:last-child { margin-right: 0; }
.site-ic { width: 70%; height: 70%; }
.site-ic svg { width: 100%; height: 100%; display: block; }
.site.tapped { opacity: .45; transform: rotate(14deg) translateY(3px); }

.hud { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.life { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 62px; height: 52px; border-radius: 12px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.15), inset 0 0 0 3px var(--mustard); cursor: default; flex: none; }
.life.can-target { cursor: crosshair; box-shadow: 0 0 0 4px #ffd60a, 0 0 18px 6px rgba(255,214,10,.7); }
.life-n { font-family: var(--display); font-size: 1.7rem; line-height: 1; }
.life-l { font-size: .55rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hud-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .95rem; }
.hud.active .hud-name strong { text-decoration: underline 3px var(--mustard); text-underline-offset: 3px; }
.hud.deciding .life { animation: think 1.6s ease-in-out infinite; }
@keyframes think { 50% { box-shadow: 0 3px 0 rgba(0,0,0,.15), inset 0 0 0 3px var(--mustard), 0 0 0 5px rgba(244,185,66,.35); } }
.hud-depts { display: flex; gap: 3px; }
.mini-dept { width: 18px; height: 18px; border-radius: 50%; background: var(--dc); display: inline-grid; place-items: center; }
.mini-dept svg { width: 78%; height: 78%; }
.piles { display: flex; gap: 10px; align-items: center; }
.pile { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: .9rem; background: none; color: var(--ink); box-shadow: none; padding: 0; border-radius: 6px; }
.pile .card.pile-card { --cw: 30px; aspect-ratio: 5 / 7; padding: 2px; }
.pile .card.mini.pile-card { --cw: 30px; }
.pile .card.mini.pile-card > :not(.c-art) { display: none; }
.pile-empty { width: 30px; height: 42px; border: 2px dashed rgba(0,0,0,.2); border-radius: 5px; }
.budget { font-weight: 800; font-size: .9rem; background: #fff; border-radius: 999px; padding: 2px 9px; box-shadow: 0 2px 0 rgba(0,0,0,.12); }
.pile-ic { font-size: 1.6rem; line-height: 1; }
.peek { display: flex; gap: 8px; align-items: center; padding: 0 6px; overflow-x: auto; }
.peek-cards { display: flex; gap: 4px; }
.peek .card.mini { --cw: 54px; }

.mid { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 8px; margin: 2px -10px; background: rgba(31, 41, 51, .9); color: #fff; position: relative; min-height: 64px; }
.steps { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: .78rem; }
.whose { font-weight: 800; margin-right: 6px; }
.mid-mine .whose { color: var(--mustard); }
.step { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: #b8c2cc; }
.step.on { background: var(--mustard); color: #2a1d05; font-weight: 800; }
.fog { font-weight: 800; color: #ffd6d6; }
.stack-view { display: flex; gap: 8px; align-items: center; }
.stack-item { display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.1); border-radius: 10px; padding: 4px 8px 4px 4px; border-left: 4px solid var(--pc); cursor: pointer; animation: stack-in .3s ease-out; }
@keyframes stack-in { from { transform: scale(1.5); opacity: 0; } }
.stack-item .card.mini { --cw: 44px; }
.stack-item .card.mini > :not(.c-art) { display: none; }
.si-text { font-size: .8rem; max-width: 150px; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.actions .hint { font-size: .85rem; max-width: 340px; color: #e9edf1; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 9px 16px; }
.waiting .spinner { margin: 0; }
.clock { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.12); --left: 1; }
.clock::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--left) * 100%); background: var(--mustard); transition: width .2s linear; }

.my-hand { display: flex; justify-content: center; align-items: flex-start; padding: 8px 8px 0; height: calc(var(--hw) * .95); flex: none; position: relative; z-index: 5; }
.my-hand .card { --cw: var(--hw); margin: 0 min(0px, ((100vw - 340px) / var(--n) - var(--hw)) / 2); transform: translateY(var(--ty)) rotate(var(--r)); transform-origin: 50% 120%; cursor: pointer; transition: transform .18s, box-shadow .18s; z-index: 1; }
.my-hand .card:hover { transform: translateY(calc(var(--hw) * -.62)) scale(1.3); z-index: 5; }
.my-hand .card.selected { transform: translateY(calc(var(--hw) * -.3)); z-index: 4; }
.my-hand .card.can-discard { box-shadow: 0 0 0 3px var(--bad); }

.side-panel { display: flex; flex-direction: column; gap: 10px; padding: 10px; min-height: 0; color: #fff; }
.inspect { display: flex; justify-content: center; align-items: center; min-height: calc(260px * 1.4); color: #8d99a6; font-size: .85rem; text-align: center; }
.inspect .card { --cw: 260px; }
.log { flex: 1; min-height: 0; overflow: auto; background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px; font-size: .82rem; }
.log h3 { font-size: .9rem; color: var(--mustard); }
.log ul { list-style: none; padding: 0; margin: 0; }
.log li { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.07); color: #d7dee6; }

.overlay { position: fixed; inset: 0; background: rgba(10, 14, 20, .62); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } }
.preview { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.preview .card { animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.state-line { color: #fff; display: flex; gap: 10px; font-weight: 700; }
.grave-panel { max-width: 900px; width: 100%; }
.rules-modal { max-width: 860px; max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.rules-modal .rules-panel { margin-top: 0 !important; }
.over-panel { text-align: center; min-width: min(420px, 90vw); }
.over-panel h2 { font-family: var(--display); font-size: 2.4rem; letter-spacing: .02em; }
.over-panel.won h2 { color: var(--mustard-dk); }
.score { display: flex; justify-content: center; gap: 30px; margin: 12px 0 16px; }
.score div { display: flex; flex-direction: column; }
.over-panel .btns { justify-content: center; }

/* floating feedback */
.fly-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.float { position: fixed; transform: translate(-50%, -50%); font-family: var(--display); font-size: 2rem; color: #fff; -webkit-text-stroke: 2px rgba(0,0,0,.6); paint-order: stroke fill; animation: rise 1.3s ease-out forwards; white-space: nowrap; }
.f-dmg, .f-life { color: #ff4d4d; }
.f-gain { color: #6ee07c; }
.f-die { font-size: 1.3rem; color: #fff; background: #1f2933; -webkit-text-stroke: 0; padding: 2px 10px; border-radius: 8px; }
.f-info { font-size: 1.1rem; color: #fff; background: var(--blue); -webkit-text-stroke: 0; padding: 2px 10px; border-radius: 8px; }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }
.banner { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: var(--display); font-size: clamp(1.8rem, 6vw, 3.2rem); color: #fff; background: rgba(31,41,51,.92); padding: 10px 36px; border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: banner 1.6s ease-in-out forwards; white-space: nowrap; }
.banner.mine { background: var(--mustard); color: #2a1d05; }
@keyframes banner { 0% { opacity: 0; transform: translate(-30%, -50%); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-70%, -50%); } }
.ghost { position: fixed !important; margin: 0 !important; z-index: 210; }
.g-die { animation: g-die .8s ease-in forwards; }
.g-layoff { animation: g-layoff .85s ease-in forwards; }
.g-counter { animation: g-counter .7s ease-out forwards; }
@keyframes g-die { to { opacity: 0; transform: translateY(30px) rotate(-18deg) scale(.6); filter: grayscale(1); } }
@keyframes g-layoff { 30% { transform: translateY(-10px); } to { opacity: 0; transform: translate(60px, 40px) rotate(25deg) scale(.5); filter: grayscale(1) brightness(.6); } }
@keyframes g-counter { to { opacity: 0; transform: scale(1.6); filter: hue-rotate(160deg) brightness(1.4); } }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1100px) {
  .play-area { grid-template-columns: 1fr; }
  .my-hand .card { margin: 0 min(0px, ((100vw - 40px) / var(--n) - var(--hw)) / 2); }
  .side-panel { display: none; }
  .board { margin: 4px 4px 0; }
}
@media (max-width: 700px) {
  .board { --bw: min(66px, 11.5vh); --hw: min(100px, 17vh); padding: 4px 4px 0; }
  .my-hand { height: calc(var(--hw) * 1.1); }
  .hud { gap: 8px; padding: 2px 4px; }
  .life { width: 50px; height: 42px; }
  .life-n { font-size: 1.35rem; }
  .board .row { padding: 6px 2px; gap: 5px; }
  .board .row.sites { min-height: 32px; }
  .site { width: 22px; height: 28px; margin-right: -8px; }
  .mid { min-height: 52px; gap: 6px; padding: 4px 6px; margin: 2px -4px; }
  .steps .step:not(.on) { display: none; }
  .actions .hint { font-size: .78rem; max-width: 100%; }
  .actions button { padding: 8px 12px; font-size: .9rem; }
  .my-hand .card { margin: 0 min(0px, ((100vw - 20px) / var(--n) - var(--hw)) / 2); }
  .my-hand .card:hover { transform: translateY(var(--ty)) rotate(var(--r)); }
  .gamebar { font-size: .8rem; gap: 10px; }
  .si-text { display: none; }
  .hud-name { font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
