:root {
  color-scheme: dark;
  --ink: #f1efe5;
  --muted: #9ca39d;
  --night: #090c10;
  --panel: #151a22;
  --line: rgba(255,255,255,.11);
  --gold: #d4a34e;
  --gold-bright: #f1ce7c;
  --red: #d75850;
  --green: #68b487;
  --card: #e9e4d8;
  --card-ink: #1a1e23;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(125,86,39,.2), transparent 34rem),
    linear-gradient(140deg, #10151c, #080b0f 62%, #121820);
}

button { font: inherit; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.025em; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.75rem); }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
}

.game-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 12px auto 28px;
}

.topbar, .run-map, .enemy-panel, .battle-table, .player-panel {
  border: 1px solid var(--line);
  background: rgba(20,25,33,.9);
  box-shadow: 0 18px 55px rgba(0,0,0,.23);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-radius: 18px 18px 0 0;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  aspect-ratio: 1;
  border: 1px solid rgba(212,163,78,.55);
  color: var(--gold-bright);
  background: #1c1812;
  transform: rotate(45deg);
  font-family: Georgia, serif;
  font-weight: 900;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--gold);
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.run-status { display: flex; gap: 24px; }
.run-status div { display: grid; text-align: right; }
.run-status span, .name-row strong {
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.run-map {
  display: grid;
  grid-template-columns: minmax(120px, .45fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 10px 0;
  padding: 12px 18px;
  border-radius: 18px;
}

.screen-map .run-map {
  min-height: min(680px, calc(100vh - 116px));
  grid-template-columns: 1fr;
  align-content: center;
  gap: 34px;
  padding: clamp(24px, 5vw, 56px);
}

.screen-map .enemy-panel,
.screen-map .battle-table,
.screen-map .player-panel {
  display: none;
}

.screen-battle .run-map {
  display: none;
}

.screen-map .map-title-row {
  text-align: center;
}

.map-title-row strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.screen-map .map-title-row strong {
  font-size: clamp(2rem, 5vw, 4.4rem);
}

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

.screen-map .map-path {
  width: min(920px, 100%);
  margin: 0 auto;
  gap: clamp(20px, 5vw, 56px);
}

.map-step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.map-step:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 22px;
  left: calc(50% + 24px);
  width: calc(100% - 12px);
  height: 2px;
  background: rgba(255,255,255,.18);
}

.map-node {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid rgba(212,163,78,.45);
  border-radius: 50%;
  color: var(--gold-bright);
  background: #0b0e13;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  font-weight: 900;
  cursor: pointer;
}

.map-node:disabled {
  cursor: not-allowed;
}

.screen-map .map-node {
  width: clamp(68px, 11vw, 112px);
  font-size: clamp(1.4rem, 3vw, 2.4rem);
}

.map-step.current .map-node {
  border-color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(241,206,124,.32), 0 4px 0 rgba(0,0,0,.35);
}

.screen-map .map-step.current .map-node {
  animation: mapCurrentPulse 1200ms ease-in-out infinite;
}

.map-step.complete .map-node {
  color: #061016;
  background: var(--gold-bright);
}

.map-step.locked {
  opacity: .54;
}

.map-step strong,
.map-step em {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-step strong {
  color: var(--ink);
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-step em {
  color: var(--muted);
  font-size: .7rem;
  font-style: normal;
}

.screen-map .map-step strong {
  font-size: clamp(.78rem, 1.6vw, 1rem);
}

.screen-map .map-step em {
  font-size: clamp(.78rem, 1.5vw, .95rem);
}

.enemy-panel, .player-panel {
  display: grid;
  grid-template-columns: 84px minmax(200px, 1fr) minmax(260px, 1.3fr);
  align-items: center;
  gap: 18px;
  padding: 14px 20px;
  border-top: 0;
}

.enemy-panel { background: linear-gradient(90deg, rgba(117,33,31,.14), rgba(20,25,33,.93) 42%); }
.player-panel { background: linear-gradient(90deg, rgba(20,25,33,.93) 58%, rgba(43,104,75,.12)); }

.enemy-avatar, .player-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 70px;
  height: 75px;
  clip-path: polygon(16% 0,84% 0,100% 26%,87% 100%,13% 100%,0 26%);
  background: linear-gradient(#33343a,#090b0e);
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.5));
}

.enemy-avatar i {
  width: 9px; height: 4px; border-radius: 50%;
  background: #ff7664; box-shadow: 0 0 10px #f44;
}

.player-avatar {
  clip-path: none;
  border: 1px solid rgba(212,163,78,.34);
  border-radius: 50% 50% 38% 38%;
  color: var(--gold-bright);
  font-family: Georgia, serif;
  font-size: 3rem;
  transform: rotate(38deg);
}

.player-avatar {
  cursor: help;
}

.player-avatar::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 18;
  left: 50%;
  bottom: calc(100% + 12px);
  width: max-content;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--gold-bright);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(5, 8, 11, .96);
  box-shadow: 0 12px 26px rgba(0,0,0,.38);
  font-size: .7rem;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translate(-50%, 4px) rotate(-38deg);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre;
}

.player-avatar::before {
  content: "";
  position: absolute;
  z-index: 19;
  left: 50%;
  bottom: calc(100% + 6px);
  width: 10px;
  aspect-ratio: 1;
  border-right: 1px solid var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  background: rgba(5, 8, 11, .96);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity 120ms ease;
}

.player-avatar:hover::after,
.player-avatar:focus-visible::after,
.player-avatar:hover::before,
.player-avatar:focus-visible::before {
  opacity: 1;
}

.player-avatar:hover::after,
.player-avatar:focus-visible::after {
  transform: translate(-50%, 0) rotate(-38deg);
}

