/* The two sheets at the top: Settings, and (further down) the Menu, which works the same way.

   The settings at the top, when there's no room for their four rows (Riff has the screen, or the screen is
   narrow): one Settings button, which opens the rows as one sheet with a Close. Nick's side, at Nick's request
   (2026-11-12): "The 4 circle buttons at the top all seem to do the same thing and it's not easy to tell how to
   collapse them. There should either be one button or they need to have separate functions." The button and the
   sheet's head are made in js/main.js ("Settings stack"). These sit over v2.css's .stack rules. */

.stack-btn,
.stack-head {
  display: none;
}

/* Closed: the one button, where the four round ones were. */
.stack.is-compact .card {
  display: none;
}

.stack.is-compact .stack-btn {
  display: grid;
}

/* Open: the four rows on one sheet, with its name and a Close, so it reads as one thing over the page. */
.stack.is-floating {
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: calc(var(--r-card) + 8px);
  background: color-mix(in srgb, var(--space) 88%, transparent);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: 0 28px 60px -28px rgba(0, 0, 0, .85);
}

.stack.is-floating .stack-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 12px;
}

.stack-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.stack-close {
  width: 44px;
  height: 44px;
}

@media (max-width: 760px) {
  .stack.is-compact .stack-btn {
    width: 40px;
    height: 40px;
  }
}

/* ---------- Riff's bar without the mic and the "?" (Nick, 2026-11-12) ----------
   v2.css sized the bar as Menu + pill + Talk to Riff + "What can I do?", and on the home kept the Menu's place
   (hidden) to balance those two on the right. With them gone: on the home the pill is alone and centred; once
   Riff has the screen the pill takes the room they left, so the bar is still as wide as the drawers' column. */
@media (min-width: 641px) {
  body[data-state="home"] .menu-btn {
    display: none;
  }

  body[data-state="riff"] .bar {
    width: min(var(--col), 100%);
    margin-right: auto;
    margin-left: auto;
  }

  body[data-state="riff"] .ask {
    flex: 1 1 auto;
  }

  body[data-state="riff"] .field {
    width: 100%;
  }
}

/* ---------- The Menu: a sheet like Settings ----------
   Nick, 2026-11-12: "The new menu that expands into listen learn create should function more like the visualizer
   menu." It was the whole screen with the three rooms in big type. Now it's a sheet under its button, with its
   name and a Close, and three rows (js/rooms.js) that open in place to chips, one at a time, on the same cards
   as Settings. js/main.js places it (--menu-top, --menu-left). These sit over v2.css's .menu rules. */
.menu {
  inset: auto;
  top: var(--menu-top, 16px);
  left: var(--menu-left, var(--gutter));
  gap: 6px;
  width: min(332px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - var(--menu-top, 16px) - 16px);
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: calc(var(--r-card) + 8px);
  background: color-mix(in srgb, var(--space) 88%, transparent);
  box-shadow: 0 28px 60px -28px rgba(0, 0, 0, .85);
  scrollbar-width: none;
}

.menu::-webkit-scrollbar {
  display: none;
}

/* Credits and Privacy, quiet at the foot of the Menu (2026-11-14). */
.menu-foot {
  margin: 2px 0;
  padding: 4px 10px 2px;
  color: var(--dust);
  font-size: 13px;
}

.menu-foot a {
  color: inherit;
  text-underline-offset: 3px;
}

.menu-foot a:hover {
  color: var(--starlight);
}

.menu-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 12px;
}

.menu-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

/* Its Close is the round one the Settings sheet has; the word stays for screen readers. */
.menu .close-btn {
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
}

.menu .close-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.menu .menu-nav {
  display: block;
  flex: none;
  padding: 0;
  overflow: visible;
}

.menu-cards {
  display: grid;
  gap: 6px;
}

/* The row of the room you're in is lit, and says so where a setting's row says what it's set to. */
.menu-row[aria-current="true"] .card-label {
  color: var(--starlight);
}

.menu .card-body .chip {
  min-height: 40px;
  color: var(--starlight);
}

/* New chat, at the foot of the sheet. */
.menu .rc-menu-chat {
  width: auto;
  margin: 2px 0 0;
}

/* On a phone the sheet stops above the play bar at the bottom. */
@media (max-width: 640px) {
  .menu {
    max-height: calc(100dvh - var(--menu-top, 16px) - 84px - env(safe-area-inset-bottom));
  }
}

/* ---------- Settings, one page (phase C, 18 November; js/settingspage.js, screens 34 to 36) ----------
   Nick, on screen 31: "let's not make it too easy to forget everything or turn off riff remembers, move that to a
   settings page". The sheet keeps its four rows, under "Sound and look", and gains Riff, Evergreen, Your account and
   About under Customize, so it scrolls as one page, its head staying at the top. Nothing in it shrinks to fit any more
   (Customize's controls included): the sheet scrolls instead. The pages one layer down (Riff's memory, Forget
   everything, Start my tree over) are drill.js sheets, styled at the end. */
