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

.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 var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
}

.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;
  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% 35%, #666, #111);
  box-shadow: inset 0 -1px 2px rgba(255, 255, 255, 0.15);
}

.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: 8px;
  box-sizing: border-box;
}

.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #c8a86a;
  border: 2px solid #8b6914;
  border-radius: var(--md-sys-shape-corner-small);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  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(0, 0, 0, 0.12);
}

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

.board__stone--black {
  background: radial-gradient(circle at 32% 28%, #555, #0a0a0a);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.board__stone--white {
  background: radial-gradient(circle at 32% 28%, #fff, #d8d8d8);
  border: 1px solid #aaa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.board__stone.is-last::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: rgba(255, 80, 80, 0.85);
}

.board__stone--white.is-last::after {
  background: rgba(220, 50, 50, 0.75);
}

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