/* ===== リセット ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== ベース ===== */
body {
  background-color: #0b0b0e;
  color: #e2e2e9;
  font-family: 'Consolas', 'Courier New', monospace, 'BIZ UD Gothic', 'Hiragino Kaku Gothic ProN', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 20px 16px 30px;
  /* CRT風スキャンライン */
  background-image:
    linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%),
    linear-gradient(90deg, rgba(255,0,0,0.02), rgba(0,255,0,0.01), rgba(0,0,255,0.02));
  background-size: 100% 4px, 6px 100%;
  user-select: none;
}

.container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ===== ヘッダー ===== */
header {
  text-align: center;
  padding: 16px 20px 14px;
  border: 2px double #00ff66;
  background-color: rgba(12, 12, 18, 0.85);
  box-shadow: 0 0 20px rgba(0, 255, 102, 0.12);
  border-radius: 4px;
}

h1 {
  font-size: 2rem;
  color: #00ff66;
  text-shadow: 0 0 10px rgba(0, 255, 102, 0.5);
  letter-spacing: 4px;
  font-weight: bold;
  line-height: 1;
}

.subtitle {
  font-size: 0.72rem;
  color: #556;
  letter-spacing: 7px;
  margin-top: 5px;
}

/* ===== ゲームエリア ===== */
.game-area {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== スコアボード ===== */
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #12121c;
  border: 1px solid #2a2a3e;
  border-radius: 6px;
  padding: 10px 14px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.35);
}

.player-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid transparent;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.player-panel.active {
  border-color: #00ff66;
  background-color: rgba(0, 255, 102, 0.06);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.12);
}

.panel-stone {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
}

.panel-stone.black {
  background: radial-gradient(circle at 36% 34%, #777, #111 65%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.7);
}

.panel-stone.white {
  background: radial-gradient(circle at 36% 34%, #ffffff, #c8c8c8 65%);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.panel-label {
  font-size: 0.65rem;
  color: #778;
  letter-spacing: 2px;
  line-height: 1;
}

.panel-count {
  font-size: 1.7rem;
  font-weight: bold;
  color: #e8e8f0;
  line-height: 1.1;
}

.turn-center {
  text-align: center;
  flex-shrink: 0;
}

.turn-text {
  font-size: 0.82rem;
  color: #00cc55;
  letter-spacing: 2px;
  text-shadow: 0 0 6px rgba(0, 204, 85, 0.4);
  white-space: nowrap;
}

@keyframes thinkBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.turn-text.thinking {
  animation: thinkBlink 0.85s ease-in-out infinite;
}

/* ===== メッセージ ===== */
.message {
  text-align: center;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 0.88rem;
  letter-spacing: 1px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.message-hidden {
  opacity: 0;
  border: 1px solid transparent;
  background: transparent;
  pointer-events: none;
}

.message-pass {
  background-color: rgba(255, 159, 0, 0.07);
  border: 1px solid rgba(255, 159, 0, 0.35);
  color: #ff9f00;
}

.message-result {
  background-color: rgba(0, 255, 102, 0.07);
  border: 1px solid rgba(0, 255, 102, 0.4);
  color: #00ff66;
  font-weight: bold;
  font-size: 0.95rem;
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
}

/* ===== 盤面ラッパー ===== */
.board-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

/* ===== 盤面 ===== */
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  background-color: #082010; /* 1pxギャップの色 = 盤面の線 */
  border: 3px solid #0f4a1e;
  border-radius: 3px;
  box-shadow:
    0 0 24px rgba(0, 180, 70, 0.18),
    0 0 60px rgba(0, 80, 30, 0.12),
    inset 0 0 8px rgba(0, 0, 0, 0.4);
  width: 100%;
}

/* ===== マス ===== */
.cell {
  aspect-ratio: 1;
  background-color: #1b6b2c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  position: relative;
  transition: background-color 0.1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cell.valid {
  cursor: pointer;
}

.cell.valid:hover {
  background-color: #21803500;
}

/* 最後に置いたマスをわずかに明るく */
.cell.last-move {
  background-color: #216230;
}

/* ===== 石 ===== */
.stone {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  pointer-events: none;
  position: relative;
}

.stone.black {
  background: radial-gradient(circle at 36% 32%, #686868, #111 65%);
  box-shadow:
    0 2px 5px rgba(0,0,0,0.7),
    inset 0 1px 2px rgba(255,255,255,0.08);
}

.stone.white {
  background: radial-gradient(circle at 36% 32%, #ffffff, #c4c4c4 65%);
  box-shadow:
    0 2px 5px rgba(0,0,0,0.5),
    inset 0 1px 3px rgba(255,255,255,0.9);
}

/* 石を置いたときのスケールイン */
@keyframes stonePlace {
  0%   { transform: scale(0); opacity: 0.6; }
  65%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.stone.placing {
  animation: stonePlace 0.18s ease-out forwards;
}

/* ===== 置ける場所のヒント ===== */
.hint {
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background-color: rgba(0, 255, 102, 0.22);
  border: 2px solid rgba(0, 255, 102, 0.42);
  pointer-events: none;
  transition: background-color 0.1s, transform 0.1s;
}

.cell.valid:hover .hint {
  background-color: rgba(0, 255, 102, 0.42);
  transform: scale(1.15);
}

/* ===== コントロール ===== */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-reset {
  background-color: transparent;
  border: 2px solid #00ff66;
  color: #00ff66;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  letter-spacing: 5px;
  padding: 10px 36px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.btn-reset:hover {
  background-color: rgba(0, 255, 102, 0.1);
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.28);
}

.btn-reset:active {
  transform: scale(0.96);
  background-color: rgba(0, 255, 102, 0.2);
}

/* ===== 一覧に戻るボタン ===== */
.btn-back {
  display: inline-block;
  color: #556;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  letter-spacing: 2px;
  padding: 10px 22px;
  border: 2px solid #334;
  border-radius: 4px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover {
  color: #00cc55;
  border-color: #00cc55;
  background-color: rgba(0, 204, 85, 0.07);
}

.btn-back:active {
  transform: scale(0.96);
}

/* ===== フッター ===== */
footer {
  text-align: center;
  padding-top: 6px;
}

.footer-link {
  color: #445;
  font-size: 0.75rem;
  letter-spacing: 2px;
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: #00cc55;
}

/* ===== レスポンシブ：スマートフォン ===== */
@media (max-width: 480px) {
  body {
    padding: 14px 10px 20px;
  }

  .container {
    gap: 12px;
  }

  header {
    padding: 13px 14px 11px;
  }

  h1 {
    font-size: 1.65rem;
    letter-spacing: 2px;
  }

  .scoreboard {
    padding: 8px 10px;
  }

  .player-panel {
    gap: 7px;
    padding: 5px 7px;
  }

  .panel-stone {
    width: 24px;
    height: 24px;
  }

  .panel-count {
    font-size: 1.4rem;
  }

  .turn-text {
    font-size: 0.74rem;
    letter-spacing: 1px;
  }

  .message {
    font-size: 0.82rem;
    min-height: 36px;
  }

  .game-area {
    gap: 10px;
  }
}

/* ===== レスポンシブ：極小スクリーン ===== */
@media (max-width: 340px) {
  .panel-stone {
    width: 20px;
    height: 20px;
  }

  .player-panel {
    gap: 5px;
    padding: 4px 5px;
  }

  .panel-count {
    font-size: 1.2rem;
  }

  .turn-text {
    font-size: 0.68rem;
  }
}