.fighter-info { min-width: 0; }
.name-row { display: flex; align-items: baseline; gap: 10px; }
.name-row h2 { margin-right: auto; }
.meter {
  height: 8px; margin-top: 8px; overflow: hidden; border-radius: 99px;
  background: #07090c; box-shadow: inset 0 1px 4px #000;
}
.meter span {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg,#4b9870,#76c495); transition: width 300ms ease;
}
.enemy-meter span { background: linear-gradient(90deg,#9d3732,#dc675d); }
.meter span.health-hit { animation: healthHit 360ms ease; }

.equipment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 24px;
  margin-top: 8px;
}

.equipment-chip,
.equipment-empty {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(212,163,78,.35);
  border-radius: 6px;
  color: var(--gold-bright);
  background: rgba(5,8,11,.35);
  font-size: .62rem;
  font-weight: 800;
}

.equipment-chip {
  position: relative;
  cursor: help;
}

.equipment-chip::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--gold-bright);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(5, 8, 11, .96);
  box-shadow: 0 12px 26px rgba(0,0,0,.38);
  font-size: .68rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translate(-50%, 4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.equipment-chip::before {
  content: "";
  position: absolute;
  z-index: 13;
  left: 50%;
  bottom: calc(100% + 4px);
  width: 10px;
  aspect-ratio: 1;
  border-right: 1px solid var(--gold-bright);
  border-bottom: 1px solid var(--gold-bright);
  background: rgba(5, 8, 11, .96);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity 120ms ease;
}

.equipment-chip:hover::after,
.equipment-chip:focus-visible::after,
.equipment-chip:hover::before,
.equipment-chip:focus-visible::before {
  opacity: 1;
}

.equipment-chip:hover::after,
.equipment-chip:focus-visible::after {
  transform: translate(-50%, 0);
}

.equipment-empty {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.enemy-hand { display: flex; justify-content: flex-end; gap: 7px; }
.card-back {
  width: 48px; aspect-ratio: .72; border: 2px solid #b58b43; border-radius: 6px;
  background:
    linear-gradient(45deg, transparent 45%, rgba(240,202,116,.2) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(240,202,116,.13) 46% 54%, transparent 55%),
    #24202b;
  background-size: 12px 12px;
  box-shadow: 0 4px 0 #0b0c0f;
}

.battle-table {
  display: grid;
  grid-template-columns: minmax(410px, 2fr) minmax(170px, .8fr);
  gap: 20px;
  padding: 22px;
  border-top: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(49,105,75,.18), transparent 36rem),
    linear-gradient(rgba(255,255,255,.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.016) 1px, transparent 1px),
    #10151b;
  background-size: auto, 26px 26px, 26px 26px;
}

.battle-log {
  align-self: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(5,8,11,.33);
}

.pass-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(241,206,124,.55);
  border-radius: 8px;
  color: var(--gold-bright);
  background: rgba(5, 8, 11, .38);
  cursor: pointer;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pass-button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.board-wrap { position: relative; width: min(100%, 400px); margin: auto; }
.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(212,163,78,.28);
  border-radius: 14px;
  background: rgba(4,8,7,.45);
  box-shadow: inset 0 0 50px rgba(0,0,0,.4), 0 20px 50px rgba(0,0,0,.2);
}

.board-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: .76;
  padding: 0;
  border: 1px dashed rgba(212,163,78,.28);
  border-radius: 7px;
  background: rgba(212,163,78,.035);
}
.board-cell.drag-over {
  border-color: var(--gold-bright);
  background: rgba(212,163,78,.12);
  box-shadow: inset 0 0 15px rgba(212,163,78,.11);
}
.board-cell.drag-over {
  border-style: solid;
  box-shadow: inset 0 0 20px rgba(212,163,78,.2), 0 0 14px rgba(212,163,78,.35);
}
.board-cell.center-cell { border-color: rgba(101,163,125,.17); background: rgba(101,163,125,.035); }
.board-cell.scored { animation: scorePulse 900ms ease; }
.board-cell.pending-card { cursor: grab; touch-action: none; }
.board-cell.pending-card:hover { filter: brightness(1.06); }
.board-cell.pending-card.dragging { opacity: .42; cursor: grabbing; }

