/* ============================================================
   VIBRA — style.css
   Mobile-first · dark mode automático · sistema de tonos
   ============================================================ */

:root {
  --bg:           #ffffff;
  --bg2:          #f7f7f7;
  --text:         #111111;
  --text2:        #666666;
  --border:       #e5e5e5;
  --accent:       #7C3AED;
  --accent-light: #EDE9FE;
  --chill:        #059669;  --chill-bg:   #ECFDF5;
  --rizz:         #7C3AED;  --rizz-bg:    #EDE9FE;
  --directo:      #D97706;  --directo-bg: #FFFBEB;
  --colega:       #0284C7;  --colega-bg:  #E0F2FE;

  --radius:       18px;
  --radius-sm:    12px;
  --shadow:       0 1px 2px rgba(17,17,17,.04), 0 8px 24px rgba(17,17,17,.06);
  --shadow-lift:  0 2px 6px rgba(17,17,17,.06), 0 16px 40px rgba(17,17,17,.10);
  --font-display: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --maxw:         480px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:    #0f0f0f;  --bg2:   #1a1a1a;
    --text:  #f0f0f0;  --text2: #999999;
    --border: #2a2a2a;
    --accent-light: #2a1d52;
    --chill-bg:   #064e3b; --rizz-bg:    #3b1d8a;
    --directo-bg: #78350f; --colega-bg:  #0c4a6e;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.5);
    --shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.6);
  }
  .chill   { --chill:   #34d399; }
  .rizz    { --rizz:    #a78bfa; }
  .directo { --directo: #fbbf24; }
  .colega  { --colega:  #38bdf8; }
}

/* ---------------------------- reset ---------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input  { font-family: inherit; }
img    { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #fff; }

/* --------------------- screens / pasos --------------------- */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

.step { display: none; animation: fadeUp .32s cubic-bezier(.2,.7,.3,1); }
.step.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------- botones ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700;
  letter-spacing: -.01em;
  transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 20px -8px var(--accent);
}
.btn-primary:disabled { opacity: .4; box-shadow: none; cursor: not-allowed; }

.btn-ghost {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border);
}

.link {
  color: var(--accent); font-weight: 700; padding: 0;
  text-decoration: none; font-size: inherit;
}
.link:active { opacity: .6; }

/* ============================ ONBOARDING ============================ */
.onboarding {
  flex: 1; display: flex; flex-direction: column;
  max-width: var(--maxw); width: 100%; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}
.onboarding-track { flex: 1; position: relative; }

.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  text-align: center;
  opacity: 0; transform: translateX(24px) scale(.98);
  transition: opacity .4s ease, transform .4s ease;
  pointer-events: none;
}
.slide.current { opacity: 1; transform: none; pointer-events: auto; }

.slide-mark {
  font-family: var(--font-display);
  font-weight: 800; font-size: 52px; letter-spacing: -.04em;
  color: var(--accent); margin-bottom: 28px;
}
.slide-emoji {
  font-family: var(--font-display);
  font-size: 72px; font-weight: 800; line-height: 1;
  margin-bottom: 28px;
}
.slide-title {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 700; line-height: 1.1;
  letter-spacing: -.03em; margin-bottom: 16px;
}
.slide-text { font-size: 17px; color: var(--text2); max-width: 22em; margin: 0 auto; }

.onboarding-footer { display: flex; flex-direction: column; gap: 22px; align-items: center; }
.dots { display: flex; gap: 8px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); transition: all .3s ease;
}
.dot.active { background: var(--accent); width: 24px; border-radius: 4px; }
.onboarding-footer .btn { max-width: 100%; }

/* ============================ AUTH ============================ */
.auth {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  max-width: var(--maxw); width: 100%; margin: 0 auto;
  padding: 48px 24px max(24px, env(safe-area-inset-bottom));
}
.auth-brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 30px; letter-spacing: -.04em;
  color: var(--accent); margin-bottom: 32px;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 6px;
}
.auth-sub { color: var(--text2); font-size: 16px; margin-bottom: 28px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text2); padding-left: 2px; }
.field input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg2); color: var(--text);
  font-size: 16px; transition: border-color .2s ease, background .2s ease;
}
.field input::placeholder { color: var(--text2); opacity: .6; }
.field input:focus {
  outline: none; border-color: var(--accent); background: var(--bg);
}

