:root {
  --bg: #121820;
  --bg2: #18212c;
  --panel: #1f2a37;
  --panel2: #273444;
  --line: #2f3d4e;
  --text: #e8edf3;
  --muted: #94a3b6;
  --accent: #f2c14e;
  --accent-ink: #2a1f00;
  --accent2: #6fd3c0;
  --good: #5ee08f;
  --bad: #ff7b72;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 700px at 15% -10%, #1d2a3a 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
[hidden] { display: none !important; }

/* ---------- buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--panel2); font-weight: 600; text-decoration: none; color: var(--text);
  transition: transform .08s ease, background .15s ease, border-color .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #314155; border-color: #42556b; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: #ffd36a; }
.btn.ghost { background: transparent; }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); }
.btn.big { padding: 13px 20px; font-size: 16px; border-radius: 13px; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn.floating { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; box-shadow: var(--shadow); }
.mini {
  padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line); background: transparent;
  font-size: 12px; color: var(--muted);
}
.mini:hover { color: var(--text); border-color: #4a5d73; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  font-weight: 800; font-size: 16px; display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: var(--panel2); }
input.text, .field input, .field select, .join-row input, .linkbox input, .chat-form input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #111821; outline: none; transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--accent); }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.field.inline { margin: 12px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); }
.disc {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  font-size: 12px; font-weight: 800; color: #111;
}
.disc.sm { width: 14px; height: 14px; border-width: 1.5px; vertical-align: -2px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; margin-left: 8px; }
.pill.warn { background: rgba(255, 123, 114, .16); color: var(--bad); border: 1px solid rgba(255, 123, 114, .35); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h2 { font-size: 18px; margin-bottom: 14px; }

/* ---------- tiles (svg) */
.tile-svg { display: block; width: 100%; height: auto; overflow: visible; }
.t-val { font: 800 17px var(--font); fill: #fff; }
.t-fx { font-size: 19px; }
.t-fx.small { font-size: 14px; }
.t-blind { font: 900 21px var(--font); fill: #2b2156; }
.t-cnt { font: 800 11px var(--font); }
.t-back-val { font: 800 15px var(--font); fill: #3a2a00; }
.glyph { vertical-align: -3px; }

/* ---------- home */
#app.home { min-height: 100%; }
.home-wrap { max-width: 560px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 18px; }
.hero { text-align: center; padding-top: 8px; }
.hero-logo { width: 64px; margin: 0 auto 10px; }
.hero h1 { font-size: 44px; font-weight: 800; letter-spacing: .5px; background: linear-gradient(90deg, #ff8a6e, #f2c14e 35%, #6cb2f2 70%, #86c977); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); margin: 6px 0 18px; }
.hero-tiles { display: flex; justify-content: center; gap: 12px; }
.hero-tiles > div { width: 74px; transform: rotate(var(--r)); animation: float 4s ease-in-out infinite; animation-delay: var(--d); filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .45)); }
@keyframes float { 50% { translate: 0 -6px; } }
.home-card { display: grid; gap: 14px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
.features { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; color: var(--muted); font-size: 13.5px; }
.rules-card summary { cursor: pointer; font-weight: 700; }
.rules h4 { margin: 16px 0 6px; font-size: 15px; color: var(--accent); }
.rules p, .rules li { color: #cdd6e0; }
.rules ol, .rules ul { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.fatal { text-align: center; display: grid; gap: 12px; justify-items: center; margin-top: 12vh; }
.loading { height: 100%; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- room shell */
#app.room { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(24, 33, 44, .92); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 18px; flex: none; }
.brand .logo-svg { width: 28px; height: 28px; }
.room-chip {
  display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--panel); padding: 0; flex: none;
}
.rc-code { padding: 6px 10px; font-weight: 800; letter-spacing: 2px; }
.rc-invite { padding: 6px 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; align-self: stretch; display: grid; place-items: center; }
.status { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status .st { overflow: hidden; text-overflow: ellipsis; }
.status .st.me { color: var(--accent); font-weight: 800; animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .65; } }
.tb-right { display: flex; align-items: center; gap: 6px; flex: none; }
.voicebox { display: flex; align-items: center; gap: 6px; }
.vbtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 14px;
}
.vbtn.join { background: #1f3b37; border-color: #2c5a52; color: #bff3e8; }
.vbtn.join:hover { background: #24483f; }
.vbtn.live { background: #1d3d2b; border-color: #2f6a47; color: #c8f7d8; }
.vbtn.muted { background: #3d2323; border-color: #6a3333; color: #ffd0cc; }
.vbtn.leave { padding: 0 11px; color: var(--bad); }
.vbtn.speaking { box-shadow: 0 0 0 3px rgba(94, 224, 143, .55); }
.vn { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--good); color: #062; font-style: normal; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.vcount { color: var(--muted); font-size: 13px; }
.vi { font-size: 12px; }
.conn-banner { flex: none; text-align: center; padding: 6px; background: #5b2a1f; color: #ffd9cf; font-size: 13px; font-weight: 600; }

/* ---------- lobby */
.lobby-main {
  flex: 1; min-height: 0; overflow: auto; padding: 16px; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); grid-template-rows: auto auto 1fr; max-width: 1200px; width: 100%; margin: 0 auto;
}
.invite-card { grid-column: 1; }
.seats-card { grid-column: 1; }
.chat-card { grid-column: 2; grid-row: 1 / span 3; display: flex; flex-direction: column; min-height: 420px; padding: 0; overflow: hidden; }
.invite { display: flex; gap: 18px; align-items: center; }
.qr { width: 176px; height: 176px; border-radius: 12px; background: #fff; padding: 6px; flex: none; }
.qr.big { width: 240px; height: 240px; }
.invite-info { display: grid; gap: 10px; min-width: 0; }
.invite-info p { margin: 0; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-size: 13.5px; min-width: 0; }
.invite-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.code-big { font-size: 18px; letter-spacing: 3px; color: var(--accent); }
.seats-card h2 .count { color: var(--muted); font-weight: 600; font-size: 14px; margin-left: 6px; }
.seats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seat { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); transition: box-shadow .2s; }
.seat.empty { justify-content: center; color: var(--muted); border-style: dashed; background: transparent; font-size: 14px; }
.seat-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name em, .pname em { color: var(--muted); font-style: normal; font-weight: 500; }
.online { width: 9px; height: 9px; border-radius: 50%; background: #56606c; flex: none; }
.online.on { background: var(--good); box-shadow: 0 0 8px var(--good); }
.speaking { box-shadow: 0 0 0 2px rgba(94, 224, 143, .75), 0 0 16px rgba(94, 224, 143, .35) !important; }
.spec-title { margin: 14px 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.spec-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 10px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.chip.offline, .spec-line .offline { opacity: .5; }
.lobby-ctl { margin-top: 14px; display: grid; gap: 4px; }
.lobby-ctl .row { display: flex; gap: 8px; flex-wrap: wrap; }
.lobby-ctl .btn.big { margin-top: 4px; }
.settings-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.time-custom { grid-column: 1 / -1; margin-top: 0; }
.tc-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tc-row input { width: 74px; }
.tc-row em { font-style: normal; color: var(--muted); font-weight: 500; margin-right: 6px; }
.fx-fire { color: #e2ccff; }
.clock {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: rgba(255, 255, 255, .09);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); vertical-align: 1px;
}
.clock.low { background: rgba(255, 123, 114, .2); color: var(--bad); animation: glow 1s ease-in-out infinite; }
.pscore .clock { display: block; margin: 0 0 2px; font-size: 11.5px; text-align: center; }
.pscore .clock[hidden] { display: none; }
.waiting { margin: 10px 0 0; }

/* ---------- game layout */
.game-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px; }
.stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.board-tabs { flex: none; display: flex; gap: 6px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; }
.board-tabs::-webkit-scrollbar { display: none; }
.btab {
  flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 6px 11px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); font-size: 13px; font-weight: 600; color: var(--muted);
}
.btab b { color: var(--text); margin-left: 4px; }
.btab.shown { color: var(--text); background: var(--panel2); border-color: #46596f; }
.btab.on { border-color: var(--accent); }
.turn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; animation: glow 1.2s infinite; }
.board-area { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.boards { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px 10px 10px; }

/* score strip: everyone's marker on one rail towards the goal */
#trackHost { flex: none; }
.strack {
  margin: 8px 10px 0; padding: 8px 18px 18px; border-radius: 12px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); transition: border-color .15s;
}
.strack:hover { border-color: #46596f; }
.st-rail { position: relative; height: calc(24px + var(--levels, 0) * 11px); }
.st-rail::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #26313f, #34465b 70%, #4d3d14);
}
.st-ticks i { position: absolute; bottom: 0; width: 1px; height: 6px; background: rgba(255, 255, 255, .16); }
.st-ticks i.major { height: 9px; bottom: -1.5px; background: rgba(255, 255, 255, .32); }
.st-ticks b { position: absolute; top: 11px; transform: translateX(-50%); font-size: 10.5px; color: var(--muted); font-weight: 600; }
.st-goal { position: absolute; top: -2px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px rgba(242, 193, 78, .6); }
.st-goal span { position: absolute; top: 100%; margin-top: 1px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.st-goal.reached { animation: glow 1.2s ease-in-out infinite; }
.st-mk {
  position: absolute; bottom: calc(2px + var(--lv, 0) * 11px); width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .55); z-index: calc(var(--lv, 0) + 1);
  transition: left .8s cubic-bezier(.3, 1.25, .5, 1), bottom .3s;
}
.st-mk.me { border-color: var(--accent2); }
.st-mk.active { box-shadow: 0 0 0 3px rgba(242, 193, 78, .75), 0 2px 5px rgba(0, 0, 0, .55); }

/* full harmony bar */
.harmony-host { flex: 1; min-height: 0; display: flex; padding: 8px 10px 10px; }
.harmony {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px;
  border-radius: 14px; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 30%, rgba(242, 193, 78, .06), transparent 60%), #172029;
}
.hb-body { flex: 1; min-height: 0; border-radius: 10px; overflow: hidden; background: #3f7639; }
.hb-body.scroll { overflow-y: auto; overscroll-behavior: contain; }
.hb-svg { width: 100%; height: 100%; display: block; }
.hb-svg.portrait { height: auto; }
.hm-num { font-family: var(--font); font-weight: 700; fill: #4f3d22; }
.hm-num.big { font-weight: 800; fill: #3a2a12; }
.hm-stone.past { opacity: .82; }
.hm-emblem { font: 800 13px var(--font); fill: #5a4320; letter-spacing: 1.5px; }
.hm-pennant { font: 800 16px var(--font); fill: #3a2a00; }
.hm-pennant-sub { font: 700 11px var(--font); fill: #5a4320; }
.hm-sign { font: 800 12.5px var(--font); fill: #5a3d1c; letter-spacing: .5px; }
.hm-title { font: 800 25px var(--font); fill: #5a4320; letter-spacing: 3px; }
.hb-mk { transition: transform .9s cubic-bezier(.3, 1.2, .5, 1); }
.hb-mk .shade { fill: rgba(0, 0, 0, .38); }
.hb-mk .top { stroke: #fff; stroke-width: 2.5; }
.hb-mk.me .top { stroke: var(--accent2); stroke-width: 3.5; }
.hb-mk.active .top { stroke: var(--accent); stroke-width: 4.5; }
.hb-mk text { font: 800 19px var(--font); }
.hb-legend { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; }
.hb-title { width: 100%; font-weight: 700; }
.hb-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 5px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); }
.hb-row.active { border-color: var(--accent); }
.hb-row .disc { width: 24px; height: 24px; font-size: 11px; }
.hb-score { font-weight: 800; }
.hb-note { width: 100%; font-size: 12px; }
.boards.single { grid-template-columns: minmax(0, 1fr); }
.boards.grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.boards.grid.n3, .boards.grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.boards.grid.n5 { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
/* "all boards": the harmony map sits in a strip above the grid */
.all-map { flex: 0 0 40%; min-height: 0; display: flex; padding: 8px 10px 0; }
.harmony.embedded { position: relative; padding: 0; gap: 0; border-radius: 12px; overflow: hidden; }
.harmony.embedded .hb-legend { display: none; }
.hb-expand { display: none; }
.harmony.embedded .hb-expand {
  display: block; position: absolute; right: 8px; top: 8px; padding: 5px 10px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(18, 24, 32, .72); font-size: 12.5px; font-weight: 700;
}
.harmony.embedded .hb-expand:hover { background: rgba(18, 24, 32, .9); }

.board {
  position: relative; min-width: 0; min-height: 0; border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(111, 211, 192, .07), transparent 65%),
    radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px) 0 0 / 22px 22px,
    #172029;
  border: 1px solid var(--line);
}
.board.is-active { border-color: rgba(242, 193, 78, .65); box-shadow: inset 0 0 0 1px rgba(242, 193, 78, .3); }
.board-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.board-svg .world { pointer-events: none; } /* hit-testing is done on the svg from coordinates */
.board.dragging .board-svg { cursor: grabbing; }
.board.compact .board-svg { cursor: zoom-in; }
.board.interactive .board-svg { cursor: crosshair; }
.board-label { position: absolute; left: 10px; top: 8px; display: flex; align-items: center; gap: 6px; font-size: 13px; pointer-events: none; background: rgba(18, 24, 32, .72); padding: 3px 10px; border-radius: 99px; }
.board-label:empty { display: none; }
.board-label span { color: var(--accent); font-weight: 700; }
.board-label em { font-style: normal; color: var(--accent); font-size: 12px; animation: glow 1.2s infinite; }
.board-tools { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; opacity: .85; }
.board-tools button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: rgba(31, 42, 55, .9); font-weight: 800; }
.board.compact .board-tools { display: none; }
.board-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--muted); font-size: 13px; }

.cell-legal rect { fill: rgba(242, 193, 78, .06); stroke: rgba(242, 193, 78, .6); stroke-width: 2.5; stroke-dasharray: 8 7; }
.cell-legal path { stroke: rgba(242, 193, 78, .7); stroke-width: 3; stroke-linecap: round; }
.cell-legal.locked rect { stroke: var(--accent); stroke-dasharray: none; stroke-width: 3.5; }
.tile { transition: opacity .2s; }
.tile.ghost { opacity: .9; filter: drop-shadow(0 0 10px rgba(242, 193, 78, .65)); }
.tile.completing > rect:first-child { stroke: #ffe28a; stroke-width: 4; }
.tile.last > rect:first-child { stroke: var(--accent); stroke-width: 4; animation: lastpulse 1.8s ease-in-out 3; }
@keyframes lastpulse { 50% { stroke-opacity: .2; } }
.disc-fresh { animation: pop .9s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pop { 50% { transform: scale(1.25); } }
.aim { stroke-width: 4; stroke-dasharray: 3 9; stroke-linecap: round; opacity: .9; pointer-events: none; }
.gain rect { fill: #f5c542; stroke: #7a5a00; stroke-width: 2; }
.gain text { font: 800 17px var(--font); fill: #3a2a00; }

.hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3; pointer-events: auto;
  background: rgba(242, 193, 78, .14); color: #ffe7a6; border: 1px solid rgba(242, 193, 78, .45);
  padding: 7px 14px; border-radius: 99px; font-size: 13.5px; white-space: nowrap; backdrop-filter: blur(6px);
}
.actionbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4;
  width: min(720px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: rgba(31, 42, 55, .95); border: 1px solid #3c4d62; border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.ab-tile { width: 62px; flex: none; padding: 0; border: 0; background: none; transition: transform .2s; }
.ab-rot { display: flex; flex-direction: column; gap: 4px; }
.rbtn { width: 38px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); font-size: 17px; line-height: 1; }
.rbtn:hover { background: #33465b; }
.ab-info { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.45; }
.ab-btns { display: flex; flex-direction: column; gap: 6px; flex: none; }

/* ---------- side panels */
.side { min-height: 0; display: flex; flex-direction: column; background: var(--bg2); border-left: 1px solid var(--line); }
.side-tabs { display: none; }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
.panel { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .8px; color: #c6d1dd; }
.p-chat { flex: 1 0 300px; display: flex; flex-direction: column; padding: 0; border-bottom: 0; min-height: 300px; }

.display { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 7px; }
.display.live .mtile:not(:disabled) { animation: invite 2s ease-in-out infinite; }
@keyframes invite { 50% { box-shadow: 0 0 0 2px rgba(242, 193, 78, .35); } }
.mtile { padding: 0; border: 0; background: none; border-radius: 12px; transition: transform .15s, box-shadow .15s, opacity .15s; }
.mtile:not(:disabled):hover { transform: translateY(-3px); }
.mtile:disabled { opacity: .92; }
.mtile.sel { transform: translateY(-4px) scale(1.04); box-shadow: 0 0 0 3px var(--accent), 0 10px 18px rgba(0, 0, 0, .45); animation: none !important; }
.mtile .tile-svg { transition: transform .2s; }
.pending { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 8px; border-radius: 12px; background: rgba(242, 193, 78, .08); border: 1px dashed rgba(242, 193, 78, .45); font-size: 13.5px; }
.pending .mtile { width: 58px; flex: none; }
.p-market > .btn { margin-top: 10px; }
.mk-row { display: flex; gap: 14px; margin-top: 14px; align-items: flex-start; }
.mk-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; white-space: nowrap; }
.pile { width: 70px; flex: none; text-align: center; }
.pile-top { width: 56px; margin: 0 auto 4px; filter: drop-shadow(3px 3px 0 #0b1016) drop-shadow(3px 3px 0 #0b1016); }
.pile-top.empty { height: 56px; border: 1px dashed var(--line); border-radius: 10px; filter: none; }
.inter { flex: 1; min-width: 0; padding: 0 0 2px; }
.inter.live { background: rgba(111, 211, 192, .08); border-radius: 12px; box-shadow: 0 0 0 1px rgba(111, 211, 192, .45); padding: 6px; }
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.slot { aspect-ratio: 1; border: 1px dashed var(--line); border-radius: 10px; }

.prow {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, box-shadow .2s;
}
.prow:hover { border-color: #46596f; }
.prow.active { border-color: var(--accent); background: linear-gradient(90deg, rgba(242, 193, 78, .1), transparent 70%), var(--panel); }
.pmain { flex: 1; min-width: 0; }
.pname { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pname .first { color: var(--accent); font-size: 13px; }
.pname .off { font-size: 11px; color: var(--bad); font-weight: 600; }
.pbar { height: 5px; border-radius: 3px; background: #0f151c; margin: 5px 0 4px; overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 3px; transition: width .5s; box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset; }
.pstats { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.pscore { font-size: 22px; font-weight: 800; min-width: 38px; text-align: right; }
.spec-line { font-size: 13px; color: var(--muted); margin: 8px 2px 2px; }
.p-players > .btn { margin-top: 6px; }
.end-ctl { display: grid; gap: 6px; margin-top: 10px; }

/* ---------- chat */
/* the chat panel; not ".chat", which is also the class of a chat message */
.chat-box { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-box .panel-head { padding: 12px 14px 0; margin-bottom: 6px; }
.logtoggle { font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 8px; display: flex; flex-direction: column; gap: 4px; }
/* flex: none — in the scrolling column the browser would otherwise squash messages to fit
   instead of scrolling, and their text spills over the next ones */
.msg { flex: none; font-size: 14px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.chat .who { font-weight: 700; margin-right: 6px; white-space: nowrap; }
.msg.chat .txt { color: #e3e9ef; }
.msg.chat { padding: 5px 10px; background: var(--panel2); border-radius: 12px 12px 12px 4px; align-self: flex-start; max-width: 92%; }
.msg.chat.mine { background: #2b4a64; border-radius: 12px 12px 4px 12px; align-self: flex-end; }
.msg.sys { font-size: 13px; color: var(--accent2); text-align: center; padding: 2px 0; }
.msg.log { font-size: 12.5px; color: var(--muted); padding-left: 8px; border-left: 2px solid var(--line); }
.hide-log .msg.log { display: none; }
.quick { display: flex; gap: 5px; padding: 6px 14px 0; overflow-x: auto; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.quick button:hover { background: var(--panel2); }
.chat-form { display: flex; gap: 8px; padding: 8px 14px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.chat-form input { min-width: 0; }

/* ---------- modal & toast */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(5, 8, 12, .62); backdrop-filter: blur(4px); animation: fade .18s ease; }
.modal-wrap.out { opacity: 0; transition: opacity .18s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel); border: 1px solid #3a4a5e; border-radius: 18px; padding: 20px; box-shadow: var(--shadow); animation: rise .2s ease; }
.modal.wide { width: min(640px, 100%); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.modal-title { font-size: 19px; margin-bottom: 12px; }
.modal-body p { margin: 0 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.share { text-align: center; display: grid; justify-items: center; gap: 6px; }
.share .linkbox { width: 100%; }
.menu-list { display: grid; gap: 6px; }
.menu-item { text-align: left; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); }
.menu-item:hover { background: var(--panel2); }
.results { width: 100%; border-collapse: collapse; font-size: 14px; }
.results th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 4px 6px; }
.results td { padding: 8px 6px; border-top: 1px solid var(--line); }
.results .num { text-align: right; }
.results tr.me td { background: rgba(242, 193, 78, .08); }
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { padding: 10px 14px; border-radius: 12px; background: #2a3747; border: 1px solid #3d4f65; box-shadow: var(--shadow); font-size: 14px; animation: rise .2s ease; transition: opacity .35s, transform .35s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.ok { border-color: #2f6a47; background: #1d3a2a; }
.toast.warn { border-color: #6a3a33; background: #3d2523; white-space: normal; }
.toast.chat { background: #22374a; }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- mobile */
@media (max-width: 900px) {
  body { font-size: 14.5px; }
  .topbar { gap: 6px; padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
  .brand span { display: none; }
  .rc-code { padding: 5px 7px; letter-spacing: 1px; font-size: 13px; }
  .rc-invite { padding: 5px 7px; font-size: 12px; }
  .status { justify-content: flex-start; font-size: 13px; }
  .pill { margin-left: 4px; padding: 1px 6px; font-size: 11px; }
  .vbtn { height: 34px; padding: 0 9px; }
  .vbtn span, .vcount { display: none; }
  .icon-btn { width: 34px; height: 34px; }
  .tb-right .icon-btn[data-act="rules"] { display: none; }

  .lobby-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; padding: 10px; gap: 10px; }
  .invite-card, .seats-card, .chat-card, .fx-rules-card { grid-column: auto; grid-row: auto; }
  .chat-card { min-height: 360px; }
  .card { padding: 14px; }
  .invite { flex-direction: column; text-align: center; }
  .invite-actions { justify-content: center; }

  .game-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); height: 41dvh; min-height: 250px; }
  .side-tabs { display: flex; flex: none; border-bottom: 1px solid var(--line); }
  .side-tabs button { flex: 1; position: relative; padding: 9px 4px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 13.5px; border-bottom: 2px solid transparent; }
  .side-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
  .badge { position: absolute; top: 4px; margin-left: 4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff; font-style: normal; font-size: 11px; display: inline-grid; place-items: center; padding: 0 4px; }
  .side-body > .panel { display: none; border-bottom: 0; }
  .side[data-tab="market"] .p-market,
  .side[data-tab="players"] .p-players { display: block; }
  .side[data-tab="chat"] .p-chat { display: flex; flex: 1; min-height: 0; }
  .boards { padding: 6px; gap: 6px; }
  .board-tabs { padding: 6px 6px 0; }
  .btab { padding: 5px 9px; font-size: 12.5px; }
  .all-map { flex-basis: 42%; padding: 6px 6px 0; }
  /* below the map the boards keep a usable size and scroll instead of shrinking */
  .boards.grid { overflow-y: auto; grid-template-rows: none !important; grid-auto-rows: minmax(170px, 1fr); }
  .boards.grid.n5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strack { margin: 6px 6px 0; padding: 6px 14px 17px; }
  .harmony-host { padding: 6px; }
  .harmony { padding: 8px; gap: 6px; }
  .hb-legend { font-size: 12.5px; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hb-legend::-webkit-scrollbar { display: none; }
  .hb-row { flex: none; }
  .hb-title, .hb-note { display: none; }
  .hint { top: 12px; font-size: 12.5px; max-width: calc(100% - 20px); white-space: normal; text-align: center; }
  .actionbar { bottom: 8px; gap: 8px; padding: 8px; width: calc(100% - 12px); flex-wrap: wrap; }
  .ab-tile { width: 50px; }
  .ab-rot { flex-direction: row; }
  .rbtn { width: 36px; height: 34px; }
  .ab-info { flex: 1 1 140px; font-size: 12.5px; }
  .ab-btns { flex-direction: row; width: 100%; }
  .ab-btns .btn { flex: 1; }
  .display { gap: 6px; }
  .board-tools button { width: 28px; height: 28px; }
}
@media (max-width: 380px) {
  .features { grid-template-columns: 1fr; }
  .room-chip .rc-invite { display: none; }
}

/* ---------- end-of-game celebration */
.celebrate {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 28%, rgba(70, 48, 120, .55), rgba(6, 9, 14, .9) 70%);
  animation: fade .35s ease;
}
.celebrate.out { opacity: 0; transition: opacity .25s; }
.celebrate .fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate .fx-back { z-index: 0; }
.celebrate .fx-front { z-index: 2; }
.cele-card {
  position: relative; z-index: 1; width: min(560px, 100%); text-align: center; padding: 24px 20px 18px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(40, 54, 72, .94), rgba(22, 30, 41, .96));
  border: 1px solid rgba(242, 193, 78, .55); box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 0 5px rgba(242, 193, 78, .08);
  animation: cele-in .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes cele-in { from { transform: scale(.6) translateY(30px); opacity: 0; } }
.cele-title {
  font-size: 15px; font-weight: 800; letter-spacing: 2.5px;
  background: linear-gradient(90deg, #ffe9a6, #f2c14e, #fff3c4, #f2c14e); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 3s linear infinite;
}
@keyframes shine { to { background-position: -200% 0; } }
.cele-hero { position: relative; width: 150px; height: 150px; margin: 6px auto 0; display: grid; place-items: center; }
.cele-rays {
  position: absolute; inset: -30px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 223, 128, .32) 0 9deg, transparent 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%);
  animation: spin 14s linear infinite;
}
.cele-disc {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-weight: 800; font-size: 17px;
  border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
}
.cele-disc.big { position: relative; width: 92px; height: 92px; font-size: 40px; border-width: 4px; box-shadow: 0 0 0 6px rgba(242, 193, 78, .5), 0 0 40px rgba(242, 193, 78, .65); }
.cele-disc.sm { width: 22px; height: 22px; font-size: 11px; border-width: 2px; vertical-align: middle; }
.cele-crown { position: absolute; top: 2px; z-index: 1; font-size: 46px; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); animation: crown-drop .9s .4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes crown-drop { from { transform: translateY(-140px) rotate(-30deg); opacity: 0; } }
.cele-name { font-size: 30px; font-weight: 800; margin-top: 2px; }
.cele-sub { color: #ffe7a6; font-weight: 600; margin-top: 2px; }
.cele-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin: 12px 0 4px; font-size: 13.5px; color: var(--muted); }
.cele-stats span { padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .06); }
.cele-stats b { color: var(--text); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 18px 0 6px; }
.pod { flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.pod-who { display: grid; justify-items: center; gap: 2px; margin-bottom: 6px; min-width: 0; max-width: 100%; animation: fade .4s var(--d) both; }
.pod-who b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-who span { font-size: 12px; color: var(--muted); }
.pod-step {
  width: 100%; height: var(--h); border-radius: 10px 10px 4px 4px; display: grid; place-items: start center; padding-top: 6px;
  font-size: 26px; font-weight: 800; color: rgba(0, 0, 0, .45); transform-origin: bottom;
  animation: rise .6s var(--d) cubic-bezier(.2, 1.2, .4, 1) both; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .12);
}
@keyframes rise { from { transform: scaleY(0); } }
.pod-1 .pod-step { --h: 96px; background: linear-gradient(180deg, #ffe58a, #f2b927); }
.pod-2 .pod-step { --h: 70px; background: linear-gradient(180deg, #eef3f7, #b7c3cf); }
.pod-3 .pod-step { --h: 52px; background: linear-gradient(180deg, #f2b98a, #c9824d); }
.pod-1 .cele-disc { width: 48px; height: 48px; font-size: 20px; box-shadow: 0 0 0 3px rgba(242, 193, 78, .6), 0 4px 10px rgba(0, 0, 0, .45); }
.cele-rest { margin-top: 8px; }
.cele-mine { margin-top: 8px; font-size: 14px; }
.cele-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 480px) {
  .cele-card { padding: 18px 14px 14px; }
  .cele-hero { width: 120px; height: 120px; }
  .cele-disc.big { width: 76px; height: 76px; font-size: 32px; }
  .cele-crown { font-size: 38px; }
  .cele-name { font-size: 24px; }
  .pod-1 .pod-step { --h: 78px; }
  .pod-2 .pod-step { --h: 58px; }
  .pod-3 .pod-step { --h: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .cele-card, .cele-crown, .pod-step, .pod-who, .cele-rays, .cele-title { animation: none !important; }
}

/* the champion keeps a crown on the score map */
.hb-mk .crown { display: none; font-size: 30px; }
.hb-mk.winner .crown { display: block; }

/* ---------- blind tiles & effects */
:root { --blind: #2b2156; --blind2: #3d2f78; --fx-bless: #5ee08f; --fx-attack: #ff7b72; --fx-charm: #c4a6ff; --fx-curse: #ffae57; }
.site-label {
  flex: none; align-self: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 800;
  color: #ffe7a6; background: rgba(242, 193, 78, .14); border: 1px solid rgba(242, 193, 78, .5); white-space: nowrap;
}
.hero .site-label { display: inline-block; margin-top: 8px; }
.fx-rules-card { grid-column: 1; }
.fx-rules-card[hidden] { display: none; }
.fx-rules-card > p { margin: -6px 0 12px; font-size: 13.5px; }
.fx-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.fx-group h5 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.fx-group h5.k-bless, .fx-kind.k-bless { color: var(--fx-bless); }
.fx-group h5.k-attack, .fx-kind.k-attack { color: var(--fx-attack); }
.fx-group h5.k-charm, .fx-kind.k-charm { color: var(--fx-charm); }
.fx-group h5.k-curse, .fx-kind.k-curse { color: var(--fx-curse); }
.fx-card.k-curse { border-color: rgba(255, 174, 87, .6); background: rgba(70, 30, 20, .7); }
.ab-fxic.k-curse { border-color: var(--fx-curse); }
.fx-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; color: #cdd6e0; padding: 4px 0; }
.fx-row .fx-ic { flex: none; width: 26px; text-align: center; font-size: 18px; line-height: 1.1; }
.rules .fx-list { margin: 8px 0; }
.fx-kind { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border-radius: 99px; background: rgba(255, 255, 255, .06); white-space: nowrap; }

.mtile.blind { position: relative; }
.mtile.blind .blind-svg { filter: drop-shadow(0 0 6px rgba(196, 166, 255, .35)); }
.display.live .mtile.blind:not(:disabled) .blind-svg { animation: shimmer 2.4s ease-in-out infinite; }
@keyframes shimmer { 50% { filter: drop-shadow(0 0 10px rgba(242, 193, 78, .7)); } }
.mtile .peek { position: absolute; right: -4px; top: -6px; font-style: normal; font-size: 14px; filter: drop-shadow(0 1px 1px #000); }
.pending.held { align-items: flex-start; background: rgba(124, 92, 255, .1); border-color: rgba(196, 166, 255, .55); }
.pending.held > .mtile, .pending.held > div.mtile { width: 58px; flex: none; }
.held-info { display: grid; gap: 6px; min-width: 0; }
.fx-card { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: rgba(43, 33, 86, .7); border: 1px solid rgba(196, 166, 255, .45); }
.fx-card.k-attack { border-color: rgba(255, 123, 114, .55); }
.fx-card.k-bless { border-color: rgba(94, 224, 143, .5); }
.fx-card .fx-ic { font-size: 26px; line-height: 1; flex: none; }
.fx-title { font-size: 14px; }
.fx-text { font-size: 13px; color: #d9def0; line-height: 1.4; margin-top: 2px; }
.fx-note { margin: -4px 0 8px; padding: 5px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; color: #ffe7a6; background: rgba(242, 193, 78, .12); border: 1px solid rgba(242, 193, 78, .4); }

.ab-fx { font-size: 13px; margin-bottom: 3px; padding: 3px 8px; border-radius: 8px; background: rgba(124, 92, 255, .16); border: 1px solid rgba(196, 166, 255, .35); }
.actionbar.fx-mode { border-color: rgba(196, 166, 255, .6); box-shadow: 0 0 0 1px rgba(196, 166, 255, .25), var(--shadow); }
.ab-fxic { width: 54px; height: 54px; flex: none; display: grid; place-items: center; font-size: 30px; border-radius: 14px; background: var(--blind); border: 2px solid var(--accent); }
.ab-fxic.k-attack { border-color: var(--fx-attack); box-shadow: 0 0 14px rgba(255, 123, 114, .35); }
.ab-fxic.k-bless { border-color: var(--fx-bless); }
.ab-fxbody { margin-top: 5px; }
.ab-fxbody > * + * { margin-top: 5px; }
.fx-targets { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-target { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel2); font-size: 13px; font-weight: 600; }
.fx-target:hover { border-color: #5a6f87; }
.fx-target.on { border-color: var(--fx-attack); background: rgba(255, 123, 114, .16); }
.fx-target b { color: var(--accent); }
.fx-warn { font-size: 12.5px; color: #ffd2a6; }

.cell-pick rect { fill: rgba(242, 193, 78, .08); stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: 9 6; animation: march 1s linear infinite; }
.cell-pick.attack rect { fill: rgba(255, 123, 114, .1); stroke: var(--fx-attack); }
.cell-pick.on rect { stroke-dasharray: none; stroke-width: 6; fill: rgba(242, 193, 78, .14); animation: none; }
.cell-pick.attack.on rect { fill: rgba(255, 123, 114, .22); }
.cell-pick path { stroke: var(--fx-attack); stroke-width: 9; stroke-linecap: round; opacity: .9; }
@keyframes march { to { stroke-dashoffset: -30; } }
.wild-ring { fill: none; stroke-width: 5; }
.tile.muted { opacity: .55; filter: grayscale(.6); }
.bomb-ring { fill: none; stroke: #ff5c3a; stroke-width: 5; stroke-dasharray: 6 6; animation: march .8s linear infinite; }
.bomb-mark circle { fill: #2a1410; stroke: #ff5c3a; stroke-width: 3; }
.bomb-mark text { font-size: 17px; }
.bomb-mark circle { animation: tick 1s ease-in-out infinite; }
@keyframes tick { 50% { fill: #7a2a14; } }
.mute-mark circle { fill: #1d2430; stroke: #94a3b6; stroke-width: 2.5; }
.mute-mark text { font-size: 14px; }
.fx-wait { fill: none; stroke: #c4a6ff; stroke-width: 4; stroke-dasharray: 10 8; animation: march 1.6s linear infinite; pointer-events: none; }
.fxb-line.card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 8px 16px 8px 10px; }
.fxb-ic { font-size: 30px; line-height: 1; flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.fxb-body { display: grid; gap: 1px; min-width: 0; }
.fxb-kind { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); }
.fxb-line.k-bless { border-color: var(--fx-bless); } .fxb-line.k-bless .fxb-kind { color: var(--fx-bless); }
.fxb-line.k-attack { border-color: var(--fx-attack); } .fxb-line.k-attack .fxb-kind { color: var(--fx-attack); }
.fxb-line.k-charm { border-color: var(--fx-charm); } .fxb-line.k-charm .fxb-kind { color: var(--fx-charm); }
.fxb-line.k-curse { border-color: var(--fx-curse); background: linear-gradient(135deg, rgba(74, 30, 18, .97), rgba(110, 44, 20, .96)); } .fxb-line.k-curse .fxb-kind { color: var(--fx-curse); }
.msg.fx.k-bless { border-left-color: var(--fx-bless); }
.msg.fx.k-attack { border-left-color: var(--fx-attack); }
.msg.fx.k-curse { border-left-color: var(--fx-curse); background: rgba(255, 174, 87, .1); }
.fx-steps { list-style: none; margin: 6px 0 2px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; counter-reset: step; }
.fx-steps li { counter-increment: step; font-size: 12px; padding: 2px 9px 2px 4px; border-radius: 99px; background: rgba(255, 255, 255, .05); color: var(--muted); display: flex; align-items: center; gap: 5px; }
.fx-steps li::before { content: counter(step); width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 11px; background: #3a4a5e; color: var(--text); }
.fx-steps li.done { color: var(--good); }
.fx-steps li.done::before { content: '✓'; background: var(--good); color: #062; }
.fx-steps li.now { color: var(--text); background: rgba(242, 193, 78, .16); box-shadow: 0 0 0 1px rgba(242, 193, 78, .55); }
.fx-steps li.now::before { background: var(--accent); color: var(--accent-ink); }
.fx-watch { display: grid; gap: 6px; margin: -2px 0 10px; padding: 8px; border-radius: 12px; background: rgba(124, 92, 255, .1); border: 1px solid rgba(196, 166, 255, .45); animation: glowbox 1.8s ease-in-out infinite; }
@keyframes glowbox { 50% { box-shadow: 0 0 0 3px rgba(196, 166, 255, .18); } }
.fx-under-attack { padding: 5px 9px; border-radius: 9px; background: rgba(255, 123, 114, .12); border: 1px solid rgba(255, 123, 114, .45); font-size: 13px; }
.pending.held.cursed { background: rgba(255, 174, 87, .1); border-color: rgba(255, 174, 87, .6); }

.charm { font-size: 13px; }
.charm.hidden { color: var(--fx-charm); font-weight: 700; }
.frozen { font-size: 13px; }
.msg.fx { font-size: 13px; color: #e9ddff; background: rgba(124, 92, 255, .13); border-left: 3px solid #a68bff; padding: 3px 8px; border-radius: 4px 8px 8px 4px; }

.fx-banner { position: fixed; left: 50%; top: 118px; transform: translateX(-50%); z-index: 40; display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(560px, calc(100% - 24px)); }
.fxb-line {
  padding: 9px 18px; border-radius: 14px; font-weight: 800; font-size: 15.5px; text-align: center; color: #fff6dc;
  background: linear-gradient(135deg, rgba(43, 33, 86, .96), rgba(61, 47, 120, .96)); border: 1.5px solid var(--accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 22px rgba(242, 193, 78, .25); animation: fxin .35s cubic-bezier(.2, 1.4, .4, 1);
  transition: opacity .4s, transform .4s;
}
.fxb-line.out { opacity: 0; transform: translateY(-8px); }
@keyframes fxin { from { opacity: 0; transform: scale(.7) translateY(-10px); } }

@media (max-width: 900px) {
  .ab-fxic { width: 42px; height: 42px; font-size: 24px; }
  .fx-banner { top: 104px; }
  .site-label span { display: none; }
  .fxb-line { font-size: 13px; padding: 6px 10px; border-radius: 11px; }
  .fxb-line:nth-last-child(n+3) { display: none; } /* two at a time on a phone */
  .fxb-ic { width: 34px; height: 34px; font-size: 22px; }
  .fx-steps li { font-size: 11px; }
  .site-label { font-size: 11px; padding: 1px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .fxb-line, .cell-pick rect, .display.live .mtile.blind .blind-svg, .fx-wait, .fx-watch, .bomb-ring, .bomb-mark circle { animation: none !important; }
}
