:root {
  --cream: #fbf1df;
  --ink: #3b2a22;
  --coral: #e8684a;
  --marigold: #f6b84b;
  --teal: #2f8c8c;
  --sys: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a1430; overflow: hidden; }
body { font: 13px/1.35 var(--sys); -webkit-font-smoothing: antialiased; color: #fff; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font: inherit; }

.ui { transition: opacity 0.8s ease; }
body.bare .ui { display: none; }
/* Controls only fade in full screen; the page itself keeps its pitch visible. */
body.full.idle .ui { opacity: 0; pointer-events: none; }
body.full.idle { cursor: none; }
body.full .pitch, body.full .menubar .mb-date { display: none; }

/* ---------- macOS menu bar (only the right-hand status area, like a real desktop) */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 26px; z-index: 3;
  display: flex; justify-content: flex-end; align-items: center; gap: 2px; padding: 0 10px;
  background: rgba(0, 0, 0, 0.16);
  -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%);
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.95);
  text-shadow: 0 0 6px rgba(0,0,0,.25);
}
.mb-item { height: 22px; padding: 0 7px; display: grid; place-items: center; border-radius: 5px; font-variant-numeric: tabular-nums; }
.mb-icon { border: 0; color: inherit; background: transparent; cursor: default; }
.mb-icon svg { width: 18px; height: 18px; }
.mb-icon[aria-expanded=true], .mb-icon:hover { background: rgba(255,255,255,.22); }

/* ---------- Panel: mirrors the app's NSPopover */
.panel {
  --bg: rgba(242, 240, 236, 0.74);
  --edge: rgba(0, 0, 0, 0.14);
  --label: rgba(0, 0, 0, 0.86);
  --label-2: rgba(0, 0, 0, 0.5);
  --fill: rgba(0, 0, 0, 0.055);
  --fill-2: rgba(0, 0, 0, 0.1);
  --seg-on: #fff;
  --sep: rgba(0, 0, 0, 0.08);
  --accent: #0a84ff;
  position: fixed; top: 32px; right: 10px; z-index: 2; width: 300px;
  padding: 10px; border-radius: 14px;
  color: var(--label); background: var(--bg);
  -webkit-backdrop-filter: blur(40px) saturate(180%); backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 0 0 0.5px var(--edge), inset 0 0.5px 0 rgba(255,255,255,.6), 0 18px 50px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.12);
  transform-origin: calc(100% - 100px) -6px;
  transition: opacity .18s ease, transform .18s ease;
  user-select: none; -webkit-user-select: none;
}
.panel[hidden] { display: block; opacity: 0; transform: scale(.97); pointer-events: none; visibility: hidden; transition: opacity .12s, transform .12s, visibility 0s .12s; }
@media (prefers-color-scheme: dark) {
  .panel {
    --bg: rgba(38, 36, 34, 0.7);
    --edge: rgba(0, 0, 0, 0.55);
    --label: rgba(255, 255, 255, 0.9);
    --label-2: rgba(255, 255, 255, 0.5);
    --fill: rgba(255, 255, 255, 0.07);
    --fill-2: rgba(255, 255, 255, 0.14);
    --seg-on: rgba(255, 255, 255, 0.22);
    --sep: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 0.5px var(--edge), inset 0 0.5px 0 rgba(255,255,255,.12), 0 18px 50px rgba(0,0,0,.45);
  }
}
.panel svg { width: 16px; height: 16px; flex: none; }

.pv { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 2 / 1; background: #0a1430; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.2); }
.pv canvas { width: 100%; height: 100%; display: block; }
.pv-live {
  position: absolute; top: 7px; left: 7px; padding: 2px 7px 2px 17px; border-radius: 99px;
  font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.35);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.pv-live::before { content: ''; position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #30d158; }
.pv-live.off { padding-left: 7px; }
.pv-live.off::before { display: none; }

.p-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 10px 4px 4px; }
.p-title { font-size: 15px; font-weight: 600; }
.p-sub { font-size: 11px; color: var(--label-2); margin-top: 1px; }
.p-time { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

.scrub { position: relative; padding: 6px 4px 18px; }
.ticks { position: relative; height: 0; font-size: 10px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; top: 3px; white-space: nowrap; }
.ticks .tick { transform: translateX(-50%); }
.ticks .tick::before { content: ''; position: absolute; left: 50%; top: -8px; width: 1px; height: 5px; background: var(--label-2); }

/* NSSlider look: thin track tinted with the day, white knob */
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0;
  background: transparent; outline: none; cursor: default; display: block;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, #1e2b55 0%, #2a3a6a 22%, #f6b08a 27%, #9fd3ea 38%, #a9d8ec 66%, #ffc07c 74%, #ff8858 77.5%, #2a3a6a 84%, #1e2b55 100%);
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.15);
}
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, #1e2b55 0%, #2a3a6a 22%, #f6b08a 27%, #9fd3ea 38%, #a9d8ec 66%, #ffc07c 74%, #ff8858 77.5%, #2a3a6a 84%, #1e2b55 100%); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 0.5px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.3);
}
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 0.5px rgba(0,0,0,.25), 0 1px 3px rgba(0,0,0,.3); }