.playing-card {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 6px;
  color: var(--card-ink);
  background: radial-gradient(circle at 50% 42%,#fff,transparent 60%),var(--card);
  box-shadow: 0 4px 0 #a39c90, 0 7px 14px rgba(0,0,0,.25);
}
.playing-card.red { color: #a92f36; }
.playing-card .rank {
  position: absolute; top: 7px; left: 8px;
  font-family: Georgia,serif; font-size: clamp(.9rem,2vw,1.35rem); font-weight: 900;
}
.playing-card .suit {
  position: absolute; inset: 50% auto auto 50%;
  font-size: clamp(1.3rem,3.4vw,2.35rem); transform: translate(-50%,-43%);
}
.playing-card.owner-player { box-shadow: inset 0 0 0 3px rgba(84,154,112,.55), 0 4px 0 #8e998f; }
.board-cell.pending-card .playing-card {
  box-shadow:
    inset 0 0 0 3px rgba(241,206,124,.72),
    0 0 0 2px rgba(241,206,124,.18),
    0 4px 0 #8e7b55,
    0 0 16px rgba(241,206,124,.24);
}
.playing-card.owner-enemy { box-shadow: inset 0 0 0 3px rgba(195,73,65,.5), 0 4px 0 #9f8f89; }

.board-turn-banner {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: max-content;
  max-width: 82%;
  padding: 10px 22px;
  border: 1px solid rgba(241,206,124,.62);
  border-radius: 8px;
  color: var(--gold-bright);
  background: rgba(7,12,18,.86);
  box-shadow: 0 16px 38px rgba(0,0,0,.42), inset 0 0 22px rgba(241,206,124,.08);
  font-family: "Courier New", monospace;
  font-size: .9rem;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%,-50%) scale(.96);
  transition: opacity 180ms ease, transform 180ms ease;
}

.board-turn-banner.show {
  opacity: 1;
  transform: translate(-50%,-50%) scale(1);
}

.hand-callout {
  position: absolute; z-index: 5; left: 50%; top: 50%;
  width: max-content; max-width: 90%; padding: 10px 18px;
  border: 1px solid rgba(241,206,124,.55); border-radius: 8px;
  color: #1b160d; background: var(--gold-bright);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  font-family: Georgia,serif; font-size: 1.2rem; font-weight: 900;
  opacity: 0; pointer-events: none; transform: translate(-50%,-20%);
  transition: 180ms ease;
}
.hand-callout.show { opacity: 1; transform: translate(-50%,-50%); }

.battle-log { min-height: 145px; }
#battle-log { display: grid; gap: 8px; }
.log-entry {
  padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--muted); font-size: .74rem; line-height: 1.4;
}
.log-entry strong { color: #dddcd5; }

.player-hand-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.player-hand {
  display: flex;
  gap: 8px;
  padding: 7px;
  border: 1px dashed transparent;
  border-radius: 10px;
  transition: border-color 120ms ease, background 120ms ease;
}
.player-hand.drag-over {
  border-color: var(--gold-bright);
  background: rgba(212,163,78,.12);
}
.player-hand.choosing-holds {
  border-color: rgba(241,206,124,.55);
  background: rgba(241,206,124,.08);
}
.hand-card {
  position: relative; width: 64px; aspect-ratio: .72; padding: 0;
  border: 0; border-radius: 7px; cursor: grab; touch-action: none;
  transition: transform 130ms ease, filter 130ms ease;
}
.hand-card:hover:not(:disabled) { transform: translateY(-5px); filter: drop-shadow(0 0 6px rgba(241,206,124,.3)); }
.hand-card.dragging { opacity: .42; cursor: grabbing; }
.hand-card:disabled { cursor: not-allowed; }
.hand-card.deployed {
  cursor: pointer;
  filter: saturate(.25) brightness(.5);
  transform: translateY(5px) scale(.95);
  opacity: .72;
}
.hand-card.deployed:hover {
  filter: saturate(.45) brightness(.72);
}
.hand-card.deployed .playing-card {
  box-shadow: inset 0 0 0 2px rgba(241,206,124,.65), 0 3px 0 #716b60;
}
.hand-card.hold-card {
  cursor: pointer;
}
.hand-card.hold-selected {
  transform: translateY(-7px);
  filter: drop-shadow(0 0 10px rgba(241,206,124,.28));
}
.hand-card.hold-selected .playing-card {
  box-shadow:
    inset 0 0 0 3px rgba(241,206,124,.78),
    0 4px 0 #8e7b55,
    0 0 18px rgba(241,206,124,.22);
}
.hand-card.redraw-selected {
  opacity: .48;
  filter: saturate(.45) brightness(.75);
}
.drag-ghost {
  position: fixed;
  z-index: 50;
  width: 64px;
  aspect-ratio: .72;
  pointer-events: none;
  filter: drop-shadow(0 12px 15px rgba(0,0,0,.55));
  transform: translate(-50%,-58%) rotate(3deg);
}

.attack-button {
  min-height: 48px; padding: 0 18px; border: 1px solid #f0c66c; border-radius: 9px;
  color: #17140e; background: linear-gradient(135deg,#f0c66c,#bd812e);
  box-shadow: inset 0 1px rgba(255,255,255,.35); cursor: pointer;
  font-weight: 900; letter-spacing: .05em; text-transform: uppercase;
}
.attack-button:disabled { opacity: .35; cursor: not-allowed; }

.modal {
  position: fixed; z-index: 20; inset: 0; display: grid; place-items: center;
  padding: 20px; background: rgba(5,7,9,.84); backdrop-filter: blur(9px);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(440px,100%); padding: 36px; border: 1px solid rgba(212,163,78,.42);
  border-radius: 18px; text-align: center; background: #171c24;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.modal-card h2 { margin-bottom: 11px; font-size: 2rem; }
.modal-card p:not(.eyebrow) { margin-bottom: 22px; color: var(--muted); line-height: 1.55; }
.modal-card button { width: 100%; }

.reward-options {
  display: grid;
  gap: 10px;
  margin: 20px 0;
}

.reward-options[hidden] {
  display: none;
}

.reward-card {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(241,206,124,.48);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(5, 8, 11, .38);
  cursor: pointer;
  text-align: left;
}

.reward-card:hover {
  border-color: var(--gold-bright);
  transform: translateY(-2px);
}

.reward-card strong {
  color: var(--gold-bright);
  font-size: .95rem;
}

.reward-card span {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

@keyframes scorePulse {
  0%,100% { filter: none; }
  35% { filter: brightness(1.5) drop-shadow(0 0 9px var(--gold)); transform: translateY(-4px); }
}

@keyframes drawCardIn {
  0% {
    opacity: 0;
    transform: translateX(34px) translateY(-8px) rotate(5deg) scale(.92);
    filter: brightness(1.35) drop-shadow(0 0 10px rgba(69,243,255,.35));
  }
  65% {
    opacity: 1;
    transform: translateX(-3px) translateY(0) rotate(-1deg) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) translateY(0) rotate(0) scale(1);
    filter: none;
  }
}

@keyframes healthHit {
  0%, 100% { filter: none; }
  35% { filter: brightness(1.9) saturate(1.35); }
}

@keyframes mapCurrentPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* HD pixel-art cyberpunk skin */
:root {
  --ink: #ecf8ff;
  --muted: #7f95a8;
  --night: #050712;
  --panel: #0b1022;
  --line: rgba(86, 240, 255, .22);
  --gold: #ffe06b;
  --gold-bright: #fff08a;
  --red: #ff4d8d;
  --green: #29ffc6;
  --cyan: #45f3ff;
  --magenta: #ff3df2;
  --acid: #a7ff36;
  --card: #0a1426;
  --card-ink: #d9fbff;
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
}

body {
  image-rendering: pixelated;
  background:
    radial-gradient(circle at 50% -18%, rgba(255, 61, 242, .22), transparent 28rem),
    radial-gradient(circle at 78% 30%, rgba(69, 243, 255, .13), transparent 24rem),
    linear-gradient(140deg, #070a14, #050610 58%, #0d1328);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, rgba(255,61,242,.05), transparent 30%, rgba(69,243,255,.05));
  mix-blend-mode: screen;
}

.grain {
  opacity: .1;
  background-image:
    linear-gradient(rgba(69,243,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,61,242,.07) 1px, transparent 1px);
  background-size: 18px 18px;
}

h1,
h2 {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.055em;
  text-shadow: none;
}

.topbar,
.run-map,
.enemy-panel,
.battle-table,
.player-panel,
.battle-log,
.modal-card {
  border-radius: 18px;
  border-color: rgba(80, 204, 220, .18);
  background:
    linear-gradient(135deg, rgba(69,243,255,.045), transparent 40%),
    rgba(7, 12, 26, .82);
  box-shadow:
    0 18px 50px rgba(0,0,0,.34),
    inset 0 1px rgba(255,255,255,.04);
}

.game-shell {
  width: min(1100px, calc(100% - 32px));
  margin-top: 10px;
}

.topbar {
  margin-bottom: 10px;
  border-radius: 22px;
  padding: 10px 18px;
}

.run-map {
  border-radius: 22px;
  background:
    linear-gradient(90deg, rgba(69,243,255,.07), rgba(255,61,242,.05)),
    rgba(7, 11, 25, .78);
}

.map-title-row strong {
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
}

.map-step:not(:last-child)::after {
  background: linear-gradient(90deg, rgba(69,243,255,.65), rgba(255,61,242,.45));
  box-shadow: 0 0 10px rgba(69,243,255,.28);
}

.map-node {
  border-color: var(--cyan);
  border-radius: 8px;
  color: var(--cyan);
  background: #071225;
  box-shadow: 0 4px 0 #03101b, 0 0 12px rgba(69,243,255,.16);
}

.map-step.current .map-node {
  color: #051016;
  background: var(--acid);
  box-shadow: 0 4px 0 #134b5c, 0 0 18px rgba(167,255,54,.42);
}

.map-step.complete .map-node {
  color: #051016;
  background: var(--cyan);
}

.enemy-panel,
.battle-table,
.player-panel {
  margin-bottom: 10px;
  border-radius: 22px;
}

.enemy-panel,
.player-panel {
  padding: 12px 20px;
}

.brand-mark {
  border-color: var(--cyan);
  color: var(--acid);
  background: #070a14;
  box-shadow: 0 0 12px rgba(69,243,255,.28), inset 0 0 12px rgba(255,61,242,.12);
}

.eyebrow {
  color: var(--acid);
  text-shadow: none;
}

.enemy-panel {
  background:
    linear-gradient(90deg, rgba(255,61,242,.11), transparent 48%),
    rgba(7, 11, 25, .78);
}

.player-panel {
  background:
    linear-gradient(90deg, rgba(7,11,25,.8) 55%, rgba(69,243,255,.09)),
    rgba(7, 11, 25, .78);
  min-height: 104px;
}

.enemy-avatar,
.player-avatar {
  border: 2px solid rgba(69,243,255,.45);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(69,243,255,.18), transparent 45%),
    linear-gradient(#171d36, #050711);
  box-shadow: 0 0 12px rgba(69,243,255,.18), inset 0 0 14px rgba(255,61,242,.1);
  clip-path: none;
}

.enemy-avatar i {
  width: 10px;
  height: 6px;
  border-radius: 0;
  background: var(--magenta);
  box-shadow: 0 0 12px var(--magenta);
}

.player-avatar {
  color: var(--cyan);
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
  font-size: 1.5rem;
  font-weight: 900;
  transform: none;
}

.player-avatar::after {
  border-color: var(--acid);
  color: var(--ink);
  background: rgba(5, 8, 18, .98);
  transform: translate(-50%, 4px);
}

.player-avatar::before {
  border-color: var(--acid);
  background: rgba(5, 8, 18, .98);
}

.player-avatar:hover::after,
.player-avatar:focus-visible::after {
  transform: translate(-50%, 0);
}

.meter {
  height: 8px;
  border-radius: 999px;
  border: 0;
  background: #03050d;
}

.meter span {
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), #7afff3);
  box-shadow: 0 0 10px rgba(69,243,255,.34);
}

.enemy-meter span {
  background: linear-gradient(90deg, var(--magenta), #ff6bbb);
  box-shadow: 0 0 10px rgba(255,61,242,.32);
}

.meter span.health-hit {
  animation: healthHit 360ms ease;
}

.card-back {
  border-color: var(--magenta);
  border-radius: 6px;
  background:
    linear-gradient(45deg, transparent 45%, rgba(69,243,255,.35) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(255,61,242,.35) 46% 54%, transparent 55%),
    #11162b;
  box-shadow: 0 4px 0 #03050d;
}

.battle-table {
  padding: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(69,243,255,.16), transparent 21rem),
    linear-gradient(rgba(69,243,255,.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(69,243,255,.022) 1px, transparent 1px),
    rgba(5, 9, 20, .78);
  background-size: auto, 20px 20px, 20px 20px;
}

.board {
  gap: 6px;
  border-radius: 16px;
  border-color: rgba(69,243,255,.34);
  background:
    linear-gradient(135deg, rgba(69,243,255,.08), rgba(255,61,242,.06)),
    rgba(2, 8, 17, .9);
  box-shadow: inset 0 0 0 2px rgba(5,12,25,.9), 0 8px 0 rgba(0,0,0,.24);
}

.board-cell {
  border-radius: 8px;
  border-color: rgba(69,243,255,.2);
  background: rgba(69,243,255,.035);
}

.board-cell.center-cell {
  border-color: rgba(167,255,54,.24);
  background: rgba(167,255,54,.035);
}

.board-cell.drag-over {
  border-color: var(--acid);
  background: rgba(167,255,54,.12);
  box-shadow: inset 0 0 0 2px rgba(167,255,54,.45);
}

.board-cell.valid-target {
  border-color: rgba(167,255,54,.45);
  background:
    linear-gradient(135deg, rgba(167,255,54,.08), rgba(69,243,255,.04)),
    rgba(69,243,255,.035);
  box-shadow: inset 0 0 0 1px rgba(167,255,54,.16);
}

.board-cell.valid-target::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(167,255,54,.42);
  clip-path: polygon(0 0, 28% 0, 28% 2px, 2px 2px, 2px 28%, 0 28%, 0 0, 100% 0, 100% 28%, calc(100% - 2px) 28%, calc(100% - 2px) 2px, 72% 2px, 72% 0, 100% 0, 100% 100%, 72% 100%, 72% calc(100% - 2px), calc(100% - 2px) calc(100% - 2px), calc(100% - 2px) 72%, 100% 72%, 100% 100%, 0 100%, 0 72%, 2px 72%, 2px calc(100% - 2px), 28% calc(100% - 2px), 28% 100%, 0 100%);
  opacity: .8;
  pointer-events: none;
}

.board-cell.line-guide {
  background:
    linear-gradient(135deg, rgba(255,61,242,.09), rgba(69,243,255,.08)),
    rgba(69,243,255,.045);
}

.board-cell.line-guide:not(.occupied) {
  border-style: solid;
}

.playing-card {
  border-radius: 0;
  color: var(--card-ink);
  background:
    linear-gradient(#0d1729, #091222);
  border: 2px solid #48d9e8;
  clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px));
  box-shadow:
    inset 0 0 0 3px #08101f,
    0 3px 0 #032432;
}

.playing-card.red {
  color: #ff4d8d;
}

.playing-card:not(.red) {
  color: #5ff1ff;
}

.playing-card .rank {
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
  color: inherit;
  text-shadow: 2px 2px 0 #020611;
}

.playing-card .suit {
  color: inherit;
  font-size: clamp(1.65rem,4vw,2.75rem);
  text-shadow: 2px 2px 0 #020611;
}

.playing-card.owner-player {
  box-shadow:
    inset 0 0 0 3px #08101f,
    inset 0 0 0 5px #48d9e8,
    0 3px 0 #032432;
}

.board-cell.pending-card .playing-card {
  box-shadow:
    inset 0 0 0 3px #08101f,
    inset 0 0 0 5px #a7ff36,
    0 3px 0 #314f14;
}

.playing-card.owner-enemy {
  box-shadow:
    inset 0 0 0 3px #08101f,
    inset 0 0 0 5px #ff4dce,
    0 3px 0 #4a164f;
}

.hand-callout {
  border-radius: 10px;
  color: #051016;
  background: var(--acid);
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
  text-transform: uppercase;
  box-shadow: 0 12px 30px rgba(0,0,0,.45), 0 0 20px rgba(167,255,54,.3);
}

.log-entry strong {
  color: var(--cyan);
}

.player-hand,
.player-hand.drag-over {
  border-radius: 12px;
}

.player-hand.drag-over {
  border-color: var(--acid);
  background: rgba(167,255,54,.1);
}

.hand-card,
.drag-ghost,
.attack-button,
.pass-button {
  border-radius: 8px;
}

.hand-card:hover:not(:disabled) {
  filter: brightness(1.14);
}

.player-hand.choosing-holds {
  border-color: var(--acid);
  background:
    linear-gradient(135deg, rgba(167,255,54,.09), rgba(69,243,255,.05)),
    rgba(7, 12, 26, .5);
  box-shadow: inset 0 0 0 1px rgba(167,255,54,.2);
}

.hand-card.drawn-card {
  animation: drawCardIn 320ms cubic-bezier(.2,.85,.25,1) both;
}

.hand-card.hold-selected {
  filter: brightness(1.16) drop-shadow(0 0 12px rgba(167,255,54,.24));
}

.hand-card.hold-selected .playing-card {
  box-shadow:
    inset 0 0 0 3px #08101f,
    inset 0 0 0 5px #a7ff36,
    0 3px 0 #314f14,
    0 0 16px rgba(167,255,54,.28);
}

.hand-card.redraw-selected {
  opacity: .5;
  filter: saturate(.45) brightness(.68);
}

.attack-button {
  border-color: var(--acid);
  color: #051016;
  background: linear-gradient(135deg, var(--acid), var(--cyan));
  box-shadow: 0 4px 0 #134b5c;
}

.pass-button {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(69,243,255,.08);
  box-shadow: 0 3px 0 #032432;
}

.pass-button:not(:disabled):hover {
  color: #051016;
  background: var(--acid);
  border-color: var(--acid);
}

.equipment-chip {
  border-color: rgba(69,243,255,.35);
  color: var(--acid);
  background: rgba(69,243,255,.08);
}

.reward-card {
  border-color: rgba(69,243,255,.32);
  background:
    linear-gradient(135deg, rgba(69,243,255,.08), rgba(255,61,242,.05)),
    rgba(5, 8, 18, .72);
}

.reward-card:hover {
  border-color: var(--acid);
  box-shadow: 0 0 18px rgba(167,255,54,.22);
}

.reward-card strong {
  color: var(--acid);
}

.icon-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--acid);
  border-radius: 8px;
  color: #051016;
  background: linear-gradient(135deg, var(--acid), var(--cyan));
  box-shadow: 0 3px 0 #134b5c;
  cursor: pointer;
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.icon-button {
  width: 34px;
  padding: 0;
  font-size: 1rem;
}

.help-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(5, 7, 9, .86);
  backdrop-filter: blur(8px);
}

.help-modal[hidden] {
  display: none;
}

.help-card {
  position: relative;
  width: min(1160px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 18px;
  padding: 28px;
  border: 2px solid var(--acid);
  border-radius: 18px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(69,243,255,.055), rgba(255,61,242,.04)),
    #101a22;
  box-shadow: 0 30px 90px rgba(0,0,0,.65), inset 0 1px rgba(255,255,255,.06);
}

.help-card h2 {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.help-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  aspect-ratio: 1;
  border: 1px solid var(--acid);
  border-radius: 8px;
  color: var(--acid);
  background: rgba(5, 10, 20, .72);
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 900;
}

.hand-reference {
  display: grid;
  gap: 26px;
  overflow: auto;
  padding: 4px 4px 8px;
}

.help-lead {
  margin: 0 auto 18px;
  max-width: 980px;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
}

.placement-reference,
.poker-reference {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 26px;
}

.section-title {
  margin: 0 0 16px;
  color: var(--ink);
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

.placement-example,
.reference-hand {
  min-width: 0;
}

.placement-example h3,
.reference-hand h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: clamp(.9rem, 1.6vw, 1.35rem);
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

.placement-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(167,255,54,.28);
  border-radius: 10px;
  background: rgba(3, 15, 12, .55);
}

.placement-cell {
  position: relative;
  display: block;
  aspect-ratio: .76;
  border: 1px solid rgba(167,255,54,.22);
  border-radius: 6px;
  background: rgba(167,255,54,.04);
}

.placement-cell.center-cell {
  background: rgba(167,255,54,.12);
}

.placement-cell.line-cell {
  background: rgba(167,255,54,.18);
}

.placement-cell.placed-card {
  box-shadow: 0 0 0 2px rgba(255,240,138,.62), 0 0 14px rgba(255,240,138,.32);
}

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

.reference-card {
  position: relative;
  display: block;
  aspect-ratio: .72;
  min-width: 0;
}

.reference-card .playing-card {
  box-shadow:
    inset 0 0 0 3px #08101f,
    0 3px 0 #032432;
}

.reference-card {
  opacity: .42;
  filter: saturate(.25) brightness(.48);
}

.reference-card .playing-card {
  box-shadow:
    inset 0 0 0 2px rgba(69,243,255,.24),
    0 3px 0 #03101b;
}

.reference-card .playing-card .rank,
.reference-card .playing-card .suit {
  text-shadow: none;
}

.reference-hand:nth-child(1) .reference-card:nth-child(1),
.reference-hand:nth-child(1) .reference-card:nth-child(2),
.reference-hand:nth-child(2) .reference-card:nth-child(1),
.reference-hand:nth-child(2) .reference-card:nth-child(2),
.reference-hand:nth-child(2) .reference-card:nth-child(3),
.reference-hand:nth-child(2) .reference-card:nth-child(4),
.reference-hand:nth-child(3) .reference-card:nth-child(1),
.reference-hand:nth-child(3) .reference-card:nth-child(2),
.reference-hand:nth-child(3) .reference-card:nth-child(3),
.reference-hand:nth-child(4) .reference-card,
.reference-hand:nth-child(5) .reference-card,
.reference-hand:nth-child(6) .reference-card,
.reference-hand:nth-child(7) .reference-card:nth-child(1),
.reference-hand:nth-child(7) .reference-card:nth-child(2),
.reference-hand:nth-child(7) .reference-card:nth-child(3),
.reference-hand:nth-child(7) .reference-card:nth-child(4),
.reference-hand:nth-child(8) .reference-card,
.reference-hand:nth-child(9) .reference-card {
  opacity: 1;
  filter: none;
}

.help-card > .attack-button {
  justify-self: center;
  min-width: 220px;
}

body.theme-quest {
  --ink: #fff8df;
  --muted: #c7d4ff;
  --panel: #183a8b;
  --line: rgba(255, 225, 101, .58);
  --gold: #ffe165;
  --gold-bright: #fff3a8;
  --red: #d93d4a;
  --green: #48b85f;
  --cyan: #75d7ff;
  --magenta: #e3537a;
  --acid: #ffe165;
  --card: #fff7dc;
  --card-ink: #173167;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0, rgba(255,255,255,.62), transparent 12rem),
    linear-gradient(180deg, #7fd7ff 0 26%, #62b96a 26% 54%, #2f7f4c 54% 100%);
  image-rendering: auto;
}

body.theme-quest::before {
  opacity: .1;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 34%),
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(255,255,255,.08) 30px 31px);
  mix-blend-mode: soft-light;
}

