/* Rain Sounds: the look of the app.
   A warm room on a rainy evening. Every colour, size, space and curve comes from
   the tokens below, so the whole app changes from here. */

/* ---------- tokens: night (the default) ---------- */

:root {
  color-scheme: dark;

  /* colours (text pairs checked for WCAG AA) */
  --bg: #1c1814;
  --bg-top: #241d17;        /* Smooth dusk: a calm gradient from top to bottom */
  --bg-bottom: #15110e;
  --paper: #26201b;         /* cards */
  --paper-2: #2f2821;       /* raised: sheets, the player */
  --sunken: #191511;        /* insets: icon tiles, number boxes */
  --line: #3b3229;          /* hairlines */
  --line-strong: #8a7660;   /* lines that must stand out (3:1) */
  --text: #f2e8d9;
  --muted: #c2b19b;
  --accent: #e9b96e;        /* honey */
  --on-accent: #2a1c0b;
  --accent-soft: #4a3720;
  --on-accent-soft: #fbe8c8;
  --rain: #9db6c8;
  --beat: #d6a08c;
  --track: #4a3f34;
  --thumb: #f6ecdc;
  --danger: #f0a898;
  --backdrop: rgba(14, 11, 8, 0.62);
  --glow: rgba(233, 185, 110, 0.07);   /* the warm wash on the hero card */

  /* type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Charter, "Bitstream Charter", Georgia, serif;
  --sans: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", "Segoe UI", system-ui, sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.55rem;
  --text-hero: clamp(1.9rem, 6.4vw, 2.6rem);

  /* space: one scale for every gap */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 48px;

  /* shape */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --target: 44px;           /* smallest touch target */
  --page: 1120px;           /* widest the page gets */
  --player-space: 150px;    /* room left at the bottom for the player */

  /* depth instead of borders */
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.24);
  --shadow-raised: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 16px 40px rgba(0, 0, 0, 0.36);

  /* motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --quick: 160ms var(--ease);
  --calm: 280ms var(--ease);
}

/* ---------- tokens: day ---------- */

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f2eadd;
    --bg-top: #f7f0e5;
    --bg-bottom: #eadfcd;
    --paper: #fbf6ee;
    --paper-2: #fffaf3;
    --sunken: #efe5d6;
    --line: #e2d5c2;
    --line-strong: #8b7660;
    --text: #2d241b;
    --muted: #66574a;
    --accent: #944a29;
    --on-accent: #fff8ef;
    --accent-soft: #f0dcc6;
    --on-accent-soft: #55250f;
    --rain: #4a6679;
    --beat: #8d4c3a;
    --track: #dccdb8;
    --thumb: #fffdf9;
    --danger: #a3361f;
    --backdrop: rgba(60, 44, 30, 0.32);
    --glow: rgba(214, 160, 90, 0.10);
    --shadow: 0 1px 2px rgba(80, 56, 30, 0.06), 0 8px 24px rgba(80, 56, 30, 0.08);
    --shadow-raised: 0 2px 6px rgba(80, 56, 30, 0.08), 0 18px 44px rgba(80, 56, 30, 0.16);
  }
}

