/* ファノロナ固有スタイル（ネオン強度：中程度） */

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

.fn-settings {
  max-width: min(100%, 640px);
  margin: 0 auto 14px;
}

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

.fn-field {
  margin: 0;
}

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

.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;
}

.fn-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  max-width: min(100%, 640px);
  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);
}

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

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

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

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

.fn-score__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface-variant);
}

.fn-score__value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--md-sys-color-on-surface);
}

.fn-status__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.fn-status__text {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: 0.95rem;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: #64748b;
}

.status-pill.is-p1,
.status-pill.is-player {
  background: linear-gradient(135deg, #22d3ee, #0284c7);
}

.status-pill.is-p2,
.status-pill.is-cpu {
  background: linear-gradient(135deg, #e879f9, #a21caf);
}

.status-pill.is-draw {
  background: #64748b;
}

.fn-hint {
  max-width: min(100%, 640px);
  margin: 0 auto 12px;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid color-mix(in srgb, #f472b6 45%, transparent);
  background: color-mix(in srgb, #f472b6 10%, var(--md-sys-color-surface));
  color: #9d174d;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

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

.fn-result.is-win {
  border-color: color-mix(in srgb, #22c55e 40%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #22c55e 8%, var(--md-sys-color-surface));
}

.fn-result.is-lose {
  border-color: color-mix(in srgb, #f43f5e 35%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #f43f5e 7%, var(--md-sys-color-surface));
}

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

.fn-result__title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 800;
}

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

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

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

.fn-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fn-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.fn-legend__swatch--p1 {
  background: linear-gradient(145deg, #ecfeff, #22d3ee);
  border: 1.5px solid rgba(8, 145, 178, 0.7);
}

.fn-legend__swatch--p2 {
  background: linear-gradient(145deg, #2e1065, #701a75);
  border: 1.5px solid #e879f9;
  border-radius: 3px;
}

.fn-board-wrap {
  max-width: min(100%, 640px);
  margin: 0 auto;
}

.fn-board {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 5;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(120% 90% at 85% 100%, rgba(232, 121, 249, 0.14), transparent 55%),
    linear-gradient(160deg, #15284f 0%, #0f1c38 55%, #0c1630 100%);
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.35),
    0 12px 28px rgba(15, 23, 42, 0.28);
  box-sizing: border-box;
}

.fn-board-grid {
  position: absolute;
  inset: 10% 5%;
}

.fn-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.fn-line {
  stroke: rgba(103, 232, 249, 0.58);
  stroke-width: 1.35;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.fn-point {
  --point-size: clamp(34px, 9.5vw, 48px);
  appearance: none;
  position: absolute;
  z-index: 1;
  width: var(--point-size);
  height: var(--point-size);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
}

.fn-point:disabled {
  cursor: default;
}

.fn-point:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

.fn-point::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.4);
  border: 1.5px solid rgba(186, 230, 253, 0.45);
  transform: translate(-50%, -50%);
  transition: width 0.12s ease, height 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, border-radius 0.12s ease;
}

.fn-point.has-p1::before,
.fn-point.has-p2::before {
  width: 58%;
  height: 58%;
}

.fn-point.has-p1::before {
  background: linear-gradient(145deg, #ecfeff 0%, #67e8f9 45%, #0891b2 100%);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(8, 145, 178, 0.45),
    0 0 10px rgba(34, 211, 238, 0.35);
  border-radius: 50%;
}

.fn-point.has-p2::before {
  background: linear-gradient(145deg, #4c1d95 0%, #701a75 55%, #3b0764 100%);
  border: 2px solid #e879f9;
  box-shadow:
    0 0 0 1px rgba(192, 38, 211, 0.4),
    0 0 10px rgba(232, 121, 249, 0.3);
  border-radius: 22%;
}

.fn-point.has-p2::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18%;
  height: 18%;
  border-radius: 2px;
  background: rgba(250, 232, 255, 0.85);
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}

.fn-point.is-selected::before {
  box-shadow:
    0 0 0 3px rgba(103, 232, 249, 0.95),
    0 0 14px rgba(34, 211, 238, 0.55);
}

.fn-point.is-can-capture::before {
  box-shadow:
    0 0 0 2px rgba(244, 114, 182, 0.95),
    0 0 12px rgba(236, 72, 153, 0.45);
}

.fn-point.is-can-capture.is-selected::before {
  box-shadow:
    0 0 0 3px rgba(103, 232, 249, 0.95),
    0 0 0 6px rgba(244, 114, 182, 0.55),
    0 0 14px rgba(34, 211, 238, 0.45);
}

.fn-point.is-move::before {
  width: 34%;
  height: 34%;
  background: rgba(34, 211, 238, 0.28);
  border: 2px solid rgba(103, 232, 249, 0.85);
  box-shadow: 0 0 8px rgba(34, 211, 238, 0.35);
}

.fn-point.is-capture-target::before {
  width: 38%;
  height: 38%;
  background: rgba(244, 114, 182, 0.3);
  border: 2px solid rgba(244, 114, 182, 0.95);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.fn-point.is-capture-preview.has-p1::before,
.fn-point.is-capture-preview.has-p2::before {
  outline: 2px dashed rgba(251, 191, 36, 0.95);
  outline-offset: 3px;
  opacity: 0.72;
}

.fn-point.is-choice-dest::before {
  width: 40%;
  height: 40%;
  background: rgba(103, 232, 249, 0.35);
  border: 2px solid #67e8f9;
}

.fn-chain-bar,
.fn-choice-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  max-width: min(100%, 640px);
  margin: 14px auto 0;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: color-mix(in srgb, #0f1c38 8%, var(--md-sys-color-surface));
}

.fn-choice-bar {
  border-color: color-mix(in srgb, #f472b6 40%, transparent);
  background: color-mix(in srgb, #f472b6 8%, var(--md-sys-color-surface));
}

.fn-chain-bar__text,
.fn-choice-bar__text {
  margin: 0;
  flex: 1 1 180px;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--md-sys-color-on-surface);
  text-align: center;
}

.fn-choice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.fn-guide {
  max-width: min(100%, 640px);
  margin: 14px auto 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
}

.fn-diagram {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
}

.fn-diagram__item {
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
}

.fn-diagram__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 750;
}

.fn-diagram__code {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0f1c38;
  color: #e0f2fe;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}

.fn-diagram__note {
  margin: 8px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.86rem;
}

@media (max-width: 480px) {
  .fn-status {
    flex-direction: column;
    align-items: stretch;
  }

  .fn-scores {
    justify-content: center;
  }

  .fn-point {
    --point-size: clamp(30px, 10.5vw, 40px);
  }

  .fn-choice-actions {
    width: 100%;
  }

  .fn-choice-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
}

/* 共通の外枠・HUD・操作ボタンを使い、横長の交点盤と捕獲操作だけを調整する。 */
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,
.fn-stage { width: 100%; max-width: 640px; }
html.gs-playing .gs-bar { gap: 10px; }
html.gs-playing .fn-settings { flex: 1; min-width: 0; max-width: none; margin: 0; }
html.gs-playing .fn-settings .field-label { display: none; }
html.gs-playing .option-tabs { max-width: none; gap: 6px; }
html.gs-playing .option-tab { min-height: 44px; gap: 0; padding: 4px 6px; 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 .status-pill { min-width: 0; padding: 0; font-size: 1.15rem; line-height: 1.2; background: none; }
html.gs-playing .status-pill.is-p1 { color: var(--play-accent); }
html.gs-playing .status-pill.is-p2,
html.gs-playing .status-pill.is-cpu { color: #e9b8fa; }
html.gs-playing .fn-status__text { flex: none; width: 100%; max-width: 640px; min-height: 3.2em; margin: 0; color: var(--play-text); font-size: .875rem; line-height: 1.6; text-align: center; }
html.gs-playing .fn-hint { flex: none; width: 100%; min-height: 2.4em; margin: 0 0 10px; padding: 4px; color: #f9a8d4; background: none; border: 0; }
html.gs-playing .fn-hint[hidden] { display: block !important; visibility: hidden; }
.fn-stage { position: relative; flex: none; }
html.gs-playing .fn-board-wrap { width: min(100%, max(260px, (100dvh - 340px) * 1.8)); }
html.gs-playing .fn-board { border-color: var(--play-border); }
html.gs-playing .fn-legend { flex: none; margin: 0 auto 10px; color: var(--play-text-muted); font-size: .75rem; gap: 6px 12px; }
html.gs-playing .fn-point { --point-size: min(48px, 10vw); }
html.gs-playing .fn-capture-controls { display: grid; flex: none; width: 100%; max-width: 640px; margin-top: 10px; }
html.gs-playing .fn-choice-bar,
html.gs-playing .fn-chain-bar { grid-area: 1 / 1; flex: none; width: 100%; min-height: 104px; margin: 0; padding: 8px; border-color: var(--play-border); background: var(--play-hud-bg); }
html.gs-playing .fn-choice-bar__text,
html.gs-playing .fn-chain-bar__text { color: var(--play-text); font-size: .8125rem; }
/* 捕獲方法の選択と連続捕獲の説明は同じ予約領域を使う。 */
html.gs-playing .fn-choice-bar[hidden] { display: flex !important; visibility: hidden; }

html.gs-playing .fn-chain-bar[hidden] { display: flex !important; visibility: hidden; }
html.gs-playing .game-controls { flex: none; justify-content: center; margin: 10px 0 0; }
html.gs-playing .fn-result { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0; border-color: var(--play-border); background: rgba(8, 15, 31, .95); color: var(--play-text); }
html.gs-playing .fn-result__detail { color: var(--play-text-muted); font-size: .875rem; }
@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: 28px; }
  html.gs-playing .game-panel > .gs-hud { margin-bottom: 20px; }
  html.gs-playing .fn-board-wrap { width: min(100%, max(260px, (100dvh - 440px) * 1.8)); }
  html.gs-playing .fn-legend { margin-bottom: 18px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 640px); grid-template-rows: auto auto auto auto auto; grid-template-areas: "bar board" "hud board" "status board" "hint legend" "choice controls"; 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 .fn-status__text { grid-area: status; }
  html.gs-playing .fn-hint { grid-area: hint; margin-bottom: 0; }
  html.gs-playing .fn-stage { grid-area: board; align-self: center; }
  html.gs-playing .fn-board-wrap { width: min(100%, (100dvh - 195px) * 1.8); }
  html.gs-playing .fn-legend { grid-area: legend; align-self: start; margin-top: 8px; }
  html.gs-playing .fn-capture-controls { grid-area: choice; margin: 0; }
  html.gs-playing .game-controls { grid-area: controls; align-self: start; margin: 0; }
}

@media (max-height: 650px) and (orientation: portrait) {
  html.gs-playing .game-panel > .gs-bar,
  html.gs-playing .game-panel > .gs-hud { margin-bottom: 6px; }
  html.gs-playing .fn-status__text { min-height: 3em; font-size: .8125rem; line-height: 1.5; }
  html.gs-playing .fn-hint { min-height: 1.5em; padding: 0; margin-bottom: 6px; font-size: .8125rem; }
  html.gs-playing .fn-legend { margin-bottom: 6px; font-size: .6875rem; gap: 4px 8px; }
  html.gs-playing .fn-capture-controls { margin-top: 6px; }
  html.gs-playing .fn-choice-bar,
  html.gs-playing .fn-chain-bar { min-height: 96px; padding: 6px; gap: 6px; }
  html.gs-playing .fn-choice-actions { flex-wrap: nowrap; }
  html.gs-playing .fn-choice-actions .btn { padding: 6px 8px; font-size: .8125rem; }
  html.gs-playing .game-controls { margin-top: 6px; }
}
