:root {
  --bg: #f2ead9;
  --paper: #f8f1e3;
  --ink: #2f261d;
  --muted: #73665a;
  --board-edge: #7a5e3e;
  --board-top: #d7b37a;
  --board-bottom: #b48649;
  --field-top: #efe4b9;
  --field-bottom: #d7c17a;
  --field-own-top: #d7d487;
  --field-own-bottom: #b5bf67;
  --river-top: #879da8;
  --river-mid: #5e7582;
  --river-bottom: #3f5662;
  --river-shallow: rgba(163, 183, 193, 0.2);
  --river-sheen: rgba(223, 235, 240, 0.1);
  --river-bank-top: rgba(71, 87, 62, 0.16);
  --river-bank-bottom: rgba(48, 59, 42, 0.18);
  --river-channel-shadow: rgba(24, 38, 46, 0.18);
  --bridge-plank-top: #d4b07a;
  --bridge-plank-mid: #b88047;
  --bridge-plank-bottom: #8a5a2e;
  --bridge-rail: rgba(100, 66, 34, 0.4);
  --bridge-edge: rgba(76, 48, 24, 0.3);
  --bridge-shadow: rgba(22, 32, 38, 0.28);
  --blocked-top: #54514b;
  --blocked-bottom: #2c2a27;
  --forbidden-top: #c8c3bc;
  --forbidden-bottom: #9a948d;
  --forbidden-stripe: rgba(66, 62, 57, 0.14);
  --forbidden-border: rgba(74, 69, 63, 0.42);
  --accent: #ab4b31;
  --accent-soft: #e5c5af;
  --enemy: #8d3b35;
  --ally: #386344;
  --panel: rgba(255, 250, 241, 0.92);
  --shadow: 0 12px 32px rgba(46, 33, 18, 0.18);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(
      circle at top,
      rgba(255, 255, 255, 0.8),
      rgba(255, 255, 255, 0) 35%
    ),
    linear-gradient(180deg, #f8f1df 0%, #eadfc9 48%, #e4d4bd 100%);
  color: var(--ink);
  font-family: "Yu Mincho", serif;
}

body {
  padding: 20px;
}

h1,
.button-primary {
  font-family: "Yuji Syuku", "Yu Mincho", serif;
}
.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.hero,
.board-card,
.guide-drawer,
.modal-sheet {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(122, 94, 62, 0.16);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: 0.08em;
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.hero-actions button {
  white-space: nowrap;
}

.main-column {
  display: grid;
  gap: 18px;
  align-content: start;
}

.board-card {
  padding: 18px;
}

.page-footer {
  padding: 18px 22px;
  background: rgba(255, 247, 235, 0.82);
  border: 1px solid rgba(122, 94, 62, 0.14);
  border-radius: 20px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}

.page-footer p {
  margin: 0;
}

.page-footer p + p {
  margin-top: 8px;
}

.page-footer a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
}

.board-and-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 18px;
  align-items: start;
}

.board-wrap {
  position: relative;
}

.board-grid {
  --board-gap: 8px;
  --board-padding: 14px;
  display: grid;
  position: relative;
  isolation: isolate;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: var(--board-gap);
  padding: var(--board-padding);
  background: linear-gradient(180deg, var(--board-top), var(--board-bottom));
  border-radius: 26px;
  border: 3px solid rgba(86, 63, 36, 0.46);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.2),
    inset 0 -3px 0 rgba(60, 39, 14, 0.18);
  height: 100vh;
}

.board-river-band {
  position: relative;
  z-index: 0;
  grid-column: 1 / -1;
  grid-row: 5;
  align-self: stretch;
  justify-self: stretch;
  pointer-events: none;
  overflow: hidden;
  background:
    /* ① 流線 — 斜めの細い筋が水の方向を暗示 */ repeating-linear-gradient(
      96deg,
      rgba(190, 218, 230, 0) 0px,
      rgba(190, 218, 230, 0.09) 3px,
      rgba(190, 218, 230, 0) 6px,
      rgba(190, 218, 230, 0) 28px
    ),
    /* ② 第2流線 — ①とピッチをずらして不規則さを出す */
      repeating-linear-gradient(
        93deg,
        rgba(170, 205, 220, 0) 0px,
        rgba(170, 205, 220, 0.06) 2px,
        rgba(170, 205, 220, 0) 5px,
        rgba(170, 205, 220, 0) 42px
      ),
    /* ③ 水面の光ムラ — 横方向の明暗で奥行き */
      linear-gradient(
        92deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(210, 230, 240, 0.1) 14%,
        rgba(255, 255, 255, 0) 28%,
        rgba(180, 210, 225, 0.08) 46%,
        rgba(255, 255, 255, 0) 58%,
        rgba(200, 222, 235, 0.06) 76%,
        rgba(255, 255, 255, 0) 100%
      ),
    /* ④ 岸辺のなじみ — 上下端を盤面色へフェード */
      linear-gradient(
        180deg,
        rgba(183, 168, 119, 0.16) 0%,
        rgba(183, 168, 119, 0) 12%,
        rgba(0, 0, 0, 0) 86%,
        rgba(110, 95, 60, 0.14) 100%
      ),
    /* ⑤ ベース水色 — 深い→浅いの縦グラデ */
      linear-gradient(
        180deg,
        var(--river-top) 0%,
        var(--river-mid) 54%,
        var(--river-bottom) 100%
      );
  box-shadow: inset 0 12px 0 var(--river-bank-top),
    inset 0 -12px 0 var(--river-bank-bottom),
    inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(52, 68, 76, 0.16);
}

