:root {
  --bg: #1a1c1e;
  --gold: #d4af37;
  --brass: #dcc08a;
  --accent: #4a5056;
  --text: #f0f2f5;
  --muted: #b7bcc2;
  --panel: rgba(22, 24, 26, 0.74);
  --line: rgba(240, 242, 245, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overflow: hidden; }
body { -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }

.viewer { position: fixed; inset: 0; touch-action: none; }
.viewer canvas { display: block; width: 100%; height: 100%; outline: none; }
.viewer::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 95% at 42% 45%, transparent 55%, rgba(10, 11, 12, .32) 100%); }

/* ---------- brand ---------- */
.brand {
  position: fixed; top: 22px; left: 26px; max-width: 300px; padding: 16px 20px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(12px) saturate(1.1); -webkit-backdrop-filter: blur(12px) saturate(1.1);
  pointer-events: none;
}
.kicker { margin: 0 0 8px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.brand h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.02; letter-spacing: .01em; }
.brand h1 span { display: block; font-size: 17px; color: var(--muted); letter-spacing: .08em; margin-top: 4px; font-style: italic; }
.tag { margin: 10px 0 0; font-family: var(--serif); font-style: italic; color: var(--brass); font-size: 15px; }
.what { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ---------- notes ---------- */
.notes {
  position: fixed; top: 22px; right: 22px; width: 300px; display: flex; flex-direction: column; gap: 6px;
  max-height: calc(100% - 170px); overflow: auto; scrollbar-width: none;
}
.notes::-webkit-scrollbar { display: none; }
.note {
  display: grid; grid-template-columns: 30px 1fr; gap: 2px 8px; text-align: left; cursor: pointer;
  padding: 12px 14px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .25s, background .25s, transform .25s;
}
.note:hover { border-color: rgba(212, 175, 55, .45); }
.note:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.note.active { border-color: rgba(212, 175, 55, .75); background: rgba(30, 30, 28, .84); }
.note .n { grid-row: span 2; font-family: var(--serif); font-size: 18px; color: var(--gold); line-height: 1.2; }
.note .t { font-size: 13.5px; font-weight: 600; letter-spacing: .01em; line-height: 1.3; }
.note .b { font-size: 12.5px; line-height: 1.5; color: var(--muted); display: none; margin-top: 4px; }
.note.open .b { display: block; }
.note .b { grid-column: 2; }
.note { padding: 10px 14px 11px; }
.note .n { grid-row: auto; }
.notes-pill { display: none; }
.disclaimer { margin: 0; padding: 7px 12px; font-size: 11px; line-height: 1.45; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---------- dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); width: min(860px, calc(100% - 40px));
  padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  display: flex; flex-direction: column; gap: 8px;
}
.row { display: flex; align-items: center; gap: 8px; }
.row.views { overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.row.views::-webkit-scrollbar { display: none; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(74, 80, 86, .35);
  font-size: 13.5px; font-weight: 600; transition: background .2s, border-color .2s, color .2s;
}
.btn:hover { background: rgba(74, 80, 86, .6); }
.btn[aria-pressed="true"] { background: var(--gold); color: #1a1c1e; border-color: var(--gold); }
.btn .ico { font-size: 15px; line-height: 1; }
.moon-ico { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset -4px -1px 0 0 currentColor; display: inline-block; transform: rotate(-20deg); }
.time { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 4px 0 8px; }
.time input { flex: 1; min-width: 60px; accent-color: var(--gold); height: 28px; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent; }
.time input::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, #eae6dc, #d9a466 38%, #3b4d7c 62%, #121a33); }
.time input::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, #eae6dc, #d9a466 38%, #3b4d7c 62%, #121a33); }
.time input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--text); border: 2px solid var(--gold); }
.time input::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 2px solid var(--gold); }
.time-label { font-size: 12px; color: var(--muted); min-width: 92px; text-align: right; font-variant-numeric: tabular-nums; }
.chip {
  white-space: nowrap; cursor: pointer; padding: 7px 12px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); transition: all .2s;
}
.chip:hover { color: var(--text); border-color: rgba(240,242,245,.3); }
.chip.active, .chip[aria-pressed="true"] { color: var(--text); border-color: var(--gold); background: rgba(212,175,55,.14); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.hint {
  position: fixed; left: 50%; transform: translateX(-50%); top: 26px; margin: 0; padding: 6px 12px; border-radius: 999px;
  font-size: 12px; color: var(--text); background: rgba(22,24,26,.55); pointer-events: none; transition: opacity .8s;
}
.hint.gone { opacity: 0; }

/* ---------- dimension labels ---------- */
.labels { position: fixed; inset: 0; pointer-events: none; }
.dim {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 11.5px; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; color: #1a1c1e;
  background: rgba(240, 242, 245, .9); opacity: 0; transition: opacity .35s; font-variant-numeric: tabular-nums;
}
.labels.on .dim.vis { opacity: 1; }

/* ---------- loader ---------- */
.loader { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--bg); transition: opacity .8s; z-index: 5; }
.loader.done { opacity: 0; pointer-events: none; }
.loader p { margin: 0; font-family: var(--serif); font-style: italic; color: var(--muted); }
.loader .ring { width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(212,175,55,.2); border-top-color: var(--gold); animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- stills dialog ---------- */
.stills { max-width: min(1180px, 94vw); width: 100%; padding: 22px 24px 24px; border-radius: 16px; border: 1px solid var(--line); background: #141618; color: var(--text); }
.stills::backdrop { background: rgba(8, 9, 10, .72); }
.stills h2 { margin: 0 0 4px; font-family: var(--serif); font-weight: 400; font-size: 24px; }
.stills p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.stills .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.stills figure { margin: 0; }
.stills img { width: 100%; height: auto; display: block; border-radius: 8px; background: #222; aspect-ratio: 16 / 10; cursor: zoom-in; }
.stills img.big { position: fixed; inset: 3vh 3vw; width: 94vw; height: 94vh; object-fit: contain; background: rgba(10,10,10,.96); cursor: zoom-out; z-index: 3; }
.stills figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stills.zoomed .close { position: fixed; top: calc(3vh + 10px); right: calc(3vw + 10px); z-index: 5; background: rgba(20,22,24,.8); }
.stills .close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; font-size: 20px; cursor: pointer; }

/* ---------- small screens ---------- */
@media (max-width: 980px) {
  .notes { width: 280px; }
  .brand { max-width: 300px; }
}
@media (max-width: 760px) {
  .brand { top: 10px; left: 10px; right: 10px; max-width: none; padding: 11px 14px 11px; border-radius: 12px; }
  .kicker { font-size: 9.5px; margin-bottom: 5px; }
  .brand h1 { font-size: 24px; }
  .brand h1 span { display: inline; font-size: 14px; margin-left: 6px; }
  .tag { margin-top: 4px; font-size: 13px; }
  .what { font-size: 12px; margin-top: 5px; line-height: 1.4; }
  .notes {
    top: auto; right: 10px; left: 10px; bottom: 164px; width: auto; max-height: 56vh; display: none; z-index: 3;
  }
  body.sheet-open .notes { display: flex; }
  .note .b { font-size: 12px; line-height: 1.42; }
  .notes-pill {
    display: inline-flex; align-items: center; gap: 7px; position: fixed; left: 10px; bottom: 122px; z-index: 3;
    padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(212,175,55,.5); background: var(--panel);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 13px; cursor: pointer;
  }
  .notes-pill .n { font-family: var(--serif); color: var(--gold); }
  .notes-pill .chev { color: var(--muted); transition: transform .2s; }
  body.sheet-open .notes-pill .chev { transform: rotate(90deg); }
  .row.views { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 30px; }
  .dock { bottom: 10px; width: calc(100% - 20px); padding: 8px; gap: 7px; border-radius: 14px; }
  .btn { padding: 8px 11px; font-size: 13px; }
  .time { padding: 0 0 0 2px; gap: 8px; }
  .time-label { min-width: 0; font-size: 11px; }
  .hint { top: auto; bottom: 170px; font-size: 11px; max-width: 92vw; white-space: nowrap; }
  .stills .grid { grid-template-columns: 1fr; }
  .stills { padding: 16px; max-height: 90vh; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { .loader .ring { animation: none; } }