.set-top,
.set-more {
  display: none;
}

.stack.is-floating .set-top,
.stack.is-floating .set-more {
  display: grid;
}

.stack.is-floating {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.stack.is-floating::-webkit-scrollbar {
  display: none;
}

.stack.is-floating > * {
  flex: none;
}

.stack.is-floating .stack-head {
  position: sticky;
  top: -8px;
  z-index: 2;
  margin: -8px -8px 0;
  padding: 8px 8px 6px 20px;
  border-radius: calc(var(--r-card) + 8px) calc(var(--r-card) + 8px) 0 0;
  background: var(--space);
}

/* The four rows of Sound and look read as one group, as on screen 34: one card, a line between rows. */
.stack.is-floating .card + .card {
  margin-top: -6px;
  border-top-width: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.stack.is-floating .card:has(+ .card) {
  border-bottom-width: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.stack.is-floating .card + .card::before {
  content: '';
  display: block;
  height: 1px;
  margin: 0 12px;
  background: var(--line);
}

.set-top {
  gap: 4px;
}

.set-more {
  gap: 4px;
  padding-bottom: 6px;
}

.set-lede {
  margin: 0 12px 2px;
  color: color-mix(in srgb, var(--starlight) 78%, transparent);
  font-size: 13.5px;
  line-height: 1.45;
}

.set-h {
  margin: 12px 12px 2px;
  color: #A6A3AC;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}

.set-group {
  display: grid;
  gap: 6px;
}

.set-group[hidden] {
  display: none;
}

.set-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--glass);
  overflow: hidden;
}

.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 10px 8px 14px;
  color: var(--starlight);
  text-align: left;
  text-decoration: none;
}

.set-row + .set-row,
.set-card:not(.set-list) > * + * {
  border-top: 1px solid var(--line);
}

.set-ic {
  width: 20px;
  height: 20px;
}

.set-ks {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  line-height: 1.35;
}

.set-k {
  font-size: 14px;
  font-weight: 500;
}

.set-sub {
  color: #A6A3AC;
  font-size: 12.5px;
}

.set-value {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  color: #A6A3AC;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-chev {
  width: 16px;
  height: 16px;
  color: var(--dust);
}

.set-go:focus-visible {
  outline: 2px solid var(--starlight);
  outline-offset: -3px;
  border-radius: var(--r-card);
}

@media (hover: hover) {
  .set-go:hover {
    background: var(--lift);
  }
}

.set-note {
  margin: 4px 12px 0;
  color: #A6A3AC;
  font-size: 12.5px;
}

.set-note a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-underline-offset: 3px;
}

.set-status {
  margin: 0 12px;
  color: var(--starlight);
  font-size: 13px;
  line-height: 1.4;
}

.set-status:empty {
  display: none;
}

.set-status:focus {
  outline: none;
}

/* A switch in a row of Settings or You's foot: the track is drawn inside a 44px target. */
:is(.set-row, .rk-foot-row) .switch {
  flex: none;
  width: 52px;
  height: 44px;
  border: 0;
  background: none;
}

:is(.set-row, .rk-foot-row) .switch::before {
  content: '';
  position: absolute;
  inset: 9px 4px;
  border: 1px solid var(--hair-hi);
  border-radius: var(--r-pill);
  transition: background-color var(--t) ease, border-color var(--t) ease;
}

:is(.set-row, .rk-foot-row) .switch .knob {
  top: 12px;
  left: 7px;
  width: 20px;
  height: 20px;
}

:is(.set-row, .rk-foot-row) .switch[aria-checked="true"] {
  background: none;
}

:is(.set-row, .rk-foot-row) .switch[aria-checked="true"]::before {
  border-color: var(--starlight);
  background: var(--starlight);
}

:is(.set-row, .rk-foot-row) .switch[aria-checked="true"] .knob {
  background: var(--space);
  translate: 18px 0;
}

:is(.set-row, .rk-foot-row) .switch:focus-visible {
  outline: 2px solid var(--starlight);
  outline-offset: -4px;
  border-radius: var(--r-pill);
}

@media (hover: hover) {
  :is(.set-row, .rk-foot-row) .switch:hover {
    background-image: none;
  }

  :is(.set-row, .rk-foot-row) .switch:hover::before {
    border-color: var(--starlight);
  }
}

/* The Menu's Settings row, at the bottom of its rows: it opens the sheet, so its chevron points on. */
.set-menu .ic-chev {
  margin-left: auto;
}