.board-river-band::before,
.board-river-band::after {
  content: "";
  position: absolute;
  inset: 0;
}

/* 水面の光沢 — 斜めに走るハイライト線 */
.board-river-band::before {
  inset: 14% 0 18%;
  background: linear-gradient(
    102deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(230, 242, 248, 0.11) 8%,
    rgba(255, 255, 255, 0) 16%,
    rgba(255, 255, 255, 0) 30%,
    rgba(220, 236, 244, 0.08) 38%,
    rgba(255, 255, 255, 0) 46%,
    rgba(255, 255, 255, 0) 62%,
    rgba(215, 232, 242, 0.06) 70%,
    rgba(255, 255, 255, 0) 78%,
    rgba(255, 255, 255, 0) 100%
  );
}

/* チャネルの陰影 — 川底の深さを表現 */
.board-river-band::after {
  background: linear-gradient(
    180deg,
    rgba(200, 218, 228, 0.12) 0%,
    rgba(200, 218, 228, 0) 20%,
    rgba(0, 0, 0, 0) 48%,
    var(--river-channel-shadow) 82%,
    rgba(0, 0, 0, 0) 100%
  );
}

button,
.button-like {
  border: 0;
  border-radius: 7px;
  padding: 12px 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  background: linear-gradient(180deg, #f6ead2, #e2cda6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 8px 16px rgba(74, 52, 25, 0.12);
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

button:hover,
.button-like:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 10px 18px rgba(74, 52, 25, 0.18);
}

button:disabled {
  cursor: default;
  opacity: 0.8;
  transform: none;
  box-shadow: none;
  background: rgb(76, 76, 76);
}

.setup-top-overlay {
  position: relative;
  z-index: 6;
  align-self: stretch;
  justify-self: stretch;
  display: grid;
  align-content: center;
  justify-items: center;
  pointer-events: none;
  padding: clamp(14px, 2vw, 22px) clamp(12px, 2vw, 20px);
  background: linear-gradient(
      180deg,
      rgba(8, 10, 13, 0.72),
      rgba(8, 10, 13, 0.52) 50%,
      rgba(8, 10, 13, 0.16) 80%,
      rgba(8, 10, 13, 0)
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  border-radius: 10px 10px 14px 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.setup-top-content {
  pointer-events: auto;
  display: grid;
  gap: 12px;
  padding: 2px 0 0;
}

.setup-overlay-copy {
  margin: 0;
  color: rgba(255, 244, 228, 0.94);
  font-size: 1rem;
  line-height: 1.65;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}

.setup-top-control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 247, 232, 0.14);
}

.setup-difficulty-group {
  display: grid;
  gap: 7px;
}

.setup-top-control-row button {
  width: 50%;
  height: 50px;
  border-radius: 8px;
  margin: 7px auto;
}

.setup-overlay-label {
  display: block;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255, 244, 228, 0.9);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.setup-board-select {
  appearance: none;
  padding: 8px 10px;
  width: 100%;
  height: 44px;
  border: 1px solid rgba(255, 247, 232, 0.24);
  border-radius: 8px;
  background: rgba(255, 250, 243, 0.92);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.setup-board-select:focus {
  outline: 2px solid rgba(171, 75, 49, 0.34);
  outline-offset: 2px;
}

.setup-river-controls {
  position: relative;
  z-index: 7;
  align-self: center;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding-inline: 8px;
  top: -12px;
}

.setup-river-panel {
  pointer-events: auto;
  width: min(100%, 520px);
  display: grid;
  gap: 8px;
  padding: 8px 10px 10px;
  border: 1px solid rgba(244, 239, 228, 0.16);
  border-radius: 12px;
  background: linear-gradient(
    180deg,
    rgba(19, 29, 35, 0.76),
    rgba(19, 29, 35, 0.56)
  );
  box-shadow: 0 10px 18px rgba(10, 16, 20, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.setup-river-label {
  color: rgba(255, 245, 231, 0.92);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-river-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.setup-river-choice-grid button {
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 6px 12px rgba(10, 16, 20, 0.1);
}

.board-node {
  position: relative;
  z-index: 1;
  min-height: 70px;
  border-radius: 10px;
  border: 1px solid rgba(69, 47, 20, 0.24);
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08)),
    linear-gradient(180deg, var(--field-top), var(--field-bottom));
  transition: transform 120ms ease, box-shadow 120ms ease,
    border-color 120ms ease;
}

.board-node::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(12, 10, 8, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  z-index: 2;
}

.board-node.has-dim-overlay::after {
  opacity: 1;
}

.board-node[data-row="6"],
.board-node[data-row="7"],
.board-node[data-row="8"],
.board-node[data-row="9"] {
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.08)),
    linear-gradient(180deg, var(--field-own-top), var(--field-own-bottom));
}

.board-node.is-blocked {
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(180deg, var(--blocked-top), var(--blocked-bottom));
  border-style: dashed;
}

.board-node.is-river {
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.board-node.is-river.has-dim-overlay::after {
  opacity: 0;
}

.board-node.is-bridge {
  border-color: transparent;
}

.board-node.is-bridge::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: calc(var(--board-gap) * -0.18);
  bottom: calc(var(--board-gap) * -0.18);
  left: 22%;
  right: 22%;
  border: 1px solid rgba(104, 70, 36, 0.28);
  background: linear-gradient(
      90deg,
      rgba(97, 64, 35, 0.92) 0%,
      rgba(97, 64, 35, 0.92) 7%,
      rgba(237, 208, 161, 0.16) 7%,
      rgba(237, 208, 161, 0) 11%,
      rgba(237, 208, 161, 0) 89%,
      rgba(237, 208, 161, 0.16) 93%,
      rgba(97, 64, 35, 0.92) 93%,
      rgba(97, 64, 35, 0.92) 100%
    ),
    repeating-linear-gradient(
      180deg,
      rgba(239, 211, 166, 0.12) 0 10px,
      rgba(118, 79, 42, 0.18) 10px 12px,
      rgba(0, 0, 0, 0) 12px 22px
    ),
    linear-gradient(
      180deg,
      var(--bridge-plank-top) 0%,
      var(--bridge-plank-mid) 56%,
      var(--bridge-plank-bottom) 100%
    );
  box-shadow: 0 12px 16px var(--bridge-shadow),
    inset 0 1px 0 rgba(255, 246, 225, 0.18), inset 0 -2px 0 var(--bridge-edge);
}

.board-node.is-hq {
  background: linear-gradient(
      90deg,
      rgba(53, 34, 10, 0) 49.2%,
      rgba(78, 50, 16, 0.45) 50%,
      rgba(53, 34, 10, 0) 50.8%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0)),
    linear-gradient(180deg, #e6dfcb, #bcc8bf);
}

.board-node.is-forbidden {
  border-color: var(--forbidden-border);
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0)
    ),
    repeating-linear-gradient(
      135deg,
      var(--forbidden-stripe) 0 10px,
      rgba(255, 255, 255, 0.03) 10px 20px
    ),
    linear-gradient(180deg, var(--forbidden-top), var(--forbidden-bottom));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.board-node.is-hq.is-forbidden {
  background: linear-gradient(
      90deg,
      rgba(53, 34, 10, 0) 49.2%,
      rgba(78, 50, 16, 0.28) 50%,
      rgba(53, 34, 10, 0) 50.8%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(
      135deg,
      var(--forbidden-stripe) 0 10px,
      rgba(255, 255, 255, 0.03) 10px 20px
    ),
    linear-gradient(180deg, var(--forbidden-top), var(--forbidden-bottom));
}

.board-node.is-forbidden::after {
  opacity: 1;
  background: linear-gradient(
    180deg,
    rgba(55, 52, 48, 0.16),
    rgba(36, 34, 31, 0.22)
  );
}

.board-node.is-clickable:hover,
.board-node.is-drop-target {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 2px rgba(171, 75, 49, 0.26);
}

.board-node.is-selected {
  box-shadow: 0 0 0 3px rgba(171, 75, 49, 0.34),
    inset 0 0 0 2px rgba(255, 255, 255, 0.3) !important;
}

.board-node.is-legal {
  box-shadow: inset 0 0 0 3px rgba(56, 99, 68, 0.52);
}

.board-node.is-last-battle {
  outline: 3px solid rgba(180, 40, 31, 0.88);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 1px rgba(255, 244, 231, 0.76);
}

.board-node-label {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 1;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(47, 38, 29, 0.58);
}

.board-node-note {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 1;
  font-size: 0.72rem;
  color: rgba(47, 38, 29, 0.38);
}

.board-node-note.is-forbidden {
  color: rgba(43, 40, 36, 0.72);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.piece-token {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  width: clamp(36px, 76%, 60px);
  aspect-ratio: 0.84;
  transform: translate(-50%, -50%);
  padding: 10px 6px 7px;
  border: 1px solid rgba(81, 56, 20, 0.18);
  clip-path: polygon(50% 5%, 82% 13%, 94% 90%, 6% 90%, 18% 13%);
  background: linear-gradient(
      180deg,
      rgba(123, 89, 44, 0.08),
      rgba(123, 89, 44, 0.02) 34%,
      rgba(82, 57, 24, 0.08)
    ),
    linear-gradient(180deg, #e2c58c 0%, #cea86a 58%, #bd8f55 100%);
  color: #2e2012;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -2px 0 rgba(100, 68, 31, 0.2), 0 10px 16px rgba(50, 31, 11, 0.16);
  cursor: pointer;
  user-select: none;
  text-align: center;
  font-family: "Yuji Syuku", "Yu Mincho", serif;
}
.is-hq .piece-token {
  width: clamp(36px, 38%, 60px);
}

.piece-face {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: clamp(2px, 0.45vw, 5px);
  pointer-events: none;
  transform-origin: center;
}

.piece-face.is-readable-from-viewer {
  transform: rotate(180deg);
}

.piece-token::before {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: polygon(50% 5%, 82% 13%, 94% 90%, 6% 90%, 18% 13%);
  border: 1px solid rgba(118, 84, 41, 0.22);
  pointer-events: none;
}

.piece-token::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
      90deg,
      rgba(122, 86, 41, 0.05),
      rgba(255, 255, 255, 0.03),
      rgba(122, 86, 41, 0.05)
    ),
    linear-gradient(180deg, rgba(87, 61, 28, 0.02), rgba(87, 61, 28, 0.05));
  clip-path: polygon(50% 5%, 82% 13%, 94% 90%, 6% 90%, 18% 13%);
  pointer-events: none;
}

.piece-token.is-enemy-hidden {
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.14),
      rgba(255, 255, 255, 0.02) 34%,
      rgba(53, 18, 16, 0.08)
    ),
    linear-gradient(180deg, #9b6454 0%, #7b4539 58%, #643228 100%);
  color: #fff3e6;
}

