/* ==========================================================================
   Vitality Frequencies — PWA styles
   Dark premium, glass, offline (system fonts only)
   ========================================================================== */

:root {
  --bg: #0A0A0A;
  --bg-deep: #0A2A3C;

  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .08);
  --border-soft: rgba(255, 255, 255, .06);

  --text: #F2F5F7;
  --text-2: rgba(242, 245, 247, .72);
  --text-3: rgba(242, 245, 247, .5);

  --cyan: #00BCD4;
  --cyan-2: #00B4D8;
  --cyan-3: #48CAE4;
  --blue: #0077B6;
  --cyan-glow: rgba(0, 188, 212, .35);
  --cyan-glow-soft: rgba(0, 188, 212, .18);

  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --dur: 200ms;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", monospace;
}

/* ---------- Reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

/* El atributo hidden manda siempre: la app lo usa para alternar vistas e iconos,
   y cualquier display propio del componente lo anularia. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

svg { display: block; }

button, input, select {
  font-family: inherit;
  color: inherit;
  font-size: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Gate (disclaimer) ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
  background: radial-gradient(120% 120% at 50% 0%, var(--bg-deep) 0%, var(--bg) 55%);
  overflow-y: auto;
}

.gate[hidden] { display: none; }

.gate__card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.gate__title {
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  font-weight: 700;
  margin: 0 0 8px;
  background: linear-gradient(135deg, var(--cyan-3), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.gate__lead {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: .95rem;
  line-height: 1.5;
}

.gate__list {
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate__list li {
  position: relative;
  padding-left: 18px;
  color: var(--text-2);
  font-size: .85rem;
  line-height: 1.55;
}

.gate__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
}

/* ---------- Buttons (generic) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.btn:hover { background: var(--surface); border-color: rgba(255, 255, 255, .14); }
.btn:active { transform: scale(.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  border-color: transparent;
  color: #02171c;
  box-shadow: 0 4px 20px var(--cyan-glow);
}

.btn--primary:hover { box-shadow: 0 6px 26px var(--cyan-glow); }
.btn--primary:active { box-shadow: 0 2px 10px var(--cyan-glow); }

.btn--block { width: 100%; }

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- App shell ---------- */

/* Caparazon fijo a la altura de la pantalla: el unico elemento que scrollea
   es .views, para que la barra superior e inferior queden ancladas siempre. */
.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.app[hidden] { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 20px 12px;
  background: rgba(10, 10, 10, .72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__pulse {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cyan);
  animation: topbarPulse 2.4s var(--ease) infinite;
}

@keyframes topbarPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 188, 212, .55); }
  70% { box-shadow: 0 0 0 8px rgba(0, 188, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 188, 212, 0); }
}

.topbar__name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .01em;
  white-space: nowrap;
}

.topbar__name b { color: var(--text); font-weight: 700; }

.iconbtn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.9); }

.views {
  flex: 1 1 auto;
  min-height: 0; /* sin esto el hijo flexible no scrollea, se estira */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}

.view { display: none; }

