/* ==========================================================================
   Sonexa — Navigation overrides
   ========================================================================== */

.nav-links {
  width: min(100%, 420px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .nav-links {
    width: 100%;
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Sonexa — UI Improvements v1.1
   - Quick theme toggle in top bar
   - Hero soundwave + stats on welcome page
   - Voice card grid (replaces dropdown visually)
   - Char progress bar
   - Keyboard hint badge on generate button
   - Player waveform animation
   - Settings: speech speed slider
   - Polished footer
   - Ambient background + page transitions + focus-visible
   ========================================================================== */

/* ——— Quick theme toggle button (top bar) ——— */
.quick-theme-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
}
.quick-theme-btn:hover {
  background: var(--surface-hover);
  color: var(--accent);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.quick-theme-btn:active { transform: translateY(0); }
.quick-theme-btn .icon { transition: transform 320ms cubic-bezier(0.2, 0, 0, 1); }
.quick-theme-btn:hover .icon { transform: rotate(20deg); }

/* ——— Hero soundwave (welcome page) ——— */
.hero-soundwave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 36px;
  margin: 0 auto 24px;
}
.hero-soundwave span {
  display: block;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-glow));
  border-radius: 999px;
  opacity: 0.6;
  transform-origin: center;
  animation: sonexa-wave 1.4s ease-in-out infinite;
}
.hero-soundwave span:nth-child(1)  { animation-delay: 0ms;    height: 40%; }
.hero-soundwave span:nth-child(2)  { animation-delay: 80ms;   height: 70%; }
.hero-soundwave span:nth-child(3)  { animation-delay: 160ms;  height: 100%; }
.hero-soundwave span:nth-child(4)  { animation-delay: 240ms;  height: 60%; }
.hero-soundwave span:nth-child(5)  { animation-delay: 320ms;  height: 90%; }
.hero-soundwave span:nth-child(6)  { animation-delay: 400ms;  height: 50%; }
.hero-soundwave span:nth-child(7)  { animation-delay: 480ms;  height: 80%; }
.hero-soundwave span:nth-child(8)  { animation-delay: 560ms;  height: 100%; }
.hero-soundwave span:nth-child(9)  { animation-delay: 640ms;  height: 65%; }
.hero-soundwave span:nth-child(10) { animation-delay: 720ms;  height: 45%; }
.hero-soundwave span:nth-child(11) { animation-delay: 800ms;  height: 85%; }
.hero-soundwave span:nth-child(12) { animation-delay: 880ms;  height: 55%; }
.hero-soundwave span:nth-child(13) { animation-delay: 960ms;  height: 95%; }
.hero-soundwave span:nth-child(14) { animation-delay: 1040ms; height: 70%; }
.hero-soundwave span:nth-child(15) { animation-delay: 1120ms; height: 35%; }