/* one quiet colour per sound category */
:root { --cat-rain: #9db6c8; --cat-weather: #b4b9b0; --cat-nature: #a9b98f; --cat-water: #93bdbb; --cat-tones: #d6a08c; --cat-noise: #cdb48c; --cat-music-bed: #c3a3b4; --cat-space: #c2b19b; }
@media (prefers-color-scheme: light) {
  :root { --cat-rain: #4a6679; --cat-weather: #5c625a; --cat-nature: #56673f; --cat-water: #3d6966; --cat-tones: #8d4c3a; --cat-noise: #75603b; --cat-music-bed: #7a4f66; --cat-space: #66574a; }
}
.cat-rain { --cat: var(--cat-rain); } .cat-weather { --cat: var(--cat-weather); } .cat-nature { --cat: var(--cat-nature); }
.cat-water { --cat: var(--cat-water); } .cat-tones { --cat: var(--cat-tones); } .cat-noise { --cat: var(--cat-noise); }
.cat-music-bed { --cat: var(--cat-music-bed); } .cat-space { --cat: var(--cat-space); }

/* ---------- base ---------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg-bottom); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text);
  background: transparent; /* the gradient layer below shows through */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* Smooth dusk: one calm warm gradient behind everything, on its own fixed layer
   (scrolling never repaints it). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 55%, var(--bg-bottom) 100%);
  pointer-events: none;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; letter-spacing: 0.005em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
strong { font-weight: 600; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[data-icon] { display: inline-flex; }

.note { font-size: var(--text-sm); color: var(--muted); }
.note:empty { display: none; }
.warning { color: var(--danger); }
.row { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); min-height: 32px; }
.value, output { color: var(--muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- buttons: one family ---------- */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--target);
  padding: 0 var(--s4);
  background: var(--paper-2);
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--quick), color var(--quick), box-shadow var(--quick), transform var(--quick), opacity var(--quick);
}
button:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--line-strong) inset; }
button:active:not(:disabled) { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: default; }
button[aria-pressed="true"] { background: var(--accent-soft); color: var(--on-accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
button .icon { width: 18px; height: 18px; }
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled) { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
button.primary-soft { background: var(--accent-soft); color: var(--on-accent-soft); font-weight: 600; }
button.ghost { background: transparent; box-shadow: 0 0 0 1px var(--line) inset; }
button.ghost:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--line-strong) inset; }
button.quiet, button.link-button { background: transparent; color: var(--accent); }
button.link-button { min-height: 36px; padding: 0 var(--s1); font-size: var(--text-sm); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
button.link-button:hover:not(:disabled), button.quiet:hover:not(:disabled) { box-shadow: none; }
button.small { min-height: 38px; padding: 0 var(--s3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
button.icon-button { width: var(--target); padding: 0; border-radius: 50%; background: transparent; color: var(--muted); }
button.icon-button:hover:not(:disabled) { background: var(--paper-2); box-shadow: none; }
button.icon-button .icon { width: 20px; height: 20px; }
.danger-text { color: var(--danger) !important; }
.link { display: inline-flex; align-items: center; gap: 6px; min-height: var(--target); font-size: var(--text-sm); }

/* ---------- page frame ---------- */

.top, .layout { width: 100%; max-width: var(--page); margin: 0 auto; padding: 0 var(--s4); }
.top { display: flex; align-items: center; padding-top: max(var(--s3), env(safe-area-inset-top)); }
.brand { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--target); color: var(--text); text-decoration: none; }
.brand-lamp { color: var(--accent); }
.brand-name { font-family: var(--serif); font-size: var(--text-lg); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s7);
  padding-top: var(--s2);
  padding-bottom: calc(var(--player-space) + env(safe-area-inset-bottom));
}
.side { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s7); align-content: start; min-width: 0; }
@media (min-width: 600px) { .top, .layout { padding-left: var(--s6); padding-right: var(--s6); } }
@media (min-width: 640px) and (max-width: 1023px) { .top, .layout { max-width: 720px; } }
/* wide screens: what plays on the left (it stays in view), everything else on the right */
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); column-gap: var(--s7); align-items: start; }
  .now-card { position: sticky; top: var(--s4); }
  .layout > footer { grid-column: 1 / -1; }
}

footer { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s1) var(--s4); color: var(--muted); font-size: var(--text-xs); }

/* ---------- the hero: what plays now ---------- */

.now-card {
  min-width: 0;
  padding: var(--s5) var(--s4) var(--s4);
  background: linear-gradient(160deg, var(--glow), transparent 55%), var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
@media (min-width: 600px) { .now-card { padding: var(--s6) var(--s6) var(--s5); } }
.eyebrow { color: var(--muted); font-size: var(--text-sm); }
.now-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s3); margin-top: 2px; }
.now-head h1 { font-size: var(--text-hero); line-height: 1.1; min-width: 0; overflow-wrap: anywhere; }
.pill { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--on-accent-soft); font-size: var(--text-xs); }
.revert { margin-left: auto; }
.now-summary { margin-top: var(--s1); color: var(--muted); font-size: var(--text-sm); }

