:root {
  --bg: #12151c; --panel: #1f2532; --panel2: #262e3f; --text: #e8ebf0;
  --muted: #9aa4b5; --accent: #7fa650; --accent2: #4a90d9; --danger: #d96a4a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; padding-bottom: env(safe-area-inset-bottom); }
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--panel); position: sticky; top: 0; z-index: 10; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; }
.bell { background: none; border: none; font-size: 20px; cursor: pointer; position: relative; }
.badge { position: absolute; top: -4px; right: -6px; background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 5px; min-width: 18px; }
main { max-width: 860px; margin: 0 auto; padding: 12px; }
.card { background: var(--panel); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, select, button { font: inherit; border-radius: 8px; border: 1px solid #38415a; background: var(--panel2); color: var(--text); padding: 8px 12px; }
input { flex: 1; min-width: 140px; }
button { cursor: pointer; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.secondary { background: var(--panel2); border-color: #38415a; }
button.danger { background: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }
.hint { color: var(--muted); font-size: 13px; }
.game-item, .sub-item, .feed-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--panel2); margin-bottom: 8px; cursor: pointer; flex-wrap: wrap; }
.game-item:hover, .sub-item:hover, .feed-item:hover { background: #2e374c; }
.game-item.new { outline: 2px solid var(--accent); }
.game-meta { color: var(--muted); font-size: 12px; }
.result-badge { font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #38415a; font-size: 13px; }
.playing-dot { color: var(--accent); font-size: 12px; }
.ios-guide { background: var(--panel2); border-radius: 8px; padding: 10px 14px; margin-top: 10px; font-size: 14px; }
.ios-guide ol { margin: 6px 0 0; padding-left: 20px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--accent2); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 4px 16px rgba(0,0,0,.4); max-width: 90vw; }
/* analysis page */
.analysis-wrap { display: grid; grid-template-columns: minmax(280px, 480px) 1fr; gap: 16px; }
@media (max-width: 720px) { .analysis-wrap { grid-template-columns: 1fr; } }
.board-col { min-width: 0; }
#board { width: 100%; aspect-ratio: 1; }
.cg-wrap { width: 100%; height: 100%; }
.evalbar { height: 10px; border-radius: 5px; background: #333; overflow: hidden; margin: 8px 0; }
.evalbar > div { height: 100%; background: #e8ebf0; transition: width .3s; }
.moves { line-height: 1.9; word-break: break-word; max-height: 300px; overflow-y: auto; }
.moves span.mv { cursor: pointer; padding: 1px 4px; border-radius: 4px; }
.moves span.mv.cur { background: var(--accent2); color: #fff; }
.engine-lines { font-size: 13px; font-family: ui-monospace, monospace; }
.engine-lines .line { padding: 4px 0; border-bottom: 1px solid #2e374c; }
.score { font-weight: 700; color: var(--accent); }
.nav-btns { display: flex; gap: 6px; margin-top: 8px; }
.nav-btns button { flex: 1; background: var(--panel2); border-color: #38415a; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumb a { color: var(--accent2); text-decoration: none; }
.spinner { text-align: center; color: var(--muted); padding: 24px; }
