/* 围棋 / 五子棋 纯前端界面样式
   配色沿用桌面版: 深色菜单背景 + 象牙色卡片 + 朱砂/青玉点缀;
   对局视图 = 左侧木纹棋盘 (canvas 绘制) + 右侧象牙色信息栏. */

:root {
  --bg-top: #22201c;
  --bg-bottom: #131211;
  --ivory: #f7f1e6;
  --ivory-hover: #fdf9f1;
  --ink: #2c2620;
  --muted: #847868;
  --card-border: #d3c5ae;
  --accent: #be6a3f;
  --jade: #527660;
  --gold: #c9a86a;
  --amber: #96684a;
  --panel-text: #3c2d1e;
  --panel-muted: #82735f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    "Source Han Sans SC", "WenQuanYi Micro Hei", sans-serif;
  background: var(--bg-bottom);
  color: var(--ink);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#app { height: 100vh; }

.view { height: 100%; }

.hidden { display: none !important; }

/* ---------------- 主菜单 ---------------- */

#menu-view {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
  color: #f1eadd;
  background:
    radial-gradient(circle at 16% 18%, rgba(230, 176, 110, 0.14), transparent 34%),
    radial-gradient(circle at 86% 84%, rgba(120, 160, 140, 0.10), transparent 30%),
    linear-gradient(var(--bg-top), var(--bg-bottom));
}

.menu-brand {
  margin-top: 6vh;
  font-size: 14px;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  color: var(--gold);
}

.menu-title {
  margin-top: 12px;
  font-size: 44px;
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.menu-subtitle {
  margin-top: 10px;
  font-size: 17px;
  color: #a89b88;
}

.menu-rule {
  width: 220px;
  height: 1px;
  margin-top: 18px;
  position: relative;
  background: linear-gradient(90deg, transparent, #5c5040 20%, #5c5040 80%, transparent);
}

.menu-rule::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--gold);
}

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 34px;
  margin: auto;
  padding: 44px 24px;
}

.card {
  width: 280px;
  height: 330px;
  padding: 18px;
  position: relative;
  background: var(--ivory);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
}

.card:hover, .card.focused {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  background: var(--ivory-hover);
}

.card .preview {
  display: block;
  width: 100%;
  height: 56%;
  border-radius: 12px;
}

.card-label {
  margin-top: 18px;
  text-align: center;
  font-size: 26px;
  font-weight: 600;
}

.card-desc {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.badge {
  position: absolute;
  top: 26px;
  right: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--jade);
  color: #f4efe4;
  font-size: 12px;
}

.badge.amber { background: var(--amber); }

.menu-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 22px;
  font-size: 14px;
  color: #a89b88;
}

kbd {
  padding: 2px 8px;
  border-radius: 6px;
  background: #36312b;
  border: 1px solid #685e51;
  color: #f1eadd;
  font-size: 12px;
  font-family: inherit;
}

#menu-back {
  position: absolute;
  left: 36px;
  bottom: 34px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #342f2a;
  border: 1px solid #60574c;
  color: #f1eadd;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#menu-back:hover { background: var(--accent); }

/* ---------------- 对局视图 ---------------- */

#game-view { display: flex; }

#board-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: #ddbb8d;
}

#board { display: block; }

#sidebar {
  width: 360px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px;
  overflow-y: auto;
  color: var(--panel-text);
  background: linear-gradient(var(--panel-top), #eae2cf);
  border-left: 2px solid var(--accent);
}

.side-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 700;
}

.side-title .stones-ico {
  width: 34px;
  height: 18px;
  position: relative;
  flex: none;
}

.side-title .stones-ico::before,
.side-title .stones-ico::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.side-title .stones-ico::before { left: 0; background: #141414; }
.side-title .stones-ico::after {
  right: 0;
  background: #f0f0f0;
  border: 1px solid var(--accent);
}

.side-subtitle {
  margin-top: 4px;
  padding-left: 44px;
  font-size: 13px;
  color: var(--panel-muted);
}

.side-sep {
  height: 1px;
  margin: 6px 0;
  background: #e0d2be;
}

.player-cards {
  display: flex;
  gap: 8px;
}

.pcard {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fbf7ef;
  border: 1px solid #d8ccba;
}

.pcard.active {
  background: #faf0dc;
  border: 2px solid var(--accent);
}

.pcard .stone-ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
}