.mix-list { display: grid; margin-top: var(--s4); }
.mix-list:empty { display: none; }
.mix-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "icon name switch" "icon slider switch";
  column-gap: var(--s3);
  align-items: center;
  padding: var(--s2) 0 2px;
  transition: opacity var(--calm), transform var(--calm);
}
@starting-style { .mix-row { opacity: 0; transform: translateY(6px); } }
.mix-row + .mix-row { border-top: 1px solid var(--line); }
.mix-row-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--sunken);
  color: var(--cat, var(--accent));
  align-self: start;
  margin-top: 2px;
}
.mix-row-name {
  grid-area: name;
  justify-content: flex-start;
  gap: var(--s2);
  min-width: 0;
  min-height: 36px;
  padding: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  text-align: left;
}
.mix-row-name:hover:not(:disabled) { box-shadow: none; }
.mix-row-name:hover .mix-row-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.mix-row-title { font-family: var(--serif); font-size: var(--text-md); white-space: nowrap; }
.mix-row-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-xs); }
.mix-row-chevron { width: 16px !important; height: 16px !important; margin-left: auto; color: var(--muted); }
.mix-row input[type="range"] { grid-area: slider; height: 36px; }
.mix-row.is-off .mix-row-title, .mix-row.is-off input, .mix-row.is-off .mix-row-icon { opacity: 0.45; }

.empty-state { display: grid; justify-items: center; gap: var(--s1); padding: var(--s7) var(--s4) var(--s5); text-align: center; }
.empty-art { color: var(--muted); margin-bottom: var(--s2); }
.empty-art .icon { width: 44px; height: 44px; stroke-width: 1.3; }
.empty-title { font-family: var(--serif); font-size: var(--text-lg); }

.now-actions { display: flex; gap: var(--s2); margin-top: var(--s4); }
.now-actions #add-sound { flex: 1 1 auto; min-width: 0; }
.now-actions #room-open { flex: none; }

/* ---------- the side: blocks ---------- */

.block { min-width: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); min-height: var(--target); }
.scroll-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--s4)); padding: 2px var(--s4) var(--s1); }
.scroll-chips::-webkit-scrollbar { display: none; }
.scroll-chips button { flex: none; }
@media (min-width: 600px) { .scroll-chips { margin: 0; padding: 2px 0 var(--s1); flex-wrap: wrap; } }

/* ready-made mixes: a row you can swipe on a phone, a grid on wider screens */
.mix-cards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 72%;
  gap: var(--s3);
  margin: var(--s3) calc(-1 * var(--s4)) 0;
  padding: var(--s1) var(--s4) var(--s3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--s4);
  scrollbar-width: none;
}
.mix-cards::-webkit-scrollbar { display: none; }
@media (min-width: 600px) {
  .mix-cards { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-columns: auto; margin: var(--s3) 0 0; padding: 0; overflow: visible; }
}
.preset-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  justify-items: start;
  gap: var(--s1);
  min-height: 124px;
  padding: var(--s4);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: left;
  scroll-snap-align: start;
}
.preset-card:hover:not(:disabled) { box-shadow: var(--shadow), 0 0 0 1px var(--line-strong) inset; }
.preset-card[aria-pressed="true"] { background: linear-gradient(160deg, var(--glow), transparent 70%), var(--paper); color: var(--text); box-shadow: var(--shadow), 0 0 0 1.5px var(--accent) inset; }
.card-name { font-family: var(--serif); font-size: var(--text-lg); line-height: 1.2; }
.card-blurb { color: var(--muted); font-size: var(--text-sm); line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; align-self: end; padding-top: var(--s2); min-width: 0; }
.mix-dots { display: flex; gap: 6px; }
.mix-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sunken); color: var(--cat); }
.mix-dot .icon { width: 15px; height: 15px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.card-minutes, .card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-size: var(--text-xs);
}
.card-badge .icon { width: 13px; height: 13px; }
.card-badge.speakers { display: none; } /* the name already says it */
.card-adjusted { display: none; font-size: var(--text-xs); color: var(--accent); }
.preset-card.is-adjusted .card-adjusted { display: inline; }
.show-all { margin-top: var(--s2); }

/* chips: soft pills */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chips button { min-height: 38px; padding: 0 var(--s4); border-radius: 999px; background: var(--paper); font-size: var(--text-sm); box-shadow: var(--shadow); }
.chips button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.control > .chips { margin-top: var(--s1); }
.sheet .chips button, .panel .chips button { background: var(--paper); box-shadow: 0 0 0 1px var(--line) inset; }
.sheet .chips button[aria-pressed="true"], .panel .chips button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }

/* saved mixes: a list in a card */
.mine-empty { padding: var(--s1) 0 var(--s2); }
#mine-list { list-style: none; margin: 0; padding: var(--s1); display: grid; gap: 2px; background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
#mine-list:empty { display: none; }
.preset { display: flex; align-items: center; min-width: 0; border-radius: var(--radius-md); }
.preset button { background: transparent; }
.preset .preset-use {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: var(--s3);
  justify-content: stretch;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-md);
  text-align: left;
}
.preset-use .icon { grid-row: span 2; color: var(--accent); }
.preset-title, .preset-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-title { font-family: var(--serif); }
.preset-summary { font-size: var(--text-xs); color: var(--muted); }
.preset .preset-use:hover:not(:disabled) { background: var(--paper-2); box-shadow: none; }
.preset.active { background: var(--accent-soft); }
.preset.active .preset-use, .preset.active .preset-summary, .preset.active .icon { color: var(--on-accent-soft); }
.preset .preset-use[aria-pressed="true"] { background: transparent; box-shadow: none; }
.preset .preset-icon { flex: none; width: var(--target); padding: 0; color: var(--muted); border-radius: 50%; }
.preset .preset-icon:hover:not(:disabled) { box-shadow: none; background: var(--paper-2); }
.preset .preset-pin[aria-pressed="true"] { color: var(--accent); background: transparent; box-shadow: none; }
.preset .preset-pin[aria-pressed="true"] .icon { fill: currentColor; }
.preset .preset-edit .icon { fill: currentColor; stroke: none; }
.backup { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s2); }

/* sleep timer and saving: two tiles */
.tiles-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.tiles-row > :only-child { grid-column: 1 / -1; }
.tile-button {
  justify-content: flex-start;
  gap: var(--s3);
  min-height: 72px;
  padding: var(--s3) var(--s4);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-align: left;
}
.tile-button:hover:not(:disabled) { box-shadow: var(--shadow), 0 0 0 1px var(--line-strong) inset; }
.tile-icon { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--sunken); color: var(--accent); }
.tile-text { display: grid; min-width: 0; }
.tile-title { font-family: var(--serif); font-size: var(--text-md); }
.tile-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-xs); }

/* ---------- one control ---------- */

.control { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.control > .row .icon { color: var(--tint, var(--accent)); }
.control.sub { padding-left: 32px; }
.control.sub > .row { font-size: var(--text-sm); color: var(--muted); min-height: 26px; }
.control.idle input, .control.idle .chips { opacity: 0.5; }
.idle-note { font-size: var(--text-xs); }
.ends { font-size: var(--text-xs); color: var(--muted); min-height: 0; margin-top: -2px; }

/* the name hidden from the eye, kept for screen readers */
.control.bare > .row {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* a name that opens its tooltip */
.tip-name {
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.tip-name:hover, .tip-name.tip-open { text-decoration-style: solid; text-decoration-color: var(--accent); }
button.tip-name { min-height: 0; padding: 0; border: 0; background: transparent; text-align: left; line-height: 1.3; }


/* ---------- choices and sliders ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tiles button {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 2px;
  min-height: 96px;
  padding: var(--s3);
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--line) inset;
  text-align: left;
}
.tiles .icon { width: 26px; height: 26px; margin-bottom: var(--s1); color: var(--tint, var(--accent)); }
.tiles button[aria-pressed="true"] .icon { color: inherit; }
.choice-name { font-weight: 600; font-size: var(--text-sm); }
.choice-note { font-size: var(--text-xs); color: var(--muted); line-height: 1.3; }
button[aria-pressed="true"] .choice-note { color: inherit; }

input[type="range"] {
  --fill: 50%;
  width: 100%;
  height: var(--target);
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--track) var(--fill));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--thumb);
  border: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  transition: transform var(--quick);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--thumb); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
input:disabled { cursor: default; }

/* the on/off switch */
.mix-switch {
  grid-area: switch;
  position: relative;
  width: 52px;
  min-width: 52px;
  height: var(--target);
  padding: 0;
  background: transparent;
}
.mix-switch:hover:not(:disabled) { box-shadow: none; }
.mix-switch:active:not(:disabled) { transform: none; }
.mix-switch::before { content: ""; position: absolute; left: 2px; right: 2px; top: 8px; height: 28px; border-radius: 999px; background: var(--track); transition: background var(--calm); }
.mix-switch::after {
  content: "";
  position: absolute;
  top: 11px;
  left: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform var(--calm);
}
.mix-switch[aria-checked="true"]::before { background: var(--accent); }
.mix-switch[aria-checked="true"]::after { transform: translateX(20px); }

/* panels of controls inside sheets */
.panel { padding: var(--s1) var(--s4); background: var(--paper); border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--line) inset; }
.panel:empty { display: none; }
.rows > .control { padding: var(--s3) 0; }
.rows > .control + .control { border-top: 1px solid var(--line); }
.more { margin-top: var(--s3); }
.more > summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--accent);
  font-size: var(--text-sm);
  cursor: pointer;
  list-style: none;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: ""; width: 7px; height: 7px; margin-left: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--quick); }
