/* =========================================
   Hazama FM mode — minimal overrides
   Layered on top of style.css
========================================= */

#fm-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: max(clamp(20px, 5vh, 48px), env(safe-area-inset-top, 0px))
           max(clamp(20px, 5vh, 48px), env(safe-area-inset-right, 0px))
           max(clamp(20px, 5vh, 48px), env(safe-area-inset-bottom, 0px))
           max(clamp(20px, 5vh, 48px), env(safe-area-inset-left, 0px));
  text-align: center;
  z-index: 10;
  /* The shell is the scroll surface: on a phone the stacked controls are
     taller than the viewport, so it must scroll and capture touch. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#fm-shell > * {
  pointer-events: auto;
}

#fm-shell h1 {
  font-size: clamp(28px, 4.6vh, 44px);
  font-weight: 600;
  letter-spacing: 0.18em;
  margin: 0 0 4px;
  color: var(--text-main);
  text-shadow: 0 0 24px rgba(125, 240, 212, 0.18);
}

#fm-shell .fm-tagline {
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--text-sub);
  text-transform: uppercase;
  margin: 0 0 14px;
  opacity: 0.78;
}

#fm_play {
  appearance: none;
  background: rgba(8, 18, 35, 0.55);
  border: 1.5px solid var(--panel-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.36em;
  padding: 22px 56px;
  border-radius: 999px;
  cursor: pointer;
  min-width: 220px;
  min-height: 64px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.4s, box-shadow 0.4s, background 0.4s, transform 0.15s;
  box-shadow: var(--shadow-soft);
}

#fm_play:hover {
  border-color: var(--accent-soft);
  background: rgba(15, 35, 60, 0.7);
}

#fm_play:active {
  transform: scale(0.98);
}

#fm_play[data-state="playing"] {
  border-color: var(--accent-glass);
  color: var(--accent-glass);
}

#fm_play[data-state="starting"],
#fm_play[data-state="stopping"] {
  font-size: 11px;
  letter-spacing: 0.18em;
  animation: fm-play-warmup 1.6s ease-in-out infinite;
}

@keyframes fm-play-warmup {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

#mandala-container {
  transition: filter 0.6s ease;
  --ident-hue: 0deg;
  --ident-saturate: 1.1;
}

#mandala-container.ident-active {
  filter: brightness(1.2) saturate(var(--ident-saturate)) hue-rotate(var(--ident-hue));
}

#mandala-container.ident-active #mandala-layers img {
  animation-play-state: running;
  animation-duration: 50s !important;
}

/* Per-genre station-ident tint. hue-rotate is cheap and works on the
   existing mint mandala. Different genres get distinguishable color casts
   while keeping the base aesthetic. */
body[data-fm-genre="any"]     #mandala-container { --ident-hue:   0deg; --ident-saturate: 1.1; }
body[data-fm-genre="ambient"] #mandala-container { --ident-hue: -40deg; --ident-saturate: 1.2; }  /* cool/water */
body[data-fm-genre="techno"]  #mandala-container { --ident-hue: 200deg; --ident-saturate: 1.6; }  /* magenta/red shift */
body[data-fm-genre="lofi"]    #mandala-container { --ident-hue:  60deg; --ident-saturate: 0.9; }  /* warm dusty */
body[data-fm-genre="jazz"]    #mandala-container { --ident-hue: 100deg; --ident-saturate: 1.0; }  /* warm gold-green */
body[data-fm-genre="funk"]    #mandala-container { --ident-hue: 150deg; --ident-saturate: 1.5; }  /* punchy orange */
body[data-fm-genre="piano"]   #mandala-container { --ident-hue: -20deg; --ident-saturate: 0.85; } /* soft blue-mint */

#fm-now {
  margin-top: clamp(28px, 5vh, 44px);
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--text-main);
  min-height: 1.4em;
  max-width: min(90vw, 540px);
  word-break: break-word;
  text-transform: lowercase;
  transition: opacity 0.22s ease;
}

#fm-now.transitioning {
  opacity: 0.18;
}

#fm-progress {
  margin: 8px auto 0;
  width: min(80vw, 320px);
  height: 2px;
  background: rgba(159, 179, 217, 0.16);
  border-radius: 999px;
  overflow: hidden;
  opacity: 0.85;
}

#fm-progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-glass));
  transition: width 0.6s linear;
  border-radius: 999px;
}

