/* Curio — estilos extraídos del canvas design/Curio.dc.html */
:root {
  --bg: #161826;
  --card: #232532;
  --card-active: #292b3d;
  --accent: #9184d9;
  --accent-soft: rgba(145, 132, 217, .12);
  --accent-light: #d2cefd;
  --text: #e9e9ed;
  --muted: rgba(233, 233, 237, .55);
  --faint: rgba(233, 233, 237, .45);
  --border: rgba(233, 233, 237, .16);
  --border-soft: rgba(233, 233, 237, .08);
  --danger: #d9848c;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
button { font-family: inherit; cursor: pointer; }
textarea {
  width: 100%; background: transparent; border: none; outline: none; resize: none;
  color: var(--text); font-family: inherit; font-size: 16px; line-height: 1.5;
}
.hidden { display: none !important; }
.accent { color: var(--accent); }
.danger { color: var(--danger); }

.view { height: 100dvh; display: flex; flex-direction: column; min-height: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes fill { from { width: 0; } to { width: 100%; } }

.spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite; display: inline-block;
}
.spinner.small { width: 14px; height: 14px; }

/* ══════ HOME ══════ */
.home-header { display: flex; align-items: center; gap: 9px; padding: 18px 20px 12px; }
.home-header i { font-size: 23px; }
.app-name { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; }

.ask-card {
  margin: 0 16px; background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 14px 10px;
}
.ask-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 6px; }

.rec-row { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s ease-in-out infinite; }
.rec-time { font-size: 15px; font-variant-numeric: tabular-nums; }
.rec-hint { font-size: 13px; color: var(--muted); }

.mic-btn {
  width: 48px; height: 48px; border-radius: 50%; background: transparent;
  border: 1px solid var(--accent); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.mic-btn.recording { background: rgba(217, 132, 140, .18); border-color: var(--danger); color: var(--danger); }
.mic-btn.busy { opacity: .5; pointer-events: none; }

.pill-btn {
  min-height: 44px; padding: 10px 18px; border-radius: 999px; background: transparent;
  border: 1px solid var(--accent); color: var(--accent);
  font-size: 14.5px; font-weight: 500; display: flex; align-items: center; gap: 7px;
}
.pill-btn:active { background: var(--accent-soft); }
.pill-btn.dim { border-color: var(--border); color: var(--muted); }
.pill-btn.danger { border-color: var(--danger); color: var(--danger); }

.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px 32px; text-align: center;
}
.empty > i { font-size: 36px; margin-bottom: 4px; }
.empty-title { font-size: 18px; font-weight: 500; }
.empty-sub { font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 270px; }
.examples { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; width: 100%; }
.example {
  min-height: 44px; padding: 10px 14px; border-radius: 8px; background: var(--card);
  border: 1px solid var(--border); color: rgba(233, 233, 237, .8);
  font-size: 13.5px; text-align: left;
}

.topic-list { flex: 1; overflow-y: auto; padding: 6px 16px 24px; display: flex; flex-direction: column; gap: 4px; }
.day-label {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); padding: 16px 4px 8px;
}
.topic-item {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: 8px; padding: 13px 14px;
  cursor: pointer; min-height: 44px; margin-bottom: 8px; user-select: none; -webkit-user-select: none;
}
.topic-item:active { background: var(--card-active); }
.topic-item > i { font-size: 20px; flex: none; }
.topic-item .t-main { flex: 1; min-width: 0; }
.topic-item .t-title { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-item .t-title.dim { color: rgba(233, 233, 237, .65); font-style: italic; }
.topic-item .t-sub { font-size: 12.5px; color: rgba(233, 233, 237, .5); margin-top: 2px; }
.retry-btn {
  min-height: 36px; padding: 7px 12px; border-radius: 8px; background: transparent;
  border: 1px solid rgba(233, 233, 237, .25); color: rgba(233, 233, 237, .75); font-size: 12.5px;
}

/* ══════ SESIÓN ══════ */
.ses-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px 6px; }
.ses-title {
  flex: 1; min-width: 0; text-align: center; font-size: 16px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.round-btn {
  width: 44px; height: 44px; border-radius: 50%; background: transparent;
  border: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex: none;
}
.round-btn.ghost { border: none; pointer-events: none; }
.round-btn.small { width: 36px; height: 36px; font-size: 15px; color: rgba(233, 233, 237, .7); }
.round-btn.big { width: 52px; height: 52px; font-size: 20px; }
.round-btn:active { border-color: var(--accent); color: var(--accent); }

.counter-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 0 2px; }
.counter { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.part-chip {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--accent-light);
  background: rgba(145, 132, 217, .14); border-radius: 999px; padding: 3px 9px;
}