body.theme-quest .grain {
  opacity: .12;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.32) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24,58,139,.08), rgba(255,225,101,.08));
  background-size: 22px 22px, auto;
}

body.theme-quest h1,
body.theme-quest h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 rgba(11,28,73,.55);
}

body.theme-quest .topbar,
body.theme-quest .run-map,
body.theme-quest .enemy-panel,
body.theme-quest .battle-table,
body.theme-quest .player-panel,
body.theme-quest .battle-log,
body.theme-quest .modal-card {
  border: 3px solid #ffe165;
  background:
    linear-gradient(180deg, rgba(45,98,190,.96), rgba(19,52,135,.96));
  box-shadow:
    0 6px 0 #071a56,
    0 20px 40px rgba(8,29,62,.28),
    inset 0 0 0 2px rgba(255,255,255,.2);
}

body.theme-quest .topbar,
body.theme-quest .run-map,
body.theme-quest .enemy-panel,
body.theme-quest .battle-table,
body.theme-quest .player-panel {
  border-radius: 10px;
}

body.theme-quest .brand-mark {
  border-color: #fff3a8;
  color: #173167;
  background: #ffe165;
  box-shadow: 0 4px 0 #8f6b13, inset 0 0 0 2px #fff8d8;
}

body.theme-quest .run-map {
  background:
    linear-gradient(90deg, rgba(255,225,101,.12), rgba(117,215,255,.08)),
    linear-gradient(180deg, rgba(45,98,190,.96), rgba(19,52,135,.96));
}

