:root {
      --bg: #0d1017;
      --panel: #151a24;
      --panel-alt: #1b2230;
      --border: #263044;
      --text: #e9eef7;
      --muted: #93a1b8;
      --accent: #38bdf8;
      --accent-green: #22c55e;
      --accent-amber: #f59e0b;
      --accent-red: #ef4444;
      --accent-purple: #a855f7;
    }
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      line-height: 1.55;
    }
    header {
      background: linear-gradient(90deg, #101622, #172135);
      border-bottom: 1px solid var(--border);
      padding: 16px 24px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 12px;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .brand-badge {
      background: var(--accent);
      color: #081018;
      font-weight: 800;
      padding: 4px 10px;
      border-radius: 6px;
      font-size: 13px;
    }
    .brand h1 {
      margin: 0;
      font-size: 19px;
      font-weight: 700;
    }
    .controls {
      display: flex;
      align-items: center;
      gap: 14px;
      background: var(--panel);
      padding: 8px 14px;
      border-radius: 10px;
      border: 1px solid var(--border);
      font-size: 13px;
    }
    .layout {
      display: grid;
      grid-template-columns: 260px 1fr;
      min-height: calc(100vh - 69px);
    }
    nav {
      background: var(--panel);
      border-right: 1px solid var(--border);
      padding: 16px 12px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .nav-btn {
      background: transparent;
      color: var(--muted);
      border: 1px solid transparent;
      text-align: left;
      padding: 11px 14px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 14px;
      font-weight: 600;
      transition: 0.15s;
    }
    .nav-btn:hover { background: var(--panel-alt); color: var(--text); }
    .nav-btn.active {
      background: rgba(56, 189, 248, 0.13);
      color: var(--accent);
      border-color: rgba(56, 189, 248, 0.35);
    }
    main {
      padding: 24px;
      max-width: 1400px;
    }
    .card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 18px 20px;
      margin-bottom: 18px;
    }
    .card h2, .card h3 {
      margin-top: 0;
      margin-bottom: 10px;
    }
    .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
    .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
    .pill {
      display: inline-block;
      padding: 3px 9px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 700;
    }
    .pill.PASS, .pill.APPROVED, .pill.ALIVE, .pill.KNOWN { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
    .pill.WARN, .pill.DRAFT, .pill.PLANTED { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
    .pill.FAIL, .pill.DEAD, .pill.UNKNOWN { background: rgba(239, 68, 68, 0.18); color: #f87171; }
    .muted { color: var(--muted); font-size: 13px; }
    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13.5px;
    }
    th, td {
      border-bottom: 1px solid var(--border);
      padding: 10px 12px;
      text-align: left;
      vertical-align: top;
    }
    th { color: var(--muted); font-weight: 600; background: rgba(255,255,255,0.02); }
    .reader-box {
      max-width: 680px;
      margin: 0 auto;
      background: #12161f;
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 32px 28px;
      font-size: 16.5px;
      line-height: 1.85;
      white-space: pre-wrap;
    }
    .scene-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px;
      margin-top: 12px;
    }
    .scene-box {
      background: var(--panel-alt);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px;
      font-size: 13px;
    }
    .scene-box strong { color: var(--accent); display: block; margin-bottom: 6px; }
    .tab-pane { display: none; }
    .tab-pane.active { display: block; }
    code {
      background: #0b0e14;
      padding: 2px 6px;
      border-radius: 4px;
      color: #7dd3fc;
      font-size: 12.5px;
    }

/* Shared layout: no fixed-width content inside a small viewport. */
[hidden] { display: none !important; }
html { scroll-padding-top: 72px; }
body { overflow-wrap: anywhere; }
button, select, summary, input { font: inherit; }
button, select, summary { touch-action: manipulation; }
button, select { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .38; }
button:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #0ea5e9; outline-offset: 3px;
}
.brand { min-width: 0; flex: 1; }
.brand-badge { flex-shrink: 0; }
.brand h1 { overflow-wrap: anywhere; }
.layout { grid-template-columns: 220px minmax(0, 1fr); }
nav { min-width: 0; align-self: start; position: sticky; top: 0; }
main { min-width: 0; width: 100%; }
.card { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.scene-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.controls { flex-wrap: wrap; }
.controls input { min-width: 0; flex: 1; }
#load-error { border-color: var(--accent-red); }
#load-error button { padding: 8px 16px; border-radius: 8px; }
@media (max-width: 800px) {
  header { padding: 14px 16px; gap: 12px; }
  .brand { width: 100%; }
  .brand-badge { font-size: 10px; padding: 5px 7px; }
  .brand h1 { font-size: 15px; line-height: 1.55; }
  .controls { width: 100%; gap: 8px; padding: 8px 10px; }
  .controls label { width: 100%; }
  .controls input { width: 100px; }
  .layout { display: block; min-height: calc(100dvh - 80px); }
  nav { display: flex; flex-direction: row; gap: 4px; padding: 7px 12px;
    width: 100%; max-width: 100%; overflow-x: auto; z-index: 10;
    border-right: 0; border-bottom: 1px solid var(--border); }
  .nav-btn { flex: 0 0 auto; padding: 9px 11px; font-size: 14px;
    white-space: nowrap; text-align: center; }
  main { padding: 16px; max-width: none; }
  .card { padding: 16px; border-radius: 12px; }
  .card h2 { font-size: 18px; line-height: 1.55; }
  .scene-grid { grid-template-columns: 1fr; }
  .scene-box { font-size: 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { margin-bottom: 14px; border: 1px solid var(--border);
    border-radius: 10px; padding: 5px 12px; background: var(--panel-alt); }
  td { padding: 9px 0; font-size: 14px; }
  td:last-child { border-bottom: 0; }
  td::before { content: attr(data-label); display: block; color: var(--muted);
    font-size: 11px; font-weight: 700; margin-bottom: 5px; }
  code { white-space: normal; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