.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 10px 20px; min-height: 0; }
.sentence-card {
  position: relative; background: var(--card); border: 1px solid rgba(233, 233, 237, .12);
  border-radius: 14px; min-height: 216px; display: flex; align-items: center; justify-content: center;
  padding: 30px 26px; cursor: pointer; overflow: hidden;
}
.sentence-card:active { border-color: rgba(145, 132, 217, .5); }
.sentence {
  font-size: 26px; line-height: 1.45; font-weight: 500; text-align: center; text-wrap: pretty;
  transition: filter .18s ease, opacity .18s ease;
}
.sentence.blurred { filter: blur(13px); opacity: .85; user-select: none; -webkit-user-select: none; }
.sentence.loading { filter: none; opacity: 1; font-size: 15px; color: var(--muted); font-weight: 400; }
.reveal-hint {
  position: absolute; bottom: 14px; left: 0; right: 0; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-size: 12px; color: rgba(233, 233, 237, .5);
}
.progress-bar {
  position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 0 2px 2px 0;
  background: var(--accent); width: 0;
}
.progress-bar.animating { animation: fill linear forwards; }

.explain-row { display: flex; justify-content: center; gap: 6px; padding-top: 12px; }
.header-favs { margin-left: auto; width: 40px; height: 40px; font-size: 18px; color: var(--accent); border-color: var(--border); }
.fav-source {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  font-size: 12px; color: var(--faint);
}
.favs-mode .follow-zone, .favs-mode #btn-live, .favs-mode #part-gen, .favs-mode #part-chip, .favs-mode #ses-del { display: none !important; }
.dim-btn { color: var(--faint); border-color: var(--border-soft); }
.dim-btn:active { color: var(--danger); border-color: var(--danger); }
#btn-fav.on { color: var(--accent-light); }
.text-btn {
  min-height: 44px; padding: 9px 16px; border-radius: 999px; background: transparent; border: none;
  color: var(--accent); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 7px;
}
.text-btn:active { background: rgba(145, 132, 217, .1); }
.text-btn.dim { color: var(--muted); }

.controls { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 4px 20px 8px; }
.play-btn {
  width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft);
  border: 1px solid var(--accent); color: var(--accent); font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 26px rgba(145, 132, 217, .22);
}
.play-btn:active { background: rgba(145, 132, 217, .2); }
.play-btn .ph-fill.ph-play { margin-left: 3px; }

.modes { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 0 20px 10px; }
.mode-pill {
  min-height: 44px; padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 7px; background: transparent;
  border: 1px solid var(--border); color: rgba(233, 233, 237, .6);
}
.mode-pill i { font-size: 15px; }
.mode-pill.on { background: rgba(145, 132, 217, .16); border-color: var(--accent); color: var(--accent-light); }

.part-gen {
  display: flex; align-items: center; gap: 10px; margin: 0 16px 8px; padding: 10px 14px;
  border-radius: 8px; background: rgba(145, 132, 217, .08); border: 1px solid rgba(145, 132, 217, .25);
  font-size: 13px; color: var(--accent-light);
}

.follow-zone { border-top: 1px solid rgba(233, 233, 237, .1); padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); }
.follow-closed {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 14px;
  border-radius: 999px; background: var(--card); border: 1px solid rgba(233, 233, 237, .12); cursor: pointer;
}
.follow-closed span { flex: 1; font-size: 14px; color: var(--faint); }
.follow-closed i { font-size: 18px; }
.follow-open {
  background: var(--card); border: 1px solid rgba(145, 132, 217, .4); border-radius: 14px;
  padding: 12px 12px 10px; animation: rise .18s ease;
}
.follow-open textarea { font-size: 15px; }
.follow-actions { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; }
.follow-right { display: flex; gap: 10px; }

