/* ============================================================
   TouchPad Beats â€” Body Brain Sensory visual system (skin only)
   Loaded LAST. Styling only: no IDs, classes, or logic changed.
   Light  = clean modern educational.
   Dark   = neon rhythm/music (glow only on active/selected).
   ============================================================ */

/* Modern readable sans-serif everywhere */
body,
body .hero-title,
body .brand-title,
body .panel-title,
body .setup-section-title,
body .mode-copy b {
  font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
}

/* ------------------------------------------------------------
   LIGHT MODE â€” selected controls: teal fill + white text
   ------------------------------------------------------------ */
html[data-theme="light"] .letter-check:has(input:checked),
html[data-theme="light"] .radio-pill:has(input:checked),
html[data-theme="light"] .finger-check:has(input:checked) {
  background: #eaf3fc;
  border-color: #2476b9;
  color: #0b2e5c;
}
html[data-theme="light"] .letter-check:has(input:checked) input,
html[data-theme="light"] .radio-pill:has(input:checked) input,
html[data-theme="light"] .finger-check:has(input:checked) input {
  accent-color: #2476b9;
}

/* Navy section headings */
html[data-theme="light"] .setup-section-title {
  color: #0b2e5c;
}

/* Dropdowns â€” flat white, neutral border */
html[data-theme="light"] .select-trigger {
  background: #ffffff;
  color: #0b2e5c;
  border-color: #c9d5e3;
}
html[data-theme="light"] .select-menu {
  background: #ffffff;
  border-color: #c9d5e3;
}
html[data-theme="light"] .select-option {
  color: #0b2e5c;
}
html[data-theme="light"] .select-option[aria-selected="true"],
html[data-theme="light"] .select-option.is-selected {
  background: #eaf3fc;
  color: #0b2e5c;
}

/* Rhythm/EQ bars â€” blue + orange (sign-in accents) */
html[data-theme="light"] .song-preview-btn.is-playing .song-preview-eq i {
  background: #226fb6;
}
html[data-theme="light"] .song-preview-btn.is-playing .song-preview-eq:last-child i {
  background: #fa8842;
}

/* ------------------------------------------------------------
   DARK MODE â€” NEON. Glow concentrated on active/selected only.
   Inactive controls stay dark and calm.
   ------------------------------------------------------------ */

/* Calm dark dropdowns */
html[data-theme="dark"] .select-trigger {
  background: #0f2130;
  color: #f2fbff;
  border-color: #315067;
}
html[data-theme="dark"] .select-menu {
  background: #0f2130;
  border-color: #315067;
}
html[data-theme="dark"] .select-option {
  color: #eaf6ff;
}
html[data-theme="dark"] .select-option[aria-selected="true"],
html[data-theme="dark"] .select-option.is-selected {
  background: rgba(36, 240, 255, 0.16);
  color: #24f0ff;
}

/* Selected hand / fingers / letters â€” neon cyan */
html[data-theme="dark"] .letter-check:has(input:checked),
html[data-theme="dark"] .radio-pill:has(input:checked),
html[data-theme="dark"] .finger-check:has(input:checked) {
  border-color: #24f0ff;
  background: rgba(36, 240, 255, 0.1);
  box-shadow: 0 0 8px rgba(36, 240, 255, 0.45), 0 0 18px rgba(36, 240, 255, 0.18);
}
html[data-theme="dark"] .letter-check:has(input:checked) input,
html[data-theme="dark"] .radio-pill:has(input:checked) input,
html[data-theme="dark"] .finger-check:has(input:checked) input {
  accent-color: #24f0ff;
}

/* Space toggle selected â€” neon pink */
html[data-theme="dark"] .check-pill:has(input:checked) {
  border-color: #ff4fd8;
  background: rgba(255, 79, 216, 0.1);
  box-shadow: 0 0 8px rgba(255, 79, 216, 0.4), 0 0 18px rgba(255, 79, 216, 0.16);
}
html[data-theme="dark"] .check-pill:has(input:checked) input {
  accent-color: #ff4fd8;
}

/* Preview (rhythm) â€” neon when playing; cyan/pink alternating EQ */
html[data-theme="dark"] .song-preview-btn.is-playing,
html[data-theme="dark"] .song-preview-btn[aria-pressed="true"] {
  border-color: #24f0ff;
  color: #24f0ff;
  box-shadow: 0 0 12px rgba(36, 240, 255, 0.4), 0 0 24px rgba(36, 240, 255, 0.15);
}
html[data-theme="dark"] .song-preview-btn.is-playing .song-preview-eq i {
  background: #24f0ff;
  box-shadow: 0 0 8px rgba(36, 240, 255, 0.6);
}
html[data-theme="dark"] .song-preview-btn.is-playing .song-preview-eq:last-child i {
  background: #ff4fd8;
  box-shadow: 0 0 8px rgba(255, 79, 216, 0.5);
}

/* Activity cards â€” neon cyan (free) / neon pink (keep) when selected */
html[data-theme="dark"] .mode-card[aria-pressed="true"][data-mode="free"] {
  border-color: #24f0ff;
  background: rgba(36, 240, 255, 0.06);
  box-shadow: 0 0 18px rgba(36, 240, 255, 0.4), 0 0 30px rgba(36, 240, 255, 0.15);
}
html[data-theme="dark"] .mode-card[aria-pressed="true"][data-mode="keep"] {
  border-color: #ff4fd8;
  background: rgba(255, 79, 216, 0.06);
  box-shadow: 0 0 18px rgba(255, 79, 216, 0.4), 0 0 30px rgba(255, 79, 216, 0.15);
}
html[data-theme="dark"] .mode-card[data-mode="keep"] .mode-icon {
  color: #ff4fd8;
}
html[data-theme="dark"] .mode-check {
  background: #24f0ff;
  color: #041318;
}
html[data-theme="dark"] .mode-card[aria-pressed="true"][data-mode="keep"] .mode-check {
  background: #ff4fd8;
}

/* Start Activity â€” text always white (gradient set per theme in variables) */
.start-btn {
  color: #ffffff;
}

/* Activity toolbar: wrap to a new line instead of overlapping when crowded */
.activity-chrome {
  flex-wrap: wrap !important;
  row-gap: 6px;
}

