/* mtg-kernel live Pauper game table styles. Plain CSS, zero external assets. */

:root {
  --bg: #080d11;
  --bg-elevated: #0e161d;
  --bg-panel: #111a23;
  --line: rgba(140, 178, 170, 0.16);
  --line-strong: rgba(140, 178, 170, 0.28);
  --text: #eef4f6;
  --text-muted: #98abb7;
  --text-dim: #6f8694;

  --accent: #7be8c4;
  --accent-strong: #46d9a7;
  --accent-surface: rgba(123, 232, 196, 0.13);
  --seat-a: #7be8c4;
  --seat-a-bg: rgba(123, 232, 196, 0.14);
  --seat-b: #80c7ff;
  --seat-b-bg: rgba(128, 199, 255, 0.14);

  --danger: #ff767d;
  --danger-bg: rgba(255, 118, 125, 0.2);
  --warn: #f7c366;
  --warn-bg: rgba(247, 195, 102, 0.18);
  --stack-accent: #9ebbff;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;

  --card-w: 84px;
  --land-w: 70px;
  --hand-card-w: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 85% 42% at 50% -8%, rgba(42, 114, 96, 0.25), transparent 64%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: #071913;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus {
  left: 12px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Top bar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 17, 0.88);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid rgba(123, 232, 196, 0.35);
  background: linear-gradient(145deg, rgba(123, 232, 196, 0.16), rgba(14, 22, 29, 0.92));
  color: var(--accent);
  display: grid;
  place-items: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 14.5px;
  letter-spacing: 0.35px;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.top-nav a {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 140ms ease;
}

.top-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Main shell */
.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px 48px;
}

/* Hero Headline */
.hero-header {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hero-title {
  margin: 0;
  font-size: clamp(23px, 2.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.55px;
  line-height: 1.16;
  color: #f4faf8;
}

.hero-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  max-width: 880px;
  line-height: 1.48;
}

/* Compact status chip + match controls */
.match-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.status-chip-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(17, 26, 35, 0.82);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(123, 232, 196, 0.75);
  flex-shrink: 0;
  animation: pulseDot 2.2s ease-in-out infinite;
}

.status-dot.idle {
  background: #87a2ab;
  box-shadow: none;
  animation: none;
}

.status-dot.busy {
  background: var(--warn);
  box-shadow: 0 0 9px rgba(247, 195, 102, 0.75);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 9px rgba(255, 118, 125, 0.75);
  animation: none;
}

.status-dot.mock {
  background: var(--seat-b);
  box-shadow: 0 0 9px rgba(128, 199, 255, 0.7);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.84); }
}

.mode-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(128, 199, 255, 0.35);
  background: rgba(128, 199, 255, 0.12);
  color: #c2e3ff;
}

.mode-pill.live {
  border-color: rgba(123, 232, 196, 0.38);
  background: rgba(123, 232, 196, 0.12);
  color: var(--accent);
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.deck-pickers {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.picker-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 3px 8px 3px 5px;
}

.picker-field select {
  background: transparent;
  border: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  padding: 3px 2px;
  max-width: 152px;
  cursor: pointer;
}

.picker-field select option {
  background: #141e27;
  color: var(--text);
}

.seat-tag,
.seat-badge {
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  border-radius: 5px;
  flex-shrink: 0;
}

.seat-tag {
  width: 20px;
  height: 20px;
  font-size: 11px;
}

.seat-badge {
  width: 26px;
  height: 26px;
  font-size: 12.5px;
  border-radius: 7px;
}

.seat-a {
  background: var(--seat-a-bg);
  color: var(--seat-a);
  border: 1px solid rgba(123, 232, 196, 0.35);
}

.seat-b {
  background: var(--seat-b-bg);
  color: var(--seat-b);
  border: 1px solid rgba(128, 199, 255, 0.35);
}

.vs-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  font-weight: 700;
}

