:root {
      --bg: #0b0b0c;
      --sidebar: #0e0e10;
      --panel: #141419;
      --panel-2: #191920;
      --code-bg: #0d0d0f;
      --border: #34343c;
      --border-soft: #232329;
      --line: #45454e;
      --text: #f2f2f5;
      --text-2: #b6b6c0;
      --text-3: #92929c;
      --rose: #ff9e85;
      --rose-deep: #d46a58;
      --amber: #e8b98a;
      --green: #8fc98c;
      --mono: 'JetBrains Mono', monospace;
      --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --serif: 'Cormorant Garamond', Georgia, serif;
    }

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

    html { scroll-behavior: smooth; overflow-x: hidden; }
body { overflow-x: hidden; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--sans);
      font-size: 16px;
      line-height: 1.7;
      -webkit-font-smoothing: antialiased;
    }

    a { color: inherit; text-decoration: none; }
    code { font-family: var(--mono); }

    /* ── Sidebar ─────────────────────────────────────────────── */
    /* Aligned with the header brand: the sidebar's left edge follows the
       centered 1020px container, so its content lines up with the logo. */
    .sidebar {
      position: fixed;
      top: 56px;
      bottom: 0;
      left: max(0px, 50vw - 510px);
      width: 272px;
      background: var(--sidebar);
      border-right: 1px solid var(--border-soft);
      overflow-y: auto;
      padding: 18px 0 40px;
      z-index: 40;
    }

    .side-search { margin: 0 24px 14px; width: calc(100% - 48px); padding: 9px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: var(--sans); font-size: 0.88rem; outline: none; }
    .side-search:focus { border-color: var(--rose-deep); }
    .side-search::placeholder { color: var(--text-3); }

    .side-nav { list-style: none; }
    .side-nav a { display: flex; align-items: baseline; gap: 10px; padding: 8px 24px; font-size: 0.92rem; color: var(--text-2); border-left: 2px solid transparent; transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
    .side-nav a .n { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); min-width: 18px; }
    .side-nav a:hover { color: var(--text); background: rgba(255,255,255,0.02); }
    .side-nav a.active { color: var(--text); border-left-color: var(--rose-deep); background: rgba(212,106,88,0.07); }
    .side-nav a.active .n { color: var(--rose-deep); }

    .side-toggle { display: none; position: fixed; top: 70px; left: 14px; z-index: 60; width: 42px; height: 42px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; color: var(--text); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
    .side-toggle span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
    body.nav-open .side-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.nav-open .side-toggle span:nth-child(2) { opacity: 0; }
    body.nav-open .side-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    /* ── Main ────────────────────────────────────────────────── */
    /* Mirrors the sidebar offset on both sides so content lines up with the
       header's centered container edge for edge. */
    .main { margin-left: calc(max(0px, 50vw - 510px) + 272px); margin-right: max(0px, 50vw - 510px); min-height: 100vh; }

    .topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 48px; border-bottom: 1px solid var(--border-soft); position: sticky; top: 56px; background: rgba(11,11,12,0.9); backdrop-filter: blur(10px); z-index: 30; }
    .topbar h1 { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; }
    .topbar .meta { display: flex; align-items: center; gap: 12px; }
    .version { font-family: var(--mono); font-size: 0.75rem; color: var(--amber); border: 1px solid rgba(232,185,138,0.35); border-radius: 999px; padding: 4px 12px; }
    .base-url { font-family: var(--mono); font-size: 0.8rem; color: var(--text-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; }

    .content { padding: 48px 48px 120px; max-width: 920px; }
    section { scroll-margin-top: 96px; }

    .sec-kicker { font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--rose-deep); margin-bottom: 10px; }
    h2.sec-title { font-family: var(--serif); font-size: clamp(1.7rem, 3.4vw, 2.2rem); font-weight: 600; line-height: 1.12; margin-bottom: 14px; letter-spacing: -0.015em; }
    .lead { color: var(--text-2); font-size: 1.02rem; margin-bottom: 28px; max-width: 720px; }

    p { color: var(--text-2); margin-bottom: 16px; }
    p strong, .lead strong { color: var(--text); font-weight: 600; }
    li { color: var(--text-2); margin-bottom: 8px; }
    ul { padding-left: 22px; margin-bottom: 18px; }
    .inline-code { font-family: var(--mono); font-size: 0.85em; color: var(--amber); background: var(--panel); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 6px; overflow-wrap: anywhere; word-break: break-word; }

    h3.block-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin: 42px 0 6px; letter-spacing: -0.01em; }
    h4 { font-size: 0.95rem; font-weight: 600; margin: 26px 0 10px; letter-spacing: 0.01em; }

    /* ── Endpoint block (terminal style, mirrors homepage code cards) ── */
    .endpoint { background: #0e0e10; border: 1px solid var(--line); border-radius: 8px; margin: 22px 0; overflow: hidden; }
    .endpoint-head { display: flex; align-items: center; gap: 14px; padding: 13px 18px; background: #16161a; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
    .method { font-family: var(--mono); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; }
    .method.post { color: var(--rose); }
    .method.get { color: var(--green); }
    .method.delete { color: var(--amber); }
    .method.patch { color: #9db8e8; }
    .method.ws { color: #c39ae8; }
    .endpoint-path { font-family: var(--mono); font-size: 1rem; color: var(--text); font-weight: 600; word-break: break-word; }
    .endpoint-desc { width: 100%; color: var(--text-3); font-size: 0.9rem; }
    .endpoint-body { padding: 20px 18px; }
    .endpoint-body > *:last-child { margin-bottom: 0; }

    /* ── Tables ──────────────────────────────────────────────── */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
    .param-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 6px 0 18px; min-width: 520px; }
    .param-table th { text-align: left; font-family: var(--mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--line); }
    .param-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; color: var(--text-2); }
    .param-table tr:last-child td { border-bottom: none; }
    .param-table .field { font-family: var(--mono); color: var(--text); white-space: nowrap; font-size: 0.85rem; }
    .param-table .type { font-family: var(--mono); font-size: 0.76rem; color: var(--text-3); white-space: nowrap; }
    .param-table .req { font-family: var(--mono); font-size: 0.72rem; color: var(--rose-deep); white-space: nowrap; }

    /* ── Code blocks ─────────────────────────────────────────── */
    .codeblock { background: var(--code-bg); border: 1px solid var(--line); border-radius: 8px; margin: 16px 0; overflow: hidden; }
    .codeblock-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; background: #16161a; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.76rem; color: var(--text-3); }
    .copy-btn { background: none; border: 1px solid var(--border); border-radius: 5px; color: var(--text-2); font-family: var(--mono); font-size: 0.72rem; padding: 5px 12px; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
    .copy-btn:hover { border-color: var(--rose-deep); color: var(--rose-deep); }
    .copy-btn.copied { color: var(--green); border-color: rgba(143,201,140,0.5); }
    pre.code { padding: 16px 18px; font-family: var(--mono); font-size: 0.86rem; line-height: 1.65; color: #e8e8ec; white-space: pre-wrap; word-break: break-word; }
    .c-key { color: var(--rose); }
    .c-str { color: #b9e08f; }
    .c-num { color: #ecc370; }
    .c-dim { color: #a2a2ac; }
    .c-comment { color: #7d7d88; }

    /* ── Voices ──────────────────────────────────────────────── */
    .voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 20px; }
    .voice-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 1px 12px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; color: var(--text); font-family: var(--sans); text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
    .voice-row:hover { border-color: var(--line); background: var(--panel-2); }
    .voice-row .v-name { font-weight: 600; font-size: 0.95rem; }
    .voice-row .v-id { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin-left: 6px; }
    .voice-row .v-desc { grid-column: 1; font-size: 0.84rem; color: var(--text-3); }
    .voice-row .play-btn { grid-column: 2; grid-row: 1 / 3; align-self: center; }
    .voice-row.is-playing { border-color: var(--rose-deep); background: rgba(212,106,88,0.06); }

    /* ── Play buttons ────────────────────────────────────────── */
    .play-btn { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); border: 1px solid var(--border); border-radius: 6px; padding: 7px 12px; background: transparent; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s; white-space: nowrap; }
    .play-btn:hover { color: var(--text); border-color: var(--line); }
    .play-btn.is-playing { color: var(--rose-deep); border-color: var(--rose-deep); background: rgba(212,106,88,0.08); }
    .voice-row.is-playing .play-btn { color: var(--rose-deep); border-color: var(--rose-deep); background: rgba(212,106,88,0.08); }

    /* ── Notes ───────────────────────────────────────────────── */
    .note { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: 6px; padding: 14px 18px; margin: 20px 0; }
    .note p { margin: 0 0 10px; color: var(--text-2); font-size: 0.92rem; }
    .note p:last-child { margin-bottom: 0; }
    .note .play-btn { margin-top: 8px; }

    /* ── Multilingual cards ──────────────────────────────────── */
    .ml-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 18px 0; }
    .ml-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 18px 16px; display: flex; flex-direction: column; gap: 10px; }
    .ml-card .ml-lang { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--rose-deep); }
    .ml-card .ml-text { font-size: 0.95rem; color: var(--text-2); font-style: italic; }
    .ml-card .play-btn { align-self: flex-start; }

    /* ── Footer ──────────────────────────────────────────────── */
    /* ── Responsive ──────────────────────────────────────────── */
    @media (max-width: 960px) {
      .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
      body.nav-open .sidebar { transform: translateX(0); }
      .side-toggle { display: inline-flex; }
      .main { margin-left: 0; margin-right: 0; }
      .topbar { padding: 18px 20px 18px 68px; }
      .content { padding: 32px 20px 96px; }
      .voice-grid { grid-template-columns: 1fr; }
      .ml-grid { grid-template-columns: 1fr; }
      .base-url { display: none; }
    }