.pcard .stone-ico.black { background: radial-gradient(circle at 35% 30%, #68686e, #08080a); }
.pcard .stone-ico.white { background: radial-gradient(circle at 35% 30%, #fffdf8, #cfc7b6); border: 1px solid #b0a890; }

.pcard .pc-main { flex: 1; min-width: 0; }

.pcard .pc-label { font-size: 16px; font-weight: 600; }

.pcard .pc-note {
  font-size: 12px;
  color: var(--panel-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcard .pc-caps {
  font-size: 12px;
  color: var(--panel-muted);
  flex: none;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 9px;
  background: #54412f;
  border: 1px solid #463626;
  color: #faf4e8;
}

.status-strip .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
  border: 1px solid rgba(150, 140, 128, 0.9);
}

.status-strip .dot.black { background: #141414; }
.status-strip .dot.white { background: #f6f6f6; }
.status-strip .dot.none { background: var(--accent); }

.status-first { font-size: 15px; }

.status-second {
  font-size: 12px;
  color: #cec0ac;
  margin-top: 1px;
}

.side-hint {
  font-size: 12px;
  color: var(--panel-muted);
  text-align: center;
}

.info-rows { display: flex; flex-direction: column; gap: 1px; }

.info-rows .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 15px;
}

.info-rows .row:nth-child(odd) { background: #fbf7ef; }
.info-rows .row:nth-child(even) { background: #f4eee3; }

.info-rows dt { color: var(--panel-muted); font-weight: 400; }
.info-rows dd { font-weight: 600; }

.btn-groups { display: flex; flex-direction: column; gap: 4px; }

.group-title {
  font-size: 12px;
  color: var(--panel-muted);
  margin-top: 4px;
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 3px;
}

.btn-grid button {
  height: 33px;
  padding: 0 4px;
  border-radius: 9px;
  border: 1px solid #d0c2ae;
  background: #fdfaf4;
  color: var(--panel-text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-grid button:hover:not(:disabled) {
  background: #f3e3ca;
  border-color: var(--accent);
}

.btn-grid button:disabled {
  background: #e8e2d8;
  color: var(--panel-muted);
  cursor: not-allowed;
}

.log-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.move-log {
  min-height: 60px;
}

.log-list {
  list-style: none;
  columns: 2;
  column-gap: 14px;
  font-size: 14px;
  line-height: 21px;
  max-height: 170px;
  overflow-y: auto;
}

/* ---------------- 模态确认框 ---------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(14, 12, 10, 0.59);
}

.modal-panel {
  width: min(440px, calc(100vw - 48px));
  background: #faf6ee;
  border: 1px solid #ccbea8;
  border-radius: 14px;
  padding: 26px;
  position: relative;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

.modal-panel::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.modal-panel.danger::before { background: #b24636; }

.modal-title { font-size: 22px; font-weight: 700; }

.modal-message {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--panel-muted);
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions button {
  min-width: 110px;
  height: 40px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: #f1ebe1;
  color: var(--panel-text);
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
}

.modal-actions button:hover { background: #e8e0d2; border-color: var(--accent); }

.modal-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.modal-actions button.primary:hover { background: #cd7a4e; }
.modal-panel.danger .modal-actions button.primary { background: #b24636; border-color: #b24636; }
.modal-panel.danger .modal-actions button.primary:hover { background: #c65a49; }

/* ---------------- 窄屏适配 ---------------- */

@media (max-width: 900px) {
  #game-view { flex-direction: column; }
  #sidebar {
    width: 100%;
    flex: 1;
    border-left: none;
    border-top: 2px solid var(--accent);
  }
  #board-wrap { min-height: 52vh; }
  .menu-title { font-size: 32px; }
  .card { width: min(280px, 84vw); }
}