.deal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.toggle-chip input {
  margin: 0;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.toggle-chip:has(input:checked) {
  border-color: rgba(123, 232, 196, 0.45);
  color: var(--text);
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 100ms ease;
  white-space: nowrap;
}

.primary-btn {
  background: var(--accent);
  color: #071913;
}

.primary-btn:hover:not(:disabled) {
  background: #9ef2d5;
}

.primary-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.secondary-btn {
  background: rgba(19, 30, 39, 0.9);
  border-color: var(--line-strong);
  color: var(--text);
}

.secondary-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.ghost-btn {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.ghost-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

/* Main workspace grid */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 355px;
  gap: 16px;
  align-items: start;
}

.board-column {
  min-width: 0;
}

.thinking-column {
  min-width: 0;
  position: sticky;
  top: 12px;
}

.board-stage {
  position: relative;
  border: 1px solid rgba(133, 186, 171, 0.24);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.52),
    0 0 0 1px rgba(123, 232, 196, 0.06) inset;
}

/* Overlays: Tap-to-start gate, Shuffle-and-deal loading, and Error screen */
.stage-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 12, 16, 0.88);
  backdrop-filter: blur(8px);
}

.gate-card,
.loading-card,
.error-card {
  width: 100%;
  max-width: 450px;
  background: linear-gradient(160deg, #15242c, #0d161d);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.6);
}

.error-card {
  border-color: rgba(255, 118, 125, 0.45);
  background: linear-gradient(160deg, #24171c, #11161c);
}

.error-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(255, 118, 125, 0.45);
}

.gate-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.25px;
}

.gate-copy,
.gate-size-note,
.gate-shared-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}

.gate-size-note {
  background: rgba(123, 232, 196, 0.08);
  border: 1px solid rgba(123, 232, 196, 0.25);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
}

.gate-shared-note {
  font-size: 12px;
  color: var(--accent);
}

.gate-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
}

/* Shuffle-and-deal card fan animation */
.shuffle-deck {
  position: relative;
  width: 150px;
  height: 76px;
  margin-bottom: 4px;
}

.deck-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 62px;
  margin-left: -22px;
  margin-top: -31px;
  border-radius: 5px;
  border: 1px solid rgba(123, 232, 196, 0.45);
  background:
    radial-gradient(circle at 50% 42%, rgba(123, 232, 196, 0.3), transparent 58%),
    linear-gradient(145deg, #1b3139, #0e1920);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.5);
}

.deck-card::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(123, 232, 196, 0.24);
  border-radius: 3px;
}

.shuffle-deck .c1 { animation: dealFan1 1.5s ease-in-out infinite; }
.shuffle-deck .c2 { animation: dealFan2 1.5s ease-in-out infinite; }
.shuffle-deck .c3 { animation: dealFan3 1.5s ease-in-out infinite; }
.shuffle-deck .c4 { animation: dealFan4 1.5s ease-in-out infinite; }
.shuffle-deck .c5 { animation: dealFan5 1.5s ease-in-out infinite; }

@keyframes dealFan1 {
  0%, 100% { transform: translate(-26px, 3px) rotate(-16deg); }
  50% { transform: translate(-44px, -6px) rotate(-24deg); }
}
@keyframes dealFan2 {
  0%, 100% { transform: translate(-13px, 1px) rotate(-8deg); }
  50% { transform: translate(-20px, -2px) rotate(-11deg); }
}
@keyframes dealFan3 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(0, -10px) rotate(2deg); }
}
@keyframes dealFan4 {
  0%, 100% { transform: translate(13px, 1px) rotate(8deg); }
  50% { transform: translate(20px, -2px) rotate(11deg); }
}
@keyframes dealFan5 {
  0%, 100% { transform: translate(26px, 3px) rotate(16deg); }
  50% { transform: translate(44px, -6px) rotate(24deg); }
}

.loading-title {
  font-size: 16px;
  color: var(--text);
}

.loading-status {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.loading-bar-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.loading-bar-fill {
  width: 28%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-strong), var(--seat-b));
  transition: width 220ms ease;
}

.batch-dots {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
}

.batch-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.batch-dot.done {
  background: var(--accent-surface);
  border-color: var(--accent);
  color: var(--accent);
}

.batch-dot.active {
  border-color: var(--warn);
  color: var(--warn);
}

/* Felt Game Table Surface */
.tabletop {
  position: relative;
  min-height: 540px;
  padding: 12px 18px;
  background:
    /* Overhead table lamp glow */
    radial-gradient(ellipse 72% 48% at 50% 50%, rgba(44, 114, 92, 0.28) 0%, rgba(21, 56, 48, 0.16) 46%, transparent 80%),
    /* Subtle felt cross-grain texture */
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0px, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.05) 0px, rgba(0, 0, 0, 0.05) 1px, transparent 1px, transparent 5px),
    /* Deep playmat base */
    linear-gradient(180deg, #0d1a20 0%, #0f211e 48%, #0d1e1c 52%, #0c171d 100%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.combat-arrows {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  overflow: visible;
}