.auth-error {
  background: #fee2e2; color: #b91c1c;
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 14px; font-weight: 600;
}
@media (prefers-color-scheme: dark) {
  .auth-error { background: #450a0a; color: #fca5a5; }
}

.auth-form .btn { margin-top: 6px; }

.auth-switch { text-align: center; margin-top: 24px; color: var(--text2); font-size: 15px; }

/* ============================ TOPBAR ============================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
}
.topbar-brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 24px; letter-spacing: -.04em; color: var(--accent);
}
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text);
  transition: background .18s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:active { transform: scale(.9); background: var(--bg2); }

/* ============================ APP MAIN ============================ */
.app-main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 28px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}

.step-head { margin-bottom: 24px; }
.step-title {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1;
}
.step-sub { color: var(--text2); font-size: 16px; margin-top: 6px; }

/* ---------------------------- dropzone ---------------------------- */
.dropzone {
  display: block; position: relative;
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--bg2);
  margin-bottom: 20px; overflow: hidden;
  transition: border-color .2s ease, background .2s ease;
  min-height: 280px;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-light); }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dropzone-inner {
  min-height: 280px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 40px 24px; text-align: center;
}
.dropzone-icon { color: var(--accent); margin-bottom: 8px; }
.dropzone-text { font-size: 17px; font-weight: 700; }
.dropzone-hint { font-size: 14px; color: var(--text2); }

.dropzone-preview { position: relative; background: #000; }
.dropzone-preview img { width: 100%; max-height: 60dvh; object-fit: contain; }
.preview-remove {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
.preview-remove:active { transform: scale(.9); }

/* ---------------------------- pills ---------------------------- */
.context-group { margin-bottom: 26px; }
.group-label {
  display: block; font-size: 13px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
}
.pills { display: flex; flex-wrap: wrap; gap: 9px; }
.pill {
  padding: 11px 17px; border-radius: 100px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 15px; font-weight: 600; color: var(--text);
  transition: all .16s ease; -webkit-tap-highlight-color: transparent;
}
.pill:active { transform: scale(.94); }
.pill.selected {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 6px 16px -8px var(--accent);
}

.step-actions { display: flex; gap: 10px; margin-top: 8px; }
.step-actions .btn-ghost { flex: 0 0 96px; }
.step-actions .btn-primary { flex: 1; }

/* ============================ RESULTS / CARDS ============================ */
#context-detected { font-style: italic; }
.results { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tone, var(--accent));
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  animation: cardIn .4s cubic-bezier(.2,.7,.3,1) backwards;
}
.card:nth-child(1) { animation-delay: .04s; }
.card:nth-child(2) { animation-delay: .10s; }
.card:nth-child(3) { animation-delay: .16s; }
.card:nth-child(4) { animation-delay: .22s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.tone-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--tone); background: var(--tone-bg);
  padding: 5px 10px; border-radius: 8px;
}
.tone-tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tone);
}
.card-text { font-size: 16px; line-height: 1.45; color: var(--text); }

.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--text2);
  padding: 6px 10px; border-radius: 9px; background: var(--bg2);
  transition: all .16s ease; white-space: nowrap;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:active { transform: scale(.92); }