@keyframes sonexa-wave {
  0%, 100% { transform: scaleY(0.55); opacity: 0.5; }
  50%      { transform: scaleY(1);    opacity: 0.95; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-soundwave span { animation: none; transform: scaleY(0.7); }
}

/* ——— Hero pills with icons ——— */
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-pill svg {
  width: 12px;
  height: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ——— Welcome stats row ——— */
.welcome-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 28px auto 0;
  padding: 16px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 480px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1.1;
}
.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
.stat-divider {
  width: 1px;
  height: 28px;
  background: var(--border-strong);
}

/* ——— Char progress bar ——— */
.char-counter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
.char-progress {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.char-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 200ms ease, background 200ms ease;
}
.char-progress-bar.is-warning { background: var(--warning); }
.char-progress-bar.is-danger  { background: var(--error); }
.char-counter-row .char-count {
  margin: 0;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ——— Voice card grid ——— */
.voice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.voice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  text-align: left;
  transition: var(--transition);
  min-height: 48px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.voice-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}
.voice-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.voice-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--surface-muted);
  color: var(--text-secondary);
}
.voice-card-icon--female { background: rgba(204, 120, 180, 0.18); color: #d96aa8; }
.voice-card-icon--male   { background: rgba(80, 140, 220, 0.18);  color: #5b9bdd; }
.voice-card.is-active .voice-card-icon {
  background: var(--accent);
  color: var(--text-inverse);
}
.voice-card-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.voice-card-name {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-card-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice-card.is-active .voice-card-desc { color: var(--accent); opacity: 0.85; }

/* Hide the native select visually but keep it accessible to JS */
.voice-select--native-hidden,
.voice-select[aria-hidden="true"] {
  display: none !important;
}

/* ——— Keyboard hint badge on generate button ——— */
.kbd-hint {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  margin-left: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-inverse);
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  line-height: 1.4;
  opacity: 0.85;
}
.btn-primary:disabled .kbd-hint { opacity: 0.5; }

/* ——— Player waveform animation ——— */
.player-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 48px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  padding: 0 12px;
  overflow: hidden;
}
.player-waveform span {
  display: block;
  width: 3px;
  height: 20%;
  background: var(--border-strong);
  border-radius: 999px;
  transition: height 200ms ease;
}
.player-waveform.is-playing span {
  background: linear-gradient(180deg, var(--accent), var(--accent-glow));
  animation: sonexa-player-wave 900ms ease-in-out infinite;
}
.player-waveform.is-playing span:nth-child(1)  { animation-delay: 0ms; }
.player-waveform.is-playing span:nth-child(2)  { animation-delay: 60ms; }
.player-waveform.is-playing span:nth-child(3)  { animation-delay: 120ms; }
.player-waveform.is-playing span:nth-child(4)  { animation-delay: 180ms; }
.player-waveform.is-playing span:nth-child(5)  { animation-delay: 240ms; }
.player-waveform.is-playing span:nth-child(6)  { animation-delay: 300ms; }
.player-waveform.is-playing span:nth-child(7)  { animation-delay: 360ms; }
.player-waveform.is-playing span:nth-child(8)  { animation-delay: 420ms; }
.player-waveform.is-playing span:nth-child(9)  { animation-delay: 480ms; }
.player-waveform.is-playing span:nth-child(10) { animation-delay: 540ms; }
.player-waveform.is-playing span:nth-child(11) { animation-delay: 600ms; }
.player-waveform.is-playing span:nth-child(12) { animation-delay: 660ms; }
.player-waveform.is-playing span:nth-child(13) { animation-delay: 720ms; }
.player-waveform.is-playing span:nth-child(14) { animation-delay: 780ms; }
.player-waveform.is-playing span:nth-child(15) { animation-delay: 840ms; }
.player-waveform.is-playing span:nth-child(16) { animation-delay: 900ms; }
.player-waveform.is-playing span:nth-child(17) { animation-delay: 960ms; }
.player-waveform.is-playing span:nth-child(18) { animation-delay: 1020ms; }
.player-waveform.is-playing span:nth-child(19) { animation-delay: 1080ms; }
.player-waveform.is-playing span:nth-child(20) { animation-delay: 1140ms; }

@keyframes sonexa-player-wave {
  0%, 100% { height: 20%; }
  50%      { height: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .player-waveform.is-playing span { animation: none; height: 60%; }
}

/* ——— Polished footer ——— */
.settings-item-control--slider {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}
.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 999px;
  outline: none;
  cursor: not-allowed;
}
.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: not-allowed;
}
.speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  cursor: not-allowed;
}
.speed-slider:disabled { opacity: 0.55; }
.speed-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: right;
}

/* ——— Polished footer ——— */
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}
.footer-row--muted { font-size: 12px; }
.footer-brand {
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: -0.02em;
}
.footer-sep { color: var(--text-tertiary); opacity: 0.6; }
.footer-link {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: var(--transition);
  font: inherit;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.footer-link:hover {
  color: var(--accent);
  text-decoration: none;
}
.footer-link--btn { display: inline-flex; align-items: center; }

/* ——— Ambient background blobs (welcome page) ——— */
.welcome-shell {
  position: relative;
  overflow: hidden;
}
.welcome-shell::before,
.welcome-shell::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
  animation: sonexa-blob 18s ease-in-out infinite;
}
.welcome-shell::before {
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
}
.welcome-shell::after {
  bottom: -120px;
  right: -80px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  animation-delay: -9s;
}
@keyframes sonexa-blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.05); }
  66%      { transform: translate(-30px, 40px) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .welcome-shell::before,
  .welcome-shell::after { animation: none; }
}