.more[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.more > .panel { margin-top: var(--s1); }

/* ---------- binaural: starting points ---------- */

.tiles.feel button { min-height: 96px; }
.drawer { margin-top: 12px; }
.drawer {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.drawer > summary { cursor: pointer; list-style: none; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  padding: 12px 16px;
  min-height: var(--target);
}
.drawer > summary::after { content: "+"; grid-column: 2; grid-row: 1 / 3; font-size: 1.3rem; color: var(--muted); }
.drawer[open] > summary::after { content: "−"; }
.drawer-title { grid-column: 1; font-family: var(--serif); font-size: var(--text-md); }
.drawer-note { grid-column: 1; color: var(--muted); font-size: var(--text-xs); }
.drawer > :not(summary) { margin: 0 16px; }
.drawer > .note { margin-bottom: 8px; }
.starter-group { padding: 10px 0 12px; border-top: 1px solid var(--line); }
.starter-group h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: var(--text-md); margin-bottom: 8px; }
.starter-range { font-family: var(--sans); font-size: var(--text-xs); color: var(--muted); }
.starter-list { display: grid; gap: 6px; }
.starter-list button { text-align: left; padding: 8px 14px; line-height: 1.35; font-size: var(--text-sm); }

/* ---------- binaural: layers ---------- */

.layers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.layer {
  min-width: 0;
  background: var(--paper);
  border-left: 3px solid var(--beat);
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 1px var(--line) inset;
}
.layer.is-off { border-left-color: var(--line-strong); }
.layer.is-off .layer-body > :not(.layer-remove) { opacity: 0.55; }
.layer-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; }
.layer-summary {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  text-align: left;
}
.layer-name { font-family: var(--serif); font-size: var(--text-md); white-space: nowrap; }
.layer-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.layer.is-open .layer-text { white-space: normal; }
.layer-on { min-width: 58px; font-size: var(--text-sm); }
.layer-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 4px 14px 12px; border-top: 1px solid var(--line); }

.layer-choice { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 8px; }
.layer-choice .tip-name, .layer-row .tip-name { font-size: var(--text-sm); justify-self: start; }
.layer-choice .chips button { min-height: 40px; padding: 0 13px; }
.layer-type-note { font-size: var(--text-xs); }
.limit-note { font-size: var(--text-xs); color: var(--accent); }
.layer-swap { justify-self: start; border-radius: 999px; font-size: var(--text-sm); }

