/* ============ 基础 ============ */
:root {
  --bg1: #1b2128;
  --bg2: #0f1318;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eee8da;
  --muted: #a9a194;
  --accent: #e8b64c;
  --accent2: #d98e3f;
  --green: #58c98f;
  --red: #e4574f;
  --radius: 14px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }body {
  font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, Segoe UI, system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}/* ============ 头部 ============ */
.site-header { text-align: center; padding: 26px 16px 6px; position: relative; z-index: 1; }
.logo {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 6px;
  background: linear-gradient(120deg, #f5d489, var(--accent) 45%, var(--accent2));
  background-clip: text;
  color: transparent;
  text-shadow: 0 4px 24px rgba(232, 182, 76, .25);
}
.tagline { margin-top: 8px; color: var(--muted); font-size: 14px; letter-spacing: 2px; }

/* ============ 布局 ============ */
.layout {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  width: min(1080px, 96vw);
  padding: 22px 0 10px;
  align-items: start;
}

/* ============ 棋盘 ============ */
.board-section { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: 0; }

.board-wrap {
  width: 100%;
  max-width: 640px;
  padding: 14px;
  border-radius: 20px;
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(255, 255, 255, .10), transparent 50%),
    linear-gradient(180deg, #5a3417, #46270f);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .08);
}.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  background:
    radial-gradient(120% 90% at 50% 32%, #dba85f 0%, #c99045 52%, #b47b33 100%);
  box-shadow: inset 0 0 46px rgba(80, 40, 0, .38), inset 0 0 4px rgba(60, 30, 0, .5);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.board-grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.board-grid line { stroke: rgba(72, 42, 12, .85); stroke-width: .55; vector-effect: non-scaling-stroke; }
.board-grid circle { fill: rgba(72, 42, 12, .85); }
.stones { position: absolute; inset: 0; pointer-events: none; }

.stone {
  --cell: calc(100% / 14);
  position: absolute;
  width: calc(var(--cell) * 0.86);
  height: calc(var(--cell) * 0.86);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: drop .16s ease-out;
  will-change: transform;
}
@keyframes drop {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); }
}.stone.black {
  background: radial-gradient(circle at 32% 28%, #7a7a7a 0%, #262626 48%, #050505 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .55), inset 0 -2px 5px rgba(0, 0, 0, .6), inset 0 1px 3px rgba(255, 255, 255, .22);
}
.stone.white {
  background: radial-gradient(circle at 32% 28%, #ffffff 0%, #efefef 52%, #b7b7b7 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .4), inset 0 -3px 6px rgba(0, 0, 0, .18), inset 0 1px 2px rgba(255, 255, 255, .9);
}
.stone.last { outline: 2px solid #e8453c; outline-offset: 1px; }

.stone.win {
  box-shadow: 0 0 0 3px rgba(255, 90, 80, .95), 0 0 18px rgba(255, 70, 60, .85), 0 4px 8px rgba(0, 0, 0, .5);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(255, 90, 80, .95), 0 0 14px rgba(255, 70, 60, .8), 0 4px 8px rgba(0, 0, 0, .5); }
  50% { box-shadow: 0 0 0 5px rgba(255, 90, 80, .75), 0 0 26px rgba(255, 70, 60, 1), 0 4px 8px rgba(0, 0, 0, .5); }
}

.preview {
  --cell: calc(100% / 14);
  position: absolute;
  width: calc(var(--cell) * 0.86);
  height: calc(var(--cell) * 0.86);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: .35;
  pointer-events: none;
}
.preview.black { background: radial-gradient(circle at 32% 28%, #7a7a7a, #111); }
.preview.white { background: radial-gradient(circle at 32% 28%, #fff, #c8c8c8); }

.board-caption { color: var(--muted); font-size: 13px; }/* ============ 侧栏 ============ */
.panel { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: rgba(0, 0, 0, .25); padding: 6px; border-radius: var(--radius); }
.tab {
  border: none; cursor: pointer; padding: 10px 4px;
  border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: all .18s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #2a1a05;
  box-shadow: 0 6px 16px rgba(232, 182, 76, .35);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  backdrop-filter: blur(6px);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; color: var(--text); }

.status-row { display: flex; align-items: center; gap: 10px; }
.status-text { font-size: 16px; font-weight: 700; }

.dot {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: #666;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .5);
}.dot.black { background: radial-gradient(circle at 35% 30%, #7a7a7a, #0a0a0a 70%); box-shadow: 0 2px 6px rgba(0, 0, 0, .6); }
.dot.white { background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf 70%); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.dot.thinking { background: conic-gradient(from 0deg, var(--accent), transparent 30%, var(--accent) 60%); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-sub { margin-top: 8px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
}
.btn:hover { background: rgba(255, 255, 255, .15); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; color: #2a1a05;
  box-shadow: 0 6px 16px rgba(232, 182, 76, .3);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: #ffb3ae; }
.btn.danger:hover { background: rgba(228, 87, 79, .18); border-color: rgba(228, 87, 79, .5); }.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.select, .input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font-size: 14px; font-family: inherit;
  outline: none;
}
.select:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 182, 76, .18); }

.hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 6px 0; }

.online-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row .btn { flex: 1; }

.room-code {
  font-size: 30px; font-weight: 800; letter-spacing: 8px;
  text-align: center; margin: 8px 0 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.link-input { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

.chat-log {
  height: 120px; overflow-y: auto;
  background: rgba(0, 0, 0, .22);
  border-radius: 10px; padding: 8px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 4px;
}
.chat-msg { line-height: 1.5; word-break: break-word; }
.chat-who { color: var(--accent); font-weight: 600; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row .input { flex: 1; }
.chat-input-row .btn { flex: none; }.move-log {
  max-height: 168px; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: 4px;
  align-content: flex-start;
}
.move-item {
  font-size: 12px; color: var(--muted);
  background: rgba(255, 255, 255, .05);
  border-radius: 6px; padding: 2px 6px;
}
.move-item.current { color: var(--accent); background: rgba(232, 182, 76, .12); }

/* ============ 弹窗 ============ */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8, 10, 12, .68);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal.show { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(380px, 92vw);
  background: linear-gradient(165deg, #262d35, #1a1f25);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: pop .25s ease;
}
.modal-card.small { width: min(320px, 90vw); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title { font-size: 24px; font-weight: 800; margin-bottom: 10px; }
.modal.win .modal-title { color: var(--green); }
.modal.lose .modal-title { color: var(--red); }
.modal.draw .modal-title { color: var(--accent); }
.modal-msg { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { min-width: 110px; }/* ============ 忙碌 / 提示 ============ */
.busy-overlay {
  position: fixed; inset: 0; z-index: 90;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(8, 10, 12, .7);
  backdrop-filter: blur(4px);
}
.busy-overlay.show { display: flex; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(232, 182, 76, .2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.busy-text { color: var(--muted); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 34px; z-index: 120;
  transform: translate(-50%, 20px);
  background: rgba(20, 24, 30, .94);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.site-footer { position: relative; z-index: 1; padding: 14px 16px 26px; color: var(--muted); font-size: 12px; text-align: center; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { max-width: 640px; width: 100%; margin: 0 auto; }
  .controls { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .site-header { padding-top: 18px; }
  .board-wrap { padding: 9px; border-radius: 14px; }
  .board-caption { font-size: 12px; }
  .tabs .tab { font-size: 13px; padding: 9px 2px; }
  .room-code { font-size: 24px; letter-spacing: 6px; }
}