/* NSSegmentedControl */
.seg { display: flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--fill); margin: 0 0 10px; }
.seg button {
  flex: 1; height: 26px; border: 0; border-radius: 6px; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 500; color: var(--label-2); background: transparent; cursor: default;
}
.seg button[aria-checked=true] { color: var(--label); background: var(--seg-on); box-shadow: 0 0.5px 1.5px rgba(0,0,0,.18), 0 0 0 0.5px rgba(0,0,0,.05); }

/* Grouped rows, like a Form section */
.group { border-radius: 9px; background: var(--fill); }
.row { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px; color: var(--label); }
.row + .row { box-shadow: inset 0 0.5px 0 var(--sep); }
.row svg { color: var(--label-2); }
.row span { flex: 1; }
.mac-only { opacity: 0.45; }

/* NSSwitch */
.row input {
  -webkit-appearance: none; appearance: none; position: relative; margin: 0; flex: none;
  width: 32px; height: 18px; border-radius: 9px; background: var(--fill-2);
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.1); transition: background .18s; cursor: default;
}
.row input::before {
  content: ''; position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 0.5px 2px rgba(0,0,0,.3); transition: transform .18s;
}
.row input:checked { background: var(--accent); }
.row input:checked::before { transform: translateX(14px); }

.p-foot { display: flex; justify-content: space-between; padding: 10px 6px 2px; font-size: 12px; color: var(--label-2); }
.link { border: 0; padding: 0; background: none; color: var(--label-2); cursor: default; }
.link:hover { color: var(--label); }

.panel :focus-visible, .menubar :focus-visible { outline: 3px solid color-mix(in srgb, var(--accent, #0a84ff) 55%, transparent); outline-offset: 1px; }

/* ---------- Pitch: the postcard, bottom left */
.pitch {
  position: fixed; left: 0; bottom: 0; z-index: 1;
  width: min(680px, 100vw); padding: 0 44px 34px;
  text-shadow: 0 1px 14px rgba(20, 12, 6, 0.35);
}
.pitch::before {
  /* soft scrim so the copy reads over curtain, railing and lamp at any hour */
  content: ''; position: absolute; z-index: -1; left: -10vw; bottom: -10vh; width: 150%; height: 140%;
  background: radial-gradient(ellipse at 18% 88%, rgba(25, 15, 8, 0.6), rgba(25, 15, 8, 0.32) 42%, transparent 70%);
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.mark { width: 28px; height: 28px; filter: drop-shadow(0 1px 4px rgba(0,0,0,.25)); }
.wordmark {
  font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 800;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-size: 24px; line-height: 1; color: #ffd9b0;
}
h1 {
  margin: 0 0 14px;
  font-family: 'Fraunces', Georgia, serif; font-weight: 350; font-style: normal;
  font-variation-settings: 'SOFT' 50, 'WONK' 0, 'opsz' 144;
  font-size: clamp(42px, 5.6vw, 68px); line-height: 0.98; letter-spacing: -0.02em;
  color: #fff6ea;
}
.pitch > p { margin: 0 0 22px; max-width: 27em; font-size: 15px; line-height: 1.45; color: rgba(255, 246, 234, 0.88); }

.cta { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.buy, .ghost {
  display: inline-flex; align-items: center; height: 44px; padding: 0 22px; border-radius: 99px;
  font: 500 15px var(--sys); text-decoration: none; cursor: pointer; text-shadow: none;
}
.buy { color: #2a1d15; background: #fff6ea; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.buy:hover { background: #fff; }
.ghost { color: #fff6ea; background: rgba(255,255,255,.08); border: 1px solid rgba(255, 246, 234, 0.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.ghost:hover { background: rgba(255,255,255,.16); }
.buy:focus-visible, .ghost:focus-visible { outline: 3px solid rgba(255, 217, 176, .7); outline-offset: 2px; }

/* postmark: the launch price, stamped on the postcard */
.stamp {
  flex: none; margin-left: 8px;
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  font: 700 9px/1.1 var(--sys); letter-spacing: .08em; text-transform: uppercase;
  color: #ffd9b0; border: 1.5px dashed rgba(255, 217, 176, .85);
  box-shadow: 0 0 0 4px rgba(255, 217, 176, 0.12);
  transform: rotate(-14deg); text-shadow: none;
}
.stamp s { font-size: 11px; letter-spacing: 0; opacity: .75; margin-top: 2px; }

.fine { margin: 14px 0 0; font-size: 12px; color: rgba(255, 246, 234, 0.62); }
kbd { font: 600 11px var(--sys); padding: 1px 5px; border-radius: 4px; border: 1px solid rgba(255, 246, 234, .35); }

/* ---------- Small screens: no fake desktop, just the view and the pitch */
@media (max-width: 760px) {
  .menubar, .panel { display: none; }
  .pitch { padding: 0 22px 26px; }
  .pitch::before { left: -22px; right: -22px; width: auto; bottom: 0; height: 125%; background: linear-gradient(to top, rgba(25, 15, 8, 0.78), rgba(25, 15, 8, 0.45) 55%, transparent); }
  .stamp, .keys { display: none; }
  .buy, .ghost { height: 42px; padding: 0 18px; font-size: 14px; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .pitch > p { display: none; }
}

/* photoreal room: a still of it shows while the layers load */
canvas#scene.photo { background: #000 url(rooms/room01/poster.jpg) center / cover no-repeat; }
