:root {
  --bg: #0f1b2d; --bg2: #14243b; --panel: #172a44; --panel2: #1d3352; --line: #8fa3c033; --line2: #8fa3c066;
  --text: #e8eef7; --muted: #8fa3c0; --gold: #e8c36a; --me: #4fd1e8; --opp: #ff7a7a; --ok: #4ade80; --warn: #f5a524;
  --Fury: #f0544f; --Calm: #4ade80; --Mind: #5aa9ff; --Body: #f5a524; --Chaos: #b48cff; --Order: #e8c36a;
  --cw: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #070d17; }
body { background: radial-gradient(ellipse at 50% 45%, #1c3150 0%, var(--bg) 70%); color: var(--text); font: 14px/1.45 system-ui, "Segoe UI", Tahoma, sans-serif; }
button { font: inherit; cursor: pointer; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); border-radius: 8px; padding: 6px 12px; }
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { opacity: .35; cursor: not-allowed; }
button.primary { background: #1f6f4a; border-color: #34a36b; }
button.big { font-size: 16px; font-weight: 700; padding: 12px; letter-spacing: .03em; }
button.glow { box-shadow: 0 0 0 2px var(--gold), 0 0 18px #e8c36a66; animation: breathe 1.6s infinite; }
button.small { padding: 3px 8px; font-size: 12px; }
button.danger { background: #6b1f25; border-color: #b9414a; }
input { font: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
@keyframes breathe { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 28px #e8c36aaa; } }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--accent, #5aa9ff), 0 0 16px #5aa9ff; } }

/* ---------- Lobby ---------- */
.lobby { max-width: 960px; margin: 40px auto; padding: 0 16px; }
.lobby h1 { margin: 0 0 4px; color: var(--gold); letter-spacing: .04em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.deck-tile { background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.deck-tile img { width: 100%; border-radius: 8px; }
.deck-tile.mine { border-color: var(--me); box-shadow: 0 0 20px #4fd1e855; }
.deck-tile.taken { border-color: var(--opp); opacity: .5; cursor: not-allowed; }
.deck-tile.in-development { border-style: dashed; }
.deck-tile.in-development > img { max-height: 210px; object-fit: contain; }
.deck-status { color: var(--warn); font-weight: 700; font-size: 13px; }
.deck-status.ready { color: var(--ok); }
.deck-summary { font-size: 12px; color: var(--muted); margin: 4px 0; }
.deck-actions { display: grid; gap: 7px; margin-top: auto; padding-top: 8px; }
.deck-tile select { max-width: 100%; }
.box.deck-details { width: min(820px, 95vw); }
.deck-details a { color: var(--me); }
.deck-card-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.deck-card-row summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.deck-card-row summary:hover { color: var(--gold); }
.deck-card-row .needs-work { color: var(--warn); }
.deck-card-info { display: flex; gap: 15px; padding: 12px 0; }
.deck-card-info img { width: 130px; object-fit: contain; align-self: flex-start; }
.deck-issues { background: var(--panel2); padding: 12px; border-radius: 8px; }
.seat { display: inline-block; margin-right: 18px; }
.dom { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #0b1422; }

/* ---------- Table layout ---------- */
.table { display: grid; grid-template-columns: 58px minmax(0, 1fr) 310px; height: 900px; }
#stage { position: fixed; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #1c3150 0%, var(--bg) 70%); box-shadow: 0 0 60px #000; }
#app { height: 100%; overflow-y: auto; }
.mat { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 0; min-width: 0; overflow: hidden; position: relative; }
.half { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: stretch; }
.grow { flex: 1; min-width: 0; }

/* โซนแบบ playmat: กรอบมุมทอง + ป้ายชื่อมุมล่าง */
.zone { position: relative; border-radius: 10px; padding: 5px 8px 16px; min-height: 0;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 14px 1.5px no-repeat, linear-gradient(var(--gold), var(--gold)) top left / 1.5px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) top right / 14px 1.5px no-repeat, linear-gradient(var(--gold), var(--gold)) top right / 1.5px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom left / 14px 1.5px no-repeat, linear-gradient(var(--gold), var(--gold)) bottom left / 1.5px 14px no-repeat,
    linear-gradient(var(--gold), var(--gold)) bottom right / 14px 1.5px no-repeat, linear-gradient(var(--gold), var(--gold)) bottom right / 1.5px 14px no-repeat,
    rgba(255,255,255,.025);
  border: 1px solid var(--line); }
.zone > .label { position: absolute; left: 10px; bottom: 2px; font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; font-weight: 700; pointer-events: none; }
.zone > .label b { color: var(--text); }
.zone.clickable { border-color: var(--me); box-shadow: inset 0 0 0 2px #4fd1e855; cursor: pointer; }
.zone.pile { width: calc(var(--cw) + 18px); display: flex; align-items: center; justify-content: center; flex-direction: column; }
.units { display: flex; flex-wrap: wrap; gap: 6px; min-height: calc(var(--cw) * 1.4); align-items: center; }
.stack { position: relative; }
.empty { color: var(--muted); font-size: 12px; opacity: .6; }

/* ---------- Cards ---------- */
.card { position: relative; width: var(--cw); aspect-ratio: 744 / 1039; border-radius: 6px; overflow: hidden; border: 2px solid #0008; background: #223; cursor: pointer; flex: none; transition: transform .12s, box-shadow .12s; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .fallback { height: 100%; padding: 4px; font-size: 10px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(160deg, #2a3f63, #1a2840); }
.card:hover { transform: translateY(-4px) scale(1.04); z-index: 5; }
.card.mine { border-color: var(--me); } .card.opp { border-color: var(--opp); }
.card.exhausted { transform: rotate(14deg); }
.card.exhausted > img, .card.exhausted > .fallback { filter: brightness(.5) saturate(.6); }
.card.exhausted:hover { transform: rotate(14deg) scale(1.04); }
.card.selected { box-shadow: 0 0 0 3px var(--gold), 0 0 18px var(--gold); }
.card.target { box-shadow: 0 0 0 3px #5aa9ff; animation: pulse 1s infinite; }
.card.canact { box-shadow: 0 0 0 2px #4ade8099, 0 0 12px #4ade8055; }
.badge { position: absolute; font-weight: 800; font-size: 12px; border-radius: 10px; padding: 0 6px; line-height: 18px; }
.badge.might { bottom: 3px; right: 3px; background: #000d; color: #fff; border: 1px solid var(--gold); }
.badge.might.up { color: #86efac; } .badge.might.down { color: #fca5a5; }
.badge.dmg { top: 3px; right: 3px; background: #c0262d; }
.unit-metrics { position: absolute; bottom: 2px; left: 2px; right: 2px; display: flex; gap: 2px; pointer-events: none; }
.unit-stat { display: inline-flex; flex: 1; min-width: 0; height: 20px; align-items: center; justify-content: center; gap: 1px; border-radius: 5px; background: #081423f5; border: 1px solid #8ea5bc80; color: #f5f8ff; font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: auto; }
.unit-stat .ic { width: 10px; height: 10px; flex: none; }
.unit-stat.double { font-size: 10px; } .unit-stat.double .ic { width: 8px; height: 8px; }
.unit-stat.many { font-size: 8px; } .unit-stat.many .ic { width: 6px; height: 6px; }
.unit-power .ic { color: #f2d28e; }
.unit-power.up b { color: #91ecb0; } .unit-power.down b { color: #ffb5a8; }
.unit-health .ic { color: #8ee8ac; }
.unit-stat { position: relative; }
.unit-power::before, .unit-hits::before { position: absolute; bottom: 100%; left: -1px; right: -1px; font-size: 8px; line-height: 11px; text-align: center; background: #102033ee; border-radius: 3px 3px 0 0; color: #e6eff8; }
.unit-power::before { content: 'พลัง'; }
.unit-hits::before { content: 'โดน'; }
.unit-hits .ic { color: #ffbd75; }
.unit-hits.hurt { border-color: #e2a25e; }
.unit-hits.lethal { color: #fff; border-color: #ff9797; background: #6c2028; }
.hand-preview-status { padding: 8px; margin: 8px 0; border: 1px solid #d9ab66; border-radius: 6px; background: #362c20; font-size: 13px; }
.hand-preview-status.available { border-color: #74cbb3; background: #163b37; }
.hand-preview-status p { margin: 4px 0 0; }
.preview-rules { margin-top: 10px; font-size: 13px; line-height: 1.65; }
.preview-more { font-size: 10px; color: var(--muted); margin: 10px 0 0; }
.unit-health.hurt { border-color: #e2a25e; } .unit-health.hurt .ic { color: #ffbd75; }
.unit-health.lethal { color: #fff; border-color: #ff9797; background: #6c2028; } .unit-health.lethal .ic { color: #ffb5b5; }
.badge.unit-damage { display: flex; align-items: center; gap: 1px; padding: 0 3px; font-size: 10px; }
.unit-damage .ic { width: 10px; height: 10px; }
.unit-vitals-details { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #0c192b; }
.vitals-values { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; }
.vitals-values span { display: inline-flex; align-items: center; gap: 4px; }
.vitals-values .ic-heart { color: #8ee8ac; } .vitals-values .ic-attack { color: #f2d28e; } .vitals-values .ic-damage { color: #ffac8c; }
.unit-vitals-details p { color: var(--muted); font-size: 11px; margin: 6px 0 0; line-height: 1.5; }
.combat-timing-note { color: #bcd9fa; font-size: 12px; }
.rune.rune-choice { cursor: pointer; outline: 2px solid #75c8ff; outline-offset: 2px; box-shadow: 0 0 12px #54b4fa66; }
.rune.rune-choice.rune-chosen { outline-color: #9bf2b3; box-shadow: 0 0 0 2px #2f9467, 0 0 15px #58df8e88; }
.rune.rune-choice:focus-visible { outline: 3px solid #fff; }
.rune-choice-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; pointer-events: none; }
.rune-choice-mark .ic { width: 23px; height: 23px; border-radius: 50%; padding: 3px; background: #15364ef0; }
.rune-chosen .rune-choice-mark .ic { background: #145d39f0; }
.rune.exhausted.rune-choice { filter: none; }
.rune.exhausted.rune-choice > img { filter: brightness(.6); }
.rune.exhausted .rune-choice-mark { transform: rotate(-90deg); }
.ready-rune-hint { margin: 0 0 8px; line-height: 1.6; color: #e8d5a5; }
.ready-rune-options { display: grid; gap: 6px; }
.ready-rune-options button { display: flex; align-items: center; gap: 7px; text-align: left; padding: 9px; }
.ready-rune-options .ic { flex: none; }
.badge.role { top: 3px; left: 3px; background: #000d; }
.badge.cost { top: 3px; left: 3px; background: #000d; }
.badge.count { bottom: 4px; left: 50%; right: auto; transform: translateX(-50%); font-size: 16px; padding: 0 8px; background: var(--panel2); border: 1px solid var(--line2); font-size: 14px; }

/* card back */
.cardback { width: var(--cw); aspect-ratio: 744 / 1039; border-radius: 6px; border: 2px solid #c9a24a99; background:
  radial-gradient(circle at 50% 50%, transparent 22%, #e8c36a33 23%, transparent 26%), radial-gradient(circle at 50% 50%, #e8c36a55 0 8%, transparent 9%),
  repeating-linear-gradient(45deg, #183a5a 0 6px, #14304c 6px 12px); position: relative; }
.cardback.mini { width: 28px; border-width: 1px; }
.pile-count { font-size: 20px; font-weight: 800; margin-top: 4px; }

/* ---------- Runes ---------- */
.runes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: calc(var(--cw) * 1.4); }
.rune { position: relative; width: 46px; aspect-ratio: 744 / 1039; border-radius: 5px; overflow: hidden; border: 2px solid; transition: transform .15s; }
.rune img { width: 100%; height: 100%; object-fit: cover; }
.rune.exhausted { transform: rotate(90deg) scale(.85); filter: brightness(.45); }
.rune .rbtn { position: absolute; inset: auto 0 0 0; display: none; gap: 2px; justify-content: center; padding: 2px; background: #000b; }
.rune:hover .rbtn { display: flex; }
.rune .rbtn button { padding: 0 4px; font-size: 12px; line-height: 18px; border-radius: 4px; }
.rune.exhausted .rbtn { transform: rotate(-90deg); }
.floating { min-width: 150px; display: flex; flex-direction: column; justify-content: center; gap: 2px; font-size: 13px; }
.floating .big { font-size: 22px; font-weight: 800; color: var(--gold); }

/* ---------- Battlefields ---------- */
.bfs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bf { display: flex; flex-direction: column; border-radius: 14px; padding: 6px 8px; border: 2px solid var(--line2); background: linear-gradient(180deg, #ff7a7a0d, transparent 40%, transparent 60%, #4fd1e80d); min-width: 0; }
.bf.ctl-me { border-color: var(--me); } .bf.ctl-opp { border-color: var(--opp); }
.bf.contest { box-shadow: 0 0 0 3px var(--warn), 0 0 24px #f5a52466; }
.bf.target { cursor: pointer; box-shadow: 0 0 0 3px #5aa9ff, 0 0 20px #5aa9ff66; }
.bf .units { justify-content: center; min-height: calc(var(--cw) * 1.42); }
.bf-mid { display: flex; align-items: center; gap: 10px; padding: 4px; margin: 2px 0; background: #0006; border-radius: 10px; }
.bf-mid img { width: 118px; border-radius: 6px; flex: none; }
.bf-mid .t { font-size: 12px; min-width: 0; }
.mightbar { display: flex; flex-direction: column; gap: 2px; margin-left: auto; text-align: right; font-weight: 800; white-space: nowrap; }
.mightbar .o { color: var(--opp); } .mightbar .m { color: var(--me); }
.ctlbadge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; background: #0008; }

/* ---------- Hand ---------- */
.handbar { position: sticky; bottom: 0; margin-top: auto; display: flex; justify-content: center; padding: 6px 0 4px; background: linear-gradient(0deg, #0f1b2df0 60%, transparent); z-index: 10; }
.hand { display: flex; justify-content: center; align-items: flex-end; min-height: 120px; padding: 0 30px; }
.hand .card { --cw: 96px; margin: 0 -10px; transform-origin: 50% 120%; box-shadow: 0 6px 16px #000a; }
.hand .card:hover { transform: translateY(-34px) scale(1.18) rotate(0deg) !important; z-index: 20; }
.hand .card.playable { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok), 0 0 16px #4ade8088; }
.hand .card.dim { filter: brightness(.6) saturate(.7); }
.hand .card.selected { transform: translateY(-18px) !important; }

/* ---------- Score track ---------- */
.track { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 10px 0; background: #0b1524aa; border-right: 1px solid var(--line); }
.track .seg { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.track .who { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: center; max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: var(--muted); background: var(--bg2); }
.pt:nth-child(odd) { transform: translateX(-6px); } .pt:nth-child(even) { transform: translateX(6px); }
.pt.win { border-color: var(--gold); color: var(--gold); }
.pt.on.me { background: var(--me); color: #062; border-color: #fff; box-shadow: 0 0 14px var(--me); color: #04222a; }
.pt.on.opp { background: var(--opp); color: #2a0606; border-color: #fff; box-shadow: 0 0 14px var(--opp); }

/* ---------- HUD (ด้านขวา) ---------- */
.hud { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-left: 1px solid var(--line); background: #0b1524cc; min-height: 0; overflow-y: auto; }
.turnbox { border-radius: 12px; padding: 10px 12px; border: 2px solid var(--line2); background: var(--panel); }
.turnbox.me { border-color: var(--me); background: linear-gradient(135deg, #12445066, var(--panel)); }
.turnbox.opp { border-color: var(--opp); background: linear-gradient(135deg, #50121266, var(--panel)); }
.turnbox .whose { font-size: 20px; font-weight: 800; }
.turnbox.me .whose { color: var(--me); } .turnbox.opp .whose { color: var(--opp); }
.steps { display: flex; gap: 3px; margin-top: 8px; }
.step { flex: 1; text-align: center; font-size: 10px; padding: 4px 0; border-radius: 6px; background: #ffffff0d; color: var(--muted); position: relative; cursor: help; }
.step.done { color: #9fb3cf; background: #ffffff14; }
.step.done::after { content: '✓'; position: absolute; top: -6px; right: 1px; font-size: 10px; color: var(--ok); }
.step.now { background: var(--gold); color: #1a1405; font-weight: 800; }
.substate { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: #f5a5241f; border: 1px solid #f5a52466; color: #ffd28a; font-size: 12.5px; }
.tips { max-height: 360px; overflow-y: auto; border-radius: 12px; border: 1px solid #4ade8055; background: #0f2a22; padding: 10px 12px; }
.tips h4 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tips ul { margin: 8px 0 0; padding-left: 0; list-style: none; }
.tips li { padding: 4px 0; border-top: 1px dashed #4ade8022; font-size: 13px; }
.tips li:first-child { border-top: 0; }
.tips .now { font-weight: 700; color: #bbf7d0; }
.blocked { margin-top: 8px; padding-top: 6px; border-top: 1px solid #ffffff1a; }
.blocked .bh { font-size: 12px; font-weight: 700; color: #7d8aa0; }
.blocked li { color: #6f7c92; font-size: 12px; border-top-color: #ffffff0d; }
.switch { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); user-select: none; }
.switch .knob { width: 36px; height: 20px; border-radius: 10px; background: #334; position: relative; transition: .15s; }
.switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ccd; transition: .15s; }
.switch.on .knob { background: var(--ok); } .switch.on .knob::after { left: 18px; background: #fff; }
.tips-off { display: flex; align-items: center; gap: 8px; }
.chain-item { padding: 6px 8px; border-radius: 6px; background: var(--panel2); margin-bottom: 4px; font-size: 13px; }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.log-panel { display: flex; flex-direction: column; flex: 1 0 240px; min-height: 240px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #101d30; }
.log-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px 5px; }
.log-heading b { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.log-heading .log-latest { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; font-size: 11px; border: 0; background: transparent; color: var(--muted); }
.log-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.log-controls button { padding: 3px 7px; font-size: 10px; border-color: transparent; background: transparent; color: var(--muted); }
.log-controls button[aria-pressed="true"] { background: #29415b; color: #edf6ff; }
.log-controls span { margin-left: auto; color: var(--muted); font-size: 10px; }
.log { flex: 1; min-height: 140px; max-height: 390px; overflow-y: auto; overscroll-behavior: contain; padding: 5px 8px; scrollbar-gutter: stable; }
.log-entry { --event: #91a6bf; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; padding: 7px 3px; border-bottom: 1px solid #ffffff09; }
.log-entry:last-child { border-bottom: 0; }
.log-symbol { display: flex; justify-content: center; padding-top: 2px; color: var(--event); }
.log-content { min-width: 0; }
.log-kind { display: block; color: var(--event); font-size: 10px; font-weight: 700; margin-bottom: 2px; }
.log-content p { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
.log-cast, .log-resolve { --event: #95c9ff; }
.log-damage, .log-death { --event: #ff9a9a; }
.log-score { --event: #f1d080; background: #f1d00808; border-radius: 6px; }
.log-buff { --event: #8dddb0; }
.log-move, .log-draw { --event: #a4c7da; }
.log-warning, .log-combat { --event: #eab38d; }
.log-turn { --event: #d3e0ef; border-top: 1px solid #a9bcd235; background: #ffffff06; margin-top: 5px; border-radius: 6px; }
.log-turn .log-kind { display: none; }
.log-turn p { font-weight: 700; }
.log-quiet, .log-resource { color: #8d9eb4; padding-top: 5px; padding-bottom: 5px; }
.log-quiet .log-kind, .log-resource .log-kind { display: none; }
.log-player { font-weight: 600; }
.log-player.self { color: #7bd6e5; }
.log-player.other { color: #e6b2b2; }
.log-value { color: var(--event); font-variant-numeric: tabular-nums; }
.log-arrow { color: #9dafc4; display: inline-flex; vertical-align: middle; }
.log .log-card { display: inline; padding: 0 1px; border: 0; border-radius: 3px; background: transparent; font: inherit; font-weight: 650; color: #c7e5ff; text-align: left; text-decoration: underline; text-decoration-color: #80bfff55; text-underline-offset: 3px; white-space: normal; }
.log .log-card:hover { color: #fff; background: #355578; text-decoration-color: currentColor; }
.log button:focus-visible, .log-controls button:focus-visible, .log-latest:focus-visible, .log:focus-visible { outline: 2px solid #80ccff; outline-offset: 2px; }
.log-empty { color: var(--muted); text-align: center; padding: 20px 0; }
.log-heading { flex-wrap: wrap; }
.log-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.log-actions button { display: inline-flex; align-items: center; gap: 4px; padding: 4px 5px; font-size: 10px; background: transparent; }
.log-actions [data-clear-room] { color: #d7aaaa; border-color: transparent; }
.log-controls .log-latest { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; }
.room-tools { margin: 12px 0; }
.room-tool-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.room-tool-buttons button { display: inline-flex; align-items: center; gap: 6px; }
.room-status { margin-top: 10px; font-size: 13px; }
.room-status ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0; }
.room-status li { padding: 4px 10px; background: #ffffff09; border-radius: 6px; }
.room-help { font-size: 12px; margin-bottom: 0; }
.room-error { color: #ffb0a6; line-height: 1.6; }
.room-success { color: #8ee1aa; }
.room-clear-dialog p { line-height: 1.65; }
.modal .box.confirm-dialog { max-width: 460px; border-color: var(--gold); box-shadow: 0 18px 50px #000c, 0 0 0 1px #0006 inset; }
.confirm-dialog h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.confirm-dialog .confirm-body { line-height: 1.65; margin: 4px 0 14px; }
.confirm-dialog .confirm-body p { margin: 0 0 8px; }
.confirm-dialog .confirm-body ul { margin: 0 0 10px; padding-left: 22px; }
.confirm-dialog .btnrow { justify-content: flex-end; }
.confirm-dialog .btnrow button { min-width: 112px; }
.copy-log-dialog textarea { display: block; width: 100%; height: 45vh; resize: vertical; background: #0b1524; color: #d5e2f2; border: 1px solid var(--line2); border-radius: 8px; padding: 12px; font: 12px/1.5 monospace; margin: 12px 0; }
.settings { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.prompt { border: 2px solid var(--gold); border-radius: 12px; padding: 10px; background: #2a2210; }
.prompt h3 { margin: 0 0 6px; font-size: 13px; color: var(--gold); }
.actionbar { position: sticky; top: 0; z-index: 12; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 8px 12px; border-radius: 10px; background: #2a2210f2; border: 2px solid var(--gold); }

/* ---------- Overlays ---------- */
.preview { position: absolute; right: 324px; top: 60px; width: 270px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 10px; z-index: 40; pointer-events: none; box-shadow: 0 10px 30px #000a; }
.preview img { width: 100%; border-radius: 8px; }
.preview .th { margin-top: 8px; padding: 8px; border-radius: 6px; background: #0f2a22; }
.toast { position: fixed; left: 50%; bottom: 160px; transform: translateX(-50%); max-width: 640px; background: #3d1414f5; border: 2px solid #e5484d; padding: 12px 16px; border-radius: 12px; z-index: 60; font-size: 15px; box-shadow: 0 10px 30px #000a; }
.modal { position: fixed; inset: 0; background: #000b; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .box { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 16px; max-width: 780px; width: 100%; max-height: 90vh; overflow: auto; }
.modal .row img { width: 230px; border-radius: 10px; }
.modal h2 { margin-top: 0; color: var(--gold); }
.rules h3 { color: var(--gold); margin-bottom: 4px; }
.rules li { margin: 3px 0; }
.banner { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 55; background: #0009; animation: fadein .25s; cursor: pointer; }
.banner .inner { text-align: center; padding: 24px 48px; border-radius: 18px; background: #0f1b2df5; border: 3px solid var(--gold); box-shadow: 0 0 60px #000; min-width: 420px; }
.banner .big { font-size: 40px; font-weight: 900; letter-spacing: .03em; }
.banner.me .big { color: var(--me); } .banner.opp .big { color: var(--opp); } .banner.fight .big { color: var(--warn); }
.banner .sub { color: var(--muted); margin-top: 6px; }
.banner ul { text-align: left; margin: 12px auto 0; display: inline-block; font-size: 14px; }
@keyframes fadein { from { opacity: 0; transform: scale(.96); } }
.winner { font-size: 26px; text-align: center; padding: 14px; color: var(--gold); font-weight: 800; }


/* ---------- Animation ---------- */
.card, .rune { transition: transform .35s cubic-bezier(.2,.8,.25,1), box-shadow .2s, filter .3s; }
.incoming { visibility: hidden; }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.ghost { position: fixed; border-radius: 7px; overflow: hidden; box-shadow: 0 10px 30px #000c; will-change: transform; transform-origin: 0 0; }
.ghost.big { box-shadow: 0 0 0 3px var(--gold), 0 20px 60px #000e, 0 0 80px #e8c36a55; border-radius: 12px; }
.ghost.dying { filter: sepia(1) hue-rotate(-40deg) saturate(3) brightness(.8); }
.caption { position: fixed; transform: translateX(-50%); padding: 6px 16px; border-radius: 20px; background: #0f1b2df0; border: 1px solid var(--gold); font-weight: 700; font-size: 16px; white-space: nowrap; color: var(--text); }
.floattext { position: fixed; font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 #000, 0 0 12px #000; white-space: nowrap; }
.floattext.dmg { color: #ff5a5a; } .floattext.gold { color: var(--gold); font-size: 26px; }
.phasepill { position: fixed; left: 50%; top: 14%; display: flex; flex-direction: column; align-items: center; padding: 10px 34px; border-radius: 14px;
  background: linear-gradient(180deg, #1c3150f5, #0f1b2df5); border: 2px solid var(--gold); box-shadow: 0 10px 40px #000c; }
.phasepill b { font-size: 30px; letter-spacing: .25em; color: var(--gold); }
.phasepill span { font-size: 15px; color: var(--text); }
.phasepill.opp { border-color: var(--opp); } .phasepill.opp b { color: var(--opp); }
.phasepill.me { border-color: var(--me); } .phasepill.me b { color: var(--me); }

/* ---------- ดูการ์ดเต็มๆ (คลิกขวา) ---------- */
.fullcard { max-width: 900px; }
.fc-row { display: flex; gap: 20px; }
.fc-img { width: 380px; flex: none; aspect-ratio: 744 / 1039; }
.fc-img img { width: 100%; border-radius: 14px; box-shadow: 0 10px 40px #000a; }
.fc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fc-info h2 { margin: 0; font-size: 26px; }
.fc-stats td { padding: 2px 12px 2px 0; } .fc-stats td:first-child { color: var(--muted); }
.fc-label { font-size: 11px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; font-weight: 700; }
.fc-th { background: #0f2a22; border: 1px solid #4ade8044; border-radius: 10px; padding: 10px 12px; font-size: 17px; line-height: 1.55; }
.fc-en { background: #0b1524; border-radius: 10px; padding: 10px 12px; color: #c7d3e6; }
.fc-kw { background: #1d2a40; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.card-rules { display: flex; flex-direction: column; gap: 10px; }
.card-rules .fc-th { font-size: 15px; }
.card-term { color: #d5e8ff; background: #5c8fc52b; border-radius: 4px; padding: 0 3px; font-weight: 650; }
.card-timing { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid #85baff40; border-radius: 10px; background: #162b45; color: #bedbfa; font-size: 13px; }
.card-timing > .ic { flex: none; margin-top: 2px; }
.card-timing p { margin: 3px 0 0; line-height: 1.6; }
.fc-kw h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: #d7e5f5; font-size: 13px; }
.fc-kw dl { margin: 0; }
.keyword-row { display: grid; grid-template-columns: minmax(85px, .3fr) 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid #ffffff0c; }
.keyword-row:first-child { border-top: 0; }
.keyword-row dt { color: #bbdaff; font-weight: 700; overflow-wrap: anywhere; }
.keyword-row dd { margin: 0; color: #c4d0e0; line-height: 1.6; }
.fc-en summary, .keyword-basics summary { cursor: pointer; color: #a9bdd6; font-size: 12px; }
.fc-en p { margin: 8px 0 0; font-size: 13px; line-height: 1.6; white-space: pre-line; }
.keyword-basics[open] summary { margin-bottom: 6px; }
.play-card-modal .row { display: flex; align-items: flex-start; gap: 16px; }
.play-card-modal .row > img { position: sticky; top: 0; flex: none; }
.play-card-modal .row > div { flex: 1; min-width: 0; }
@media (max-width: 650px) { .play-card-modal .row { flex-direction: column; } .play-card-modal .row > img { position: static; width: 140px; align-self: center; } .keyword-row { grid-template-columns: 1fr; gap: 3px; } }
@media (max-width: 800px) { .fc-row { flex-direction: column; } .fc-img { width: 100%; } }
.zone.pile > .label { left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 9px; letter-spacing: .08em; }

/* ---------- จังหวะ animation (เปิดช้ากว่าปิด, stamp-in, เส้นโค้ง 80/25) ---------- */
#stage.animating .mat { pointer-events: none; }
.shine { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: linear-gradient(90deg, transparent, #ffffff88, transparent); pointer-events: none; }
.modal:not(.hidden) .box { animation: popin .13s cubic-bezier(.15,.8,.3,1); }
@keyframes popin { from { opacity: 0; transform: scale(.96); } }
.banner .inner { animation: stampin .3s cubic-bezier(.15,.8,.3,1); }
@keyframes stampin { from { opacity: 0; transform: scale(1.5); } }
.toast:not(.hidden) { animation: risein .33s cubic-bezier(.15,.8,.3,1); }
@keyframes risein { from { opacity: 0; transform: translate(-50%, 30px); } }
.hand .card.playable::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, #ffffff40 50%, transparent 70%);
  transform: translateX(-120%); animation: sweep 3.2s ease-in-out infinite; pointer-events: none; }
@keyframes sweep { 0%, 60% { transform: translateX(-120%); } 90%, 100% { transform: translateX(120%); } }

/* ---------- แจกดาเมจ / ทำนายผล / แบ่งโทเคน ---------- */
.asg-row { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; background: #0006; margin-bottom: 4px; }
.asg-row.dead { background: #4a1414aa; }
.asg-name { flex: 1; min-width: 0; font-size: 12px; line-height: 1.3; }
.asg-n { min-width: 22px; text-align: center; font-size: 16px; }
.tag { font-size: 10px; padding: 0 5px; border-radius: 6px; background: var(--warn); color: #000; font-weight: 700; }
.badge.asg { bottom: 22px; left: 3px; background: #c0262d; font-size: 11px; }
.predbox { flex-basis: 100%; font-size: 13px; margin-top: 4px; }
.pred { padding: 2px 0; }
.pred.win, button.win { color: #86efac; } .pred.lose, button.lose { color: #fca5a5; } .pred.even, button.even { color: #fde68a; }
.splitloc { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; background: #0006; }
/* ---------- โหมดสอน ---------- */
.coach { position: fixed; left: 24px; bottom: 24px; z-index: 58; max-width: 420px; padding: 14px 16px; border-radius: 14px; background: #10243df5;
  border: 2px solid var(--me); box-shadow: 0 10px 40px #000c; font-size: 15px; line-height: 1.55; }
.coach-h { font-weight: 800; font-size: 17px; color: var(--me); margin-bottom: 6px; }
/* ---------- ดูย้อนหลัง ---------- */
#replaybar { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 57; display: flex; gap: 6px; align-items: center; padding: 8px 14px;
  border-radius: 12px; background: #10243df5; border: 2px solid var(--gold); box-shadow: 0 10px 30px #000c; white-space: nowrap; }

/* ---------- ไอคอน + โทนสะอาด ---------- */
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.17em; flex: none; display: inline-block; }
.ic-energy { color: var(--gold); } .ic-power { color: #b48cff; } .ic-attack { color: #ffb4a8; } .ic-defend, .ic-hold { color: #8fd8ff; }
.ic-death, .ic-damage, .ic-alert, .ic-ban { color: #ff7a7a; } .ic-score, .ic-trophy, .ic-conquer { color: var(--gold); } .ic-check { color: var(--ok); }
.ic-tip { color: #fde68a; } .ic-bot { color: var(--me); margin-left: 3px; }
.turn-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.turnbox .whose { font-size: 19px; }
.tips { padding: 10px 12px; }
.tips-h { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tips .now { margin: 6px 0 2px; font-weight: 700; color: #d1fae5; font-size: 13.5px; }
.tips ul { margin: 4px 0 0; }
.tips li { font-size: 12.5px; padding: 3px 0; color: #c8d6e5; }
details.blocked { margin-top: 6px; padding-top: 4px; border-top: 1px solid #ffffff14; }
details.blocked summary { cursor: pointer; font-size: 12px; color: #7d8aa0; list-style: none; }
details.blocked summary::before { content: '▸ '; } details.blocked[open] summary::before { content: '▾ '; }
.sec { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; align-items: center; gap: 4px; }
.panel.chain { padding: 8px 10px; }
.chain-item { font-size: 12.5px; padding: 5px 8px; }
.ghostbtn { background: transparent; border-color: var(--line2); }
.toolbar { display: flex; align-items: center; gap: 4px; padding-top: 2px; }
.toolbar .tool { width: 34px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: transparent; }
.toolbar .tool.on { color: var(--text); border-color: var(--line2); background: var(--panel2); }
.toolbar .tool.danger { color: #ff9a9a; margin-left: auto; background: transparent; }
.toolbar .tool .ic { width: 17px; height: 17px; }
.toolbar input[type=range] { width: 70px; padding: 0; accent-color: var(--gold); }
.pool-row { display: flex; align-items: center; gap: 5px; }
.floating { min-width: 96px; }
.floating .big { font-size: 20px; }
.mightbar span { display: inline-flex; align-items: center; gap: 3px; }
.bf-mid .t { font-size: 13px; }
.toast-row { display: flex; gap: 10px; align-items: flex-start; } .toast-row .ic { width: 22px; height: 22px; color: #ff9a9a; }
.log { font-size: 11.5px; color: #b9c6d8; }
.log .ic { width: 13px; height: 13px; }

/* พื้นที่ร่าย: การ์ดอยู่บนสนามตลอดช่วงตอบโต้ */
.casting-zone { flex: none; min-width: 0; border: 1px solid #7189aa50; border-radius: 12px; padding: 8px 10px;
  background: linear-gradient(110deg, #132238, #192d46); }
.casting-zone.active { border-color: #e8c36a99; box-shadow: inset 0 1px #e8c36a22, 0 4px 16px #0003; }
.casting-heading { display: flex; align-items: center; gap: 14px; font-size: 12px; margin-bottom: 6px; }
.casting-heading > b { color: var(--gold); white-space: nowrap; }
.casting-heading > .muted { margin-left: auto; }
.casting-status { color: #dce7f5; }
.cast-count { padding: 1px 6px; background: #e8c36a22; border-radius: 6px; }
.casting-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; padding: 2px; }
.cast-item { display: flex; align-items: center; gap: 10px; flex: 0 0 290px; min-width: 0; text-align: left; padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--cast-color) 45%, transparent); border-left: 3px solid var(--cast-color); background: #0a1726b3; border-radius: 9px; }
.cast-item.mine { --cast-color: var(--me); } .cast-item.opp { --cast-color: var(--opp); }
.cast-item.next { background: linear-gradient(120deg, #26354c, #102033); }
.cast-item .card { --cw: 61px; pointer-events: none; }
.cast-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cast-owner { color: var(--cast-color); font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.cast-info strong { font-size: 15px; line-height: 1.2; }
.cast-detail { font-size: 11px; color: #b5c6dc; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cast-state { font-size: 11px; color: var(--gold); }
.cast-empty { padding: 2px 0; font-size: 12px; color: var(--muted); }
.casting-zone.idle .cast-item { flex-basis: 430px; padding: 3px 8px; }
.casting-zone.idle .card { --cw: 36px; }
.casting-zone.idle .cast-detail { display: none; }
.casting-zone.idle .cast-info { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.casting-zone.idle .cast-info strong { font-size: 13px; }
.cast-target { outline: 2px dashed var(--gold); outline-offset: 3px; }
.cast-source { box-shadow: 0 0 0 3px var(--me); }
.cast-owner-area { border-left: 3px solid var(--gold); padding-left: 5px; }
.cast-explanation { margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: #e8d9b2; max-height: 54px; overflow-y: auto; }
.turn-guide { flex: none; border: 1px solid #4fd1e866; border-left: 4px solid var(--me); background: #143047; border-radius: 10px; padding: 10px; }
.turn-guide strong { color: #b7f1fa; font-size: 15px; }
.turn-guide p { margin: 5px 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.turn-guide button { width: 100%; margin-top: 6px; }
.decision { flex: none; }
.decision-heading { margin-bottom: 8px; }
.decision-step { display: block; color: #cfbf9d; font-size: 11px; margin-bottom: 3px; }
.decision-content { max-height: 245px; overflow-y: auto; scrollbar-width: thin; }
.decision-content .chain-choices { max-height: none; }
.decision-help { font-size: 12px; margin: 8px 0; line-height: 1.5; color: #d5cdbd; }
.decision-help summary { cursor: pointer; color: var(--gold); }
.decision-footer { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #e8c36a44; }
.decision-footer > button:first-child { flex: 1 1 100%; }
.decision-footer > button { flex: 1; }
.decision-footer .primary { min-height: 36px; }
.choice-warning { color: #ffd18a; font-size: 12px; }
.cost-total { color: var(--gold); font-weight: 700; padding: 6px 0; }
.payment-runes { padding-left: 18px; font-size: 12px; line-height: 1.6; max-height: 140px; overflow-y: auto; }
.payment-review p { font-size: 12px; }
.recent-outcome { flex: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #132534; font-size: 12px; }
.recent-outcome > b { color: var(--gold); }
.recent-outcome > div { margin-top: 6px; }
.recent-outcome ul { padding-left: 16px; margin: 4px 0; max-height: 90px; overflow-y: auto; }
.motion-setting { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 6px 0; }
.motion-setting select { flex: 1; min-width: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: 5px; }
#stage.motion-reduced *, #stage.motion-reduced *::after { animation: none !important; transition: none !important; }
.toolbar { flex-wrap: wrap; flex-shrink: 0; }
#stage.input-locked .motion-setting { pointer-events: auto; }
.chain-choices { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; margin: 8px 0; }
.chain-choice { display: flex; gap: 10px; align-items: center; text-align: left; }
.chain-choice .card { pointer-events: none; flex-shrink: 0; }
.chain-choice small { display: block; color: var(--warn); margin-top: 4px; }
.token-location { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.token-location select { min-width: 120px; max-width: 200px; background: var(--bg); color: var(--text); padding: 6px; border-radius: 6px; }
.cast-item:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.connection-status { border: 1px solid var(--warn); color: #ffe0a0; padding: 8px; border-radius: 8px; background: #432d15; }
#stage.input-locked #app { pointer-events: none; }
#stage.input-locked .cast-item, #stage.input-locked .toolbar, #stage.input-locked .log-panel { pointer-events: auto; }
/* ลิ้นชักข้าง (ประวัติ/คำแนะนำ/เครื่องมือ) เปิดดูได้เสมอ แม้กำลังรอเซิร์ฟเวอร์หรือการเชื่อมต่อขาด */
#stage.input-locked .table-drawer > summary, #stage.input-locked .table-settings { pointer-events: auto; }
#stage.input-locked #passBtn, #stage.input-locked #endBtn { opacity: .45; box-shadow: none; animation: none; }
.hud > .btnrow { flex: none; }
.hud #passBtn { font-size: 14px; }
.half, .bfs { flex-shrink: 0; }
.mat { overflow-y: auto; scrollbar-width: thin; }
@media (prefers-reduced-motion: reduce) {
  .card, .rune { transition: none; }
  button.glow, .card.target, .hand .card.playable::after { animation: none; }
}
#fx .battle-fx { position: fixed; z-index: 0; pointer-events: none; transform-origin: center; will-change: transform, opacity; }
#fx .floattext { z-index: 2; }
.battle-fx-ring, .battle-fx-impact, .battle-fx-bolt { mask-repeat: no-repeat; mask-mode: luminance; mask-size: 100% 100%; }
/* First cell of RO3's 3 x 3 ring atlas; the source remains unmodified. */
.battle-fx-ring { mask-image: url('vfx/ro3/ring.png'); mask-size: 300% 300%; mask-position: 0 0; }
.battle-fx-impact { mask-image: url('vfx/ro3/impact.png'); }
.battle-fx-bolt { mask-image: url('vfx/ro3/bolt.png'); }
.battle-fx-slash { border-radius: 50%; box-shadow: 0 0 8px #ffe4bc; }
.floattext.buff { color: #8cf0b2; font-size: 26px; }
.floattext.debuff { color: #d7a0ff; font-size: 26px; }
.battle-fx-plus { clip-path: polygon(35% 0,65% 0,65% 35%,100% 35%,100% 65%,65% 65%,65% 100%,35% 100%,35% 65%,0 65%,0 35%,35% 35%); }
.battle-fx-down { clip-path: polygon(0 15%,50% 55%,100% 15%,100% 55%,50% 100%,0 55%); }
.battle-fx-spark { clip-path: polygon(50% 0,63% 37%,100% 50%,63% 63%,50% 100%,37% 63%,0 50%,37% 37%); }
.battle-fx-shield { clip-path: polygon(50% 0,95% 18%,85% 70%,50% 100%,15% 70%,5% 18%,50% 0,50% 10%,15% 25%,24% 65%,50% 88%,76% 65%,85% 25%,50% 10%); }

/* Decisions and gestures live on the playmat. */
.board-decision:empty { display: none; }
.board-decision { flex: none; min-width: 0; }
.board-decision .decision { margin: 0; padding: 10px 14px; border-color: #4fd1e877; background: #112b3d; }
.board-decision .decision-heading { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.board-decision .decision-heading h3 { margin: 0; font-size: 15px; }
.board-decision .decision-step { flex: none; }
.board-decision .decision-content { max-height: 150px; }
.board-decision .decision-footer { margin-top: 5px; padding-top: 6px; justify-content: flex-end; }
.board-decision .decision-footer > button { flex: 0 1 auto; min-width: 100px; }
.board-decision p { margin: 4px 0; }
.board-decision .decision-help { margin: 3px 0; }
.board-decision .chain-choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.board-decision .chain-choice { flex: 0 1 230px; }
.board-decision .payment-runes { max-height: 65px; margin: 3px 0; }
.board-decision .cost-total { padding: 2px 0; }
.board-instruction { color: #a5edf7; }
.unit-wrap { position: relative; display: inline-flex; flex: none; }
.unit-ability { position: absolute; z-index: 9; left: 50%; bottom: -15px; transform: translateX(-50%); white-space: nowrap; font-size: 11px; padding: 3px 6px; background: #22543a; border-color: var(--ok); }
.card.picked-target { outline: 3px solid var(--gold); outline-offset: 3px; }
/* ชี้รายการในแผง → การ์ดใบนั้นบนกระดานกะพริบ */
.locate { outline: 3px solid #ffd766 !important; outline-offset: 4px; box-shadow: 0 0 0 6px #ffd76633, 0 0 26px #ffd766cc !important; animation: locate-pulse .55s ease-in-out infinite alternate; position: relative; z-index: 12; }
@keyframes locate-pulse { from { outline-offset: 2px; } to { outline-offset: 6px; } }
.unit-wrap:has(> .locate) { z-index: 12; }
.token-tray { display: flex; gap: 6px; flex-wrap: wrap; }
.token-tray button { font-size: 12px; }
.token-ghost { width: 54px; min-height: 65px; border: 2px dashed var(--me); background: #4fd1e814; color: #b4eaf2; font-size: 11px; padding: 3px; }
.token-ghost.selected { outline: 2px solid var(--gold); }
[data-hand], [data-champion], [data-unit], [data-gear] { touch-action: none; user-select: none; -webkit-user-select: none; }
.gear-slot.can-equip > .card { cursor: grab; }
.gear-slot.can-equip:hover > .card { box-shadow: 0 0 0 2px #75c8ff88; }
[data-hand] img, [data-champion] img, [data-unit] img { -webkit-user-drag: none; }
.board-dragging { cursor: grabbing; user-select: none; }
.board-dragging .card:hover { transform: none; }
.board-dragging .drop-ready { outline: 2px dashed var(--me); outline-offset: 3px; }
.board-dragging .drop-hover { outline: 3px solid var(--ok); box-shadow: 0 0 20px #4ade8055; }
.board-dragging .drag-source { opacity: .4; }
#boardDragOverlay { position: fixed; inset: 0; z-index: 500; pointer-events: none; }
.board-drag-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.board-drag-line line { stroke: #82e8f7; stroke-width: 3; stroke-dasharray: 8 5; }
#boardDragGhost { position: absolute; width: 340px; max-width: calc(100vw - 16px); padding: 12px 15px; border: 1px solid var(--me); border-radius: 12px; background: #0c1d30f5; box-shadow: 0 10px 30px #0008; }
#boardDragGhost b { color: var(--gold); font-size: 15px; }
#boardDragHint { white-space: pre-line; font-size: 13px; margin-top: 5px; max-height: 100px; overflow: hidden; }
.unit-assignment { display: flex; align-items: center; gap: 3px; position: absolute; bottom: 100%; left: -12px; z-index: 15; padding: 4px; border: 1px solid var(--gold); border-radius: 8px; background: #14243bf5; }
.unit-assignment button { font-size: 12px; padding: 2px 5px; }
.unit-assignment b { min-width: 14px; text-align: center; }
#boardDropNotice { position: fixed; z-index: 501; pointer-events: none; width: 300px; padding: 10px; border: 1px solid var(--warn); border-radius: 8px; background: #352511f5; color: #ffe4b4; font-size: 13px; }

/* Quiet playmat: wide playing surface, fine zone lines, tools on demand. */
.clean-table { grid-template-columns: 28px minmax(0, 1fr) 188px; background: radial-gradient(ellipse at 50% 48%, #243a55, #182b42 75%); }
.clean-table .mat { gap: 8px; padding: 16px 18px 0; }
.clean-table .zone { border: 1px solid #b9c9db20; border-radius: 3px; background: linear-gradient(#c2cfcf66,#c2cfcf66) top left / 12px 1px no-repeat, linear-gradient(#c2cfcf66,#c2cfcf66) top left / 1px 12px no-repeat, linear-gradient(#c2cfcf66,#c2cfcf66) bottom right / 12px 1px no-repeat, linear-gradient(#c2cfcf66,#c2cfcf66) bottom right / 1px 12px no-repeat; }
.clean-table .zone > .label { font-size: 9px; color: #a8bacb88; letter-spacing: .1em; }
.clean-table .zone > .label b { color: #a8bacbaa; font-weight: 400; }
.clean-table .empty { visibility: hidden; }
.clean-table .half { gap: 6px; }
.clean-table .card { border-width: 1px; border-radius: 4px; box-shadow: 0 3px 7px #0004; }
.clean-table .card.mine, .clean-table .card.opp { border-color: #aabacb55; }
.clean-table .card.canact { box-shadow: 0 0 0 1px #4ade8044; }
/* แบบ Runeterra: การ์ดที่เล่นได้ตอนนี้มีขอบเรือง · ที่เล่นไม่ได้เป็นสีเทามืด (ชี้แล้วสว่างขึ้นพอให้อ่าน) · ค่าการ์ดสีแดงเมื่อจ่ายไม่พอ */
.clean-table .hand .card { transition: filter .18s, box-shadow .18s, transform .12s; }
.clean-table .hand .card.playable { border-color: #67e8d4; box-shadow: 0 0 0 1px #67e8d4, 0 0 14px #2dd4bf70, 0 3px 10px #0005; }
.clean-table .hand .card.dim { filter: grayscale(.85) brightness(.55); }
.clean-table .hand .card.dim:hover { filter: grayscale(.35) brightness(.9); }
.hand .card.short .badge.cost { background: #7f1d1de8; color: #fecaca; }
.clean-table .bfs { flex: 1 0 235px; gap: 14px; }
.clean-table .bf { border: 1px solid #b5cad32c; border-radius: 3px; background: transparent; justify-content: space-between; }
.clean-table .bf.ctl-me { border-bottom-color: #76b6bb88; }
.clean-table .bf.ctl-opp { border-top-color: #ca929288; }
.clean-table .bf-mid { align-self: center; gap: 10px; background: transparent; margin: 0; padding: 0 8px; width: 100%; justify-content: center; }
.clean-table .bf-mid img { width: 102px; opacity: .85; }
.clean-table .bf-mid .t { max-width: 160px; font-size: 11px; color: #b8c8d6; }
.clean-table .ctlbadge { padding: 0; background: transparent; font-size: 10px; font-weight: 400; }
.clean-table .mightbar { margin-left: 12px; font-size: 12px; }
.clean-table .handbar { background: linear-gradient(0deg,#182b42 60%,transparent); padding-top: 12px; }
.clean-table .casting-zone.idle { min-height: 25px; border: 0; padding: 2px 8px; background: transparent; opacity: .65; }
.clean-table .casting-zone.idle .casting-list, .clean-table .casting-zone.idle .casting-heading > .muted { display: none; }
.clean-table .casting-heading { margin: 0; font-size: 10px; }
.clean-table .casting-heading > b { font-weight: 400; color: #a3b7cc; }
.clean-table .casting-zone.active { background: #14283ec9; border-color: #c3ad7355; border-radius: 5px; }
.clean-table .hud { background: #101e30b3; padding: 14px 10px; gap: 10px; border-color: #b4c9df1a; }
.clean-table .turnbox { padding: 8px 0; background: none; border: 0; }
.clean-table .turnbox .whose { font-size: 13px; font-weight: 500; }
.clean-table .turn-top { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 10px; }
.clean-table .steps { gap: 2px; }
.clean-table .step { font-size: 7px; background: transparent; border-radius: 2px; }
.clean-table .step.now { background: #c0aa7155; color: #eadbb6; }
.clean-table .substate { background: transparent; border: 0; padding: 5px 0; font-size: 11px; }
.clean-table .turn-guide { padding: 8px; border-width: 1px; background: #19334a88; border-radius: 5px; }
.clean-table .turn-guide strong { font-size: 12px; }
.clean-table .turn-guide p { font-size: 11px; }
.clean-table .hud > .btnrow { display: flex; flex-direction: column; margin-top: auto; }
.clean-table .hud .big { font-size: 12px; padding: 10px 6px; font-weight: 500; }
.clean-table button.glow { animation: none; box-shadow: none; border-color: #abbdc477; }
.clean-table .table-drawer { border-top: 1px solid #bdd0e222; padding-top: 8px; }
.table-drawer > summary { display: flex; gap: 6px; align-items: center; cursor: pointer; color: #9cb0c5; font-size: 11px; list-style: none; }
.table-drawer > summary::after { content: '+'; margin-left: auto; }
.table-drawer[open] > summary::after { content: '−'; }
.table-drawer[open] > summary { margin-bottom: 8px; color: #e0e9ef; }
.clean-table .tips { padding: 7px; background: transparent; border: 0; }
.clean-table .tips li, .clean-table .tips .now { font-size: 11px; }
.clean-table .log-panel { min-height: 220px; border-radius: 4px; }
.clean-table .log-heading { flex-wrap: wrap; padding: 6px; }
.clean-table .log-controls { padding: 4px; }
.clean-table .log { min-height: 120px; max-height: 250px; }
.clean-table .log-entry { grid-template-columns: 15px minmax(0,1fr); }
.clean-table .log-content p { font-size: 10px; }
.clean-table .toolbar { padding: 5px 0; }
.clean-table .motion-setting { flex-wrap: wrap; font-size: 10px; }
.table-score { display: flex; justify-content: center; gap: 12px; align-items: baseline; font-size: 23px; font-variant-numeric: tabular-nums; }
.score-opp { color: #c99999; } .score-me { color: #91cbd1; }
.score-divider, .table-score small { color: #8096ac; font-size: 10px; }
.turn-tabs { padding: 16px 3px; border: 0; background: transparent; gap: 12px; }
.turn-tab { --tab-color: #7bc8d6; display: flex; flex: 1; width: 12px; align-items: center; justify-content: center; gap: 12px; flex-direction: column; border-radius: 3px; background: #9aafc015; border: 1px solid #9aafc022; transition: background .25s, box-shadow .25s; }
.turn-tab.opp { --tab-color: #d89898; }
.turn-tab.active { background: color-mix(in srgb, var(--tab-color) 25%, transparent); border-color: var(--tab-color); box-shadow: 0 0 14px color-mix(in srgb, var(--tab-color) 15%, transparent); }
.turn-tab-dot { width: 4px; height: 4px; border-radius: 50%; background: #9aafc044; }
.turn-tab.active .turn-tab-dot { background: var(--tab-color); box-shadow: 0 0 6px var(--tab-color); }
.turn-tab-label { writing-mode: vertical-rl; color: var(--tab-color); font-size: 7px; letter-spacing: .18em; }
.clean-table .card.selected { outline: 2px solid var(--gold); outline-offset: 2px; }
.clean-table .card.target { outline: 2px solid #75c8ff; outline-offset: 2px; }
.clean-table .zone.clickable { border-color: #75c8ff; background-color: #75c8ff0b; cursor: pointer; }
.clean-table .card.picked-target { outline-color: var(--gold); }

/* Floating interactions never participate in the board's layout. */
.clean-table { position: relative; }
.board-overlays { position: absolute; inset: 0 188px 0 28px; pointer-events: none; z-index: 30; }
.board-overlays > :not(:empty) { pointer-events: auto; }
.clean-table .board-overlays .casting-zone { position: absolute; right: 16px; top: 265px; width: 232px; padding: 8px; border-radius: 8px; background: #102237ed; box-shadow: 0 8px 24px #0005; }
.clean-table .board-overlays .casting-zone.idle { display: none; }
.clean-table .board-overlays .casting-heading { flex-wrap: wrap; gap: 4px 8px; }
.board-overlays .casting-heading > .muted { display: none; }
/* การ์ดลอยกลางกระดาน: ตัวเลือกที่เป็นการ์ดนอกกระดาน */
.card-tray { --tray-cw: 124px; position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); max-width: calc(100% - 48px); padding: 12px 16px 10px; border-radius: 14px; background: #0c1b2df2; border: 1px solid #e8c36a88; box-shadow: 0 18px 50px #000c, 0 0 0 1px #0008 inset; z-index: 32; pointer-events: auto; }
.card-tray.enter { animation: tray-in .27s cubic-bezier(.15,.8,.3,1); }
@keyframes tray-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.92); } }
.tray-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.tray-head h3 { margin: 0; font-size: 16px; color: var(--gold); }
.tray-head p { margin: 0; font-size: 12px; color: #cfd8e6; }
.tray-cards { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: thin; padding: 6px 2px 8px; max-width: 100%; }
.tray-group { display: flex; flex-direction: column; gap: 4px; flex: none; }
.tray-group + .tray-group { border-left: 1px dashed #e8c36a55; padding-left: 12px; }
.tray-group > b { font-size: 12px; color: #cfbf9d; }
.tray-row { display: flex; gap: 10px; }
.tray-card { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; width: calc(var(--tray-cw) + 10px); padding: 4px 4px 6px; border-radius: 10px; background: transparent; border: 2px solid transparent; color: var(--text); font: inherit; text-align: center; }
.tray-card .card { --cw: var(--tray-cw); cursor: inherit; }
button.tray-card { cursor: pointer; transition: transform .12s, border-color .12s, background .12s; }
button.tray-card:hover:not([disabled]), button.tray-card:focus-visible { border-color: #75c8ff; background: #75c8ff14; transform: translateY(-4px); }
button.tray-card[disabled] { cursor: not-allowed; }
.tray-card.dim .card, button.tray-card[disabled] .card { opacity: .45; }
.tray-card { position: relative; }
button.tray-card.selected { border-color: var(--gold); background: #e8c36a1a; transform: translateY(-8px); }
button.tray-card.selected .card { filter: saturate(.5) brightness(.8); }
.tray-mark { position: absolute; top: 34%; left: 50%; transform: translateX(-50%) rotate(-8deg); padding: 3px 12px; border-radius: 6px; background: var(--gold); color: #1a1407; font-weight: 700; font-size: 14px; box-shadow: 0 4px 12px #000a; pointer-events: none; }
.card-tray.waiting { padding: 14px 22px; }
.card-tray.reveal { border-color: #75c8ff88; }
.card-tray.reveal .tray-card { cursor: default; }
.card-tray[data-tray="mulligan"] { --tray-cw: 132px; }
.tray-foot .muted { font-size: 12px; }
.tray-name { font-size: 12px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-card small { font-size: 11px; color: #cfbf9d; }
.tray-card .btnrow { gap: 4px; justify-content: center; margin: 0; }
.tray-card button.small { font-size: 11px; padding: 3px 8px; }
.tray-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tray-foot > button { min-width: 120px; }
.tray-foot .decision-help { margin: 0; flex: 1 1 200px; }
#stage.input-locked .card-tray { opacity: .7; }
#stage.motion-reduced .card-tray.enter { animation: none; }
@media (prefers-reduced-motion: reduce) { .card-tray.enter { animation: none; } }
.board-overlays .casting-status { font-size: 10px; }
.board-overlays .casting-list { display: flex; flex-direction: column; max-height: 245px; overflow-y: auto; padding: 5px 2px; }
.board-overlays .cast-item { position: relative; flex: none; width: 100%; padding: 7px; gap: 8px; background: #14283f; }
.board-overlays .cast-item + .cast-item { margin-top: -28px; }
.board-overlays .cast-item:hover, .board-overlays .cast-item:focus-visible { z-index: 100 !important; margin-top: 0; }
.board-overlays .cast-item .card { --cw: 40px; }
.board-overlays .cast-info { gap: 2px; }
.board-overlays .cast-info strong { font-size: 12px; }
.board-overlays .cast-owner, .board-overlays .cast-state { font-size: 10px; }
.board-overlays .cast-detail { display: none; }
.board-overlays .cast-explanation { font-size: 10px; max-height: 42px; }
.clean-table .board-overlays .board-decision { position: absolute; bottom: 165px; left: 50%; transform: translateX(-50%); width: min(650px, calc(100% - 36px)); max-height: 330px; overflow-y: auto; border-radius: 8px; box-shadow: 0 8px 32px #0005; }
.board-overlays .board-decision:empty { display: none; }
.clean-table .board-overlays .decision { background: #11283df5; }
.board-overlays > .actionbar { position: absolute; bottom: 165px; left: 18px; right: 18px; max-height: 210px; overflow-y: auto; font-size: 12px; }
.board-dragging .board-overlays .casting-zone.idle { display: block; border: 1px dashed var(--me); opacity: 1; min-height: 72px; }
.board-dragging .board-overlays .casting-zone.idle .casting-status { display: none; }

/* Fixed 1600 × 900 playmat. Only the stage scales on window resize. */
.clean-table { grid-template-columns: 58px minmax(0,1fr) 188px; }
.clean-table .mat { display: grid; grid-template-rows: 210px 270px 210px 170px; gap: 8px; padding: 16px 18px 0; height: 900px; overflow: hidden; min-height: 0; }
.clean-table .half { display: grid; grid-template-rows: 102px 102px; gap: 6px; min-width: 0; min-height: 0; }
.clean-table .half > .row { display: grid; gap: 8px; min-width: 0; min-height: 0; }
.clean-table .mine-half > .row:first-child { grid-template-columns: minmax(0,1fr) 76px 76px; }
.clean-table .mine-half > .row:last-child { grid-template-columns: 76px minmax(0,1fr) 112px 76px 76px; }
.clean-table .opp-half > .row:first-child { grid-template-columns: 76px 76px 160px 112px minmax(0,1fr) 76px; }
.clean-table .opp-half > .row:last-child { grid-template-columns: 76px 76px minmax(0,1fr); }
.clean-table .zone { min-width: 0 !important; width: auto; max-width: 100%; height: 102px; }
.clean-table .units, .clean-table .runes { flex-wrap: nowrap; min-width: 0; max-width: 100%; height: 80px; min-height: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding: 3px; }
.clean-table .units > *, .clean-table .runes > * { flex-shrink: 0; }
.clean-table .bfs { min-height: 0; height: 270px; }
.clean-table .bf { display: grid; grid-template-rows: 92px 68px 92px; gap: 0; min-height: 0; height: 270px; overflow: hidden; }
.clean-table .bf .units { min-height: 0; height: 92px; justify-content: safe center; }
.clean-table .bf-mid { min-width: 0; height: 68px; overflow: hidden; }
.clean-table .bf-mid img { width: 90px; max-height: 64px; object-fit: contain; }
.clean-table .handbar { position: relative; bottom: auto; margin: 0; height: 170px; min-width: 0; overflow: hidden; padding: 0; }
.clean-table .hand { min-height: 0; height: 170px; width: 100%; justify-content: safe center; padding: 40px 30px 12px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.clean-table .hand .card { --cw: 82px; }
.clean-table .hand .card:hover { transform: translateY(-18px) scale(1.08) rotate(0deg) !important; }
.clean-table .unit-ability { bottom: 0; }
.clean-table .unit-assignment { bottom: auto; top: 0; left: 0; }
.board-overlays { left: 58px; }
.score-track { gap: 18px; padding: 10px 0; }
.score-track .turn-tab { width: 48px; flex: none; gap: 3px; padding: 7px 0; border: 1px solid transparent; background: transparent; }
.score-track .turn-tab.active { border-color: var(--tab-color); background: color-mix(in srgb,var(--tab-color) 12%,transparent); }
.score-track .who { color: #b7c6d4; max-width: 44px; font-size: 9px; }
.score-track .turn-tab.active .who { color: var(--tab-color); }

/* Screen proportions determine board width; card art keeps its own ratio. */
.clean-table { --hud-width: 188px; grid-template-columns: 58px minmax(0,1fr) var(--hud-width); }
.board-overlays { right: var(--hud-width,188px); }
.compact-stage .clean-table { --hud-width: 164px; }
.compact-stage .clean-table .mat { padding-left: 12px; padding-right: 12px; }
.compact-stage .clean-table .opp-half > .row:first-child { grid-template-columns: 68px 68px 120px 92px minmax(0,1fr) 68px; }
.compact-stage .clean-table .mine-half > .row:last-child { grid-template-columns: 68px minmax(0,1fr) 92px 68px 68px; }
.compact-stage .clean-table .mine-half > .row:first-child { grid-template-columns: minmax(0,1fr) 68px 68px; }
.compact-stage .clean-table .opp-half > .row:last-child { grid-template-columns: 68px 68px minmax(0,1fr); }
.compact-stage .clean-table .floating { min-width: 0; }
.compact-stage .clean-table .bf-mid .t { max-width: 100px; }
.compact-stage .clean-table .bf-mid img { width: 76px; }
.compact-stage .clean-table .hud { padding-left: 8px; padding-right: 8px; }
.clean-table .units, .clean-table .runes, .clean-table .hand { scrollbar-width: none; -ms-overflow-style: none; }
.clean-table .units::-webkit-scrollbar, .clean-table .runes::-webkit-scrollbar, .clean-table .hand::-webkit-scrollbar { display: none; width: 0; height: 0; }
.clean-table [data-card-scroll]:focus-visible { outline: 1px solid #75c8ff88; outline-offset: -1px; }

/* Picking must leave every card lane exposed and keep the next action reachable. */
.clean-table .half .units { height: 90px; padding: 6px 8px; }
.clean-table [data-unit] { --cw: 52px; }
.clean-table .unit-wrap { align-self: center; }
.clean-table .unit-assignment { max-width: 128px; }
.board-overlays.picking-on-board .casting-zone.active { display: none; }
.board-overlays .cast-item + .cast-item { margin-top: 0; }
.board-overlays .cast-item:hover, .board-overlays .cast-item:focus-visible { margin-top: 0; }
.sidebar-decision, .sidebar-movement { min-width: 0; flex: none; }
.sidebar-decision .decision { margin: 0; padding: 8px; border-radius: 5px; }
.sidebar-decision .decision-heading h3 { font-size: 12px; margin: 4px 0; }
.sidebar-decision .decision-content { max-height: 210px; }
.sidebar-decision .decision-help, .sidebar-decision p { font-size: 11px; }
.sidebar-decision .chain-choice { padding: 5px; gap: 5px; font-size: 11px; }
.sidebar-decision .token-tray { display: grid; }
.sidebar-decision .decision-footer button { font-size: 11px; padding: 5px; }
.sidebar-movement .actionbar { position: static; padding: 7px; font-size: 11px; max-height: 240px; overflow-y: auto; }
.sidebar-movement .actionbar > button { width: 100%; font-size: 11px; }
.clean-table .hud > .btnrow { position: sticky; bottom: -14px; padding: 8px 0; background: #101e30f5; z-index: 8; }
#preview { max-height: 790px; overflow: hidden; }
#preview > img { max-height: 370px; object-fit: contain; }
.compact-stage #preview { right: 176px; width: 240px; }
#preview { padding: 0; background: transparent; border: 0; box-shadow: none; overflow: visible; width: 270px; right: 200px; top: 30px; }
#preview.with-keywords { display: grid; grid-template-columns: 270px 250px; gap: 10px; width: 530px; }
.preview-card, .preview-keywords { align-self: start; min-width: 0; max-height: 800px; overflow: hidden; padding: 12px; border: 1px solid #8fa3c055; background: #14243bf5; border-radius: 10px; box-shadow: 0 8px 24px #0007; }
.preview-card > img { width: 100%; max-height: 340px; object-fit: contain; border-radius: 7px; margin-bottom: 8px; }
.preview-keywords h3 { margin: 0 0 10px; font-size: 13px; color: var(--gold); display: flex; align-items: center; gap: 6px; }
.preview-keywords dl { margin: 0; }
.preview-keywords dl > div { border-top: 1px solid #8fa3c025; padding: 8px 0; }
.preview-keywords dt { font-size: 12px; color: #a8e1ed; font-weight: 700; }
.preview-keywords dd { margin: 3px 0 0; font-size: 12px; line-height: 1.6; color: #d5dfeb; }
.preview-keywords > p { font-size: 10px; color: var(--muted); margin: 8px 0 0; }
.compact-stage #preview.with-keywords { grid-template-columns: 235px 230px; width: 475px; }
.board-overlays .casting-list, .board-overlays .cast-explanation { scrollbar-width: none; -ms-overflow-style: none; }
.board-overlays .casting-list::-webkit-scrollbar, .board-overlays .cast-explanation::-webkit-scrollbar { display: none; width: 0; height: 0; }
.casting-list:focus-visible { outline: 1px solid #75c8ff88; outline-offset: 2px; }
.card .badge.cost { display: inline-flex; align-items: center; gap: 2px; }
.card .badge .ic { flex-shrink: 0; width: 11px; height: 11px; }
.cardback { background: #07364b url('images/card-back-main.png') center / contain no-repeat; border: 0; box-shadow: 0 2px 5px #0005; }
.cardback.rune-back { background-color: #f7f7f7; background-image: url('images/card-back-rune.webp'); }
.cardback.mini { border: 0; }
.pool-help { display: inline-flex; align-items: center; justify-content: center; position: relative; cursor: help; min-width: 24px; min-height: 24px; border-radius: 4px; }
.pool-help:focus-visible { outline: 1px solid var(--gold); }
.pool-help::after { content: attr(data-tooltip); display: none; position: absolute; z-index: 45; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: 240px; padding: 10px 12px; border: 1px solid #8fa3c066; border-radius: 8px; background: #0e1f34fa; color: #e8eef7; box-shadow: 0 6px 18px #0006; font-size: 12px; font-weight: 400; line-height: 1.65; pointer-events: none; }
.pool-help:hover::after, .pool-help:focus-visible::after { display: block; }
.floating:has(.pool-help:hover), .floating:has(.pool-help:focus-visible) { z-index: 45; }

/* Land artwork sits behind fixed lanes; the middle strip explains its effect. */
.clean-table .bf { position: relative; isolation: isolate; }
.clean-table .bf .land-art { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: .22; filter: saturate(.75); pointer-events: none; }
.clean-table .bf::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg,#101e35a6,#101e3540 45%,#101e35a6); pointer-events: none; }
.clean-table .bf-mid { padding: 3px 10px; gap: 10px; background: #0c1c30d9; border-top: 1px solid #bed0d525; border-bottom: 1px solid #bed0d525; border-radius: 0; justify-content: space-between; }
.land-info { flex: 1; min-width: 0; }
.land-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.land-heading > b { color: #e5d3a1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.land-heading .ctlbadge { flex-shrink: 0; font-size: 9px; }
.land-ability { color: #d3e0ec; font-size: 10.5px; line-height: 1.35; margin: 3px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clean-table .bf-mid .mightbar { flex-shrink: 0; margin-left: 0; font-size: 11px; }
/* Exhausted units lie horizontally, with upright stats and reserved lane space. */
.clean-table .unit-horizontal { width: calc(52px * 1039 / 744); height: 52px; flex-shrink: 0; }
.clean-table .unit-horizontal > .card { position: absolute; left: calc((52px * 1039 / 744 - 52px) / 2); top: calc((52px - 52px * 1039 / 744) / 2); transform: rotate(90deg); }
.clean-table .unit-horizontal > .card:hover { transform: rotate(90deg); }
.unit-wrap > .unit-metrics { pointer-events: none; z-index: 6; }
.unit-wrap > .unit-metrics .unit-stat { pointer-events: none; }
.unit-wrap > .unit-damage { z-index: 6; pointer-events: none; }
.unit-wrap:has(> .incoming) > .unit-metrics, .unit-wrap:has(> .incoming) > .unit-damage { visibility: hidden; }
.board-dragging .unit-horizontal > .card { transform: rotate(90deg) !important; }

/* Land: two stable card lanes, corner totals, and a quiet footer. */
.clean-table .bf { grid-template-rows: 96px 96px 64px; row-gap: 0; padding: 5px 8px 7px; }
.clean-table .bf .land-art { object-position: center 28%; transform: scale(1.22); opacity: .25; filter: saturate(.65); }
.clean-table .bf::before { background: linear-gradient(180deg,#111f3580 0%,#111f3540 30%,#111f3599 58%,#111f35f5 82%,#111f35 100%); }
.clean-table .bf .land-opponent-lane { grid-row: 1; height: 96px; padding: 6px 74px; }
.clean-table .bf .land-friendly-lane { grid-row: 2; height: 96px; padding: 6px 74px; }
.clean-table .bf .bf-mid { grid-row: 3; width: 100%; height: 64px; padding: 4px 10px; border: 0; background: transparent; align-items: center; }
.land-heading > b { color: #bac6d2; font-size: 11px; font-weight: 600; }
.land-heading .ctlbadge { opacity: .72; font-size: 9px; }
.land-ability { color: #a9b8c8; font-size: 10.5px; line-height: 1.4; margin-top: 4px; -webkit-line-clamp: 2; }
.land-totals { position: absolute; top: 12px; left: 13px; z-index: 3; display: grid; gap: 6px; padding: 5px 7px; border-radius: 5px; background: #0e1e3355; pointer-events: none; }
.land-totals > span { display: flex; align-items: center; gap: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.land-totals .ic { width: 11px; height: 11px; }
.land-totals b { min-width: 13px; font-weight: 600; }
.land-totals small { font-size: 8px; color: #a0b0c1; }
.land-totals .o { color: #c59396; }
.land-totals .m { color: #91bdc8; }
.banner.turn-notice { background: transparent; pointer-events: none; }
.banner.turn-notice .inner { min-width: min(420px,90vw); padding: 22px 38px; border: 1px solid #b8cde555; border-radius: 10px; background: #102238ed; box-shadow: 0 12px 40px #0006; }
.banner.turn-notice .big { font-size: clamp(22px,3vw,36px); letter-spacing: .12em; font-weight: 600; }
.banner.turn-notice .inner > .muted { display: none; }
.control-indicator { flex: none; display: grid; gap: 4px; padding: 8px 10px; border: 1px solid #b8a1e066; border-left: 3px solid #b8a1e0; border-radius: 5px; background: #b8a1e00d; }
.control-indicator b { color: #c9b2ee; font-size: 11px; letter-spacing: .06em; }
.control-indicator span { color: #9fadc0; font-size: 10px; }
.control-indicator.other { opacity: .7; }
.banner.turn-notice.still { animation: none; }
@media (prefers-reduced-motion: reduce) { .banner.turn-notice { animation: none; } }
@media (max-width: 640px) {
  .modal { padding: 8px; }
  .modal .box { padding: 12px; }
  .modal .row { flex-wrap: wrap; }
  .modal .row img { width: min(180px, 50vw); }
}

/* ตัวเลขไล่นับเมื่อค่าเปลี่ยน (countNumbers ใน app.js) */
[data-num] { display: inline-block; font-variant-numeric: tabular-nums; }
.num-count { animation: num-pop .9s cubic-bezier(.2,.9,.3,1); }
.num-count.num-up { color: #8ff0b4 !important; text-shadow: 0 0 8px #3ddc8488; }
.num-count.num-down { color: #ffa99c !important; text-shadow: 0 0 8px #ff5a4a88; }
@keyframes num-pop { 0% { transform: scale(1); } 18% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* Legend ที่กดใช้ได้ (Kai'Sa) · Accelerate · Power เฉพาะ spell */
.zone .units:has(> .legend-ability) { position: relative; }
.legend-ability { bottom: -6px; }
.accelerate-toggle { display: flex; gap: 6px; align-items: center; margin: 6px 0; cursor: pointer; }
.dom.any-power { background: linear-gradient(135deg, var(--Fury), var(--Mind)); }
/* Hidden (การ์ดคว่ำ) · Buff counter · ปุ่มซ่อนบนการ์ดในมือ */
.hidden-slot { display: inline-flex; padding: 0; margin-right: 6px; background: none; border: 1px dashed var(--muted, #888); border-radius: 6px; vertical-align: middle; }
.hidden-slot.mine.playable { border-color: var(--ok); box-shadow: 0 0 8px var(--ok); cursor: pointer; }
.hidden-slot .cardback.mini { width: 34px; height: 48px; }
.card.buffed { box-shadow: 0 0 0 2px #e0b84a, 0 0 8px #e0b84a88; }
/* Gear (โทเคน Gold) ที่ฐาน · ปุ่ม Flow ในกองทิ้ง */
.gear-slot { position: relative; display: inline-flex; margin: 0 4px; border-radius: 6px; }
.gear-slot.attached .card { opacity: .4; filter: saturate(.6); }
.gear-on { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); max-width: 72px; padding: 1px 5px; border-radius: 6px; background: #0b1a2ce6; color: #8ee8ac; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
/* Equipment ที่ติดอยู่ซ้อนมุมล่างขวาของยูนิต */
/* Equipment สอดอยู่ "ใต้" การ์ดยูนิต โผล่ออกมาทางขวาเหมือนบนโต๊ะจริง (เลนยูนิตเลื่อนแนวนอน จึงไม่ถูกตัด) */
.unit-wrap:has(> .unit-gear) { margin-right: 16px; }
.unit-wrap > .card { z-index: 1; }
.unit-gear { position: absolute; left: calc(100% - 12px); top: 8px; display: flex; z-index: 0; pointer-events: auto; }
.unit-gear:hover { z-index: 8; }
.unit-gear-card { margin-left: -14px; transition: transform .12s; }
.unit-gear-card:first-child { margin-left: 0; }
.unit-gear-card .card { box-shadow: 2px 0 6px #000b, 0 0 0 1px #e8c36a66; cursor: help; }
.unit-gear-card:hover { transform: translateX(8px) scale(1.5); }
.unit-horizontal .unit-gear { left: auto; right: -14px; top: auto; bottom: -2px; }
.gear-slot.target { box-shadow: 0 0 0 2px var(--ok); cursor: pointer; }
.gear-slot.picked-target { box-shadow: 0 0 0 2px #e0b84a; }
.trash-card { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.card.empowered { box-shadow: 0 0 0 2px #b48cff, 0 0 10px #b48cffaa; }
.card.stunned > img { filter: grayscale(.8) brightness(.7); }
.card.stunned { outline: 2px dashed #8ab4ff; }

/* ---------- Polish: โล่งและสบายตา ---------- */
/* โซน: เลิกใช้มุมตกแต่ง ใช้พื้นจางๆ + เส้นบาง แบ่งด้วยระยะห่าง */
.clean-table .zone { background: #ffffff06; border: 1px solid #c3d3e314; border-radius: 6px; }
.clean-table .zone.clickable { background: #75c8ff12; border-color: #75c8ff; }
.clean-table .zone > .label { font-size: 10px; letter-spacing: .02em; text-transform: none; color: #9fb2c6aa; font-weight: 600; }
.clean-table .zone > .label b { color: #c6d4e2; font-weight: 600; }
/* สนาม: ครอบเฉพาะภาพวาดกลางการ์ด (ข้อความกติกาอยู่สองข้างของภาพ) และจางขอบซ้ายขวา */
.clean-table .bf { border-radius: 8px; border-color: #c3d3e322; }
.clean-table .bf .land-art { object-position: center 40%; transform: scale(1.62); opacity: .3; filter: saturate(.7) blur(.5px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent); }
/* ยูนิตบนสนามใหญ่ขึ้นให้อ่าน Might ง่าย (เลนสูง 102 · การ์ดสูง ~84) */
.clean-table .bf { grid-template-rows: 102px 102px 52px; }
.clean-table .bf .land-opponent-lane, .clean-table .bf .land-friendly-lane { height: 102px; padding: 6px 74px; }
.clean-table .bf .bf-mid { height: 52px; }
.clean-table .bf { --uw: 60px; }
.clean-table .bf [data-unit] { --cw: var(--uw); }
.clean-table .bf .unit-horizontal { width: calc(var(--uw) * 1039 / 744); height: var(--uw); }
.clean-table .bf .unit-horizontal > .card { left: calc((var(--uw) * 1039 / 744 - var(--uw)) / 2); top: calc((var(--uw) - var(--uw) * 1039 / 744) / 2); }
.clean-table .bf .unit-stat { height: 22px; font-size: 12px; }
/* แถบขั้นตอน: แถบบางๆ + ชื่อขั้นปัจจุบัน */
.clean-table .steps { gap: 3px; margin-top: 8px; }
.clean-table .step { height: 4px; padding: 0; font-size: 0; background: #9fb2c626; border-radius: 2px; }
.clean-table .step.done { background: #9fb2c666; }
.clean-table .step.done::after { content: none; }
.clean-table .step.now { background: var(--gold); }
.step-now { margin-top: 6px; font-size: 12px; color: #eadbb6; }
.step-now span { color: #8fa3b8; font-size: 10px; margin-left: 4px; }
.clean-table .turnbox .whose { font-size: 14px; font-weight: 600; }
.clean-table .turn-top { font-size: 11px; align-items: baseline; justify-content: space-between; }
/* การ์ดในมือ: ยกขึ้นไม่ให้ขอบล่างตัด */
/* เว้นหัว 30px: การ์ดที่ชี้ยก 18px + ขยาย 1.1 รอบจุดหมุน 120% (≈32px) ต้องไม่โดนขอบบนของแถบมือตัด */
.clean-table .hand { padding: 30px 30px 20px; }
/* โหมดสอน: การ์ดเล็กในแถบขวา ไม่บังกระดาน */
.hud .coach { position: static; max-width: none; padding: 10px; border: 1px solid #7bc8d688; border-left: 3px solid var(--me); border-radius: 6px; background: #12304499; box-shadow: none; font-size: 11.5px; line-height: 1.6; }
.hud .coach.fresh { animation: coach-in .33s cubic-bezier(.15,.8,.3,1); }
.hud .coach .coach-h { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; color: #a8e1ed; }
.hud .coach p { margin: 0 0 8px; color: #d5e2ee; }
.hud .coach .btnrow { display: flex; gap: 6px; }
.hud .coach .btnrow button { flex: 1; font-size: 11px; padding: 5px 4px; }
@keyframes coach-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* ปุ่มที่กดไม่ได้ให้จางชัดเจน */
.clean-table .hud .big:disabled { opacity: .45; }

/* ---------- เอฟเฟกต์และความรู้สึกการเล่น ---------- */
.ghost.banished { filter: hue-rotate(220deg) saturate(1.6) brightness(1.3) drop-shadow(0 0 12px #c9a2ff); }
.floattext.dmg.big { font-size: 40px; color: #ff4040; }
/* ป้ายประทับกลางสนาม */
.fx-stamp { position: fixed; z-index: 3; display: grid; justify-items: center; gap: 4px; padding: 12px 28px; border-radius: 10px; pointer-events: none; white-space: nowrap;
  background: #0d1c2ff0; border: 1px solid #e8c36a88; box-shadow: 0 10px 34px #000a, 0 0 0 1px #0008 inset; }
.fx-stamp b { font-size: 26px; letter-spacing: .04em; color: #f0d58f; text-shadow: 0 2px 0 #000; }
.fx-stamp span { font-size: 12px; color: #b9c8d8; }
.fx-stamp.combat { border-color: #ff8a7a99; } .fx-stamp.combat b { color: #ffb19f; }
.fx-stamp.result.me { border-color: #7bd8e6aa; } .fx-stamp.result.me b { color: #9ee6f0; }
.fx-stamp.result.opp { border-color: #ff8f8faa; } .fx-stamp.result.opp b { color: #ffaaaa; }
.fx-stamp.result.even b { color: #e7dcc0; }
/* สนามที่กำลังเผชิญหน้า / สู้กัน */
.clean-table .bf.bf-showdown { border-color: #e8c36a; box-shadow: 0 0 0 1px #e8c36a66, 0 0 26px #e8c36a33; }
.clean-table .bf.bf-combat { border-color: #ff8a7a; box-shadow: 0 0 0 1px #ff8a7a77, 0 0 30px #ff6a5a3a; animation: bf-pulse 1.6s ease-in-out infinite; }
@keyframes bf-pulse { 50% { box-shadow: 0 0 0 1px #ff8a7aaa, 0 0 42px #ff6a5a55; } }
/* ขอบกระดานบอกเจ้าของเทิร์น */
.clean-table .mat { transition: box-shadow .5s; }
.clean-table.turn-me .mat { box-shadow: inset 0 0 0 1px #4fd1e83a, inset 0 0 70px #4fd1e812; }
.clean-table.turn-opp .mat { box-shadow: inset 0 0 0 1px #ff7a7a33, inset 0 0 70px #ff7a7a10; }
/* เส้นชี้เป้าหมายของ chain */
#chainLinks { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 29; pointer-events: none; overflow: visible; }
#chainLinks path { fill: none; stroke-width: 2.5; stroke-dasharray: 8 6; stroke-linecap: round; animation: chain-dash 1s linear infinite; filter: drop-shadow(0 0 4px #000); }
#chainLinks path.mine { stroke: #6fd6e8; } #chainLinks path.opp { stroke: #ff8c8c; }
#chainLinks circle { stroke-width: 2; fill: #0c1d30; } #chainLinks circle.mine { stroke: #6fd6e8; } #chainLinks circle.opp { stroke: #ff8c8c; }
@keyframes chain-dash { to { stroke-dashoffset: -28; } }
/* การ์ดที่ลากตามเมาส์ */
#boardDragCard { position: absolute; width: 70px; aspect-ratio: 744 / 1039; border-radius: 5px; overflow: hidden; pointer-events: none;
  box-shadow: 0 14px 28px #000a; transition: transform .12s ease-out, box-shadow .12s; transform-origin: 50% 20%; }
#boardDragCard img { width: 100%; height: 100%; object-fit: cover; display: block; }
#boardDragCard.valid { box-shadow: 0 0 0 2px var(--ok), 0 0 22px #4ade8088, 0 14px 28px #000a; }
/* หน้าสรุปจบเกม */
.modal .box.end-screen { max-width: 460px; text-align: center; border-color: var(--gold); }
.end-screen .end-crest { display: flex; justify-content: center; color: var(--gold); }
.end-screen .end-crest .ic { width: 46px; height: 46px; stroke-width: 1.5; filter: drop-shadow(0 0 10px #e8c36a88); }
.end-screen.lost .end-crest { color: #8fa3b8; } .end-screen.lost .end-crest .ic { filter: none; }
.end-screen h2 { font-size: 28px; margin: 6px 0 4px; }
.end-screen.lost h2 { color: #c8d4e0; }
.end-score { display: flex; justify-content: center; align-items: baseline; gap: 14px; font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.end-score .me { color: #91cbd1; } .end-score .opp { color: #d6a0a0; } .end-score small { font-size: 12px; color: var(--muted); font-weight: 400; }
.end-stats { width: 100%; margin: 12px 0 16px; border-collapse: collapse; font-size: 13px; }
.end-stats th, .end-stats td { padding: 6px 8px; border-bottom: 1px solid #c3d3e31a; }
.end-stats tbody th { text-align: left; font-weight: 400; color: #b5c4d3; }
.end-stats thead th { font-size: 12px; color: var(--muted); font-weight: 600; }
.end-stats td { font-variant-numeric: tabular-nums; } .end-stats td.lead { color: var(--gold); font-weight: 700; }
.end-screen .btnrow { justify-content: center; }
@media (prefers-reduced-motion: reduce) { #chainLinks path, .clean-table .bf.bf-combat { animation: none; } }
.motion-reduced ~ #chainLinks path { animation: none; }
.end-screen .btnrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.land-totals small { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- การแจ้งเตือน ---------- */
/* ชี้ต้นเหตุเมื่อเล่นไม่ได้ */
.problem { animation: problem-pulse .45s ease-in-out 3; outline: 2px solid #ff6b6b; outline-offset: 2px; }
@keyframes problem-pulse { 0%, 100% { box-shadow: 0 0 0 0 #ff4d4d00; translate: 0 0; } 25% { translate: -3px 0; } 50% { box-shadow: 0 0 18px 2px #ff4d4d88; translate: 3px 0; } 75% { translate: -1px 0; } }
/* พลุกระดาษ / แพ้ */
.confetti { position: fixed; z-index: 4; border-radius: 1px; pointer-events: none; }
#stage.defeated { filter: saturate(.35) brightness(.8); transition: filter .8s; }
#stage { transition: filter .8s; }
/* ตั้งค่าเสียงแยกหมวด */
.sound-mix { display: grid; gap: 4px; width: 100%; margin-top: 4px; }
.sound-mix label { display: grid; grid-template-columns: 58px 1fr; align-items: center; gap: 6px; font-size: 10px; color: #9cb0c5; }
.sound-mix input { width: 100%; }
.notify-setting { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 10.5px; color: #b8c8d8; cursor: pointer; }
.notify-setting:has(input:disabled) { opacity: .55; cursor: help; }
@media (prefers-reduced-motion: reduce) { .problem { animation: none; } }

/* ---------- เล่าเหตุการณ์ (ใครทำอะไรกับใคร) ---------- */
#narration { position: fixed; z-index: 44; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; pointer-events: none; max-width: min(760px, 70vw); }
#narration[hidden] { display: none; }
.nar-line { display: grid; justify-items: center; gap: 2px; padding: 6px 16px; border-radius: 9px; background: #0c1b2ef2; border: 1px solid #c3d3e333; box-shadow: 0 6px 20px #0008; text-align: center; }
.nar-line span { font-size: 15px; font-weight: 600; color: #eef4fa; }
.nar-line small { font-size: 12px; color: #b7c7d7; line-height: 1.5; max-width: 680px; }
.nar-line.now { animation: nar-in .22s ease-out; }
.nar-line.old { padding: 3px 12px; opacity: .55; background: #0c1b2ecc; }
.nar-line.old span { font-size: 12px; font-weight: 400; }
.nar-line.me { border-left: 3px solid var(--me); } .nar-line.opp { border-left: 3px solid var(--opp); }
.nar-line.hit { border-left: 3px solid #ff8a7a; } .nar-line.fx { border-left: 3px solid var(--gold); }
@keyframes nar-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- เน้นส่วนสำคัญในข้อความการ์ด ---------- */
.rt-kw { display: inline-block; padding: 0 4px; border-radius: 4px; font-weight: 700; color: #e9dcff; background: #8f6fd52e; border: 1px solid #b48cff44; line-height: 1.35; }
.rt-kw.rt-timing { color: #ffe3a3; background: #e8c36a24; border-color: #e8c36a55; }
.rt-kw.rt-combat { color: #ffc9bd; background: #ff8a7a22; border-color: #ff8a7a55; }
.rt-dmg { color: #ff8f86; font-weight: 700; }
.rt-buff { color: #8cf0b2; font-weight: 700; }
.rt-debuff { color: #d7a0ff; font-weight: 700; }
.rt-draw { color: #8fd3ff; font-weight: 700; }
.rt-score { color: #f2d48a; font-weight: 700; }
.rt-cond { color: #f5c97a; font-weight: 600; }
.rt-dur { text-decoration: underline dashed #9fb2c6; text-underline-offset: 3px; }
.rt-enemy { color: #ffb3b3; font-weight: 600; } .rt-friend { color: #a8e6f0; font-weight: 600; } .rt-all { font-weight: 700; }
/* ตามกรณี: คำที่ใช้ได้ในจังหวะนี้ */
.rt-kw.hot, .card-term.hot { box-shadow: 0 0 0 1px currentColor, 0 0 10px currentColor; animation: rt-hot 1.4s ease-in-out infinite; }
.rt-buff.hot, .rt-debuff.hot { text-shadow: 0 0 8px currentColor; }
@keyframes rt-hot { 50% { box-shadow: 0 0 0 1px currentColor, 0 0 3px currentColor; } }
@media (prefers-reduced-motion: reduce) { .rt-kw.hot, .card-term.hot { animation: none; } .nar-line.now { animation: none; } }

/* ---------- สรุปการ์ดแบบเข้าใจง่าย ---------- */
.card-guide { display: grid; gap: 8px; margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; background: linear-gradient(135deg, #1b3a4f, #16283d); border: 1px solid #7bd8e655; }
.card-guide .guide-label { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: #7bd8e6; }
.card-guide .guide-label .ic { width: 13px; height: 13px; }
.card-guide .guide-plain { font-size: 15px; line-height: 1.6; color: #f1f6fb; }
.card-guide .guide-tip { font-size: 13px; line-height: 1.55; color: #c9d8e6; padding-top: 7px; border-top: 1px dashed #7bd8e633; }
.card-guide .guide-tip .guide-label { color: #f2d48a; }
.card-guide.compact { margin: 8px 0; padding: 8px 10px; gap: 5px; }
.card-guide.compact .guide-plain { font-size: 13px; }
.card-guide.compact .guide-tip { font-size: 12px; padding-top: 5px; }
.card-guide .guide-points { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.card-guide .guide-points li::marker { color: #7bd8e6; }
.card-guide .guide-kw { display: grid; gap: 3px; margin: 0; padding: 7px 9px; border-radius: 7px; background: #0e1f3388; font-size: 12px; }
.card-guide .guide-kw > div { display: grid; grid-template-columns: max-content 1fr; gap: 8px; align-items: baseline; }
.card-guide .guide-kw dt { color: #e9dcff; font-weight: 700; } .card-guide .guide-kw dt::before { content: '['; color: #8f7bb8; } .card-guide .guide-kw dt::after { content: ']'; color: #8f7bb8; }
.card-guide .guide-kw dd { margin: 0; color: #c9d8e6; }
.card-guide.compact .guide-kw { font-size: 11px; padding: 5px 7px; }
.card-guide .guide-kw dt.term { color: #f5c97a; } .card-guide .guide-kw dt.term::before, .card-guide .guide-kw dt.term::after { content: none; }

/* ---------- ทำอะไรได้บ้างตอนนี้ ---------- */
.whatnow-btn { width: 100%; justify-content: center; border-color: #7bd8e655 !important; color: #a8e1ed !important; }
.can-do { outline: 3px solid #4ade80 !important; outline-offset: 3px; animation: can-do 1s ease-in-out 5; z-index: 25; }
@keyframes can-do { 50% { outline-color: #4ade8044; box-shadow: 0 0 22px #4ade8099; } }
#whatNowPanel { position: fixed; z-index: 46; width: 360px; padding: 12px 14px; border-radius: 10px; background: #0f2236f5; border: 1px solid #4ade8077; box-shadow: 0 10px 30px #0009; font-size: 13px; line-height: 1.55; }
#whatNowPanel > b { display: block; margin-bottom: 6px; color: #eef4fa; font-size: 14px; }
#whatNowPanel p { margin: 4px 0; } #whatNowPanel p.ok { color: #8cf0b2; display: flex; gap: 6px; align-items: center; }
#whatNowPanel ul { margin: 4px 0 6px; padding-left: 18px; color: #d5e2ee; }
#whatNowPanel details summary { cursor: pointer; color: #9fb2c6; font-size: 12px; }
#whatNowPanel button { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .can-do { animation: none; } }
.end-series { margin: 2px 0 0; font-size: 13px; color: #c9d8e6; } .end-series b { color: var(--gold); font-size: 16px; }
.bot-pick { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-right: 8px; }
.bot-pick button { min-width: 64px; }

/* ---------- เกมแรก: สอนเล่นแบบพาทำ ---------- */
.tutorial-start { font-weight: 700; }
.hud .tutorial { padding: 12px; border-radius: 8px; border: 1px solid #f2d48a88; border-left: 4px solid var(--gold); background: linear-gradient(160deg, #2a2a1c, #16263a); box-shadow: 0 6px 20px #0006; font-size: 12.5px; line-height: 1.6; animation: coach-in .3s ease-out; }
.tutorial .tutorial-h { display: flex; justify-content: space-between; align-items: center; color: #f2d48a; font-size: 11px; font-weight: 700; letter-spacing: .04em; margin-bottom: 4px; }
.tutorial .tutorial-h button { padding: 2px 8px; font-size: 10px; }
.tutorial > b { display: block; font-size: 14px; color: #fff3d6; margin-bottom: 4px; }
.tutorial p { margin: 0 0 4px; color: #e3ebf3; }
.tutorial .tutorial-wait { font-size: 11px; margin-top: 6px; }
.tutorial > button.primary { width: 100%; margin-top: 6px; }
.tut-focus { outline: 3px solid #f2d48a !important; outline-offset: 3px; animation: tut-focus 1.2s ease-in-out infinite; }
@keyframes tut-focus { 50% { outline-color: #f2d48a33; box-shadow: 0 0 24px #f2d48aaa; } }
@media (prefers-reduced-motion: reduce) { .tut-focus { animation: none; } }

/* ---------- คำบรรยายเด็ค ---------- */
.deck-guide { display: grid; gap: 6px; text-align: left; }
.deck-guide .deck-style { margin: 0; font-size: 13px; color: #eef4fa; font-weight: 600; }
.deck-difficulty { justify-self: start; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: #ffffff10; color: #f2d48a; }
.deck-difficulty.d1 { color: #8cf0b2; } .deck-difficulty.d3 { color: #ffb19f; }
.deck-guide details summary { cursor: pointer; font-size: 12px; color: #7bd8e6; }
.deck-guide details ul { margin: 6px 0; padding-left: 18px; font-size: 12px; line-height: 1.55; }
.deck-guide details p { margin: 4px 0; font-size: 12px; line-height: 1.5; }
.deck-guide b.good { color: #8cf0b2; } .deck-guide b.warn { color: #f5c97a; }
.deck-keycards { display: grid; gap: 6px; margin-top: 6px; }
.deck-keycard { display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: center; padding: 4px; border-radius: 6px; background: #0e1f3366; cursor: help; }
.deck-keycard img { width: 40px; border-radius: 4px; }
.deck-keycard b { display: block; font-size: 12px; } .deck-keycard small { font-size: 11px; color: #c9d8e6; line-height: 1.4; }
.fallback-fly { width: 100%; height: 100%; }

/* ============================================================ ป๊อปอัปกลางสนาม */
/* ถึงตาเราตอบโต้: การ์ดที่อีกฝ่ายร่าย + การ์ดที่ใช้ตอบโต้ได้ + ปุ่มผ่าน */
.respond-prompt { position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%); width: min(540px, calc(100% - 36px)); max-height: min(480px, calc(100% - 40px)); display: flex; flex-direction: column; overflow: hidden;
  padding: 12px 14px; border-radius: 12px; border: 2px solid #4fd1e8; background: #0f2638f7; box-shadow: 0 0 0 100vmax #00000040, 0 14px 40px #000a; z-index: 5; }
.respond-prompt.pop-in { animation: respond-pop .28s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes respond-pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.92); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.respond-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.respond-head strong { font-size: 16px; color: #b7f1fa; }
.respond-card { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.respond-card .card { --cw: 92px; cursor: help; }
.respond-info b { font-size: 15px; }
.respond-info p { margin: 4px 0; font-size: 13px; line-height: 1.55; }
.respond-target { color: #ffd38a; }
.respond-note { margin: 2px 0 6px; font-size: 13px; }
.respond-head, .respond-card, .respond-note, .respond-none, .respond-foot { flex: none; }
.respond-list { flex: 1 1 auto; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; margin-top: 10px; padding: 8px 2px 0 0; border-top: 1px solid #4fd1e833; }
body:has(.respond-prompt) #narration { opacity: 0; }
.respond-h { font-size: 12px; color: #8cf0b2; }
.respond-list .chain-choice { text-align: left; padding: 5px; gap: 8px; font-size: 12px; }
.respond-list .chain-choice small { display: block; font-size: 11px; color: #c9d8e6; line-height: 1.4; }
.respond-none { margin: 10px 0 0; font-size: 12px; }
.respond-foot { display: flex; justify-content: center; margin-top: 10px; }
.respond-foot .big { min-width: 220px; }
.respond-pill { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px;
  border: 2px solid #4fd1e8; background: #0f2638f2; box-shadow: 0 6px 20px #0008; white-space: nowrap; font-size: 13px; z-index: 5; }
.respond-pill .big { padding: 5px 14px; font-size: 13px; }
.board-dragging .respond-prompt, .board-dragging .respond-pill { opacity: .2; pointer-events: none; }

/* คำถามที่ไม่ต้องคลิกบนสนาม: กลางจอ พื้นหลังมืดลงเล็กน้อย (ไม่บังการคลิก) */
.clean-table .board-overlays .board-decision { top: 46%; bottom: auto; transform: translate(-50%, -50%); max-height: min(440px, calc(100% - 40px)); }
.clean-table .board-overlays .board-decision:has(.decision) { box-shadow: 0 0 0 100vmax #00000040, 0 14px 40px #000a; border-radius: 10px; }

/* คำถามที่ต้องเลือกบนสนาม / เดินยูนิต: แถบลอยบนสุดของสนาม (สลับไปล่างได้) สนามยังคลิกได้ครบ */
.board-overlays .board-pick { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 36px)); max-height: 240px; overflow-y: auto;
  border-radius: 10px; border: 2px solid var(--gold); background: #11283df5; box-shadow: 0 8px 26px #0009; z-index: 4; }
.board-overlays .board-pick.dock-bottom { top: auto; bottom: 165px; }
.board-pick .dock-toggle { position: sticky; top: 4px; float: right; margin: 4px 4px 0 0; z-index: 2; font-size: 11px; padding: 2px 8px; }
.board-pick .decision { border: 0; background: transparent; }
.board-pick .decision-content { max-height: 130px; }
.board-pick .chain-choices { display: flex; flex-wrap: wrap; gap: 5px; }
.board-pick .chain-choice { flex: 0 1 200px; }
.board-pick .decision-footer { justify-content: flex-end; }
.board-pick .decision-footer button { flex: 0 1 auto; min-width: 90px; }
.board-pick .actionbar { position: static; border: 0; background: transparent; max-height: none; }
.board-pick .actionbar > button { width: auto; }
.board-dragging .board-pick { opacity: .35; pointer-events: none; }

/* ============================================================ เดคของฉัน + ตัวจัดเดค */
.my-decks-note { font-size: 13px; font-weight: 400; }
.my-decks .my-decks-empty { grid-column: 1 / -1; text-align: left; line-height: 1.6; }
.my-decks .muted { margin: 0; }
.deck-tile.custom-deck { border-color: #8cf0b255; }
.deck-tile.custom-deck.mine { border-color: var(--me); }
.my-deck-tools { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.my-deck-tools button { flex: 1 1 auto; }
.deck-editor-wrap { position: fixed; inset: 0; z-index: 45; background: #000b; display: flex; align-items: center; justify-content: center; padding: 14px; }
.deck-editor { width: min(1500px, 100%); height: min(940px, 100%); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px #000c; }
.de-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #0e1f33; }
.de-top input { flex: 0 1 340px; font-size: 16px; font-weight: 700; }
.de-status { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.de-status .deck-status { margin: 0; }
.de-count-pill { padding: 2px 9px; border-radius: 999px; background: #3a1d22; color: #ffb4b4; font-weight: 700; }
.de-count-pill.ok { background: #143a29; color: #8cf0b2; }
.de-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 380px 1fr; }
.de-side { overflow-y: auto; padding: 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.de-legend { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.de-legend small { display: block; margin-top: 4px; line-height: 1.4; }
.de-issues { margin: 0; font-size: 12px; }
.de-issues ul { margin: 4px 0 0; padding-left: 18px; }
.de-ok { margin: 0; color: #8cf0b2; font-size: 13px; }
.de-field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.de-runes, .de-bfs { display: flex; flex-wrap: wrap; gap: 6px; }
.de-rune, .de-bf { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 8px; background: #0e1f33; border: 1px solid var(--line); }
.de-bf.on { border-color: var(--gold); }
.de-rune b { min-width: 18px; text-align: center; }
.de-rune button, .de-bf button, .de-row button { padding: 1px 7px; min-width: 0; }
.de-list h3 { margin: 4px 0; font-size: 15px; }
.de-list h4 { margin: 10px 0 4px; font-size: 13px; color: var(--gold); }
.de-row { display: grid; grid-template-columns: 34px 1fr auto 22px auto; align-items: center; gap: 5px; padding: 3px 4px; border-radius: 6px; font-size: 13px; }
.de-row:hover { background: #ffffff0d; }
.de-row b { text-align: center; }
.de-row.is-champ { background: #c8aa6e1a; }
.de-row em { font-style: normal; font-size: 10px; color: var(--gold); margin-left: 4px; }
.de-name { cursor: help; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de-cost { color: #9fc6e6; font-size: 12px; }
.de-pool { min-width: 0; display: flex; flex-direction: column; padding: 12px; gap: 6px; }
.de-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.de-filters input { flex: 1 1 260px; }
.de-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.de-pool-help { margin: 0; font-size: 12px; }
.de-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; padding: 4px 2px; }
.de-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px; border-radius: 10px; background: #0e1f33; border: 2px solid transparent; text-align: center; }
.de-card:hover { border-color: #4fd1e8aa; }
.de-card.in { border-color: #8cf0b288; background: #12301f; }
.de-card.full { opacity: .55; }
.de-card small { font-size: 11px; line-height: 1.35; color: #c9d8e6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.de-n { position: absolute; top: 4px; right: 6px; min-width: 24px; padding: 2px 6px; border-radius: 999px; background: var(--me); color: #00151c; font-weight: 800; font-size: 13px; }
.toast.ok { background: #12301ff5; border-color: #3ccf7a; }
.toast.ok .toast-row .ic { color: #8cf0b2; }

/* ============================================================ หน้าแรก: ห้อง / บอท / เดค */
.lobby.home { max-width: 1240px; }
.home-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.home-top h1 { flex: 1; margin: 8px 0; }
.name-chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.home-section { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 14px 0; transition: box-shadow .3s; }
.home-section > h2 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-size: 18px; color: var(--gold); }
.home-section > h2 .muted { font-size: 13px; font-weight: 400; color: var(--muted); }
.home-section.need-deck { box-shadow: 0 0 0 3px #e5484d, 0 0 30px #e5484d66; }
.step-no { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #1a1408; font-size: 14px; font-weight: 800; }
.home-name { max-width: 560px; margin: 40px auto; }
.home-name-row { display: flex; gap: 8px; } .home-name-row input { flex: 1; font-size: 16px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.room-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; border: 2px solid var(--line2); background: #0e1f33; min-height: 170px; text-align: left; }
.room-card.waiting { border-color: #4fd1e888; }
.room-card.mine { border-color: var(--me); box-shadow: 0 0 18px #4fd1e833; }
.room-head { display: flex; align-items: center; gap: 8px; } .room-head b { flex: 1; font-size: 15px; }
.room-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #2a2440; color: #cbb8ff; display: inline-flex; gap: 4px; align-items: center; }
.room-status { font-size: 12px; color: var(--muted); }
.room-seats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.room-seats li { display: flex; align-items: center; gap: 6px; }
.room-score { margin-left: auto; font-weight: 800; color: var(--gold); }
.room-actions { display: flex; gap: 6px; margin-top: auto; } .room-actions > button:first-child { flex: 1; }
.room-card.room-add { align-items: center; justify-content: center; border: 2px dashed #7189aa88; background: transparent; color: var(--muted); cursor: pointer; text-align: center; }
.room-card.room-add:hover { border-color: var(--me); color: var(--text); background: #4fd1e80d; }
.room-add .plus { font-size: 44px; line-height: 1; font-weight: 300; color: var(--me); }
.room-add b { font-size: 16px; color: var(--text); } .room-add small { font-size: 12px; }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.bot-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 12px; text-align: left; }
.bot-card .ic { width: 26px; height: 26px; color: var(--me); }
.bot-card b { font-size: 15px; } .bot-card small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.bot-card.tutorial-start .ic { color: var(--gold); }
.my-bot-rooms { margin-top: 12px; } .my-bot-rooms > p { grid-column: 1 / -1; margin: 0; }
.deck-current { padding: 9px 12px; border-radius: 10px; background: #3a1d22; color: #ffc2c2; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.deck-current.ok { background: #12301f; color: #b9f5cf; }
.prepared-decks > summary { cursor: pointer; list-style: none; } .prepared-decks > summary h3 { display: inline; }
.prepared-decks > summary::before { content: '▸ '; color: var(--muted); } .prepared-decks[open] > summary::before { content: '▾ '; }
.room-seats-row { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.room-seat { flex: 1 1 240px; padding: 12px; border-radius: 12px; border: 2px solid var(--line2); background: #0e1f33; display: flex; flex-direction: column; gap: 6px; }
.room-seat.me { border-color: var(--me); } .room-seat.empty { border-style: dashed; justify-content: center; }
.room-seats-row .vs { align-self: center; font-weight: 800; color: var(--gold); }

/* หน้าต่างยาว (วิธีเล่น / รายละเอียดเดค): ปุ่มท้ายหน้าต่างติดขอบล่างเสมอ ไม่ต้องเลื่อนหา */
.modal .box > .btnrow:last-child { position: sticky; bottom: -16px; margin: 12px -16px -16px; padding: 10px 16px; background: linear-gradient(0deg, var(--panel) 75%, transparent); z-index: 2; }
@media (max-width: 640px) { .modal .box > .btnrow:last-child { bottom: -12px; margin: 10px -12px -12px; padding: 8px 12px; } }

/* ชี้การ์ดบนมือ: rune ที่จะถูกใช้จ่าย (exhaust = เอียง · recycle = กลับเข้ากอง) */
.rune.pay-exhaust, .rune.pay-recycle { outline: 2px solid #67e8d4; outline-offset: 2px; border-radius: 4px; filter: brightness(1.25); }
.rune.pay-recycle { outline-color: #c4a7ff; outline-style: dashed; }

/* การ์ดล่าสุด (แบบ Runeterra): ไอคอนการ์ดเรียงในแผงข้าง ชี้เพื่อดูเต็ม */
.recent-plays { margin: 8px 0 4px; }
.recent-h { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.recent-h .ic { width: 13px; height: 13px; }
.recent-row { display: flex; gap: 4px; align-items: flex-end; }
.recent-card { flex: none; width: 30px; height: 42px; border-radius: 4px; overflow: hidden; border: 2px solid var(--line2); background: var(--bg2); cursor: help; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.recent-card.me { border-color: var(--me); } .recent-card.opp { border-color: var(--opp); }
.recent-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.recent-card.latest { width: 36px; height: 50px; box-shadow: 0 0 10px #ffffff30; }
#chainLinks path.aim { stroke: #ffd36b; stroke-width: 3; stroke-dasharray: none; animation: none; }
#chainLinks circle.aim { stroke: #ffd36b; fill: #ffd36b55; }

/* ผลที่คาดของสเปลในแผงยืนยัน */
.spell-outcome { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #0b1726; border: 1px solid #ffd36b44; font-size: 13px; }
.spell-outcome ul { margin: 4px 0 0; padding-left: 18px; }
.spell-outcome li.opp.dies { color: #8cf0b2; } .spell-outcome li.mine.dies { color: #ff9a9a; }
.spell-outcome .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* อีกฝ่ายกำลังคิด */
.opp-half { position: relative; }
.thinking { position: absolute; right: 12px; bottom: -4px; z-index: 6; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; color: #ffd0d0; background: #2a1520e8; border: 1px solid #ff8c8c66; box-shadow: 0 4px 12px #0006; pointer-events: none; }
.thinking .ic { width: 14px; height: 14px; }
.thinking .dots { display: inline-flex; gap: 3px; }
.thinking .dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .3; animation: think 1.2s infinite; }
.thinking .dots i:nth-child(2) { animation-delay: .2s; } .thinking .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes think { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .thinking .dots i { animation: none; opacity: .7; } }
.motion-reduced .thinking .dots i { animation: none; opacity: .7; }

/* นาฬิกาต่อตา */
.turn-clock { margin: 6px 0; font-size: 12px; color: var(--muted); }
.turn-clock span { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.turn-clock .ic { width: 13px; height: 13px; }
.turn-clock b { color: var(--text); font-variant-numeric: tabular-nums; }
.turn-clock .rope { height: 5px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.turn-clock .rope i { display: block; height: 100%; background: #67e8d4; transform-origin: 0 50%; transform: scaleX(var(--from)); animation: rope linear forwards; }
.turn-clock.opp .rope i { background: #ff8c8c; }
.turn-clock.low .rope i { background: #ff5a5a; } .turn-clock.low b { color: #ff9a9a; }
@keyframes rope { from { transform: scaleX(var(--from)); } to { transform: scaleX(0); } }
.timer-setting { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.timer-setting select { background: var(--bg); color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 6px; }
.timer-setting .ic { width: 14px; height: 14px; }

/* จังหวะ motion อ้างอิงสถิติ UI ของ RO3 (7,403 bundle): tooltip ขยาย+จาง ~0.15s · ของใหม่เลื่อนเข้า ~0.34s + กะพริบ 0→1→0 ~0.4s
   ใช้ ease-out แรงช่วงต้นแบบเดียวกับ curve ส่วนใหญ่ของ RO3 (ถึง ~75% ที่ 30% ของเวลา) */
#preview:not(.hidden) > * { animation: tip-in .15s cubic-bezier(.15,.8,.3,1); }
@keyframes tip-in { from { opacity: 0; transform: translateY(4px) scale(.97); } }
.recent-card.fresh { animation: recent-in .34s cubic-bezier(.15,.8,.3,1), recent-flash .4s .3s; }
@keyframes recent-in { from { opacity: 0; transform: translateX(-14px) scale(.9); } }
@keyframes recent-flash { 50% { box-shadow: 0 0 0 2px #fff8, 0 0 16px #ffffffaa; } }
@media (prefers-reduced-motion: reduce) { #preview:not(.hidden) > *, .recent-card.fresh { animation: none; } }

/* ---------- จาก RO3: ปุ่มยุบตอนกด · ปุ่มที่กำลังส่ง · ฉากหลังเบลอ · ป้ายใหม่ · แสงไล่ปุ่มยืนยัน ---------- */
button { transition: scale .08s, filter .15s, opacity .15s; }
button:active:not(:disabled) { scale: .96; }
button.is-pending { cursor: progress; opacity: .7; filter: saturate(.6); }
.modal:not(.hidden) { backdrop-filter: blur(4px) saturate(.85); }
.nbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; font-size: 11px; font-weight: 800; color: #10151f; background: #ffd36b; vertical-align: 1px; }
#confirmPlay, #confirmClearRoom { position: relative; overflow: hidden; }
#confirmPlay:not(:disabled)::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, #ffffff40 50%, transparent 65%); transform: translateX(-120%); animation: sweep 3.2s infinite; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { button { transition: none; } button:active:not(:disabled) { scale: none; } #confirmPlay::after { animation: none; display: none; } }

/* ---------- การ์ด 3D: พลิกหลัง→หน้า · หมุนเข้ากลางจอ · การ์ดบนมือเอียงตามเมาส์ ---------- */
.ghost.ghost-3d { overflow: visible; box-shadow: none; background: transparent; }
.ghost.ghost-3d.big { box-shadow: none; }
.c3d { width: 100%; height: 100%; perspective: 900px; }
.c3d-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.c3d-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 7px; overflow: hidden; box-shadow: 0 14px 34px #000c; }
.c3d-back { transform: rotateY(180deg); }
.ghost-3d.big .c3d-face { border-radius: 12px; box-shadow: 0 0 0 3px var(--gold), 0 20px 60px #000e, 0 0 80px #e8c36a55; }
.c3d-glare { position: absolute; inset: -20%; background: linear-gradient(105deg, transparent 35%, #ffffffb0 50%, transparent 65%); mix-blend-mode: soft-light; opacity: 0; pointer-events: none; }
.ghost.tilt-in > * { animation: tilt-in .32s cubic-bezier(.2,.8,.3,1); transform-origin: 50% 60%; }
@keyframes tilt-in { from { transform: perspective(900px) rotateX(22deg) rotateY(-14deg) scale(.92); } }
/* การ์ดบนมือ: เอียงตามตำแหน่งเมาส์ + แสงสะท้อน (ตั้งค่า --rx/--ry/--gx/--gy จาก app.js) */
/* ยกไม่เกินขอบบนของแถบมือ (overflow hidden): -34px/1.18 เดิมทำให้หัวการ์ดถูกตัด */
.clean-table .hand .card:hover { transform: translateY(-18px) scale(1.1) perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) !important; transition: transform .08s linear, filter .18s, box-shadow .18s; }
.hand .card .tilt-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), #ffffff55, transparent 55%); mix-blend-mode: overlay; z-index: 3; }
.hand .card:hover .tilt-glare { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .clean-table .hand .card:hover { transform: translateY(-18px) scale(1.1) !important; } .hand .card .tilt-glare { display: none; } .ghost.tilt-in > * { animation: none; } }
.motion-reduced .hand .card .tilt-glare { display: none; }
/* Decision previews are labels, never changes to the live card statistics. */
.forecast-mark,.target-hint{position:absolute;left:50%;top:6px;transform:translateX(-50%);z-index:14;max-width:150px;width:max-content;padding:4px 8px;border:1px solid #62d6d0;border-radius:7px;background:#102a30;color:#c9fffa;font-size:12px;line-height:1.35;text-align:center;pointer-events:none;box-shadow:0 3px 10px #0008}
.forecast-lethal{background:#3b1b28;border-color:#ff859b;color:#ffe2e8}
.bf-mid{position:relative}
.bf-mid>.forecast-mark{bottom:auto;top:-20px}
.forecast-uncertain{padding:9px 12px;border-left:3px solid #e4bd72;background:#e4bd7212;color:#eed8b0}
.target-hint{bottom:6px;top:auto;border-color:#5ec4df;background:#112d3b;color:#d9f7ff;font-size:11px}
.target-invalid{display:none;background:#30272a;border-color:#af8890;color:#f4dbe1}
.unit-wrap:hover>.target-invalid{display:block}
.hand-availability{display:none;position:absolute;bottom:8px;left:4px;right:4px;padding:5px;border-radius:5px;background:#321f29f5;border:1px solid #dd8b9c;color:#ffe4eb;font-size:11px;line-height:1.3;text-align:center;z-index:12;pointer-events:none}
[data-hand]:hover .hand-availability,[data-hand]:focus-visible .hand-availability{display:none}
[data-hand]:focus-visible { outline: 3px solid #a8e1ed; outline-offset: 3px; z-index: 20; }
#preview .preview-card > img { max-height: 260px; }
.hand-availability.available{background:#153630f5;border-color:#76d6b8;color:#d4ffef}
.cast-item.resolving{border-color:#f4d58a!important;box-shadow:0 0 0 2px #f4d58a88,0 0 24px #e8ba4b33;background:#3b3220!important}
.cast-item.resolving .cast-state{color:#ffe3a1;font-weight:800}
.cast-invalid{display:block;color:#ffb1be;font-size:12px;line-height:1.4;margin-top:4px}
.spell-outcome ul{max-height:180px;overflow:auto}
.clean-table .board-overlays .board-decision:has(.payment-review){top:25%;bottom:auto;left:auto;right:12px;transform:none;width:360px;max-width:42%;max-height:62%;box-shadow:0 12px 32px #0008;border-radius:10px}
.clean-table .board-overlays .board-decision:has(.review-left){left:12px;right:auto}
.payment-review .decision-heading{flex-wrap:wrap;gap:6px}
.payment-review #reviewDock{margin-left:auto;font-size:11px;padding:3px 6px}
.payment-review .decision-footer{position:sticky;bottom:-10px;background:#11283d;padding-bottom:8px;flex-wrap:wrap}
.payment-review .decision-footer>button{min-width:70px}
.play-steps{display:flex;gap:5px;list-style:none;padding:0;margin:6px 0;flex-wrap:wrap;font-size:11px;color:#a5b5c7}
.play-steps li{padding:4px 6px;border:1px solid #8097b044;border-radius:5px}
.play-steps [aria-current="step"]{background:#143e50;border-color:#62d6e8;color:#d3fbff;font-weight:700}
.selection-summary{display:flex;flex-wrap:wrap;gap:5px;margin:6px 0}
.selection-summary button{background:#3b321f;border:1px solid #e4bd72;color:#ffe6aa;text-align:left;font-size:12px;padding:5px 7px}
.selection-summary small{display:block;color:#dbcca9;font-size:10px}
.selection-mark{position:absolute;right:3px;top:26px;z-index:16;border:1px solid #ffdc80;border-radius:5px;padding:2px 5px;background:#34260df5;color:#ffe6a1;font-size:13px;font-weight:800;pointer-events:none}
.picked-target{outline:2px solid #efc66c!important;outline-offset:2px}
.auto-response-status{padding:7px;border:1px solid #8ba7bb66;border-radius:6px;background:#142b3b;color:#d1e8f7;font-size:11px;line-height:1.5}
.auto-response-status button{display:block;margin-top:4px;font-size:11px;padding:4px 6px}
.commit-explanation{font-size:11px;color:#b5e4ef;border-left:2px solid #62c3d4;padding-left:7px}
#toastClose{flex:none;align-self:flex-start;padding:1px 7px;font-size:18px}
.recent-outcome details{margin-top:6px}.recent-outcome summary{cursor:pointer;color:#f1d59b}.recent-outcome ol{padding-left:20px}.recent-outcome li+li{margin-top:4px}
.board-pick:has(.play-steps){overflow:hidden}
.board-pick:has(.play-steps) .decision{display:flex;flex-direction:column;max-height:230px}
.board-pick:has(.play-steps) .decision-content{flex:1 1 auto;min-height:0;overflow-y:auto;max-height:none}
.board-pick:has(.play-steps) .decision-heading,.board-pick:has(.play-steps) .decision-footer{flex-shrink:0}
.board-pick:has(.play-steps) .decision-footer{position:sticky;bottom:0;background:#11283d;z-index:3}
.target-selected{background:#34260df5;border-color:#efc66c;color:#ffe6a1}
.clean-table .hud>.turn-controls{position:sticky;bottom:-14px;margin-top:auto;flex:none;display:flex;flex-direction:column;gap:12px;background:#101e3afa;padding:10px 0 8px;z-index:9;border-top:1px solid #738ca344}
.turn-control{padding:8px;border:1px solid #738ca33b;border-radius:8px;background:#122536}
.control-label{display:flex;justify-content:space-between;gap:5px;font-size:10px;color:#b9c7d5;margin-bottom:6px}
.control-label kbd{font-family:inherit;color:#7f97ad}
.turn-control .big{width:100%;min-height:42px;line-height:1.35}
.turn-control p{font-size:11px;line-height:1.45;margin:6px 0 0;color:#9eb2c4;overflow-wrap:anywhere}
.pass-control.available{border-color:#59c3d799;background:#143644}
.pass-control.available p{color:#bdebf3}
.end-control{margin-top:5px;border-top:2px solid #b0925c66}
.end-control.available #endBtn{background:#6e5125;border-color:#e1bd74;color:#fff1ce}
.end-control.available p{color:#dbcba8}
.turn-confirm{padding:9px;border:1px solid #e8c36a;border-radius:8px;background:#342c20;color:#ffe6b4;font-size:12px;line-height:1.5;max-height:250px;overflow-y:auto}
.turn-confirm ul{padding-left:16px;margin:5px 0}.turn-confirm p{font-size:11px;margin:6px 0}
.turn-confirm>div{position:sticky;bottom:-9px;background:#342c20;display:flex;gap:5px;flex-wrap:wrap;padding:7px 0}
.turn-confirm button{flex:1;font-size:11px;min-height:34px;padding:6px 3px}
.combat-unit-label{position:absolute;top:-8px;left:50%;transform:translateX(-50%);z-index:15;max-width:100%;box-sizing:border-box;width:max-content;padding:3px 4px;border-radius:5px;background:#233145f5;border:1px solid #8ba2bd;color:#edf4ff;font-size:10px;line-height:1.3;text-align:center;pointer-events:none}
.combat-unit-label small{display:block;font-size:9px}.combat-unit-label b{font-size:13px}
.combat-contributor{background:#153b45;border-color:#64d1d5;color:#cafffc}
.combat-recipient{background:#3b2731;border-color:#e795a7;color:#ffe7ed}
.combat-focused{border:2px solid #f4d18a;background:#46351d;color:#fff0cc}
.unit-wrap:has(.combat-focused)>.card{outline:3px solid #f4d18a;outline-offset:2px}
.unit-wrap:has(.combat-contributor)>.card{box-shadow:0 0 0 2px #64d1d577}
.combat-field-summary{position:absolute;top:-22px;left:50%;transform:translateX(-50%);z-index:4;max-width:95%;width:max-content;border-radius:6px;background:#142538f5;border:1px solid #a8b6c255;padding:3px 8px;font-size:11px;text-align:center;pointer-events:none}
.combat-field-summary span{display:block;font-size:10px;color:#bfccda}
.board-overlays .board-pick:has(.combat-assignment){top:8px;left:12px;right:auto;transform:none;width:400px;max-width:43%;max-height:calc(100% - 190px);overflow:hidden}
.board-overlays .board-pick:has([data-combat-bf="0"]){left:auto;right:12px}
.board-overlays .board-pick.dock-bottom:has(.combat-assignment){top:auto;bottom:165px}
.board-pick .combat-assignment{display:flex;flex-direction:column;max-height:570px;padding:8px}
.board-pick .combat-assignment .decision-content{flex:1 1 auto;min-height:0;max-height:none;overflow-y:auto}
.board-pick .combat-assignment .decision-footer,.board-pick .combat-assignment .decision-heading{flex-shrink:0}
.board-pick .combat-assignment .decision-footer{position:sticky;bottom:0;background:#11283d;padding:7px 0;flex-wrap:wrap}
.combat-damage-pool{padding:8px;border:1px solid #5dcbd6;border-radius:6px;background:#15333c;margin-bottom:8px;font-size:12px;color:#d5faff}
.combat-damage-pool p{font-size:11px;color:#b1d9e0}
.combat-source-list{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px}.combat-source-list span{font-size:10px;border:1px solid #8cb7b344;border-radius:4px;padding:2px 4px}
.combat-assignment .asg-row{display:grid;grid-template-columns:38px minmax(75px,1fr) 25px 20px 25px;gap:4px;padding:7px 4px;align-items:center}
.combat-assignment [data-asgkill]{grid-column:2/-1;justify-self:end;font-size:10px;padding:2px 6px}
.asg-row.asg-focused{outline:1px solid #f4d18a;background:#55401e55}
.asg-focus{padding:0!important;border:0!important;background:transparent!important;text-align:left;color:inherit;font-size:11px}
.asg-name small{display:block;font-size:10px;color:#d6c2ba}
.assignment-status{font-size:12px;color:#96e4bd}.assignment-status.invalid{color:#ffd18c}
#chainLinks .combat-allocation{stroke:#f4d18a;stroke-width:3;fill:none;stroke-dasharray:7 4}
#chainLinks .combat-link-label{fill:#fff0bd;stroke:#152234;stroke-width:4px;paint-order:stroke;font-size:13px;font-weight:700}
.effect-trace{position:absolute;right:0;bottom:-15px;z-index:18;padding:1px 4px;font-size:9px;line-height:1.4;border:1px solid #9abac9;background:#183447;color:#e5f4ff;border-radius:4px}
.effect-trace:focus-visible{outline:2px solid #ffe1a0;outline-offset:2px}
.card.effect-source{outline:3px solid #67e3d2!important;outline-offset:3px}
.card.effect-recipient{box-shadow:0 0 0 4px #ffd083!important}
.action-availability{display:flex;flex-wrap:wrap;gap:4px;font-size:11px;line-height:1.5;max-height:130px;overflow-y:auto}
.action-availability>span{flex-basis:100%;color:#b8cadb}
.action-availability button{padding:4px 6px;font-size:10px;text-align:left;width:100%;border-color:#648ba366;background:#1d3348;color:#d9ecff}
.action-availability.no-actions{color:#bce5c6;padding:7px;border:1px solid #78c99b66;border-radius:6px;background:#19382e}
.end-control.suggest-end #endBtn{border:2px solid #9ee8bd;background:#226047;color:#f0fff4}
.action-hint-target{outline:3px solid #79e0f2!important;outline-offset:3px}
/* Named textures exported from the local Runeterra bundle; see vfx/lor/sources.json. */
.battle-fx-ring,.battle-fx-impact,.battle-fx-bolt,.battle-fx-slash,.battle-fx-spark{mask-mode:alpha;mask-size:100% 100%;mask-position:center;mask-repeat:no-repeat}
.battle-fx-ring{mask-image:url('vfx/lor/ring.png')}
.battle-fx-impact{mask-image:url('vfx/lor/impact.png')}
.battle-fx-bolt{mask-image:url('vfx/lor/bolt.png')}
.battle-fx-slash{mask-image:url('vfx/lor/slash.png');border-radius:0;box-shadow:none}
.battle-fx-spark{mask-image:url('vfx/lor/spark.png');clip-path:none}
.battle-fx-shield,.battle-fx-stun,.battle-fx-buff,.battle-fx-death{mask-mode:alpha;mask-size:100% 100%;mask-position:center;mask-repeat:no-repeat;clip-path:none}
.battle-fx-shield{mask-image:url('vfx/lor/shield.png')}
.battle-fx-stun{mask-image:url('vfx/lor/stun.png')}
.battle-fx-buff{mask-image:url('vfx/lor/buff.png')}
.battle-fx-death{mask-image:url('vfx/lor/death.png')}
.comfort-note{font-size:10px;line-height:1.5;color:#b9cddd;margin:6px 0}
.comfort-no-flash .card{transition-property:transform,filter,opacity!important}
.comfort-no-flash .card.target,.comfort-no-flash .bf.bf-combat,.comfort-no-flash .rt-kw.hot,.comfort-no-flash .card-term.hot{animation:none!important}
.comfort-no-flash .recent-card.fresh{animation:recent-in .34s cubic-bezier(.15,.8,.3,1)}
.comfort-no-flash .problem,.comfort-no-shake .problem{animation:none!important}
/* Reserve a dedicated rail inside the playmat; cards and overlays never sit beneath it. */
.clean-table{--action-rail:178px}
.clean-table .mat.has-board-actions{position:relative;padding-right:calc(var(--action-rail) + 26px)}
.clean-table:has(.board-actions) .board-overlays{right:calc(var(--hud-width) + var(--action-rail) + 12px)}
.clean-table .mat>.board-actions{position:absolute;right:12px;top:245px;width:var(--action-rail);max-height:620px;overflow-y:auto;padding:12px 8px;box-sizing:border-box;z-index:12;display:flex;flex-direction:column;gap:12px;align-items:stretch;border:1px solid #bda06a55;border-radius:20px;background:linear-gradient(160deg,#1c3146ee,#101e30f5);box-shadow:inset 0 1px #fff1,0 8px 24px #0004;text-align:center;pointer-events:auto}
.board-action-heading{font-size:11px;letter-spacing:2px;color:#b4c5d3}
.board-actions .turn-control{border:0;background:none;padding:0;margin:0}
.board-actions .turn-control[hidden]{display:none}
.board-actions .board-action-button,.board-actions .end-control.available #endBtn,.board-actions .end-control.suggest-end #endBtn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;width:148px;height:148px;margin:0 auto;border-radius:50%;border:3px solid #d2ba7c;background:radial-gradient(circle at 40% 28%,#47667c,#183346 65%,#101f2e);box-shadow:inset 0 0 0 5px #101e30,inset 0 0 0 6px #d1b77777,0 0 20px #e9be5b15;color:#fff1d3;font-size:22px;font-weight:800;padding:16px 10px;line-height:1.3}
.board-actions .board-action-button small{font-size:10px;font-weight:500;letter-spacing:2px;color:#b6cad8}
.board-actions .board-action-button:enabled:hover{filter:brightness(1.15);box-shadow:inset 0 0 0 5px #101e30,inset 0 0 0 6px #d1b777,0 0 20px #e9be5b44}
.board-actions .board-action-button:focus-visible{outline:3px solid #9aeaff;outline-offset:3px}
.board-actions .board-action-button:disabled{opacity:1;border-color:#62798a;color:#aebdc8;background:radial-gradient(circle at 40% 28%,#2d4051,#172839);box-shadow:inset 0 0 0 5px #101e30,inset 0 0 0 6px #61798a44;cursor:default;font-size:18px}
.board-actions .turn-control p{font-size:11px;line-height:1.6;margin:10px 3px 0;color:#b9cfdd}
.board-action-options{border-top:1px solid #a6c3d433;padding-top:9px;font-size:11px;text-align:left}
.board-action-options summary{cursor:pointer;color:#cbd7de;text-align:center;padding:3px}
.board-action-options .action-availability{margin-top:8px;max-height:145px}
.board-actions .turn-confirm{font-size:11px;text-align:left;max-height:230px}
.board-actions .auto-response-status{font-size:10px;text-align:left;margin:0}
.board-actions .turn-confirm button{min-height:32px}
#stage.input-locked .board-actions{pointer-events:auto}