/* ---------- Beat Flash â€” opacity-only cue locked to the main tap beat ------ */
.beat-light {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--beat-flash-color, #226fb6);
}
html[data-theme="dark"] .beat-light {
  color: var(--beat-flash-color, #24f0ff);
}
.beat-light__box {
  width: clamp(90px, 30vw, 240px);
  height: 18px;
  border-radius: 6px;
  background: var(--beat-flash-color, #226fb6);
  opacity: 0.2;
  box-shadow: none;
  transform: none;
  outline: 2px solid color-mix(in srgb, var(--beat-flash-color, #226fb6) 50%, transparent);
  outline-offset: 0;
  transition: opacity 0.08s linear;
}
.beat-light__label {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.beat-light.beat-flash .beat-light__box {
  opacity: var(--beat-flash-opacity, 0.85);
  box-shadow: none;
  transform: none;
}
.beat-light--off .beat-light__box {
  visibility: hidden;
  opacity: 0;
}
.beat-light--bar.beat-light--off,
.beat-light--guide.beat-light--off {
  display: none;
}
/* In the top toolbar â€” longer bar, clearly visible; size via --beat-flash-size */
.beat-light--bar {
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  max-width: min(92vw, 640px);
  padding: 0 12px;
  height: 44px;
  /* Center the Beat Light in the middle of the activity toolbar/banner */
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}
.beat-light--bar .beat-light__box {
  width: calc(320px * var(--beat-flash-width, var(--beat-flash-size, 1)));
  max-width: 100%;
  height: calc(30px * var(--beat-flash-height, var(--beat-flash-size, 1)));
  min-height: 18px;
  border-radius: 10px;
}
.beat-light--bar .beat-light__label {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
}
.beat-light--preview {
  margin-top: 8px;
}
.beat-light--guide {
  width: 100%;
  min-height: 36px;
  justify-content: stretch;
  margin-top: 4px;
}
.beat-light--guide .beat-light__box {
  width: calc(240px * var(--beat-flash-width, var(--beat-flash-size, 1)));
  max-width: 100%;
  height: calc(28px * var(--beat-flash-height, var(--beat-flash-size, 1)));
  min-height: 18px;
  border-radius: 8px;
  margin-inline: auto;
}
.beat-light-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.beat-light-toggle {
  min-height: clamp(46px, 7vh, 52px);
  padding: 0 18px;
  border-radius: 12px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.beat-light-toggle[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--menu-selected-bg);
  color: var(--menu-selected-text, #fff);
}
/* Full-time / Half-time beat choice, and Full Songs / Loops audio type */
.beat-mode-field,
.audio-type-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.beat-mode-toggle,
.audio-type-toggle {
  display: flex;
  gap: 8px;
}
.beat-mode-btn,
.audio-type-btn {
  flex: 1 1 0;
  min-height: clamp(46px, 7vh, 52px);
  padding: 0 14px;
  border-radius: 12px;
  border: 2px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
}
.beat-mode-btn[aria-pressed="true"],
.audio-type-btn[aria-pressed="true"] {
  border-color: var(--teal);
  background: var(--menu-selected-bg);
  color: var(--menu-selected-text, #fff);
}

/* Type of Sound / Category chips + sound/song card grids */
.tpb-choice-field,
.tpb-sound-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  grid-column: 1 / -1;
}
.tpb-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tpb-choice-chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 2px solid #0b2e5c;
  background: #ffffff;
  color: #0b2e5c;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
}
.tpb-choice-chip[aria-pressed="true"] {
  background: #e6eef8;
  border-color: #0b2e5c;
}
.tpb-sound-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 104px), 1fr));
  gap: clamp(6px, 1.2vw, 10px);
  max-height: min(48vh, 420px);
  overflow: auto;
  padding: 2px;
  width: 100%;
  min-width: 0;
}
.tpb-sound-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  padding: clamp(4px, 1vw, 8px);
  border-radius: 10px;
  border: 2px solid #0b2e5c;
  background: #ffffff;
  color: #0b2e5c;
  font-weight: 800;
  font-size: clamp(0.68rem, 1.8vw, 0.88rem);
  text-align: left;
  cursor: pointer;
  line-height: 1.15;
}
.tpb-sound-card[aria-pressed="true"] {
  background: #e6eef8;
  box-shadow: 0 0 0 2px #0b2e5c;
}
.tpb-sound-card__preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
  border: 0;
  flex: 0 0 auto;
}
.tpb-sound-card__preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.tpb-sound-card__name {
  display: block;
  padding: 0 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-theme="light"] .tpb-choice-chip,
html[data-theme="light"] .tpb-sound-card {
  border-color: #0b2e5c;
  background: #ffffff;
  color: #0b2e5c;
}
html[data-theme="light"] .tpb-choice-chip[aria-pressed="true"],
html[data-theme="light"] .tpb-sound-card[aria-pressed="true"] {
  background: #e6eef8;
}
.beat-mode-hint {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* Phone / narrow: shrink tiles so they stay a compact grid, not giant squares */
@media (max-width: 900px) {
  .tpb-sound-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    max-height: min(42vh, 360px);
  }
}
@media (max-width: 640px) {
  .tpb-sound-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    max-height: min(40vh, 320px);
  }
  .tpb-sound-card {
    padding: 4px;
    gap: 4px;
    border-width: 1.5px;
    border-radius: 8px;
  }
  .tpb-sound-card__preview {
    border-radius: 6px;
  }
  .tpb-sound-card__name {
    font-size: 0.65rem;
  }
}
@media (max-width: 420px) {
  .tpb-sound-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  .tpb-sound-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    max-height: min(52vh, 280px);
    gap: 5px;
  }
  .tpb-sound-card__name {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .beat-light__box {
    transition: none;
  }
}

/* ------------------------------------------------------------
   Navigation: Back to Menu + Sign out (activity chrome + menu header)
   ------------------------------------------------------------ */
/* Nav buttons hold text, so they must not be forced to the 40px icon size.
   High specificity + !important so this always beats .chrome-btn { width:40px }. */
.activity-chrome .chrome-btn--nav {
  width: auto !important;
  min-width: 0 !important;
  height: 40px;
  padding: 0 12px !important;
  gap: 6px;
  font-weight: 800;
  font-size: 13px;
  white-space: nowrap;
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.chrome-btn--signout {
  border-color: #ff5b52;
  color: #ff5b52;
}
html[data-theme="dark"] .chrome-btn--signout {
  border-color: #ff4fd8;
  color: #ff4fd8;
}
/* Menu-header Sign out button */
.theme-btn--signout {
  gap: 6px;
  font-weight: 800;
}
html[data-theme="light"] .theme-btn--signout {
  border-color: #ff5b52;
  color: #c0392b;
}
html[data-theme="dark"] .theme-btn--signout {
  border-color: #ff4fd8;
  color: #ff4fd8;
}

/* ------------------------------------------------------------
   LIGHT MODE â€” activity cards: light blue + light yellow,
   full borders, and music-note "beats".
   ------------------------------------------------------------ */
/* White cards distinguished only by border color:
   Make Your Own Beat = blue, Keep the Beat Going = yellow. */
html[data-theme="light"] .mode-card {
  border-width: 2px;
  border-style: solid;
  border-color: #c9d5e3;
  background: #ffffff;
}
html[data-theme="light"] .mode-card[data-mode="free"] {
  border-color: #2476b9;
  background: #ffffff;
}
html[data-theme="light"] .mode-card[data-mode="keep"] {
  border-color: #e0a800;
  background: #ffffff;
}
html[data-theme="light"] .mode-card[data-mode="free"] .mode-icon {
  background: transparent;
  color: #2476b9;
  box-shadow: none;
}
html[data-theme="light"] .mode-card[data-mode="keep"] .mode-icon {
  background: transparent;
  color: #b8860b;
  box-shadow: none;
}
html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="free"] {
  border-color: #2476b9;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06);
}
html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="keep"] {
  border-color: #e0a800;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06);
}
html[data-theme="light"] .mode-card[data-mode="free"] .mode-check {
  background: #2476b9;
}
html[data-theme="light"] .mode-card[data-mode="keep"] .mode-check {
  background: #e0a800;
}

/* Small music-note "beats" on each card, tinted to match the border */
html[data-theme="light"] .mode-card::after {
  background: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  width: auto !important;
  height: auto !important;
  right: 20px !important;
  opacity: 0.55 !important;
  font-size: 26px !important;
  letter-spacing: 5px;
  font-weight: 700;
  line-height: 1;
}
html[data-theme="light"] .mode-card[data-mode="free"]::after {
  content: "\266A \266A" !important;
  color: #2476b9 !important;
}
html[data-theme="light"] .mode-card[data-mode="keep"]::after {
  content: "\266A \266B \266A \266B" !important;
  color: #e0a800 !important;
}

/* Clean panels: no top accent bar; a subtle blue border frames the card */
html[data-theme="light"] .setup-panel::before {
  display: none !important;
}
html[data-theme="light"] .setup-panel {
  border: 1px solid #2476b9 !important;
}
html[data-theme="light"] .preview-panel {
  border: 1px solid #c9d5e3 !important;
}

/* Header â€” full border instead of the top-only accent line */
html[data-theme="light"] .app-header::before {
  display: none !important;
}
html[data-theme="light"] .app-header {
  background: #ffffff !important;
  border: 1px solid #c9d5e3 !important;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06) !important;
}

/* Activity-card icons: glossy red/blue/yellow animated pads (no finger/hand). */
.mode-icon--free::before,
.mode-icon--keep::before {
  display: none !important;
}
.mode-card .mode-icon {
  position: relative;
  width: clamp(64px, 9vw, 84px);
  height: clamp(64px, 9vw, 84px);
  overflow: visible;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}
.mode-anim {
  position: absolute;
  inset: 4%;
  display: block;
  pointer-events: none;
}
.mode-anim i {
  font-style: normal;
  display: block;
  box-sizing: border-box;
}

