/* Neon Align 固有スタイル */

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

.na-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 auto 14px;
  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);
}

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

.na-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-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, #e879f9 20%, var(--md-sys-color-surface));
  color: #a21caf;
}

.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, #64748b 16%, var(--md-sys-color-surface));
  color: #475569;
}

.na-result {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  text-align: center;
  animation: na-result-in 200ms ease-out;
}

.na-result.is-win {
  border: 1px solid 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));
}

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

.na-result.is-draw {
  border: 1px solid color-mix(in srgb, #64748b 34%, var(--md-sys-color-outline-variant));
  background: color-mix(in srgb, #64748b 10%, var(--md-sys-color-surface));
}

.na-result__title {
  margin: 0 0 4px;
  font-family: Outfit, "Noto Sans JP", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.na-result__detail {
  margin: 0 0 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.9rem;
}

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

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

.na-layout {
  display: grid;
  gap: 18px;
  margin-bottom: 14px;
}

@media (min-width: 860px) {
  .na-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    align-items: start;
    gap: 22px;
  }
}

.na-board-wrap {
  --na-frame: #38bdf8;
  --na-slot: #0b1630;
  --na-board-bg: linear-gradient(160deg, #14284f 0%, #0d1a36 55%, #0a1428 100%);
  --na-cyan: #22d3ee;
  --na-cyan-deep: #0891b2;
  --na-magenta: #e879f9;
  --na-magenta-deep: #c026d3;
  display: flex;
  justify-content: center;
}

.na-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  padding: 12px;
  border: 2px solid color-mix(in srgb, var(--na-frame) 78%, #ffffff);
  border-radius: 18px;
  background: var(--na-board-bg);
  box-shadow:
    0 0 0 1px rgba(56, 189, 248, 0.18),
    0 0 28px rgba(56, 189, 248, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.na-cell {
  appearance: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 12px;
  background: var(--na-slot);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.na-cell:hover:not(:disabled):not(.is-filled) {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

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

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

.na-cell.is-placeable {
  box-shadow:
    inset 0 0 0 1px rgba(56, 189, 248, 0.45),
    0 0 12px rgba(56, 189, 248, 0.22);
}

.na-cell.is-win {
  background: color-mix(in srgb, #22d3ee 18%, #0b1630);
  border-color: #67e8f9;
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.55),
    0 0 16px rgba(34, 211, 238, 0.45);
}

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

.na-selected__label,
.na-tray__label {
  margin: 0 0 10px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.na-selected__slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  border-radius: 14px;
  background: linear-gradient(160deg, #14284f 0%, #0d1a36 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.12);
}

.na-selected__slot.is-active {
  box-shadow:
    inset 0 0 18px rgba(56, 189, 248, 0.18),
    0 0 16px rgba(56, 189, 248, 0.28);
}

.na-selected__empty {
  color: rgba(186, 230, 253, 0.72);
  font-size: 0.85rem;
  font-weight: 600;
}

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

.na-tray-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 12px;
  background: linear-gradient(160deg, #14284f 0%, #0d1a36 100%);
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.04s ease;
}

.na-tray-btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.7);
}

.na-tray-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.na-tray-btn:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

.na-tray-btn.is-selected {
  border-color: #67e8f9;
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.5),
    0 0 14px rgba(34, 211, 238, 0.4);
}

.na-tray-btn.is-used,
.na-tray-btn:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  box-shadow: none;
}

.na-piece {
  --piece-color: var(--na-cyan, #22d3ee);
  --piece-deep: var(--na-cyan-deep, #0891b2);
  --piece-size: 78%;
  position: relative;
  display: block;
  width: var(--piece-size);
  height: var(--piece-size);
  border: 2px solid color-mix(in srgb, var(--piece-color) 70%, #ffffff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}

.na-piece--cyan {
  --piece-color: #22d3ee;
  --piece-deep: #0891b2;
}

.na-piece--magenta {
  --piece-color: #e879f9;
  --piece-deep: #c026d3;
}

.na-piece--circle {
  border-radius: 50%;
}

.na-piece--square {
  border-radius: 18%;
}

.na-piece--solid {
  background: linear-gradient(155deg, color-mix(in srgb, var(--piece-color) 78%, #ffffff) 0%, var(--piece-color) 42%, var(--piece-deep) 100%);
}

.na-piece--stripe {
  background:
    repeating-linear-gradient(
      135deg,
      color-mix(in srgb, var(--piece-color) 88%, #ffffff) 0 7px,
      var(--piece-deep) 7px 14px
    );
}

.na-piece--lg {
  --piece-size: 78%;
}

.na-piece--sm {
  --piece-size: 48%;
}

.na-cell .na-piece--lg {
  --piece-size: 72%;
}

.na-cell .na-piece--sm {
  --piece-size: 44%;
}

.na-selected__slot .na-piece--lg {
  --piece-size: 52px;
}

.na-selected__slot .na-piece--sm {
  --piece-size: 34px;
}

.na-tray-btn .na-piece--lg {
  --piece-size: 70%;
}

.na-tray-btn .na-piece--sm {
  --piece-size: 44%;
}

.na-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8rem;
  font-weight: 600;
}

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

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

.na-legend__swatch--cyan {
  background: #22d3ee;
}

.na-legend__swatch--magenta {
  background: #e879f9;
}

.na-guide {
  margin: 0 0 14px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.85rem;
  line-height: 1.55;
}

.game-panel.is-locked .na-cell,
.game-panel.is-locked .na-tray-btn {
  pointer-events: none;
}

.how-to-list {
  margin: 0 0 10px;
  padding-left: 1.2em;
}

.how-to-list li {
  margin-bottom: 4px;
}

@media (max-width: 480px) {
  .na-board {
    width: min(100%, 320px);
    gap: 6px;
    padding: 10px;
  }

  .na-tray__grid {
    gap: 6px;
  }

  .na-piece--stripe {
    background:
      repeating-linear-gradient(
        135deg,
        color-mix(in srgb, var(--piece-color) 88%, #ffffff) 0 6px,
        var(--piece-deep) 6px 12px
      );
  }
}

/* 外枠・HUD・操作は共通UI。盤面と16駒のトレーのみ固有配置にする。 */
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 .status-pill { padding: 0; background: none; color: var(--play-accent); font-size: .875rem; }
html.gs-playing .status-pill.is-cpu,
html.gs-playing .status-pill.is-lose { color: #c4b5fd; }
html.gs-playing .na-status__text { color: var(--play-text); font-size: .8125rem; line-height: 1.5; min-height: 3em; display: flex; align-items: center; text-align: center; }
html.gs-playing .na-layout { flex: none; width: 100%; max-width: 640px; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 16px; margin: 6px auto 12px; }
html.gs-playing .na-layout__board { position: relative; min-width: 0; }
html.gs-playing .na-board { width: 100%; box-sizing: border-box; }
html.gs-playing .na-selected { padding: 0; margin-bottom: 10px; border: 0; background: none; }
html.gs-playing .na-selected__label,
html.gs-playing .na-tray__label { color: var(--play-text-muted); margin-bottom: 6px; font-size: .75rem; }
html.gs-playing .na-selected__slot { min-height: 60px; }
html.gs-playing .na-legend { flex: none; width: 100%; max-width: 640px; justify-content: center; margin: 0 0 8px; color: var(--play-text-muted); font-size: .75rem; gap: 4px 10px; }
html.gs-playing .na-guide { flex: none; width: 100%; max-width: 640px; min-height: 3em; margin: 0; color: var(--play-text-muted); text-align: center; font-size: .8125rem; }
html.gs-playing .game-controls { display: flex; justify-content: center; margin: 12px 0 0; }
html.gs-playing .na-result { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; padding: 12px; margin: 0; border-color: var(--play-border); background: rgba(8, 15, 31, .95); color: var(--play-text); }
html.gs-playing .na-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 .na-layout { margin: 6px auto 24px; }
}
@media (max-width: 480px) {
  html.gs-playing .na-layout { gap: 10px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); max-width: 320px; }
  html.gs-playing .na-layout__board { width: 100%; margin: 0 auto; }
  html.gs-playing .na-layout__side { min-width: 0; }
  html.gs-playing .na-tray__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  html.gs-playing .na-tray-btn { padding: 1px; border-radius: 6px; min-height: 26px; }
  html.gs-playing .na-selected__slot { min-height: 58px; }
  html.gs-playing .na-selected__slot .na-piece--lg { --piece-size: 40px; }
  html.gs-playing .na-selected__slot .na-piece--sm { --piece-size: 26px; }
  html.gs-playing .na-result__title { font-size: 1.1rem; }
  html.gs-playing .na-result__detail { font-size: .75rem; margin-bottom: 6px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 420px); grid-template-areas: "bar layout" "hud layout" "legend layout" "guide layout" "controls layout"; align-content: start; align-items: start; justify-content: center; gap: 4px 12px; }
  html.gs-playing .gs-bar { grid-area: bar; margin: 0; }
  html.gs-playing .gs-hud { grid-area: hud; margin: 0; }
  html.gs-playing .na-layout { grid-area: layout; margin: 0; gap: 10px; }
  html.gs-playing .na-legend { grid-area: legend; }
  html.gs-playing .na-guide { grid-area: guide; }
  html.gs-playing .game-controls { grid-area: controls; margin: 0; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .gs-hud { height: 90px; }
}
