/* ==========================================================
   围棋复盘笔记 · 样式
   ========================================================== */

:root {
  --paper:      #faf8f3;
  --paper-2:    #ffffff;
  --ink:        #1c1b19;
  --ink-2:      #4a463f;
  --muted:      #8a8578;
  --line:       #e5e0d4;
  --line-2:     #efeae0;
  --accent:     #b03a2e;
  --accent-2:   #8c2d23;
  --board:      #e6bf82;
  --board-edge: #d9ad69;
  --board-line: #7d5f31;
  --good:       #2f7a4f;
  --bad:        #b03a2e;
  --doubt:      #b8860b;
  --radius:     10px;
  --shadow:     0 1px 2px rgba(28,27,25,.05), 0 8px 28px -12px rgba(28,27,25,.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------- 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250,248,243,.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 19px;
  letter-spacing: 3px;
  font-weight: 600;
  color: var(--ink);
}

.brand small {
  font-family: -apple-system, sans-serif;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.topbar .spacer { flex: 1; }

/* ---------------------------------------------------- 按钮 */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
  line-height: 1.4;
}

.btn:hover {
  border-color: #d5cebd;
  background: #fdfcf9;
  color: var(--ink);
}

.btn:active { transform: translateY(1px); }

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

.btn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover { background: #f1ece2; color: var(--ink); }

/* ---------------------------------------------------- 布局 */
.layout {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 24px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------- 棋盘卡 */
.board-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}

.game-title {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.board-head .spacer { flex: 1; }

#board {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  background: var(--board);
  cursor: pointer;
  touch-action: manipulation;
}

#board svg { display: block; width: 100%; height: 100%; }

/* ---------------------------------------------------- 控制条 */
.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line-2);
  background: #fdfcf9;
  flex-wrap: wrap;
}

.ctrl-btn {
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  transition: all .15s;
}

.ctrl-btn:hover { background: #f7f3ea; color: var(--ink); }
.ctrl-btn:active { transform: translateY(1px); }

.move-input {
  width: 64px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  padding: 0 4px;
}

.move-input:focus { outline: 2px solid #d9c9a8; outline-offset: -1px; }

.controls .spacer { flex: 1; }

.turn-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.turn-dot i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid #999;
}

.turn-dot i.black { background: #1a1a1a; border-color: #1a1a1a; }
.turn-dot i.white { background: #fff; border-color: #bdbdbd; }

/* ---------------------------------------------------- 侧栏 */
.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
}

.panel-title {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  font-weight: 500;
}

.panel-head .spacer { flex: 1; }

.info-grid {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 6px 10px;
  padding: 12px 14px 14px;
  font-size: 13px;
}

.info-grid dt { color: var(--muted); }
.info-grid dd { margin: 0; color: var(--ink-2); }

/* ---------------------------------------------------- 手顺 */
.move-list {
  max-height: 268px;
  overflow-y: auto;
  padding: 6px;
}

.move-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
  transition: background .12s;
}

.move-row:hover { background: #f7f3ea; }

.move-row.active {
  background: #f3e9d5;
  color: var(--ink);
  font-weight: 600;
}

.move-row .no {
  width: 26px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.move-row .stone {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex: none;
}

.move-row .stone.b { background: #1a1a1a; }
.move-row .stone.w { background: #fff; border: 1px solid #bdbdbd; }

.move-row .coord {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: .4px;
}

.move-row .tag {
  margin-left: auto;
  font-size: 11px;
  padding: 0 6px;
  border-radius: 4px;
  line-height: 17px;
}

.tag.good  { background: #e6f0e9; color: var(--good); }
.tag.bad   { background: #f7e8e6; color: var(--bad); }
.tag.doubt { background: #f6efdc; color: var(--doubt); }

.empty-hint {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

/* ---------------------------------------------------- 笔记 */
.notes-body { padding: 12px 14px 14px; }

.mark-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.mark-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 4px 11px;
  font-size: 12px;
  cursor: pointer;
  color: var(--ink-2);
  font-family: inherit;
  transition: all .15s;
}

.mark-btn:hover { background: #f7f3ea; }

.mark-btn[data-mark="good"].on  { background: #e6f0e9; border-color: #b9d8c6; color: var(--good); }
.mark-btn[data-mark="bad"].on   { background: #f7e8e6; border-color: #e6c1bc; color: var(--bad); }
.mark-btn[data-mark="doubt"].on { background: #f6efdc; border-color: #dfcfa4; color: var(--doubt); }

textarea#note {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink);
  background: #fefdfb;
}

textarea#note:focus {
  outline: 2px solid #e3d4b5;
  outline-offset: -1px;
  border-color: #d9c9a8;
}

.note-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.note-foot .spacer { flex: 1; }

/* ---------------------------------------------------- 关于 */
.about {
  max-width: 1220px;
  margin: 56px auto 0;
  padding: 0 24px;
}

.about-inner {
  border-top: 1px solid var(--line);
  padding-top: 40px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
}

@media (max-width: 780px) {
  .about-inner { grid-template-columns: 1fr; gap: 16px; }
}

.about h2 {
  font-family: "Songti SC", "Noto Serif SC", Georgia, serif;
  font-size: 17px;
  letter-spacing: 3px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.about-text p {
  margin: 0 0 14px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.95;
  max-width: 760px;
}

.about-text strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------- 页脚 */
footer {
  margin-top: 72px;
  border-top: 1px solid var(--line);
  background: #f6f3ec;
}

.footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 24px 36px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 2.1;
}

.footer-inner a { color: var(--muted); }
.footer-inner a:hover { color: var(--ink-2); }

.beian-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.beian-row span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------------------------------------------------- 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translate(-50%, 12px);
  background: #26241f;
  color: #f5f1e8;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
  max-width: 80vw;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