.mode-anim__pad--red,
.mode-anim__dot--red {
  background: linear-gradient(180deg, #ff6b61 0%, #ff3b30 42%, #e8251a 100%);
  box-shadow: 0 3px 0 #9b1610, 0 5px 10px rgba(0, 0, 0, 0.18);
}
.mode-anim__pad--blue,
.mode-anim__dot--blue {
  background: linear-gradient(180deg, #4da3ff 0%, #007aff 42%, #0062cc 100%);
  box-shadow: 0 3px 0 #004a99, 0 5px 10px rgba(0, 0, 0, 0.18);
}
.mode-anim__pad--yellow,
.mode-anim__dot--yellow {
  background: linear-gradient(180deg, #ffe066 0%, #ffcc00 42%, #e6b800 100%);
  box-shadow: 0 3px 0 #b8860b, 0 5px 10px rgba(0, 0, 0, 0.18);
}

.mode-anim--free .mode-anim__pads {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7%;
  transform: translateY(-50%);
}
.mode-anim--free .mode-anim__pad {
  flex: 0 0 auto;
  width: 26%;
  aspect-ratio: 1;
  border: none;
  border-radius: 22%;
  position: relative;
  animation: modePadPulse 1.6s ease-in-out infinite;
}
.mode-anim--free .mode-anim__pad::after,
.mode-anim--keep .mode-anim__dot::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: 12%;
  height: 26%;
  border-radius: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.mode-anim--free .mode-anim__pad--red { animation-delay: 0s; }
.mode-anim--free .mode-anim__pad--blue { animation-delay: 0.2s; }
.mode-anim--free .mode-anim__pad--yellow {
  animation: modePadHit 1.6s ease-in-out infinite;
  z-index: 1;
}
.mode-anim--free .mode-anim__ring {
  position: absolute;
  right: 0;
  top: 50%;
  width: 26%;
  aspect-ratio: 1;
  margin-top: -13%;
  border: 2px solid rgba(255, 204, 0, 0.85);
  border-radius: 28%;
  opacity: 0;
  animation: modeTapRing 1.6s ease-out infinite;
  background: transparent !important;
  box-shadow: none;
}

.mode-anim--keep .mode-anim__dots {
  position: absolute;
  left: 2%;
  right: 18%;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5%;
  transform: translateY(-50%);
}
.mode-anim--keep .mode-anim__dot {
  flex: 1 1 0;
  aspect-ratio: 1;
  border: none;
  border-radius: 22%;
  position: relative;
  animation: modeDotPulse 2s ease-in-out infinite;
}
.mode-anim--keep .mode-anim__dot:nth-child(1) { animation-delay: 0s; }
.mode-anim--keep .mode-anim__dot:nth-child(2) { animation-delay: 0.4s; }
.mode-anim--keep .mode-anim__dot:nth-child(3) { animation-delay: 0.8s; }
.mode-anim--keep .mode-anim__dot:nth-child(4) { animation-delay: 1.2s; }
.mode-anim--keep .mode-anim__dot:nth-child(5) { animation-delay: 1.6s; }
.mode-anim--keep .mode-anim__arrow {
  position: absolute;
  right: 0;
  top: 50%;
  width: 14%;
  height: 22%;
  color: #c98912;
  transform: translateY(-50%);
  animation: modeArrowNudge 2s ease-in-out infinite;
}
.mode-anim--keep .mode-anim__arrow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 70%;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%);
}
.mode-anim--keep .mode-anim__arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transform: translateY(-50%);
}

html[data-theme="light"] .mode-card[data-mode="free"]::after,
html[data-theme="light"] .mode-card[data-mode="keep"]::after {
  animation: modeNotesBob 2.4s ease-in-out infinite;
}
html[data-theme="light"] .mode-card[data-mode="keep"]::after {
  animation-delay: 0.3s;
}

