/* Seega（セーガ）固有スタイル（ネオン強度：中程度） */

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

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

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

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

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

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

.sg-score__label {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

.sg-score__hand {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.7rem;
  font-weight: 600;
}

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

.sg-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-player {
  background: color-mix(in srgb, #22d3ee 22%, var(--md-sys-color-surface));
  color: #0e7490;
}

.status-pill.is-cpu {
  background: color-mix(in srgb, #c084fc 20%, var(--md-sys-color-surface));
  color: #7e22ce;
}

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

.sg-phase {
  max-width: min(100%, 480px);
  margin: 0 auto 6px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--md-sys-color-on-surface-variant);
}

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

.sg-result {
  max-width: min(100%, 480px);
  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: sg-result-in 200ms ease-out;
}

.sg-result.is-win {
  border-color: color-mix(in srgb, var(--success, #16a34a) 38%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, var(--success, #16a34a) 10%, var(--md-sys-color-surface));
}

.sg-result.is-lose {
  border-color: color-mix(in srgb, #ef4444 34%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #ef4444 10%, var(--md-sys-color-surface));
}

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

.sg-result__title {
  margin: 0 0 6px;
  font-family: Outfit, "Noto Sans JP", sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
}

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

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

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

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

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

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

.sg-legend__swatch--player {
  background: linear-gradient(160deg, #67e8f9, #0891b2);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 2px color-mix(in srgb, #22d3ee 35%, transparent);
}

.sg-legend__swatch--cpu {
  background: linear-gradient(160deg, #e9d5ff, #a21caf);
  border-radius: 4px;
}

.sg-legend__center {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px dashed color-mix(in srgb, #fbbf24 70%, white);
  background: color-mix(in srgb, #fbbf24 18%, #14284f);
}

.sg-board-wrap {
  --sg-player: #22d3ee;
  --sg-cpu: #e879f9;
  --sg-frame: #38bdf8;
  --sg-board-bg: linear-gradient(160deg, #14284f 0%, #0d1a36 55%, #0a1428 100%);
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
  max-width: min(100%, 460px);
}

.sg-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 10px;
  border: 2px solid color-mix(in srgb, var(--sg-frame) 70%, #0ea5e9);
  border-radius: 18px;
  background: var(--sg-board-bg);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.18),
    0 10px 28px rgba(8, 20, 48, 0.28);
}

.sg-cell {
  position: relative;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  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.12);
}

.sg-cell:nth-child(odd) {
  background: #1e3a64;
}

.sg-cell--center {
  background:
    linear-gradient(145deg, color-mix(in srgb, #fbbf24 16%, #1a3358), #152a4c);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in srgb, #fbbf24 55%, transparent),
    inset 0 0 0 1px rgba(56, 189, 248, 0.12);
}

.sg-cell--center::before {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  min-width: 10px;
  min-height: 10px;
  border: 1.5px solid color-mix(in srgb, #fbbf24 65%, white);
  border-radius: 3px;
  opacity: 0.7;
  pointer-events: none;
  transform: rotate(45deg);
}

.sg-cell--playable {
  cursor: pointer;
}

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

.sg-cell--playable:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: -2px;
  z-index: 2;
}

.sg-cell.is-selected {
  box-shadow:
    inset 0 0 0 3px #67e8f9,
    0 0 12px color-mix(in srgb, #22d3ee 35%, transparent);
  z-index: 1;
}

.sg-cell.is-continue {
  box-shadow:
    inset 0 0 0 3px #f0abfc,
    0 0 12px color-mix(in srgb, #e879f9 30%, transparent);
}

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

.sg-cell.is-place-target::after {
  width: 22%;
  height: 22%;
  min-width: 8px;
  min-height: 8px;
  background: color-mix(in srgb, #67e8f9 50%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, #22d3ee 40%, transparent);
}

.sg-cell.is-move-target::after {
  width: 18%;
  height: 18%;
  min-width: 8px;
  min-height: 8px;
  background: color-mix(in srgb, #67e8f9 55%, transparent);
}

.sg-cell.is-capture-target::after {
  width: 42%;
  height: 42%;
  min-width: 16px;
  min-height: 16px;
  border: 2px solid color-mix(in srgb, #f0abfc 85%, white);
  background: color-mix(in srgb, #e879f9 14%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, #e879f9 35%, transparent);
}

.sg-cell.is-last-to {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, #38bdf8 70%, white);
}

.sg-cell.is-last-from {
  opacity: 0.92;
}

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

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

.sg-piece {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72%;
  height: 72%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.35),
    inset 0 1px 2px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.sg-piece--player {
  border-radius: 50%;
  background: linear-gradient(160deg, #67e8f9 0%, #22d3ee 45%, #0891b2 100%);
}

.sg-piece--cpu {
  border-radius: 22%;
  background: linear-gradient(160deg, #f0abfc 0%, #e879f9 45%, #a21caf 100%);
}

.sg-piece__mark {
  pointer-events: none;
}

.sg-piece__mark--ring {
  display: block;
  width: 42%;
  height: 42%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
}

.sg-piece__mark--dot {
  display: block;
  width: 28%;
  height: 28%;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.8);
  transform: rotate(45deg);
}

.sg-howto {
  max-width: min(100%, 480px);
  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;
}

@media (max-width: 520px) {
  .sg-board-wrap {
    max-width: min(100%, 100vw - 32px);
  }

  .sg-status {
    max-width: 100%;
  }

  .sg-score {
    min-width: 4.8rem;
    padding: 5px 8px;
  }

  .sg-board {
    gap: 2px;
    padding: 8px;
  }

  .sg-piece {
    width: 76%;
    height: 76%;
  }
}

/* 共通プレイUIを再利用し、5×5盤と説明領域だけ固有サイズにする。 */
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 { width: 100%; max-width: 640px; flex: none; }
html.gs-playing .sg-score__hand { min-height: 1.5em; font-size: .75rem; color: var(--play-text-muted); }
html.gs-playing .sg-score__hand[hidden] { display: block !important; visibility: hidden; }
html.gs-playing .status-pill { padding: 0; background: none; color: var(--play-accent); font-size: 1rem; }
html.gs-playing .status-pill.is-cpu,
html.gs-playing .status-pill.is-lose { color: #c4b5fd; }
html.gs-playing .sg-status__text,
html.gs-playing .sg-phase,
html.gs-playing .sg-guide { flex: none; width: 100%; max-width: 640px; margin: 0; text-align: center; color: var(--play-text); font-size: .8125rem; line-height: 1.5; }
html.gs-playing .sg-status__text,
html.gs-playing .sg-phase { min-height: 1.5em; }
html.gs-playing .sg-phase { color: var(--play-text-muted); }
html.gs-playing .sg-guide { min-height: 3em; margin: 6px 0; }
html.gs-playing .sg-legend { flex: none; max-width: 640px; margin: 0 auto 8px; gap: 4px 12px; color: var(--play-text-muted); font-size: .75rem; }
html.gs-playing .sg-board-wrap { flex: none; position: relative; width: min(100%, max(180px, calc(100dvh - 400px))); max-width: 440px; }
html.gs-playing .sg-howto { display: none; }
html.gs-playing .game-controls { justify-content: center; margin: 12px 0 0; }
html.gs-playing .sg-result { position: absolute; inset: 0; z-index: 3; max-width: none; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; border-color: var(--play-border); background: rgba(8, 15, 31, .95); color: var(--play-text); }
html.gs-playing .sg-result__detail { color: var(--play-text-muted); }
@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: 18px; }
  html.gs-playing .sg-guide { margin: 10px 0; }
  html.gs-playing .sg-legend { margin-bottom: 16px; }
  html.gs-playing .sg-board-wrap { width: min(100%, max(180px, calc(100dvh - 440px))); }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel { display: grid; grid-template-columns: minmax(240px, 300px) minmax(0, 300px); grid-template-areas: "bar board" "hud board" "status board" "phase board" "guide board" "legend controls"; gap: 4px 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 .sg-status__text { grid-area: status; }
  html.gs-playing .sg-phase { grid-area: phase; }
  html.gs-playing .sg-guide { grid-area: guide; margin: 0; }
  html.gs-playing .sg-board-wrap { grid-area: board; width: min(100%, calc(100dvh - 90px)); }
  html.gs-playing .sg-legend { grid-area: legend; margin: 0; }
  html.gs-playing .game-controls { grid-area: controls; 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: 4px; }
  html.gs-playing .sg-guide { margin: 2px 0; }
  html.gs-playing .sg-legend { margin-bottom: 4px; font-size: .6875rem; }
  html.gs-playing .game-controls { margin-top: 6px; }
}
