/* ============================================================
   RILSPIK — spik.css
   Dark theme, mobile-first, sin frameworks
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
  --bg:       #0a0a0a;
  --bg2:      #111111;
  --bg3:      #191919;
  --bg4:      #222222;
  --accent:   #e8ff5a;
  --accent2:  #c8df3a;
  --text:     #f0f0f0;
  --text2:    #a8a8a8;
  --text3:    #666666;
  --muted:    #555555;
  --border:   rgba(255,255,255,0.08);
  --border2:  rgba(255,255,255,0.14);
  --radius:   12px;
  --radius-sm:8px;
  --radius-lg:20px;
  --shadow:   0 4px 24px rgba(0,0,0,0.5);
  --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.18s ease;
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }
ul, ol { list-style: none; }

/* --- Focus accesible ------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  text-decoration: none;
}

/* --- Scrollbar ------------------------------------------- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 2px; }

/* ============================================================
   TIPOGRAFÍA
   ============================================================ */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.4rem;  font-weight: 700; line-height: 1.25; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }
p  { line-height: 1.6; color: #c0c0c0; }
small { font-size: 0.88rem; color: #888888; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.page-content {
  flex: 1;
  padding: 16px max(16px, env(safe-area-inset-right)) 
           calc(64px + 32px + env(safe-area-inset-bottom)) 
           max(16px, env(safe-area-inset-left));
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   NAVEGACIÓN INFERIOR
   ============================================================ */
.nav-bottom {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: 64px;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  color: var(--text3);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color var(--transition);
  min-height: 54px;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--accent); font-weight: 600; }
.nav-item:hover { color: var(--text2); text-decoration: none; }

/* ============================================================
   TOP BAR (páginas de app)
   ============================================================ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 50;
  border-bottom: 1px solid var(--border);
  height: 56px;
}
.top-bar h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.top-bar .logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  transition: background var(--transition), color var(--transition), transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

/* Mobile: mejor feedback visual en touch */
@supports (hover: none) and (pointer: coarse) {
  .btn:active { 
    transform: scale(0.95) !important;
    opacity: 0.85;
  }
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
  min-height: 56px;
  font-size: 1.05rem;
}
.btn-primary:hover { background: var(--accent2); text-decoration: none; color: #000; }
.btn-primary:disabled { background: var(--bg4); color: var(--muted); cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: var(--bg4); text-decoration: none; color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); text-decoration: none; }

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--bg4); color: var(--text); text-decoration: none; }
.btn-icon svg { width: 20px; height: 20px; }

.btn-sm { min-height: 44px; padding: 0 16px; font-size: 0.95rem; }
.btn-accent-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-accent-outline:hover { background: rgba(232,255,90,0.08); text-decoration: none; color: var(--accent); }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 12px; }