.piece-token.is-ai-owned {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 0 rgba(70, 28, 23, 0.2), 0 10px 16px rgba(63, 18, 16, 0.18);
}

.piece-token.is-opponent-piece {
  transform: translate(-50%, -50%) rotate(180deg);
}

.piece-token.is-static {
  cursor: default;
}

.piece-main {
  max-width: 100%;
  position: relative;
  z-index: 1;
  font-size: clamp(0.74rem, 1.34vw, 0.96rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.22);
}

.piece-token.is-rank-piece .piece-main {
  top: 5px;
}

.piece-sub {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 1.08rem;
}

.officer-badge {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 78%);
  min-height: 1.08rem;
  margin-inline: auto;
  padding: 0.02rem 0;
  --badge-star: #6a4b23;
  --badge-mark: rgba(104, 73, 31, 0.62);
}

.officer-badge.is-general {
  --badge-mark: rgba(213, 37, 37, 0.82);
}

.officer-badge.is-senior {
  --badge-mark: rgba(182, 92, 60, 0.82);
}

.officer-badge.is-junior {
  --badge-mark: rgba(120, 120, 120, 0.82);
}

.officer-mark {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 76%;
  height: 1.5px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: var(--badge-mark);
}

.officer-badge.is-senior .officer-mark {
  background: transparent;
  box-shadow: 0 -2.5px 0 0 var(--badge-mark), 0 2.5px 0 0 var(--badge-mark);
}

