/* タフル（Hnefatafl）固有スタイル（ネオン強度：中程度） */

.game-panel {
  margin-top: 20px;
}

.hn-settings {
  max-width: min(100%, 560px);
  margin: 0 auto 14px;
  display: grid;
  gap: 14px;
}

.hn-settings .field-label {
  margin-bottom: 8px;
}

.hn-field {
  margin: 0;
}

.option-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
}

.option-tabs--side {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 520px;
}

.option-tab {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 8px 6px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.04s ease;
}

.option-tab small {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.75;
}

.option-tab:hover {
  background: var(--md-sys-color-primary-container);
}

.option-tab:active {
  transform: translateY(1px);
}

.option-tab.is-active {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.option-tab:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* ---- ステータス ---- */

.hn-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  max-width: min(100%, 520px);
  margin: 0 auto 10px;
  padding: 12px 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
}

.hn-scores {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.hn-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 6.2rem;
  padding: 6px 10px;
  border-radius: var(--md-sys-shape-corner-medium);
}

.hn-score--attacker {
  background: color-mix(in srgb, #6366f1 12%, var(--md-sys-color-surface));
  border: 1px solid color-mix(in srgb, #6366f1 35%, transparent);
}

.hn-score--defender {
  background: color-mix(in srgb, #22d3ee 14%, var(--md-sys-color-surface));
  border: 1px solid color-mix(in srgb, #22d3ee 35%, transparent);
}

.hn-score__label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hn-score__value {
  color: var(--md-sys-color-on-surface);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.hn-score__value strong {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hn-score__king {
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 700;
}

.hn-status__main {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
}

.hn-status__text {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: 0.92rem;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-primary) 14%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-pill.is-attacker {
  background: color-mix(in srgb, #6366f1 18%, var(--md-sys-color-surface));
  color: #3730a3;
}

.status-pill.is-defender {
  background: color-mix(in srgb, #22d3ee 22%, var(--md-sys-color-surface));
  color: #0e7490;
}

.status-pill.is-win {
  background: color-mix(in srgb, var(--success, #16a34a) 18%, var(--md-sys-color-surface));
  color: var(--success, #15803d);
}

.status-pill.is-lose {
  background: color-mix(in srgb, #ef4444 16%, var(--md-sys-color-surface));
  color: #b91c1c;
}

.status-pill.is-draw {
  background: color-mix(in srgb, #94a3b8 18%, var(--md-sys-color-surface));
  color: #475569;
}

.hn-guide {
  max-width: min(100%, 520px);
  margin: 0 auto 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.hn-result {
  max-width: min(100%, 520px);
  margin: 0 auto 14px;
  padding: 14px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  text-align: center;
  animation: hn-result-in 200ms ease-out;
}

.hn-result.is-defender {
  border-color: color-mix(in srgb, #22d3ee 45%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #22d3ee 10%, var(--md-sys-color-surface));
}

.hn-result.is-attacker {
  border-color: color-mix(in srgb, #6366f1 40%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #6366f1 9%, var(--md-sys-color-surface));
}

.hn-result.is-draw {
  border-color: color-mix(in srgb, #94a3b8 40%, var(--md-sys-color-outline-variant));
}

.hn-result__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.45;
}

.hn-result__detail {
  margin: 0 0 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.92rem;
  font-weight: 600;
}

.hn-result__actions {
  display: flex;
  justify-content: center;
}

@keyframes hn-result-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- 盤面 ---- */

.hn-board-wrap {
  display: flex;
  justify-content: center;
  max-width: min(100%, 540px);
  margin: 0 auto 12px;
}

.hn-frame {
  --hn-pad: 8px;
  --hn-gap: 2px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  grid-template-rows: 16px auto;
  gap: 4px;
  width: 100%;
  padding: 10px 12px 12px 8px;
  border: 2px solid color-mix(in srgb, #38bdf8 65%, #0ea5e9);
  border-radius: 18px;
  background: linear-gradient(160deg, #14284f 0%, #0d1a36 55%, #0a1428 100%);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.18),
    0 10px 28px rgba(8, 20, 48, 0.28);
}

.hn-coords {
  display: grid;
  gap: var(--hn-gap);
  color: #93b4dc;
  font-family: Outfit, "Noto Sans JP", sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

.hn-coords span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hn-coords--cols {
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  padding: 0 var(--hn-pad);
}

.hn-coords--rows {
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(9, minmax(0, 1fr));
  padding: var(--hn-pad) 0;
}

.hn-board {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: var(--hn-gap);
  aspect-ratio: 1 / 1;
  padding: var(--hn-pad);
  border-radius: 12px;
  background: #0b1630;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.22);
}

.hn-cell {
  position: relative;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #1a3358;
  color: inherit;
  font: inherit;
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.1);
}

.hn-cell:nth-child(even) {
  background: #1e3a64;
}

.hn-cell:disabled {
  cursor: default;
}

.hn-cell.is-playable {
  cursor: pointer;
}

/* 王座：金の二重枠＋王冠マーク */
.hn-cell.hn-cell--throne {
  background: linear-gradient(145deg, color-mix(in srgb, #fbbf24 20%, #1a3358), #172c50);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, #fbbf24 75%, transparent),
    inset 0 0 0 4px #172c50,
    inset 0 0 0 5px color-mix(in srgb, #fbbf24 45%, transparent),
    0 0 8px color-mix(in srgb, #fbbf24 25%, transparent);
}

.hn-cell--throne::before {
  content: "";
  position: absolute;
  inset: 22%;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 18h18l-1.6-9.2-4.6 3.8L12 5.5l-2.8 7.1-4.6-3.8z' fill='%23fbbf24' fill-opacity='0.55'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* 四隅：緑のゲート＋出口矢印 */
.hn-cell.hn-cell--corner {
  background: linear-gradient(145deg, color-mix(in srgb, #34d399 22%, #13284a), #10233f);
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, #34d399 80%, transparent),
    inset 0 0 0 4px #10233f,
    inset 0 0 0 5px color-mix(in srgb, #34d399 40%, transparent),
    0 0 8px color-mix(in srgb, #34d399 22%, transparent);
}

.hn-cell--corner::before {
  content: "";
  position: absolute;
  inset: 24%;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236ee7b7' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 18L6 6M6 15V6h9'/%3E%3C/svg%3E");
  opacity: 0.85;
  pointer-events: none;
}

.hn-cell--corner:nth-child(9)::before {
  transform: rotate(90deg);
}

.hn-cell--corner:nth-child(73)::before {
  transform: rotate(-90deg);
}

.hn-cell--corner:nth-child(81)::before {
  transform: rotate(180deg);
}

.hn-cell.is-playable:hover {
  background: color-mix(in srgb, #38bdf8 20%, #1a3358);
}

.hn-cell.is-last-from {
  background: color-mix(in srgb, #38bdf8 12%, #1a3358);
}

.hn-cell.is-last-to {
  outline: 2px solid color-mix(in srgb, #7dd3fc 75%, transparent);
  outline-offset: -2px;
}

.hn-cell:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  z-index: 2;
}

.hn-cell.is-selected {
  outline: 3px solid #67e8f9;
  outline-offset: -3px;
  z-index: 1;
}

.hn-cell.is-selected .hn-piece {
  box-shadow:
    0 0 0 2px #0b1630,
    0 0 0 4px #67e8f9,
    0 0 12px color-mix(in srgb, #22d3ee 55%, transparent);
}

.hn-cell.is-move-target::after,
.hn-cell.is-capture-target::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hn-cell.is-move-target::after {
  width: 26%;
  height: 26%;
  min-width: 7px;
  min-height: 7px;
  background: color-mix(in srgb, #67e8f9 75%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, #22d3ee 45%, transparent);
}

.hn-cell.is-capture-target::after {
  width: 48%;
  height: 48%;
  min-width: 14px;
  min-height: 14px;
  border: 2px solid color-mix(in srgb, #f0abfc 90%, white);
  background: color-mix(in srgb, #e879f9 18%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, #e879f9 40%, transparent);
}

.hn-cell.is-captured {
  animation: hn-capture-flash 420ms ease-out;
}

@keyframes hn-capture-flash {
  0% {
    background: color-mix(in srgb, #f472b6 55%, #1a3358);
  }
  100% {
    background: #1a3358;
  }
}

/* ---- 駒 ---- */

.hn-piece {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74%;
  height: 74%;
  pointer-events: none;
}

.hn-piece--attacker {
  border: 2px solid #a5b4fc;
  border-radius: 24%;
  background: linear-gradient(160deg, #4f46e5 0%, #312e81 45%, #1e1b4b 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.45);
}

.hn-piece--attacker .hn-piece__mark {
  width: 34%;
  height: 34%;
  border: 1.5px solid rgba(199, 210, 254, 0.85);
  border-radius: 2px;
  transform: rotate(45deg);
}

.hn-piece--defender {
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: linear-gradient(160deg, #ecfeff 0%, #a5f3fc 45%, #22d3ee 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.hn-piece--defender .hn-piece__mark {
  width: 42%;
  height: 42%;
  border: 2px solid rgba(14, 116, 144, 0.7);
  border-radius: 50%;
}

.hn-piece--king {
  width: 84%;
  height: 84%;
  border: 2px solid #fff7d6;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7 0%, #fbbf24 50%, #d97706 100%);
  box-shadow:
    0 0 0 2px #b45309,
    0 0 10px color-mix(in srgb, #fbbf24 45%, transparent),
    0 2px 5px rgba(0, 0, 0, 0.4);
  color: #78350f;
}

.hn-piece--king svg {
  display: block;
  width: 62%;
  height: 62%;
}

.hn-cell.is-selected .hn-piece--king {
  box-shadow:
    0 0 0 2px #b45309,
    0 0 0 4px #67e8f9,
    0 0 12px color-mix(in srgb, #22d3ee 55%, transparent);
}

/* ---- 凡例・説明 ---- */

.hn-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  max-width: min(100%, 540px);
  margin: 0 auto 10px;
  padding: 0;
  list-style: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  font-weight: 600;
}

.hn-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hn-legend__piece.hn-piece {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.hn-legend__piece.hn-piece--king {
  width: 20px;
  height: 20px;
  border-width: 1.5px;
  box-shadow: 0 0 0 1.5px #b45309;
}

.hn-legend__cell {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 4px;
}

.hn-legend__cell--throne {
  background: color-mix(in srgb, #fbbf24 22%, #1a3358);
  box-shadow:
    inset 0 0 0 1.5px #fbbf24,
    inset 0 0 0 3px #1a3358,
    inset 0 0 0 4px color-mix(in srgb, #fbbf24 50%, transparent);
}

.hn-legend__cell--corner {
  background: color-mix(in srgb, #34d399 22%, #13284a);
  box-shadow:
    inset 0 0 0 1.5px #34d399,
    inset 0 0 0 3px #13284a,
    inset 0 0 0 4px color-mix(in srgb, #34d399 45%, transparent);
}

.hn-howto {
  max-width: min(100%, 520px);
  margin: 0 auto 12px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
  font-weight: 600;
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

/* ---- ルール説明の図 ---- */

.hn-diagrams {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
  margin: 12px 0;
}

.hn-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  max-width: 11rem;
  text-align: center;
}

.hn-diagram__grid {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  grid-template-rows: repeat(3, 30px);
  gap: 2px;
  padding: 6px;
  border-radius: 10px;
  background: #0b1630;
}

.hn-diagram__grid span {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #1a3358;
}

.hn-diagram__grid .is-throne {
  background: color-mix(in srgb, #fbbf24 22%, #1a3358);
  box-shadow: inset 0 0 0 1.5px #fbbf24;
}

.hn-diagram__grid .is-a::before,
.hn-diagram__grid .is-k::before {
  content: "";
  width: 70%;
  height: 70%;
}

.hn-diagram__grid .is-a::before {
  border: 1.5px solid #a5b4fc;
  border-radius: 24%;
  background: linear-gradient(160deg, #4f46e5, #1e1b4b);
}

.hn-diagram__grid .is-k::before {
  border: 1.5px solid #fff7d6;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fef3c7, #fbbf24 55%, #d97706);
  box-shadow: 0 0 0 1.5px #b45309;
}

.hn-diagram figcaption {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.82rem;
  line-height: 1.5;
}

.hn-diagram figcaption strong {
  display: block;
  color: var(--md-sys-color-on-surface);
}

@media (max-width: 520px) {
  .hn-status {
    max-width: 100%;
    padding: 10px;
  }

  .hn-score {
    min-width: 5.4rem;
    padding: 5px 8px;
  }

  .hn-board-wrap {
    max-width: none;
    margin-left: -12px;
    margin-right: -12px;
  }

  .hn-frame {
    --hn-pad: 4px;
    --hn-gap: 1px;
    grid-template-columns: 12px minmax(0, 1fr);
    grid-template-rows: 12px auto;
    gap: 3px;
    padding: 6px 6px 6px 4px;
    border-radius: 14px;
  }

  .hn-coords {
    font-size: 0.6rem;
  }

  .hn-cell {
    border-radius: 4px;
  }

  .hn-piece {
    width: 78%;
    height: 78%;
  }

  .hn-piece--king {
    width: 86%;
    height: 86%;
  }

  .hn-piece--attacker,
  .hn-piece--defender,
  .hn-piece--king {
    border-width: 1.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hn-cell.is-captured,
  .hn-result {
    animation: none;
  }
}

/* 外枠とHUDは15パズル・パイプパズルの共通UIを使用する。
   陣営選択と9×9盤を収める寸法だけをタフル用に調整する。 */
html.gs-playing .game-panel { align-items: center; }
html.gs-playing .game-panel > .gs-bar,
html.gs-playing .game-panel > .gs-hud,
html.gs-playing .game-controls,
.hn-stage { width: 100%; max-width: 640px; }
html.gs-playing .gs-bar { gap: 10px; align-items: flex-start; }
html.gs-playing .hn-settings { flex: 1; min-width: 0; max-width: none; margin: 0; gap: 6px; }
html.gs-playing .hn-settings .field-label { display: none; }
html.gs-playing .option-tabs { max-width: none; gap: 6px; }
html.gs-playing .option-tab { min-height: 44px; padding: 4px; gap: 0; border-color: var(--play-border); background: var(--play-hud-bg); color: var(--play-text); font-size: .8125rem; }
html.gs-playing .option-tab small { font-size: .6875rem; }
html.gs-playing .option-tab.is-active { border-color: var(--play-accent); background: color-mix(in srgb, var(--play-accent) 18%, var(--play-hud-bg)); color: var(--play-accent); }
html.gs-playing .option-tab:focus-visible { outline-color: var(--play-accent); }
html.gs-playing .gs-hud__label { font-size: .6875rem; letter-spacing: 0; text-align: center; }
html.gs-playing .status-pill { min-height: 0; padding: 0; background: none; color: var(--play-accent); font-size: 1rem; line-height: 1.38; }
html.gs-playing .status-pill.is-defender { color: #a5f3fc; }
html.gs-playing .status-pill.is-lose { color: #fda4af; }
html.gs-playing .hn-status__text { flex: none; margin: 0; color: var(--play-text); font-size: .875rem; line-height: 1.6; text-align: center; }
html.gs-playing .hn-guide { flex: none; width: 100%; max-width: 640px; min-height: 3.2em; margin: 0 auto 8px; color: var(--play-text-muted); font-size: .8125rem; line-height: 1.6; }
.hn-stage { position: relative; flex: none; }
html.gs-playing .hn-board-wrap { width: min(100%, max(200px, 100dvh - 415px)); max-width: 540px; margin: 0 auto 8px; }
html.gs-playing .hn-frame { box-sizing: border-box; }
html.gs-playing .hn-legend { flex: none; margin: 0 auto; color: var(--play-text-muted); font-size: .6875rem; gap: 4px 10px; }
html.gs-playing .game-controls { flex: none; margin: 10px 0 0; }
html.gs-playing .hn-result { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: none; margin: 0; border-color: var(--play-border); background: rgba(8, 15, 31, .95); color: var(--play-text); }
html.gs-playing .hn-result__detail { color: var(--play-text-muted); }
html.gs-playing #game-error:not([hidden]) { flex: none; width: 100%; max-width: 640px; }
@media (min-width: 768px) and (min-height: 600px) {
  html.gs-playing .game-panel { padding-top: max(clamp(24px, 5vh, 56px), env(safe-area-inset-top)); }
  html.gs-playing .game-panel > .gs-bar { margin-bottom: 24px; }
  html.gs-playing .game-panel > .gs-hud { margin-bottom: 16px; }
  html.gs-playing .hn-board-wrap { width: min(100%, max(200px, 100dvh - 440px)); margin-bottom: 16px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 520px); grid-template-areas: "bar board" "hud board" "status board" "guide board" "controls legend"; gap: 0 16px; align-content: start; justify-content: center; }
  html.gs-playing .game-panel > .gs-bar { grid-area: bar; }
  html.gs-playing .gs-hud { grid-area: hud; }
  html.gs-playing .hn-status__text { grid-area: status; }
  html.gs-playing .hn-guide { grid-area: guide; }
  html.gs-playing .hn-stage { grid-area: board; }
  html.gs-playing .hn-board-wrap { width: min(100%, 100dvh - 90px); }
  html.gs-playing .hn-legend { grid-area: legend; }
  html.gs-playing .game-controls { grid-area: controls; }
}
@media (min-width: 768px) and (min-height: 600px) {
  html.gs-playing .hn-board-wrap { width: min(100%, max(180px, 100dvh - 470px)); }
}
@media (max-height: 650px) and (orientation: portrait) {
  html.gs-playing .hn-board-wrap { width: min(100%, max(160px, 100dvh - 415px)); }
  html.gs-playing .hn-legend { font-size: .625rem; gap: 3px 8px; }
  html.gs-playing .game-controls { margin-top: 6px; }
}
/* 高さの少ない縦画面では補助表示を省スペース化し、9列の操作面を優先する。 */
@media (max-height: 650px) and (orientation: portrait) {
  html.gs-playing .option-tab { min-height: 36px; }
  html.gs-playing .option-tab small { display: none; }
  html.gs-playing .hn-legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  html.gs-playing .hn-board-wrap { width: min(100%, max(260px, 100dvh - 330px)); }
  html.gs-playing .game-panel > .gs-bar,
  html.gs-playing .game-panel > .gs-hud { margin-bottom: 6px; }
}
@media (max-height: 650px) and (orientation: portrait) {
  html.gs-playing .gs-hud__item { padding-left: 4px; padding-right: 4px; }
  html.gs-playing .gs-hud__label { font-size: .625rem; }
}
@media (max-height: 650px) and (orientation: portrait) {
  html.gs-playing .gs-hud__label { line-height: 1.3; }
  html.gs-playing .hn-board-wrap { margin-bottom: 0; }
  html.gs-playing .hn-guide { margin-bottom: 4px; }
}