.layer-row { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) 4.9rem 1.5rem; align-items: center; gap: 8px; }
.layer-row output { grid-column: span 2; }
.layer-row .unit, .step-field .unit { font-size: var(--text-xs); color: var(--muted); }
.layer-row input[type="number"], .step-field input, .program-step select {
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  background: var(--sunken);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.layer-row input[type="number"], .step-field input { text-align: right; -moz-appearance: textfield; }
.layer-row input[type="number"]::-webkit-inner-spin-button, .step-field input::-webkit-inner-spin-button { display: none; }
.pulse-rows { display: grid; gap: 4px; }

/* ---------- binaural: programs ---------- */

.layer-program {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  background: transparent;
  box-shadow: 0 0 0 1px var(--line) inset;
}
.layer-program::after { content: "▾"; color: var(--muted); }
.layer-program[aria-expanded="true"]::after { content: "▴"; }
.program-name { font-family: var(--serif); }
.program-words { margin-left: auto; color: var(--muted); font-size: var(--text-sm); }
.program-panel { display: grid; gap: 8px; padding: 10px 0 4px; }
.program-help .tip-name { font-size: var(--text-sm); }
.program-drawing {
  width: 100%;
  height: 64px;
  background: var(--sunken);
  border-radius: 10px;
}
.program-drawing .beat-line { fill: none; stroke: var(--beat); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.program-drawing .ticks line { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.program-drawing .now { stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.program-caption { font-size: var(--text-xs); }
.program-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.program-step { padding: 8px 10px 10px; background: var(--sunken); border-radius: var(--radius-sm); }
.step-top { display: flex; align-items: center; gap: 6px; }
.step-name { font-family: var(--serif); margin-right: auto; white-space: nowrap; }
.step-top select { width: auto; min-width: 0; flex: 0 1 9.5rem; }
@media (max-width: 420px) {
  /* narrow phones: the curve picker gets a line of its own */
  .step-top { flex-wrap: wrap; }
  .step-top select { order: 5; flex: 1 1 100%; }
}
.program-panel, .program-steps { grid-template-columns: minmax(0, 1fr); }
.program-step .icon-button { width: 40px; min-width: 40px; height: 40px; }
.step-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin-top: 8px; }
.step-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px; }
.step-label { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--muted); }
.step-field select { width: 4.4rem; }
.program-step.is-hold .step-field:not(:first-child) { opacity: 0.5; }
.add-step { justify-self: start; background: transparent; box-shadow: 0 0 0 1px var(--line) inset; }
.program-end .chips button { min-height: 40px; }
.layer-remove { justify-self: start; margin-top: 6px; }
#add-layer { margin-top: 10px; background: transparent; box-shadow: 0 0 0 1px var(--line) inset; }
#builder .idle-note { margin-top: 6px; }


/* ---------- sheets: from the bottom on a phone, a centred card on wider screens ---------- */

dialog {
  color: var(--text);
  border: 0;
  background: var(--paper-2);
  box-shadow: var(--shadow-raised);
}
dialog.sheet {
  width: 100%;
  max-width: 100%;
  max-height: 88vh;
  margin: auto auto 0;
  padding: var(--s2) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--calm), transform var(--calm), overlay var(--calm) allow-discrete, display var(--calm) allow-discrete;
}
dialog.sheet[open] { opacity: 1; transform: none; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: translateY(24px); } }
dialog::backdrop { background: rgba(0, 0, 0, 0); transition: background var(--calm), overlay var(--calm) allow-discrete, display var(--calm) allow-discrete; }
dialog[open]::backdrop { background: var(--backdrop); }
@starting-style { dialog[open]::backdrop { background: rgba(0, 0, 0, 0); } }
@media (min-width: 768px) {
  dialog.sheet {
    width: min(560px, calc(100% - 48px));
    max-height: min(86vh, 860px);
    margin: auto;
    padding: var(--s5) var(--s6) var(--s6);
    border-radius: var(--radius-xl);
    transform: translateY(12px) scale(0.98);
  }
  dialog.sheet[open] { transform: none; }
  @starting-style { dialog.sheet[open] { transform: translateY(12px) scale(0.98); } }
  .sheet-handle { display: none; }
}
.sheet-handle { width: 40px; height: 5px; margin: 2px auto var(--s3); border-radius: 3px; background: var(--line-strong); opacity: 0.5; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); }
.sheet-head h2 { font-size: var(--text-xl); min-width: 0; }
.sheet-title { display: flex; align-items: center; gap: var(--s3); min-width: 0; margin-right: auto; }
.sheet-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .mix-switch { flex: none; }

/* a sound's sheet */
.module-blurb, .phones-note { margin-bottom: var(--s3); }
.sheet-level { margin: var(--s2) 0 var(--s4); padding: var(--s2) var(--s4) var(--s1); background: var(--paper); border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--line) inset; }
.sheet-level .row label { font-size: var(--text-sm); color: var(--muted); }
.module-panel > .panel, .module-panel > .tone-panel { margin-top: var(--s3); }
.module-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); }
.module-tools .danger-text { margin-left: auto; }