.officer-badge.is-general .officer-mark {
  box-shadow: 0 -4px 0 0 var(--badge-mark), 0 4px 0 0 var(--badge-mark);
}

.officer-stars {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  width: min(100%, 2.7rem);
  min-height: 0.96rem;
  padding: 0 0.3rem;
  top: 2px;
}

.officer-star {
  align-self: center;
  justify-self: center;
  font-size: clamp(0.44rem, 0.82vw, 0.56rem);
  line-height: 1;
  color: var(--badge-star);
  text-shadow: 0 0 0.5px rgba(87, 61, 16, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.14);
}

.status-card h3 {
  margin: 0 0 12px;
  font-size: 1.02rem;
}

.status-card {
  background: rgba(255, 247, 235, 0.92);
  border: 1px solid rgba(122, 94, 62, 0.14);
  border-radius: 20px;
  padding: 16px;
}

.status-section {
  display: grid;
  gap: 12px;
}

.status-section + .status-section {
  margin-top: 20px;
}

.info-list {
  display: grid;
  gap: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.info-row strong {
  color: var(--ink);
  font-weight: 600;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-primary {
  background: linear-gradient(180deg, #3ca400, #2b7500);
  color: #fffaf5;
}

.button-secondary {
  background: linear-gradient(180deg, #d8e3d1, #adbba4);
}

.button-x-share {
  background: #111111;
  color: #f5f5f5;
  border: 1px solid #2b2b2b;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 16px rgba(0, 0, 0, 0.24);
}

.button-x-share:hover {
  background: #1b1b1b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 10px 18px rgba(0, 0, 0, 0.28);
}

.button-x-share:focus-visible {
  outline: 2px solid rgba(20, 20, 20, 0.4);
  outline-offset: 2px;
}

.delete-button {
  background: linear-gradient(180deg, #e04b4b, #a83232);
  color: #fff3e6;
}

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

.reserve-piece {
  position: relative;
  min-height: 86px;
}

.reserve-piece .piece-token {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: 0 auto;
}

.reserve-piece.is-selected .piece-token {
  box-shadow: 0 0 0 3px rgba(171, 75, 49, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 10px 16px rgba(50, 31, 11, 0.16);
}

.setup-piece-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 4;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.402);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.setup-piece-remove:hover {
  transform: translateY(-1px);
}

.setup-piece-remove:focus-visible {
  outline: 2px solid rgba(171, 75, 49, 0.45);
  outline-offset: 2px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(56, 99, 68, 0.1);
  color: var(--ally);
  font-size: 0.88rem;
}

.pill.enemy {
  background: rgba(141, 59, 53, 0.1);
  color: var(--enemy);
}

.section-divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(122, 94, 62, 0),
    rgba(122, 94, 62, 0.24),
    rgba(122, 94, 62, 0)
  );
  margin: 12px 0;
}

.log {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.log-entry {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  line-height: 1.55;
  color: var(--muted);
}

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

.matrix {
  overflow: auto;
  min-height: 0;
  border: 1px solid rgba(122, 94, 62, 0.12);
  border-radius: 16px;
}

.matrix-shell {
  position: relative;
  display: grid;
  gap: 8px;
}

.matrix-shell::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 40px;
  bottom: 1px;
  width: 32px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(248, 241, 227, 0),
    rgba(248, 241, 227, 0.92)
  );
  border-radius: 0 16px 16px 0;
}

.matrix table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.86rem;
}

.matrix th,
.matrix td {
  min-width: 3.4rem;
  padding: 8px 10px;
  text-align: center;
  border-right: 1px solid rgba(122, 94, 62, 0.1);
  border-bottom: 1px solid rgba(122, 94, 62, 0.1);
  background: rgba(255, 255, 255, 0.6);
}

.matrix tr > *:first-child {
  border-left: 1px solid rgba(122, 94, 62, 0.1);
}

.matrix thead tr:first-child > * {
  border-top: 1px solid rgba(122, 94, 62, 0.1);
}

.matrix thead th {
  position: sticky;
  top: 0;
  background: rgba(244, 233, 213, 0.98);
  white-space: nowrap;
  z-index: 3;
}

.matrix thead th:first-child {
  left: 0;
  z-index: 4;
}

.matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  white-space: nowrap;
  background: rgba(244, 233, 213, 0.98);
  box-shadow: 1px 0 0 rgba(122, 94, 62, 0.12);
}