.copy-btn.copied { color: #fff; background: var(--tone); }

/* tone scoping */
.card.chill   { --tone: var(--chill);   --tone-bg: var(--chill-bg); }
.card.rizz    { --tone: var(--rizz);    --tone-bg: var(--rizz-bg); }
.card.directo { --tone: var(--directo); --tone-bg: var(--directo-bg); }
.card.colega  { --tone: var(--colega);  --tone-bg: var(--colega-bg); }

/* ---------------------------- skeleton ---------------------------- */
.skeleton-card {
  background: var(--bg);
  border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.sk-line {
  height: 13px; border-radius: 6px; margin-bottom: 9px;
  background: linear-gradient(100deg, var(--bg2) 30%, var(--border) 50%, var(--bg2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.sk-tag { width: 64px; height: 22px; border-radius: 8px; margin-bottom: 12px;
  background: linear-gradient(100deg, var(--bg2) 30%, var(--border) 50%, var(--bg2) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.sk-line.short { width: 55%; }
.sk-line:last-child { margin-bottom: 0; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.loading-status {
  text-align: center; color: var(--text2); font-size: 15px; font-weight: 600;
  margin: 18px 0 4px; min-height: 22px;
  transition: opacity .3s ease;
}

/* ============================ HISTORY ============================ */
.history-main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 20px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.history-list { display: flex; flex-direction: column; gap: 12px; flex: 1; }

.history-empty {
  text-align: center; color: var(--text2); font-size: 16px;
  padding: 80px 24px; line-height: 1.6;
}
.history-empty .emoji { font-size: 40px; display: block; margin-bottom: 14px; }

.hcard {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.hcard-top {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 15px 16px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hcard-main { flex: 1; min-width: 0; }
.hcard-date { font-size: 13px; color: var(--text2); font-weight: 600; margin-bottom: 8px; }
.hcard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.badge {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 7px;
  background: var(--accent-light); color: var(--accent);
}
.badge.sit { background: var(--bg2); color: var(--text2); }
.hcard-ctx { font-size: 14px; color: var(--text); font-style: italic; line-height: 1.4; }

.hcard-trash {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text2);
  transition: all .16s ease;
}
.hcard-trash:active { transform: scale(.9); color: #ef4444; }

.hcard-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .3s ease;
  border-top: 1px solid transparent;
}
.hcard.open .hcard-body { grid-template-rows: 1fr; border-top-color: var(--border); }
.hcard-body-inner { overflow: hidden; }
.hsug {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.hsug:last-child { border-bottom: none; }
.hsug-tag {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--tone);
}
.hsug.chill   { --tone: var(--chill); }
.hsug.rizz    { --tone: var(--rizz); }
.hsug.directo { --tone: var(--directo); }
.hsug.colega  { --tone: var(--colega); }
.hsug-text { font-size: 15px; line-height: 1.4; }
.hsug-used { font-size: 11px; color: var(--accent); font-weight: 700; }

.history-footer {
  text-align: center; font-size: 13px; color: var(--text2);
  padding: 26px 12px 6px; line-height: 1.5;
}

/* ============================ utils ============================ */
[hidden] { display: none !important; }

@media (min-width: 520px) {
  .dropzone, .dropzone-inner { min-height: 320px; }
}

/* ============================================================
   v3 · MODO SWITCH (upload / historia)
   ============================================================ */
.mode-switch {
  display: flex; gap: 6px; margin-bottom: 22px;
  background: var(--bg2); padding: 5px; border-radius: 14px;
  border: 1px solid var(--border);
}
.mode-btn {
  flex: 1; padding: 11px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--text2);
  transition: all .18s ease; -webkit-tap-highlight-color: transparent;
}
.mode-btn:active { transform: scale(.97); }
.mode-btn.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }

/* ============================================================
   v3 · STORY
   ============================================================ */
.story-textarea {
  width: 100%; min-height: 84px; resize: vertical;
  padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg2); color: var(--text);
  font-family: inherit; font-size: 16px; line-height: 1.45;
  transition: border-color .2s ease, background .2s ease;
}
.story-textarea::placeholder { color: var(--text2); opacity: .6; }
.story-textarea:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.char-count { text-align: right; font-size: 12px; color: var(--text2); margin-top: 6px; font-weight: 600; }
#step-story .dropzone, #step-story .dropzone-inner { min-height: 190px; }
#step-story .dropzone { margin-bottom: 0; }

/* ============================================================
   v3 · FEEDBACK (👍👎 bajo cada card)
   ============================================================ */
.feedback-row {
  display: flex; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.fb-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--text2);
  padding: 9px 10px; border-radius: 9px; background: var(--bg2);
  border: 1px solid var(--border);
  transition: all .16s ease; -webkit-tap-highlight-color: transparent;
}
.fb-btn span { font-weight: 800; }
.fb-btn:active { transform: scale(.95); }
.fb-worked:active { color: var(--chill); border-color: var(--chill); }
.fb-didnt:active  { color: #ef4444; border-color: #ef4444; }
.fb-saved {
  flex: 1; text-align: center; font-size: 13px; font-weight: 800;
  color: var(--chill); padding: 9px 10px;
}
.card.fb-worked-on { border-color: var(--chill); box-shadow: 0 0 0 1px var(--chill) inset, var(--shadow); }
.card.fb-didnt-on  { border-color: #ef4444; box-shadow: 0 0 0 1px #ef4444 inset, var(--shadow); }

.fb-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 7px;
}
.fb-badge.worked { background: var(--chill-bg); color: var(--chill); }
.fb-badge.didnt  { background: #fee2e2; color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .fb-badge.worked { color: #34d399; }
  .fb-badge.didnt  { background: #450a0a; color: #fca5a5; }
}

/* ============================================================
   v3 · EXPORT / ANÁLISIS COMPLETO
   ============================================================ */
.export-main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.export-help {
  font-size: 13px; color: var(--text2); line-height: 1.5;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px;
}
.export-help strong { color: var(--text); }
.export-dropzone, .export-dropzone .dropzone-inner { min-height: 170px; }
.export-loaded { display: flex; flex-direction: column; gap: 16px; margin-top: 2px; }
.export-loaded-info {
  font-size: 15px; font-weight: 700;
  background: var(--accent-light); color: var(--accent);
  border-radius: var(--radius-sm); padding: 12px 16px; text-align: center;
}
.export-results { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }

.analysis-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 4px 2px; box-shadow: var(--shadow);
  animation: cardIn .4s cubic-bezier(.2,.7,.3,1) backwards;
}
.analysis-row { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.analysis-row:last-child { border-bottom: none; }
.analysis-label {
  font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text2); margin-bottom: 5px;
}
.analysis-text { font-size: 15px; line-height: 1.5; color: var(--text); }
.analysis-row.highlight {
  background: var(--accent-light); border-radius: var(--radius-sm);
  margin: 6px; border-bottom: none;
}
.analysis-row.highlight .analysis-label { color: var(--accent); }
.analysis-row.highlight .analysis-text { font-weight: 600; }

.export-sep {
  text-align: center; font-size: 13px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text2); margin: 22px 0 6px;
}
.last-msg-bubble {
  align-self: flex-start; max-width: 85%;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px; padding: 11px 14px;
  font-size: 15px; line-height: 1.45; color: var(--text); margin-bottom: 6px;
}

/* ============================================================
   v4 · CALIBRACIÓN (screen-customize)
   ============================================================ */
.customize-main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}

.cal-progress { display: flex; gap: 8px; justify-content: center; margin-bottom: 28px; }
.cal-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border); transition: all .3s ease;
}
.cal-dot.done { background: var(--accent); width: 26px; border-radius: 5px; }

.cal-state { animation: fadeUp .32s cubic-bezier(.2,.7,.3,1); }

/* loading / calculando */
#cal-loading { text-align: center; padding: 56px 12px; }
.cal-spinner {
  width: 34px; height: 34px; margin: 0 auto 18px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: cal-spin .8s linear infinite;
}
@keyframes cal-spin { to { transform: rotate(360deg); } }
.cal-loading-text { color: var(--text2); font-size: 16px; font-weight: 600; }

/* ronda A/B */
.cal-context-label {
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text2); margin-bottom: 8px;
}
.cal-context {
  background: var(--bg2); border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 16px;
  font-size: 16px; line-height: 1.45; color: var(--text); font-style: italic;
  margin-bottom: 24px;
}
.cal-question {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 14px;
}
.cal-option {
  display: flex; align-items: flex-start; gap: 13px; width: 100%; text-align: left;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  transition: all .16s ease; -webkit-tap-highlight-color: transparent;
}
.cal-option:active { transform: scale(.985); border-color: var(--accent); background: var(--accent-light); }
.cal-letter {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-light); color: var(--accent);
  font-weight: 800; font-size: 14px;
}
.cal-text { font-size: 16px; line-height: 1.45; color: var(--text); padding-top: 2px; }

