/* 囲碁 9路盤 スタイル(サイバーサッカーと同じネオン基調) */

:root {
  --bg: #04050a;
  --line: #00e5ff;
  --you: #00e5ff;
  --cpu: #ff2bd6;
  --accent: #f6ff3d;
  --text: #dff6ff;
  --dim: #56707a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Share Tech Mono', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', monospace;
  background: var(--bg);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
}

#app {
  height: 100vh;
  height: 100dvh;
  background:
    linear-gradient(rgba(0, 229, 255, 0.05) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(0, 229, 255, 0.05) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1em;
  padding: 1em;
  text-align: center;
}

/* ---- タイトル ---- */

.game-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(3em, 16vw, 4.6em);
  line-height: 1;
  letter-spacing: 0.1em;
  color: var(--you);
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.7), 3px 3px 0 var(--cpu);
}

.game-title small {
  display: block;
  margin-top: 0.35em;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.34em;
  letter-spacing: 0.3em;
  color: var(--text);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
}

.opt-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7em;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

.opt-record {
  min-height: 1.2em;
  font-size: 0.8em;
  color: var(--accent);
}

.seg {
  display: flex;
}

.seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15em;
  min-width: 5.6em;
  padding: 0.5em 0.9em;
  border: 1px solid var(--you);
  margin-left: -1px;
  background: rgba(0, 229, 255, 0.04);
  color: var(--you);
  font-family: 'Orbitron', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 700;
  font-size: 0.95em;
  letter-spacing: 0.06em;
  cursor: pointer;
  touch-action: manipulation;
}

.seg button small {
  font-family: 'Share Tech Mono', 'Hiragino Kaku Gothic ProN', monospace;
  font-weight: normal;
  font-size: 0.72em;
  opacity: 0.8;
}

.seg button[aria-checked="true"] {
  background: var(--you);
  color: #001318;
  box-shadow: 0 0 14px rgba(0, 229, 255, 0.55);
}

#seg-color button {
  flex-direction: row;
  gap: 0.4em;
}

.stone-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  vertical-align: -0.12em;
}

.stone-icon.black {
  background: radial-gradient(circle at 35% 30%, #5b6474, #07080c 70%);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.7);
}

.stone-icon.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #b9d6e2 75%);
  box-shadow: 0 0 6px rgba(223, 246, 255, 0.7);
}

.rules {
  margin: 0;
  font-size: 0.78em;
  line-height: 1.7;
  opacity: 0.75;
}

/* ---- プレイヤー名 ---- */

.name-box {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

.name-box label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7em;
  letter-spacing: 0.15em;
  opacity: 0.7;
}

#player-name {
  font: inherit;
  font-size: 1.05em;
  padding: 0.4em 0.8em;
  width: 12em;
  max-width: 80vw;
  border: 1px solid var(--you);
  border-radius: 0;
  background: rgba(0, 229, 255, 0.06);
  color: var(--text);
  text-align: center;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

#player-name:focus {
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.5);
}

/* ---- ボタン ---- */

