:root { --bg:#0b0f15; --panel:rgba(11,15,21,.95); --line:#2c3542; --line2:#3a4452; --ink:#e9e3d3; --hi:#f4efe2; --mute:#8e97a4; --mute2:#b9c0ca; --gold:#d9b25c; --teal:#5fc8b8;
          --serif:"Brygada 1918", Georgia, serif; --sans:"Onest", system-ui, sans-serif; --mono:"IBM Plex Mono", ui-monospace, monospace; }
  * { box-sizing:border-box; }
  html,body { margin:0; height:100%; overflow:hidden; background:#141f27; font-family:var(--sans); color:var(--ink); }
  canvas { display:block; width:100vw; height:100vh; cursor:grab; touch-action:none; }
  canvas.pointer { cursor:pointer; }
  .card { background:var(--panel); border:1px solid var(--line); }
  .cap { font-family:var(--mono); font-size:11px; letter-spacing:.2em; text-transform:uppercase; }
  button { font-family:var(--sans); font-size:13px; background:transparent; color:var(--ink); border:1px solid var(--line2); padding:9px 14px; cursor:pointer; border-radius:0; }
  button:hover { border-color:var(--gold); color:var(--hi); }
  button:focus-visible, a:focus-visible, input:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
  a { color:var(--gold); }

  /* top bar */
  .bar { position:fixed; top:0; left:0; right:0; height:64px; display:flex; gap:22px; align-items:center; padding:0 24px; background:linear-gradient(rgba(11,15,21,.96), rgba(11,15,21,.82)); border-bottom:1px solid var(--line); z-index:3; }
  .brand { text-decoration:none; display:flex; align-items:baseline; gap:14px; white-space:nowrap; }
  .brand b { font-family:var(--serif); font-weight:600; font-size:22px; letter-spacing:.26em; color:var(--hi); }
  .brand span { color:var(--gold); }
  .modes { display:flex; margin-left:auto; border:1px solid var(--line2); }
  .modes button { border:none; padding:9px 15px; color:var(--mute2); }
  .modes .sht { display:none; }
  .modes button.on { background:var(--gold); color:var(--bg); font-weight:600; }
  .btns { display:flex; gap:6px; }
  button.sq { width:38px; padding:8px 0; font-size:17px; line-height:1; }
  .coords { position:fixed; left:24px; top:78px; padding:4px 10px; font-family:var(--mono); font-size:11.5px; color:var(--mute2); }
  .legend { position:fixed; left:24px; top:110px; padding:6px 10px; font-size:12px; display:flex; align-items:center; gap:8px; color:var(--mute2); }
  .lg-hatch { width:22px; height:12px; border:1px solid rgba(255,255,255,.25); background:repeating-linear-gradient(-45deg,#2a8c82 0 3px,transparent 3px 5px,#5e7fb2 5px 8px,transparent 8px 10px); }
  .hint { position:fixed; top:78px; right:24px; padding:10px 14px; font-size:13px; max-width:280px; color:var(--mute2); }

  /* timeline */
  .timeline { position:fixed; left:24px; right:24px; bottom:18px; height:96px; padding:0 22px; display:flex; align-items:center; gap:20px; }
  .play { width:44px; height:44px; padding:0; border:1px solid var(--gold); color:var(--gold); font-size:14px; flex:none; }
  .year { display:flex; flex-direction:column; flex:none; width:118px; }
  #yearNum { font-family:var(--mono); font-weight:500; font-size:38px; line-height:1; color:var(--gold); }
  #yearEra { font-size:11.5px; color:var(--mute); margin-top:4px; min-height:14px; }
  .yearbtns { display:grid; grid-template-columns:1fr 1fr; gap:4px; flex:none; }
  .yearbtns button { padding:3px 8px; font-family:var(--mono); font-size:11px; color:var(--mute2); }
  .trackwrap { flex:1; display:flex; flex-direction:column; gap:6px; min-width:0; }
  input[type=range] { -webkit-appearance:none; appearance:none; width:100%; margin:0; height:22px; background:transparent; }
  input[type=range]::-webkit-slider-runnable-track { height:2px; background:var(--line2); }
  input[type=range]::-moz-range-track { height:2px; background:var(--line2); }
  input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; width:14px; height:14px; margin-top:-6px; background:var(--gold); transform:rotate(45deg); border:none; }
  input[type=range]::-moz-range-thumb { width:13px; height:13px; background:var(--gold); transform:rotate(45deg); border:none; border-radius:0; }
  .ticks { position:relative; height:14px; }
  .tick { position:absolute; top:2px; width:8px; height:8px; padding:0; transform:translateX(-50%) rotate(45deg); background:var(--teal); border:none; opacity:.75; }
  .tick:hover { background:var(--gold); opacity:1; }
  .scale { position:relative; height:12px; font-family:var(--mono); font-size:10.5px; color:#6f7886; }
  .scale span { position:absolute; transform:translateX(-50%); white-space:nowrap; }
  .event { position:fixed; left:50%; transform:translateX(-50%); bottom:126px; padding:7px 14px; font-size:13px; color:var(--hi); opacity:0; transition:opacity .25s; pointer-events:none; white-space:nowrap; }
  .event.on { opacity:1; }

  /* side panel */
  .panel { position:fixed; top:78px; right:24px; bottom:130px; width:392px; overflow:auto; display:none; }
  .panel.on { display:flex; flex-direction:column; }
  .x { position:absolute; top:10px; right:10px; border:none; font-size:22px; padding:2px 8px; color:var(--mute); }
  .phead { display:flex; gap:16px; align-items:center; padding:22px 24px 18px; border-bottom:1px solid var(--line); }
  .phead .nm { font-family:var(--serif); font-weight:600; font-size:26px; line-height:1.08; color:var(--hi); margin-right:24px; }
  .phead .kz { color:var(--teal); }
  .phead .dates { font-family:var(--mono); font-size:12px; color:var(--mute); }
  .psec { padding:18px 24px 0; display:flex; flex-direction:column; gap:10px; }
  .psec p { margin:0; font-size:14.5px; line-height:1.55; color:#d4d0c6; }
  .also { display:flex; flex-wrap:wrap; gap:6px; align-items:center; font-size:12.5px; color:var(--mute); }
  .chip { font-size:12.5px; padding:5px 10px; display:inline-flex; align-items:center; gap:7px; }
  .chip i { width:8px; height:8px; display:inline-block; }
  .rul { display:flex; gap:16px; align-items:flex-start; }
  .rul .nm { font-family:var(--serif); font-weight:600; font-size:30px; line-height:1.02; color:var(--hi); text-decoration:none; cursor:pointer; }
  .rul .meta { font-family:var(--mono); font-size:12px; color:var(--mute2); line-height:1.7; }
  .rul .title { font-size:13px; color:var(--mute2); }
  .link { font-size:14px; cursor:pointer; text-decoration:none; color:var(--gold); }
  .link:hover { text-decoration:underline; }
  ol.rulers { list-style:none; padding:0; margin:0; font-size:14px; }
  ol.rulers li { display:flex; justify-content:space-between; gap:10px; padding:5px 10px; margin:0 -10px; cursor:pointer; color:var(--mute); }
  ol.rulers li:hover { color:var(--hi); }
  ol.rulers li.cur { background:rgba(217,178,92,.12); color:var(--hi); }
  ol.rulers li.cur span:first-child::before { content:""; display:inline-block; width:6px; height:6px; background:var(--gold); transform:rotate(45deg); margin-right:10px; vertical-align:2px; }
  ol.rulers li span:last-child { font-family:var(--mono); font-size:12px; white-space:nowrap; }
  ol.rulers li.cur span:last-child { color:var(--gold); }
  .pfoot { margin-top:auto; padding:14px 24px; border-top:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:12.5px; color:var(--mute); }
  .pfoot { position:sticky; bottom:0; background:var(--panel); }
  .gap { height:16px; flex:none; }

  /* AI placeholders */
  .ph { position:relative; flex:none; }
  .ph .frame { border:1px solid #4a5260; background:#141b24; display:flex; align-items:center; justify-content:center; overflow:hidden; }
  .ph.emb .frame { width:58px; height:58px; }
  .ph.por .frame { width:84px; height:104px; align-items:flex-end; background:#18202b; }
  .ph.big .frame { width:132px; height:164px; }
  .ai { position:absolute; right:-6px; bottom:-6px; width:18px; height:18px; padding:0; border:1px solid var(--bg); background:var(--gold); color:var(--bg); font-family:var(--mono); font-size:8.5px; font-weight:500; line-height:1; cursor:help; }
  .ai:hover { color:var(--bg); border-color:var(--bg); }
  .tip { position:absolute; left:0; top:calc(100% + 10px); z-index:5; width:270px; padding:12px 14px; background:var(--bg); border:1px solid var(--gold); font-size:13px; line-height:1.45; color:var(--ink); box-shadow:0 6px 24px rgba(0,0,0,.5); display:none; }
  .tip b { display:block; font-family:var(--mono); font-weight:500; font-size:10.5px; letter-spacing:.18em; color:var(--gold); margin-bottom:6px; }
  .ai:hover + .tip, .ai:focus + .tip { display:block; }

  /* person page */
  .modal { position:fixed; inset:0; background:rgba(5,8,12,.6); display:none; place-items:center; padding:16px; z-index:6; }
  .modal.on { display:grid; }
  .person { max-width:640px; width:100%; max-height:86vh; overflow:auto; padding:28px 30px; position:relative; background:var(--bg); }
  .person .top { display:flex; gap:22px; align-items:flex-start; }
  .person h1 { margin:0; font-family:var(--serif); font-weight:600; font-size:36px; line-height:1.05; color:var(--hi); }
  .person .sub { color:var(--gold); font-size:14px; margin-top:6px; }
  .person dl { display:grid; grid-template-columns:auto 1fr; gap:4px 16px; font-size:13.5px; margin:14px 0 0; }
  .person dt { color:var(--mute); }
  .person dd { margin:0; font-family:var(--mono); font-size:12.5px; color:var(--mute2); }
  .person .bio { font-size:15.5px; line-height:1.6; margin-top:18px; color:#d4d0c6; }
  .person .acts { display:flex; gap:8px; flex-wrap:wrap; margin-top:18px; }
  .muted { color:var(--mute); font-size:13px; }
  .toast { position:fixed; left:50%; top:76px; transform:translateX(-50%); padding:10px 16px; font-size:14px; display:none; z-index:10; }
  .toast.on { display:block; }
  .loading { position:fixed; inset:0; display:grid; place-items:center; font-family:var(--serif); font-size:20px; letter-spacing:.2em; background:var(--bg); color:var(--gold); transition:opacity .4s; pointer-events:none; z-index:20; }
  .credit { position:fixed; right:26px; bottom:2px; font-size:10px; color:#6f7886; }

  @media (max-width:760px) {
    .bar { height:56px; padding:0 12px; gap:10px; }
    .brand b { font-size:16px; letter-spacing:.16em; } .brand span { display:none; }
    .modes button { padding:7px 9px; font-size:12px; } .modes .lng { display:none; } .modes .sht { display:inline; }
    .btns button:not(.sq) { display:none; }
    .coords, .hint { display:none; }
    .legend { top:auto; bottom:116px; left:8px; font-size:11px; }
    .timeline { left:8px; right:8px; bottom:8px; height:86px; padding:0 12px; gap:12px; }
    .yearbtns, .scale { display:none; }
    #yearNum { font-size:28px; } .year { width:78px; }
    .panel { top:auto; left:8px; right:8px; width:auto; bottom:102px; max-height:52vh; }
    .event { bottom:104px; font-size:12px; }
    .credit { display:none; }
  }
