:root {
  --ink: #f6efe4;
  --ink-2: rgba(246, 239, 228, .76);
  --ink-3: rgba(246, 239, 228, .5);
  --line: rgba(255, 255, 255, .14);
  --glass: rgba(20, 16, 13, .45);
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0b09; color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.veil { position: fixed; inset: 0; background: #0d0b09; pointer-events: none; transition: opacity 2.6s ease; z-index: 20; }
body.ready .veil { opacity: 0; }

/* entry */
.enter { position: fixed; inset: 0; z-index: 15; display: grid; place-content: center; justify-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 60%, rgba(10, 8, 6, .35), rgba(10, 8, 6, .82)); transition: opacity 1.4s ease, visibility 1.4s; }
.enter.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.eyebrow { margin: 0 0 18px; font-size: 12px; letter-spacing: .34em; text-transform: uppercase; color: var(--ink-2); }
.enter h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(48px, 7.5vw, 104px); line-height: .95; letter-spacing: -.01em; }
.enter h1 em { font-style: italic; }
.lede { max-width: 440px; margin: 22px 0 30px; font-size: 17px; line-height: 1.6; color: var(--ink-2); }
.btn { height: 54px; padding: 0 30px; border-radius: 999px; background: #f3e9da; color: #1d1813; font-size: 16px; transition: transform .25s, background .25s; }
.btn:hover { background: #fff; transform: translateY(-1px); }
.small { margin: 16px 0 0; font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }

/* chrome */
header.chrome { position: fixed; top: 0; left: 0; padding: 18px 22px; z-index: 10; transition: opacity 1s; pointer-events: none; }
.brand { font-family: var(--serif); font-size: 24px; color: var(--ink-2); text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
/* solid panels: a backdrop blur over a live WebGL canvas costs a full-screen pass every frame */
:root { --panel: rgba(24, 19, 15, .86); --panel-2: rgba(255, 245, 230, .06); --accent: #e9b46e; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); transition: opacity .8s, transform .8s; max-width: calc(100vw - 24px); }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 16px; background: var(--panel-2); }
.seg button { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: 13px; font-size: 14px; color: var(--ink-3); transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #f1e6d4; color: #20180f; }
.inten { display: grid; gap: 2px; width: 170px; padding: 0 6px; transition: opacity .3s; }
.inten.off { opacity: .35; pointer-events: none; }
.inten .lbl { font-size: 12px; color: var(--ink-2); letter-spacing: .02em; }
.sep { width: 1px; height: 28px; background: var(--line); }
.chip { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: 15px; font-size: 14px; color: var(--ink-2); transition: background .2s, color .2s; white-space: nowrap; }
.chip:hover, .chip[aria-expanded=true] { background: var(--panel-2); color: var(--ink); }
.chip.icon { width: 44px; padding: 0; justify-content: center; }
#soundIcon .x { display: none; }
#soundIcon.muted .x { display: inline; } #soundIcon.muted .w { display: none; }

.pop { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 11; width: min(340px, calc(100vw - 24px)); padding: 16px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 16px 50px rgba(0, 0, 0, .45); }
.pop[hidden] { display: none; }
.ptitle { margin: 0 0 12px; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); }
.pnote { margin: 10px 0 0; font-family: var(--serif); font-size: 22px; color: var(--ink); text-align: center; }
.toggle { display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.toggle i { width: 34px; height: 20px; border-radius: 10px; background: rgba(255, 255, 255, .15); position: relative; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #f1e6d4; transition: transform .2s; }
.toggle.on i { background: var(--accent); } .toggle.on i::after { transform: translateX(14px); }
.toggle.on { color: var(--ink); }
.hourrow .ticks { display: flex; justify-content: space-between; margin-top: 4px; }
.ticks button { font-size: 12px; color: var(--ink-3); padding: 4px 2px; }
.ticks button:hover { color: var(--ink); }
.vrow { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; height: 38px; font-size: 13.5px; color: var(--ink-2); }
.item { display: grid; grid-template-columns: 24px 1fr; column-gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 12px; font-size: 14.5px; color: var(--ink); }
.item small { grid-column: 2; font-size: 12px; color: var(--ink-3); }
.item svg { grid-row: span 2; }
.item:hover { background: var(--panel-2); }
.todo { list-style: none; margin: 6px 0 0; padding: 0 10px; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.todo b { font-weight: 500; color: var(--ink); }

/* sliders: a thick, easy track with a filled part */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #f3e9da; margin-top: -7px; box-shadow: 0 1px 6px rgba(0, 0, 0, .4); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .2); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #f3e9da; }

/* tape panel */
.tape-panel { position: fixed; z-index: 9; width: 300px; transform: translate(-50%, -100%) translateY(6px); padding: 14px 14px 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.tape-panel.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -100%); }
.tp-head { display: flex; align-items: center; gap: 12px; }
.tp-reel { width: 38px; height: 38px; border-radius: 50%; background: #2b2420; border: 1px solid var(--line); display: grid; place-items: center; }
.tp-reel i { width: 16px; height: 16px; border-radius: 50%; border: 3px dashed #d9cdb8; }
.tape-panel.playing .tp-reel i { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tp-meta { flex: 1; min-width: 0; }
.tp-title { margin: 0; font-family: var(--serif); font-size: 21px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-side { margin: 1px 0 0; font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }
.tp-time { margin: 0; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tp-prog { height: 3px; margin: 12px 0 8px; border-radius: 2px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.tp-prog i { display: block; height: 100%; width: 0; background: var(--accent); }
.tp-row { display: flex; align-items: center; gap: 4px; }
.tp-row button { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.tp-row button svg { fill: currentColor; stroke: none; }
.tp-row button:hover { background: var(--panel-2); color: var(--ink); }
.tp-row .tp-play { width: 48px; height: 48px; border-radius: 50%; background: #f1e6d4; color: #20180f; }
.tp-row .tp-play:hover { background: #fff; color: #20180f; }
.tp-play .s { display: none; } .tape-panel.playing .tp-play .s { display: block; } .tape-panel.playing .tp-play .p { display: none; }
.tp-vol { flex: 1; display: flex; align-items: center; gap: 6px; margin-left: 6px; color: var(--ink-3); }

.caption, .toast { position: fixed; left: 50%; transform: translateX(-50%); margin: 0; z-index: 9; pointer-events: none; text-align: center; transition: opacity .5s ease; opacity: 0; padding: 0 16px; width: max-content; max-width: 100vw; }
.caption { bottom: 92px; font-size: 13.5px; letter-spacing: .02em; color: var(--ink); background: rgba(20, 16, 13, .78); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; }
.caption:empty { display: none; }
.toast { bottom: 140px; font-family: var(--serif); font-size: 24px; color: var(--ink); background: rgba(20, 16, 13, .7); padding: 6px 18px 8px; border-radius: 999px; }
.caption.show, .toast.show { opacity: 1; }

body.idle .chrome, body.bare .chrome, body.breathing .chrome, body.breathing .caption, body.bare .pop, body.idle .pop { opacity: 0; pointer-events: none; }
body.idle .bar, body.bare .bar { transform: translateX(-50%) translateY(12px); }
body.idle { cursor: none; }
body.bare .caption { opacity: 0; }

/* breathing */
.breath { position: fixed; inset: 0; display: grid; align-content: start; justify-content: center; justify-items: center; padding-top: max(70px, 12vh); z-index: 12; pointer-events: none; }
.breath[hidden] { display: none; }
.ring, .core { width: 190px; height: 190px; }
.ring { display: grid; place-items: center; }
.core { border-radius: 50%; border: 1px solid rgba(255, 255, 255, .55); background: radial-gradient(circle, rgba(255, 240, 220, .1), rgba(255, 240, 220, .02) 70%); transform: scale(.42); transition: transform 4s cubic-bezier(.45, 0, .35, 1); }
.breath-word { margin: 30px 0 6px; font-family: var(--serif); font-size: 42px; text-shadow: 0 2px 30px rgba(0, 0, 0, .55); }
.breath-sub { margin: 0; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.link { pointer-events: auto; margin-top: 36px; font-size: 14px; color: var(--ink-3); }
.link:hover { color: var(--ink); }
.nojs { position: fixed; inset: 0; display: grid; place-content: center; }

.mobile-only { display: none; }
@media (max-width: 720px) {
  .mobile-only { display: flex; }
  .bar { bottom: calc(10px + env(safe-area-inset-bottom)); gap: 2px; padding: 5px; }
  .chip span { display: none; } .chip { width: 50px; height: 46px; padding: 0; justify-content: center; }
  .sep { display: none; }
  #wxSlot .seg { width: 100%; margin-bottom: 14px; }
  #wxSlot .seg button { flex: 1; justify-content: center; height: 46px; }
  #wxSlot .inten { width: 100%; padding: 0 4px; }
  .caption { display: none; }
  .toast { bottom: auto; top: calc(62px + env(safe-area-inset-top)); font-size: 19px; }
  header.chrome { padding-top: calc(14px + env(safe-area-inset-top)); }
  .tape-panel { width: min(340px, calc(100vw - 24px)); }
}
@media (max-width: 640px) {
  .chrome { padding: 12px 14px; }
  .brand { font-size: 20px; }
}

/* sleep timer: the room slowly goes dark */
.sleepdim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 8; transition: opacity 2s linear; }
.sleepchips { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 10px 8px 44px; }
.sleepchips button { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--panel-2); font-size: 13px; color: var(--ink-2); }
.sleepchips button.on { background: #f1e6d4; color: #20180f; }
.sleepnote { margin: 0; padding: 0 10px 6px 44px; font-size: 12px; color: var(--ink-3); }

/* loading */
.loading { width: min(260px, 70vw); margin: 0 0 22px; }
.lbar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.lbar i { display: block; height: 100%; background: #e9b46e; transform-origin: left; transform: scaleX(.04); transition: transform .4s ease; }
.loading p { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em; }
.enter.loaded .loading { opacity: 0; height: 0; margin: 0; overflow: hidden; transition: opacity .5s; }
.btn[disabled] { opacity: .35; cursor: default; transform: none; }
.enter:not(.loaded) .btn { display: none; }
/* the veil hides the canvas until the room is there, but the entry text shows from the start */
.veil { z-index: 14; }
body.ready .veil { opacity: 0; }

header.chrome { display: flex; align-items: baseline; gap: 10px; }
.byline { pointer-events: auto; font-size: 12.5px; color: var(--ink-3); text-decoration: none; text-shadow: 0 1px 10px rgba(0, 0, 0, .6); transition: color .2s; }
.byline:hover { color: var(--ink); }
