:root {
  --bg: #11141f;
  --panel: rgba(20, 24, 38, 0.82);
  --panel-edge: #2c3350;
  --ink: #ece6d6;
  --dim: #8f93a8;
  --gold: #f2b53a;
  --sol: #f2b53a;
  --luna: #5aa9ff;
  --red: #e8434f;
  --white: #f6f8ff;
  --good: #4fd17d;
  --bad: #ff5468;
  --sq-l: #4f8274;
  --sq-d: #2b4e48;
  --bs: clamp(300px, min(calc(100vh - 330px), 92vw), 620px);
  --c-common: #3d8fe8;
  --c-uncommon: #38b866;
  --c-rare: #e8513d;
  --c-legendary: #a259ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pixelify Sans", ui-monospace, Menlo, monospace;
  font-size: 15px;
  overflow-x: hidden;
}
button { font-family: inherit; }

/* ---------- Background swirl + CRT ---------- */
#bg {
  position: fixed; inset: -30%; z-index: -2;
  background:
    radial-gradient(circle at 30% 30%, #4a1d5c 0, transparent 38%),
    radial-gradient(circle at 70% 55%, #0f4b55 0, transparent 42%),
    radial-gradient(circle at 45% 85%, #5c1a26 0, transparent 38%),
    radial-gradient(circle at 80% 15%, #2a2f6e 0, transparent 35%),
    #10131d;
  filter: blur(40px);
  animation: swirl 60s linear infinite;
}
@keyframes swirl { to { transform: rotate(360deg); } }
#crt {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(rgba(0,0,0,.13) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 160px rgba(0,0,0,.7);
}

/* ---------- Layout ---------- */
#app { max-width: 1400px; margin: 0 auto; padding: 10px 16px 20px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
h1 {
  font-family: Silkscreen, monospace; font-size: 26px; margin: 0; letter-spacing: 2px;
  text-shadow: 3px 3px 0 #000, 0 0 18px rgba(242,181,58,.35);
}
h1 span { color: var(--gold); }
.hdr-btns { display: flex; gap: 8px; }

main {
  display: grid;
  grid-template-columns: 250px auto 260px;
  gap: 18px;
  justify-content: center;
  align-items: start;
}
#left, #right { display: flex; flex-direction: column; gap: 12px; }
#center { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }

.panel, .pbox {
  background: var(--panel);
  border: 3px solid var(--panel-edge);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 5px 0 rgba(0,0,0,.45);
}
.panel h3 { font-family: Silkscreen, monospace; font-size: 13px; margin: 0 0 8px; color: var(--dim); letter-spacing: 1px; }

@media (max-width: 1080px) {
  main { grid-template-columns: 1fr; }
  #left { flex-direction: row; flex-wrap: wrap; order: 0; }
  #left > * { flex: 1 1 200px; }
  #center { order: 1; }
  #right { order: 2; flex-direction: row; flex-wrap: wrap; }
  #right > * { flex: 1 1 240px; }
  :root { --bs: clamp(280px, min(calc(100vh - 260px), calc(100vw - 32px)), 620px); }
}

/* ---------- Player boxes ---------- */
.pbox { position: relative; transition: border-color .2s, box-shadow .2s; }
.pbox.active.sol { border-color: var(--sol); box-shadow: 0 5px 0 rgba(0,0,0,.45), 0 0 22px rgba(242,181,58,.35); }
.pbox.active.luna { border-color: var(--luna); box-shadow: 0 5px 0 rgba(0,0,0,.45), 0 0 22px rgba(90,169,255,.35); }
.pb-head { display: flex; align-items: center; gap: 8px; font-family: Silkscreen, monospace; font-size: 17px; }
.pb-sym { font-size: 22px; }
.sol .pb-sym, .who.sol { color: var(--sol); }
.luna .pb-sym, .who.luna { color: var(--luna); }
.pb-tag { margin-left: auto; font-size: 10px; color: var(--dim); border: 1px solid var(--dim); border-radius: 4px; padding: 1px 5px; }
.pb-row { margin-top: 6px; font-size: 13px; color: var(--dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pb-row b { color: var(--ink); }
.mini-backs { display: inline-flex; }
.mini-back {
  width: 14px; height: 20px; border-radius: 3px; margin-right: -4px;
  background: repeating-linear-gradient(45deg, #b73a4a 0 3px, #8f2433 3px 6px);
  border: 1px solid #f3d7a0;
}
.skip-chip { color: var(--bad); font-weight: 600; }
.lost { font-size: 18px; letter-spacing: -1px; color: var(--ink); text-shadow: 0 1px 0 #000; }

/* ---------- Effects panel ---------- */
.chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 3px 7px; border-radius: 5px;
  font-size: 12px; background: #1a2036; border: 1px solid #39405f;
}
.chip.red { border-color: var(--red); color: #ffb3b9; }
.chip.white { border-color: #dfe6ff; color: #fff; }
.chip.gold { border-color: var(--gold); color: var(--gold); }
.deckline { font-size: 13px; color: var(--dim); margin-top: 6px; }

/* ---------- Phase bar ---------- */
#phaseBar {
  min-height: 38px; width: var(--bs); max-width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 3px solid var(--panel-edge); border-radius: 10px;
  padding: 5px 10px; font-size: 14px; text-align: center;
}
#phaseBar .who { font-family: Silkscreen, monospace; }
#phaseBar .hint-good { color: var(--good); }
#phaseBar .hint-bad { color: var(--bad); }
#phaseBar .hint-unk { color: #ffd479; }

/* ---------- Board ---------- */
#boardWrap { position: relative; padding: 0 0 0 0; }
#board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: var(--bs); height: var(--bs);
  border: 6px solid #0b0e16; border-radius: 10px; overflow: hidden;
  box-shadow: 0 8px 0 #05070c, 0 0 40px rgba(0,0,0,.6);
  user-select: none; touch-action: manipulation;
}
.sq { position: relative; display: flex; align-items: center; justify-content: center; }
.sq.l { background: var(--sq-l); }
.sq.d { background: var(--sq-d); }
.sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(242,181,58,.22); }
.sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(255,230,120,.42); box-shadow: inset 0 0 0 3px #ffe27a; }
.sq.tgt::after {
  content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%;
  background: rgba(255,232,140,.6); z-index: 3; pointer-events: none;
}
.sq.tgt.cap::after { width: 86%; height: 86%; background: transparent; border: 4px solid rgba(255,232,140,.75); }
.sq.danger { box-shadow: inset 0 0 0 3px var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: inset 0 0 0 3px transparent, inset 0 0 24px rgba(255,84,104,.6); } }
.sq.pick .pc { cursor: crosshair; }
.sq.pick:hover::before { content: ""; position: absolute; inset: 0; background: rgba(162,89,255,.35); }
.coord { position: absolute; font-size: 10px; color: rgba(255,255,255,.35); pointer-events: none; font-family: Silkscreen, monospace; }
.coord.f { bottom: 1px; right: 3px; }
.coord.r { top: 1px; left: 3px; }

.pc {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
}
.pc .g {
  position: relative; z-index: 2;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Apple Symbols", serif;
  font-size: calc(var(--bs) * 0.088); line-height: 1;
  color: #f3e8cf;
  text-shadow: 0 2px 0 #7a6440, 1px 0 0 #3b2f1c, -1px 0 0 #3b2f1c, 0 -1px 0 #3b2f1c, 0 4px 6px rgba(0,0,0,.55);
  transform: translateY(-4%);
}
.pc .disc {
  position: absolute; z-index: 1; bottom: 8%; left: 16%; right: 16%; height: 17%; border-radius: 50%;
}
.pc .disc.red { background: radial-gradient(ellipse at 50% 35%, #ff8a92, #c21f2c 70%); box-shadow: 0 0 10px rgba(255,59,74,.85), 0 2px 0 #5c0b12; }
.pc .disc.white { background: radial-gradient(ellipse at 50% 35%, #ffffff, #c7cfe2 70%); box-shadow: 0 0 10px rgba(255,255,255,.85), 0 2px 0 #5d6478; }
.pc .disc.none { background: rgba(0,0,0,.22); }
.pc.frozen .g { filter: saturate(.2) brightness(.8) hue-rotate(160deg); opacity: .75; }
.pc .ice { position: absolute; top: 3%; right: 5%; font-size: calc(var(--bs) * 0.028); z-index: 4; color: #bfe7ff; text-shadow: 0 0 4px #39a6ff; }
.pc.flash { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { filter: drop-shadow(0 0 0 #fff); transform: scale(1); } 30% { filter: drop-shadow(0 0 14px #c58bff); transform: scale(1.25) rotate(-8deg); } 100% { filter: none; transform: scale(1); } }

.badge {
  position: absolute; top: 4%; left: 5%; z-index: 4;
  width: calc(var(--bs) * 0.034); height: calc(var(--bs) * 0.034); min-width: 15px; min-height: 15px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--bs) * 0.022); line-height: 1; font-weight: 700;
}
.badge.priv { border: 2px dashed currentColor; background: rgba(0,0,0,.55); }
.badge.rev { border: 2px solid #fff; color: #10131d !important; }
.badge.sol { color: var(--sol); }
.badge.luna { color: var(--luna); }
.badge.rev.sol { background: var(--sol); }
.badge.rev.luna { background: var(--luna); }

/* ---------- Legend ---------- */
.lg { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 5px 0; }
.lg-disc { display: inline-block; width: 22px; height: 9px; border-radius: 50%; }
.lg-disc.red { background: #e8434f; box-shadow: 0 0 6px #ff3b4a; }
.lg-disc.white { background: #fff; box-shadow: 0 0 6px #fff; }
.lg-disc.none { background: rgba(255,255,255,.12); border: 1px solid #555; }
.lg-b { position: static; width: 18px; height: 18px; font-size: 11px; }
.lg-q { width: 18px; text-align: center; color: var(--dim); }

/* ---------- Log ---------- */
#log { max-height: 340px; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
#log div { padding: 3px 6px; border-left: 3px solid #39405f; background: rgba(255,255,255,.03); border-radius: 0 4px 4px 0; }
#log .good { border-color: var(--good); }
#log .bad { border-color: var(--bad); }
#log .hot { border-color: var(--gold); }
#log .warn { border-color: #ff9f43; }
#log .cool { border-color: var(--luna); }
#log .dim { color: var(--dim); }

/* ---------- Hand & cards ---------- */
#handArea { width: 100%; display: flex; justify-content: center; min-height: 200px; padding-top: 6px; }
#hand { display: flex; justify-content: center; align-items: flex-end; flex-wrap: nowrap; max-width: 100%; }
.cw { animation: sway 3.4s ease-in-out infinite; animation-delay: var(--d); margin: 0 -6px; }
@keyframes sway { 0%, 100% { transform: rotate(calc(var(--rot) - 1.4deg)) translateY(0); } 50% { transform: rotate(calc(var(--rot) + 1.4deg)) translateY(-4px); } }
.card {
  --rc: var(--c-common);
  width: 128px; height: 182px; border-radius: 10px;
  background: linear-gradient(#f6efdf, #e8dcc2);
  color: #23202a; border: 4px solid var(--rc);
  box-shadow: 0 6px 0 rgba(0,0,0,.55);
  padding: 7px 7px 6px; display: flex; flex-direction: column; gap: 4px;
  transition: transform .14s ease, box-shadow .14s ease, filter .2s;
  position: relative; overflow: hidden;
}
.card.r-common { --rc: var(--c-common); }
.card.r-uncommon { --rc: var(--c-uncommon); }
.card.r-rare { --rc: var(--c-rare); }
.card.r-legendary { --rc: var(--c-legendary); }
.card.r-legendary::after {
  content: ""; position: absolute; inset: -50%;
  background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.55) 50%, transparent 60%);
  animation: shimmer 3s linear infinite; pointer-events: none;
}
@keyframes shimmer { from { transform: translateX(-60%); } to { transform: translateX(60%); } }
.c-name { font-family: Silkscreen, monospace; font-size: 12px; text-align: center; background: var(--rc); color: #fff; border-radius: 5px; padding: 3px 2px; text-shadow: 1px 1px 0 rgba(0,0,0,.4); line-height: 1.1; }
.c-icon { font-size: 34px; text-align: center; line-height: 1.1; color: var(--rc); text-shadow: 2px 2px 0 rgba(0,0,0,.18); flex: none; }
.c-name, .c-foot { flex: none; }
.c-text { font-size: 11.5px; line-height: 1.22; flex: 1; min-height: 0; overflow: hidden; text-align: center; }
.c-foot { font-family: Silkscreen, monospace; font-size: 8.5px; text-align: center; color: #6b6577; text-transform: uppercase; letter-spacing: .5px; }
.card.k-reaction .c-foot { color: #b03a48; }
.card.playable { cursor: pointer; }
.card.playable:hover { transform: translateY(-22px) scale(1.08); box-shadow: 0 14px 0 rgba(0,0,0,.45), 0 0 22px var(--rc); z-index: 5; }
.cw:hover { animation-play-state: paused; z-index: 5; position: relative; }
.card.unplayable { filter: brightness(.72) saturate(.75); }
.card.reactive { filter: none; }
.hand-empty { color: var(--dim); align-self: center; font-size: 14px; }

/* ---------- Overlays ---------- */
#overlay, #rulesOv, #handoff {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(5, 6, 12, .62); backdrop-filter: blur(3px);
}
#rulesOv { z-index: 120; }
#handoff { z-index: 110; background: radial-gradient(circle, #1d2440, #07080f); backdrop-filter: none; flex-direction: column; text-align: center; }
#overlay.show, #rulesOv.show, #handoff.show { display: flex; }
.modal {
  background: #171b2c; border: 4px solid var(--panel-edge); border-radius: 14px;
  padding: 20px 22px; max-width: 520px; width: 100%;
  box-shadow: 0 10px 0 rgba(0,0,0,.6); animation: pop .22s ease-out;
  max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 820px; }
.modal h2 { font-family: Silkscreen, monospace; margin: 0 0 10px; font-size: 22px; }
.modal p { line-height: 1.45; margin: 8px 0; }
.modal .note { font-size: 13px; color: var(--dim); }
.m-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.ho-sym { font-size: 90px; line-height: 1; }
.ho-title { font-family: Silkscreen, monospace; font-size: 30px; margin: 10px 0; }
.ho-sub { color: var(--dim); margin-bottom: 20px; }

.btn {
  font-family: Silkscreen, monospace; font-size: 15px; letter-spacing: .5px;
  background: #e8513d; color: #fff; border: none; border-radius: 8px; padding: 10px 16px;
  box-shadow: 0 5px 0 #8e2a1d; cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #8e2a1d; }
.btn.blue { background: #3d8fe8; box-shadow: 0 5px 0 #1f5490; }
.btn.green { background: #38b866; box-shadow: 0 5px 0 #1f6e3b; }
.btn.gold { background: #e9a21f; box-shadow: 0 5px 0 #8a5c0b; }
.btn.grey { background: #4a5070; box-shadow: 0 5px 0 #2a2e44; }
.btn.purple { background: #a259ff; box-shadow: 0 5px 0 #5b2aa0; }
.btn.small { font-size: 12px; padding: 7px 11px; box-shadow: 0 4px 0 #2a2e44; background: #4a5070; }

.verdict { padding: 8px 10px; border-radius: 8px; background: #0f1220; border: 2px solid #39405f; font-size: 14px; margin-top: 8px; }
.verdict.good { border-color: var(--good); }
.verdict.bad { border-color: var(--bad); }
.verdict.unk { border-color: #ffd479; }

/* Rules */
.rules-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; justify-items: center; margin-top: 10px; }
.rules-cards .rc { position: relative; }
.rules-cards .cnt { position: absolute; top: -8px; right: -8px; z-index: 3; background: var(--gold); color: #000; font-family: Silkscreen, monospace; font-size: 12px; border-radius: 10px; padding: 1px 7px; box-shadow: 0 2px 0 #000; }
.modal ul { padding-left: 20px; line-height: 1.5; margin: 6px 0; }
.modal h4 { font-family: Silkscreen, monospace; margin: 16px 0 4px; color: var(--gold); font-size: 14px; }

/* ---------- Banner ---------- */
#banner {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 130;
  pointer-events: none; text-align: center; display: none;
}
#banner.show { display: block; animation: bannerIn var(--bt, 1.5s) ease-out forwards; }
/* During a dispute: a compact strip at the top, so the board stays visible. */
#banner.peek {
  top: 10px; width: max-content; max-width: calc(100vw - 24px);
  background: rgba(12, 14, 24, .92); border: 3px solid currentColor; border-radius: 12px; padding: 6px 16px 8px;
  box-shadow: 0 6px 0 rgba(0,0,0,.5);
}
#banner.peek.show { animation-name: bannerPeek; }
#banner.peek .b-big { font-size: clamp(26px, 7vw, 44px); text-shadow: 3px 3px 0 #000; }
#banner.peek .b-small { font-size: 15px; white-space: normal; }
#banner.good.peek { color: var(--good); } #banner.bad.peek { color: var(--bad); }
#banner.gold.peek { color: var(--gold); } #banner.cool.peek { color: var(--luna); }
@keyframes bannerPeek {
  0% { transform: translate(-50%, -120%); opacity: 0; }
  10% { transform: translate(-50%, 0); opacity: 1; }
  88% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, -30%); opacity: 0; }
}
.b-big {
  font-family: Silkscreen, monospace; font-size: clamp(40px, 9vw, 86px); font-weight: 700; letter-spacing: 3px;
  color: #fff; text-shadow: 5px 5px 0 #000, 0 0 30px currentColor; white-space: nowrap;
}
.b-small { font-size: 22px; margin-top: 4px; text-shadow: 2px 2px 0 #000; color: #fff; }
#banner.good .b-big { color: var(--good); }
#banner.bad .b-big { color: var(--bad); }
#banner.warn .b-big { color: #ff9f43; }
#banner.cool .b-big { color: var(--luna); }
#banner.gold .b-big { color: var(--gold); }
#banner.purple .b-big { color: #c58bff; }
@keyframes bannerIn {
  0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; }
  14% { transform: translate(-50%, -50%) scale(1.15) rotate(3deg); opacity: 1; }
  22% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  80% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(.95); opacity: 0; }
}

/* ---------- Card showcase ---------- */
#cardShow {
  position: fixed; inset: 0; z-index: 125; display: none;
  align-items: center; justify-content: center; cursor: pointer;
  background: rgba(5, 6, 12, .4);
}
#cardShow.show { display: flex; }
#cardShow .cs-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; animation: csIn .45s cubic-bezier(.2,1.3,.4,1) both; }
#cardShow.out { background: transparent; backdrop-filter: none; pointer-events: none; transition: background .25s; }
#cardShow.out .cs-wrap { animation: csOut .28s ease-in forwards; }
#cardShow .card { transform: scale(1.6); margin: 70px 50px; box-shadow: 0 10px 0 rgba(0,0,0,.6), 0 0 50px var(--rc); }
#cardShow .cs-lab { font-family: Silkscreen, monospace; font-size: 22px; text-shadow: 3px 3px 0 #000; }
#cardShow .cs-hint { font-size: 13px; color: var(--dim); text-shadow: 1px 1px 0 #000; }
#cardShow .cs-bar { width: 200px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
#cardShow .cs-bar i { display: block; height: 100%; background: var(--gold); transform-origin: left; animation: csBar linear forwards; }
@keyframes csIn { from { transform: translateY(40px) rotateY(80deg) scale(.8); opacity: 0; } }
@keyframes csOut { to { transform: translateY(-50px) scale(.9); opacity: 0; } }
@keyframes csBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 720px) { #cardShow .card { transform: scale(1.5); margin: 64px 40px; } }

/* ---------- Cards played panel ---------- */
#lastCard .lc-body { display: flex; gap: 10px; align-items: flex-start; }
#lastCard .lc-mini { width: 100px; height: 142px; flex: none; cursor: zoom-in; }
#lastCard .lc-mini .card { transform: scale(.78); transform-origin: top left; }
#lastCard .lc-side { font-size: 13px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#lastCard .lc-who { font-family: Silkscreen, monospace; font-size: 12px; }
#lastCard .lc-prev { display: flex; flex-direction: column; gap: 3px; }
#lastCard .lc-prev button {
  font: inherit; font-size: 12px; text-align: left; color: var(--ink); cursor: zoom-in;
  background: #1a2036; border: 1px solid #39405f; border-radius: 5px; padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#lastCard .lc-prev button:hover { border-color: var(--gold); }
#lastCard .lc-empty { font-size: 13px; color: var(--dim); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 140;
  background: #23283f; border: 2px solid var(--gold); padding: 8px 14px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; pointer-events: none; font-size: 14px;
}
#toast.show { opacity: 1; }

/* scrollbars */
#log::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; }
#log::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: #39405f; border-radius: 4px; }


.gl { font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Apple Symbols", serif; font-size: 1.35em; line-height: 1; vertical-align: -0.1em; }

.opt { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 2px solid #39405f; border-radius: 8px; background: #0f1220; cursor: pointer; }
.opt input { width: 18px; height: 18px; accent-color: var(--gold); cursor: pointer; }

/* ---------- Menus & online ---------- */
.gold-t { color: var(--gold); }
.field { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--dim); }
.field input, .link-row input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 15px; color: var(--ink);
  background: #0f1220; border: 2px solid #39405f; border-radius: 8px; padding: 8px 10px;
}
.field input:focus, .link-row input:focus, .code-input:focus { outline: none; border-color: var(--gold); }
.menu-sec { font-family: Silkscreen, monospace; font-size: 12px; color: var(--dim); letter-spacing: 1px; margin: 18px 0 8px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-row .btn { width: 100%; }
.code-big {
  font-family: Silkscreen, monospace; font-size: clamp(40px, 12vw, 64px); letter-spacing: 10px; text-align: center;
  color: var(--gold); background: #0f1220; border: 3px dashed var(--gold); border-radius: 12px; padding: 10px 0 10px 10px;
  margin: 8px 0 12px; user-select: all; text-shadow: 3px 3px 0 #000;
}
.link-row { display: flex; gap: 8px; align-items: center; }
.code-input {
  display: block; width: 100%; font-family: Silkscreen, monospace; font-size: 40px; letter-spacing: 12px; text-align: center;
  text-transform: uppercase; color: var(--gold); background: #0f1220; border: 3px solid #39405f; border-radius: 12px; padding: 8px 0 8px 12px;
}
.dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.about a, .modal a { color: var(--luna); }
@media (max-width: 420px) { .menu-row { grid-template-columns: 1fr; } }
.setup-note { margin: 6px 2px 0; }

/* ---------- Free-dispute bar ---------- */
#challengeBar { display: none; }
#challengeBar.show {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px;
  width: var(--bs); max-width: 100%; padding: 8px 12px; font-size: 14px; text-align: center;
  background: #1d1a10; border: 3px solid var(--gold); border-radius: 10px;
  box-shadow: 0 4px 0 rgba(0,0,0,.45), 0 0 18px rgba(242,181,58,.25); animation: pop .2s ease-out;
}
#challengeBar.good { border-color: var(--good); background: #10201a; }
#challengeBar.bad { border-color: #5a6080; background: #161a2a; box-shadow: 0 4px 0 rgba(0,0,0,.45); }
#challengeBar .cb-hint { font-size: 12.5px; color: var(--dim); }
#challengeBar .cb-btns { display: inline-flex; gap: 8px; }
#challengeBar .cb-note { width: 100%; font-size: 11.5px; color: var(--dim); }


/* ---------- Dispute marks on the board ---------- */
.sq.disp { --dc: var(--gold); box-shadow: inset 0 0 0 4px var(--dc); animation: dispPulse 1s ease-in-out infinite; }
.sq.disp::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--dc) 30%, transparent); }
.sq.disp::after {
  content: "⚖"; position: absolute; right: 2%; bottom: 2%; z-index: 12; pointer-events: none;
  font-size: calc(var(--bs) * 0.03); min-width: 14px; line-height: 1; text-align: center;
  background: var(--dc); color: #10131d; border-radius: 4px; padding: 1px 2px;
}
.sq.disp-trail { --dc: var(--gold); box-shadow: inset 0 0 0 3px var(--dc); }
.sq.disp-trail::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--dc) 28%, transparent) 0 6px, transparent 6px 12px); }
.sq.d-honest { --dc: var(--good); } .sq.d-caught { --dc: var(--bad); } .sq.d-countered { --dc: var(--luna); }
.sq.disp.d-caught::after { content: "✖"; } .sq.disp.d-honest::after { content: "✔"; } .sq.disp.d-countered::after { content: "⛨"; }
@keyframes dispPulse { 50% { box-shadow: inset 0 0 0 4px var(--dc), inset 0 0 22px var(--dc); } }
#challengeBar.recap { border-color: var(--gold); background: #1d1a10; }
#challengeBar.recap.good { border-color: var(--good); background: #10201a; }
#challengeBar.recap.bad { border-color: var(--bad); background: #24121a; box-shadow: 0 4px 0 rgba(0,0,0,.45), 0 0 18px rgba(255,84,104,.25); }
#challengeBar.recap.cool { border-color: var(--luna); background: #111a2a; }

/* ---------- Prompts as a bottom sheet (board stays visible) ---------- */
#overlay.sheet { align-items: flex-end; background: rgba(5, 6, 12, .2); backdrop-filter: none; padding: 8px; pointer-events: none; }
#overlay.sheet .modal { pointer-events: auto; max-height: 48vh; padding: 14px 16px; animation: sheetIn .22s ease-out; box-shadow: 0 -4px 30px rgba(0,0,0,.6); }
#overlay.sheet .modal h2 { font-size: 18px; margin-bottom: 6px; }
#overlay.sheet .modal p { margin: 6px 0; }
#overlay.sheet .m-btns { margin-top: 10px; }
body.sheet-open #app { padding-bottom: 50vh; } /* room to scroll the board above the sheet */
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }

/* ---------- Card preview (touch) ---------- */
.modal.preview { max-width: 340px; text-align: center; }
.pv-card { display: flex; justify-content: center; padding: 50px 0 46px; }
.pv-card .card { transform: scale(1.55); }
.modal.preview .m-btns { justify-content: center; }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  :root { --bs: clamp(240px, min(calc(100vw - 16px), calc(100svh - 150px)), 620px); }
  body { font-size: 14px; }
  #app { padding: 8px 8px 16px; }
  header { flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
  h1 { font-size: 17px; letter-spacing: 1px; }
  .hdr-btns { flex-wrap: wrap; gap: 6px; width: 100%; }
  .hdr-btns .btn { flex: 1 1 0; font-size: 10px; padding: 7px 4px; white-space: nowrap; }

  /* Rival and you side by side on top, board next, everything else below. */
  main { grid-template-columns: 1fr 1fr; gap: 8px; }
  #left, #right { display: contents; }
  #pbox1 { order: 1; } #pbox0 { order: 2; }
  #center { order: 3; grid-column: 1 / -1; gap: 8px; }
  #effects { order: 4; grid-column: 1 / -1; }
  #right > * { order: 5; grid-column: 1 / -1; }
  .panel, .pbox { padding: 7px 9px; border-width: 2px; }
  .pbox { min-width: 0; }
  .pb-head { font-size: 13px; gap: 5px; }
  .pb-sym { font-size: 16px; }
  .pb-tag { font-size: 9px; }
  .pb-row { font-size: 11px; margin-top: 3px; gap: 4px; }
  .mini-back { width: 9px; height: 13px; }
  .lost { font-size: 14px; }
  #phaseBar { font-size: 12.5px; min-height: 32px; padding: 4px 8px; gap: 6px; border-width: 2px; }
  #challengeBar.show { font-size: 13px; padding: 6px 8px; border-width: 2px; }
  #board { border-width: 4px; }

  /* Hand: a swipeable row of readable cards instead of an overlapping fan. */
  #handArea { min-height: 0; padding-top: 2px; }
  #hand { width: 100%; justify-content: flex-start; overflow-x: auto; padding: 4px 2px 10px; gap: 6px; scroll-snap-type: x proximity; }
  #hand > .cw:first-child { margin-left: auto; }
  #hand > .cw:last-child { margin-right: auto; }
  .cw { animation: none; margin: 0; transform: none; scroll-snap-align: center; flex: none; }
  .card { width: 112px; height: 166px; padding: 5px 5px 4px; gap: 3px; border-width: 3px; }
  .card.playable:hover { transform: none; }
  .card.playable { box-shadow: 0 5px 0 rgba(0,0,0,.55), 0 0 12px var(--rc); }
  .c-name { font-size: 10px; padding: 3px 2px; }
  .c-icon { font-size: 22px; }
  .c-text { font-size: 11px; line-height: 1.2; }
  .c-foot { font-size: 7.5px; }

  .modal { padding: 16px; }
  #overlay.sheet .m-btns .btn { flex: 1 1 auto; padding: 9px 10px; }
  #overlay.sheet .modal { padding: 12px 14px; max-height: 46vh; }
  #overlay.sheet .modal h2 { font-size: 16px; }
  #overlay.sheet .modal p, #overlay.sheet .verdict { font-size: 13px; }
  #overlay.sheet .modal .note { font-size: 12px; }
  #log { max-height: 240px; }
  .b-small { font-size: 16px; }
}
body.sheet-open .sq.last { box-shadow: inset 0 0 0 4px var(--gold); animation: dispPulse 1s ease-in-out infinite; --dc: var(--gold); }

/* ---------- Hover card tooltip (mouse only) ---------- */
#cardTip { position: fixed; z-index: 135; display: none; pointer-events: none; flex-direction: column; align-items: center; gap: 8px; }
#cardTip.show { display: flex; animation: tipIn .14s ease-out; }
#cardTip .ct-card { zoom: 1.65; }
#cardTip .card { box-shadow: 0 6px 0 rgba(0,0,0,.6), 0 0 30px var(--rc); }
#cardTip .ct-hint {
  max-width: 230px; font-size: 13px; text-align: center; color: var(--ink);
  background: #171b2c; border: 2px solid var(--panel-edge); border-radius: 8px; padding: 5px 9px;
}
@keyframes tipIn { from { opacity: 0; transform: translateY(6px); } }