.card-elevated {
  background: var(--bg3);
  border-color: var(--border2);
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem; /* mínimo 16px evita zoom en iOS */
  padding: 14px 16px;
  width: 100%;
  min-height: 48px;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.input:focus-visible { outline: 2px solid var(--accent); }

textarea.input { min-height: 100px; resize: vertical; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 48px; }
.input-action {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text3);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.input-action:hover { color: var(--text2); }
.input-action svg { width: 18px; height: 18px; }

.input-check { color: var(--accent); display: none; }
.input-check.visible { display: inline; }

.form-error {
  font-size: 0.85rem;
  color: #ff6b6b;
  display: none;
}
.form-error.visible { display: block; }

.select {
  background: var(--bg3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 14px 40px 14px 16px;
  width: 100%;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* ============================================================
   CHIPS / CONTEXTOS
   ============================================================ */
.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips-scroll::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--bg3);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
  cursor: pointer;
  min-height: 38px;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.chip:hover { background: var(--bg4); border-color: var(--border2); color: var(--text); }
.chip.active {
  background: rgba(232,255,90,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   BLOQUE ESPIK (frase del día + tutor)
   ============================================================ */
.espik-block {
  border-left: 3px solid var(--accent);
  padding: 16px 16px 16px 20px;
  background: rgba(232,255,90,0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 0;
}
.espik-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.espik-phrase-en {
  font-size: 0.95rem;
  color: var(--text2);
  margin-bottom: 4px;
}
.espik-phonetic {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.4;
  margin-bottom: 6px;
}
.espik-translation {
  font-size: 0.9rem;
  color: var(--text3);
}
.espik-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Dashboard frase del día (más grande) */
.daily-block .espik-phrase-en { font-size: 1rem; }
.daily-block .espik-phonetic  { font-size: 1.5rem; }
.daily-block .espik-translation { font-size: 0.95rem; }

/* ============================================================
   PANTALLA DE LECTURA FULL-SCREEN
   ============================================================ */
.read-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  text-align: center;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
.read-screen.open { transform: translateY(0); }

.read-screen .rs-en {
  font-size: 1.1rem;
  color: var(--text2);
  margin-bottom: 12px;
  max-width: 500px;
}
.read-screen .rs-phonetic {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.3;
  margin-bottom: 16px;
  max-width: 500px;
}
.read-screen .rs-translation {
  font-size: 1.1rem;
  color: var(--text3);
  margin-bottom: 40px;
}

/* ============================================================
   CHAT / TUTOR
   ============================================================ */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 56px - 64px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.55;
  font-size: 0.97rem;
  word-break: break-word;
}
.msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}
.msg-assistant {
  align-self: flex-start;
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.msg-assistant .espik-block {
  margin: 8px 0 4px;
  background: rgba(232,255,90,0.06);
}

.msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.msg-actions .btn { min-height: 34px; font-size: 0.82rem; padding: 0 12px; }

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  display: none;
  gap: 5px;
  padding: 14px 18px;
  background: var(--bg3);
  border-radius: 18px 18px 18px 4px;
  border: 1px solid var(--border);
}
.typing-indicator.visible { display: flex; }
.typing-indicator span {
  width: 7px; height: 7px;
  background: var(--text3);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(1); opacity: 0.4; }
  40%           { transform: scale(1.3); opacity: 1; }
}

/* Chat input area */
.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input-area textarea {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  resize: none;
  min-height: 48px;
  max-height: 130px;
  line-height: 1.4;
  overflow-y: auto;
}
.chat-input-area textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.chat-input-area textarea::placeholder { color: var(--muted); }

.chat-send-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent2); }
.chat-send-btn svg { width: 20px; height: 20px; }

.mic-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.mic-btn.recording {
  background: rgba(255,80,80,0.15);
  border-color: #ff5050;
  color: #ff5050;
  animation: pulse-rec 1s infinite;
}
.mic-btn svg { width: 20px; height: 20px; }

@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,80,80,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(255,80,80,0); }
}

/* Sugerencias rápidas */
.suggestions {
  display: flex;
  gap: 8px;
  padding: 8px 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.suggestions::-webkit-scrollbar { display: none; }
.suggestion-btn {
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 0.83rem;
  white-space: nowrap;
  cursor: pointer;
  min-height: 36px;
  transition: background var(--transition);
}
.suggestion-btn:hover { background: var(--bg4); color: var(--text); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-greeting {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.dash-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.tool-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tool-card:hover { background: var(--bg3); border-color: var(--border2); text-decoration: none; color: var(--text); }
.tool-card-icon { font-size: 1.5rem; }
.tool-card-name { font-size: 0.95rem; font-weight: 600; }
.tool-card-desc { font-size: 0.78rem; color: var(--text3); }

/* Week bars */
.week-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  justify-content: space-between;
  height: 64px;
  padding: 0 4px;
}
.week-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.week-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  height: 44px;
}
.week-bar {
  width: 100%;
  background: var(--bg4);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}
.week-bar.has-activity { background: var(--bg3); border: 1px solid var(--border2); }
.week-bar.today .week-bar { background: var(--accent); }
.week-day-label {
  font-size: 0.7rem;
  color: var(--text3);
  font-weight: 600;
}
.week-day.today .week-day-label { color: var(--accent); }

/* Upgrade banner */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(232,255,90,0.08), rgba(232,255,90,0.03));
  border: 1px solid rgba(232,255,90,0.25);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  text-align: center;
}
.upgrade-banner h3 { color: var(--accent); margin-bottom: 6px; }
.upgrade-banner p  { font-size: 0.9rem; margin-bottom: 14px; }

/* ============================================================
   ONBOARDING
   ============================================================ */
.onboarding-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px 40px;
  max-width: 480px;
  margin: 0 auto;
}