/* ══════ SHEET EXPLICAR ══════ */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 62%; overflow-y: auto;
  background: var(--card); border-top: 1px solid rgba(145, 132, 217, .35);
  border-radius: 14px 14px 0 0; box-shadow: 0 -18px 44px rgba(0, 0, 0, .6);
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); animation: rise .2s ease; z-index: 30;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-label {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--faint);
}
.explain-gist { font-size: 15.5px; line-height: 1.55; margin-bottom: 16px; }
.vocab-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.vocab-item {
  display: flex; align-items: baseline; gap: 12px; padding: 9px 12px; border-radius: 8px;
  background: rgba(145, 132, 217, .07); border: 1px solid rgba(145, 132, 217, .18);
}
.vocab-term { font-size: 15px; font-weight: 500; color: var(--accent-light); }
.vocab-es { font-size: 13.5px; color: rgba(233, 233, 237, .6); }
.explain-tip { display: flex; gap: 9px; align-items: flex-start; }
.explain-tip i { font-size: 16px; color: var(--accent); margin-top: 2px; }
.explain-tip div { font-size: 13.5px; line-height: 1.5; color: rgba(233, 233, 237, .65); }
.explain-loading { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); padding: 10px 0; }

/* ══════ LIVE ══════ */
@keyframes wave { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.round-btn.accent-border { border-color: var(--accent); color: var(--accent); }

.live-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(14, 15, 26, .94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; align-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom));
  animation: fadein .25s ease;
}
.live-badge {
  display: flex; align-items: center; gap: 8px; margin-top: 18px;
  font-size: 12px; font-weight: 600; letter-spacing: .14em; color: var(--accent-light);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.live-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; width: 100%; }
.live-search { height: 64px; display: flex; align-items: center; }
.live-search i { font-size: 30px; color: var(--accent); animation: pulse 1s ease-in-out infinite; }
.live-bars { height: 64px; display: flex; align-items: center; gap: 7px; }
.live-bars span {
  width: 7px; height: 52px; border-radius: 4px; background: #595d6c;
  transform-origin: center; animation: wave 1s ease-in-out infinite;
}
.live-bars span:nth-child(2) { animation-delay: .15s; }
.live-bars span:nth-child(3) { animation-delay: .3s; }
.live-bars span:nth-child(4) { animation-delay: .45s; }
.live-bars span:nth-child(5) { animation-delay: .6s; }
.live-bars.speaking span { background: var(--accent); }
.live-bars.idle span { opacity: .35; }
.live-label { font-size: 13px; color: var(--muted); }
.live-sub { min-height: 84px; max-width: 300px; text-align: center; font-size: 18px; line-height: 1.5; font-weight: 500; }
.live-actions { display: flex; gap: 22px; }
.live-btn {
  width: 64px; height: 64px; border-radius: 50%; background: transparent;
  border: 1px solid var(--accent); color: var(--accent); font-size: 22px;
  display: flex; align-items: center; justify-content: center;
}
.live-btn.muted { background: rgba(217, 132, 140, .18); border-color: var(--danger); color: var(--danger); }
.live-btn.hang { background: rgba(217, 132, 140, .14); border-color: var(--danger); color: var(--danger); font-size: 24px; }
.live-btn.hang:active { background: rgba(217, 132, 140, .26); }

/* ══════ OVERLAYS ══════ */
.backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(14, 15, 26, .7);
  display: flex; align-items: center; justify-content: center; padding: 32px; animation: fadein .2s ease;
}
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .65); padding: 26px 24px; text-align: center; max-width: 300px;
}
.big-icon { font-size: 34px; }
.modal-title { font-size: 17px; font-weight: 500; margin: 12px 0 8px; }
.modal-sub { font-size: 14px; line-height: 1.55; color: rgba(233, 233, 237, .6); }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }

.lock {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 40px; text-align: center;
}
.lock-logo { font-size: 44px; }
.lock-title { font-size: 22px; font-weight: 500; }
.lock-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.lock input {
  width: 100%; max-width: 280px; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 13px 14px; color: var(--text); font-family: inherit;
  font-size: 16px; outline: none; text-align: center;
}
.lock input:focus { border-color: var(--accent); }
.lock-error { min-height: 20px; font-size: 13px; color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 10px 18px; font-size: 13.5px; color: var(--text); z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); animation: rise .2s ease; max-width: 84vw; text-align: center;
}