/* Add a sound */
.library-search-box {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 46px;
  margin: var(--s2) 0 var(--s3);
  padding: 0 var(--s4);
  background: var(--sunken);
  border-radius: 999px;
  color: var(--muted);
}
dialog .library-search { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--text); outline: none; }
.library-search-box:focus-within { box-shadow: 0 0 0 2px var(--accent) inset; }
.library-search::-webkit-search-cancel-button { filter: grayscale(1); }
.library-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 2px var(--s1); }
.library-chips::-webkit-scrollbar { display: none; }
.library-chips button { flex: none; }
@media (min-width: 768px) { .library-chips { flex-wrap: wrap; overflow: visible; } }
.library-group { margin-top: var(--s5); }
.library-group h3 { margin-bottom: var(--s1); color: var(--muted); font-family: var(--sans); font-size: var(--text-sm); font-weight: 600; }
.library-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) 0;
}
.library-item + .library-item { border-top: 1px solid var(--line); }
.library-item .mix-row-icon { grid-area: auto; align-self: center; margin: 0; }
.library-text { display: grid; gap: 1px; min-width: 0; }
.library-name { font-family: var(--serif); font-size: var(--text-md); }
.library-blurb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: var(--text-xs); }
.library-text .card-badge { justify-self: start; margin-top: 2px; }
.library-add { min-height: 36px; min-width: 84px; padding: 0 var(--s3); border-radius: 999px; background: var(--accent-soft); color: var(--on-accent-soft); font-size: var(--text-sm); font-weight: 600; }
.library-add .icon { width: 16px; height: 16px; }
.library-add[aria-pressed="true"], .library-add:disabled { opacity: 1; background: transparent; color: var(--muted); box-shadow: none; font-weight: 500; }

/* Room & key */
.room-key, .room-effect { margin-top: var(--s4); }
.room-key > .note, .room-effect > .note { margin: 2px 0 var(--s2); }
.room-effect h3, .room-key h3 { font-size: var(--text-md); }

/* Save as audio (its sheet) */
#export-sheet .export-box { padding: 0; background: transparent; box-shadow: none; }
#export-sheet .export-box > .row:first-child { display: none; } /* the sheet's own title says it */

/* the tone editor inside the Tones sheet */
.tone-section { margin-top: var(--s5); }
.tone-section h3 { font-size: var(--text-md); }
.tone-section > .note { margin: 2px 0 var(--s3); }
.affirmations-row { margin-top: var(--s4); padding: var(--s2) var(--s4); }
.coming-soon .name { flex-wrap: wrap; }
.badge { padding: 1px 10px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }
#affirmations { font-size: var(--text-sm); }

/* ---------- the sleep timer sheet ---------- */

.timer-open { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; border-radius: 999px; }
.timer-open .icon { width: 18px; height: 18px; color: var(--accent); }