.progress-bar-wrap {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
}
.progress-step {
  flex: 1;
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-step.done { background: var(--accent); }
.progress-step.active {
  background: var(--bg3);
  position: relative;
}
.progress-step.active::after {
  content: '';
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 60%;
  background: var(--accent);
  border-radius: 2px;
  animation: progress-pulse 1.5s ease infinite;
}
@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

.onboarding-step { display: none; }
.onboarding-step.active { display: block; }
.onboarding-step h2 { margin-bottom: 8px; }
.onboarding-step > p { margin-bottom: 24px; }

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.option-card {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.option-card:hover { border-color: var(--border2); background: var(--bg3); }
.option-card.selected {
  border-color: var(--accent);
  background: rgba(232,255,90,0.07);
}
.option-card .opt-icon { font-size: 1.6rem; }
.option-card .opt-label { font-size: 0.9rem; font-weight: 600; }
.option-card .opt-desc  { font-size: 0.75rem; color: var(--text3); }

/* ============================================================
   PROGRESS PAGE
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label { font-size: 0.8rem; color: var(--text3); }

.phrase-list { display: flex; flex-direction: column; gap: 10px; }
.phrase-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.phrase-item-text { flex: 1; }
.phrase-item-en    { font-size: 0.95rem; font-weight: 600; margin-bottom: 3px; }
.phrase-item-ph    { font-size: 0.9rem; color: var(--accent); font-weight: 600; }
.phrase-item-tr    { font-size: 0.82rem; color: var(--text3); }
.phrase-item-actions { display: flex; gap: 6px; align-items: center; }

/* SR card */
.sr-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}
.sr-card .sr-en { font-size: 1.1rem; color: var(--text2); margin-bottom: 8px; }
.sr-card .sr-phonetic { font-size: 1.8rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.sr-card .sr-translation { font-size: 1rem; color: var(--text3); margin-bottom: 32px; }
.sr-buttons { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   WRITE ASSIST / SPIK CHECK
   ============================================================ */
.result-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  display: none;
}
.result-block.visible { display: block; }

.result-english {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.result-phonetic {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 10px;
}

.check-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 700;
}
.check-badge.correct { background: rgba(80,200,120,0.15); color: #50c878; }
.check-badge.incorrect { background: rgba(255,80,80,0.15); color: #ff6b6b; }

.error-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.error-item {
  background: rgba(255,80,80,0.07);
  border-left: 3px solid #ff6b6b;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  font-size: 0.9rem;
}
.error-original { text-decoration: line-through; color: #ff6b6b; margin-bottom: 2px; }
.error-correction { font-weight: 700; margin-bottom: 2px; }
.error-explanation { color: var(--text3); font-size: 0.85rem; }

.explanations-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.explanation-item {
  font-size: 0.9rem;
  color: var(--text2);
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
}
.explanation-item::before { content: '→ '; color: var(--accent); font-weight: 700; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.92rem;
  color: var(--text);
  white-space: nowrap;
  animation: toast-in 0.25s ease;
  pointer-events: all;
  max-width: 320px;
  text-align: center;
}
.toast.success { border-color: rgba(80,200,120,0.4); color: #50c878; }
.toast.error   { border-color: rgba(255,107,107,0.4); color: #ff6b6b; }
.toast.out     { animation: toast-out 0.25s ease forwards; }

@keyframes toast-in  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; transform:translateY(8px); } }

/* ============================================================
   UPGRADE MODAL
   ============================================================ */
#upgrade-modal {
  display: none;
  position: fixed; inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.75);
  align-items: flex-end;
  justify-content: center;
}
#upgrade-modal.open { display: flex; }
.modal-sheet {
  position: relative;
  background: var(--bg2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 32px 24px 40px;
  width: 100%;
  max-width: 480px;
  animation: sheet-up 0.3s ease;
  border: 1px solid var(--border2);
  border-bottom: none;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-sheet h2 { margin-bottom: 8px; }
.modal-sheet p  { margin-bottom: 20px; }
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  cursor: pointer;
}

/* ============================================================
   AUTH PAGES (login/register)
   ============================================================ */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 20px 40px;
  max-width: 440px;
  margin: 0 auto;
}
.auth-logo {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}
.auth-tagline { color: var(--text3); font-size: 0.95rem; margin-bottom: 32px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--text3); }
.auth-footer a { color: var(--accent); }

/* ============================================================
   HOME / LANDING
   ============================================================ */
.landing-hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  max-width: 560px;
  margin: 0 auto;
}
.landing-logo {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.05em;
  margin-bottom: 4px;
}
.landing-tagline {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text);
}
.landing-sub {
  font-size: 1.05rem;
  color: var(--text2);
  margin-bottom: 36px;
  line-height: 1.55;
}
.landing-demo {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}
.landing-cta-group { display: flex; flex-direction: column; gap: 12px; }