.combat-arrows path {
  fill: none;
  stroke: var(--warn);
  stroke-width: 2.6;
  stroke-dasharray: 6 4;
  opacity: 0.94;
  filter: drop-shadow(0 0 6px rgba(247, 195, 102, 0.65));
}

.seat-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Seat header: player HUD + fanned hand side by side on desktop */
.seat-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(8, 15, 20, 0.68);
  border: 1px solid rgba(140, 178, 170, 0.14);
  transition: border-color 180ms ease, box-shadow 180ms ease;
  flex: 1 1 320px;
}

.seat-area.is-active .player-bar {
  border-color: rgba(123, 232, 196, 0.45);
  box-shadow: 0 0 18px rgba(123, 232, 196, 0.14);
}

.seat-top.is-active .player-bar {
  border-color: rgba(128, 199, 255, 0.48);
  box-shadow: 0 0 18px rgba(128, 199, 255, 0.14);
}

.player-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-labels {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.player-title-row strong {
  font-size: 13px;
  line-height: 1.15;
}

.deck-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.first-badge,
.turn-badge,
.poison-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.first-badge {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

.turn-badge {
  background: var(--accent-surface);
  color: var(--accent);
}

.seat-top .turn-badge {
  background: var(--seat-b-bg);
  color: var(--seat-b);
}

.poison-pill {
  background: rgba(176, 148, 255, 0.2);
  color: #ddd0ff;
}

.player-counters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pile-stat,
.pile-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.pile-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pile-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--text-dim);
}

.life-box {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(6, 11, 15, 0.85);
  border: 1px solid rgba(140, 178, 170, 0.28);
  min-width: 64px;
  justify-content: flex-end;
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.life-box.pulse-loss {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 118, 125, 0.26), 0 0 22px rgba(255, 118, 125, 0.45);
}

.life-box.pulse-gain {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(123, 232, 196, 0.26), 0 0 22px rgba(123, 232, 196, 0.45);
}

.life-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--text-dim);
}