#fm-next {
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--text-sub);
  opacity: 0.7;
  min-height: 1.4em;
  text-transform: lowercase;
}

/* v194: current sectional-form "world" readout — a touch brighter than
   #fm-next so the section the listener is in is easy to spot. */
#fm-section {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--accent-soft);
  opacity: 0.82;
  min-height: 1.4em;
  text-transform: lowercase;
}

#fm-resume {
  margin-top: 16px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent-soft);
  opacity: 0.85;
}

#fm-energy {
  margin-top: clamp(28px, 4vh, 40px);
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px;
  background: rgba(8, 18, 35, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#fm-energy button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.24em;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: uppercase;
  min-width: 72px;
  min-height: 44px;
  transition: background 0.25s, color 0.25s;
}

#fm-energy button[aria-pressed="true"] {
  background: rgba(125, 240, 212, 0.18);
  color: var(--accent-glass);
}

#fm-genre {
  margin-top: 14px;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 4px;
  background: rgba(8, 18, 35, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  max-width: min(92vw, 560px);
}

#fm-genre button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.18em;
  padding: 11px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-transform: uppercase;
  min-width: 64px;
  min-height: 44px;
  transition: background 0.25s, color 0.25s;
}

#fm-genre button[aria-pressed="true"] {
  background: rgba(159, 179, 217, 0.18);
  color: var(--accent-soft);
}

/* When pill has an artist-reference caption, lay out as 2 lines. */
#fm-genre button.fm-genre--captioned {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 12px 7px;
  min-width: 64px;
  line-height: 1.15;
}

#fm-genre button .fm-genre-caption {
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  opacity: 0.62;
  font-weight: 400;
  white-space: nowrap;
}

#fm-genre button[aria-pressed="true"] .fm-genre-caption {
  opacity: 0.85;
}

#fm-audition {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
}

#fm_shuffle {
  appearance: none;
  border: 1px solid rgba(159, 179, 217, 0.26);
  background: rgba(8, 18, 35, 0.42);
  color: var(--text-sub);
  border-radius: 999px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.24em;
  min-width: 96px;
  padding: 7px 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

#fm_shuffle[aria-pressed="true"] {
  border-color: rgba(125, 240, 212, 0.4);
  background: rgba(125, 240, 212, 0.14);
  color: var(--accent-glass);
}

/* DJ set buttons (3 cross-genre arcs + stop) */
#fm-dj-set {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(94vw, 580px);
}

#fm-dj-set button {
  appearance: none;
  border: 1px solid rgba(255, 184, 122, 0.28);
  background: rgba(40, 22, 8, 0.4);
  color: rgba(255, 219, 187, 0.78);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.16em;
  padding: 10px 16px;
  min-height: 40px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

#fm-dj-set button[data-djset="stop"] {
  border-color: rgba(159, 179, 217, 0.24);
  background: rgba(8, 18, 35, 0.42);
  color: var(--text-sub);
  font-size: 10px;
  letter-spacing: 0.20em;
}

#fm-dj-set button[aria-pressed="true"] {
  border-color: rgba(255, 184, 122, 0.7);
  background: rgba(255, 184, 122, 0.16);
  color: rgba(255, 230, 200, 1);
}

#fm-dj-status {
  flex-basis: 100%;
  text-align: center;
  font-size: 10px;
  color: var(--text-sub);
  opacity: 0.8;
  margin-top: 6px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

#fm-focus-group {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
}

#fm-focus-mode {
  appearance: none;
  border: 1px solid rgba(125, 240, 212, 0.32);
  background: rgba(9, 38, 44, 0.42);
  color: rgba(196, 244, 235, 0.82);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.16em;
  padding: 8px 16px;
  min-width: 84px;
  min-height: 36px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

#fm-focus-mode:hover {
  border-color: rgba(125, 240, 212, 0.56);
  background: rgba(12, 56, 64, 0.5);
  color: rgba(236, 255, 251, 1);
}

#fm-focus-mode[aria-pressed="true"] {
  border-color: rgba(125, 240, 212, 0.68);
  background: rgba(125, 240, 212, 0.14);
  color: var(--accent-glass);
}

#fm-focus-status {
  font-size: 10px;
  color: var(--text-sub);
  opacity: 0.8;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  min-width: 48px;
}

/* fm-71: AI fill (Magenta DrumsRNN) — sits below the DJ set group with
   the same pill aesthetic but tinted purple to read as "AI/experimental". */
