:root {
  color-scheme: dark;

  --page-bg: #0d1519;
  --panel-bg: #121d22;
  --board-edge: rgba(157, 177, 189, 0.18);
  --grid-line: rgba(160, 175, 186, 0.1);

  --color-red: #d95c5f;
  --color-blue: #4d89d8;
  --color-yellow: #e7c762;
  --color-green: #54b576;
  --active-color: var(--color-red);

  /* Logical dimensions stay fixed. The camera handles screen scaling. */
  --card-size: 140px;

  --muted: #a9bac5;

  font-family: Inter, "Segoe UI", sans-serif;
  color: #edf3f7;
  background: var(--page-bg);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

p {
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--board-edge);
  border-radius: 8px;
  color: inherit;
  background: #17252d;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #223640;
  border-color: #78909e;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
.board-viewport:focus-visible {
  outline: 2px solid #eef4f8;
  outline-offset: 3px;
}

button.primary {
  border-color: var(--active-color);
  background: #23323a;
}

button.quiet {
  background: transparent;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.75rem;
}

.eyebrow,
.version,
.badge,
.table-label {
  font:
    0.67rem/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar {
  height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--board-edge);
}

.topbar > div {
  display: flex;
  align-items: baseline;
  gap: 18px;
}

.card-theme-control {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font:
    0.67rem/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card-theme-control select {
  min-height: 30px;
  color: inherit;
  background: #17252d;
  border: 1px solid var(--board-edge);
  border-radius: 4px;
}

h1 {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
  font-weight: 500;
}

.badge {
  padding: 6px 10px;
  border: 1px solid var(--board-edge);
  border-radius: 5px;
}

.game-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100dvh - 70px);
  min-height: 520px;
}