.life-value {
  font-size: 23px;
  line-height: 1.05;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: color 240ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.life-value.life-loss {
  color: var(--danger);
  transform: scale(1.25);
}

.life-value.life-gain {
  color: var(--accent);
  transform: scale(1.25);
}

.life-delta {
  position: absolute;
  right: 8px;
  top: -18px;
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  z-index: 20;
}

.life-delta.show-loss {
  color: #ff8a90;
  animation: floatDelta 1.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.life-delta.show-gain {
  color: #93f5d4;
  animation: floatDelta 1.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.life-delta.is-massive {
  font-size: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(185, 24, 38, 0.92);
  color: #fff3f4;
  border: 1px solid rgba(255, 165, 170, 0.7);
  box-shadow: 0 8px 26px rgba(255, 64, 78, 0.55);
  animation: floatMassiveDelta 1.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes floatMassiveDelta {
  0% { opacity: 0; transform: translateY(10px) scale(0.5); }
  18% { opacity: 1; transform: translateY(-6px) scale(1.28); }
  72% { opacity: 1; transform: translateY(-22px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-38px) scale(0.95); }
}

.tabletop.impact-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 86, 98, 0.24), rgba(180, 20, 34, 0.36));
  animation: impactVignette 850ms ease-out forwards;
}

@keyframes impactVignette {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}

/* Library-to-graveyard mill burst particles */
.mill-card-particle {
  position: absolute;
  width: 22px;
  height: 31px;
  border-radius: 3px;
  border: 1px solid rgba(123, 232, 196, 0.65);
  background: linear-gradient(145deg, #213c43, #0f1a20);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 24;
}

.mill-count-float {
  position: absolute;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(20, 42, 46, 0.94);
  border: 1px solid rgba(123, 232, 196, 0.65);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 25;
  animation: floatDelta 1.3s ease-out forwards;
}

.pile-btn.pulse-mill {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(123, 232, 196, 0.32), 0 0 18px rgba(123, 232, 196, 0.45);
}

@keyframes floatDelta {
  0% { opacity: 0; transform: translateY(8px) scale(0.85); }
  16% { opacity: 1; transform: translateY(-2px) scale(1.22); }
  72% { opacity: 1; transform: translateY(-14px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-24px) scale(0.92); }
}

/* Fanned Hand Tray (no heavy borders, sits gracefully on the table edge) */
.hand-tray {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.zone-micro-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.85px;
  color: rgba(169, 201, 193, 0.56);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.zone-micro-label strong {
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-left: 2px;
}

.hand-fan {
  display: flex;
  align-items: flex-end;
  padding: 6px 10px 4px 12px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

.hand-fan::-webkit-scrollbar {
  display: none;
}

.hand-fan .card-item {
  flex: 0 0 var(--hand-card-w);
  width: var(--hand-card-w);
  margin-left: -10px;
  transform: translateY(var(--fan-y, 0px)) rotate(var(--fan-rot, 0deg));
  transform-origin: center bottom;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), z-index 0s;
}

.hand-fan .card-item:first-child {
  margin-left: 0;
}

.hand-fan .card-item:hover,
.hand-fan .card-item:focus-visible {
  transform: translateY(-10px) rotate(0deg) scale(1.22);
  z-index: 14;
}

.hand-fan .card-meta-bar {
  display: none;
}

/* Open Battlefield Half: cards rest directly on felt without boxes */
.battlefield-half {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
  justify-content: center;
  padding: 2px 0;
}

.bf-backrow {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 24px;
}

.bf-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bf-frontline {
  width: 100%;
  min-height: 106px;
}

.card-rail {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
  padding: 8px 6px;
}

.creatures-rail {
  padding: 16px 8px;
  gap: 12px;
}

.lands-rail {
  gap: 14px;
  padding: 6px 8px 8px;
}

/* Card items: strict 488:680 Scryfall frame, ZERO overlays over bottom artist/copyright */
.card-item {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), filter 180ms ease;
  transform-origin: center center;
}

.lands-rail .card-item {
  flex-basis: var(--land-w);
  width: var(--land-w);
}

.card-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 488 / 680;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #131f27;
  overflow: hidden;
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.56);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.card-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-item:hover .card-frame,
.card-item:focus-visible .card-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(123, 232, 196, 0.38), 0 12px 24px rgba(0, 0, 0, 0.65);
}

.card-item.is-highlighted .card-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(123, 232, 196, 0.72), 0 0 24px rgba(123, 232, 196, 0.4);
}

/* Compact stacked identical lands with physical card-layer depth */
.card-item.is-land-stack {
  margin-right: 6px;
}

.card-item.is-land-stack .card-stack-wrap {
  position: relative;
  width: 100%;
}

.card-item.stack-depth-2 .card-stack-wrap::before,
.card-item.stack-depth-3 .card-stack-wrap::before,
.card-item.stack-depth-3 .card-stack-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(145deg, #1b2d34, #0f1a20);
  border: 1px solid rgba(160, 196, 186, 0.28);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.card-item.stack-depth-2 .card-stack-wrap::before {
  transform: translate(5px, 4px);
  z-index: 0;
}

.card-item.stack-depth-3 .card-stack-wrap::before {
  transform: translate(4px, 3px);
  z-index: 1;
}

.card-item.stack-depth-3 .card-stack-wrap::after {
  transform: translate(8px, 6px);
  z-index: 0;
}

.card-item.is-land-stack .card-frame {
  position: relative;
  z-index: 2;
}

/* Tapped, Attacking, and Blocking motion */
.card-item.is-tapped {
  transform: rotate(11deg) translateY(2px);
  margin-right: 6px;
}

.card-item.is-tapped .card-frame {
  filter: saturate(0.76) brightness(0.84);
}

.card-item.is-attacking {
  z-index: 6;
}

.seat-bottom .card-item.is-attacking {
  transform: translateY(-16px) rotate(6deg) scale(1.04);
}

.seat-top .card-item.is-attacking {
  transform: translateY(16px) rotate(6deg) scale(1.04);
}

.card-item.is-attacking .card-frame {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(255, 118, 125, 0.65), 0 12px 28px rgba(255, 86, 96, 0.35);
}

.card-item.is-blocking {
  z-index: 6;
}

.seat-bottom .card-item.is-blocking {
  transform: translateY(-12px) scale(1.03);
}

.seat-top .card-item.is-blocking {
  transform: translateY(12px) scale(1.03);
}

.card-item.is-blocking .card-frame {
  border-color: var(--warn);
  box-shadow: 0 0 0 2px rgba(247, 195, 102, 0.65), 0 10px 24px rgba(247, 195, 102, 0.3);
}

.card-item.is-sick .card-frame {
  border-style: dashed;
  border-color: rgba(162, 192, 204, 0.4);
}

/* Floating creature damage burst */
.creature-dmg-float {
  position: absolute;
  top: -12px;
  right: -6px;
  z-index: 12;
  padding: 2px 6px;
  border-radius: 999px;
  background: #c8222e;
  color: #fff3f4;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: floatDelta 1.15s ease-out forwards;
}

/* Status pills sit ONLY along top edge or below frame, never obscuring Scryfall bottom copyright */
.card-top-badges {
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px;
  pointer-events: none;
  z-index: 4;
}

.badge-pip {
  font-size: 9px;
  font-weight: 700;
  line-height: 1.1;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.72);
}