/* ——— Page transition (fade-in) ——— */
.page.active {
  animation: sonexa-page-in 280ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes sonexa-page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .page.active { animation: none; }
}

/* ——— Better focus-visible states (keyboard accessibility) ——— */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible,
.nav-link:focus-visible,
.theme-btn:focus-visible,
.voice-card:focus-visible,
.quick-theme-btn:focus-visible,
.btn-icon-only:focus-visible,
.spoiler-card summary:focus-visible,
.settings-link-btn:focus-visible,
.navbar-footer-link:focus-visible,
.footer-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.text-input:focus-visible,
.voice-select:focus-visible {
  outline: none; /* keep existing box-shadow focus */
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .quick-theme-btn { width: 36px; height: 36px; }

  .hero-soundwave { height: 28px; gap: 3px; margin-bottom: 18px; }
  .hero-soundwave span { width: 2px; }

  .welcome-stats {
    gap: 12px;
    padding: 12px 16px;
    max-width: 100%;
  }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 10px; }
  .stat-divider { height: 22px; }

  .voice-grid { grid-template-columns: 1fr; gap: 6px; }

  .kbd-hint { display: none; }

  .player-waveform { height: 36px; gap: 2px; }
  .player-waveform span { width: 2px; }

  .settings-item-control--slider { min-width: 0; width: 100%; }
  .speed-slider { flex: 1; width: auto; }

  .footer-row { font-size: 12px; gap: 6px; }
  .footer-row--muted { font-size: 11px; }
}

@media (max-width: 400px) {
  .welcome-stats { padding: 10px 12px; gap: 10px; }
  .stat-value { font-size: 16px; }
}

/* ==========================================================================
   Sonexa — v1.2 Animation pack
   Beautiful, tasteful motion across the whole interface
   ========================================================================== */

