/* =============================================================================
   Aether by DSK — aether.css
   Built on the design-system tokens (ds-tokens.css), softened for a calm,
   spacious ambient instrument: muted neon, gentle glow, slow motion.
   The live accent is driven by JS (--accent / --accent-soft / --accent-glow).
   ========================================================================== */

:root {
  --bg-0: #0E1011;          /* deepest ambient void */
  --bg-1: #141719;
  --bg-2: #191D1F;
  --surface: #1B1F22;
  --surface-2: #21262A;
  --hair: rgba(255, 255, 255, 0.07);
  --hair-strong: rgba(255, 255, 255, 0.12);
  --txt: #EAF0EF;
  --txt-muted: #9AA3A2;
  --txt-faint: #687070;

  --accent: hsl(174, 62%, 62%);
  --accent-soft: hsla(174, 62%, 62%, 0.16);
  --accent-glow: hsla(174, 70%, 60%, 0.45);

  /* calm, ambient motion — slower than the arcade base system */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 420ms;
}

/* ---- hard event blocking (PWA / touch app behaviour) ---- */
html, body {
  margin: 0; padding: 0;
  height: 100%;
  overscroll-behavior: none;
  background: var(--bg-0);
}
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
body {
  font-family: var(--font-ui, "Chakra Petch", system-ui, sans-serif);
  color: var(--txt);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* =============================== APP SHELL =============================== */
.aether-app {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,0.025), transparent 60%),
    radial-gradient(90% 60% at 50% 115%, var(--accent-soft), transparent 65%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  padding: max(env(safe-area-inset-top), 6px) 14px max(env(safe-area-inset-bottom), 6px);
  box-sizing: border-box;
  overflow: hidden;
}

/* =============================== TOP BAR =============================== */
.aether-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
  flex-shrink: 0;
}


.aether-brand { display: flex; align-items: center; gap: 10px; }
.aether-mark {
  position: relative;
  width: 26px; height: 26px;
  display: inline-block;
}
.aether-mark .ring, .aether-mark .dot {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}
.aether-mark .ring {
  border: 1.5px solid var(--accent);
  opacity: 0.7;
}
.aether-mark .r1 { width: 24px; height: 24px; animation: breathe 6s var(--ease) infinite; }
.aether-mark .r2 { width: 14px; height: 14px; opacity: 0.5; animation: breathe 6s var(--ease) infinite 1.2s; }
.aether-mark .dot {
  width: 5px; height: 5px; background: var(--txt);
  box-shadow: 0 0 8px var(--accent-glow);
}
@keyframes breathe { 0%,100% { transform: translate(-50%,-50%) scale(1);} 50% { transform: translate(-50%,-50%) scale(1.12);} }

.aether-brand-text { display: flex; flex-direction: column; line-height: 1.05; gap: 1px; }
.aether-word {
  font-weight: 700;
  letter-spacing: 4px;
  font-size: 16px;
}
.aether-sub {
  font-size: 10px; letter-spacing: 1px;
  color: var(--txt-faint);
  text-transform: lowercase;
}
.aether-iconbtn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 14px -4px var(--accent-glow); }
.aether-iconbtn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
  font-size: 17px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 160ms var(--ease);
}
.aether-iconbtn:hover { color: var(--txt); background: var(--accent-soft); }
.aether-iconbtn:active { transform: scale(0.93); }
.aether-iconbtn.lg { font-size: 19px; }
.aether-top-actions { display: flex; align-items: center; gap: 6px; }
@media (max-width: 380px) {
  .aether-iconbtn { width: 38px; height: 38px; border-radius: 11px; }
  .aether-top-actions { gap: 5px; }
}
.aether-iconbtn.spin svg { animation: spin 0.6s var(--ease); }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* =============================== MAIN FIELD =============================== */
.aether-main { position: relative; flex: 1 1 auto; min-height: 0; }
.aether-field { position: absolute; inset: 0; }
.aether-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.aether-hint {
  position: absolute; left: 0; right: 0; bottom: -20px;
  text-align: center; pointer-events: none;
  color: var(--txt-faint);
  font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  animation: hintpulse 4s ease-in-out infinite;
}
@keyframes hintpulse { 0%,100% { opacity: 0.35;} 50% { opacity: 0.75;} }