.matrix .is-win {
  color: var(--ally);
  font-weight: 700;
}

.matrix .is-loss {
  color: var(--enemy);
  font-weight: 700;
}

.matrix .is-tie {
  color: var(--muted);
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 32, 21, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal-sheet {
  width: min(640px, 100%);
  padding: 24px;
}

.modal-sheet h2 {
  margin: 0;
  font-size: 1.4rem;
}

.modal-sheet p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.overlay-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.guide-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  padding: 20px;
}

.guide-scrim {
  position: absolute;
  inset: 0;
  background: rgba(44, 32, 21, 0.48);
}

.guide-drawer {
  position: relative;
  width: min(420px, 44vw);
  max-height: calc(100vh - 40px);
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.guide-eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
}

.guide-header h2 {
  margin: 0;
  font-size: 1.45rem;
}

.guide-close {
  flex-shrink: 0;
  background: rgb(206, 0, 0);
  color: #fff3e6;
}

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

.guide-tab {
  padding: 12px 6px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
  border: 1px solid rgba(122, 94, 62, 0.12);
  text-align: center;
}

.guide-tab:hover {
  box-shadow: none;
}

.guide-tab.is-active {
  background: linear-gradient(180deg, #d77657, #a14730);
  color: #fffaf5;
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(74, 52, 25, 0.18);
}

.guide-body {
  overflow: auto;
  min-height: 0;
  padding-right: 4px;
}

.guide-body.is-matchup-view {
  display: grid;
  overflow: hidden;
}

.guide-section {
  display: grid;
  gap: 14px;
}

.guide-section.is-matchup {
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.guide-section.is-matchup .matrix-shell {
  min-height: 0;
}

.guide-summary {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.guide-cards,
.movement-list {
  display: grid;
  gap: 12px;
}

.guide-card,
.movement-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(122, 94, 62, 0.12);
}

.guide-card h3,
.movement-title h3 {
  margin: 0;
  font-size: 1rem;
}

.guide-card p,
.movement-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.movement-title {
  display: flex;
  align-items: center;
}

.movement-piece {
  display: flex;
  align-items: center;
  gap: 12px;
}

.movement-token {
  width: 74px;
  flex: 0 0 74px;
}

.movement-token .piece-token {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: 0 auto;
}

.movement-meta {
  display: grid;
  gap: 2px;
}

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

.result-overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.result-overlay-backdrop.is-closing {
  pointer-events: none;
}

.result-overlay-scrim {
  position: absolute;
  inset: 0;
  background: rgba(28, 20, 12, 0.62);
  backdrop-filter: blur(5px);
}

.result-overlay-scrim.is-closing {
  animation: result-overlay-scrim-exit 220ms ease-in forwards;
}

.result-overlay-card,
.result-overlay-handle {
  --result-accent: rgba(171, 75, 49, 0.92);
  --result-soft: rgba(171, 75, 49, 0.18);
  --result-glow: rgba(171, 75, 49, 0.24);
}

.result-overlay-card.is-victory,
.result-overlay-handle.is-victory {
  --result-accent: rgba(56, 99, 68, 0.95);
  --result-soft: rgba(56, 99, 68, 0.16);
  --result-glow: rgba(56, 99, 68, 0.26);
}

.result-overlay-card.is-defeat,
.result-overlay-handle.is-defeat {
  --result-accent: rgba(141, 59, 53, 0.95);
  --result-soft: rgba(141, 59, 53, 0.18);
  --result-glow: rgba(141, 59, 53, 0.28);
}

.result-overlay-card.is-draw,
.result-overlay-handle.is-draw {
  --result-accent: rgba(115, 102, 90, 0.95);
  --result-soft: rgba(115, 102, 90, 0.18);
  --result-glow: rgba(115, 102, 90, 0.2);
}

.result-overlay-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 24px));
  padding: 30px 30px 24px;
  border-radius: 28px;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.72),
      rgba(255, 255, 255, 0) 28%
    ),
    linear-gradient(
      180deg,
      rgba(248, 241, 227, 0.98),
      rgba(243, 234, 218, 0.96)
    );
  border: 1px solid rgba(118, 91, 61, 0.18);
  box-shadow: 0 28px 56px rgba(24, 17, 10, 0.28), 0 0 0 1px var(--result-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
  animation: result-overlay-enter 180ms ease-out;
  overflow: hidden;
}