/* ——— Top bar: slide-down on load ——— */
.top-bar {
  animation: sonexa-slide-down 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sonexa-slide-down {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ——— Logo mark: animated gradient sheen ——— */
.logo-mark {
  position: relative;
  overflow: hidden;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sonexa-logo-sheen 4.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sonexa-logo-sheen {
  0%, 70% { transform: translateX(-120%); }
  85%     { transform: translateX(120%); }
  100%    { transform: translateX(120%); }
}
.top-bar-brand:hover .logo-mark::after {
  animation-duration: 1.6s;
}

/* ——— Beta badge: subtle pulse ——— */
.beta-badge {
  animation: sonexa-beta-pulse 2.4s ease-in-out infinite;
}
@keyframes sonexa-beta-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { box-shadow: 0 0 0 4px transparent; }
}

/* ——— Hamburger: subtle hover wobble ——— */
.hamburger-btn:hover span {
  background: var(--accent);
}
.hamburger-btn:hover span:nth-child(1) { transform: translateY(-1px); }
.hamburger-btn:hover span:nth-child(3) { transform: translateY(1px); }

/* ——— Quick theme toggle: spinning icon on click ——— */
.quick-theme-btn.is-spinning .icon {
  animation: sonexa-spin-once 480ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sonexa-spin-once {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* ——— Welcome: floating soundwave container ——— */
.hero-soundwave {
  animation: sonexa-float 6s ease-in-out infinite;
}
@keyframes sonexa-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* ——— Welcome stats: glassy entrance + counter shimmer ——— */
.welcome-stats {
  animation: sonexa-rise-in 600ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 320ms;
  position: relative;
  overflow: hidden;
}
.welcome-stats::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sonexa-shimmer 5s ease-in-out infinite;
  animation-delay: 1s;
  pointer-events: none;
}
@keyframes sonexa-shimmer {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.stat-value {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: transform 200ms ease;
}
.stat-item:hover .stat-value {
  transform: scale(1.1);
}

/* ——— Hero pills: bounce-in + hover lift ——— */
.hero-pill {
  animation: sonexa-pill-in 500ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.hero-pill:nth-child(1) { animation-delay: 380ms; }
.hero-pill:nth-child(2) { animation-delay: 460ms; }
.hero-pill:nth-child(3) { animation-delay: 540ms; }
@keyframes sonexa-pill-in {
  from { opacity: 0; transform: translateY(8px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.hero-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.hero-pill:hover svg {
  transform: scale(1.15) rotate(-5deg);
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ——— Spoiler cards: smooth expand/collapse ——— */
.spoiler-card {
  animation: sonexa-rise-in 500ms cubic-bezier(0.2, 0, 0, 1) both;
}
.spoiler-card:nth-of-type(1) { animation-delay: 540ms; }
.spoiler-card:nth-of-type(2) { animation-delay: 620ms; }
.spoiler-card:nth-of-type(3) { animation-delay: 700ms; }
.spoiler-card summary {
  transition: color 200ms ease;
}
.spoiler-card:hover summary { color: var(--accent); }
.spoiler-card summary::after {
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.spoiler-card[open] summary::after {
  transform: rotate(180deg);
}
.spoiler-card p {
  animation: sonexa-spoiler-text 360ms ease both;
}
@keyframes sonexa-spoiler-text {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ——— Voice cards: stagger entrance + 3D tilt hover ——— */
.voice-card {
  animation: sonexa-card-in 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  position: relative;
  overflow: hidden;
}
.voice-card:nth-child(1) { animation-delay: 80ms; }
.voice-card:nth-child(2) { animation-delay: 130ms; }
.voice-card:nth-child(3) { animation-delay: 180ms; }
.voice-card:nth-child(4) { animation-delay: 230ms; }
.voice-card:nth-child(5) { animation-delay: 280ms; }
.voice-card:nth-child(6) { animation-delay: 330ms; }
.voice-card:nth-child(7) { animation-delay: 380ms; }
.voice-card:nth-child(8) { animation-delay: 430ms; }
.voice-card:nth-child(9) { animation-delay: 480ms; }
@keyframes sonexa-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.voice-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
              var(--accent-soft), transparent 60%);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
.voice-card:hover::before { opacity: 1; }
.voice-card.is-active {
  animation: sonexa-card-pulse 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sonexa-card-pulse {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
  50%  { transform: scale(1.04); box-shadow: 0 0 0 6px transparent; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}

/* ——— Generate button: animated gradient + loading spinner + ripple ——— */
.btn-primary {
  background-size: 200% 200%;
  background-image: linear-gradient(120deg, var(--accent), var(--accent-hover), var(--accent));
  background-position: 0% 50%;
  animation: sonexa-btn-gradient 4s ease infinite;
  position: relative;
  overflow: hidden;
}
@keyframes sonexa-btn-gradient {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
  transform: translateX(-100%);
  pointer-events: none;
}
.btn-primary:hover::after {
  animation: sonexa-btn-shine 800ms ease;
}
@keyframes sonexa-btn-shine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
/* Ripple on click */
.btn-primary.is-rippling {
  animation: sonexa-btn-gradient 4s ease infinite, sonexa-btn-press 240ms ease;
}
@keyframes sonexa-btn-press {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
/* Loading spinner state */
.btn-primary.is-loading .icon {
  animation: sonexa-spin 800ms linear infinite;
}
.btn-primary.is-loading .btn-arrow {
  animation: sonexa-arrow-bounce 1.2s ease-in-out infinite;
}
@keyframes sonexa-spin {
  to { transform: rotate(360deg); }
}
@keyframes sonexa-arrow-bounce {
  0%, 100% { transform: translateX(0); opacity: 0.85; }
  50%      { transform: translateX(4px); opacity: 1; }
}

/* ——— Char progress bar: glowing fill at high values ——— */
.char-progress-bar {
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--accent), var(--accent-hover));
  box-shadow: 0 0 0 0 transparent;
  transition: width 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
              background 200ms ease,
              box-shadow 280ms ease;
}
.char-progress-bar.is-warning {
  background-image: linear-gradient(90deg, var(--warning), var(--accent));
  box-shadow: 0 0 8px var(--warning);
  animation: sonexa-pulse-soft 1.4s ease-in-out infinite;
}
.char-progress-bar.is-danger {
  background-image: linear-gradient(90deg, var(--error), var(--warning));
  box-shadow: 0 0 12px var(--error);
  animation: sonexa-pulse-soft 0.9s ease-in-out infinite;
}
@keyframes sonexa-pulse-soft {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

/* ——— Status messages: slide-in between states ——— */
.status {
  animation: sonexa-status-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: background 200ms ease, border-color 200ms ease;
}
@keyframes sonexa-status-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.status.busy .status-icon {
  animation: sonexa-spin 1200ms linear infinite;
}
.status.success .status-icon {
  animation: sonexa-pop 380ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.status.error .status-icon {
  animation: sonexa-shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
@keyframes sonexa-pop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}
@keyframes sonexa-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

/* ——— Settings: staggered entrance + hover lift ——— */
.settings-item {
  animation: sonexa-rise-in 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.settings-item:nth-child(1) { animation-delay: 80ms; }
.settings-item:nth-child(2) { animation-delay: 160ms; }
.settings-item:nth-child(3) { animation-delay: 240ms; }
.settings-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.settings-item-icon {
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.settings-item:hover .settings-item-icon {
  transform: scale(1.1) rotate(-5deg);
}

/* ——— Theme buttons: pop-in active state ——— */
.theme-btn {
  transition: all 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-btn.is-active {
  animation: sonexa-pop 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ——— About cards: staggered entrance + hover lift ——— */
.about-card {
  animation: sonexa-rise-in 500ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.about-card:nth-child(1) { animation-delay: 80ms; }
.about-card:nth-child(2) { animation-delay: 160ms; }
.about-card:nth-child(3) { animation-delay: 240ms; }
.about-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.about-card h2 {
  position: relative;
  display: inline-block;
}
.about-card h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.about-card:hover h2::after { width: 100%; }

/* ——— Sidebar: staggered nav items when opening ——— */
.navbar.is-open .nav-link,
.navbar.is-open .nav-group-title {
  animation: sonexa-nav-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.navbar.is-open .nav-group-title:nth-of-type(1) { animation-delay: 60ms; }
.navbar.is-open .nav-group:nth-child(1) .nav-link:nth-child(2) { animation-delay: 100ms; }
.navbar.is-open .nav-group:nth-child(1) .nav-link:nth-child(3) { animation-delay: 140ms; }
.navbar.is-open .nav-group:nth-child(1) .nav-link:nth-child(4) { animation-delay: 180ms; }
.navbar.is-open .nav-group:nth-child(1) .nav-link:nth-child(5) { animation-delay: 220ms; }
.navbar.is-open .nav-group:nth-child(2) .nav-group-title { animation-delay: 260ms; }
.navbar.is-open .nav-group:nth-child(2) .nav-link:nth-child(2) { animation-delay: 300ms; }
.navbar.is-open .nav-group:nth-child(2) .nav-link:nth-child(3) { animation-delay: 340ms; }
@keyframes sonexa-nav-in {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ——— Footer: fade-up + heartbeat on heart ——— */
.footer {
  animation: sonexa-rise-in 600ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: 200ms;
}
.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.footer-brand {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-link--btn {
  position: relative;
}
.footer-link--btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 240ms ease;
}
.footer-link--btn:hover::after { width: 100%; }

/* ——— Service steps: staggered entrance ——— */
.service-step {
  animation: sonexa-rise-in 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.service-step:nth-child(1) { animation-delay: 100ms; }
.service-step:nth-child(2) { animation-delay: 180ms; }
.service-step:nth-child(3) { animation-delay: 260ms; }
.service-step strong {
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.service-step:hover strong {
  transform: scale(1.15) rotate(-10deg);
}

/* ——— Coming-soon badges: shimmer ——— */
.coming-soon {
  position: relative;
  overflow: hidden;
}
.coming-soon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sonexa-shimmer 3s ease-in-out infinite;
  animation-delay: 1.2s;
}

/* ——— Player section: reveal animation when shown ——— */
.player-section {
  animation: sonexa-player-reveal 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sonexa-player-reveal {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ——— Page transition: more pronounced fade + scale ——— */
.page.active {
  animation: sonexa-page-in 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ——— Easter egg: floating heart ——— */
.easter-egg:hover {
  animation: sonexa-wiggle 600ms ease-in-out;
}
@keyframes sonexa-wiggle {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-8deg); }
  75%      { transform: rotate(8deg); }
}

/* ——— Reveal-on-scroll utility (used by JS IntersectionObserver) ——— */
.sonexa-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sonexa-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Reduced motion: disable all non-essential animations
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-soundwave,
  .welcome-stats,
  .logo-mark::after,
  .beta-badge,
  .coming-soon::after,
  .btn-primary,
  .char-progress-bar.is-warning,
  .char-progress-bar.is-danger {
    animation: none !important;
  }
  .sonexa-reveal {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Mobile tweaks: simplify heavy animations
   ========================================================================== */
@media (max-width: 768px) {
  .top-bar { animation-duration: 320ms; }
  .voice-card { animation-duration: 320ms; }
  .logo-mark::after { animation-duration: 6s; }
  .welcome-stats::after { display: none; }
}

/* ==========================================================================
   Sonexa Assistant — floating chat widget v1.3
   ========================================================================== */

/* Floating Action Button (FAB) */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 900;
  box-shadow:
    0 8px 24px var(--accent-glow),
    0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 240ms ease;
  animation: chat-fab-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 800ms;
}
@keyframes chat-fab-in {
  from { opacity: 0; transform: translateY(20px) scale(0.5); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-fab:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 12px 32px var(--accent-glow),
    0 6px 16px rgba(0, 0, 0, 0.3);
}
.chat-fab:active { transform: translateY(-1px) scale(1.02); }
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab-icon-close { display: none !important; }
.chat-fab.is-open .chat-fab-icon-open { display: none !important; }
.chat-fab.is-open .chat-fab-icon-close { display: block !important; }

/* Pulse ring вокруг FAB */
.chat-fab-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  pointer-events: none;
  animation: chat-fab-pulse 2.4s ease-out infinite;
}
.chat-fab.is-open .chat-fab-pulse { display: none; }
@keyframes chat-fab-pulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(1.6); opacity: 0;   }
}

/* Chat panel */
.chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 130px);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  z-index: 901;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 240ms cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.chat-header-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.chat-header-icon svg { width: 20px; height: 20px; }
.chat-header-titles { min-width: 0; flex: 1; }
.chat-header-chat-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.chat-header-model { margin-top: 2px; }
.chat-model-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* Switcher toggle (">" pointing down) */
.chat-switcher-toggle {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-switcher-toggle:hover {
  background: var(--surface-hover);
  color: var(--accent);
  border-color: var(--border-strong);
}
.chat-switcher-toggle svg { width: 16px; height: 16px; }
.chat-switcher-toggle.is-open svg {
  transform: rotate(180deg);
}
.chat-switcher-toggle svg { transition: transform 240ms cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Switcher dropdown */
.chat-switcher {
  position: absolute;
  top: 64px;
  left: 12px;
  right: 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 6px;
  z-index: 3;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 320px;
  overflow-y: auto;
}
.chat-switcher.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.chat-new-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  cursor: pointer;
  transition: var(--transition);
}
.chat-new-btn:hover {
  background: var(--accent-glow);
}
.chat-new-btn svg { width: 14px; height: 14px; }
.chat-switcher-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  min-height: 40px;
}
.chat-list-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.chat-list-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.chat-list-item-icon { flex-shrink: 0; opacity: 0.7; }
.chat-list-item-icon svg { width: 14px; height: 14px; }
.chat-list-item-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item-delete {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}
.chat-list-item:hover .chat-list-item-delete { opacity: 1; }
.chat-list-item-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
}
.chat-list-item-delete svg { width: 12px; height: 12px; }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: var(--bg);
}
.chat-message {
  display: flex;
  gap: 10px;
  animation: chat-msg-in 320ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-width: 100%;
}
@keyframes chat-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.chat-message-user .chat-message-avatar {
  background: var(--surface-muted);
  color: var(--text-secondary);
}
.chat-message-assistant .chat-message-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
}
.chat-message-content {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.chat-message-user .chat-message-content {
  background: var(--accent-soft);
  border-top-left-radius: 4px;
}
.chat-message-assistant .chat-message-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.chat-message-content.is-streaming::after {
  content: "▋";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  animation: chat-cursor 800ms ease-in-out infinite;
}
@keyframes chat-cursor {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

/* Empty state / welcome */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 24px;
  color: var(--text-tertiary);
  gap: 12px;
}
.chat-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.chat-empty-icon svg { width: 24px; height: 24px; }
.chat-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.chat-empty-text {
  font-size: 13px;
  line-height: 1.5;
  max-width: 260px;
}
.chat-empty-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}
.chat-suggestion-btn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.chat-suggestion-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Form / input */
.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  max-height: 120px;
  min-height: 42px;
  font-family: inherit;
  transition: var(--transition);
}
.chat-input::placeholder { color: var(--text-tertiary); }
.chat-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.chat-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.chat-send:active:not(:disabled) { transform: translateY(0); }
.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}
.chat-send svg { width: 18px; height: 18px; }

/* Stop button (заменяет send во время стриминга) */
.chat-stop {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--error);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.chat-stop:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: var(--error);
  transform: translateY(-1px);
}
.chat-stop:active { transform: translateY(0); }
.chat-stop svg { width: 16px; height: 16px; }

/* Loading dots for waiting state */
.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: chat-typing 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 150ms; }
.chat-typing span:nth-child(3) { animation-delay: 300ms; }
@keyframes chat-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* Footer hint */
.chat-footer-hint {
  padding: 6px 12px 8px;
  font-size: 10px;
  color: var(--text-tertiary);
  text-align: center;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 768px) {
  .chat-fab {
    width: 52px;
    height: 52px;
    bottom: 16px;
    right: 16px;
  }
  .chat-fab svg { width: 22px; height: 22px; }
  .chat-panel {
    bottom: 80px;
    right: 8px;
    left: 8px;
    width: auto;
    height: calc(100vh - 100px);
    max-height: 600px;
    border-radius: 16px;
  }
  .chat-footer-hint { display: none; }
}

@media (max-width: 400px) {
  .chat-panel {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .chat-panel.is-open {
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-fab,
  .chat-fab-pulse,
  .chat-message,
  .chat-message-content.is-streaming::after,
  .chat-typing span {
    animation: none !important;
  }
}

/* ==========================================================================
   Sonexa ASR — speech-to-text page
   ========================================================================== */

/* Panel grid для ASR — как в TTS, но с другой структурой */
.asr-panel-grid {
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* Drag & Drop area */
.asr-dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--surface);
  margin-bottom: 16px;
  outline: none;
}
.asr-dropzone:hover,
.asr-dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.asr-dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.asr-dropzone.is-loading {
  opacity: 0.6;
  pointer-events: none;
}
.asr-dropzone.has-file {
  border-color: var(--success);
  border-style: solid;
  background: rgba(34, 197, 94, 0.05);
}

.asr-dropzone-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-tertiary);
  display: grid;
  place-items: center;
}
.asr-dropzone-icon svg { width: 100%; height: 100%; }
.asr-dropzone:hover .asr-dropzone-icon,
.asr-dropzone.is-dragover .asr-dropzone-icon {
  color: var(--accent);
  animation: asr-bounce 600ms ease;
}
@keyframes asr-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.asr-dropzone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.asr-dropzone-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.asr-dropzone-hint {
  font-size: 11px;
  color: var(--text-tertiary);
}
.asr-dropzone-filename {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  word-break: break-all;
}

/* Record button row */
.asr-record-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.asr-preview {
  flex: 1;
  min-width: 200px;
  max-width: 100%;
  height: 42px;
}
.asr-preview:not([style*="display: none"]) {
  display: block !important;
}

#asr-record-btn.is-recording {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--error);
  color: var(--error);
  animation: asr-record-pulse 1.4s ease-in-out infinite;
}
@keyframes asr-record-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}
#asr-record-btn.is-recording .icon {
  animation: asr-record-blink 1s ease-in-out infinite;
}
@keyframes asr-record-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Result section */
.asr-result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: sonexa-player-reveal 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.asr-result-text {
  min-height: 120px;
  max-height: 320px;
  overflow-y: auto;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
}
.asr-result-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.asr-result-text:empty::before {
  content: "Здесь появится распознанный текст...";
  color: var(--text-tertiary);
}

/* Mobile */
@media (max-width: 768px) {
  .asr-panel-grid { grid-template-columns: 1fr; gap: 16px; }
  .asr-dropzone { padding: 24px 16px; }
  .asr-dropzone-icon { width: 40px; height: 40px; }
  .asr-record-row { flex-direction: column; align-items: stretch; }
  .asr-preview { width: 100%; }
  .asr-result-text { min-height: 100px; max-height: 240px; font-size: 13px; }
}