.pip-atk { background: #c22530; color: #fff1f2; }
.pip-blk { background: #9d6812; color: #fff7e3; }
.pip-tap { background: rgba(9, 17, 22, 0.88); color: #d0e8de; border: 1px solid rgba(123, 232, 196, 0.35); }
.pip-dmg { background: #b51f2a; color: #ffe6e8; }
.pip-cnt { background: #224b64; color: #e0f3ff; }
.pip-stack { background: #0d2722; color: var(--accent); border: 1px solid rgba(123, 232, 196, 0.55); font-family: var(--font-mono); font-size: 10px; }
.pip-sick { background: rgba(12, 20, 27, 0.86); color: #a8becb; }

/* Slim metadata bar outside & below the card image */
.card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  font-size: 10px;
  line-height: 1.15;
  color: rgba(215, 232, 236, 0.84);
  min-height: 14px;
}

.card-meta-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
}

.card-pt-pill {
  flex-shrink: 0;
  background: rgba(14, 24, 31, 0.92);
  border: 1px solid rgba(140, 178, 170, 0.38);
  color: #f0f8fa;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
}

/* Text-card fallback when image is missing or fails to load */
.text-card-fallback {
  width: 100%;
  height: 100%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: linear-gradient(155deg, #21343c, #121c24);
  color: var(--text);
}

.text-card-fallback.is-token {
  background: linear-gradient(155deg, #2e2a3d, #161824);
}

.text-card-fallback.is-facedown {
  background:
    radial-gradient(circle at 50% 45%, rgba(123, 232, 196, 0.22), transparent 60%),
    linear-gradient(155deg, #1a2d36, #0d171d);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.text-card-head {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
}

.text-card-type {
  font-size: 8px;
  color: var(--accent);
}

.text-card-rules {
  font-size: 8px;
  line-height: 1.28;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.text-card-pt {
  margin-top: auto;
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.14);
}

/* Center combat divider: Turn, Phase, Action Caption, and Stack */
.center-strip {
  margin: 6px -18px;
  padding: 8px 18px;
  border-top: 1px solid rgba(123, 232, 196, 0.16);
  border-bottom: 1px solid rgba(123, 232, 196, 0.16);
  background: linear-gradient(90deg, rgba(6, 12, 17, 0.72), rgba(11, 24, 24, 0.82), rgba(6, 12, 17, 0.72));
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.turn-caption-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.turn-phase-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.turn-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-surface);
  color: var(--accent);
  border: 1px solid rgba(123, 232, 196, 0.35);
}

.phase-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.action-caption {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #f3faf7;
  flex: 1 1 220px;
  min-width: 0;
}

.show-result-chip {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(123, 232, 196, 0.45);
  background: var(--accent-surface);
  color: var(--accent);
}

.stack-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(158, 187, 255, 0.12);
  border-left: 3px solid var(--stack-accent);
}

.stack-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  font-weight: 700;
  color: var(--stack-accent);
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.stack-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: rgba(10, 18, 28, 0.92);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 500;
}

.stack-chip.seat-0 { border-left: 3px solid var(--seat-a); }
.stack-chip.seat-1 { border-left: 3px solid var(--seat-b); }

/* Dramatic Game-Over Winner Banner */
.game-over-banner {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(ellipse at 50% 45%, rgba(16, 46, 38, 0.65), rgba(6, 11, 16, 0.82));
  backdrop-filter: blur(5px);
  animation: fadeBannerIn 280ms ease-out;
}

@keyframes fadeBannerIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.game-over-inner {
  width: 100%;
  max-width: 520px;
  background: linear-gradient(165deg, rgba(17, 36, 34, 0.98), rgba(11, 18, 25, 0.98));
  border: 1px solid rgba(123, 232, 196, 0.55);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.72),
    0 0 40px rgba(123, 232, 196, 0.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.game-over-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  font-weight: 700;
}

.game-over-headline {
  font-size: clamp(21px, 2.2vw, 27px);
  line-height: 1.18;
  letter-spacing: -0.4px;
  color: #f5fcf9;
}

.game-over-detail {
  margin: 0;
  font-size: 13.5px;
  color: #bfd1da;
  line-height: 1.5;
}

.game-over-primary-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  width: 100%;
}

.banner-deal-btn {
  padding: 10px 22px;
  font-size: 14px;
}

.banner-share {
  width: 100%;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.banner-share-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

.banner-share .share-input-row {
  flex: 0 0 auto;
  width: 100%;
}

/* Playback & Timeline */
.transport-bar {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: rgba(13, 21, 29, 0.96);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.transport-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.transport-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  transition: border-color 140ms ease, color 140ms ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #071913;
  display: inline-grid;
  place-items: center;
  transition: background 140ms ease, transform 100ms ease;
}

.play-btn:hover:not(:disabled) {
  background: #a0f3d7;
}

.speed-group {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(7, 12, 17, 0.65);
}

.speed-btn {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.speed-btn.active {
  background: var(--accent-surface);
  color: var(--accent);
}

.step-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.frame-counter {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}

.kbd-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.timeline-wrap {
  position: relative;
  padding: 12px 0 5px;
}

.timeline-slider {
  width: 100%;
  margin: 0;
  height: 6px;
  appearance: none;
  background: #243542;
  border-radius: 999px;
  cursor: pointer;
  accent-color: var(--accent);
  display: block;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #081512;
  box-shadow: 0 0 8px rgba(123, 232, 196, 0.65);
}

.timeline-markers {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 0;
  height: 12px;
  pointer-events: none;
}

.marker-pip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #0a1016;
  pointer-events: auto;
  transition: transform 120ms ease;
}

.marker-pip:hover {
  transform: translateX(-50%) scale(1.45);
  z-index: 4;
}

.marker-pip.swing { background: var(--danger); }
.marker-pip.combo { background: var(--warn); }
.marker-pip.finish { background: var(--accent); border-radius: 2px; transform: translateX(-50%) rotate(45deg); }

.marker-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-swing { background: var(--danger); }
.dot-combo { background: var(--warn); }
.dot-finish { background: var(--accent); border-radius: 2px; transform: rotate(45deg); }

.legend-note {
  margin-left: auto;
}

/* Provenance & Share Bar */
.provenance-bar {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: rgba(9, 15, 21, 0.95);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proof-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.proof-facts dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--text-dim);
}

.proof-facts dd {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.share-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.share-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 250px;
  min-width: 0;
}

.share-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  background: #080e14;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  color: var(--accent);
}

.copy-status {
  font-size: 11.5px;
  color: var(--accent);
}

/* Signature Thinking Panel */
.thinking-panel {
  border: 1px solid rgba(123, 232, 196, 0.28);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(175deg, rgba(22, 46, 42, 0.45), rgba(14, 21, 29, 0.97) 38%),
    var(--bg-panel);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.44);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.thinking-panel.is-evaluating {
  border-color: rgba(247, 195, 102, 0.52);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.44), 0 0 22px rgba(247, 195, 102, 0.12);
}

.thinking-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 11px;
}

.thinking-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thinking-eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--accent);
}

