        *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
        :root {
            --bg: #fafafa; --bg-white: #ffffff;
            --text: #1a1a2e; --text-secondary: #555; --text-light: #888;
            --accent: #4338ca; --accent-light: #6366f1;
            --border: #e5e5e5; --hero-bg: #1a1a2e;
            /* 图表配色：dataviz 参考调色板，光面 */
            --surface-1: #fcfcfb; --ink-muted: #898781; --grid: #e1e0d9; --axis: #c3c2b7;
            --s-you: #2a78d6; --s-etc: #eb6834; --s-thr: #1baf7a; --s-eg: #eda100; --s-ucb: #e87ba4; --s-ref: #898781;
        }
        html { scroll-behavior: smooth; }
        body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; }

        /* ---- NAV ---- */
        .navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: rgba(255,255,255,0.95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid transparent; transition: border-color 0.3s; }
        .navbar.scrolled { border-bottom-color: var(--border); }
        .nav-container { max-width: 1100px; margin: 0 auto; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 56px; }
        .nav-brand a { text-decoration: none; color: var(--text); }
        .nav-brand h1 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; }
        .nav-menu { list-style: none; display: flex; gap: 2rem; }
        .nav-menu a { text-decoration: none; color: var(--text-secondary); font-size: 0.875rem; font-weight: 400; position: relative; transition: color 0.2s; }
        .nav-menu a::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 1px; background: var(--accent); transition: width 0.3s; }
        .nav-menu a:hover { color: var(--text); }
        .nav-menu a:hover::after { width: 100%; }
        .nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
        .nav-toggle span { display: block; width: 20px; height: 1.5px; background: var(--text); margin: 5px 0; transition: transform 0.3s, opacity 0.3s; }
        .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
        .nav-toggle.active span:nth-child(2) { opacity: 0; }
        .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

        /* ---- PAGE HEADER ---- */
        .page-header { position: relative; background: var(--hero-bg); display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 100px 2rem 60px; min-height: 260px; }
        .page-header canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
        .page-header-content { position: relative; z-index: 2; text-align: center; max-width: 800px; }
        .page-title { font-size: 2.1rem; font-weight: 700; color: #fff; letter-spacing: -0.03em; line-height: 1.25; margin-bottom: 0.5rem; }
        .page-meta-line { font-size: 0.85rem; color: rgba(255,255,255,0.4); font-weight: 300; letter-spacing: 0.02em; }

        /* ---- CONTENT ---- */
        .content-wrapper { max-width: 1100px; margin: 0 auto; padding: 3rem 2rem 4rem; }
        .back-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent); text-decoration: none; font-size: 0.85rem; font-weight: 500; margin-bottom: 2.5rem; transition: color 0.2s; }
        .back-link:hover { color: var(--accent-light); }
        .content-section { margin-bottom: 3.5rem; }
        .content-section h2 { font-size: 1.5rem; font-weight: 600; color: var(--text); letter-spacing: -0.02em; padding-left: 1rem; border-left: 3px solid var(--accent); margin-bottom: 1.5rem; line-height: 1.3; }
        .content-section h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 1.75rem 0 0.75rem; }
        .content-section p { color: var(--text-secondary); line-height: 1.85; margin-bottom: 1.25rem; font-size: 0.95rem; }
        .content-section ul, .content-section ol { color: var(--text-secondary); line-height: 1.85; margin-left: 1.5rem; margin-bottom: 1.25rem; font-size: 0.95rem; }
        .content-section li { margin-bottom: 0.6rem; }
        .content-section strong { color: var(--text); font-weight: 600; }
        .content-section a { color: var(--accent); }
        .content-section code { font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 0.85em; background: rgba(67,56,202,0.06); padding: 0.1em 0.35em; border-radius: 4px; color: var(--text); }

        .rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.25rem 0 1.5rem; }
        .rule-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.15rem; }
        .rule-card h4 { font-size: 0.8rem; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; margin-bottom: 0.4rem; }
        .rule-card p { font-size: 0.88rem; margin: 0; line-height: 1.7; }

        /* ---- CONTROLS ---- */
        .btn { font: inherit; font-size: 0.85rem; font-weight: 500; padding: 0.45rem 0.95rem; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-white); color: var(--text); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s; }
        .btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
        .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
        .btn.primary:hover:not(:disabled) { background: var(--accent-light); border-color: var(--accent-light); color: #fff; }
        .btn:disabled { opacity: 0.45; cursor: not-allowed; }
        .btn.sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }
        .seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
        .seg button { font: inherit; font-size: 0.8rem; padding: 0.35rem 0.7rem; border: none; background: var(--bg-white); color: var(--text-secondary); cursor: pointer; }
        .seg button + button { border-left: 1px solid var(--border); }
        .seg button.on { background: var(--accent); color: #fff; }
        select, input[type=number], input[type=text] { font: inherit; font-size: 0.85rem; padding: 0.35rem 0.55rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-white); color: var(--text); }
        input[type=number] { width: 5.5rem; }
        .toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem 0.8rem; align-items: center; margin-bottom: 0.75rem; }
        .toolbar label { font-size: 0.85rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.4rem; }
        .status { font-size: 0.85rem; color: var(--text-light); min-height: 1.4em; margin-top: 0.6rem; }
        .status.err { color: #b42318; }

        /* ---- GAME BOARD ---- */
        .board { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
        .map-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 0.9rem; }
        .map-wrap { position: relative; width: 100%; }
        .map-wrap canvas { display: block; width: 100%; cursor: default; }
        .map-wrap canvas.clickable { cursor: pointer; }
        .map-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.7rem; align-items: center; }
        .map-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
        .map-legend i.sq { display: inline-block; width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.08); }
        .map-legend i.ramp { display: inline-block; width: 60px; height: 12px; border-radius: 2px; background: linear-gradient(90deg, #cde2fb, #3987e5, #0d366b); }
        .map-legend i.pawn { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #1a1a2e; border: 2px solid #fff; box-shadow: 0 0 0 1px #1a1a2e; }
        .map-legend i.bot { display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); border-radius: 1px; }
        .tooltip { position: absolute; pointer-events: none; background: rgba(26,26,46,0.94); color: #fff; font-size: 0.75rem; line-height: 1.5; padding: 0.45rem 0.6rem; border-radius: 6px; white-space: nowrap; display: none; z-index: 5; font-variant-numeric: tabular-nums; }
        .tooltip b { font-weight: 600; }

        .panel { background: var(--bg-white); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.1rem; font-size: 0.86rem; color: var(--text-secondary); }
        .panel .stat-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.3rem 0; border-bottom: 1px dashed var(--border); }
        .panel .stat-row:last-of-type { border-bottom: none; }
        .panel .stat-row b { font-size: 1.05rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
        .panel .stat-row b.you { color: var(--s-you); }
        .panel h5 { font-size: 0.75rem; font-weight: 600; color: var(--text-light); letter-spacing: 0.05em; text-transform: uppercase; margin: 0.9rem 0 0.45rem; }
        .chips { display: flex; flex-wrap: wrap; gap: 0.3rem; max-height: 6.6rem; overflow-y: auto; }
        .chip { font-size: 0.75rem; padding: 0.15rem 0.45rem; border-radius: 4px; border: 1px solid transparent; font-variant-numeric: tabular-nums; cursor: default; }
        .chip.clickable { cursor: pointer; }
        .chip.clickable:hover { border-color: var(--text); }
        .chip.here { outline: 2px solid #1a1a2e; outline-offset: 1px; }
        .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; margin-top: 0.9rem; }
        .actions .btn { padding: 0.5rem 0.4rem; font-size: 0.82rem; }
        .actions .btn.wide { grid-column: span 2; }
        .panel .msg { margin-top: 0.7rem; font-size: 0.8rem; color: var(--text-light); min-height: 2.2em; line-height: 1.5; }
        .panel .msg.gold { color: #9a6700; }

        /* ---- CHART / TABLE ---- */
        .chart-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1rem 0.75rem; margin-top: 1.25rem; }
        .chart-card h4 { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 0.15rem; }
        .chart-card .sub { font-size: 0.8rem; color: var(--ink-muted); margin-bottom: 0.6rem; }
        .chart-wrap { position: relative; width: 100%; }
        .chart-wrap canvas { display: block; width: 100%; height: 280px; }
        .legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.5rem; }
        .legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
        .legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
        .legend i.dash { border-top-style: dashed; }
        .legend i.dot { border-top-style: dotted; }
        .table-scroll { overflow-x: auto; margin-top: 1.25rem; }
        table.rank-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; background: var(--bg-white); min-width: 640px; font-variant-numeric: tabular-nums; }
        table.rank-table th, table.rank-table td { border: 1px solid var(--border); padding: 0.5rem 0.55rem; text-align: right; white-space: nowrap; }
        table.rank-table th { background: var(--bg); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.02em; color: var(--text-secondary); }
        table.rank-table td.name, table.rank-table th.name { text-align: left; }
        table.rank-table td.name i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.5rem; vertical-align: -1px; }
        table.rank-table tr.you td { background: rgba(42,120,214,0.07); font-weight: 600; color: var(--text); }
        .table-note { font-size: 0.8rem; color: var(--text-light); margin-top: 0.6rem; }

        /* ---- EDITOR ---- */
        .editor-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg-white); }
        .editor-wrap textarea { width: 100%; min-height: 340px; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; padding: 0.9rem; border: none; outline: none; resize: vertical; color: var(--text); background: var(--bg-white); tab-size: 2; }
        .CodeMirror { height: auto; min-height: 340px; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
        .CodeMirror-scroll { min-height: 340px; }
        .preset-summary { font-size: 0.85rem; color: var(--text-light); margin: 0.5rem 0 0; }
        details.world { margin: 1rem 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-white); }
        details.world summary { cursor: pointer; padding: 0.7rem 1rem; font-size: 0.88rem; font-weight: 500; color: var(--text-secondary); user-select: none; }
        details.world .world-body { padding: 0.25rem 1rem 1rem; display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; }
        details.world .world-body label { font-size: 0.83rem; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 0.4rem; }

        /* ---- SUBMIT ---- */
        .submit-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-bottom: 0.75rem; }
        .submit-row input[type=text] { width: 14rem; }
        .payload { width: 100%; min-height: 120px; font-family: 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; padding: 0.7rem; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-white); color: var(--text-secondary); resize: vertical; }

        .footer { padding: 2rem 0; text-align: center; border-top: 1px solid var(--border); }
        .footer p { font-size: 0.75rem; color: #999; font-weight: 300; }
        .curve-divider { display: block; width: 100%; height: 32px; margin: 0; }
        .curve-divider path { fill: none; stroke: var(--border); stroke-width: 1; }

        @media (max-width: 860px) {
            .board { grid-template-columns: 1fr; }
        }
        @media (max-width: 768px) {
            .nav-toggle { display: block; }
            .nav-menu { position: fixed; top: 56px; left: 0; right: 0; background: rgba(255,255,255,0.98); backdrop-filter: blur(8px); flex-direction: column; align-items: center; gap: 0; padding: 1rem 0; border-bottom: 1px solid var(--border); transform: translateY(-100%); opacity: 0; pointer-events: none; transition: transform 0.3s, opacity 0.3s; }
            .nav-menu.active { transform: translateY(0); opacity: 1; pointer-events: auto; }
            .nav-menu li { padding: 0.6rem 0; }
            .page-title { font-size: 1.5rem; }
            .page-header { padding: 80px 1.5rem 40px; min-height: 200px; }
            .content-wrapper { padding: 2rem 1.25rem 3rem; }
            .content-section h2 { font-size: 1.3rem; }
            .chart-wrap canvas { height: 220px; }
        }

        /* 页面头部的子导航（基础版 / 加强版 / 解法） */
        .page-meta-line a { color: rgba(255,255,255,0.75); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.3); }
        .page-meta-line a:hover { color: #fff; }
        .page-meta-line a.here { color: #fff; border-bottom-color: #fff; }