body.theme-quest .map-title-row strong {
  font-family: Georgia, "Times New Roman", serif;
}

body.theme-quest .map-step:not(:last-child)::after {
  height: 4px;
  border: 1px solid #ffe165;
  background: #62b96a;
  box-shadow: 0 2px 0 #071a56;
}

body.theme-quest .map-node {
  border: 3px solid #ffe165;
  border-radius: 50%;
  color: #fff8df;
  background: linear-gradient(180deg, #2d62be, #133487);
  box-shadow: 0 5px 0 #071a56, inset 0 0 0 2px rgba(255,255,255,.18);
}

body.theme-quest .map-step.current .map-node {
  color: #173167;
  background: linear-gradient(180deg, #fff7bb, #f3c243);
  box-shadow: 0 5px 0 #8f6b13, 0 0 18px rgba(255,225,101,.45);
}

body.theme-quest .map-step.complete .map-node {
  color: #173167;
  background: #75d7ff;
}

body.theme-quest .eyebrow {
  color: #fff3a8;
  letter-spacing: .1em;
  text-shadow: 1px 1px 0 #071a56;
}

body.theme-quest .run-status span,
body.theme-quest .name-row strong {
  color: #e1e9ff;
}

body.theme-quest .icon-button,
body.theme-quest .attack-button {
  border: 2px solid #102b79;
  color: #173167;
  background: linear-gradient(180deg, #fff7bb, #f3c243);
  box-shadow: 0 4px 0 #8f6b13, inset 0 1px rgba(255,255,255,.7);
  font-family: Georgia, "Times New Roman", serif;
}

body.theme-quest .enemy-panel {
  background:
    linear-gradient(90deg, rgba(227,83,122,.18), transparent 48%),
    linear-gradient(180deg, rgba(45,98,190,.96), rgba(19,52,135,.96));
}

body.theme-quest .player-panel {
  background:
    linear-gradient(90deg, rgba(45,98,190,.96), rgba(21,105,72,.92));
}

body.theme-quest .enemy-avatar,
body.theme-quest .player-avatar {
  border: 3px solid #ffe165;
  border-radius: 48% 48% 44% 44%;
  background:
    radial-gradient(circle at 50% 28%, rgba(255,255,255,.7), transparent 16%),
    linear-gradient(180deg, #61d9ff, #2c78cf 72%, #174a9f);
  box-shadow: 0 5px 0 #071a56, inset 0 -8px rgba(11,39,113,.24);
}

body.theme-quest .enemy-avatar {
  border-radius: 50% 50% 42% 42%;
  transform: scaleX(1.08);
}

body.theme-quest .enemy-avatar i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #071a56;
  box-shadow: none;
}

body.theme-quest .player-avatar {
  color: #fff8df;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  transform: none;
}

body.theme-quest .player-avatar::after {
  border: 2px solid #ffe165;
  color: #fff8df;
  background: #173167;
  box-shadow: 0 5px 0 #071a56, 0 18px 30px rgba(7,26,86,.36);
  transform: translate(-50%, 4px);
}

body.theme-quest .player-avatar::before {
  border-right: 2px solid #ffe165;
  border-bottom: 2px solid #ffe165;
  background: #173167;
}

body.theme-quest .player-avatar:hover::after,
body.theme-quest .player-avatar:focus-visible::after {
  transform: translate(-50%, 0);
}

body.theme-quest .meter {
  height: 10px;
  border: 2px solid #071a56;
  border-radius: 0;
  background: #091b50;
  box-shadow: inset 0 2px rgba(0,0,0,.3);
}

body.theme-quest .meter span {
  background: linear-gradient(90deg, #51cf66, #b6f06d);
  box-shadow: inset 0 1px rgba(255,255,255,.45);
}

body.theme-quest .enemy-meter span {
  background: linear-gradient(90deg, #e3537a, #ff9aa8);
}

body.theme-quest .equipment-chip {
  border: 2px solid #ffe165;
  color: #173167;
  background: #fff3a8;
  box-shadow: 0 2px 0 #8f6b13;
}

body.theme-quest .equipment-chip::after {
  border: 2px solid #ffe165;
  color: #fff8df;
  background: #173167;
  box-shadow: 0 5px 0 #071a56, 0 18px 30px rgba(7,26,86,.36);
}

body.theme-quest .equipment-chip::before {
  border-right: 2px solid #ffe165;
  border-bottom: 2px solid #ffe165;
  background: #173167;
}

body.theme-quest .equipment-empty {
  color: #e1e9ff;
}

body.theme-quest .card-back {
  border: 2px solid #ffe165;
  background:
    linear-gradient(45deg, transparent 45%, rgba(255,225,101,.55) 46% 54%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(255,255,255,.28) 46% 54%, transparent 55%),
    #244fa5;
  box-shadow: 0 4px 0 #071a56;
}

body.theme-quest .battle-table {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,225,101,.2), transparent 20rem),
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px),
    #1b6c54;
  background-size: auto, 24px 24px, 24px 24px;
}

body.theme-quest .board {
  border: 3px solid #ffe165;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,225,101,.12)),
    #204b9f;
  box-shadow: 0 7px 0 #071a56, inset 0 0 0 2px rgba(255,255,255,.18);
}

body.theme-quest .board-cell {
  border: 2px solid rgba(255,243,168,.32);
  border-radius: 4px;
  background: rgba(8,29,82,.34);
}

body.theme-quest .board-cell.center-cell {
  border-color: rgba(255,225,101,.5);
  background: rgba(255,225,101,.1);
}

body.theme-quest .board-cell.valid-target,
body.theme-quest .board-cell.drag-over {
  border-color: #fff3a8;
  background: rgba(255,225,101,.18);
  box-shadow: inset 0 0 0 2px rgba(255,243,168,.34);
}

body.theme-quest .board-cell.line-guide {
  background: rgba(117,215,255,.18);
}

body.theme-quest .playing-card {
  border: 2px solid #173167;
  border-radius: 4px;
  color: var(--card-ink);
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.6), transparent 44%),
    linear-gradient(180deg, #fff9df, #efd88d);
  clip-path: none;
  box-shadow: inset 0 0 0 3px #fff3a8, 0 3px 0 #8f6b13;
}

body.theme-quest .playing-card.red {
  color: #c93543;
}

body.theme-quest .playing-card:not(.red) {
  color: #173167;
}

body.theme-quest .playing-card .rank,
body.theme-quest .playing-card .suit {
  font-family: Georgia, "Times New Roman", serif;
  text-shadow: 1px 1px 0 rgba(255,255,255,.7);
}

body.theme-quest .playing-card.owner-player {
  box-shadow: inset 0 0 0 4px #6bcdf7, 0 3px 0 #174a9f;
}

body.theme-quest .playing-card.owner-enemy {
  box-shadow: inset 0 0 0 4px #e3537a, 0 3px 0 #7d2342;
}

body.theme-quest .board-cell.pending-card .playing-card,
body.theme-quest .hand-card.hold-selected .playing-card {
  box-shadow: inset 0 0 0 4px #ffe165, 0 3px 0 #8f6b13, 0 0 16px rgba(255,225,101,.45);
}

body.theme-quest .hand-callout {
  border: 3px solid #173167;
  color: #173167;
  background: #fff3a8;
  font-family: Georgia, "Times New Roman", serif;
  text-transform: none;
  box-shadow: 0 6px 0 #8f6b13, 0 18px 30px rgba(7,26,86,.28);
}

body.theme-quest .board-turn-banner {
  border: 3px solid #ffe165;
  color: #fff3a8;
  background: rgba(23,49,103,.9);
  font-family: Georgia, "Times New Roman", serif;
  text-transform: none;
  box-shadow: 0 6px 0 #8f6b13, 0 18px 30px rgba(7,26,86,.28);
}

body.theme-quest .log-entry strong {
  color: #fff3a8;
}

body.theme-quest .player-hand.choosing-holds {
  border-color: #fff3a8;
  background: rgba(255,243,168,.12);
  box-shadow: inset 0 0 0 1px rgba(255,243,168,.22);
}

body.theme-quest .hand-card.hold-selected {
  filter: brightness(1.1) drop-shadow(0 0 12px rgba(255,225,101,.3));
}

body.theme-quest .hand-card.redraw-selected {
  opacity: .52;
  filter: saturate(.5) brightness(.72);
}

body.theme-quest .help-modal {
  background: rgba(8, 24, 57, .74);
}

body.theme-quest .help-card {
  border: 4px solid #ffe165;
  border-radius: 8px;
  color: #fff8df;
  background:
    linear-gradient(180deg, rgba(31,83,166,.98), rgba(17,65,51,.98));
  box-shadow: 0 8px 0 #071a56, 0 28px 70px rgba(7,26,86,.45), inset 0 0 0 2px rgba(255,255,255,.16);
}

body.theme-quest .help-card h2,
body.theme-quest .section-title,
body.theme-quest .placement-example h3,
body.theme-quest .reference-hand h3 {
  color: #fff8df;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .02em;
  text-shadow: 2px 2px 0 #071a56;
}

body.theme-quest .help-lead {
  color: #fff8df;
  text-shadow: 2px 2px 0 #071a56;
}

body.theme-quest .help-close {
  border: 2px solid #102b79;
  color: #173167;
  background: #fff3a8;
  box-shadow: 0 3px 0 #8f6b13;
}

body.theme-quest .reward-card {
  border: 2px solid #ffe165;
  color: #fff8df;
  background: rgba(17, 65, 51, .72);
  box-shadow: 0 4px 0 #071a56;
}

body.theme-quest .reward-card:hover {
  box-shadow: 0 5px 0 #8f6b13, 0 0 18px rgba(255,225,101,.32);
}

body.theme-quest .reward-card strong {
  color: #fff3a8;
}

body.theme-quest .reward-card span {
  color: #e1e9ff;
}

body.theme-quest .reference-card .playing-card {
  box-shadow: inset 0 0 0 3px #fff3a8, 0 3px 0 #8f6b13;
}

body.theme-quest .placement-board {
  border: 2px solid #ffe165;
  background: rgba(11, 65, 51, .62);
}

body.theme-quest .placement-cell {
  border-color: rgba(255,243,168,.42);
  background: rgba(7, 26, 86, .34);
}

body.theme-quest .placement-cell.center-cell {
  background: rgba(255,225,101,.22);
}

body.theme-quest .placement-cell.line-cell {
  background: rgba(145, 205, 99, .48);
}

body.theme-quest .placement-cell.placed-card {
  box-shadow: 0 0 0 2px #fff3a8, 0 0 16px rgba(255,225,101,.42);
}

@media (max-width: 850px) {
  .battle-table { grid-template-columns: 1fr; }
  .run-map { grid-template-columns: 1fr; gap: 10px; }
  .screen-map .run-map { min-height: min(620px, calc(100vh - 100px)); gap: 26px; }
  .screen-map .map-path { gap: 16px; }
  .map-title-row { text-align: center; }
  .placement-reference,
  .poker-reference { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .battle-log { display: none; }
  .enemy-panel, .player-panel { grid-template-columns: 62px 1fr; }
  .enemy-hand, .player-hand-wrap { grid-column: 1 / -1; justify-content: center; }
  .enemy-hand { display: none; }
}

@media (max-width: 560px) {
  .game-shell { width: min(100% - 10px, 500px); margin-top: 5px; }
  .topbar { padding: 10px 12px; }
  .run-status div:first-child { display: none; }
  .run-map { padding: 10px; }
  .screen-map .run-map { padding: 20px 10px; }
  .map-path { gap: 8px; }
  .map-step:not(:last-child)::after { left: calc(50% + 18px); width: calc(100% - 4px); }
  .map-node { width: 36px; }
  .screen-map .map-node { width: clamp(50px, 18vw, 76px); }
  .map-step strong { font-size: .58rem; }
  .screen-battle .map-step em { display: none; }
  .enemy-panel, .player-panel { padding: 10px 12px; gap: 10px; }
  .enemy-avatar, .player-avatar { width: 53px; height: 58px; }
  .battle-table { padding: 10px 5px; gap: 10px; }
  .board { gap: 4px; padding: 6px; }
  .board-turn-banner {
    padding: 8px 16px;
    font-size: .72rem;
  }
  .pass-button {
    min-height: 25px;
    padding: 0 8px;
    font-size: .68rem;
  }
  .player-hand-wrap { gap: 8px; }
  .player-hand { gap: 5px; }
  .hand-card { width: min(15vw,58px); }
  .help-card { padding: 20px 12px 16px; gap: 14px; }
  .hand-reference { gap: 18px; }
  .placement-reference,
  .poker-reference { grid-template-columns: 1fr; gap: 18px; }
  .reference-cards { gap: 4px; }
  .attack-button { min-height: 44px; padding: 0 10px; font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
