:root {
  --ivory: rgba(238, 231, 214, 0.92);
  --ivory-2: rgba(226, 219, 203, 0.62);
  --ivory-3: rgba(214, 208, 196, 0.36);
  --hair: rgba(226, 214, 186, 0.16);
  --brass: #d8b878;
  --brass-dim: rgba(216, 184, 120, 0.55);
  --ice: #8fd6ff;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: var(--ivory); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
canvas#sky, canvas#overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#sky { cursor: grab; touch-action: none; }
canvas#sky.dragging { cursor: grabbing; }
canvas#overlay { pointer-events: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: var(--mono); font-weight: 300; letter-spacing: 0.02em; }
.muted { color: var(--ivory-3); }
.serif-i { font-style: italic; }
.eyebrow { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--ivory-3); }

#ui { position: fixed; inset: 0; pointer-events: none; transition: opacity 1.2s ease; opacity: 0; }
#ui.on { opacity: 1; }
#ui.hidden-ui { opacity: 0 !important; }
#ui.hidden-ui * { pointer-events: none !important; }
.panel, #ribbon-wrap, #card { pointer-events: auto; }
.panel { text-shadow: 0 0 12px rgba(0,0,0,0.9), 0 0 2px rgba(0,0,0,0.6); }
#title::before, #since::before, #instruments::before { content: ""; position: absolute; z-index: -1; inset: -60px -90px -50px -70px; background: radial-gradient(closest-side, rgba(2,3,7,0.5), rgba(2,3,7,0.26) 55%, transparent); opacity: var(--scrim, 1); pointer-events: none; }
#ribbon-wrap::before { content: ""; position: absolute; z-index: -1; inset: -30px -40px -26px; background: linear-gradient(to top, rgba(2,3,6,0.85), rgba(2,3,6,0.5) 60%, transparent); pointer-events: none; }

/* ---------- title ---------- */
#title { position: absolute; left: 44px; top: 36px; max-width: 520px; }
.place { display: block; margin-top: 6px; font-family: var(--serif); font-weight: 300; font-size: 46px; line-height: 1; letter-spacing: 0.005em; color: var(--ivory); text-align: left; }
.place::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 12px; border-right: 1px solid var(--brass-dim); border-bottom: 1px solid var(--brass-dim); transform: translateY(-9px) rotate(45deg); transition: transform .3s; }
.place:hover::after { transform: translateY(-6px) rotate(45deg); }
.coords { margin-top: 10px; font-size: 11px; color: var(--ivory-2); }
.date { margin-top: 16px; font-size: 25px; font-weight: 300; font-style: italic; }
.date .scrub + .scrub { margin-left: 0.18em; }
#d-weekday::after { content: ","; }
.time { margin-top: 6px; font-size: 15px; color: var(--ivory); letter-spacing: 0.06em; }
.time i { font-style: normal; color: var(--ivory-2); padding: 0 1px; }
.tz { margin-left: 10px; color: var(--ivory-3); font-size: 11px; }
.scrub { position: relative; cursor: ns-resize; outline: none; border-bottom: 1px solid transparent; transition: border-color .25s, color .25s; user-select: none; -webkit-user-select: none; }
.scrub:hover, .scrub:focus-visible, .scrub.active { border-bottom-color: var(--brass-dim); color: #fff6e2; }
.scrub::before, .scrub::after { pointer-events: none; }
.scrub:hover::before, .scrub.active::before { content: ""; position: absolute; left: 50%; top: -7px; width: 5px; height: 5px; border-left: 1px solid var(--brass); border-top: 1px solid var(--brass); transform: translateX(-50%) rotate(45deg); opacity: .8; }
#d-weekday:hover::after { content: ","; }
.scrub-hint { margin-top: 10px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--ivory-3); opacity: 0; transition: opacity .4s; text-transform: uppercase; }
#title:hover .scrub-hint { opacity: 1; }
.places { margin-top: 14px; padding: 12px 0 4px; border-top: 1px solid var(--hair); display: grid; grid-template-columns: 1fr 1fr; gap: 2px 24px; }
.places button { text-align: left; font-size: 17px; font-weight: 300; color: var(--ivory-2); padding: 3px 0; transition: color .2s; }
.places button small { font-family: var(--mono); font-size: 9px; color: var(--ivory-3); margin-left: 6px; }
.places button:hover, .places button.cur { color: var(--ivory); }
.places button.cur::before { content: "◆ "; font-size: 8px; color: var(--brass); vertical-align: 2px; }