/* ---------- One layer down: Riff's memory, Forget everything, Start my tree over (drill.js sheets) ---------- */
.set-page {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

.set-p {
  margin: 0;
  max-width: 62ch;
  color: color-mix(in srgb, var(--starlight) 82%, transparent);
  line-height: 1.5;
}

.set-small {
  color: #A6A3AC;
  font-size: 12.5px;
}

.set-page .set-h {
  margin: 8px 0 -4px;
}

.set-page .set-status {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--hair-hi);
  border-radius: var(--r-card);
}

.set-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--hair-hi);
  border-radius: 16px;
  background: radial-gradient(120% 90% at 85% 0%, #24364A 0%, #0A0C13 70%);
}

.set-state-ic {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(158, 218, 151, .16);
  color: #CDEBCA;
}

.set-state:not(.is-on) .set-state-ic {
  background: color-mix(in srgb, var(--starlight) 8%, transparent);
  color: var(--starlight);
}

.set-state-ic .ic {
  width: 22px;
  height: 22px;
}

.set-state-k {
  font-size: 15px;
  font-weight: 600;
}

.set-state .set-sub {
  color: color-mix(in srgb, var(--starlight) 80%, transparent);
  font-size: 13px;
}

.set-box {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
}

.set-acts {
  display: grid;
  gap: 8px;
}

.set-acts.is-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.set-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  color: var(--starlight);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.set-pill.is-full {
  width: 100%;
}

.set-pill.is-main {
  background: var(--starlight);
  color: var(--space);
  font-weight: 600;
}

.set-pill.is-outline {
  border-color: var(--hair-hi);
}

.set-pill.is-warn {
  border-color: #EB603A;
  color: #EB603A;
  font-weight: 600;
}

.set-pill[aria-disabled="true"] {
  opacity: .45;
  cursor: default;
}

.set-pill:focus-visible {
  outline: 2px solid var(--starlight);
  outline-offset: 3px;
}

@media (hover: hover) {
  .set-pill.is-outline:hover,
  .set-pill.is-warn:not([aria-disabled="true"]):hover {
    background: var(--lift);
  }
}

.set-pill-ic {
  width: 16px;
  height: 16px;
}

.set-instead {
  padding: 0 4px;
  color: color-mix(in srgb, var(--starlight) 80%, transparent);
  font-size: 13.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.set-list {
  padding: 2px 14px 4px;
}

.set-list-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 13.5px;
  font-weight: 600;
}

.set-list-ic {
  width: 18px;
  height: 18px;
}

.set-list.is-goes .set-list-ic {
  color: #EB603A;
}

.set-list.is-stays .set-list-ic {
  color: #9EDA97;
}

.set-items {
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
}

.set-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
}

.set-item-ic {
  width: 20px;
  height: 20px;
  margin: 1px 4px 0;
  color: #C9C5CE;
}

.set-item-star {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 24px;
}

.set-quote {
  color: var(--starlight);
  font-family: var(--serif);
  font-size: 14.5px;
  font-style: italic;
}

.set-item .set-sub {
  color: #C9C5CE;
  font-size: 13px;
}

/* Start my tree over's choice (screen 41): the whole card is the checkbox's label, so the target is the card. */
.set-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 56px;
  padding: 14px;
  border-color: var(--hair-hi);
  cursor: pointer;
}

.set-card.set-check > * + * {
  border-top: 0;
}

.set-check .set-k {
  font-size: 14.5px;
  font-weight: 600;
}

.set-check .set-sub {
  color: #C9C5CE;
  font-size: 13px;
}

.set-check-box {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: #EB603A;
  cursor: pointer;
}

.set-check:has(.set-check-box:focus-visible) {
  outline: 2px solid var(--starlight);
  outline-offset: 2px;
}

.set-form {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.set-label {
  color: color-mix(in srgb, var(--starlight) 82%, transparent);
  font-size: 13.5px;
}

.set-label strong {
  color: var(--starlight);
  font-weight: 600;
}

.set-form input {
  height: 48px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--hair-hi);
  border-radius: 12px;
  background: #0A0C13;
  color: var(--starlight);
  font: inherit;
  font-size: 16px;
}

.set-form input::placeholder {
  color: #A6A3AC;
  opacity: 1;
}

.set-form input:focus-visible {
  outline: 2px solid var(--starlight);
  outline-offset: 2px;
}

.set-hint {
  margin: 0;
  color: #EB603A;
  font-size: 13px;
}

.set-hint:empty {
  display: none;
}

.set-form .set-acts {
  margin-top: 4px;
}

/* Riff's group: his pick, small on its disc, before the name. */
.set-h-riff {
  display: flex;
  align-items: center;
  gap: 6px;
}

.set-h-riff .rp {
  flex: none;
}