#cal-round.cal-swap { opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }

/* terminado */
#cal-done { text-align: center; padding: 36px 8px 8px; }
.cal-done-icon { color: var(--accent); margin-bottom: 14px; display: flex; justify-content: center; }
.cal-done-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 12px;
}
.cal-done-summary {
  font-size: 16px; line-height: 1.55; color: var(--text2);
  max-width: 24em; margin: 0 auto 28px;
}
#cal-done .btn { max-width: 320px; margin: 0 auto; }

/* ============================================================
   v4 · indicadores de feedback en historial
   ============================================================ */
.fb-badge.learn { background: var(--accent-light); color: var(--accent); }

.hsug-fb { font-size: 11px; font-weight: 800; }
.hsug-fb.worked { color: var(--chill); }
.hsug-fb.didnt  { color: #ef4444; }
@media (prefers-color-scheme: dark) {
  .hsug-fb.worked { color: #34d399; }
  .hsug-fb.didnt  { color: #fca5a5; }
}

/* ============================================================
   v5 · MODO INCÓGNITO + texto opcional + análisis en historial
   ============================================================ */

/* etiqueta "opcional" junto a una pregunta */
.opt-tag {
  font-size: 11px; font-weight: 700; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 6px; margin-left: 6px;
  text-transform: lowercase; letter-spacing: 0;
}

/* fila del interruptor de incógnito */
.incognito-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; margin-bottom: 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px;
}
.incognito-label {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 700; color: var(--text);
}
.incognito-label svg { color: var(--text2); }
.incognito-note {
  font-size: 12.5px; color: var(--accent); font-weight: 600;
  margin: -6px 4px 14px; text-align: center;
}

/* switch genérico */
.switch {
  position: relative; width: 46px; height: 27px; flex: 0 0 auto;
  background: var(--border); border-radius: 999px;
  transition: background .2s ease; -webkit-tap-highlight-color: transparent;
}
.switch .switch-knob {
  position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s cubic-bezier(.3,.7,.4,1);
}
.switch.on { background: var(--accent); }
.switch.on .switch-knob { transform: translateX(19px); }
.incognito-row.on {
  border-color: var(--accent); background: var(--accent-light);
}

/* informe de análisis dentro del historial */
.hanalysis {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg2); padding: 2px 2px; margin-bottom: 14px;
}
.hanalysis-row { padding: 10px 13px; border-bottom: 1px solid var(--border); }
.hanalysis-row:last-child { border-bottom: none; }
.hanalysis-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text2); margin-bottom: 4px;
}
.hanalysis-text { font-size: 14px; line-height: 1.45; color: var(--text); }
.hanalysis-row.highlight { background: var(--accent-light); border-radius: var(--radius-sm); margin: 5px; border-bottom: none; }
.hanalysis-row.highlight .hanalysis-label { color: var(--accent); }
.hanalysis-sep {
  font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text2); padding: 10px 13px 4px;
}
.hanalysis-lastmsg {
  margin: 0 13px 12px; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px 14px 14px 14px; font-size: 14px; line-height: 1.4; color: var(--text);
}