/* ============================================================
   PRICING
   ============================================================ */
.pricing-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  margin-bottom: 12px;
}
.pricing-card.featured {
  border-color: var(--accent);
  background: rgba(232,255,90,0.04);
}
.price-amount {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}
.price-amount span { font-size: 1rem; color: var(--text3); font-weight: 400; }
.price-features {
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.price-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text2);
}
.price-feature::before { content: '✓'; color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* ============================================================
   SPINNER / LOADING
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(10,10,10,0.7);
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  z-index: 10;
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.hidden   { display: none !important; }
.sr-only  { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-2    { gap: 8px; }
.gap-3    { gap: 12px; }
.gap-4    { gap: 16px; }
.mt-1     { margin-top: 4px; }
.mt-2     { margin-top: 8px; }
.mt-3     { margin-top: 12px; }
.mt-4     { margin-top: 16px; }
.mb-2     { margin-bottom: 8px; }
.mb-3     { margin-bottom: 12px; }
.mb-4     { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--text3); }
.text-accent { color: var(--accent); }
.w-full   { width: 100%; }
.divider  { height: 1px; background: var(--border); margin: 20px 0; }
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
}

/* ============================================================
   SCENARIOS — Grid y cards
   ============================================================ */
.scenarios-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.scenario-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 130px;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}
.scenario-card:hover { background: var(--bg3); border-color: var(--border2); text-decoration: none; }
.scenario-card.scenario-locked { opacity: 0.65; }
.scenario-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.scenario-icon { font-size: 1.8rem; line-height: 1; }
.scenario-lock-badge {
  font-size: 0.7rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 8px;
  color: var(--text3);
}
.scenario-done-badge {
  width: 22px; height: 22px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.scenario-card-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
}
.scenario-card-desc {
  font-size: 0.76rem;
  color: var(--text3);
  line-height: 1.4;
  flex: 1;
}
.scenario-progress-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}
.scenario-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
}
.scenario-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.scenario-progress-text {
  font-size: 0.7rem;
  color: var(--text3);
  white-space: nowrap;
}