.result-overlay-card.is-closing {
  animation: result-overlay-exit 220ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

.result-overlay-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--result-accent),
    rgba(255, 255, 255, 0.6)
  );
}

.result-overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 2.5rem;
  height: 40px;
  width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  border-radius: 999px;
  color: red;
  background: transparent;
  box-shadow: none;
}

.result-overlay-eyebrow {
  margin: 0 0 10px;
  color: var(--result-accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.result-overlay-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.08;
}

.result-overlay-reason {
  margin: 14px 0 0;
  line-height: 1.72;
  color: var(--muted);
}

.result-overlay-meta {
  margin: 18px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--result-soft);
  color: var(--ink);
  font-size: 0.92rem;
}

.result-overlay-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.result-overlay-actions > button {
  min-width: 140px;
}

.result-overlay-handle {
  position: fixed;
  top: 50%;
  right: 10px;
  z-index: 25;
  width: 22px;
  padding: 0;
  border-radius: 0;
  display: inline-grid;
  place-items: center;
  background: #cccccc;
  border: 1px solid #979797;
  box-shadow: none;
  transform: translateY(-50%);
}

.result-overlay-handle:hover,
.result-overlay-handle:focus-visible {
  background: #aeaeae;
  transform: translateY(-50%);
  box-shadow: none;
}

.result-overlay-handle:focus-visible {
  outline: 2px solid rgba(70, 70, 70, 0.45);
  outline-offset: 2px;
}

.result-overlay-grip {
  width: 2px;
  height: 56px;
  border-radius: 0;
  background: #6d6d6d;
  box-shadow: -5px 0 0 #6d6d6d, 5px 0 0 #6d6d6d;
}

@keyframes result-overlay-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes result-overlay-exit {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateX(calc(50vw + 50% + 40px)) scale(0.98);
  }
}