/* ============================================================
   v6 · CONTACTOS
   ============================================================ */

/* botón "+ nuevo contacto" en el selector */
.pill-add { border-style: dashed; color: var(--accent); font-weight: 700; }

/* pantalla de contactos */
.contacts-main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 24px 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
}
.contact-form { display: flex; flex-direction: column; margin-bottom: 26px; }
.field-input {
  width: 100%; padding: 14px 16px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg2); color: var(--text); font-family: inherit;
  transition: border-color .2s ease, background .2s ease;
}
.field-input::placeholder { color: var(--text2); opacity: .6; }
.field-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.contact-form .pills { margin-top: 8px; }

.contacts-list { display: flex; flex-direction: column; gap: 10px; }
.contacts-empty { color: var(--text2); text-align: center; padding: 20px 0; font-size: 15px; }
.contact-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
}
.contact-item-info { flex: 1; min-width: 0; }
.contact-item-namerow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.contact-item-name { font-weight: 700; font-size: 16px; color: var(--text); }
.contact-item-notes { font-size: 13.5px; color: var(--text2); line-height: 1.45; margin-top: 5px; }
.contact-item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.contact-mini-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border);
  transition: all .15s ease; -webkit-tap-highlight-color: transparent;
}
.contact-mini-btn:active { transform: scale(.92); }
.contact-mini-btn.danger:active { color: #ef4444; border-color: #ef4444; }

/* badge de contacto en el historial */
.badge.contact { background: var(--accent-light); color: var(--accent); }

/* rejilla de opciones de calibración (4) */
#cal-options { display: flex; flex-direction: column; }