.confidence-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--line-strong);
}

.confidence-pill.high {
  background: var(--accent-surface);
  color: var(--accent);
  border-color: rgba(123, 232, 196, 0.42);
}

.confidence-pill.close {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: rgba(247, 195, 102, 0.42);
}

.confidence-pill.thinking {
  background: rgba(247, 195, 102, 0.16);
  color: var(--warn);
  border-color: rgba(247, 195, 102, 0.5);
}

.thinking-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.24;
  letter-spacing: -0.25px;
}

.thinking-actor-line {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.chosen-callout {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(123, 232, 196, 0.09);
  border: 1px solid rgba(123, 232, 196, 0.32);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background 180ms ease, border-color 180ms ease;
}

.chosen-callout.seat-1 {
  background: rgba(128, 199, 255, 0.09);
  border-color: rgba(128, 199, 255, 0.35);
}

.chosen-callout.is-evaluating {
  background: rgba(247, 195, 102, 0.08);
  border-color: rgba(247, 195, 102, 0.35);
}

.chosen-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.85px;
  color: var(--text-muted);
  font-weight: 700;
}

.chosen-label {
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--text);
}

.candidates-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.candidate-row {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(9, 15, 21, 0.72);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 220ms ease;
}

.candidate-row:hover {
  border-color: var(--line-strong);
}