.view--active {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: viewIn 260ms var(--ease);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Search ---------- */

.search {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search__field {
  position: relative;
  display: flex;
  align-items: center;
}

.search__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.search__input {
  width: 100%;
  height: 48px;
  padding: 0 48px 0 44px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .95rem;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.search__input::placeholder { color: var(--text-3); }
/* La app ya tiene su propio boton de limpiar: fuera el nativo de WebKit */
.search__input::-webkit-search-cancel-button,
.search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search__input:focus { border-color: var(--cyan); background: var(--surface-2); }

.search__clear {
  position: absolute;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 1.3rem;
  line-height: 1;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.search__clear:hover { background: var(--surface-2); color: var(--text); }
.search__clear[hidden] { display: none; }

.search__filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.search__meta {
  font-size: .8rem;
  color: var(--text-3);
  padding-left: 2px;
}

/* ---------- Form controls (select / input / range / switch) ---------- */

.select {
  height: 44px;
  width: 100%;
  padding: 0 34px 0 14px;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: .82rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='%238A9BAA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.select:focus { border-color: var(--cyan); background-color: var(--surface-2); }

.input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .95rem;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.input::placeholder { color: var(--text-3); font-family: var(--font-ui); }
.input:focus { border-color: var(--cyan); background: var(--surface-2); }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  outline: none;
  margin: 6px 0;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  box-shadow: 0 2px 12px var(--cyan-glow);
  border: none;
  cursor: pointer;
  transition: transform var(--dur) var(--ease);
}

.range::-webkit-slider-thumb:active { transform: scale(1.15); }

.range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
}

.range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  box-shadow: 0 2px 12px var(--cyan-glow);
  border: none;
  cursor: pointer;
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
  transition: transform var(--dur) var(--ease);
}

.switch:checked {
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  border-color: transparent;
}

.switch:checked::before { transform: translateX(20px); }

/* ---------- List (results / library) ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  min-height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.list__item:hover { background: var(--surface-2); border-color: var(--border); }
.list__item:active { transform: scale(.98); }

/* Boton que ocupa toda la fila: apila nombre, metadatos y frecuencias */
.list__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  color: inherit;
}

.list__main > * { max-width: 100%; }

.list__empty {
  padding: 32px 16px;
  text-align: center;
  font-size: .9rem;
  color: var(--text-3);
}

.list__name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.list__meta {
  font-size: .75rem;
  color: var(--text-3);
}

.list__freqs {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: rgba(72, 202, 228, .7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Player ---------- */

.player {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.player__placeholder {
  text-align: center;
  color: var(--text-2);
  font-size: .95rem;
  line-height: 1.6;
  padding: 64px 20px;
}

.player__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.player__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.player__sub {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 188, 212, .12);
  border: 1px solid rgba(0, 188, 212, .32);
  color: var(--cyan-3);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.iconbtn--fav[aria-pressed="true"] { color: var(--cyan); }
.iconbtn--fav[aria-pressed="true"] svg path {
  filter: drop-shadow(0 0 6px var(--cyan-glow));
}

/* ---------- Dial (frequency readout) ---------- */

.dial {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 120% at 50% 20%, rgba(0, 188, 212, .1), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
}

.dial::before {
  content: "";
  display: block;
  padding-top: 100%;
}

.dial::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, transparent, rgba(0, 188, 212, .4), transparent 30%);
  opacity: .4;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: dialSpin 9s linear infinite, dialBreathe 3.2s ease-in-out infinite;
}

@keyframes dialSpin { to { transform: rotate(360deg); } }
@keyframes dialBreathe { 0%, 100% { opacity: .3; } 50% { opacity: .6; } }

.dial__wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dial__readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.dial__hz {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 12vw, 4.5rem);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
  text-shadow: 0 0 30px var(--cyan-glow), 0 0 70px rgba(0, 188, 212, .2);
}

.dial__note {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .05em;
  color: var(--text-2);
}

/* ---------- Meter (progress) ---------- */

.meter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meter__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-2);
}

.meter__row--muted { color: var(--text-3); }

.meter__track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.meter__track--thin { height: 3px; }

.meter__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 12px var(--cyan-glow);
  transition: width 200ms linear;
}

/* ---------- Transport ---------- */

.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.transport .iconbtn {
  width: 48px;
  height: 48px;
  color: var(--text);
}

.transport .iconbtn svg { width: 24px; height: 24px; }

.playbtn {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  box-shadow: 0 8px 30px var(--cyan-glow);
  color: #02171c;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.playbtn svg { width: 30px; height: 30px; }
.playbtn:active { transform: scale(.94); }

.playbtn::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 188, 212, .5), transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.playbtn:has(#pauseIcon:not([hidden]))::before {
  opacity: 1;
  animation: playPulse 1.8s ease-in-out infinite;
}

@keyframes playPulse {
  0%, 100% { transform: scale(1); opacity: .5; }
  50% { transform: scale(1.3); opacity: 0; }
}

/* ---------- Switches / chips ---------- */

.switches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* El barrido lleva un texto mas largo: ocupa la fila entera */
.chip--wide { grid-column: 1 / -1; }

.chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 44px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.chip:active { transform: scale(.97); }

.chip__label { font-size: .85rem; font-weight: 600; color: var(--text); }
.chip__hint { font-size: .7rem; color: var(--text-3); }

