:root {
  color-scheme: dark;
  --ink: #190f1d;
  --frame: #382635;
  --cream: #f1ddd8;
  --muted: #c5a9b9;
  --accent: #ffd39b;
  --wallpaper-light: #7778bc;
  --wallpaper-mid: #454a88;
  --wallpaper-dark: #242950;
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
}

:root[data-wallpaper="mint"] {
  --wallpaper-light: #63a9a1;
  --wallpaper-mid: #326d78;
  --wallpaper-dark: #153d4b;
}

:root[data-wallpaper="lilac"] {
  --wallpaper-light: #ad85c0;
  --wallpaper-mid: #785893;
  --wallpaper-dark: #4b2d60;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 48% 22%, #2d172a, var(--ink) 73%);
  color: var(--cream);
  font-family: system-ui, sans-serif;
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.room {
  width: min(92%, 88rem, max(48rem, calc((100svh - 5.5rem) * 1.599)));
  margin-inline: auto;
  padding-block: 1.3rem 1.1rem;
}

.masthead { margin-bottom: 1rem; }

.wordmark {
  font: 600 clamp(.83rem, 1.4vw, 1rem)/1.2 var(--mono);
  letter-spacing: -.055em;
}

.wordmark span { color: var(--muted); }

.stage {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  aspect-ratio: 1586 / 992;
  background: #2b1124;
  border-radius: .55rem;
  outline: 1px solid #684257;
  box-shadow: 0 1.8rem 4rem #100811a8;
}

.desk-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transition: filter 380ms ease;
}

.stage picture { border-radius: inherit; }

.lamp-off .desk-art { filter: brightness(.53) saturate(.82); }

.stage::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: radial-gradient(ellipse at 93% 57%, #1a0417a8, transparent 28%);
  mix-blend-mode: multiply;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.6s ease;
  content: "";
}

.lava-off .stage::before { opacity: 1; }

.stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 93% 57%, var(--lava-spill, #f9482d2b), transparent 23%),
    radial-gradient(ellipse at 35% 46%, #b45cd927, transparent 24%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 380ms ease;
  content: "";
}

.lamp-off .stage::after { opacity: 1; }
.lava-off .stage { --lava-spill: transparent; }

.screen, .palette-preview {
  background:
    radial-gradient(ellipse 103% 115% at 99% 115%, var(--wallpaper-dark) 44%, transparent 44.8%),
    radial-gradient(ellipse 115% 120% at 87% 110%, var(--wallpaper-mid) 61%, transparent 61.8%),
    linear-gradient(145deg, var(--wallpaper-mid), var(--wallpaper-light) 54%, var(--wallpaper-mid));
}

.screen {
  position: absolute;
  z-index: 2;
  inset: 32.3% 54.4% 40.5% 24.2%;
  overflow: hidden;
  border-radius: 4% / 6%;
  box-shadow: inset 0 0 1.15cqw #1b132791;
}

.screen::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(133deg, #fff1e829, transparent 37%),
    repeating-linear-gradient(0deg, #0e0c201c 0 1px, transparent 1px 3px);
  content: "";
}

.desktop-bar {
  display: flex;
  align-items: center;
  gap: .52cqw;
  height: 2.05cqw;
  padding-inline: 1.1cqw;
  border-bottom: 1px solid #4b3b64;
  background: linear-gradient(#eee8ff, #b6acce);
  color: #271b39;
  font-family: Geneva, Verdana, sans-serif;
}

.desktop-mark { font-size: 1.25cqw; }
.desktop-bar h1 { margin: 0; font-size: 1.08cqw; line-height: 1; }

.desktop-folder {
  position: absolute;
  top: 24%;
  right: 9%;
  display: grid;
  justify-items: center;
  gap: .3cqw;
  min-width: 4.8cqw;
  padding: .35cqw .3cqw;
  border: 0;
  background: transparent;
  color: #fff5ff;
  font: 700 max(.46rem, 1.06cqw)/1.15 Geneva, Verdana, sans-serif;
  text-shadow: 1px 1px #1b153a;
}

.desktop-folder:is(:hover, :focus-visible) .folder-icon { filter: brightness(1.14); }

.desktop-folder:focus-visible {
  outline: 0;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.folder-icon {
  position: relative;
  display: block;
  width: 3.3cqw;
  height: 2.35cqw;
  margin-top: .48cqw;
  border: 1px solid #5b3c2a;
  border-radius: .22cqw;
  background: linear-gradient(#ffe6a7, #dda55f);
  box-shadow: inset 0 1px #fff4cb, 1px 1px #21183985;
}

.folder-icon::before {
  position: absolute;
  bottom: 100%;
  left: -.02cqw;
  width: 47%;
  height: .48cqw;
  border: 1px solid #5b3c2a;
  border-bottom: 0;
  border-radius: .24cqw .28cqw 0 0;
  background: #e1b473;
  content: "";
}

.lava-glass {
  position: absolute;
  z-index: 2;
  inset: 39.9% 2.6% 39.8% 89.65%;
  overflow: hidden;
  clip-path: polygon(25% 0, 76% 0, 99% 77%, 99% 86%, 92% 99%, 8% 99%, 1% 86%, 1% 78%);
  pointer-events: none;
}

.lava-glass::after {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 100%, #472014, #390710 65%, #290617);
  opacity: 0;
  transition: opacity 1.6s ease;
  content: "";
}

.lava-off .lava-glass::after { opacity: .87; }

.lava-wax {
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity 1.6s ease, transform 1.9s ease-in;
}

.lava-off .lava-wax { opacity: 0; transform: translateY(16%); }

.hotspot {
  position: absolute;
  z-index: 3;
  padding: 0;
  border: 0;
  background: transparent;
}

.hotspot:focus-visible { outline: 0; }

.hotspot:focus-visible::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: .66rem;
  height: .66rem;
  transform: translate(-50%, -50%);
  border: 2px solid #fff0cf;
  border-radius: 50%;
  background: #874518;
  box-shadow: 0 0 0 2px #23111e;
  content: "";
}

.hotspot-desk-lamp { inset: 3.1% 69% 75.5% 17.4%; }
.hotspot-board { inset: 11.3% 10.6% 49.2% 56.2%; }
.hotspot-lava { inset: 33.9% 2.5% 24.8% 89.5%; }
.hotspot-notebook { inset: 78% 84.8% 10.5% 0; }

.radio-knob {
  top: 68.65%;
  left: 83.62%;
  z-index: 4;
  display: grid;
  width: max(44px, 3.65cqw);
  aspect-ratio: 1;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.radio-knob::after {
  width: 3.4cqw;
  aspect-ratio: 1;
  transform: rotate(-42deg);
  border-radius: 50%;
  background: linear-gradient(#eab27f, #89492b) center .4cqw / max(1px, .1cqw) .42cqw no-repeat;
  opacity: .9;
  pointer-events: none;
  transition: transform 250ms ease;
  content: "";
}

.radio-knob[aria-pressed="true"]::after { transform: rotate(35deg); }

.radio-dial {
  position: absolute;
  z-index: 2;
  inset: 63.4% 18.2% 32.9% 73.2%;
  border-radius: .19cqw;
  background: #25101a;
  opacity: .74;
  transition: opacity 280ms ease, box-shadow 280ms ease;
  pointer-events: none;
}

.stage:is([data-radio-state="tuning"], [data-radio-state="playing"]) .radio-dial {
  opacity: 1;
  background: transparent;
  box-shadow: 0 0 .65cqw #ff9b4666;
}

.print-controls button, .swatches button {
  min-height: 2.5rem;
  padding: .35rem .75rem;
  border: 1px solid #654858;
  border-radius: .3rem;
  background: #271927;
  font: .815rem/1.15 var(--mono);
}

.print-controls button:hover, .swatches button:hover {
  border-color: #be8f92;
  background: #3d2637;
}

.radio-fallback { color: var(--muted); font-size: .875rem; text-align: right; }
.radio-fallback a { color: var(--accent); }

.desktop-window {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid #b78d9f;
  border-radius: .54rem;
  background: #241925;
  color: var(--cream);
  box-shadow: 0 1.5rem 6rem #0b050cc9;
}

.desktop-window::backdrop {
  background: #130911ad;
  backdrop-filter: blur(4px);
}

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.15rem;
  padding: .3rem .4rem .3rem .9rem;
  border-bottom: 1px solid #80576d;
  background: linear-gradient(#513648, #3b293d);
  font: .875rem/1.3 var(--mono);
}

.window-close {
  width: 2.45rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid #9a7385;
  border-radius: .25rem;
  background: #322234;
  font-size: 1.45rem;
  line-height: 1;
}

.window-close:hover { background: #654052; }
.window-close:focus-visible { outline-offset: 1px; }

.window-content { padding: clamp(1.1rem, 4vw, 1.85rem); }

.window-content h2 {
  margin: 0;
  color: var(--accent);
  font: 700 clamp(1.6rem, 5vw, 2rem)/1.16 var(--mono);
  letter-spacing: -.075em;
}

.window-content h3 { margin: 0 0 .35rem; font: 650 1rem/1.4 var(--mono); }
.window-content p { margin: .55rem 0 0; color: var(--muted); line-height: 1.5; }

.experiment {
  margin-top: 1.35rem;
  padding-top: 1.2rem;
  border-top: 1px solid #583d51;
}

.swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.swatches [aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.palette-preview {
  margin-top: .8rem;
  padding: .8rem 1rem;
  border-radius: .33rem;
  color: #fff5ff;
  font: 700 1.2rem/1.3 Geneva, Verdana, sans-serif;
  text-shadow: 1px 1px #1b153a;
}

.board-window .window-content { background: #4a2c28; }
.print { margin: 0; padding: .55rem .55rem .75rem; background: #f1d8b5; color: #301d24; }
.print img { display: block; width: 100%; height: auto; background: #392030; }
.print figcaption { padding: .65rem .25rem 0; font: .93rem/1.2 var(--mono); }
.print-controls { display: flex; justify-content: space-between; gap: .65rem; margin-top: 1rem; }
.notebook-window ul { margin: .85rem 0 0; padding-inline-start: 1.25rem; line-height: 1.7; }
.notebook-window li + li { margin-top: .3rem; }
.no-script { color: var(--muted); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 45rem) {
  .room { width: 94%; padding-top: 1rem; }
}

@media (max-width: 34rem) {
  .room { padding-top: clamp(1rem, calc((100svh - 26rem) * .32), 9rem); }
  .masthead { margin-bottom: .8rem; }
  .desktop-bar { height: 2.65cqw; }
  .desktop-bar h1, .desktop-mark { font-size: 1.64cqw; }
  .folder-icon { width: 4.45cqw; height: 3.35cqw; }
  .folder-icon::before { height: .75cqw; }
  .hotspot-lava {
    right: 0;
    left: auto;
    width: max(44px, 10.5cqw);
  }

  .hotspot-lava:focus-visible::before { left: 57%; }
}

@media (prefers-reduced-motion: reduce) {
  .desk-art, .stage::before, .stage::after, .lava-wax, .lava-glass::after,
  .radio-dial, .radio-knob::after { transition: none; }
}
