/* 五子棋专属样式（公共组件、变量见 ../../style.css） */

#app {
  display: grid;
  grid-template-columns: 240px auto;
  grid-template-areas: "sidebar board";
  gap: 20px;
  align-items: start;
}
#sidebar { grid-area: sidebar; }
#board-wrap { grid-area: board; }

#sidebar {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.actions { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn:active:not(:disabled) { transform: translateY(1px); }

/* 棋盘 */
#board-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
#board {
  width: min(90vw, 540px);
  height: min(90vw, 540px);
  border-radius: 12px;
  box-shadow: var(--shadow);
  /* 允许上下滚动（pan-y），轻点仍可靠落子；水平手势不触发滚动避免误触 */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* 执子：radio 单选行 */
.radio-row {
  display: flex;
  gap: 16px;
  align-items: center;
}
.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}
.radio-item input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}
.radio-stone {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.radio-stone.black { background: radial-gradient(circle at 30% 30%, #555, #1a1a1a); }
.radio-stone.white { background: radial-gradient(circle at 30% 30%, #fff, #d4c4a8); border: 1px solid #c4b48a; }

/* 禁手：toggle 开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 24px;
  transition: background .2s;
}
.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* 执子 / 禁手：标签与控件同行（更紧凑、符合触屏习惯） */
#color-group,
#forbid-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#color-group .control-label { flex: 0 0 auto; }
#forbid-group .control-label { flex: 0 0 auto; white-space: nowrap; }
#color-group .radio-row { gap: 12px; }
#color-group .radio-item { gap: 5px; }

/* 轮次指示器 */
#turn-indicator { font-size: 14px; }

/* 响应式：窄屏侧栏在上 */
@media (max-width: 640px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "board";
  }
  #sidebar {
    padding: 16px;
  }
  #board {
    width: min(92vw, 420px);
    height: min(92vw, 420px);
  }
  /* 紧凑布局：控件横排 */
  .control-group { display: flex; flex-direction: row; align-items: center; gap: 8px; }
  .control-group .control-label { min-width: 3em; }
  .control-group select { flex: 1; }
  .actions { flex-direction: row; flex-wrap: wrap; }
  .actions .btn-primary { flex: 1 1 100%; }
  .btn-row { flex: 1; }
  .hints-tip { display: none; }
}