.chip[aria-pressed="true"] {
  background: rgba(0, 188, 212, .14);
  border-color: rgba(0, 188, 212, .5);
  box-shadow: 0 0 0 1px rgba(0, 188, 212, .2), 0 0 20px rgba(0, 188, 212, .15);
}

.chip[aria-pressed="true"] .chip__label { color: var(--cyan-3); }
.chip[aria-pressed="true"] .chip__hint { color: rgba(72, 202, 228, .75); }

/* ---------- Freqlist (details/summary) ---------- */

.freqlist {
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  padding: 4px;
}

.freqlist__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 12px 14px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  list-style: none;
}

.freqlist__summary::-webkit-details-marker { display: none; }

.freqlist__summary::after {
  content: "\203A";
  font-size: 1.1rem;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}

.freqlist[open] .freqlist__summary::after { transform: rotate(90deg); }

.freqlist__items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px 8px;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-2);
}

.freqlist__items li { padding: 8px 10px; border-radius: 8px; }
.freqlist__items li:nth-child(odd) { background: rgba(255, 255, 255, .025); }

/* ---------- Panel (generator) ---------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.panel__title { font-size: 1.2rem; font-weight: 700; }
.panel__lead { font-size: .85rem; color: var(--text-2); line-height: 1.55; }
.panel__status { font-size: .8rem; color: var(--cyan-3); min-height: 1.2em; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.field__label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.field__row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field__row .field { min-width: 140px; }

/* ---------- Tabs (library) ---------- */

.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.tabs__btn {
  flex: 1;
  min-height: 44px;
  border-radius: calc(var(--radius-md) - 6px);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.tabs__btn--active {
  background: linear-gradient(135deg, var(--cyan-2), var(--cyan));
  color: #02171c;
  box-shadow: 0 4px 16px var(--cyan-glow);
}

/* ---------- Tabbar (bottom nav) ---------- */

.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(10, 10, 10, .72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--border-soft);
}

.tabbar__btn {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: .65rem;
  font-weight: 600;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.tabbar__btn:active { transform: scale(.95); }

.tabbar__btn--active { color: var(--cyan-3); }
.tabbar__btn--active svg { filter: drop-shadow(0 0 6px var(--cyan-glow)); }

/* ---------- Icons ---------- */

.iconbtn svg,
.tabbar__btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#playIcon path,
#pauseIcon path,
.iconbtn--stop rect,
.iconbtn--fav svg path,
.transport .iconbtn svg path,
#openSettings path {
  fill: currentColor;
  stroke: none;
}

/* ---------- Sheet (settings modal) ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet[hidden] { display: none; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(18, 24, 32, .92);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-bottom: none;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp 320ms var(--ease);
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  background: rgba(18, 24, 32, .92);
}

.sheet__title { font-size: 1.1rem; font-weight: 700; }

.sheet__foot {
  padding: 16px 0 4px;
  font-size: .72rem;
  color: var(--text-3);
  text-align: center;
}

/* ---------- Setting rows ---------- */

.setting {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-soft);
}

.setting:last-of-type { border-bottom: none; }

.setting__label { display: block; font-size: .85rem; font-weight: 600; color: var(--text); }
.setting__label b { color: var(--cyan-3); font-family: var(--font-mono); }

.setting__hint {
  display: block;
  margin-top: 4px;
  font-size: .75rem;
  line-height: 1.55;
  color: var(--text-3);
}

.setting--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- Segmented control ---------- */

.segmented {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.segmented__btn {
  flex: 1;
  min-height: 44px;
  border-radius: calc(var(--radius-sm) - 3px);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.segmented__btn--active {
  background: rgba(0, 188, 212, .16);
  color: var(--cyan-3);
  box-shadow: inset 0 0 0 1px rgba(0, 188, 212, .4);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(18, 24, 32, .92);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  color: var(--text);
  font-size: .85rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  animation: toastIn 220ms var(--ease) forwards;
}

.toast[hidden] { display: none; }

@keyframes toastIn {
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Larger viewports (up to 1200px) ---------- */

@media (min-width: 720px) {
  .views { padding-top: 28px; }
  .switches { grid-template-columns: 1fr 1fr; }
  .gate__card { padding: 40px 36px; }
}