@keyframes result-overlay-scrim-exit {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.legend span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

@media (max-width: 850px) {
  .board-and-status {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  .hero,
  .board-card,
  .page-footer,
  .status-card {
    border-radius: 18px;
  }

  .hero {
    padding: 18px;
    gap: 14px;
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-actions button {
    width: 100%;
    white-space: normal;
  }

  .board-card {
    padding: 12px;
  }

  .page-footer {
    padding: 16px 18px;
  }

  .status-card {
    padding: 14px;
  }

  .info-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .controls {
    flex-direction: column;
  }

  .controls > button,
  .controls > .button-like {
    width: 100%;
  }

  .board-grid {
    --board-gap: 6px;
    --board-padding: 10px;
    min-height: clamp(420px, 118vw, 620px);
  }

  .setup-top-overlay {
    padding: 10px 10px 12px;
  }

  .setup-top-content {
    width: min(100%, 260px);
    gap: 10px;
  }

  .setup-overlay-copy {
    line-height: 1.45;
    font-size: 0.8rem;
  }

  .setup-top-control-row {
    gap: 8px;
    padding-top: 8px;
  }

  .setup-top-control-row button {
    width: 100%;
    height: auto;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  .setup-overlay-label {
    font-size: 0.8rem;
  }

  .setup-board-select {
    border-radius: 8px;
    font-size: 0.82rem;
  }

  .setup-river-controls {
    padding-inline: 4px;
    top: 0;
  }

  .setup-river-panel {
    width: 100%;
    max-width: 360px;
    padding: 5px 6px;
    gap: 6px;
    border-radius: 10px;
  }

  .setup-river-label {
    font-size: 0.62rem;
  }

  .setup-river-choice-grid {
    gap: 6px;
  }

  .setup-river-choice-grid button {
    min-width: 0;
    padding: 8px 4px;
    font-size: 0.74rem;
    line-height: 1.2;
    border-radius: 8px;
  }

  .board-node {
    min-height: 0;
    border-radius: 7px;
  }

  .board-node-label {
    top: 7px;
    left: 8px;
    font-size: 0.62rem;
  }

  .board-node-note {
    right: 8px;
    bottom: 6px;
    font-size: 0.62rem;
  }

  .board-river-band {
    box-shadow: inset 0 8px 0 rgba(48, 62, 70, 0.16),
      inset 0 -8px 0 rgba(22, 33, 39, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(52, 68, 76, 0.14);
  }

  .board-node.is-bridge::before {
    left: 21%;
    right: 21%;
    box-shadow: 0 8px 12px rgba(25, 37, 43, 0.18),
      inset 0 1px 0 rgba(255, 246, 225, 0.16),
      inset 0 -2px 0 rgba(76, 48, 24, 0.26);
  }

  .piece-token {
    width: clamp(44px, 74%, 54px);
    padding: 9px 4px 6px;
  }
  .is-hq .piece-token {
    width: clamp(44px, 37%, 54px);
  }

  .piece-main {
    font-size: clamp(0.62rem, 2.4vw, 0.82rem);
  }

  .piece-sub {
    min-height: 0.92rem;
  }

  .officer-badge {
    width: min(100%, 84%);
    min-height: 0.92rem;
  }

  .officer-stars {
    width: min(100%, 2.2rem);
    min-height: 0.8rem;
  }

  .officer-star {
    font-size: 0.37rem;
  }

  .officer-mark {
    width: 74%;
    height: 1px;
  }

  .officer-badge.is-senior .officer-mark {
    box-shadow: 0 -2px 0 0 var(--badge-mark), 0 2px 0 0 var(--badge-mark);
  }

  .officer-badge.is-general .officer-mark {
    box-shadow: 0 -3.2px 0 0 var(--badge-mark), 0 3.2px 0 0 var(--badge-mark);
  }

  .movement-piece {
    align-items: flex-start;
  }

  .movement-token {
    width: 66px;
    flex-basis: 66px;
  }

  .movement-token .piece-token {
    min-height: 66px;
  }

  .guide-backdrop {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .result-overlay-backdrop {
    padding: 14px;
  }

  .result-overlay-card {
    padding: 24px 18px 18px;
    border-radius: 24px;
  }

  .result-overlay-close {
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
  }

  .result-overlay-actions {
    flex-direction: column;
  }

  .result-overlay-actions > button {
    width: 100%;
  }

  .result-overlay-handle {
    right: 8px;
    width: 28px;
  }

  .guide-drawer {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: 20px 16px 18px;
    border-radius: 0;
  }

  .guide-header {
    align-items: flex-start;
  }

  .guide-body {
    padding-right: 2px;
  }

  .guide-tabs {
    gap: 8px;
  }

  .guide-tab {
    padding: 12px 8px;
    font-size: 0.88rem;
  }

  .layout-pieces {
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
  }

  .reserve-piece {
    min-height: 76px;
  }

  .setup-piece-remove {
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    font-size: 0.9rem;
  }

  .matrix-shell::after {
    top: 32px;
  }

  .matchup-strip {
    top: 10px;
    gap: 1px;
    padding: 6px 4px;
  }

  .matchup-strip.is-right {
    right: 10px;
  }

  .matchup-strip.is-left {
    left: 10px;
  }

  .matchup-strip-title {
    font-size: 0.62rem;
    padding-bottom: 2px;
    margin-bottom: 1px;
  }

  .matchup-row {
    gap: 3px;
    padding: 1px 0;
  }

  .matchup-symbol {
    font-size: 0.6rem;
    width: 12px;
  }

  .matchup-name {
    font-size: 0.6rem;
  }

  .toggle-switch {
    width: 40px;
    height: 22px;
  }

  .toggle-knob {
    width: 16px;
    height: 16px;
  }

  .toggle-switch.is-on .toggle-knob {
    transform: translateX(18px);
  }
}

@media (max-width: 540px) {
  body {
    padding: 8px;
  }

  .hero,
  .board-card,
  .page-footer,
  .status-card {
    border-radius: 16px;
  }

  .hero {
    padding: 16px 14px;
  }

  .hero h1 {
    font-size: clamp(1.7rem, 8vw, 2.3rem);
  }

  .hero p {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .board-card {
    padding: 10px;
  }

  .page-footer {
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.65;
  }

  .board-and-status {
    gap: 12px;
  }

  .result-overlay-backdrop {
    padding: 10px;
  }

  .result-overlay-card {
    width: min(100vw - 20px, 100%);
    padding: 22px 16px 16px;
    border-radius: 20px;
  }

  .result-overlay-card h2 {
    font-size: clamp(1.7rem, 8vw, 2.1rem);
  }

  .result-overlay-reason {
    margin-top: 12px;
    font-size: 0.92rem;
  }

  .result-overlay-meta {
    margin-top: 14px;
    font-size: 0.82rem;
  }

  .result-overlay-handle {
    right: 6px;
    width: 30px;
  }

  .board-grid {
    --board-gap: 5px;
    --board-padding: 8px;
    border-radius: 20px;
  }

  .setup-top-overlay {
    padding: 8px 8px 10px;
  }

  .setup-top-content {
    width: min(100%, 220px);
    gap: 8px;
  }

  .setup-overlay-copy {
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .setup-top-control-row {
    gap: 6px;
    padding-top: 6px;
  }

  .setup-top-control-row button,
  .setup-board-select {
    min-height: 40px;
    font-size: 0.8rem;
  }

  .setup-river-controls {
    padding-inline: 2px;
    top: -12px;
  }

  .setup-river-panel {
    max-width: 280px;
    padding: 4px 5px 6px;
  }

  .setup-river-label {
    font-size: 0.58rem;
    letter-spacing: 0.1em;
  }

  .setup-river-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .setup-river-choice-grid button {
    padding: 7px 4px;
    font-size: 0.7rem;
  }

  .board-node {
    border-radius: 5px;
  }

  .board-node-label {
    top: 6px;
    left: 7px;
    font-size: 0.56rem;
  }

  .board-node-note {
    right: 7px;
    bottom: 5px;
    font-size: 0.56rem;
  }

  .piece-token {
    padding: 7px 3px 5px;
  }

  .piece-main {
    font-size: clamp(0.54rem, 2.7vw, 0.72rem);
  }

  .piece-sub {
    min-height: 0.78rem;
  }

  .officer-badge {
    min-height: 0.78rem;
  }

  .officer-stars {
    min-height: 0.68rem;
    width: min(100%, 1.8rem);
  }

  .officer-star {
    font-size: 0.32rem;
  }

  .setup-piece-remove {
    top: 2px;
    right: 2px;
    width: 17px;
    height: 17px;
    font-size: 0.84rem;
  }

  .layout-pieces {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
  }

  .reserve-piece {
    min-height: 68px;
  }
}

/* --- Matchup hint strip (overlay on board) --- */

.matchup-strip {
  position: absolute;
  top: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid rgba(255, 247, 231, 0.14);
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(29, 23, 18, 0.76),
    rgba(29, 23, 18, 0.56)
  );
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  animation: matchup-fade-in 160ms ease-out;
}

.matchup-strip.is-right {
  right: 14px;
}

.matchup-strip.is-left {
  left: 14px;
}

@keyframes matchup-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.matchup-strip-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 243, 223, 0.96);
  text-align: center;
  padding-bottom: 4px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 247, 231, 0.14);
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.matchup-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 0;
  white-space: nowrap;
  line-height: 1.3;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
}

.matchup-symbol {
  font-size: 0.72rem;
  font-weight: 700;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.matchup-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 243, 223, 0.84);
}

.matchup-row.is-win .matchup-symbol,
.matchup-row.is-win .matchup-name {
  color: #9bd8a9;
}

.matchup-row.is-loss .matchup-symbol,
.matchup-row.is-loss .matchup-name {
  color: #ffb1aa;
}

.matchup-row.is-tie .matchup-symbol,
.matchup-row.is-tie .matchup-name {
  color: #ddd1bf;
}

/* --- Toggle switch --- */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 2px;
  border-radius: 999px;
  border: 0;
  background: rgba(115, 102, 90, 0.22);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background 180ms ease;
  flex-shrink: 0;
}

.toggle-switch:hover {
  transform: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch.is-on {
  background: linear-gradient(180deg, #5a9466, #386344);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.toggle-knob {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 180ms ease;
  pointer-events: none;
}

.toggle-switch.is-on .toggle-knob {
  transform: translateX(20px);
}