.candidate-row.is-chosen {
  border-color: rgba(123, 232, 196, 0.65);
  background: rgba(19, 44, 39, 0.74);
  box-shadow: 0 0 0 1px rgba(123, 232, 196, 0.22), 0 0 18px rgba(123, 232, 196, 0.16);
}

.candidate-row.is-chosen.seat-1 {
  border-color: rgba(128, 199, 255, 0.65);
  background: rgba(19, 36, 54, 0.74);
  box-shadow: 0 0 0 1px rgba(128, 199, 255, 0.22), 0 0 18px rgba(128, 199, 255, 0.16);
}

.candidate-row.just-chosen {
  animation: chosenGlow 420ms ease-out;
}

@keyframes chosenGlow {
  0% { transform: scale(1.02); box-shadow: 0 0 0 3px rgba(123, 232, 196, 0.5), 0 0 26px rgba(123, 232, 196, 0.42); }
  100% { transform: scale(1); }
}

.candidate-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.candidate-left {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
}

.candidate-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  min-width: 14px;
  padding-top: 1px;
}

.candidate-name {
  font-size: 12.5px;
  line-height: 1.35;
  color: #c8d7e1;
  overflow-wrap: anywhere;
}

.candidate-row.is-chosen .candidate-name {
  color: #f4fcf8;
  font-weight: 600;
}

.candidate-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.chosen-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent);
  color: #071913;
}

.candidate-row.is-chosen.seat-1 .chosen-tag {
  background: var(--seat-b);
  color: #071624;
}

.candidate-pct {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 44px;
  text-align: right;
}

.candidate-row.is-chosen .candidate-pct {
  color: var(--accent);
}

.candidate-row.is-chosen.seat-1 .candidate-pct {
  color: var(--seat-b);
}

.prob-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: 999px;
  background: #537180;
  transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease;
}