.timer-big { margin-top: 14px; text-align: center; font-family: var(--serif); font-size: 2.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.timer-ends { min-height: 1.5em; text-align: center; }
.timer-track { position: relative; margin: 16px 0 2px; }
.timer-track input[type="range"] { position: relative; z-index: 1; height: 48px; }
.timer-ticks { position: absolute; left: 12px; right: 12px; top: 30px; height: 10px; pointer-events: none; }
.timer-ticks i { position: absolute; top: 0; width: 1px; height: 6px; background: var(--line-strong); opacity: 0.55; }
.timer-ticks i.hour { height: 10px; opacity: 1; }
.timer-hours { position: relative; height: 1.5em; margin: 0 12px; color: var(--muted); font-size: var(--text-xs); }
.timer-hours span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.timer-hours .first { transform: translateX(-30%); }
.timer-hours .last { transform: translateX(-70%); }
.timer-fine { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.timer-fine button { min-width: 72px; border-radius: 999px; }
.timer-quick { justify-content: center; margin-top: 14px; }
.timer-how { margin-top: 14px; }
dialog.sheet .dialog-actions { justify-content: center; margin-top: 16px; }


/* ---------- save as audio ---------- */

.export-box { display: grid; gap: var(--s3); }
.export-box h3 { font-size: var(--text-md); }
.export-fade { justify-self: start; border-radius: 999px; font-size: var(--text-sm); }
.export-start { justify-self: start; }
.export-progress { display: grid; gap: 6px; }
.export-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.export-progress progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.export-progress progress::-webkit-progress-bar { background: var(--track); border-radius: 999px; }
.export-progress progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.export-progress progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.export-percent { min-width: 3ch; color: var(--muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; text-align: right; }
.export-again { justify-self: start; }

/* ---------- tooltips ---------- */

.tooltip {
  position: absolute;
  z-index: 30;
  width: min(300px, calc(100vw - 20px));
  padding: 12px 14px;
  background: var(--paper-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-raised), 0 0 0 1px var(--line) inset;
  font-size: var(--text-sm);
  line-height: 1.45;
  animation: appear 160ms ease;
}
.tooltip p { margin-top: 8px; }
.tooltip-title { display: block; font-family: var(--serif); font-size: var(--text-md); font-weight: 500; }
.tooltip-label { display: block; font-size: var(--text-xs); font-weight: 600; color: var(--accent); }

/* ---------- toast and dialogs ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-space) + 8px);
  z-index: 20;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 6px 6px 6px 16px;
  background: var(--paper-2);
  border-radius: 999px;
  box-shadow: var(--shadow-raised), 0 0 0 1px var(--line) inset;
  font-size: var(--text-sm);
  animation: appear 200ms ease;
}
#toast-undo { color: var(--accent); background: transparent; border-radius: 999px; font-weight: 600; }

dialog:not(.sheet) {
  width: min(420px, calc(100vw - 32px));
  padding: var(--s6);
  border-radius: var(--radius-xl);
}
dialog form { display: grid; gap: 12px; }
dialog h2 { font-size: var(--text-lg); }
dialog label { font-size: var(--text-sm); color: var(--muted); }
dialog input:not([type="range"]):not([type="checkbox"]):not([type="file"]):not(.library-search) {
  min-height: 48px;
  padding: 0 14px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
dialog input:not([type="range"]):not(.library-search):focus-visible { border-color: var(--accent); outline: none; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-actions .danger { color: var(--danger); margin-right: auto; background: transparent; }

/* opacity only, so nothing that is placed with transform jumps */
@keyframes appear { from { opacity: 0; } }


/* ---------- the player ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s1) var(--s4);
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s3) var(--s4) calc(var(--s2) + env(safe-area-inset-bottom));
  background: var(--paper-2);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, 0.22);
}
@media (min-width: 600px) { .player { padding-left: var(--s6); padding-right: var(--s6); } }
#play {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
#play svg { position: absolute; width: 28px; height: 28px; fill: currentColor; transition: opacity var(--quick), transform var(--calm); }
.icon-pause { opacity: 0; transform: scale(0.6); }
.playing .icon-play { opacity: 0; transform: scale(0.6); }
.playing .icon-pause { opacity: 1; transform: none; }
/* a slow glow, like a lamp, while it plays */
#play::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.playing #play::after { animation: breathe 6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.95; } }

.now { min-width: 0; }
.now-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scene-name { font-family: var(--serif); font-size: var(--text-lg); }
#scene-surface { color: var(--muted); font-size: var(--text-sm); }
.now-status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s3); color: var(--muted); font-size: var(--text-sm); min-height: 1.5em; }
#program-chip { color: var(--accent); font-variant-numeric: tabular-nums; }
/* the moon button: always there, so the timer is one tap away */
.timer-chip {
  gap: 5px;
  min-height: 38px;
  padding: 0 var(--s3);
  margin: -7px 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: 0 0 0 1px var(--line) inset;
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.timer-chip.is-set { color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.timer-chip .icon { width: 16px; height: 16px; }
#update-note { grid-column: 1 / -1; background: var(--accent-soft); color: var(--on-accent-soft); }

#volume-control { grid-column: 1 / -1; }
#volume-control .control { grid-template-columns: auto minmax(0, 1fr) 3rem; align-items: center; gap: var(--s3); }
#volume-control .row { display: contents; }
#volume-control .name { order: 0; font-size: var(--text-sm); color: var(--muted); }
#volume-control input { order: 1; height: 36px; }
#volume-control output { order: 2; }
#volume-control .icon { width: 20px; height: 20px; }
@media (min-width: 720px) {
  :root { --player-space: 116px; }
  .player { grid-template-columns: auto minmax(0, 1fr) minmax(220px, 32%); padding-top: var(--s3); padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom)); }
  #volume-control { grid-column: auto; }
}

/* ---------- the narrowest phones ---------- */

@media (max-width: 380px) {
  .now-card { padding-left: var(--s3); padding-right: var(--s3); }
  dialog.sheet { padding-left: var(--s4); padding-right: var(--s4); }
  .layer-body { padding: var(--s1) var(--s2) var(--s3); }
  .layer-row { grid-template-columns: 3rem minmax(0, 1fr) 4.9rem 1.3rem; gap: 6px; }
  .step-fields { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .tiles-row { grid-template-columns: minmax(0, 1fr); }
  .tile-button { min-height: 64px; }
}

/* ---------- people who prefer less movement ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, dialog, dialog::backdrop { animation: none !important; transition: none !important; }
}