.game-panel {
  padding: 20px;
  background: var(--panel-bg);
  overflow-y: auto;
  border-right: 1px solid var(--board-edge);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.online-room {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem;
  border: 1px solid var(--board-edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.online-room input {
  min-width: 0;
  width: 100%;
  text-transform: uppercase;
}

.game-panel > * {
  flex-shrink: 0;
}

.player-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.player-chip {
  padding: 7px 4px;
  text-align: center;
  font-size: 0.67rem;
  border: 1px solid var(--board-edge);
  border-top: 3px solid var(--player-color);
  border-radius: 5px;
}

.player-chip.active {
  background: #263842;
  outline: 1px solid var(--player-color);
}

.turn-banner {
  border-left: 3px solid var(--active-color);
  padding-left: 12px;
}

h2 {
  font-size: 1.3rem;
  font-weight: 500;
  margin-top: 3px;
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

#setupPanel,
#playPanel {
  display: grid;
  gap: 13px;
}

#setupPanel > .muted {
  font-size: 0.8rem;
}

.table-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

input {
  width: 76px;
  padding: 7px;
  border: 1px solid var(--board-edge);
  border-radius: 5px;
  background: #0d171c;
  color: inherit;
}

.choice-options {
  display: grid;
  gap: 8px;
}

.choice-row {
  display: grid;
  grid-template-columns: 50px 1fr 34px 22px 34px;
  align-items: center;
  gap: 6px;
}

.choice-row > button {
  padding: 0;
  min-height: 36px;
}

.choice-row strong {
  text-align: center;
  font-size: 0.9rem;
}

.choice-title {
  font-size: 0.8rem;
}

.choice-title span {
  display: block;
  font-size: 0.67rem;
  color: var(--muted);
  margin-top: 3px;
}

.selection-count {
  text-align: center;
  font-size: 0.8rem;
}

.button-row,
.rotation-controls {
  display: flex;
  gap: 8px;
}

.button-row button,
.rotation-controls button {
  flex: 1;
  font-size: 0.78rem;
}

.steps {
  list-style: none;
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 0;
  counter-reset: step;
}

.steps li {
  font-size: 0.75rem;
  color: #8599a5;
  padding: 6px 9px;
  border-left: 2px solid #2a3c46;
}

.steps li::before {
  counter-increment: step;
  content: "0" counter(step) " / ";
  font-family: monospace;
}

.steps li.active {
  color: #fff;
  border-color: var(--active-color);
  background: #1c2c35;
}

.steps li.passed {
  color: #adc9b8;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
}

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

.hand-card {
  padding: 5px 3px;
  background: #101c23;
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.hand-card > span:last-child {
  font-size: 0.66rem;
}

.hand-card.selected {
  outline: 2px solid var(--active-color);
  outline-offset: -1px;
  background: #23343e;
}

.empty-hand {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 12px 0;
}

.community-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: center;
  padding-top: 8px;
}

.deck {
  min-height: 150px;
  display: grid;
  gap: 6px;
  place-items: center;
  font-size: 0.75rem;
  position: relative;
  background: repeating-linear-gradient(
    135deg,
    #15242d 0 9px,
    #192b35 9px 10px
  );
  box-shadow:
    3px 3px 0 #263944,
    6px 6px 0 #0a1116,
    0 12px 20px #0005;
}

.deck:enabled {
  border-color: var(--active-color);
}

.deck-mark {
  font:
    2.3rem ui-monospace,
    monospace;
  font-weight: 300;
}

.deck-mark span {
  color: var(--active-color);
}

.community-face {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.drawn-preview {
  width: 86px;
  height: 86px;
  border: 1px dashed #38515f;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.instruction {
  font-size: 0.84rem;
  padding: 12px;
  background: #0c171d;
  border-left: 2px solid var(--active-color);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.stats dt {
  font-size: 0.68rem;
  color: var(--muted);
}

.stats dd {
  margin: 4px 0 0;
  font:
    1rem ui-monospace,
    monospace;
}

details {
  border-top: 1px solid var(--board-edge);
  padding-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

summary {
  cursor: pointer;
  color: #dae5ec;
}

details p {
  margin-top: 10px;
}

.complete-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-green);
  border-radius: 8px;
  font-size: 0.85rem;
}

.board-panel {
  min-width: 0;
  min-height: 0;
  padding: 18px;
}

.board {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--board-edge);
  background: #090f14;
  box-shadow:
    inset 0 0 50px #0005,
    0 22px 60px #0005;
}

.board-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.board-viewport.is-dragging {
  cursor: grabbing;
}

.board-world {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.board-grid {
  position: absolute;
  pointer-events: none;
  border: 2px solid #56717d;
  background-color: #0e161b;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--card-size) var(--card-size);

  /* Align grid lines to cell edges, not inside the border. */
  background-origin: border-box;
}

.cards-layer,
.guides-layer,
.analysis-layer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

.table-label {
  position: absolute;
  left: 16px;
  top: 12px;
  pointer-events: none;
  background: #091218c9;
  padding: 4px 7px;
}

.board-controls {
  position: absolute;
  bottom: 36px;
  right: 14px;
  display: flex;
  gap: 5px;
}

.board-controls button {
  font-size: 0.76rem;
  background: #13212bea;
}

.board-help {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  font-size: 0.66rem;
  color: #a2b6c3;
  pointer-events: none;
}

/* Tile face, thickness, bevel and gloss. */

.tile {
  --glare-x: 50%;
  --glare-y: 22%;
  position: relative;
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 9px 14px #0007);
}

.tile::before {
  content: "";
  position: absolute;
  inset: 8% 2% -3%;
  border-radius: 9%;
  z-index: 0;
  background: linear-gradient(180deg, #060a0ec7, #070b0f80 42%, #05080acc);
  transform: translateY(3px);
  box-shadow: 0 10px 18px #0004;
  pointer-events: none;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 2%;
  border-radius: 8%;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    ellipse at var(--glare-x) var(--glare-y),
    #ffffff47,
    #ffffff1f 18%,
    transparent 42%
  );
  mix-blend-mode: screen;
}

.grid-card {
  position: absolute;
  width: var(--card-size);
  height: var(--card-size);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.tile-small {
  width: 50px;
  height: 50px;
}

.hand-card .tile-small {
  width: 65px;
  height: 65px;
}

.drawn-preview .tile-small {
  width: 84px;
  height: 84px;
}

.card-svg {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  overflow: visible;
}

/* Stage 6 approved Minimal theme. This only styles presentation SVG emitted
   by card-theme.js; the authoritative renderer and state are unchanged. */
html[data-card-theme="minimal"] .tile {
  filter: drop-shadow(0 5px 8px #0005);
}

html[data-card-theme="minimal"] .tile::before,
html[data-card-theme="minimal"] .tile::after {
  display: none;
}

.minimal-card-svg .minimal-outer {
  fill: #fbfaf5;
  stroke: var(--minimal-frame, #202729);
  stroke-width: 4;
}

.minimal-card-svg .minimal-inner {
  fill: none;
  stroke: var(--minimal-frame, #202729);
  stroke-width: 1.4;
  opacity: 0.7;
}

.minimal-path {
  --minimal-frame: var(--color-red);
}
.minimal-path .minimal-route {
  fill: none;
  stroke: var(--minimal-frame);
  stroke-width: 13;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.minimal-path .minimal-outer,
.minimal-path .minimal-inner {
  stroke: var(--minimal-frame);
}

.minimal-tunnel .minimal-outer {
  fill: #242a2c;
  stroke: #f7f5ec;
}
.minimal-tunnel .minimal-inner {
  stroke: #f7f5ec;
  opacity: 0.72;
}
.minimal-tunnel .minimal-route {
  fill: none;
  stroke: #f7f5ec;
  stroke-width: 13;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.minimal-universal {
  fill: #242a2c;
  stroke: #f7f5ec;
  stroke-width: 3;
}

.minimal-sr-text {
  opacity: 0;
  pointer-events: none;
}
.minimal-room .minimal-room-fill {
  fill: var(--minimal-frame);
  opacity: 0.16;
}
.minimal-room .minimal-room-mark {
  fill: var(--minimal-frame);
}
.minimal-room .minimal-outer,
.minimal-room .minimal-inner {
  stroke: var(--minimal-frame);
}
.minimal-center {
  --minimal-frame: #202729;
}
.minimal-final {
  --minimal-frame: #cda33b;
}
.minimal-center .minimal-room-fill,
.minimal-final .minimal-room-fill {
  fill: var(--minimal-frame);
  opacity: 0.16;
}
.minimal-center .minimal-outer,
.minimal-center .minimal-inner,
.minimal-final .minimal-outer,
.minimal-final .minimal-inner {
  stroke: var(--minimal-frame);
}
.minimal-special-mark {
  fill: var(--minimal-frame);
  font: 700 38px/1 sans-serif;
  text-anchor: middle;
}
.minimal-utility .minimal-outer,
.minimal-utility .minimal-inner {
  stroke: var(--minimal-frame);
}
.minimal-utility-icon .m-line,
.minimal-utility-icon .m-node {
  fill: none;
  stroke: var(--utility-accent);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.minimal-utility-icon .m-soft {
  fill: none;
  stroke: #66706f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.minimal-utility-icon .m-move {
  fill: none;
  stroke: #344447;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.minimal-utility-icon .m-remove {
  fill: none;
  stroke: #b45454;
  stroke-width: 4;
  stroke-linecap: round;
}
.minimal-utility-icon circle.m-node {
  fill: var(--utility-accent);
}
.minimal-utility-name {
  fill: #202729;
  font:
    700 8px/1 Inter,
    sans-serif;
  text-anchor: middle;
}
html[data-card-theme="minimal"] .utility-symbol {
  width: 65px;
  height: 65px;
  display: block;
}
html[data-card-theme="minimal"] .utility-symbol .card-svg {
  width: 100%;
  height: 100%;
}

.card-shell {
  stroke: rgba(240, 244, 248, 0.6);
  stroke-width: 1.15;
}

.card-border-inner {
  fill: none;
  stroke: #ffffff26;
  stroke-width: 0.7;
}

.arm {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 #ffffff24);
}

.arm--red {
  stroke: var(--color-red);
}

.arm--blue {
  stroke: var(--color-blue);
}

.arm--yellow {
  stroke: var(--color-yellow);
}

.arm--green {
  stroke: var(--color-green);
}

.arm--highlight {
  stroke: #ffffff33;
  stroke-width: 3.5;
  opacity: 0.75;
  transform: translateY(-0.7px);
}

.junction-core {
  fill: #0a0e12f5;
  stroke: #ffffff3d;
  stroke-width: 1;
}

.junction-rim {
  fill: none;
  stroke: #ffffff2e;
  stroke-width: 1;
}

button.placement {
  padding: 0;
  min-height: 0;
  border: 1px dashed #abc1cc;
  border-radius: 10px;
  background: transparent;
  opacity: 0.42;
}

button.placement:hover,
button.placement:focus-visible {
  opacity: 0.95;
  background: #25384066;
  border-color: #fff;
}

.placement-caption {
  position: absolute;
  bottom: 5px;
  left: 0;
  right: 0;
  z-index: 3;
  font:
    10px ui-monospace,
    monospace;
  color: #fff;
  text-align: center;
}

.center-match {
  display: grid;
  place-content: center;
  gap: 5px;
  padding: 10px;
  text-align: center;
  border: 1px dashed var(--match-color);
  border-radius: 9px;
  color: var(--match-color);
  opacity: 0.6;
  pointer-events: none;
  font:
    11px ui-monospace,
    monospace;
}

.center-match small {
  font-size: 9px;
  color: #becdd6;
}

/* Developer previews use small tiles; the large PLACE control stays clickable. */
.analysis-toggle {
  margin-top: 12px;
  font-size: 0.75rem;
}

.analysis-toggle[aria-pressed="true"] {
  border-color: #b0a8cf;
}

.analysis-cell {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 3px;
  padding: 4px;
  pointer-events: none;
}

.analysis-caption {
  width: 100%;
  font:
    9px ui-monospace,
    monospace;
  color: #d3cce9;
  text-align: center;
}

button.analysis-preview {
  width: 40px;
  min-height: 0;
  padding: 1px;
  border: 1px dotted #b0a8cf;
  border-radius: 5px;
  background: #111923e8;
  color: #d3cce9;
  font:
    9px ui-monospace,
    monospace;
  pointer-events: auto;
}

.analysis-preview .card-svg {
  height: 34px;
  opacity: 0.7;
}

.analysis-preview[aria-pressed="true"] {
  outline: 2px solid #d3cce9;
}

.analysis-card-preview {
  margin-top: 12px;
}

.analysis-metrics {
  display: grid;
  gap: 7px;
}

.analysis-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.analysis-metrics dd {
  margin: 0;
  color: #edf3f7;
  text-align: right;
}

#placeAnalysisBtn {
  margin-top: 10px;
  font-size: 0.75rem;
}

.development-tools {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--board-edge);
}

.game-test-panel {
  border-color: color-mix(in srgb, var(--accent, #e5b95c) 55%, transparent);
}

.game-test-panel > summary {
  color: var(--accent, #e5b95c);
  font-weight: 800;
}

.game-test-panel fieldset,
.game-test-panel details {
  margin-block: 0.75rem;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 0.55rem;
  padding: 0.65rem;
}

.game-test-panel label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.78rem;
}

.game-test-panel input,
.game-test-panel select,
.game-test-panel textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.game-test-panel pre {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.game-test-seat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.55rem;
}

@media (max-width: 420px) {
  .game-test-seat-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.development-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.development-grid button,
#returnLiveBtn {
  min-height: 36px;
  padding: 0.45rem;
  font-size: 0.68rem;
}

#replayControls {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid #6c648555;
  border-radius: 7px;
  background: #181d2b;
}

#developmentStatus {
  min-height: 1.2em;
  margin: 0;
}

#developmentStatus.error {
  color: #ef9b9e;
}

.terminal-panel {
  border-color: #a89bcf;
}

button.placement:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .topbar {
    min-height: 60px;
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    align-items: center;
  }

  .topbar h1 {
    font-size: 1.25rem;
  }

  .card-theme-control {
    margin-left: auto;
  }

  .version {
    display: none;
  }

  .game-layout {
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .board-panel {
    order: -1;
    height: 56svh;
    min-height: 330px;
    padding: 10px;
  }

  .game-panel {
    overflow: visible;
    min-width: 0;
    border-right: 0;
    border-top: 1px solid var(--board-edge);
  }

  .hand-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .hand-card .tile-small {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }

  .hand-card > span:last-child {
    font-size: 0.6rem;
  }

  .community-area {
    max-width: 350px;
  }

  .board-controls {
    left: 10px;
    right: auto;
    gap: 4px;
  }

  .board-controls button {
    padding: 0.5rem;
    font-size: 0.7rem;
  }

  .board-help {
    font-size: 0.58rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Phase Two uses the existing table, tile dimensions, and camera. */
#phaseTwoPanel {
  display: grid;
  gap: 12px;
}

.rule-notice {
  padding: 9px;
  border-left: 2px solid #e7c762;
  background: #e7c7620c;
  font-size: 0.75rem;
}

.public-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.public-tokens span {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #0d1519;
  font-size: 10px;
  font-weight: 800;
}

.player-chip small {
  display: block;
  font-size: 0.57rem;
}

.phase-two-piles,
.target-choices {
  display: grid;
  gap: 8px;
}

.pile-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.pile-pair .deck {
  min-height: 120px;
  height: auto;
  width: 100%;
  font-size: 0.75rem;
}

.discard-pile {
  padding: 8px;
  border: 1px solid var(--board-edge);
  border-radius: 8px;
  font-size: 0.68rem;
  min-width: 0;
}

.discard-pile .tile-small {
  display: block;
  margin: 8px auto;
}

.discard-pile ol {
  padding-left: 18px;
}

.utility-symbol {
  display: grid;
  place-items: center;
  min-height: 60px;
  border: 1px solid #cab88a;
  border-radius: 5px;
  padding: 4px;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.pawn-marker {
  position: absolute;
  z-index: 3;
  left: 38%;
  top: 20%;
  width: 24%;
  height: 40%;
  display: grid;
  place-items: center;
  border-radius: 45% 45% 25% 25%;
  border: 3px solid #f2f5f6;
  background: var(--pawn-color);
  color: #0d1519;
  font-weight: 900;
  box-shadow: 0 4px 6px #0009;
  pointer-events: none;
}

.obstacle-marker {
  position: absolute;
  z-index: 3;
  inset: 20% 6%;
  display: grid;
  place-items: center;
  background: #141c24e8;
  border: 4px double #e6b994;
  color: #f4e0d0;
  text-transform: uppercase;
  font-weight: 800;
  pointer-events: none;
}

button.phase-two-target {
  pointer-events: auto;
  border: 2px dashed #c9e5f2;
  background: #95cbe023;
  box-shadow: none;
  z-index: 2;
}

.phase-two-target .card-svg {
  opacity: 0.5;
}

.phase-two-target .placement-caption {
  color: #fff;
  background: #14232cee;
  white-space: normal;
}

.phase-two-target:focus-visible,
.phase-two-target:hover:not(:disabled) {
  border-color: #fff;
  background: #b3d9e755;
}

#movementRoute {
  overflow-wrap: anywhere;
  max-height: 130px;
  overflow-y: auto;
}

#trapHandoffDialog {
  width: min(32rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 1.25rem;
  border: 1px solid var(--board-edge);
  border-radius: 12px;
  background: var(--panel-bg);
  color: inherit;
}

#trapHandoffDialog::backdrop {
  background: #0d1519;
}

#trapHandoffDialog h2,
#trapHandoffDialog p {
  margin-bottom: 1rem;
}

/* Stage 7 — Minimal controls the complete light technical interface. Legacy
   deliberately retains the preceding dark rules above as an immediate rollback. */
html[data-card-theme="minimal"] {
  color-scheme: light;
  --page-bg: #f3f2ec;
  --panel-bg: #fbfaf5;
  --board-edge: #b8c2c2;
  --grid-line: #cbd3d1;
  --muted: #52636a;
  color: #1d282c;
  background: var(--page-bg);
}

html[data-card-theme="minimal"] body {
  background:
    linear-gradient(#ffffff88, #ffffff88),
    repeating-linear-gradient(0deg, transparent 0 23px, #dce2df66 23px 24px),
    var(--page-bg);
}

html[data-card-theme="minimal"] button,
html[data-card-theme="minimal"] input,
html[data-card-theme="minimal"] select,
html[data-card-theme="minimal"] textarea {
  border-color: #aebabb;
  color: #1d282c;
  background: #fffef9;
  box-shadow: none;
}

html[data-card-theme="minimal"] button:hover:not(:disabled) {
  background: #eaf0ee;
  border-color: #607982;
}

html[data-card-theme="minimal"] button:active:not(:disabled) {
  transform: translateY(1px);
}

html[data-card-theme="minimal"] button:focus-visible,
html[data-card-theme="minimal"] input:focus-visible,
html[data-card-theme="minimal"] select:focus-visible,
html[data-card-theme="minimal"] textarea:focus-visible,
html[data-card-theme="minimal"] .board-viewport:focus-visible {
  outline: 3px solid #195d78;
  outline-offset: 3px;
}

html[data-card-theme="minimal"] button.primary {
  color: #fff;
  background: #244f60;
  border-color: #244f60;
}

html[data-card-theme="minimal"] button.primary:hover:not(:disabled) {
  background: #173d4d;
}

html[data-card-theme="minimal"] button.quiet {
  color: #345968;
  background: transparent;
}

html[data-card-theme="minimal"] button:disabled {
  color: #778486;
  background: #edf0ed;
  border-color: #d0d7d4;
  opacity: 1;
}

html[data-card-theme="minimal"] .topbar {
  background: #fffef9;
  border-bottom: 2px solid #aebabb;
  box-shadow: 0 2px 10px #263a3d12;
}

html[data-card-theme="minimal"] .topbar h1 {
  font-weight: 750;
  letter-spacing: -0.055em;
}

html[data-card-theme="minimal"] .version,
html[data-card-theme="minimal"] .eyebrow,
html[data-card-theme="minimal"] .badge,
html[data-card-theme="minimal"] .table-label {
  color: #435860;
}

html[data-card-theme="minimal"] .badge {
  background: #eff3f0;
  border-color: #b9c5c2;
}

html[data-card-theme="minimal"] .card-theme-control {
  color: #334e58;
}

html[data-card-theme="minimal"] .card-theme-control select {
  background: #f8faf7;
}

html[data-card-theme="minimal"] .game-panel {
  background: #fbfaf5;
  border-right-color: #bfc8c5;
  box-shadow: 8px 0 20px #243b4010;
}

html[data-card-theme="minimal"] .player-chip {
  background: #f6f7f3;
  border-color: #cbd2cf;
}

html[data-card-theme="minimal"] .player-chip.active {
  background: #e8f0ed;
  outline: 2px solid var(--player-color);
}

html[data-card-theme="minimal"] .turn-banner {
  border-left-width: 4px;
  background: linear-gradient(90deg, #f2f6f3, transparent);
  padding-block: 6px;
}

html[data-card-theme="minimal"] .steps li {
  color: #68767a;
  border-left-color: #c6cfcc;
  background: #f7f8f5;
}

html[data-card-theme="minimal"] .steps li.active {
  color: #173943;
  border-color: var(--active-color);
  background: #e9f0ed;
  font-weight: 700;
}

html[data-card-theme="minimal"] .steps li.passed {
  color: #416958;
}

html[data-card-theme="minimal"] .hand-card {
  background: #eff2ee;
  border: 1px solid #c5cfcb;
  border-radius: 5px;
}

html[data-card-theme="minimal"] .hand-card.selected {
  outline: 3px solid var(--active-color);
  background: #fffef9;
}

html[data-card-theme="minimal"] .deck {
  color: #1d282c;
  background:
    repeating-linear-gradient(135deg, #edf3f0 0 9px, #dbe5e1 9px 10px), #edf3f0;
  border-color: #91a6a6;
  box-shadow:
    3px 3px 0 #c9d3cf,
    0 7px 14px #263a3d18;
}

html[data-card-theme="minimal"] .deck:enabled {
  border-color: #315d6d;
}

html[data-card-theme="minimal"] .drawn-preview,
html[data-card-theme="minimal"] .discard-pile,
html[data-card-theme="minimal"] .complete-panel,
html[data-card-theme="minimal"] #replayControls,
html[data-card-theme="minimal"] .game-test-panel,
html[data-card-theme="minimal"] .analysis-metrics div {
  background: #fffef9;
  border-color: #bec9c6;
  color: #1d282c;
}

html[data-card-theme="minimal"] .instruction,
html[data-card-theme="minimal"] .rule-notice {
  color: #243d46;
  background: #eef4f2;
  border-left-color: var(--active-color);
}

html[data-card-theme="minimal"] .board {
  background: #e7ece8;
  border-color: #8ea1a2;
  box-shadow:
    inset 0 0 32px #39535912,
    0 12px 28px #263a3d16;
}

html[data-card-theme="minimal"] .board-grid {
  border-color: #82989a;
  background-color: #edf1ee;
  background-image:
    linear-gradient(#cad4d1 1px, transparent 1px),
    linear-gradient(90deg, #cad4d1 1px, transparent 1px),
    linear-gradient(#ffffff70 1px, transparent 1px),
    linear-gradient(90deg, #ffffff70 1px, transparent 1px);
  box-shadow: inset 0 0 0 1px #ffffffb0;
}

html[data-card-theme="minimal"] .table-label,
html[data-card-theme="minimal"] .board-controls button {
  color: #284550;
  background: #fffef9e8;
  border-color: #9eafaf;
}

html[data-card-theme="minimal"] .board-help {
  color: #3d535b;
}

html[data-card-theme="minimal"] button.placement,
html[data-card-theme="minimal"] button.phase-two-target {
  border-color: #35677a;
  background: #b9d6dc66;
}

html[data-card-theme="minimal"] .placement-caption,
html[data-card-theme="minimal"] .phase-two-target .placement-caption {
  color: #fff;
  background: #214a59e8;
}

html[data-card-theme="minimal"] .analysis-cell,
html[data-card-theme="minimal"] .analysis-toggle[aria-pressed="true"] {
  background: #deece7;
  border-color: #62847d;
}

html[data-card-theme="minimal"] .utility-symbol {
  background: #fffef9;
  border-color: #b8c7c4;
}

html[data-card-theme="minimal"] .obstacle-marker {
  color: #493523;
  background: #fff6e7f2;
  border-color: #aa754a;
}

html[data-card-theme="minimal"] dialog,
html[data-card-theme="minimal"] #trapHandoffDialog {
  color: #1d282c;
  background: #fffef9;
  border-color: #8fa4a5;
  box-shadow: 0 20px 55px #263a3d44;
}

html[data-card-theme="minimal"] dialog::backdrop,
html[data-card-theme="minimal"] #trapHandoffDialog::backdrop {
  background: #e7ece8f5;
}

html[data-card-theme="minimal"] .terminal-panel,
html[data-card-theme="minimal"] #developmentStatus.error {
  color: #842f35;
  border-color: #b95b61;
  background: #fff2f1;
}

html[data-card-theme="minimal"] details,
html[data-card-theme="minimal"] summary {
  color: #36505a;
  border-color: #c5cfcb;
}

html[data-card-theme="minimal"] .minimal-card-svg .minimal-outer {
  fill: #fffef9;
}

@media (prefers-reduced-motion: no-preference) {
  html[data-card-theme="minimal"] {
    --motion-fast: 100ms;
    --motion-select: 160ms;
    --motion-settle: 200ms;
    --motion-turn: 180ms;
    --motion-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  html[data-card-theme="minimal"] button,
  html[data-card-theme="minimal"] .hand-card,
  html[data-card-theme="minimal"] .player-chip,
  html[data-card-theme="minimal"] .game-panel,
  html[data-card-theme="minimal"] .board {
    transition:
      background-color var(--motion-fast) var(--motion-ease),
      border-color var(--motion-fast) var(--motion-ease),
      outline-color var(--motion-fast) var(--motion-ease),
      box-shadow var(--motion-select) var(--motion-ease),
      transform var(--motion-select) var(--motion-ease);
  }

  html[data-card-theme="minimal"] .hand-card:hover:not(:disabled),
  html[data-card-theme="minimal"] .hand-card:focus-visible {
    transform: translateY(-2px);
  }

  html[data-card-theme="minimal"] #handGrid.motion-select .hand-card.selected,
  html[data-card-theme="minimal"]
    #phaseTwoHand.motion-select
    .hand-card.selected {
    animation: minimal-select var(--motion-select) var(--motion-ease);
  }

  html[data-card-theme="minimal"] #handGrid.motion-rotate .hand-card.selected,
  html[data-card-theme="minimal"]
    #phaseTwoHand.motion-rotate
    .hand-card.selected {
    animation: minimal-rotate var(--motion-settle) var(--motion-ease);
  }

  html[data-card-theme="minimal"] .motion-settle {
    animation: minimal-settle var(--motion-settle) var(--motion-ease);
  }

  html[data-card-theme="minimal"] .motion-turn {
    animation: minimal-turn var(--motion-turn) var(--motion-ease);
  }

  @keyframes minimal-select {
    from {
      transform: translateY(0);
    }
    55% {
      transform: translateY(-3px);
    }
    to {
      transform: translateY(0);
    }
  }

  @keyframes minimal-rotate {
    from {
      transform: rotate(0deg);
    }
    55% {
      transform: rotate(1deg);
    }
    to {
      transform: rotate(0deg);
    }
  }

  @keyframes minimal-settle {
    from {
      opacity: 0.985;
    }
    to {
      opacity: 1;
    }
  }

  @keyframes minimal-turn {
    from {
      transform: translateY(-2px);
    }
    to {
      transform: translateY(0);
    }
  }
}

@media (max-width: 900px) {
  html[data-card-theme="minimal"] .game-panel {
    border-top-color: #bfc8c5;
    box-shadow: 0 -6px 18px #263a3d10;
  }
}