/* ---------- toggles ---------- */
#toggles { position: absolute; right: 40px; top: 36px; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
#toggles button, .pill, .dial-btns button { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ivory-3); transition: color .25s; }
#toggles button::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 10px; border: 1px solid currentColor; border-radius: 50%; vertical-align: 1px; transition: background .25s, box-shadow .25s; }
#toggles button.on { color: var(--ivory); }
#toggles button.on::after { background: var(--brass); border-color: var(--brass); box-shadow: 0 0 8px rgba(216,184,120,.7); }
#toggles button:hover { color: var(--ivory); }
#toggles .sep { width: 46px; height: 1px; background: var(--hair); margin: 6px 0; }
#go-then::after, #go-now::after { display: none !important; }
#go-then, #go-now { color: var(--brass-dim) !important; }
#go-then:hover, #go-now:hover { color: var(--brass) !important; }

/* ---------- since ---------- */
#since { position: absolute; left: 44px; bottom: 132px; width: 400px; }
#since .big { font-size: 40px; font-weight: 300; line-height: 1; margin-top: 10px; }
#since-ymd { font-size: 16px; margin-top: 4px; }
.ledger { margin: 16px 0 0; display: grid; gap: 1px; }
.ledger dt { font-size: 14px; font-style: italic; color: var(--ivory-2); margin-top: 8px; }
.ledger dd { margin: 2px 0 0; font-size: 13px; display: flex; align-items: baseline; gap: 6px; }
.ledger dd .mono { color: var(--ivory); font-size: 13.5px; }
.ledger .unit { font-family: var(--mono); font-size: 9.5px; color: var(--ivory-3); letter-spacing: .14em; }
.ledger em { margin-left: auto; font-family: var(--mono); font-style: normal; font-size: 10px; color: var(--brass-dim); }
.reach { font-size: 15.5px; line-height: 1.35; color: var(--ivory-2); margin: 14px 0 10px; }
.reach b { font-weight: 400; color: var(--ice); }
.row { display: flex; gap: 14px; }
.pill { padding: 6px 12px 6px 10px; border: 1px solid var(--hair); border-radius: 20px; color: var(--ivory-2) !important; }
.pill::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border: 1px solid var(--ice); border-radius: 50%; vertical-align: -1px; transition: box-shadow .3s, background .3s; }
.pill.on { border-color: rgba(143,214,255,.4); color: var(--ice) !important; }
.pill.on::before { background: var(--ice); box-shadow: 0 0 10px var(--ice); }
.drift { margin-top: 16px; }
.drift label { display: flex; justify-content: space-between; font-size: 14px; font-style: italic; color: var(--ivory-2); }
.drift label .mono { font-style: normal; font-size: 11px; color: var(--brass); }
.drift-scale { display: flex; justify-content: space-between; font-size: 8.5px; color: var(--ivory-3); letter-spacing: .1em; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; margin: 4px 0 0; cursor: ew-resize; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(90deg, transparent, var(--hair) 8%, var(--brass-dim) 50%, var(--hair) 92%, transparent); }
input[type=range]::-moz-range-track { height: 1px; background: var(--hair); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 9px; height: 9px; margin-top: -4px; transform: rotate(45deg); background: #0b0d12; border: 1px solid var(--brass); }
input[type=range]::-moz-range-thumb { width: 8px; height: 8px; border-radius: 0; transform: rotate(45deg); background: #0b0d12; border: 1px solid var(--brass); }

/* ---------- instruments ---------- */
#instruments { position: absolute; right: 40px; bottom: 120px; display: flex; align-items: flex-end; gap: 34px; }
#instruments figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
#globe { width: 150px; height: 150px; cursor: crosshair; touch-action: none; }
#globe-cap { margin-top: 4px; font-size: 8.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--ivory-3); }
#dial { width: 236px; height: 132px; cursor: ew-resize; touch-action: none; }
#rate-read { text-align: center; font-size: 11px; color: var(--ivory-2); margin-top: 2px; min-height: 14px; }
.dial-btns { display: flex; justify-content: center; gap: 14px; margin-top: 8px; }
.dial-btns button { letter-spacing: .08em; font-size: 10px; }
.dial-btns button:hover, .dial-btns button.on { color: var(--brass); }
#lock { letter-spacing: .2em; font-size: 8.5px; margin-left: 4px; }

/* ---------- ribbon ---------- */
#ribbon-wrap { position: absolute; left: 40px; right: 40px; bottom: 26px; height: 84px; }
#ribbon { width: 100%; height: 100%; display: block; cursor: col-resize; touch-action: none; }

/* ---------- card ---------- */
#card { position: fixed; z-index: 5; min-width: 230px; max-width: 320px; padding: 14px 16px 12px; background: rgba(6, 8, 14, 0.66); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); border: 1px solid var(--hair); border-radius: 2px; pointer-events: none; transition: opacity .2s; }
#card h3 { margin: 0; font-weight: 400; font-size: 24px; line-height: 1.05; }
#card .sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; color: var(--ivory-3); text-transform: uppercase; margin-top: 4px; }
#card .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
#card p { margin: 8px 0 0; font-size: 15px; line-height: 1.3; color: var(--ivory-2); }
#card p b { color: var(--ivory); font-weight: 400; }
#card p.ice b { color: var(--ice); }
#card .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin-top: 10px; font-family: var(--mono); font-size: 10.5px; color: var(--ivory-2); }
#card .kv span:nth-child(odd) { color: var(--ivory-3); }

#hint { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 9px; letter-spacing: .18em; color: var(--ivory-3); text-transform: uppercase; opacity: .7; white-space: nowrap; }
#keys { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 90vw); padding: 22px 26px; background: rgba(6,8,14,.75); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--hair); pointer-events: auto; font-size: 16px; color: var(--ivory-2); }
#keys b { font-family: var(--mono); font-weight: 400; font-size: 11px; color: var(--brass); }

/* ---------- intro ---------- */
#intro { position: fixed; inset: 0; display: grid; place-items: center; background: #000; transition: opacity 2.4s ease, visibility 2.4s; z-index: 10; cursor: pointer; }
#intro.gone { opacity: 0; visibility: hidden; }
.intro-inner { text-align: center; opacity: 0; transform: translateY(8px); animation: rise 2.2s .3s ease forwards; }
.intro-inner h1 { font-weight: 300; font-style: italic; font-size: clamp(30px, 4.4vw, 60px); margin: 18px 0 10px; letter-spacing: .005em; }
.intro-inner p { margin: 0; font-size: 18px; color: var(--ivory-2); letter-spacing: .04em; }
@keyframes rise { to { opacity: 1; transform: none; } }
#fail { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; font-size: 20px; padding: 40px; z-index: 20; background: #000; }

@media (max-width: 1100px) {
  #since { width: 340px; bottom: 300px; }
  #instruments { gap: 18px; }
  .place { font-size: 36px; }
}
@media (max-width: 760px) {
  #title { left: 20px; top: 18px; }
  .place { font-size: 30px; }
  .date { font-size: 19px; }
  #toggles { right: 16px; top: 18px; }
  #since { display: none; }
  #instruments { right: 12px; left: 12px; justify-content: space-between; bottom: 104px; }
  #globe { width: 110px; height: 110px; }
  #ribbon-wrap { left: 12px; right: 12px; }
  #hint { display: none; }
}
@media (max-height: 820px) and (min-width: 761px) {
  #since .ledger dt { margin-top: 4px; }
  #since .big { font-size: 32px; }
}

#keys .credits { margin-top: 14px; font-family: var(--mono); font-size: 9.5px; color: var(--ivory-3); }
#keys .credits a { color: var(--brass-dim); }