.thinking-panel.is-evaluating .prob-fill {
  background: linear-gradient(90deg, #5d8393, #8bb9c4);
}

.candidate-row.is-chosen .prob-fill {
  background: linear-gradient(90deg, #43d6a3, #9af4d7);
  box-shadow: 0 0 10px rgba(123, 232, 196, 0.5);
}

.candidate-row.is-chosen.seat-1 .prob-fill {
  background: linear-gradient(90deg, #4ca6f7, #9ed5ff);
  box-shadow: 0 0 10px rgba(128, 199, 255, 0.5);
}

.candidate-row.is-outside-top5 {
  border-style: dashed;
}

.candidate-outside-note {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.forced-note {
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--line-strong);
  font-size: 12px;
  color: var(--text-muted);
}

.forced-note strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.forced-note p {
  margin: 0;
  line-height: 1.5;
}

/* Best-of-5 batch tray */
.batch-summary {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-summary-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.batch-summary-head strong {
  font-size: 12px;
  color: var(--text);
}

.batch-reason {
  font-size: 11.5px;
  color: var(--text-muted);
}

.batch-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.batch-pill {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(9, 15, 21, 0.72);
  padding: 5px 3px;
  font-size: 10.5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}

.batch-pill strong {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.batch-pill.is-selected {
  border-color: var(--accent);
  background: var(--accent-surface);
  color: var(--accent);
}

.batch-pill.is-selected strong {
  color: var(--accent);
}

.thinking-footnote {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Below the board: Pitch & 3 proof points */
.pitch-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.pitch-intro {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 700;
}

.pitch-intro h2 {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 29px);
  line-height: 1.2;
  letter-spacing: -0.4px;
}

.pitch-intro p {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.65;
}

.pitch-intro code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.proof-card {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.proof-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}

.proof-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.proof-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1 1 auto;
}

.proof-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 8, 12, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow: auto;
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-body {
  padding-top: 14px;
}

.card-detail-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.card-detail-image {
  width: 100%;
  aspect-ratio: 488 / 680;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #0b1117;
}

.card-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-detail-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.card-detail-info .detail-type {
  color: var(--accent);
  font-weight: 600;
}

.card-detail-info .detail-text {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
  white-space: pre-line;
}

.pile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(7, 12, 16, 0.92);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-notice {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-meta a {
  color: var(--text-muted);
}

/* Responsive breakpoints */
@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .thinking-column {
    position: static;
  }

  .proof-grid {
    grid-template-columns: 1fr;
  }

  .proof-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --card-w: 62px;
    --land-w: 54px;
    --hand-card-w: 44px;
  }

  .topbar-inner {
    padding: 9px 10px;
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-text strong {
    font-size: 13.5px;
  }

  .brand-text span {
    display: none;
  }

  .top-nav {
    gap: 9px;
  }

  .top-nav a {
    font-size: 11px;
    white-space: nowrap;
  }

  .page-shell {
    padding: 12px 10px 36px;
  }

  .hero-header {
    margin-bottom: 10px;
  }

  .hero-title {
    font-size: 21px;
    line-height: 1.18;
  }

  .hero-subtitle {
    font-size: 12.5px;
  }

  .status-chip {
    font-size: 11.5px;
    padding: 5px 10px;
    border-radius: 12px;
    align-items: flex-start;
  }

  .status-chip .status-dot {
    margin-top: 4px;
  }

  .controls-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .deck-pickers {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
  }

  .picker-field {
    width: 100%;
    min-width: 0;
    padding: 3px 6px;
  }

  .picker-field select {
    width: 100%;
    max-width: none;
    min-width: 0;
    font-size: 12px;
  }

  .deal-actions {
    width: 100%;
  }

  .deal-actions .primary-btn {
    flex: 1 1 auto;
  }

  .stage-overlay {
    align-items: flex-start;
    padding: 14px;
  }

  .gate-card,
  .loading-card,
  .error-card {
    padding: 18px 16px;
    gap: 10px;
  }

  .tabletop {
    min-height: 420px;
    padding: 8px 10px;
  }

  .center-strip {
    margin: 6px -10px;
    padding: 7px 10px;
  }

  .seat-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .player-bar {
    flex: 0 1 auto;
    border-radius: var(--radius-md);
    flex-wrap: wrap;
    padding: 7px 8px;
    gap: 6px;
  }

  .player-counters {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .pile-stat,
  .pile-btn {
    padding: 3px 6px;
    font-size: 11px;
  }

  .life-box {
    min-width: 56px;
    padding: 2px 8px;
  }

  .life-value {
    font-size: 20px;
  }

  .hand-tray {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .hand-fan {
    width: 100%;
    padding: 4px 6px;
  }

  .hand-fan .card-item {
    margin-left: -6px;
  }

  .battlefield-half {
    min-height: 76px;
  }

  .bf-frontline {
    min-height: 86px;
  }

  .bf-backrow {
    gap: 4px;
  }

  .bf-group {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .card-rail {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 7px;
    padding: 12px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 178, 170, 0.3) transparent;
  }

  .creatures-rail {
    padding: 14px 6px;
  }

  .lands-rail {
    gap: 10px;
  }

  .game-over-banner {
    align-items: flex-start;
    padding: 12px;
  }

  .game-over-inner {
    padding: 16px 14px;
  }

  .transport-bar,
  .provenance-bar {
    padding: 10px;
  }

  .step-meta {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .kbd-hint {
    display: none;
  }

  .legend-note {
    margin-left: 0;
    width: 100%;
  }

  .proof-facts {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .share-input-row {
    width: 100%;
  }

  .thinking-panel {
    padding: 14px;
  }

  .card-detail-layout {
    grid-template-columns: 1fr;
  }

  .card-detail-image {
    max-width: 240px;
    margin: 0 auto;
  }

  .footer-inner {
    padding: 18px 12px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .hand-fan .card-item {
    transform: none !important;
  }
}
