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

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

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

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

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

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

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

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

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

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

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

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

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

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

.sk-streak {
  width: 100%;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: right;
}

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

.sk-hint {
  max-width: min(100%, 560px);
  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;
}

.sk-result {
  max-width: min(100%, 560px);
  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;
}

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

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

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

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

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

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

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

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

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

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

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

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

.sk-board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 15% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(120% 90% at 85% 100%, rgba(167, 139, 250, 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;
}

.sk-board-grid {
  position: absolute;
  inset: 2%;
}

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

.sk-line {
  stroke: rgba(96, 165, 250, 0.48);
  stroke-width: 0.06;
  stroke-linecap: round;
}

.sk-loop {
  fill: none;
  stroke-linecap: round;
  stroke-width: 0.09;
}

.sk-loop--inner {
  stroke: rgba(34, 211, 238, 0.72);
}

.sk-loop--outer {
  stroke: rgba(167, 139, 250, 0.78);
}

.sk-loop.is-active {
  stroke-width: 0.14;
  filter: drop-shadow(0 0 0.12px rgba(251, 191, 36, 0.9));
}

.sk-loop--inner.is-active {
  stroke: #fbbf24;
}

.sk-loop--outer.is-active {
  stroke: #f472b6;
}

.sk-path-line {
  stroke: rgba(251, 191, 36, 0.92);
  stroke-width: 0.1;
  stroke-linecap: round;
  stroke-dasharray: 0.18 0.12;
}

.sk-path-loop {
  fill: none;
  stroke: rgba(244, 114, 182, 0.95);
  stroke-width: 0.14;
  stroke-linecap: round;
}

.sk-point {
  --point-size: clamp(32px, 11vw, 46px);
  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;
}

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

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

.sk-point::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20%;
  height: 20%;
  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;
}

.sk-point.has-p1::before,
.sk-point.has-p2::before {
  width: 56%;
  height: 56%;
}

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

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

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

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

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

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

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

.sk-point.is-capture-target::before {
  width: 42%;
  height: 42%;
  background: rgba(244, 114, 182, 0.28);
  border: 2.5px solid rgba(244, 114, 182, 0.98);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.5);
}

.sk-point.is-capture-target.has-p1::before,
.sk-point.is-capture-target.has-p2::before {
  outline: 2px solid rgba(251, 191, 36, 0.95);
  outline-offset: 3px;
}

.sk-point.is-path-end::before {
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.95),
    0 0 14px rgba(244, 114, 182, 0.55);
}

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

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

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

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

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

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

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

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

  .sk-streak {
    text-align: center;
  }

  .sk-point {
    --point-size: clamp(28px, 12vw, 40px);
  }
}

/* 共通の外枠・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,
.sk-stage { width: 100%; max-width: 640px; }
html.gs-playing .gs-bar { gap: 10px; }
html.gs-playing .sk-settings { flex: 1; min-width: 0; max-width: none; margin: 0; }
html.gs-playing .sk-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 .sk-status__text { flex: none; width: 100%; max-width: 640px; min-height: 1.6em; margin: 0; color: var(--play-text); font-size: .875rem; line-height: 1.6; text-align: center; }
html.gs-playing .sk-hint { flex: none; width: 100%; min-height: 2.4em; margin: 0 0 10px; padding: 4px; color: #f9a8d4; background: none; border: 0; }
html.gs-playing .sk-hint[hidden] { display: block !important; visibility: hidden; }
.sk-stage { position: relative; flex: none; }
html.gs-playing .sk-board-wrap { width: min(100%, max(220px, 100dvh - 370px)); }
html.gs-playing .sk-board { border-color: var(--play-border); }
html.gs-playing .sk-legend { flex: none; margin: 0 auto 10px; color: var(--play-text-muted); font-size: .75rem; gap: 6px 12px; }
html.gs-playing .game-controls { flex: none; justify-content: center; margin: 10px 0 0; }
html.gs-playing .sk-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 .sk-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 .sk-board-wrap { width: min(100%, max(220px, 100dvh - 430px)); }
  html.gs-playing .sk-legend { margin-bottom: 18px; }
}

html.gs-playing .sk-streak { flex: none; width: 100%; max-width: 640px; margin: 2px 0 6px; color: var(--play-text-muted); text-align: center; }
html.gs-playing #game-error { display: none; }
html.gs-playing .sk-point { --point-size: clamp(24px, 9vw, 46px); }
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 520px); grid-template-rows: repeat(6, auto); grid-template-areas: "bar board" "hud board" "status board" "streak board" "hint 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 .sk-status__text { grid-area: status; }
  html.gs-playing .sk-streak { grid-area: streak; }
  html.gs-playing .sk-hint { grid-area: hint; min-height: 3.2em; }
  html.gs-playing .sk-stage { grid-area: board; }
  html.gs-playing .sk-board-wrap { width: min(100%, 100dvh - 82px); }
  html.gs-playing .sk-legend { grid-area: legend; margin: 6px 0 0; }
  html.gs-playing .game-controls { grid-area: controls; margin-top: 0; }
}
/* 捕獲ヒントは折り返す前提で2行分を予約する。 */
html.gs-playing .sk-hint { min-height: calc(2.8em + 8px); line-height: 1.4; }
@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 .sk-hint { margin-bottom: 6px; font-size: .8125rem; }
  html.gs-playing .sk-legend { font-size: .6875rem; gap: 4px 8px; margin-bottom: 6px; }
  html.gs-playing .game-controls { margin-top: 6px; }
}