#fm-ai-fill-group {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
}

#fm-ai-fill {
  appearance: none;
  border: 1px solid rgba(196, 168, 255, 0.34);
  background: rgba(30, 18, 56, 0.42);
  color: rgba(228, 214, 255, 0.88);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.18em;
  padding: 8px 16px;
  min-height: 36px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.25s, border-color 0.25s, color 0.25s, opacity 0.2s;
}

#fm-ai-fill:hover:not(:disabled) {
  border-color: rgba(196, 168, 255, 0.6);
  background: rgba(60, 38, 110, 0.5);
  color: rgba(248, 240, 255, 1);
}

#fm-ai-fill:disabled {
  opacity: 0.55;
  cursor: progress;
}

#fm-ai-fill-status {
  font-size: 10px;
  color: var(--text-sub);
  opacity: 0.8;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  max-width: 200px;
}

.fm-install-btn {
  appearance: none;
  margin-top: clamp(20px, 3vh, 32px);
  border: 1px solid rgba(125, 240, 212, 0.35);
  background: rgba(125, 240, 212, 0.06);
  color: var(--accent-glass);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.24em;
  padding: 10px 22px;
  cursor: pointer;
  text-transform: lowercase;
  transition: background 0.25s, border-color 0.25s;
}

.fm-install-btn:hover {
  background: rgba(125, 240, 212, 0.12);
  border-color: var(--accent-glass);
}

.fm-install-btn[hidden] { display: none; }

/* v198: PWA install hint — a small dismissable banner at the top of the page.
   Shown only when the page is not running standalone and not previously
   dismissed (per-origin localStorage). Subtle to fit the focus aesthetic. */
.install-hint {
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(92vw, 540px);
  padding: 4px 6px 4px 10px;
  background: rgba(8, 18, 28, 0.78);
  border: 1px solid rgba(180, 200, 230, 0.22);
  border-radius: 999px;
  color: rgba(230, 240, 250, 0.92);
  font: 11px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
}
.install-hint[hidden] { display: none; }
.install-hint__toggle,
.install-hint__action,
.install-hint__dismiss {
  background: transparent;
  border: 1px solid rgba(180, 200, 230, 0.28);
  border-radius: 999px;
  color: inherit;
  font: inherit;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.install-hint__toggle { border: none; padding: 3px 4px; }
.install-hint__action { background: rgba(120, 200, 220, 0.16); }
.install-hint__dismiss { padding: 2px 8px; font-size: 13px; line-height: 1; }
.install-hint__details {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 8px 14px;
  background: rgba(8, 18, 28, 0.92);
  border: 1px solid rgba(180, 200, 230, 0.22);
  border-radius: 8px;
  font: 11px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
}
.install-hint__details[hidden] { display: none; }
.install-hint__details p { margin: 2px 0; }

/* Listening trace debug overlay — tucked in the bottom-right corner. */
#fm-trace-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 18, 35, 0.6);
  color: var(--text-sub);
  font-size: 16px;
  cursor: pointer;
  z-index: 30;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0.45;
  transition: opacity 0.25s, border-color 0.25s, background 0.25s;
}

#fm-trace-btn:hover,
#fm-trace-btn[aria-expanded="true"] {
  opacity: 1;
  border-color: var(--accent-glass);
}

#fm-trace-panel {
  position: fixed;
  right: 16px;
  bottom: 64px;
  width: min(92vw, 420px);
  max-height: min(70vh, 560px);
  background: rgba(8, 18, 35, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  color: var(--text-main);
  z-index: 31;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#fm-trace-panel[hidden] { display: none; }

#fm-trace-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

#fm-trace-panel h2 {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin: 0;
}

#fm-trace-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-sub);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

#fm-trace-close:hover { color: var(--accent-glass); }

#fm-trace-body {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  line-height: 1.4;
  color: var(--accent-soft);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: calc(70vh - 48px);
}

#fm-shuffle-status {
  min-width: 118px;
  text-align: left;
  color: var(--text-sub);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.72;
}

#fm-route {
  align-items: center;
  appearance: none;
  background: rgba(8, 18, 35, 0.38);
  border: 1px solid rgba(159, 179, 217, 0.22);
  border-radius: 999px;
  color: var(--text-sub);
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  min-height: 32px;
  padding: 0 12px;
  text-transform: lowercase;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

