  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --surface-strong: #e2e8f0;
    --text: #1e293b;
    --text-muted: #475569;
    --text-soft: #64748b;
    --border: #dbe3ee;
    --border-strong: #c4d0e0;
    --primary: #2563eb;
    --primary-soft: #dbeafe;
    --success: #16a34a;
    --warning: #ea580c;
    --danger: #dc2626;
    --required-bg: #fee2e2;
    --required-text: #b91c1c;
    --optional-bg: #e2e8f0;
    --optional-text: #334155;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);

    --code-bg: #1e1e2e;
    --code-border: #303446;
    --code-text: #cdd6f4;
    --json-key: #6c8cff;
    --json-string: #a6e3a1;
    --json-number: #fab387;
    --json-bool: #cba6f7;
    --json-null: #cba6f7;
    --json-punctuation: #6c7086;

    --toc-width: 300px;
    --content-max: 900px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
  }

  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    scroll-behavior: smooth;
  }

  body {
    font-family: 'IBM Plex Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background:
      radial-gradient(circle at 10% 0%, #e2e8f0 0%, rgba(226, 232, 240, 0) 34%),
      radial-gradient(circle at 100% 20%, #dbeafe 0%, rgba(219, 234, 254, 0) 36%),
      var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
  }

  .layout {
    width: min(1440px, calc(100% - 32px));
    margin: 20px auto 32px;
    display: grid;
    grid-template-columns: var(--toc-width) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 16px;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
  }

  .sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(140deg, #eff6ff 0%, #ffffff 55%);
  }

  .sidebar-title {
    font-size: 0.84rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
    margin-bottom: 6px;
    font-weight: 600;
  }

  .sidebar-schema {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    color: #1d4ed8;
    font-size: 0.76rem;
    font-weight: 600;
    background: #eff6ff;
  }

  .sidebar-schema::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
  }

  .toc {
    padding: 12px 10px 14px 12px;
    overflow-y: auto;
  }

  .toc-group {
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 10px;
  }

  .toc-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .toc-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    margin: 6px 8px;
    font-weight: 600;
  }

  .toc a {
    display: block;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.45;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease;
  }

  .toc a:hover,
  .toc a:focus-visible {
    background: var(--surface-muted);
    color: var(--text);
    border-color: var(--border);
    outline: none;
  }

  .toc a.is-active {
    background: var(--primary-soft);
    color: #1d4ed8;
    border-color: #bfdbfe;
    font-weight: 600;
  }

  .toc-sub {
    margin-top: 4px;
    margin-left: 8px;
    border-left: 2px solid var(--surface-strong);
    padding-left: 6px;
  }

  .toc-sub a {
    font-size: 0.82rem;
    padding: 6px 8px;
  }

  .content {
    width: 100%;
    max-width: var(--content-max);
    min-width: 0;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(219, 227, 238, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(3px);
    padding: 28px;
  }

  .section {
    margin-bottom: 40px;
    scroll-margin-top: 18px;
  }

  .section:last-child {
    margin-bottom: 0;
  }

  .section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
  }

  .section h2 {
    font-size: 1.35rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #0f172a;
  }

  .section h3 {
    font-size: 1.02rem;
    line-height: 1.35;
    margin: 18px 0 10px;
    color: #0f172a;
  }

  .section h4 {
    font-size: 0.92rem;
    margin: 14px 0 8px;
    color: #1e293b;
  }

  p,
  li {
    color: var(--text-muted);
  }

  p {
    margin-bottom: 10px;
  }

  ul,
  ol {
    margin: 10px 0 12px 20px;
  }

  li {
    margin-bottom: 6px;
  }

  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
  }

  .chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    line-height: 1;
    border-radius: 999px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    font-weight: 600;
  }

  .chip.required {
    background: var(--required-bg);
    color: var(--required-text);
    border-color: #fecaca;
  }

  .chip.optional {
    background: var(--optional-bg);
    color: var(--optional-text);
    border-color: #cbd5e1;
  }

  .chip.info {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
  }

  .chip.warn {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
  }

  .card {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 12px 0 16px;
    box-shadow: var(--shadow-sm);
  }

  .callout {
    border-left: 4px solid var(--primary);
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin: 12px 0;
  }

  .callout strong {
    color: #1e3a8a;
  }

  .callout p {
    margin: 0;
    color: #1e40af;
  }

  .callout.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    border-left-color: var(--warning);
  }

  .callout.warning p,
  .callout.warning strong {
    color: #9a3412;
  }

  .callout.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: var(--success);
  }

  .callout.success p,
  .callout.success strong {
    color: #166534;
  }

  .table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin: 12px 0 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
    font-size: 0.86rem;
  }

  thead th {
    text-align: left;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
    color: #334155;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
  }

  tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f7;
    color: var(--text-muted);
    vertical-align: top;
  }

  tbody tr:nth-child(even) td {
    background: #fafcff;
  }

  tbody tr:last-child td {
    border-bottom: none;
  }

  code,
  .mono {
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, Menlo, Monaco, monospace;
  }

  code {
    font-size: 0.84em;
    background: #eef2ff;
    color: #3730a3;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 1px 6px;
  }

  pre {
    position: relative;
    margin: 12px 0 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--code-border);
    background: linear-gradient(170deg, #1c1e2c 0%, #161822 100%);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
    overflow-x: auto;
  }

  pre code {
    display: block;
    background: transparent;
    color: var(--code-text);
    border: none;
    border-radius: 0;
    padding: 0;
    font-size: 0.82rem;
    line-height: 1.54;
    white-space: pre;
  }

  .pre-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(108, 112, 134, 0.28);
    gap: 10px;
  }

  .pre-title {
    color: #bac2de;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
  }

  .copy-btn {
    border: 1px solid #4c4f69;
    background: #292c3c;
    color: #cdd6f4;
    border-radius: 6px;
    font-size: 0.72rem;
    font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    transition: background-color 200ms ease, border-color 200ms ease;
  }

  .copy-btn:hover,
  .copy-btn:focus-visible {
    background: #313449;
    border-color: #6c7086;
    outline: none;
  }

  .copy-btn.is-done {
    border-color: #22c55e;
    background: #166534;
    color: #dcfce7;
  }

  .json-key {
    color: var(--json-key);
  }

  .json-string {
    color: var(--json-string);
  }

  .json-number {
    color: var(--json-number);
  }

  .json-bool {
    color: var(--json-bool);
  }

  .json-null {
    color: var(--json-null);
  }

  .json-punctuation {
    color: var(--json-punctuation);
  }

  .swatches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
  }

  .swatch {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 8px 10px;
  }

  .swatch-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.2);
    flex: 0 0 14px;
  }

  .swatch code {
    font-size: 0.74rem;
    padding: 1px 4px;
  }

  .swatch-name {
    font-size: 0.8rem;
    color: var(--text-muted);
  }

  .schema-tree {
    display: grid;
    gap: 8px;
    margin: 12px 0 16px;
  }

  .tree-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.87rem;
    box-shadow: var(--shadow-sm);
  }

  .tree-indent-1 {
    margin-left: 18px;
  }

  .tree-indent-2 {
    margin-left: 36px;
  }

  .tree-indent-3 {
    margin-left: 54px;
  }

  .tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    background: #fff;
    margin-left: 6px;
    vertical-align: middle;
  }

  .mobile-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 120;
    backdrop-filter: blur(10px);
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(219, 227, 238, 0.9);
    border-radius: 12px;
    margin: 0 auto 12px;
    width: min(1440px, calc(100% - 16px));
    box-shadow: var(--shadow-sm);
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-title {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-soft);
  }

  .mobile-toc-toggle {
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 200ms ease;
  }

  .mobile-toc-toggle:hover,
  .mobile-toc-toggle:focus-visible {
    background: var(--surface-muted);
    outline: none;
  }

  .placeholder {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: rgba(248, 250, 252, 0.7);
    padding: 16px;
    color: var(--text-soft);
    font-size: 0.92rem;
  }


  .example-block {
    margin: 14px 0 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .example-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
  }

  .example-tab {
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
  }

  .example-tab:hover,
  .example-tab:focus-visible {
    background: #eef2ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    outline: none;
  }

  .example-tab.is-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #eff6ff;
  }

  .example-tab.is-disabled,
  .example-tab:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    background: #fff;
    color: #64748b;
    border-color: var(--border);
  }

  .example-panel {
    display: none;
    padding: 12px;
  }

  .example-panel.is-active {
    display: block;
  }

  .example-panel pre {
    margin: 0;
  }

  .example-editor {
    width: 100%;
    min-height: 120px;
    margin-top: 10px;
    padding: 10px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    font-family: 'JetBrains Mono', 'SFMono-Regular', Consolas, Menlo, Monaco, monospace;
    font-size: 0.79rem;
    line-height: 1.45;
    resize: vertical;
  }

  .example-preview-host {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    min-height: 220px;
    overflow: hidden;
  }

  .preview-frame {
    display: block;
    width: 100%;
    min-height: 390px;
    border: 0;
    background: #fff;
  }

  .preview-message,
  .preview-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 18px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-soft);
    background: #f8fafc;
  }

  .preview-error {
    color: #b91c1c;
    background: #fef2f2;
  }

  .real-cases-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 10px;
  }

  .real-case {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .real-case-head {
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(140deg, #f8fafc 0%, #ffffff 55%);
  }

  .real-case-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
  }

  .real-case-subtitle {
    color: var(--text-soft);
    font-size: 0.84rem;
    margin: 0;
  }

  .case-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    flex-wrap: wrap;
  }

  .case-tab {
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
  }

  .case-tab:hover,
  .case-tab:focus-visible {
    background: #eef2ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
    outline: none;
  }

  .case-tab.is-active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #eff6ff;
  }

  .case-panel {
    display: none;
    padding: 12px;
  }

  .case-panel.is-active {
    display: block;
  }

  .case-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
  }

  .case-summary-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: #fcfdff;
  }

  .case-summary-label {
    color: var(--text-soft);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    font-weight: 700;
  }

  .case-summary-value {
    color: var(--text);
    font-size: 0.93rem;
    font-weight: 700;
  }

  .case-json-wrap {
    border: 1px solid var(--code-border);
    border-radius: var(--radius-sm);
    background: linear-gradient(170deg, #1c1e2c 0%, #161822 100%);
    padding: 10px;
    overflow: auto;
    max-height: 520px;
  }

  .case-json-wrap code {
    border: none;
    background: transparent;
    color: var(--code-text);
    padding: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    display: block;
    white-space: pre;
  }

  .case-preview-host {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 280px;
  }

  .schema-source-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
  }

  .schema-source-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 10px;
    box-shadow: var(--shadow-sm);
  }

  .schema-source-label {
    color: var(--text-soft);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    font-weight: 700;
  }

  .schema-source-value {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    word-break: break-word;
  }

  @media (max-width: 640px) {
    .example-tabs,
    .case-tabs {
      gap: 6px;
    }

    .example-tab,
    .case-tab {
      font-size: 0.74rem;
      padding: 5px 9px;
    }

    .example-editor {
      min-height: 96px;
    }
  }

  @media (max-width: 1200px) {
    :root {
      --toc-width: 270px;
    }

    .layout {
      width: min(1280px, calc(100% - 20px));
      gap: 18px;
    }

    .content {
      padding: 22px;
    }
  }

  @media (max-width: 980px) {
    .mobile-bar {
      display: flex;
    }

    .layout {
      display: block;
      width: calc(100% - 16px);
      margin-top: 0;
    }

    .sidebar {
      position: static;
      max-height: none;
      margin-bottom: 12px;
      display: none;
    }

    .sidebar.is-open {
      display: block;
    }

    .content {
      max-width: 100%;
      padding: 18px;
    }

    .section {
      margin-bottom: 30px;
    }
  }

  @media (max-width: 640px) {
    body {
      background: var(--bg);
    }

    .layout {
      width: calc(100% - 10px);
    }

    .mobile-bar {
      width: calc(100% - 10px);
      border-radius: 10px;
    }

    .content {
      border-radius: 12px;
      padding: 14px;
    }

    .section h2 {
      font-size: 1.18rem;
    }

    table {
      min-width: 560px;
    }

    .swatches {
      grid-template-columns: 1fr;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation: none !important;
      transition: none !important;
      scroll-behavior: auto !important;
    }
  }

  @media print {
    body {
      background: #fff;
    }

    .mobile-bar,
    .sidebar,
    .copy-btn {
      display: none !important;
    }

    .layout {
      display: block;
      width: 100%;
      margin: 0;
    }

    .content {
      max-width: 100%;
      border: none;
      box-shadow: none;
      background: #fff;
      padding: 0;
    }

    pre {
      box-shadow: none;
      border: 1px solid #cbd5e1;
    }
  }