@keyframes modePadPulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.08); }
}
@keyframes modePadHit {
  0%, 55%, 100% { transform: scale(1); filter: brightness(1); }
  62%, 72% { transform: scale(1.12); filter: brightness(1.15); }
}
@keyframes modeTapRing {
  0%, 55% { opacity: 0; transform: scale(0.45); }
  62% { opacity: 0.75; transform: scale(0.75); }
  85% { opacity: 0; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(1.4); }
}
@keyframes modeDotPulse {
  0%, 18%, 100% { transform: scale(1); filter: brightness(0.92); }
  8%, 12% { transform: scale(1.22); filter: brightness(1.18); }
}
@keyframes modeArrowNudge {
  0%, 100% { transform: translateY(-50%) translateX(0); opacity: 0.75; }
  50% { transform: translateY(-50%) translateX(12%); opacity: 1; }
}
@keyframes modeNotesBob {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  50% { transform: translateY(calc(-50% - 3px)) translateX(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .mode-anim--free .mode-anim__pad,
  .mode-anim--free .mode-anim__pad--hit,
  .mode-anim--free .mode-anim__ring,
  .mode-anim--keep .mode-anim__dot,
  .mode-anim--keep .mode-anim__arrow,
  html[data-theme="light"] .mode-card[data-mode="free"]::after,
  html[data-theme="light"] .mode-card[data-mode="keep"]::after {
    animation: none !important;
  }
  .mode-anim--free .mode-anim__pad--yellow,
  .mode-anim--keep .mode-anim__dot:nth-child(2) {
    filter: brightness(1.12);
    transform: scale(1.06);
  }
}
/* White cards; the activity is identified by its border color.
   Make Your Own Beat = blue border, Keep the Beat Going = yellow border. */
html[data-theme="light"] .mode-card--launch[data-mode="free"] {
  background: #ffffff;
  border: 2px solid #2476b9;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06);
}
html[data-theme="light"] .mode-card--launch[data-mode="keep"] {
  background: #ffffff;
  border: 2px solid #e0a800;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06);
}
html[data-theme="light"] .mode-card--launch[data-mode="free"]:hover {
  border-color: #175e99;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.1);
}
html[data-theme="light"] .mode-card--launch[data-mode="keep"]:hover {
  border-color: #c99000;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.1);
}

/* ------------------------------------------------------------
   Mode change is obvious: panel title color + fill switches with the card.
   ------------------------------------------------------------ */
/* White panels; the same activity border color carries through from the menu:
   Make Your Own Beat = blue border, Keep the Beat Going = yellow border. */
html[data-theme="light"] body[data-activity-mode="free"] .setup-panel,
html[data-theme="light"] .setup-panel.setup-panel--free {
  background: #ffffff !important;
  border: 2px solid #2476b9 !important;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06) !important;
}
html[data-theme="light"] body[data-activity-mode="keep"] .setup-panel,
html[data-theme="light"] .setup-panel.setup-panel--keep {
  background: #ffffff !important;
  border: 2px solid #e0a800 !important;
  box-shadow: 0 4px 14px rgba(11, 46, 92, 0.06) !important;
}
html[data-theme="light"] body[data-activity-mode="free"] .setup-panel .panel-title,
html[data-theme="light"] .setup-panel.setup-panel--free .panel-title,
html[data-theme="light"] body[data-activity-mode="keep"] .setup-panel .panel-title,
html[data-theme="light"] .setup-panel.setup-panel--keep .panel-title {
  color: #0b2e5c !important;
}

.beat-flash-color-field,
.beat-flash-opacity-field,
.beat-flash-size-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.beat-flash-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.beat-flash-swatch {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid #c9d5e3;
  background: var(--swatch, #2476b9);
  cursor: pointer;
  padding: 0;
}
.beat-flash-size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.beat-flash-size-btn {
  min-width: 52px;
  min-height: 48px;
  border-radius: 12px;
  border: 2px solid var(--input-border, #c9d5e3);
  background: var(--input-bg, #fff);
  color: var(--text-primary, #0b2e5c);
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  line-height: 1;
}
.beat-flash-size-btn:hover {
  border-color: #2476b9;
  background: #eaf3fc;
}
.beat-flash-size-value {
  min-width: 4.5em;
  text-align: center;
  font-weight: 900;
  font-size: 16px;
  color: var(--text-primary, #0b2e5c);
}
.beat-flash-size-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary, #6b7c91);
}
.beat-flash-swatch[aria-pressed="true"] {
  border-color: #0b2e5c;
  box-shadow: 0 0 0 2px #0b2e5c;
}
.beat-flash-opacity {
  width: 100%;
  min-height: 36px;
  accent-color: #2476b9;
}

/* ============================================================
   Light theme â€” Voice Memo reference look (whole app)
   Cream page, navy chrome, white cards, colored borders, chip selection.
   Loaded last so it wins over comic / neon light rules.
   ============================================================ */
html[data-theme="light"] body::before {
  background: #f7f1d4 !important;
}
html[data-theme="light"] body::after {
  display: none !important;
}
html[data-theme="light"] .bg-waves {
  display: none !important;
}

/* Header â€” white card + navy border (matches rest of light UI) */
html[data-theme="light"] .app-header,
html[data-theme="light"] body.comic-ui .app-header {
  background: #ffffff !important;
  background-image: none !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  align-items: center !important;
  min-height: 64px !important;
  padding: 10px 14px !important;
  gap: 12px !important;
}
html[data-theme="light"] .app-header::before {
  display: none !important;
}
html[data-theme="light"] .header-actions {
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 599px) {
  html[data-theme="light"] .app-header,
  html[data-theme="light"] body.comic-ui .app-header {
    flex-wrap: wrap !important;
    overflow: visible !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px !important;
    min-height: 0 !important;
  }
  html[data-theme="light"] .header-actions {
    flex: 1 1 100% !important;
    justify-content: flex-start !important;
    gap: 6px !important;
  }
  html[data-theme="light"] .header-actions .theme-btn--classroom,
  html[data-theme="light"] .header-actions .theme-btn--signout,
  html[data-theme="light"] .back-to-chooser {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }
  html[data-theme="light"] .theme-switch {
    height: 36px !important;
    min-height: 36px !important;
  }
  html[data-theme="light"] .brand-byline {
    display: none !important;
  }
}
html[data-theme="light"] .brand-title,
html[data-theme="light"] .brand-touchpad,
html[data-theme="light"] .brand-beats,
html[data-theme="light"] body.comic-ui .brand-touchpad,
html[data-theme="light"] body.comic-ui .brand-beats {
  color: #0b2e5c !important;
  text-shadow: none !important;
  -webkit-text-fill-color: #0b2e5c;
  background: none !important;
}
html[data-theme="light"] .brand-beats {
  color: #e87a1a !important;
  -webkit-text-fill-color: #e87a1a;
}
html[data-theme="light"] .brand-byline,
html[data-theme="light"] body.comic-ui .brand-byline {
  color: #7a7a72 !important;
  text-shadow: none !important;
}
html[data-theme="light"] .logo-mark {
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

/* Shared action chip size in header */
html[data-theme="light"] .header-actions .theme-btn--classroom,
html[data-theme="light"] .header-actions .theme-btn--signout,
html[data-theme="light"] .back-to-chooser {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 14px !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  color: #0b2e5c !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
}
html[data-theme="light"] .header-actions .theme-btn--signout {
  border-color: #a33a4a !important;
  color: #a33a4a !important;
}
html[data-theme="light"] .theme-switch {
  height: 40px !important;
  min-height: 40px !important;
  padding: 3px !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  box-shadow: none !important;
  align-items: stretch !important;
}
html[data-theme="light"] .theme-switch .theme-btn {
  height: auto !important;
  min-height: 0 !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: #7a7a72 !important;
  box-shadow: none !important;
  font-size: 13px !important;
}
html[data-theme="light"] .theme-switch .theme-btn[aria-pressed="true"],
html[data-theme="light"] .theme-switch .theme-btn.is-active {
  background: #e6eef8 !important;
  color: #0b2e5c !important;
  border: 0 !important;
  box-shadow: none !important;
}
html[data-theme="light"] .theme-switch .theme-btn[aria-pressed="true"] .icon {
  color: #0b2e5c !important;
}

/* Titles / heroes */
html[data-theme="light"] .menu-choose,
html[data-theme="light"] .comic-section-title,
html[data-theme="light"] .panel-title,
html[data-theme="light"] .comic-banner-title,
html[data-theme="light"] .preview-title {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  color: #0b2e5c !important;
  -webkit-text-fill-color: #0b2e5c;
  text-shadow: none !important;
  font-family: Inter, "Segoe UI", Arial, sans-serif !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  padding: 0 !important;
  text-decoration: none !important;
}
html[data-theme="light"] .setup-panel .panel-title.comic-banner-title {
  margin: 0 0 10px !important;
  display: block !important;
}
html[data-theme="light"] body.comic-ui .setup-panel::after {
  display: none !important;
  content: none !important;
}

/* Mode / activity cards â€” white + colored border */
html[data-theme="light"] .mode-card,
html[data-theme="light"] .mode-card--launch,
html[data-theme="light"] body.comic-ui .mode-card {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
html[data-theme="light"] .mode-card[data-mode="free"],
html[data-theme="light"] .mode-card--launch[data-mode="free"] {
  border-color: #0b2e5c !important;
}
html[data-theme="light"] .mode-card[data-mode="keep"],
html[data-theme="light"] .mode-card--launch[data-mode="keep"] {
  border-color: #c98912 !important;
}
html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="free"],
html[data-theme="light"] .mode-card--launch[data-mode="free"]:hover {
  background: #e6eef8 !important;
  border-color: #0b2e5c !important;
}
html[data-theme="light"] .mode-card[aria-pressed="true"][data-mode="keep"],
html[data-theme="light"] .mode-card--launch[data-mode="keep"]:hover {
  background: #fff6dc !important;
  border-color: #c98912 !important;
}
html[data-theme="light"] .mode-card::after,
html[data-theme="light"] body.comic-ui .mode-card::after {
  opacity: 0.35;
  filter: none;
}
html[data-theme="light"] .mode-card[data-mode="free"] .mode-icon,
html[data-theme="light"] .mode-card[data-mode="keep"] .mode-icon {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
}
html[data-theme="light"] .mode-card[data-mode="free"] .mode-icon {
  color: #0b2e5c;
}
html[data-theme="light"] .mode-card[data-mode="keep"] .mode-icon {
  color: #c98912;
}
html[data-theme="light"] .mode-copy b {
  color: #0b2e5c !important;
}
html[data-theme="light"] .mode-copy span {
  color: #7a7a72 !important;
}

/* Panels */
html[data-theme="light"] .setup-panel,
html[data-theme="light"] .preview-panel,
html[data-theme="light"] .panel,
html[data-theme="light"] body.comic-ui .setup-panel,
html[data-theme="light"] body.comic-ui .preview-panel {
  background: #ffffff !important;
  background-image: none !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
html[data-theme="light"] .setup-panel::before,
html[data-theme="light"] .preview-panel::before {
  display: none !important;
}
html[data-theme="light"] body[data-activity-mode="keep"] .setup-panel,
html[data-theme="light"] .setup-panel.setup-panel--keep {
  border-color: #c98912 !important;
}
html[data-theme="light"] body[data-activity-mode="free"] .setup-panel,
html[data-theme="light"] .setup-panel.setup-panel--free {
  border-color: #0b2e5c !important;
}

/* Section labels â€” small uppercase muted */
html[data-theme="light"] .field-label,
html[data-theme="light"] .setup-section-title {
  color: #7a7a72 !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  font-family: Inter, "Segoe UI", Arial, sans-serif !important;
}

/* Choice chips â€” white + navy border; selected = wash + check feel */
html[data-theme="light"] .radio-pill,
html[data-theme="light"] .finger-check,
html[data-theme="light"] .letter-check,
html[data-theme="light"] .check-pill,
html[data-theme="light"] body.comic-ui .finger-check,
html[data-theme="light"] body.comic-ui .radio-pill {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: #0b2e5c !important;
}
html[data-theme="light"] .radio-pill:has(input:checked),
html[data-theme="light"] .finger-check:has(input:checked),
html[data-theme="light"] .letter-check:has(input:checked),
html[data-theme="light"] .check-pill:has(input:checked),
html[data-theme="light"] body.comic-ui .finger-check:has(input:checked),
html[data-theme="light"] body.comic-ui .radio-pill:has(input:checked) {
  background: #e6eef8 !important;
  border-color: #0b2e5c !important;
  box-shadow: none !important;
}
html[data-theme="light"] .setup-letter-group {
  background: #ffffff !important;
  background-image: none !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 12px !important;
}

/* Selects / inputs â€” orange outline like reference text box */
html[data-theme="light"] .select-trigger,
html[data-theme="light"] .song-preview-btn,
html[data-theme="light"] select,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] textarea {
  background: #ffffff !important;
  background-image: none !important;
  border: 2px solid #e87a1a !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: #0b2e5c !important;
}
html[data-theme="light"] .select-trigger:hover,
html[data-theme="light"] .song-preview-btn:hover {
  background: #fff0e4 !important;
}
html[data-theme="light"] .song-preview-btn.is-playing,
html[data-theme="light"] .song-preview-btn[aria-pressed="true"] {
  background: #fff0e4 !important;
  border-color: #e87a1a !important;
}
html[data-theme="light"] .select-menu {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}
html[data-theme="light"] .select-option[aria-selected="true"] {
  background: #e6eef8 !important;
  color: #0b2e5c !important;
}

/* Primary CTA â€” orange Record style */
html[data-theme="light"] .start-btn {
  background: #e87a1a !important;
  color: #ffffff !important;
  border: 2px solid #e87a1a !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  filter: none !important;
}
html[data-theme="light"] .start-btn:hover {
  background: #d66c12 !important;
  border-color: #d66c12 !important;
  box-shadow: none !important;
  filter: none !important;
}

/* Beat flash swatches â€” squares, no blue tray */
html[data-theme="light"] .beat-flash-swatch {
  border-radius: 6px !important;
  border: 2px solid #0b2e5c !important;
}
html[data-theme="light"] .beat-flash-swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #0b2e5c !important;
}
html[data-theme="light"] .beat-flash-size-btn {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  color: #0b2e5c !important;
}

/* Session / comments */
html[data-theme="light"] .tpb-comments__card,
html[data-theme="light"] .tpb-session-data {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
html[data-theme="light"] .tpb-comments__btn--primary {
  background: #e87a1a !important;
  border-color: #e87a1a !important;
  color: #fff !important;
}
html[data-theme="light"] .tpb-comments__btn--secondary,
html[data-theme="light"] .tpb-comments__btn--ghost {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  color: #0b2e5c !important;
  border-radius: 10px !important;
}

/* Activity chrome */
html[data-theme="light"] .activity-chrome {
  background: transparent !important;
  border-bottom: 2px solid rgba(11, 46, 92, 0.18) !important;
}
html[data-theme="light"] .activity-chrome .chrome-btn,
html[data-theme="light"] .activity-chrome .theme-btn {
  background: #ffffff !important;
  border: 2px solid #0b2e5c !important;
  border-radius: 10px !important;
  color: #0b2e5c !important;
  box-shadow: none !important;
}
html[data-theme="light"] .activity-chrome .chrome-btn--start {
  background: #e87a1a !important;
  border-color: #e87a1a !important;
  color: #ffffff !important;
}
html[data-theme="light"] .activity-chrome .chrome-btn--comments {
  background: #e6eef8 !important;
  border-color: #0b2e5c !important;
}
html[data-theme="light"] .activity-chrome .chrome-btn--signout {
  border-color: #a33a4a !important;
  color: #a33a4a !important;
}
html[data-theme="light"] .activity-shell,
html[data-theme="light"] .activity-main {
  background: transparent;
}
html[data-theme="light"] body[data-page="activity"] {
  background: #f7f1d4;
}

/* Classroom */
html[data-theme="light"] .classroom-page,
.classroom-page {
  background: #f7f1d4;
}
.classroom-chrome {
  background: #0b2e5c !important;
  border-bottom: 2px solid #0b2e5c !important;
}
.classroom-brand strong,
.classroom-brand span {
  color: #ffffff !important;
}
.classroom-brand span {
  opacity: 0.8;
}
.classroom-field {
  color: rgba(255, 255, 255, 0.85) !important;
}
.classroom-field select,
.mode-btn,
.classroom-nav button,
#btnClear,
#btnStartSequence,
.chrome-peek,
.classroom-stepper button {
  background: #ffffff !important;
  border: 2px solid #ffffff !important;
  border-radius: 10px !important;
  color: #0b2e5c !important;
  box-shadow: none !important;
}
.mode-btn[aria-pressed="true"] {
  background: #e6eef8 !important;
  border-color: #ffffff !important;
  color: #0b2e5c !important;
}
.classroom-hint {
  color: #7a7a72 !important;
}
.word-chip {
  color: #0b2e5c !important;
}
.word-chip.is-selected {
  background: #e6eef8 !important;
  box-shadow: 0 0 0 3px #0b2e5c !important;
}

/* Kill comic halftone / ink on light */
html[data-theme="light"] body.comic-ui,
html[data-theme="light"] body.comic-ui .page {
  background: #f7f1d4 !important;
}
html[data-theme="light"] body.comic-ui .app-header {
  background: #ffffff !important;
}


/* ------------------------------------------------------------
   Keep the Beat — Option 7 Music Browser (Sounds step)
   Autofit any screen: fill viewport, scroll only inside lists.
   ------------------------------------------------------------ */
.setup-panel--keep .audio-type-field,
.setup-panel--keep .keep-sounds-layout,
.setup-panel--keep .setup-section-title {
  grid-column: 1 / -1;
}

body[data-activity-mode="keep"][data-setup-step="sounds"] {
  overflow: hidden;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-height: 100vh;
  max-height: 100dvh;
  max-height: var(--app-height, 100dvh);
  margin: 0;
  padding:
    calc(var(--safe-top, 0px) + 6px)
    clamp(8px, 1.2vw, 16px)
    calc(var(--safe-bottom, 0px) + 8px);
  gap: clamp(6px, 1.2vh, 12px);
  box-sizing: border-box;
  overflow: hidden;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] .app-header {
  flex: 0 0 auto;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  overflow: hidden;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup > .hero--menu {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #previewPanel {
  display: none !important;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #startBtn {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: clamp(44px, 7vh, 56px);
}

.setup-panel--keep-sounds {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(8px, 1.2vh, 14px) clamp(10px, 1.4vw, 16px);
  box-sizing: border-box;
  container-type: inline-size;
  container-name: keep-sounds;
}
.setup-panel--keep-sounds .panel-title {
  flex: 0 0 auto;
  margin: 0 0 clamp(4px, 0.8vh, 8px);
  font-size: clamp(1rem, 2.2vh, 1.35rem);
}
.setup-panel--keep-sounds .setup-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1vh, 10px);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.setup-panel--keep-sounds .setup-section-title {
  display: none;
}
.setup-panel--keep-sounds .audio-type-field {
  flex: 0 0 auto;
}
.setup-panel--keep-sounds .audio-type-field .field-label {
  display: none;
}
.setup-panel--keep-sounds .audio-type-toggle {
  max-width: min(420px, 100%);
  width: 100%;
}
.setup-panel--keep-sounds .audio-type-btn {
  min-height: clamp(40px, 6.5vh, 52px);
  font-size: clamp(0.9rem, 2vh, 1.05rem);
}

.keep-sounds-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.78fr);
  gap: clamp(8px, 1.2vw, 14px);
  align-items: stretch;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
/* Never show Music Library outside Keep → Sounds */
body[data-activity-mode="free"] .keep-sounds-layout,
body[data-setup-step="keys"] .keep-sounds-layout,
.keep-sounds-layout[hidden] {
  display: none !important;
}
.keep-music-browser,
.keep-beat-settings {
  background: #ffffff;
  border: 2px solid #0b2e5c;
  border-radius: clamp(10px, 1.2vw, 16px);
  padding: clamp(8px, 1.2vh, 12px) clamp(8px, 1.2vw, 14px);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.keep-panel-head {
  margin: 0 0 clamp(4px, 0.8vh, 8px);
  flex: 0 0 auto;
}
.keep-panel-title {
  margin: 0;
  font-size: clamp(0.85rem, 1.8vh, 1.05rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #0b2e5c;
}
.keep-browser-body {
  display: grid;
  grid-template-columns: minmax(120px, 0.38fr) minmax(0, 1fr);
  gap: clamp(8px, 1vw, 12px);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.keep-pane-label {
  margin: 0 0 6px;
  font-size: clamp(0.68rem, 1.4vh, 0.78rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a6f8a;
  flex: 0 0 auto;
}
.keep-cat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.keep-cat-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.keep-cat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  padding: clamp(7px, 1.2vh, 10px) clamp(8px, 1vw, 12px);
  border-radius: 10px;
  border: 2px solid #c9d5e3;
  background: #fff;
  color: #0b2e5c;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.keep-cat-item[aria-pressed="true"] {
  border-color: #0b2e5c;
  background: #e6eef8;
  box-shadow: 0 0 0 1px #0b2e5c;
}
.keep-cat-item__name {
  font-size: clamp(0.8rem, 1.7vh, 0.95rem);
  line-height: 1.2;
}
.keep-cat-item__count {
  font-size: clamp(0.68rem, 1.4vh, 0.78rem);
  font-weight: 700;
  color: #5a6f8a;
}
.keep-song-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.keep-song-pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.keep-song-pane-title {
  margin: 0;
  font-size: clamp(0.9rem, 1.9vh, 1.05rem);
  font-weight: 900;
  color: #0b2e5c;
}
.keep-song-pane-count {
  font-size: clamp(0.72rem, 1.5vh, 0.82rem);
  font-weight: 700;
  color: #5a6f8a;
  white-space: nowrap;
}
.keep-song-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}
.keep-song-search {
  flex: 1 1 140px;
  min-width: 0;
  min-height: clamp(36px, 5.5vh, 42px);
  border: 2px solid #0b2e5c;
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  font-weight: 700;
  color: #0b2e5c;
  background: #fff;
}
.keep-song-sort-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  font-size: clamp(0.72rem, 1.5vh, 0.8rem);
  font-weight: 800;
  color: #5a6f8a;
}
.keep-song-sort {
  min-height: clamp(36px, 5.5vh, 42px);
  border: 2px solid #0b2e5c;
  border-radius: 10px;
  padding: 0 10px;
  font: inherit;
  font-weight: 700;
  color: #0b2e5c;
  background: #fff;
  max-width: 100%;
}
.keep-song-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}
.keep-song-empty {
  margin: 12px 4px;
  font-weight: 700;
  color: #5a6f8a;
}
.keep-song-row {
  display: grid;
  grid-template-columns: clamp(40px, 5vw, 48px) minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
}
.keep-song-row[aria-selected="true"] .keep-song-main {
  background: #e6eef8;
  border-color: #0b2e5c;
}
.keep-song-play,
.keep-song-main {
  border: 2px solid #c9d5e3;
  background: #fff;
  color: #0b2e5c;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.keep-song-play {
  width: clamp(40px, 5vw, 48px);
  min-height: clamp(40px, 6vh, 48px);
  aspect-ratio: 1;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: #15294b;
  color: #ffffff;
  font-size: clamp(0.95rem, 2vh, 1.15rem);
  line-height: 1;
  box-shadow: 0 2px 6px rgba(11, 46, 92, 0.18);
}
.keep-song-play:hover {
  background: #1c3660;
  color: #ffffff;
}
.keep-song-play.is-playing,
.keep-song-row[aria-selected="true"] .keep-song-play.is-playing {
  background: #15294b;
  color: #ffffff;
  border-color: transparent;
}
.keep-song-row[aria-selected="true"] .keep-song-play:not(.is-playing) {
  background: #15294b;
  color: #ffffff;
  border-color: transparent;
}
.keep-song-play__icon {
  display: block;
  pointer-events: none;
}
.keep-song-play__icon--play {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #ffffff;
}
.keep-song-play__icon--stop {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #ffffff;
}
.keep-song-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(6px, 1vw, 12px) clamp(8px, 1.4vw, 18px);
  min-height: clamp(40px, 6vh, 48px);
  padding: 6px clamp(8px, 1.2vw, 14px);
  text-align: left;
}
.keep-song-name {
  min-width: 0;
  line-height: 1.2;
  font-size: clamp(0.82rem, 1.7vh, 0.98rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.keep-song-bpm {
  justify-self: center;
  font-size: clamp(0.75rem, 1.5vh, 0.88rem);
  font-weight: 800;
  color: #5a6f8a;
  white-space: nowrap;
  min-width: 4.8rem;
  text-align: center;
}
.keep-song-len {
  justify-self: end;
  font-size: clamp(0.75rem, 1.5vh, 0.88rem);
  font-weight: 800;
  color: #0b2e5c;
  white-space: nowrap;
  min-width: 2.8rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.keep-song-selected {
  margin-top: 6px;
  padding: clamp(7px, 1.2vh, 10px) 12px;
  border-radius: 10px;
  background: #e6eef8;
  border: 1px solid rgba(11, 46, 92, 0.25);
  font-weight: 800;
  color: #0b2e5c;
  font-size: clamp(0.8rem, 1.6vh, 0.95rem);
  flex: 0 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.keep-beat-settings-body {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 1.1vh, 10px);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.keep-beat-settings .advanced-options-heading {
  margin: 0;
  font-size: clamp(0.78rem, 1.6vh, 0.92rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #0b2e5c;
}
.keep-beat-settings .advanced-options-body {
  padding: clamp(8px, 1.2vh, 10px) clamp(8px, 1vw, 12px);
  gap: 6px;
}
.keep-beat-settings .timing-tolerance-readout {
  margin: 0;
  font-size: clamp(0.75rem, 1.5vh, 0.85rem);
  font-weight: 800;
  color: #5a6f8a;
}
.beat-flash-size-xy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.beat-flash-size-axis-label {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(0.7rem, 1.4vh, 0.8rem);
  font-weight: 800;
  color: #5a6f8a;
}
.keep-preview-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "label label"
    "play cue";
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid rgba(11, 46, 92, 0.12);
}
.keep-preview-settings > .field-label {
  grid-area: label;
}
.keep-preview-cue {
  grid-area: cue;
  min-height: clamp(36px, 6vh, 48px);
  padding: 6px 8px;
  border-radius: 10px;
  background: #eef6ef;
  border: 1px solid rgba(47, 163, 107, 0.35);
}
.keep-preview-settings .song-preview-btn,
.keep-preview-play {
  grid-area: play;
  position: relative;
  width: clamp(44px, 6vh, 52px);
  height: clamp(44px, 6vh, 52px);
  min-height: 0;
  padding: 0;
  display: inline-grid;
  grid-auto-flow: column;
  place-items: center;
  gap: 0;
  border: none !important;
  border-radius: 12px !important;
  background: #15294b !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(11, 46, 92, 0.18) !important;
}
.keep-preview-settings .song-preview-btn:hover,
.keep-preview-play:hover {
  background: #1c3660 !important;
  color: #ffffff !important;
}
.keep-preview-settings .song-preview-btn.is-playing,
.keep-preview-settings .song-preview-btn[aria-pressed="true"] {
  background: #15294b !important;
  border: none !important;
  color: #ffffff !important;
}
.keep-preview-settings .song-preview-btn__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.keep-preview-settings .song-preview-btn__icon {
  display: block;
  line-height: 1;
}
.keep-preview-settings .song-preview-btn__icon--play {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid #ffffff;
}
.keep-preview-settings .song-preview-btn__icon--stop {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: #ffffff;
  border: none;
}

@container keep-sounds (max-width: 760px) {
  .keep-sounds-layout {
    grid-template-columns: 1fr;
    overflow: hidden;
  }
  .keep-music-browser,
  .keep-beat-settings {
    min-height: 0;
  }
  .keep-browser-body {
    grid-template-columns: 1fr;
  }
  .keep-cat-list {
    flex-direction: row;
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .keep-cat-item {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
  }
  .keep-song-list {
    max-height: none;
  }
  .keep-song-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name name"
      "bpm len";
  }
  .keep-song-name { grid-area: name; }
  .keep-song-bpm { grid-area: bpm; justify-self: start; text-align: left; min-width: 0; }
  .keep-song-len { grid-area: len; }
}

/* Fallback when container queries are unavailable (older browsers). */
@supports not (container-type: inline-size) {
  @media (max-width: 900px) {
    .keep-sounds-layout {
      grid-template-columns: 1fr;
      overflow: hidden;
    }
    .keep-browser-body {
      grid-template-columns: 1fr;
    }
    .keep-cat-list {
      flex-direction: row;
      flex-wrap: wrap;
      max-height: min(18vh, 120px);
      overflow: auto;
    }
    .keep-cat-item {
      width: auto;
      min-width: min(160px, 100%);
    }
  }
}

@media (max-width: 1100px) and (orientation: landscape) {
  .keep-sounds-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.85fr);
  }
  .keep-browser-body {
    grid-template-columns: minmax(100px, 0.36fr) minmax(0, 1fr);
  }
  .keep-song-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name name"
      "bpm len";
  }
  .keep-song-name { grid-area: name; }
  .keep-song-bpm { grid-area: bpm; justify-self: start; text-align: left; min-width: 0; }
  .keep-song-len { grid-area: len; }
}

@media (max-width: 820px) and (orientation: portrait) {
  body[data-activity-mode="keep"][data-setup-step="sounds"] {
    overflow: auto;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup {
    overflow: visible;
  }
  .setup-panel--keep-sounds {
    min-height: 0;
    overflow: visible;
  }
  .keep-sounds-layout {
    grid-template-columns: 1fr;
    overflow: visible;
    min-height: 0;
  }
  .keep-browser-body {
    grid-template-columns: 1fr;
  }
  .keep-cat-list {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
  }
  .keep-cat-item {
    width: auto;
    min-width: 140px;
  }
  .keep-song-list {
    max-height: min(42vh, 320px);
  }
  .beat-flash-size-xy {
    grid-template-columns: 1fr;
  }
  .keep-song-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name name"
      "bpm len";
  }
  .keep-song-name { grid-area: name; white-space: normal; }
  .keep-song-bpm { grid-area: bpm; justify-self: start; text-align: left; }
  .keep-song-len { grid-area: len; }
}

@media (orientation: landscape) and (max-height: 640px) {
  body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
    gap: 4px;
    padding-block: 4px;
  }
  .setup-panel--keep-sounds {
    padding: 6px 10px;
  }
  .setup-panel--keep-sounds .panel-title {
    font-size: 0.95rem;
    margin-bottom: 2px;
  }
  .keep-panel-title {
    font-size: 0.8rem;
  }
  .keep-song-play,
  .keep-song-main,
  .setup-panel--keep-sounds .audio-type-btn {
    min-height: 36px;
  }
  .keep-preview-cue {
    min-height: 28px;
  }
}

/* Keep Sounds autofit polish — any screen */
body.comic-ui[data-activity-mode="keep"][data-setup-step="sounds"] #app.page,
html[data-theme="light"] body.comic-ui[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
  gap: clamp(4px, 1vh, 10px) !important;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-height: 100vh;
  max-height: 100svh;
  max-height: 100dvh;
  max-height: var(--app-height, 100dvh);
  overflow: hidden;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] {
  overflow: hidden;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #nextBtn[hidden],
body[data-activity-mode="keep"][data-setup-step="sounds"] #nextBtn[aria-hidden="true"] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}
body[data-activity-mode="keep"][data-setup-step="sounds"] #tpbSessionData[hidden] {
  display: none !important;
}

.keep-sounds-rotate {
  display: none !important;
}
/* Portrait song picker stays usable — rotate hint is only on the activity after Start. */
@media (orientation: portrait) {
  body[data-activity-mode="keep"][data-setup-step="sounds"] {
    overflow: auto;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
    height: auto;
    max-height: none;
    min-height: 100vh;
    min-height: var(--app-height, 100dvh);
    overflow: visible;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup {
    overflow: visible;
  }
  .setup-panel--keep-sounds {
    min-height: 0;
    overflow: visible;
  }
  .keep-sounds-layout {
    grid-template-columns: 1fr;
    overflow: visible;
    min-height: 0;
    gap: 10px;
  }
  .keep-browser-body {
    grid-template-columns: 1fr;
  }
  .keep-cat-list {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    overflow: visible;
  }
  .keep-cat-item {
    width: auto;
    min-width: min(140px, 100%);
  }
  .keep-song-list {
    max-height: min(48vh, 360px);
    overflow: auto;
  }
  .keep-beat-settings-body {
    overflow: visible;
  }
  .beat-flash-size-xy {
    grid-template-columns: 1fr;
  }
}

@media (orientation: landscape) and (max-width: 900px) {
  .keep-sounds-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.9fr);
  }
  .keep-browser-body {
    grid-template-columns: minmax(110px, 0.42fr) minmax(0, 1fr);
  }
  .keep-song-bpm {
    min-width: 4.2rem;
  }
}

@media (orientation: landscape) and (max-height: 700px) {
  .keep-beat-settings-body {
    gap: 8px;
  }
  .keep-beat-settings .field-label {
    font-size: 0.78rem;
  }
  .keep-beat-settings .beat-mode-hint {
    display: none;
  }
  .keep-beat-settings .beat-mode-btn,
  .keep-beat-settings .beat-light-toggle,
  .keep-beat-settings .beat-flash-size-btn {
    min-height: 34px;
    padding-block: 4px;
  }
  .keep-beat-settings .beat-flash-swatch {
    width: 32px;
    height: 32px;
  }
  .keep-preview-cue {
    min-height: 24px;
    padding: 4px 6px;
  }
  .keep-preview-settings .song-preview-btn,
  .keep-preview-play {
    width: 36px;
    height: 36px;
    min-height: 0;
  }
  .keep-beat-settings .advanced-options-heading {
    font-size: 0.78rem;
  }
  .keep-beat-settings .advanced-options-body {
    padding: 6px 8px;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] #startBtn {
    min-height: 42px;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .setup-panel--keep-sounds .panel-title {
    display: none;
  }
  .keep-panel-head {
    margin-bottom: 2px;
  }
  .beat-flash-size-xy {
    gap: 6px;
  }
}

/* ------------------------------------------------------------
   Phone / narrow: Music Library must stack and stay usable.
   Width-based (not only orientation) so portrait phones always win.
   ------------------------------------------------------------ */
@media (max-width: 700px) {
  body[data-activity-mode="keep"][data-setup-step="sounds"] {
    overflow: auto !important;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] #app.page,
  body.comic-ui[data-activity-mode="keep"][data-setup-step="sounds"] #app.page,
  html[data-theme="light"] body.comic-ui[data-activity-mode="keep"][data-setup-step="sounds"] #app.page {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    min-height: var(--app-height, 100dvh);
    overflow: visible !important;
    gap: 8px !important;
    padding:
      calc(var(--safe-top, 0px) + 4px)
      8px
      calc(var(--safe-bottom, 0px) + 10px) !important;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup {
    overflow: visible !important;
    gap: 8px;
    min-height: 0;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .mode-setup > .hero--menu {
    margin: 0;
    padding: 0;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] #startBtn {
    min-height: 48px;
    margin-top: 4px;
  }

  .setup-panel--keep-sounds {
    min-height: 0 !important;
    overflow: visible !important;
    padding: 10px 10px 8px !important;
  }
  .setup-panel--keep-sounds .panel-title {
    font-size: 1.05rem;
    margin-bottom: 6px;
  }
  .setup-panel--keep-sounds .setup-grid {
    overflow: visible;
    min-height: 0;
  }
  .setup-panel--keep-sounds .audio-type-toggle {
    max-width: 100%;
  }
  .setup-panel--keep-sounds .audio-type-btn {
    min-height: 42px;
    font-size: 0.9rem;
    padding-inline: 8px;
  }

  .keep-sounds-layout {
    flex-direction: column;
    gap: 10px;
    overflow: visible !important;
    min-height: 0;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .keep-sounds-layout {
    display: flex !important;
  }
  .keep-music-browser,
  .keep-beat-settings {
    width: 100%;
    min-height: 0;
    overflow: visible;
    padding: 10px;
    border-radius: 12px;
  }
  .keep-panel-head {
    margin-bottom: 6px;
  }
  .keep-panel-title {
    font-size: 0.9rem;
  }

  /* Categories: one horizontal scroll row of chips */
  .keep-browser-body {
    flex-direction: column;
    gap: 8px;
    overflow: visible;
    min-height: 0;
  }
  body[data-activity-mode="keep"][data-setup-step="sounds"] .keep-browser-body {
    display: flex !important;
  }
  .keep-cat-pane {
    flex: 0 0 auto;
    overflow: visible;
  }
  .keep-pane-label {
    margin-bottom: 4px;
  }
  .keep-cat-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    max-height: none !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
  .keep-cat-item {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 0 !important;
    max-width: none;
    padding: 8px 12px;
    border-radius: 999px;
  }
  .keep-cat-item__name {
    font-size: 0.82rem;
    white-space: nowrap;
  }
  .keep-cat-item__count {
    display: none;
  }

  .keep-song-pane {
    overflow: visible;
    min-height: 0;
  }
  .keep-song-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 8px;
  }
  .keep-song-search {
    width: 100%;
    flex: none;
    min-height: 40px;
  }
  .keep-song-sort-label {
    width: 100%;
    justify-content: space-between;
  }
  .keep-song-sort {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .keep-song-list {
    max-height: min(46vh, 340px);
    min-height: 140px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .keep-song-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 6px;
  }
  .keep-song-play {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    aspect-ratio: 1;
  }
  .keep-song-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name name"
      "bpm len";
    gap: 2px 10px;
    min-height: 44px;
    padding: 8px 10px;
    align-items: center;
  }
  .keep-song-name {
    grid-area: name;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.88rem;
  }
  .keep-song-bpm {
    grid-area: bpm;
    justify-self: start;
    text-align: left;
    min-width: 0;
    font-size: 0.75rem;
  }
  .keep-song-len {
    grid-area: len;
    justify-self: end;
    min-width: 0;
    font-size: 0.75rem;
  }
  .keep-song-selected {
    white-space: normal;
    line-height: 1.25;
    font-size: 0.82rem;
  }

  .keep-beat-settings-body {
    overflow: visible;
  }
  .beat-flash-size-xy {
    grid-template-columns: 1fr;
  }
  .keep-preview-settings {
    grid-template-columns: 40px minmax(0, 1fr);
  }
}

/* Very small phones */
@media (max-width: 380px) {
  .keep-song-list {
    max-height: min(40vh, 280px);
  }
  .keep-cat-item {
    padding: 7px 10px;
  }
  .keep-song-name {
    font-size: 0.82rem;
  }
  .setup-panel--keep-sounds .audio-type-btn {
    font-size: 0.82rem;
  }
}

/* ------------------------------------------------------------
   Dark theme — Keep Music Library + Settings (readable contrast)
   Panels were hard-coded white; dark text tokens then became invisible.
   ------------------------------------------------------------ */
html[data-theme="dark"] .keep-music-browser,
html[data-theme="dark"] .keep-beat-settings {
  background: #0b1925 !important;
  border-color: #24f0ff !important;
  color: #eefcff !important;
  box-shadow: 0 0 24px rgba(36, 240, 255, 0.12);
}
html[data-theme="dark"] .keep-panel-title,
html[data-theme="dark"] .keep-song-pane-title,
html[data-theme="dark"] .keep-beat-settings .advanced-options-heading {
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-pane-label,
html[data-theme="dark"] .keep-song-pane-count,
html[data-theme="dark"] .keep-cat-item__count,
html[data-theme="dark"] .keep-song-bpm,
html[data-theme="dark"] .keep-beat-settings .timing-tolerance-readout,
html[data-theme="dark"] .keep-beat-settings .beat-mode-hint,
html[data-theme="dark"] .beat-flash-size-hint,
html[data-theme="dark"] .beat-flash-size-axis-label {
  color: #a8c0d4 !important;
}
html[data-theme="dark"] .keep-beat-settings .field-label,
html[data-theme="dark"] body.comic-ui .keep-beat-settings .field-label,
html[data-theme="dark"] .setup-panel--keep-sounds .field-label,
html[data-theme="dark"] body.comic-ui .setup-panel--keep-sounds .field-label {
  color: #d5e6f2 !important;
  text-shadow: none !important;
  font-family: inherit;
  letter-spacing: 0.02em;
}
html[data-theme="dark"] .keep-beat-settings .beat-mode-hint {
  opacity: 1;
}

html[data-theme="dark"] .keep-cat-item,
html[data-theme="dark"] .keep-song-play,
html[data-theme="dark"] .keep-song-main,
html[data-theme="dark"] .keep-beat-settings .beat-mode-btn,
html[data-theme="dark"] .keep-beat-settings .beat-light-toggle,
html[data-theme="dark"] .keep-beat-settings .beat-flash-size-btn,
html[data-theme="dark"] .setup-panel--keep-sounds .audio-type-btn {
  background: #102334 !important;
  border-color: #3a5670 !important;
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-cat-item[aria-pressed="true"],
html[data-theme="dark"] .keep-song-row[aria-selected="true"] .keep-song-main,
html[data-theme="dark"] .keep-beat-settings .beat-mode-btn[aria-pressed="true"],
html[data-theme="dark"] .keep-beat-settings .beat-light-toggle[aria-pressed="true"],
html[data-theme="dark"] .setup-panel--keep-sounds .audio-type-btn[aria-pressed="true"] {
  background: #24f0ff !important;
  border-color: #24f0ff !important;
  color: #041318 !important;
  box-shadow: none !important;
}
html[data-theme="dark"] .keep-song-play,
html[data-theme="dark"] .keep-preview-settings .song-preview-btn,
html[data-theme="dark"] .keep-preview-play {
  background: #15294b !important;
  border-color: #24f0ff !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .keep-song-name,
html[data-theme="dark"] .keep-song-len {
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-song-selected {
  background: rgba(36, 240, 255, 0.12) !important;
  border-color: rgba(36, 240, 255, 0.45) !important;
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-song-search,
html[data-theme="dark"] .keep-song-sort,
html[data-theme="dark"] .keep-beat-settings input,
html[data-theme="dark"] .keep-beat-settings select,
html[data-theme="dark"] .keep-beat-settings .advanced-options-body,
html[data-theme="dark"] .keep-beat-settings .custom-select .select-trigger {
  background: #102334 !important;
  border-color: #3a5670 !important;
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-song-search::placeholder,
html[data-theme="dark"] .keep-beat-settings input::placeholder {
  color: #8aa3b8 !important;
  opacity: 1;
}
html[data-theme="dark"] .keep-song-sort-label {
  color: #a8c0d4 !important;
}
html[data-theme="dark"] .beat-flash-size-value {
  color: #eefcff !important;
}
html[data-theme="dark"] .keep-beat-settings .beat-flash-size-btn:hover {
  background: #163247 !important;
  border-color: #24f0ff !important;
}
html[data-theme="dark"] .beat-flash-swatch {
  border-color: #3a5670 !important;
}
html[data-theme="dark"] .beat-flash-swatch[aria-pressed="true"] {
  border-color: #24f0ff !important;
  box-shadow: 0 0 0 2px #24f0ff !important;
}
html[data-theme="dark"] .beat-flash-opacity {
  accent-color: #24f0ff;
}
html[data-theme="dark"] .keep-preview-cue {
  background: #102334 !important;
  border-color: #3a5670 !important;
}