#fm-route:hover {
  background: rgba(15, 31, 54, 0.56);
}

#fm-route:focus-visible {
  outline: 2px solid rgba(125, 240, 212, 0.58);
  outline-offset: 3px;
}

.fm-route-dot {
  background: rgba(159, 179, 217, 0.48);
  border-radius: 999px;
  box-shadow: 0 0 0 rgba(159, 179, 217, 0);
  height: 7px;
  width: 7px;
}

#fm-route-status {
  font-size: 10px;
  letter-spacing: 0.18em;
}

#fm-route[data-route="bridge"] {
  border-color: rgba(125, 240, 212, 0.48);
  color: var(--accent-glass);
}

#fm-route[data-route="bridge"] .fm-route-dot {
  background: var(--accent-glass);
  box-shadow: 0 0 14px rgba(125, 240, 212, 0.42);
}

#fm-route[data-route="direct"] .fm-route-dot,
#fm-route[data-route="ready"] .fm-route-dot {
  background: rgba(246, 206, 137, 0.72);
}

#fm-route[data-route="failed"] {
  border-color: rgba(255, 137, 137, 0.5);
  color: rgba(255, 186, 186, 0.95);
}

#fm-route[data-route="failed"] .fm-route-dot {
  background: rgba(255, 137, 137, 0.9);
  box-shadow: 0 0 14px rgba(255, 137, 137, 0.36);
}

#fm-route-panel[hidden] {
  display: none;
}

#fm-route-panel {
  backdrop-filter: blur(18px);
  background: rgba(6, 15, 28, 0.92);
  border: 1px solid rgba(159, 179, 217, 0.24);
  border-radius: 8px;
  bottom: 78px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  color: var(--text-main);
  left: 50%;
  padding: 14px;
  position: fixed;
  text-align: left;
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 28px));
  z-index: 70;
}

.fm-route-panel-head,
.fm-route-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.fm-route-panel-head strong {
  color: var(--text-sub);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#fm-route-close,
#fm-route-rearm {
  appearance: none;
  background: rgba(7, 20, 32, 0.62);
  border: 1px solid rgba(125, 240, 212, 0.28);
  border-radius: 999px;
  color: var(--accent-glass);
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
  min-height: 28px;
  padding: 0 12px;
  text-transform: uppercase;
}

#fm-route-close {
  min-width: 32px;
  padding: 0;
}

#fm-route-rearm:disabled {
  cursor: wait;
  opacity: 0.58;
}

.fm-route-grid {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 12px 0 14px;
}

.fm-route-grid dt {
  color: var(--text-sub);
  font-size: 10px;
  letter-spacing: 0.12em;
  margin: 0;
  text-transform: uppercase;
}

.fm-route-grid dd {
  color: var(--text-main);
  font-size: 11px;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

#fm-route-rearm-status {
  color: var(--text-sub);
  flex: 1;
  font-size: 10px;
  letter-spacing: 0.12em;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  text-transform: uppercase;
}

#fm-review {
  margin-top: 10px;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#fm_sync {
  appearance: none;
  border: 1px solid rgba(125, 240, 212, 0.32);
  background: rgba(7, 20, 32, 0.52);
  color: var(--accent-glass);
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.24em;
  min-width: 88px;
  padding: 8px 18px;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.22s, border-color 0.22s, opacity 0.22s, transform 0.12s;
}

#fm_sync:hover {
  border-color: var(--accent-glass);
  background: rgba(15, 35, 60, 0.66);
}

#fm_sync:active {
  transform: scale(0.98);
}

#fm_sync:disabled {
  cursor: default;
  opacity: 0.48;
}

#fm-sync-status {
  min-height: 1.2em;
  color: var(--text-sub);
  font-size: 10px;
  letter-spacing: 0.18em;
  line-height: 1.3;
  text-transform: lowercase;
}

@media (max-width: 480px) {
  #fm-genre button {
    padding: 7px 10px;
    min-width: 0;
    font-size: 10px;
    letter-spacing: 0.16em;
  }
}

.fm-app-links {
  margin-top: clamp(18px, 3vh, 36px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.fm-app-link {
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--text-sub);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.3s;
  text-transform: lowercase;
}

.fm-app-link:hover {
  opacity: 0.95;
}

#fm-system-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(92vw, 680px);
  margin: 0 0 clamp(18px, 3vh, 30px);
}