/* =============================== TRANSPORT =============================== */
.aether-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0 4px;
  flex-shrink: 0;
  margin-top: 20px;
}
.aether-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
  font-size: 13px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  min-width: 116px;
  justify-content: center;
  transition: all var(--dur) var(--ease);
}
.aether-chip .ico { font-size: 15px; }
.aether-chip:hover { color: var(--txt); border-color: var(--hair-strong); }
.aether-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 16px -4px var(--accent-glow);
}
.aether-chip.rec { color: #FF6B6B; border-color: #FF6B6B; background: rgba(255,107,107,0.12); box-shadow: 0 0 16px -4px rgba(255,107,107,0.5); }
.aether-chip .rec-dot { color: #FF6B6B; }
.aether-chip.active.rec .rec-dot { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 0%,100% { opacity: 1;} 50% { opacity: 0.25;} }

.aether-play {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1.5px solid var(--accent);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 6px var(--accent-soft), 0 0 28px -6px var(--accent-glow);
  transition: transform 200ms var(--ease), box-shadow var(--dur) var(--ease);
}
.aether-play:hover { transform: scale(1.04); }
.aether-play:active { transform: scale(0.96); }
.aether-play.playing {
  background: var(--accent);
  color: var(--bg-0);
  box-shadow: 0 0 0 8px var(--accent-soft), 0 0 40px -4px var(--accent-glow);
  animation: playpulse 5s ease-in-out infinite;
}
@keyframes playpulse {
  0%,100% { box-shadow: 0 0 0 8px var(--accent-soft), 0 0 40px -4px var(--accent-glow); }
  50%     { box-shadow: 0 0 0 14px transparent, 0 0 56px 0px var(--accent-glow); }
}
.aether-play-glyph { font-size: 22px; line-height: 1; padding-left: 3px; letter-spacing: 1px; }
.aether-play.playing .aether-play-glyph { padding-left: 0; }

/* =============================== FOOTER =============================== */
.aether-foot {
  text-align: center;
  font-size: 11px;
  color: var(--txt-faint);
  letter-spacing: 0.5px;
  padding: 2px 0 0;
  flex-shrink: 0;
}

.aether-foot .heart { color: #FF6B6B; }
.aether-foot a { color: var(--txt-muted); border-bottom: 1px solid var(--hair-strong); padding-bottom: 1px; }
.aether-foot a:hover { color: var(--accent); }

/* =============================== SHEETS =============================== */
.aether-sheet-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8,9,10,0.55);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
  display: flex; align-items: flex-end; justify-content: center;
}
.aether-sheet-scrim.open { opacity: 1; pointer-events: auto; }
.aether-sheet {
  width: 100%; max-width: 520px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--hair);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 10px 20px max(env(safe-area-inset-bottom), 22px);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.6);
  transform: translateY(110%);
  transition: transform var(--dur) var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.aether-sheet-scrim.open .aether-sheet { transform: translateY(0); }
@media (min-width: 560px) {
  .aether-sheet-scrim { align-items: center; }
  .aether-sheet { border-radius: 22px; border-bottom: 1px solid var(--hair); }
}
.aether-sheet-handle { width: 38px; height: 4px; border-radius: 999px; background: var(--hair-strong); margin: 4px auto 12px; }
.aether-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.aether-sheet-title { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; margin: 0; }
.aether-sheet-body { padding-top: 8px; }
.aether-sheet-desc { color: var(--txt-muted); font-size: 13px; line-height: 1.5; margin: 0 0 16px; }

.aether-optgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.aether-optgrid.five { grid-template-columns: repeat(3, 1fr); }
.aether-opt {
  min-height: 52px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt);
  font-size: 14px; font-weight: 600; letter-spacing: 0.5px;
  transition: all 200ms var(--ease);
}
.aether-opt:hover { border-color: var(--hair-strong); background: rgba(255,255,255,0.06); }
.aether-opt.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 18px -6px var(--accent-glow); }

.aether-status { margin-top: 16px; text-align: center; color: var(--txt-muted); font-size: 14px; }
.aether-status strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.aether-status .pulse { color: var(--accent); animation: hintpulse 1.6s ease-in-out infinite; }

.aether-rec-live { text-align: center; }
.aether-rec-meter { color: #FF6B6B; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; font-size: 13px; }
.aether-rec-meter .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #FF6B6B; margin-right: 7px; vertical-align: middle; animation: blink 1.1s steps(2) infinite; }
.aether-rec-time { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 10px 0 18px; letter-spacing: 1px; }

/* ---- settings ---- */
.aether-set-group { margin-bottom: 22px; }
.aether-set-label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 10px; }
.aether-seg { display: inline-flex; width: 100%; background: rgba(0,0,0,0.3); border: 1px solid var(--hair); border-radius: 12px; padding: 4px; gap: 4px; }
.aether-seg-item { flex: 1; min-height: 38px; border-radius: 9px; font-size: 13px; font-weight: 600; letter-spacing: 1px; color: var(--txt-muted); transition: all 180ms var(--ease); }
.aether-seg-item.on { background: var(--accent); color: var(--bg-0); }
.aether-note { font-size: 12px; color: var(--txt-faint); margin-top: 8px; }

/* wrapping chip selector — used by Mood / Voice (timbre) */
.aether-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.aether-tag {
  min-height: 40px; padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
  font-size: 13px; font-weight: 600; letter-spacing: 0.5px;
  transition: all 180ms var(--ease);
}
.aether-tag:hover { color: var(--txt); border-color: var(--hair-strong); }
.aether-tag.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); box-shadow: 0 0 16px -6px var(--accent-glow); }
.aether-tag:active { transform: scale(0.96); }