/* ─── Dashboard mini-scenarios ─────────────────────────────── */
.scenarios-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.scenario-mini-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  transition: background var(--transition), border-color var(--transition);
}
.scenario-mini-card:hover { background: var(--bg3); border-color: var(--border2); text-decoration: none; }
.scenario-mini-icon { font-size: 1.4rem; }
.scenario-mini-name { font-size: 0.72rem; font-weight: 600; color: var(--text2); line-height: 1.2; }
.scenario-mini-bar {
  width: 100%;
  height: 3px;
  background: var(--bg4);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.scenario-mini-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* ─── Scenario detail — moment list ────────────────────────── */
.moment-list-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background var(--transition), border-color var(--transition);
  margin-bottom: 8px;
}
.moment-list-item:hover { background: var(--bg3); border-color: var(--border2); text-decoration: none; }
.moment-list-item.done { border-color: rgba(232,255,90,0.25); }
.moment-list-left { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }
.moment-list-num {
  width: 28px; height: 28px;
  flex-shrink: 0;
  background: var(--bg4);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text3);
}
.moment-list-num.done { background: var(--accent); color: #000; }
.moment-list-num.active { background: rgba(232,255,90,0.2); border: 1px solid var(--accent); color: var(--accent); }
.moment-list-text { flex: 1; min-width: 0; }
.moment-phrase-en  { font-size: 0.9rem; color: var(--text2); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moment-phonetic   { font-family: 'Courier New', monospace; font-size: 0.95rem; font-weight: 700; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moment-translation{ font-size: 0.8rem; color: var(--text3); }
.moment-list-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.moment-score { font-size: 0.85rem; font-weight: 700; }
.moment-diff-badge {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text3);
  white-space: nowrap;
}
.moment-diff-badge.easy   { border-color: rgba(0,230,118,0.3); color: #00e676; }
.moment-diff-badge.medium { border-color: rgba(255,170,0,0.3);  color: #ffaa00; }
.moment-diff-badge.hard   { border-color: rgba(255,77,77,0.3);  color: #ff4d4d; }

/* ============================================================
   MOMENT — Página de práctica
   ============================================================ */

/* ─── Step indicator ────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
}
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
  cursor: default;
}
.step-dot.active { background: var(--accent); border-color: var(--accent); }
.step-line {
  flex: 1;
  max-width: 48px;
  height: 2px;
  background: var(--border);
}

/* ─── Practice steps ──────────────────────────────────────── */
.practice-step { display: none; }
.practice-step.active { display: block; }

/* ─── Step 1: Listen ──────────────────────────────────────── */
.moment-espik-card {
  text-align: center;
  padding: 24px 20px;
  margin-bottom: 16px;
}
.moment-phrase-en-lg {
  font-size: 1rem;
  color: var(--text3);
  margin-bottom: 6px;
}
.moment-espik-lg {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.35;
  margin-bottom: 8px;
  word-break: break-word;
}
.moment-trans-lg {
  font-size: 1rem;
  color: var(--text2);
  margin-bottom: 4px;
}
.moment-context-note {
  font-size: 0.82rem;
  color: var(--text3);
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 12px;
  text-align: left;
}
.listen-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.listen-btn { flex: 1; }
.prev-score-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text3);
  margin-bottom: 10px;
}

/* ─── Step 2: Record ──────────────────────────────────────── */
.practice-phonetic-reminder {
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  padding: 4px 0;
}
.mic-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  position: relative;
}
.mic-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - 24px));
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(232,255,90,0.3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.mic-ring.pulsing {
  opacity: 1;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,100% { transform: translate(-50%, calc(-50% - 24px)) scale(1);   opacity: 0.5; }
  50%      { transform: translate(-50%, calc(-50% - 24px)) scale(1.18); opacity: 0.15; }
}
.mic-btn-xl {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  touch-action: manipulation;
}
.mic-btn-xl:active { transform: scale(0.93); }
.mic-btn-xl.recording { background: #ff4d4d; }
.mic-btn-xl.recording svg { stroke: #fff; }
.mic-state-label {
  font-size: 0.88rem;
  color: var(--text3);
  margin: 0;
}
.transcript-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 56px;
  font-size: 1rem;
  color: var(--text2);
  text-align: center;
  line-height: 1.5;
}
.transcript-placeholder { color: var(--text3); font-style: italic; }
.transcript-text { color: var(--text); }
.transcript-text.interim { color: var(--text3); }

/* ─── Step 3: Feedback ────────────────────────────────────── */
.score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.score-circle {
  position: relative;
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.score-svg {
  position: absolute;
  top: 0; left: 0;
  transform: rotate(-90deg);
}
.score-track {
  fill: none;
  stroke: var(--bg4);
  stroke-width: 8;
}
.score-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease, stroke 0.4s;
}
.score-number {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  position: relative;
  z-index: 1;
}
.score-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.score-said {
  font-size: 0.82rem;
  color: var(--text3);
  text-align: center;
  max-width: 280px;
}
.word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
}
.word-chip {
  padding: 5px 10px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  border: 1px solid;
}
.word-chip.ok   { background: rgba(0,230,118,0.1); border-color: rgba(0,230,118,0.35); color: #00e676; }
.word-chip.fail { background: rgba(255,77,77,0.1);  border-color: rgba(255,77,77,0.35);  color: #ff4d4d; }
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─── Confetti ────────────────────────────────────────────── */
.confetti-particle {
  position: fixed;
  top: -8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============================================================
   DESKTOP (>= 640px)
   ============================================================ */
@media (min-width: 640px) {
  html { font-size: 18px; }

  .page-content { padding: 24px 24px 100px; }

  .tools-grid { grid-template-columns: repeat(4, 1fr); }

  .option-grid { grid-template-columns: repeat(3, 1fr); }

  .chat-wrap { max-width: 680px; margin: 0 auto; }

  .read-screen .rs-phonetic { font-size: 3rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