#fm-system-map a {
  display: grid;
  gap: 2px;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid rgba(159, 179, 217, 0.22);
  border-radius: 6px;
  background: rgba(6, 15, 27, 0.42);
  color: var(--text-sub);
  text-align: left;
  text-decoration: none;
}

#fm-system-map strong {
  color: var(--accent-glass);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#fm-system-map span {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.fm-sync-caption {
  max-width: min(84vw, 420px);
  color: rgba(159, 179, 217, 0.78);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.35;
}

#fm-review {
  min-height: 70px;
}

@media (max-width: 760px), (max-height: 720px) {
  #fm-shell {
    justify-content: flex-start;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  #fm-system-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
  }

  #fm-system-map a {
    min-height: 34px;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
  }
}

@media (max-width: 420px) {
  #fm-system-map {
    grid-template-columns: 1fr;
  }
}

/* Hidden engine shim must stay invisible no matter what */
#fm-engine-shim,
#fm-engine-shim * {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0) !important;
  overflow: hidden !important;
}

/* Body data-page hook so existing style.css rules don't pull in mixer chrome */
body[data-page="fm"] #ui-shell,
body[data-page="fm"] #lang-switch,
body[data-page="fm"] #header-runtime,
body[data-page="fm"] header,
body[data-page="fm"] main#control-panel {
  display: none !important;
}

@media (max-width: 480px) {
  #fm_play {
    padding: 18px 40px;
    min-width: 180px;
    font-size: 14px;
  }
  #fm-shell h1 {
    font-size: 28px;
  }
}

/* fm-70: mic follow drum-floor (port of band-room v137).
   Compact, single-row default, slider sits below. The bar and label
   are written by engine.js updateMicFollowReadout() so the visual
   reflects MicFollowState.features.inputLevel + MicJamState.drive. */
#mic_follow_panel {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-width: min(94vw, 320px);
  margin-left: auto;
  margin-right: auto;
  padding: 8px 12px;
  border: 1px solid rgba(255, 184, 122, 0.22);
  border-radius: 10px;
  background: rgba(28, 18, 8, 0.32);
  transition: border-color 0.25s, background 0.25s, opacity 0.25s;
  opacity: 0.78;
}
#mic_follow_panel.is-active {
  opacity: 1;
  border-color: rgba(255, 184, 122, 0.5);
  background: rgba(36, 22, 10, 0.5);
}
#mic_follow_panel.is-reacting {
  border-color: rgba(255, 120, 80, 0.7);
  box-shadow: 0 0 12px rgba(255, 120, 80, 0.18);
}
#mic_follow_panel.is-error {
  border-color: rgba(255, 100, 100, 0.5);
}
.fm-mic-follow-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#fm-mic-follow-enable,
#fm-mic-follow-disable {
  appearance: none;
  background: rgba(255, 184, 122, 0.10);
  border: 1px solid rgba(255, 184, 122, 0.34);
  color: rgba(255, 219, 187, 0.90);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
#fm-mic-follow-enable:hover:not(:disabled),
#fm-mic-follow-disable:hover:not(:disabled) {
  background: rgba(255, 184, 122, 0.24);
  border-color: rgba(255, 184, 122, 0.6);
}
#fm-mic-follow-enable:disabled,
#fm-mic-follow-disable:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#mic_follow_label {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 219, 187, 0.7);
  font-variant-numeric: tabular-nums;
}
#mic_follow_panel.is-reacting #mic_follow_label {
  color: rgba(255, 180, 130, 1);
}
#mic_follow_meter {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
#mic_follow_bar {
  width: 0%;
  height: 100%;
  background: rgba(255, 184, 122, 0.6);
  transition: width 80ms linear, background 120ms linear;
}
#mic_follow_panel.is-reacting #mic_follow_bar {
  background: linear-gradient(90deg, rgba(255, 184, 122, 0.7), rgba(255, 90, 80, 0.95));
}
.fm-mic-follow-amount {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 219, 187, 0.7);
}
.fm-mic-follow-amount > span:first-child { min-width: 38px; }
.fm-mic-follow-amount input[type="range"] {
  flex: 1;
  appearance: none;
  height: 3px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 2px;
  outline: none;
}
#fm-mic-follow-amount-readout {
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 184, 122, 0.85);
}
.fm-mic-follow-help {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(255, 219, 187, 0.5);
  text-align: center;
}