.aether-theme-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.aether-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 4px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hair);
  transition: all 200ms var(--ease);
}
.aether-swatch .sw-ring {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--sw);
  background: radial-gradient(circle at 50% 50%, var(--sw), transparent 72%);
  box-shadow: 0 0 14px -3px var(--sw);
}
.aether-swatch .sw-name { font-size: 11px; color: var(--txt-muted); letter-spacing: 0.5px; }
.aether-swatch.on { border-color: var(--sw); background: rgba(255,255,255,0.06); }
.aether-swatch.on .sw-name { color: var(--txt); }

.aether-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.1); outline: none; }
.aether-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px -2px var(--accent-glow); cursor: pointer; }
.aether-range::-moz-range-thumb { width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--accent); cursor: pointer; }

.aether-about { font-size: 12px; line-height: 1.6; color: var(--txt-faint); margin: 16px 0 0; text-align: center; }

/* ---- presets ---- */
.aether-set-label.mt { margin-top: 22px; }
.aether-save-row { display: flex; gap: 10px; }
.aether-input {
  flex: 1; min-width: 0;
  min-height: 48px; padding: 0 16px;
  border-radius: 14px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--hair);
  color: var(--txt);
  font-family: inherit; font-size: 14px;
  user-select: text; -webkit-user-select: text;
  outline: none;
  transition: border-color 180ms var(--ease);
}
.aether-input::placeholder { color: var(--txt-faint); }
.aether-input:focus { border-color: var(--accent); }

.aether-preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.aether-preset {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 0 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt);
  text-align: left;
  transition: all 200ms var(--ease);
}
.aether-preset:hover { border-color: var(--accent); background: var(--accent-soft); }
.aether-preset .pv {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px -3px var(--accent-glow);
}
.aether-preset .pv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.aether-preset .pn { font-size: 13px; font-weight: 600; letter-spacing: 0.3px; line-height: 1.2; }

.aether-userlist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.aether-userpreset { display: flex; gap: 8px; align-items: stretch; }
.aether-userpreset .up-apply {
  flex: 1; min-height: 48px; padding: 0 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--hair);
  color: var(--txt);
  text-align: left; font-size: 14px; font-weight: 600;
  transition: all 180ms var(--ease);
}
.aether-userpreset .up-apply:hover { border-color: var(--accent); background: var(--accent-soft); }
.aether-userpreset .up-del {
  width: 48px; flex-shrink: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
  font-size: 14px;
  transition: all 180ms var(--ease);
}
.aether-userpreset .up-del:hover { color: #FF6B6B; border-color: #FF6B6B; background: rgba(255,107,107,0.1); }
.aether-userpreset .up-export {
  width: 48px; flex-shrink: 0; height: auto;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
}
.aether-userpreset .up-export:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* user-presets header row with Import action */
.aether-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.aether-label-row.mt { margin-top: 30px; }
.aether-label-row .aether-set-label { margin-bottom: 0; }
.aether-mini-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--hair);
  color: var(--txt-muted);
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  transition: all 180ms var(--ease);
}
.aether-mini-btn svg { display: block; }
.aether-mini-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.aether-mini-btn:active { transform: scale(0.96); }

/* ---- shared buttons ---- */
.aether-btn {
  min-height: 48px; padding: 0 22px; border-radius: 14px;
  font-size: 14px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 180ms var(--ease);
}
.aether-btn.wide { width: 100%; }
.aether-btn.primary { background: var(--accent); color: var(--bg-0); box-shadow: 0 0 22px -6px var(--accent-glow); }
.aether-btn.primary:hover { filter: brightness(1.08); }
.aether-btn.ghost { background: rgba(255,255,255,0.05); border: 1px solid var(--hair); color: var(--txt); }
.aether-btn.ghost:hover { border-color: var(--hair-strong); }
.aether-btn.danger { background: #FF6B6B; color: #1a0e0e; }
.aether-btn:active { transform: scale(0.97); }

/* =============================== MODAL =============================== */
.aether-modal-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8,9,10,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadein var(--dur) var(--ease);
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.aether-modal-panel {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--hair);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.65);
  animation: popin var(--dur) var(--ease);
}
@keyframes popin { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.aether-modal-panel.tone-accent { border-top: 2px solid var(--accent); }
.aether-modal-panel.tone-warn { border-top: 2px solid var(--neon-amber, #FFE66D); }
.aether-modal-title { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.aether-modal-msg { font-size: 14px; line-height: 1.55; color: var(--txt-muted); margin: 0 0 16px; }
.aether-modal-body { margin-bottom: 16px; }
.aether-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.aether-modal-actions .aether-btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}


/* Sobrescritura exclusiva para móviles en vertical */
@media (max-width: 767px) and (orientation: portrait) {

  /* En la app nativa Android anula el margen negativo,
     ya que el Kotlin ya empujó todo el WebView hacia abajo */
  .is-webview .aether-top {
    margin-top: -20px;
    margin-bottom: 10px;
  }

  .is-webview .aether-foot {
    margin-top: 20px;
    margin-bottom: -30px;
    }

}