/* 五目並べツール固有スタイル */

.mode-buttons {
  margin-top: 20px;
}

.mode-buttons .btn {
  flex: 1 1 0;
  min-width: 9rem;
  justify-content: center;
}

.difficulty-group {
  margin-top: 20px;
}

.option-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.option-tab {
  appearance: none;
  min-height: 48px;
  padding: 10px 12px;
  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: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);
}

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

.game-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(96, 154, 214, 0.28);
  border-radius: var(--md-sys-shape-corner-medium);
  background:
    radial-gradient(circle at 8% 0%, rgba(63, 196, 255, 0.06), transparent 55%),
    var(--md-sys-color-surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--md-sys-color-surface));
  color: var(--md-sys-color-primary);
  font-size: 0.8125rem;
  font-weight: 700;
}

.status-pill.is-black {
  background: color-mix(in srgb, #1a1a1a 14%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
}

.status-pill.is-white {
  background: color-mix(in srgb, #888 12%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
}

.status-pill.is-win {
  background: color-mix(in srgb, var(--success) 14%, var(--md-sys-color-surface));
  color: var(--success);
}

.status-pill.is-lose {
  background: var(--danger-container);
  color: var(--danger);
}

.status-pill.is-draw {
  background: color-mix(in srgb, var(--md-sys-color-outline) 18%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface-variant);
}

.game-status__text {
  margin: 0;
  color: var(--md-sys-color-on-surface);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.5;
}

.player-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.player-info__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--md-sys-color-outline-variant) 40%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 600;
}

.player-info__item.is-active {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 1px;
}

.stone-dot {
  inline-size: 12px;
  block-size: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.stone-dot--black {
  background: radial-gradient(circle at 35% 32%, #aeb6c6 0%, #5c6678 45%, #3a4254 100%);
  border: 1px solid rgba(198, 214, 235, 0.9);
  box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.18);
}

.stone-dot--white {
  background: radial-gradient(circle at 35% 35%, #fff, #ccc);
  border: 1px solid #bbb;
}

.board-wrap {
  width: 100%;
  max-width: min(100%, 520px);
  margin: 0 auto;
  padding: 14px;
  box-sizing: border-box;
  border: 1px solid rgba(96, 154, 214, 0.35);
  border-radius: var(--md-sys-shape-corner-large);
  background:
    radial-gradient(circle at 18% 0%, rgba(63, 196, 255, 0.14), transparent 62%),
    radial-gradient(circle at 86% 100%, rgba(122, 157, 255, 0.14), transparent 60%),
    linear-gradient(160deg, #16264a 0%, #101c38 55%, #0d1730 100%);
  box-shadow: 0 14px 34px rgba(28, 52, 96, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 20% 12%, rgba(63, 196, 255, 0.16), transparent 42%),
    radial-gradient(circle at 82% 88%, rgba(167, 139, 250, 0.12), transparent 46%),
    linear-gradient(160deg, #1a2f58 0%, #122246 48%, #0d1a38 100%);
  border: 2px solid rgba(96, 180, 255, 0.55);
  border-radius: var(--md-sys-shape-corner-small);
  box-shadow:
    0 0 0 1px rgba(63, 196, 255, 0.18),
    inset 0 0 28px rgba(20, 60, 120, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  touch-action: manipulation;
}

.board__play-area {
  position: absolute;
  inset: 3.5%;
}

.board__lines {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board__grid {
  position: absolute;
  inset: 0;
}

.board__cell {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell-size, 7%);
  height: var(--cell-size, 7%);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  -webkit-tap-highlight-color: transparent;
}

.board__cell:disabled {
  cursor: default;
}

.board__cell:not(:disabled):hover::before,
.board__cell:not(:disabled):focus-visible::before {
  content: "";
  position: absolute;
  inline-size: 42%;
  block-size: 42%;
  border-radius: 50%;
  background: rgba(63, 196, 255, 0.28);
  box-shadow: 0 0 10px rgba(63, 196, 255, 0.45);
}

.board__stone {
  position: relative;
  inline-size: 88%;
  block-size: 88%;
  border-radius: 50%;
  pointer-events: none;
}

.board__stone--black {
  /* ミッド〜ライトチャコール。濃紺盤面との輝度差を確保 */
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.62) 0%, rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 42% 38%, #a8b0c0 0%, #6e788c 30%, #4a5366 62%, #3a4254 100%);
  border: 2px solid rgba(198, 214, 235, 0.98);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.32),
    inset 0 -3px 6px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(140, 170, 210, 0.45),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

.board__stone--white {
  background: radial-gradient(circle at 32% 28%, #fff, #d4dae4);
  border: 1px solid rgba(190, 210, 235, 0.75);
  box-shadow:
    inset 0 -1px 2px rgba(40, 60, 90, 0.12),
    0 0 6px rgba(180, 210, 255, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.18);
}

.board__stone.is-last::after {
  content: "";
  position: absolute;
  /* 中心ドットではなく細いリングで、石本体の視認を妨げない */
  inset: 30%;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(120, 210, 255, 0.92);
  box-shadow: 0 0 3px rgba(63, 196, 255, 0.35);
  box-sizing: border-box;
}

.board__stone--black.is-last::after {
  border-color: rgba(170, 225, 255, 0.95);
}

.board__stone--white.is-last::after {
  border-color: rgba(255, 150, 215, 0.92);
  box-shadow: 0 0 3px rgba(255, 122, 217, 0.35);
}

.qr-preview {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface);
  text-align: center;
}

#room-qr-code {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
}

#room-qr-code img,
#room-qr-code canvas {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
}

.qr-preview p {
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.6;
}

.qr-actions {
  justify-content: center;
  margin-top: 16px;
}

.waiting-message {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--md-sys-color-primary) 10%, var(--md-sys-color-surface));
  color: var(--md-sys-color-on-surface);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
}

@media (max-width: 480px) {
  .board-wrap {
    padding: 4px;
  }

  .game-status {
    padding: 12px;
  }

  .option-tab {
    min-height: 46px;
    padding: 9px 8px;
    font-size: 0.8125rem;
  }
}
