:root {
  --ink: #241a13;
  --muted: #6b5a48;
  --paper: #f8f3e7;
  --panel: #fffaf0;
  --line: #d6c4a7;
  --yellow: #ffd447;
  --blue: #52a7ff;
  --grave: #050505;
  --water: #7cc8d8;
  --danger: #d64f3f;
  --good: #268b4a;
  --terrain-firestorm: #a74432;
  --terrain-earthquake: #f3df91;
  --terrain-flood: #1f6fb2;
  --terrain-whirlwind: #d8dde1;
  --hex-shape: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #7c674f;
  border-radius: 7px;
  background: #2f251b;
  color: #fffaf0;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

button.secondary {
  background: #fffaf0;
  color: var(--ink);
}

button.active {
  background: #8c5d2e;
}

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

input,
select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 0.45rem 0.55rem;
}

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

.app-shell {
  width: min(1500px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px 0 32px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.topbar {
  grid-column: 1;
  grid-row: 1 / span 5;
  position: sticky;
  top: 10px;
  z-index: 120;
  padding: 0;
}

.view,
.notice {
  grid-column: 2;
}

.session-form {
  display: grid;
  gap: 12px;
}

.session-form label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.session-form [hidden] {
  display: none;
}

.session-primary-row,
.session-join-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.session-card {
  width: min(620px, 100%);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.session-form input {
  width: 92px;
  text-transform: uppercase;
}

.notice {
  min-height: 32px;
  padding: 8px 0;
  color: var(--danger);
  font-weight: 650;
}

.tabs {
  display: grid;
  gap: 6px;
  min-width: 150px;
  padding: 8px;
}

.tab {
  background: #fffaf0;
  color: var(--ink);
  text-align: left;
}

.tab.active {
  background: #2f251b;
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-menu {
  position: relative;
}

.view-menu summary {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #7c674f;
  border-radius: 7px;
  background: #2f251b;
  color: #fffaf0;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 900;
  list-style: none;
}

.view-menu summary::-webkit-details-marker {
  display: none;
}

.view-menu .tabs {
  position: absolute;
  top: 0;
  left: calc(100% + 6px);
  z-index: 100;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 24px rgba(36, 26, 19, 0.18);
}

.empty-state {
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.session-empty {
  align-content: center;
  justify-items: center;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(640px, 820px) minmax(560px, 1fr);
  gap: 16px;
  align-items: start;
}

.game-layout.techline-view {
  grid-template-columns: minmax(0, 1fr);
}

.game-layout.techline-view .panel-status {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

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

.status-strip,
.action-bar,
.side-panel,
.lab-output,
.fit-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-strip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: #efe1c8;
  padding: 0.32rem 0.58rem;
  font-weight: 700;
}

.status-pill.danger-pill {
  background: #f8d5ce;
  color: #9d2f22;
}

.status-pill.team-yellow,
.score-yellow {
  background: #ffe58a;
  color: #3d2d06;
}

.status-pill.team-blue,
.score-blue {
  background: #b9dcff;
  color: #103655;
}

.status-pill.team-yellow,
.status-pill.team-blue {
  border: 1px solid rgba(36, 26, 19, 0.18);
}

.score-pill {
  gap: 4px;
  padding: 0.18rem 0.3rem;
}

.score-yellow,
.score-blue {
  border-radius: 999px;
  padding: 0.14rem 0.34rem;
}

.status-pill.danger-pill {
  border-color: #efb4aa;
  background: #f8d5ce;
  color: #9d2f22;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.ui-icon {
  width: 18px;
  height: 18px;
}

.board-selector {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.winner-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border: 3px solid #2d2118;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 12px 28px rgba(36, 26, 19, 0.18);
}

.winner-banner strong {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1;
}

.winner-banner.winner-yellow {
  background: #ffd447;
  color: #241a13;
}

.winner-banner.winner-blue {
  background: #52a7ff;
  color: #071d32;
}

.info-button {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  padding: 0;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.map-wrap {
  height: clamp(640px, calc(100vh - 92px), 920px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ecd9b8;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: none;
}

.techline-wrap {
  height: clamp(640px, calc(100vh - 92px), 920px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1e5cf;
}

.techline-pane {
  min-width: 980px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.techline-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: start;
}

.techline-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.techline-header p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.techline-credit-box {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.techline-credit-box strong {
  font-size: 2rem;
  line-height: 1;
}

.techline-credit-box small,
.techline-cell small {
  color: var(--muted);
  font-size: 0.72rem;
}

.techline-rows {
  display: grid;
  gap: 14px;
}

.techline-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.techline-row-label {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-weight: 900;
}

.techline-cells {
  display: flex;
  gap: 8px;
}

.techline-cell {
  position: relative;
  width: 132px;
  min-height: 235px;
  flex: 0 0 132px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px 7px;
}

.techline-cell.teched {
  border-color: #8c5d2e;
  background: #fff6e7;
}

.techline-cell.available {
  border-color: #2fa45a;
  background: #f2fbf0;
}

.techline-order {
  position: absolute;
  top: 5px;
  left: 6px;
  border-radius: 999px;
  background: #efe1c8;
  padding: 2px 5px;
  font-size: 0.68rem;
  font-weight: 900;
}

.techline-token {
  width: 80px;
  height: 70px;
  position: relative;
}

.techline-token .unit-token {
  inset: 4px;
  font-size: 0.65rem;
}

.techline-token .unit-name {
  display: none;
}

.tech-card {
  width: 80px;
  height: 70px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 2px solid #8c5d2e;
  border-radius: 8px;
  background: #fff6e7;
  text-align: center;
  padding: 6px;
}

.tooltip-trigger {
  position: relative;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #8c5d2e;
  border-radius: 999px;
  background: #fff6e7;
  color: #5c3c1c;
  font-family: Georgia, serif;
  font-weight: 900;
  cursor: help;
}

.ui-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 300;
  width: min(340px, 75vw);
  border: 1px solid #8c5d2e;
  border-radius: 7px;
  background: #2f251b;
  color: #fffaf0;
  padding: 8px 10px;
  box-shadow: 0 8px 22px rgba(36, 26, 19, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tooltip-trigger .ui-tooltip {
  top: calc(100% + 8px);
  right: auto;
  bottom: auto;
  left: 0;
  transform: none;
}

.tooltip-trigger:hover .ui-tooltip,
.tooltip-trigger:focus .ui-tooltip,
.techline-cell.has-tooltip:hover > .ui-tooltip,
.techline-cell.has-tooltip:focus > .ui-tooltip {
  opacity: 1;
  visibility: visible;
}

.techline-item-tooltip {
  bottom: calc(100% - 8px);
  width: 220px;
}

.techline-cell:first-child .techline-item-tooltip {
  left: 0;
  transform: none;
}

.techline-cell:last-child .techline-item-tooltip {
  right: 0;
  left: auto;
  transform: none;
}

.tech-card span {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.techline-credits {
  display: flex;
  gap: 5px;
}

.credit-dot {
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 900;
}

.credit-dot.yellow {
  background: #ffd447;
  color: #241a13;
}

.credit-dot.blue {
  background: #52a7ff;
  color: #071d32;
}

.map-wrap.panning {
  cursor: grabbing;
  user-select: none;
}

.hex-map {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.hex-map-inner {
  position: relative;
  transform-origin: 0 0;
}

.path-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.path-history,
.path-preview {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.path-history {
  stroke: rgba(47, 37, 27, 0.42);
  stroke-width: 5;
}

.path-preview {
  stroke: #df5b42;
  stroke-width: 7;
  stroke-dasharray: 12 7;
}

.hex {
  position: absolute;
  width: 80px;
  height: 70px;
  clip-path: var(--hex-shape);
  --hex-fill: #d7b87c;
  --hex-border: rgba(54, 42, 30, 0.32);
  --hex-border-width: 2px;
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 0;
  touch-action: none;
}

.hex::before,
.hex::after {
  content: "";
  position: absolute;
  clip-path: var(--hex-shape);
  pointer-events: none;
}

.hex::before {
  inset: 0;
  background: var(--hex-border);
  z-index: 0;
}

.hex::after {
  inset: var(--hex-border-width);
  background: var(--hex-fill);
  z-index: 1;
}

.hex > * {
  z-index: 2;
}

.hex.water,
.hover-hex-preview.water {
  --hex-fill: var(--water);
}

.hex.graveyard,
.hover-hex-preview.graveyard {
  --hex-fill: var(--grave);
  color: white;
}

.hex.terrain-firestorm,
.hover-hex-preview.terrain-firestorm {
  --hex-fill: var(--terrain-firestorm);
  color: #fff6ec;
}

.hex.terrain-earthquake,
.hover-hex-preview.terrain-earthquake {
  --hex-fill: var(--terrain-earthquake);
  color: #31281b;
}

.hex.terrain-flood,
.hover-hex-preview.terrain-flood {
  --hex-fill: var(--terrain-flood);
  color: #edf8ff;
}

.hex.terrain-whirlwind,
.hover-hex-preview.terrain-whirlwind {
  --hex-fill: var(--terrain-whirlwind);
  color: #26313a;
}

.hex.spawn-yellow,
.hover-hex-preview.spawn-yellow {
  --hex-border: rgba(255, 212, 71, 0.95);
  --hex-border-width: 4px;
}

.hex.spawn-blue,
.hover-hex-preview.spawn-blue {
  --hex-border: rgba(82, 167, 255, 0.95);
  --hex-border-width: 4px;
}

.hex.selected {
  --hex-border: #df5b42;
  --hex-border-width: 5px;
  z-index: 5;
}

.hex.tutorial-highlight {
  --hex-border: #2fa45a;
  --hex-border-width: 6px;
  z-index: 6;
}

.hex.tutorial-role-source {
  --hex-border: #238b83;
}

.hex.tutorial-role-destination,
.hex.tutorial-role-graveyard {
  --hex-border: #2fa45a;
}

.hex.tutorial-role-target {
  --hex-border: #d97822;
}

.hex.tutorial-role-danger {
  --hex-border: #d64f3f;
}

.hex.tutorial-role-occupied {
  --hex-border: #d9a514;
}

.hex.tutorial-role-terrain {
  --hex-border: #7c3fb3;
}

.hex.tutorial-role-finisher {
  --hex-border: #326fad;
}

.coord {
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.76rem;
  color: rgba(36, 26, 19, 0.55);
}

.terrain-chip {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 26px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.86);
  color: #302217;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  padding: 2px 1px;
}

.grave-mark {
  position: absolute;
  inset: 23px 0 auto;
  text-align: center;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.terrain-mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  z-index: 2;
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 250, 240, 0.4);
}

.terrain-mark .unit-icon {
  width: 1.12em;
  height: 1.12em;
}

.terrain-flood-mark .unit-icon,
.terrain-whirlwind-mark .unit-icon {
  width: 1.85em;
  height: 1.85em;
}

.unit-token {
  position: absolute;
  inset: 4px;
  clip-path: var(--hex-shape);
  --unit-fill: #f7f0dc;
  --unit-border: #2d2118;
  background: transparent;
  border: 0;
  z-index: 3;
  font-size: 0.65rem;
  line-height: 1;
  overflow: hidden;
  isolation: isolate;
}

.unit-token::before,
.unit-token::after {
  content: "";
  position: absolute;
  clip-path: var(--hex-shape);
  pointer-events: none;
}

.unit-token::before {
  inset: 0;
  background: var(--unit-border);
  z-index: 0;
}

.unit-token::after {
  inset: 3px;
  background: var(--unit-fill);
  z-index: 1;
}

.unit-token * {
  pointer-events: none;
  z-index: 2;
}

.unit-token.yellow {
  --unit-fill: #ffe276;
}

.unit-token.blue {
  --unit-fill: #9bd0ff;
}

.unit-token.on-graveyard {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.unit-token.on-graveyard.yellow {
  --unit-fill: #9a7418;
}

.unit-token.on-graveyard.blue {
  --unit-fill: #1f629a;
}

.unit-token.exhausted {
  filter: grayscale(0.6);
  opacity: 0.72;
}

.unit-token.state-ready {
  --unit-border: #249047;
}

.unit-token.state-moved {
  --unit-border: #7c3fb3;
}

.unit-token.state-attacked {
  --unit-border: #d9861c;
}

.unit-token.state-exhausted {
  --unit-border: #c52f2f;
}

.unit-name {
  position: absolute;
  top: 24px;
  left: 19px;
  right: 19px;
  text-align: center;
  font-size: 0.56rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hex .unit-name {
  display: none;
}

.cost-line {
  position: absolute;
  top: 5px;
  left: 18px;
  right: 18px;
  text-align: center;
  font-weight: 900;
}

.speed-line {
  position: absolute;
  left: 6px;
  top: 25px;
  width: 19px;
  text-align: center;
  font-weight: 800;
  font-size: 0.55rem;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
  white-space: nowrap;
}

.ability-line {
  position: absolute;
  right: 6px;
  top: 21px;
  width: 20px;
  height: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  text-align: right;
  font-size: 0.55rem;
  font-weight: 900;
  overflow: visible;
  line-height: 1;
}

.unit-token.movement-keywords-2 .speed-line {
  width: 31px;
}

.unit-token.ability-keywords-2 .ability-line {
  width: 31px;
}

.terrain-line {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 19px;
  text-align: center;
  font-size: 0.42rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.combat-line {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 10px;
  display: flex;
  gap: 3px;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 0.56rem;
  white-space: nowrap;
  overflow: visible;
}

.combat-line.flurry-combat {
  left: 12px;
  right: 12px;
  bottom: 10px;
  gap: 2px;
  font-size: 0.55rem;
}

.combat-line > span,
.warded {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.stat-value {
  min-width: 0.55em;
  text-align: center;
}

.adjusted-stat,
.health-damaged {
  color: #c92424;
}

.health-boosted {
  color: var(--good);
}

.unit-icon {
  width: 1.08em;
  height: 1.08em;
  display: inline-block;
  flex: 0 0 auto;
  fill: currentColor;
  stroke: currentColor;
  vertical-align: -0.12em;
}

.unit-icon.mirror {
  transform: scaleX(-1);
}

.speed-line .unit-icon {
  width: 1.18em;
  height: 1.18em;
}

.ability-line .unit-icon {
  width: 1em;
  height: 1em;
}

.warded {
  border: 1px solid #c92424;
  border-radius: 999px;
  padding: 0 1px;
}

.side-panel {
  --top-inspector-card-height: clamp(200px, 15.44vw, 222px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "status status"
    "reinforcements hover"
    "research spells"
    "research spells";
  gap: 12px;
  padding: 12px;
}

.panel-status {
  grid-area: status;
  position: relative;
  display: grid;
  grid-template-rows: none;
  gap: 8px;
}

.side-status-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.side-notice {
  border: 1px solid #efb4aa;
  border-radius: 7px;
  background: #fbe5e1;
  color: #9d2f22;
  padding: 7px 9px;
  font-weight: 700;
}

.side-notice.good {
  border-color: #b7d4b6;
  background: #edf8eb;
  color: #205d35;
}

.board-ended-blurb {
  display: grid;
  gap: 3px;
  border: 2px solid currentColor;
  border-radius: 8px;
  padding: 9px 11px;
  line-height: 1.3;
}

.board-ended-blurb.team-yellow {
  background: #fff1ad;
  color: #6c5200;
}

.board-ended-blurb.team-blue {
  background: #d7ebff;
  color: #164d7e;
}

.timer-card {
  min-width: 96px;
  display: grid;
  justify-items: center;
  gap: 1px;
  border: 1px solid #b7d4b6;
  border-radius: 8px;
  background: #edf8eb;
  color: #205d35;
  padding: 7px 10px;
}

.timer-card span {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timer-card strong {
  font-size: 1.35rem;
}

.timer-card.danger {
  border-color: #efb4aa;
  background: #fbe5e1;
  color: #9d2f22;
}

body.timer-flash::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20000;
  pointer-events: none;
  background: rgba(214, 79, 63, 0.28);
}

.panel-reinforcements {
  grid-area: reinforcements;
  align-self: stretch;
  min-height: calc(var(--top-inspector-card-height) + 32px);
}

.panel-research {
  grid-area: research;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.panel-spells {
  grid-area: spells;
  height: 430px;
  min-height: 0;
}

.panel-spells.has-drawback {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.panel-hover {
  grid-area: hover;
  align-self: stretch;
  min-height: calc(var(--top-inspector-card-height) + 32px);
}

.side-section {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.side-section h3 {
  font-size: 1rem;
  margin: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mana-badge {
  border: 1px solid #8c5d2e;
  border-radius: 999px;
  background: #fff6e7;
  color: #5c3c1c;
  padding: 0.22rem 0.48rem;
  font-size: 0.76rem;
  font-weight: 900;
}

.compact-list {
  display: grid;
  gap: 7px;
}

.research-actions {
  align-self: start;
}

.subscription-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #b7d4b6;
  border-radius: 7px;
  background: #edf8eb;
  color: #205d35;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.subscription-summary.warning {
  border-color: #efb4aa;
  background: #fbe5e1;
  color: #9d2f22;
}

.subscription-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.subscription-button {
  min-width: 36px;
  padding: 0.24rem 0.36rem;
  border-color: #1e743c;
  background: #228647;
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
}

.subscription-button.active,
.subscription-pending .unit-token,
.subscription-pending-card {
  outline: 3px solid #2fa45a;
  outline-offset: 2px;
}

.subscription-button.danger-outline {
  outline: 3px solid var(--danger);
  outline-offset: 1px;
}

.subscription-button:disabled {
  background: #d2d2d2;
  border-color: #9d9d9d;
  color: #565656;
}

.active-subscription {
  border-color: #2fa45a;
  background: #f2fbf0;
}

.active-subscription .unit-token {
  --unit-border: #2fa45a;
}

.subscription-bars {
  display: grid;
  gap: 5px;
  margin: 4px 0;
}

.subscription-bar-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
}

.subscription-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e1e6df;
  overflow: hidden;
}

.subscription-bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: #2fa45a;
}

.subscription-hover-layout {
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.subscription-hover-unit {
  min-width: 0;
}

.subscription-hover-unit .hover-unit-name {
  text-align: center;
}

.subscription-hover-requests {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.research-list {
  height: 100%;
  min-height: 150px;
  align-content: stretch;
}

.research-empty {
  min-height: 100%;
  box-sizing: border-box;
  align-content: start;
}

.scroll-list {
  overflow-y: auto;
  padding-right: 4px;
}

.spells-scroll {
  max-height: 398px;
  align-content: start;
  grid-auto-rows: max-content;
}

.panel-spells.has-drawback .spells-scroll {
  max-height: none;
}

/* Expanded game setup, accounts, and optional modes. */
.session-card {
  width: min(1040px, 100%);
  padding: 18px;
}

.session-primary-row {
  display: grid;
  grid-template-columns: 80px 105px 145px minmax(230px, 1.4fr) 150px 130px;
  align-items: end;
}

.session-form input {
  width: 100%;
  text-transform: none;
}

#code-input {
  width: 120px;
  text-transform: uppercase;
}

.account-strip,
.session-buttons,
.captain-inputs,
.timer-pair,
.elo-inputs {
  display: flex;
  gap: 10px;
  align-items: end;
}

.account-strip {
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

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

.timer-setting {
  border: 1px solid rgba(36, 26, 19, 0.16);
  border-radius: 8px;
  padding: 7px;
}

.timer-setting-yellow {
  background: #fff1a9;
  color: #574208 !important;
}

.timer-setting-blue {
  background: #cbe5ff;
  color: #17486d !important;
}

.mode-toggles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.mode-toggles legend {
  padding: 0 5px;
  color: var(--ink);
  font-weight: 800;
}

.mode-toggles label {
  grid-template-columns: auto 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f3e8d5;
  padding: 9px;
  color: var(--ink);
  font-weight: 750;
}

.mode-toggles input {
  width: 18px;
  height: 18px;
}

.mode-toggles small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 500;
}

.drawbacks-settings {
  display: grid;
  gap: 10px;
  border: 2px solid #70452e;
  border-radius: 8px;
  background: #efe0d2;
  padding: 12px;
}

.drawbacks-settings[hidden] {
  display: none;
}

.captain-inputs > label {
  flex: 1;
  border-radius: 7px;
  padding: 8px;
}

.captain-inputs .team-yellow {
  background: #fff0a5;
}

.captain-inputs .team-blue {
  background: #c9e4ff;
}

.drawback-overrides {
  display: grid;
  gap: 7px;
  max-height: 280px;
  overflow: auto;
}

.assignment-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 8px;
  align-items: end;
  border-top: 1px solid rgba(36, 26, 19, 0.13);
  padding-top: 7px;
}

.account-dialog {
  width: min(820px, calc(100vw - 28px));
  border: 2px solid #5d422d;
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 22px;
  box-shadow: 0 24px 70px rgba(25, 15, 8, 0.42);
}

.account-dialog::backdrop {
  background: rgba(28, 20, 14, 0.66);
}

.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.account-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.3fr;
  gap: 20px;
}

.account-form {
  display: grid;
  align-content: start;
  gap: 10px;
}

.account-form label {
  display: grid;
  gap: 4px;
}

.elo-inputs > label {
  flex: 1;
}

.elo-guide {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}

.elo-guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.elo-estimate {
  display: grid;
  gap: 3px;
}

.elo-estimate > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px dotted var(--line);
  font-size: 0.8rem;
}

.spawn-command {
  border: 2px solid #3f7b45;
  background: #2f8a49;
  font-size: 1rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.winner-banner.winner-draw {
  background: linear-gradient(90deg, #ffd447 0 50%, #52a7ff 50% 100%);
}

.drawback-pill,
.panel-drawback {
  border-color: #845139 !important;
  background: #e8d4c3 !important;
  color: #4d2c20 !important;
}

.panel-drawback p {
  margin: 6px 0;
  line-height: 1.35;
}

.panel-drawback {
  border: 1px solid;
  border-radius: 7px;
  padding: 8px;
}

.drawback-target {
  --hex-border: #b51964;
  --hex-border-width: 6px;
}

.drawback-target-mark {
  position: absolute;
  z-index: 8;
  right: 9px;
  bottom: 9px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #b51964;
  color: white;
  font-weight: 900;
}

.unit-token.drawback-marked {
  filter: drop-shadow(0 0 5px #c51463);
}

.drawback-unit-mark {
  position: absolute;
  z-index: 8;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #a20f51;
  color: white;
  padding: 1px 4px;
  font-size: 0.42rem;
  font-weight: 900;
  white-space: nowrap;
}

.exile-unit-button {
  width: 100%;
  margin-top: 8px;
  border-color: #7e2430;
  background: #a62f3f;
}

.hover-lock-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

/* Netherworld is board-independent, like the Techline. */
.netherworld-wrap {
  height: clamp(640px, calc(100vh - 92px), 920px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: radial-gradient(circle at 50% 0, #3c2943, #160f1b 72%);
  color: #f8ecda;
}

.netherworld-pane {
  min-width: 960px;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.netherworld-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.netherworld-header p,
.owned-token p,
.token-copy p {
  color: inherit;
  opacity: 0.84;
  line-height: 1.3;
}

.token-deck {
  border: 1px solid #8e6d93;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.08);
  padding: 10px;
}

.token-deck summary {
  cursor: pointer;
  font-weight: 850;
}

.token-deck ol {
  max-height: 360px;
  overflow: auto;
  margin-bottom: 0;
}

.token-deck li {
  margin-bottom: 7px;
  padding-left: 4px;
}

.token-deck li span {
  display: block;
  opacity: 0.74;
  font-size: 0.78rem;
}

.auction-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.token-auction {
  display: grid;
  justify-items: center;
  gap: 9px;
}

.token-triangle {
  position: relative;
  width: 320px;
  height: 277px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #f2c76c, #8d4d53 72%);
  color: #261821;
}

.facing-viewer .token-triangle {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  padding: 22px 52px 68px;
}

.facing-opponent .token-triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  padding: 68px 52px 22px;
}

.token-copy {
  display: grid;
  gap: 5px;
  max-width: 168px;
  text-align: center;
  font-size: 0.76rem;
}

.token-copy > strong {
  font-size: 1.15rem;
}

.token-bid {
  position: absolute;
  z-index: 3;
  display: flex;
  gap: 5px;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.9);
  padding: 3px 8px;
  font-size: 0.72rem;
}

.token-bid-top {
  top: 10px;
}

.token-bid-bottom {
  bottom: 10px;
}

.facing-viewer .token-bid-bottom {
  bottom: 52px;
}

.facing-opponent .token-bid-top {
  top: 52px;
}

.auction-actions,
.token-use-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: end;
  justify-content: center;
}

.auction-actions label {
  display: flex;
  align-items: center;
  gap: 3px;
}

.auction-actions input {
  width: 64px;
}

.token-acted {
  color: #cdbbd0;
  font-size: 0.8rem;
}

.controlled-token-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.controlled-supply {
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9px;
  padding: 12px;
}

.controlled-supply.team-yellow {
  background: rgba(255, 212, 71, 0.12);
}

.controlled-supply.team-blue {
  background: rgba(82, 167, 255, 0.13);
}

.controlled-supply > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.owned-token {
  display: grid;
  gap: 6px;
  border: 1px solid #9f7e9e;
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.11);
  padding: 10px;
}

.netherworld-unit .unit-token {
  margin: 2px auto;
  transform: scale(0.78);
}

.domination-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 2px solid #8f214b;
  border-radius: 8px;
  background: #f3d7df;
  color: #4c1429;
  padding: 9px;
}

@media (max-width: 900px) {
  .session-primary-row,
  .mode-toggles,
  .account-grid,
  .elo-guide-grid,
  .controlled-token-grid,
  .netherworld-header {
    grid-template-columns: 1fr;
  }

  .assignment-row {
    grid-template-columns: 1fr;
  }

  .netherworld-pane {
    min-width: 720px;
  }
}

.hex.blockaded,
.hover-hex-preview.blockaded {
  --hex-border-width: 6px;
  --hex-border: #24180f;
  --hex-fill: repeating-linear-gradient(135deg, #d8b06b 0 8px, #4b3522 8px 14px);
}

.hex.blockade-yellow {
  --hex-border: #a47a00;
}

.hex.blockade-blue {
  --hex-border: #185e9e;
}

.blockade-mark {
  position: absolute;
  inset: 13px 8px 8px;
  z-index: 7;
  display: grid;
  align-content: center;
  gap: 4px;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(255, 244, 215, 0.65));
}

.blockade-mark > span {
  display: block;
  height: 5px;
  border: 2px solid #23170e;
  border-radius: 2px;
  background: #9a6738;
  transform: rotate(-8deg);
}

.blockade-mark > span:nth-child(2) {
  transform: rotate(7deg);
}

.blockade-mark strong {
  padding: 1px 2px;
  border-radius: 2px;
  background: rgba(35, 23, 14, 0.92);
  color: #fff4d7;
  font-size: 0.55rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-align: center;
}

.hex.origin-displacement,
.hex.origin-terrain {
  --hex-border-width: 5px;
  --hex-border: rgba(74, 49, 29, 0.78);
}

.hex.origin-displacement-yellow {
  --hex-border: rgba(177, 136, 0, 0.9);
}

.hex.origin-displacement-blue {
  --hex-border: rgba(24, 94, 163, 0.9);
}

.origin-mark {
  position: absolute;
  top: 11px;
  right: 15px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(44, 31, 20, 0.7);
  border-radius: 999px;
  background: rgba(255, 249, 231, 0.94);
  color: #39291d;
  font-size: 0.68rem;
  font-weight: 900;
}

.actions-scroll {
  max-height: 220px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 8px;
  display: grid;
  gap: 5px;
}

.mini-card strong {
  font-size: 0.94rem;
}

.bench-unit {
  width: 80px;
  height: 70px;
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: grab;
  touch-action: none;
}

.bench-unit:active {
  cursor: grabbing;
}

.bench-unit.active {
  outline: 0;
}

.bench-unit.active .unit-token {
  --unit-border: #df5b42;
}

.bench-unit .unit-name {
  display: none;
}

.panel-reinforcements .compact-list,
.reinforcement-list {
  align-content: start;
}

.panel-reinforcements > .compact-list {
  height: 100%;
  min-height: var(--top-inspector-card-height);
}

.panel-reinforcements .mini-card,
.research-bench-list .mini-card {
  justify-items: start;
}

.reinforcement-list {
  display: grid;
  gap: 7px;
}

.reinforcement-list.single {
  grid-template-columns: 1fr;
  height: 100%;
  min-height: var(--top-inspector-card-height);
}

.reinforcement-list.dense {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.reinforcement-list.scrollable {
  max-height: var(--top-inspector-card-height);
  overflow-y: auto;
  padding-right: 4px;
}

.reinforcement-list.dense .mini-card {
  min-width: 0;
  padding: 5px;
  gap: 4px;
  font-size: 0.72rem;
}

.reinforcement-list.dense .mini-card strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
}

.reinforcement-list.dense .bench-stats,
.reinforcement-list.dense .bench-help {
  display: none;
}

.reinforcement-list.single .bench-unit {
  width: 112px;
  height: 98px;
}

.reinforcement-list.single .mini-card,
.panel-reinforcements > .compact-list > .mini-card {
  height: 100%;
  min-height: var(--top-inspector-card-height);
  box-sizing: border-box;
}

.reinforcement-list.single .unit-token {
  inset: 0;
  font-size: 0.78rem;
}

.reinforcement-list.single .cost-line {
  top: 8px;
  left: 30px;
  right: 30px;
  font-size: 0.88rem;
}

.reinforcement-list.single .speed-line {
  top: 42px;
  left: 13px;
  width: 27px;
  font-size: 0.78rem;
}

.reinforcement-list.single .movement-keywords-2 .speed-line {
  width: 44px;
}

.reinforcement-list.single .ability-line {
  top: 34px;
  right: 13px;
  width: 27px;
  height: 34px;
  font-size: 0.78rem;
}

.reinforcement-list.single .ability-keywords-2 .ability-line {
  width: 44px;
}

.reinforcement-list.single .terrain-line {
  left: 26px;
  right: 26px;
  bottom: 31px;
  font-size: 0.58rem;
}

.reinforcement-list.single .combat-line {
  left: 28px;
  right: 28px;
  bottom: 16px;
  font-size: 0.88rem;
}

.reinforcement-list.single .combat-line.flurry-combat {
  left: 22px;
  right: 22px;
  bottom: 16px;
  font-size: 0.78rem;
}

.reinforcement-list.dense .bench-unit {
  width: 67px;
  height: 59px;
}

.reinforcement-list.dense .unit-token {
  inset: 0;
  font-size: 0.47rem;
}

.reinforcement-list.dense .cost-line {
  top: 4px;
  left: 18px;
  right: 18px;
  font-size: 0.54rem;
}

.reinforcement-list.dense .speed-line {
  top: 23px;
  left: 5px;
  width: 16px;
  font-size: 0.46rem;
}

.reinforcement-list.dense .movement-keywords-2 .speed-line {
  width: 25px;
}

.reinforcement-list.dense .ability-line {
  top: 19px;
  right: 5px;
  width: 16px;
  height: 22px;
  font-size: 0.45rem;
}

.reinforcement-list.dense .ability-keywords-2 .ability-line {
  width: 25px;
}

.reinforcement-list.dense .terrain-line {
  left: 14px;
  right: 14px;
  bottom: 18px;
  font-size: 0.34rem;
}

.reinforcement-list.dense .combat-line {
  left: 16px;
  right: 16px;
  bottom: 9px;
  font-size: 0.54rem;
}

.reinforcement-list.dense .combat-line.flurry-combat {
  left: 10px;
  right: 10px;
  bottom: 9px;
  font-size: 0.46rem;
}

.drag-ghost {
  position: fixed;
  width: 80px;
  height: 70px;
  z-index: 10000;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.05);
  filter: drop-shadow(0 10px 14px rgba(36, 26, 19, 0.35));
}

.drag-ghost .unit-token {
  inset: 0;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
}

.turn-action strong {
  text-transform: capitalize;
}

.log {
  max-height: 170px;
  overflow: auto;
  font-size: 0.83rem;
  color: var(--muted);
}

.history-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 10px;
  z-index: 80;
  width: min(460px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 32px rgba(36, 26, 19, 0.2);
}

.history-popover[hidden] {
  display: none;
}

.history-popover h3 {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.history-popover .actions-scroll {
  max-height: 190px;
}

.history-popover .log {
  max-height: 150px;
}

.hover-card {
  height: var(--top-inspector-card-height);
  min-height: var(--top-inspector-card-height);
  box-sizing: border-box;
  overflow: hidden;
  align-content: start;
}

.hover-props {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.hover-props span {
  border-radius: 999px;
  background: #efe1c8;
  padding: 3px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
}

.hover-hex-preview {
  position: relative;
  width: 133px;
  height: 116px;
  margin: 4px auto 0;
  clip-path: var(--hex-shape);
  --hex-fill: #d7b87c;
  --hex-border: rgba(54, 42, 30, 0.32);
  --hex-border-width: 5px;
  background: transparent;
  color: var(--ink);
  isolation: isolate;
}

.hover-hex-preview::before,
.hover-hex-preview::after {
  content: "";
  position: absolute;
  clip-path: var(--hex-shape);
  pointer-events: none;
}

.hover-hex-preview::before {
  inset: 0;
  background: var(--hex-border);
  z-index: 0;
}

.hover-hex-preview::after {
  inset: var(--hex-border-width);
  background: var(--hex-fill);
  z-index: 1;
}

.hover-hex-preview > * {
  z-index: 2;
}

.hover-hex-preview .coord {
  top: 12px;
  font-size: 0.78rem;
}

.hover-hex-preview .terrain-mark {
  font-size: 1.9rem;
}

.hover-unit-name {
  margin-top: 4px;
  font-weight: 900;
  font-size: 0.9rem;
}

.hover-unit-preview {
  position: relative;
  width: 133px;
  height: 116px;
  margin: 3px auto;
}

.hover-unit-preview .unit-token {
  top: 0;
  left: 0;
  width: 190px;
  height: 166px;
  transform: scale(0.7);
  transform-origin: top left;
  font-size: 0.82rem;
}

.hover-unit-preview .unit-name {
  display: block;
  top: 50px;
  left: 45px;
  right: 45px;
  font-size: 0.78rem;
}

.hover-unit-preview .cost-line {
  top: 14px;
  left: 50px;
  right: 50px;
  font-size: 0.9rem;
}

.hover-unit-preview .speed-line {
  top: 77px;
  left: 17px;
  width: 38px;
  font-size: 1.05rem;
  gap: 2px;
}

.hover-unit-preview .movement-keywords-2 .speed-line {
  width: 58px;
}

.hover-unit-preview .ability-line {
  top: 66px;
  right: 17px;
  width: 38px;
  height: 48px;
  font-size: 1.08rem;
  gap: 3px;
}

.hover-unit-preview .ability-keywords-2 .ability-line {
  width: 58px;
}

.hover-unit-preview .unit-icon {
  width: 1.24em;
  height: 1.24em;
}

.hover-unit-preview .speed-line .unit-icon {
  width: 1.34em;
  height: 1.34em;
}

.hover-unit-preview .ability-line .unit-icon {
  width: 1.18em;
  height: 1.18em;
}

.hover-unit-preview .terrain-line {
  left: 34px;
  right: 34px;
  bottom: 46px;
  font-size: 0.66rem;
  letter-spacing: 0;
}

.hover-unit-preview .combat-line {
  left: 38px;
  right: 38px;
  bottom: 24px;
  font-size: 1.16rem;
}

.hover-unit-preview .combat-line.flurry-combat {
  left: 32px;
  right: 32px;
  bottom: 24px;
  font-size: 1.08rem;
}

.hover-unit-stats,
.hover-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.lab-control {
  display: inline-grid;
  gap: 3px;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.lab-control input {
  width: 82px;
}

.lab-output {
  min-height: 360px;
  padding: 12px;
}

.tutorial-callout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  border: 1px solid #b7d4b6;
  border-left: 5px solid #2fa45a;
  border-radius: 8px;
  background: #f2fbf0;
  color: #205d35;
  padding: 9px 11px;
  line-height: 1.35;
}

.tutorial-copy {
  display: grid;
  gap: 3px;
}

.tutorial-callout button {
  white-space: nowrap;
  background: #205d35;
  border-color: #174728;
}

.tutorial-callout strong {
  font-size: 0.95rem;
}

.tutorial-callout span {
  color: #315b3d;
  font-size: 0.86rem;
}

.tutorial-action-hint {
  max-width: 180px;
  border-radius: 999px;
  background: #dcefdc;
  padding: 0.35rem 0.55rem;
  text-align: center;
  font-weight: 800;
}

.tutorial-control-highlight,
.techline-cell.tutorial-tech-target {
  outline: 4px solid #2fa45a;
  outline-offset: 2px;
}

.tutorial-card-highlight {
  border-color: #8c5d2e;
  box-shadow: 0 0 0 3px rgba(140, 93, 46, 0.18);
}

.unit-lab-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
  align-items: start;
}

.fit-panel {
  padding: 12px;
}

.fit-panel img {
  width: 100%;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.unit-preview {
  width: 300px;
  height: 263px;
  position: relative;
  margin: 16px auto;
}

.unit-preview .unit-token {
  inset: 0;
  font-size: 1.2rem;
}

.unit-preview .unit-name {
  display: block;
  top: 78px;
  left: 72px;
  right: 72px;
  font-size: 1.05rem;
}

.unit-preview .cost-line {
  top: 24px;
  left: 80px;
  right: 80px;
  font-size: 1.25rem;
}

.unit-preview .speed-line {
  top: 121px;
  left: 27px;
  width: 59px;
  font-size: 1.15rem;
  gap: 4px;
}

.unit-preview .movement-keywords-2 .speed-line {
  width: 87px;
}

.unit-preview .ability-line {
  top: 107px;
  right: 27px;
  width: 59px;
  font-size: 0.95rem;
}

.unit-preview .ability-keywords-2 .ability-line {
  width: 87px;
}

.unit-preview .terrain-line {
  left: 54px;
  right: 54px;
  bottom: 73px;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.unit-preview .combat-line {
  left: 65px;
  right: 65px;
  bottom: 32px;
  font-size: 1.4rem;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar,
  .view,
  .notice {
    grid-column: 1;
  }

  .topbar {
    position: static;
  }

  .game-layout,
  .unit-lab-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "status"
      "reinforcements"
      "research"
      "hover"
      "spells";
  }

  .map-wrap,
  .techline-wrap {
    height: clamp(460px, calc(100vh - 210px), 640px);
  }

  .side-status-top,
  .techline-header {
    grid-template-columns: 1fr;
  }

  .techline-pane {
    min-width: 720px;
  }
}

@media (max-width: 700px) {
  .tutorial-callout {
    grid-template-columns: 1fr;
  }

  .tutorial-callout button,
  .tutorial-action-hint {
    justify-self: start;
  }
}