.btn {
  font-family: 'Orbitron', 'Hiragino Kaku Gothic ProN', sans-serif;
  font-weight: 700;
  font-size: 1.05em;
  letter-spacing: 0.1em;
  padding: 0.75em 2em;
  border: 2px solid var(--you);
  border-radius: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-main {
  background: var(--you);
  color: #001318;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.6);
}

.btn-sub {
  background: transparent;
  color: var(--you);
  font-size: 0.85em;
  padding: 0.6em 1.4em;
}

.btn-sub small {
  font-family: 'Share Tech Mono', monospace;
  font-weight: normal;
  opacity: 0.8;
}

.btn.danger {
  border-color: var(--cpu);
  color: var(--cpu);
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn:active:not(:disabled) {
  transform: scale(0.95);
}

.btn-row {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* ---- トグルスイッチ(サイバーサッカーと共通の見た目) ---- */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.4em 0.2em;
  border: none;
  background: none;
  color: var(--text);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 0.8em;
  letter-spacing: 0.1em;
  cursor: pointer;
  touch-action: manipulation;
}

.switch-track {
  position: relative;
  width: 3.4em;
  height: 1.7em;
  border: 2px solid var(--you);
  background: rgba(0, 229, 255, 0.25);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.45);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.switch-knob {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: calc(100% - 1.15em - 2px);
  width: 1.15em;
  background: var(--you);
  transition: left 0.15s, background 0.15s;
}

.switch-state {
  width: 2.2em;
  text-align: left;
  color: var(--you);
}

.switch[aria-checked="false"] .switch-track {
  border-color: var(--dim);
  background: transparent;
  box-shadow: none;
}

.switch[aria-checked="false"] .switch-knob {
  left: 2px;
  background: var(--dim);
}

.switch[aria-checked="false"] .switch-state {
  color: var(--dim);
}

/* ---- 対局画面 ---- */

.screen-play {
  position: relative;
  padding: 0;
  gap: 0;
  justify-content: flex-start;
}

#hud {
  flex: none;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5em;
  padding: 0.45em 0.7em;
  font-size: 0.9em;
  border-bottom: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
}

.hud-side {
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.2em 0.4em;
  border: 1px solid transparent;
  white-space: nowrap;
  justify-self: start;
}

.hud-side.right {
  justify-self: end;
}

.hud-side.active {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(246, 255, 61, 0.35);
}

.hud-side .who {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.hud-side .who.you { color: var(--you); }
.hud-side .who.cpu { color: var(--cpu); }

.hud-side .cap {
  font-size: 0.8em;
  opacity: 0.75;
}

.hud-side .cap b {
  font-size: 1.15em;
  color: #fff;
}

.hud-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8em;
  line-height: 1.3;
  opacity: 0.8;
}

#hud-level {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
}

#board-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4em;
}

#board {
  display: block;
  touch-action: none;
  cursor: pointer;
}

#status {
  flex: none;
  width: 100%;
  padding: 0.3em 0.7em calc(0.9em + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
}

#status-msg {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.95em;
  letter-spacing: 0.04em;
}

#status-msg.thinking {
  color: var(--cpu);
  animation: blink 1s steps(2) infinite;
}

#status-msg.yours {
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0.45; }
}

/* ---- 終局 ---- */

#result {
  flex: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 0.7em calc(0.6em + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(0, 229, 255, 0.3);
  background: rgba(0, 0, 0, 0.6);
}

#result-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: clamp(1.6em, 8vw, 2.4em);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(246, 255, 61, 0.6);
}

#result-title.lose {
  color: var(--cpu);
  text-shadow: 0 0 18px rgba(255, 43, 214, 0.6);
}

#result-score {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.15em;
}

#result-detail {
  margin: 0;
  font-size: 0.82em;
  opacity: 0.85;
}

/* ---- ランキング ---- */

#ranking {
  width: min(420px, 94vw);
  max-height: 24vh;
  overflow-y: auto;
  border: 1px solid rgba(0, 229, 255, 0.35);
  background: rgba(0, 229, 255, 0.05);
  padding: 0.4em 0.7em;
}

#ranking h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75em;
  letter-spacing: 0.15em;
  margin: 0 0 0.3em;
  color: var(--you);
}

#ranking table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

#ranking td {
  padding: 0.2em 0.4em;
  border-top: 1px solid rgba(0, 229, 255, 0.15);
  text-align: right;
  white-space: nowrap;
}

#ranking td.name {
  text-align: left;
  width: 100%;
  white-space: normal;
  word-break: break-all;
}

#ranking tr.me td {
  color: var(--accent);
  background: rgba(246, 255, 61, 0.08);
}

#ranking p {
  margin: 0.3em 0;
  font-size: 0.85em;
  color: var(--accent);
}

#result .footer-note {
  margin-top: 0.2em;
}

/* ---- 投了確認 ---- */

#confirm {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 10, 0.75);
}

.confirm-box {
  padding: 1.2em 1.6em;
  border: 1px solid var(--cpu);
  background: rgba(4, 5, 10, 0.95);
  box-shadow: 0 0 18px rgba(255, 43, 214, 0.35);
}

.confirm-box p {
  margin: 0 0 1em;
  font-size: 1.1em;
}

/* 背の低い画面ではタイトルの間隔を詰める */
@media (max-height: 700px) {
  #screen-title { gap: 0.6em; }
  .game-title { font-size: clamp(2.4em, 12vw, 3.4em); }
}

/* 2026.11.08(01) */
