/* DeutschCoach — sistema de diseño */

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eff1f7;
  --border: #e2e5ee;
  --text: #131722;
  --muted: #5d6476;
  --faint: #8d93a3;
  --primary: #3450e0;
  --primary-press: #2a42c2;
  --primary-soft: #e8ecff;
  --on-primary: #ffffff;
  --accent: #f2b705;
  --accent-soft: #fff4d1;
  --ok: #128a5a;
  --ok-soft: #e1f5ec;
  --warn: #b76e00;
  --warn-soft: #fff0d6;
  --bad: #d43a3a;
  --bad-soft: #fde8e8;
  --der: #2c6be0;
  --die: #d63d74;
  --das: #128a5a;
  --shadow: 0 1px 2px rgba(19, 23, 34, .05), 0 4px 16px rgba(19, 23, 34, .06);
  --shadow-lg: 0 10px 40px rgba(19, 23, 34, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1016;
    --surface: #161a23;
    --surface-2: #1e2330;
    --border: #2a3040;
    --text: #eef0f6;
    --muted: #a2a9ba;
    --faint: #6e7588;
    --primary: #7088ff;
    --primary-press: #5d77f5;
    --primary-soft: rgba(112, 136, 255, .16);
    --on-primary: #0d1016;
    --accent: #f5c33b;
    --accent-soft: rgba(245, 195, 59, .14);
    --ok: #3cc98b;
    --ok-soft: rgba(60, 201, 139, .14);
    --warn: #f0a93a;
    --warn-soft: rgba(240, 169, 58, .14);
    --bad: #ff6b6b;
    --bad-soft: rgba(255, 107, 107, .14);
    --der: #6aa1ff;
    --die: #ff7aa8;
    --das: #3cc98b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1016;
  --surface: #161a23;
  --surface-2: #1e2330;
  --border: #2a3040;
  --text: #eef0f6;
  --muted: #a2a9ba;
  --faint: #6e7588;
  --primary: #7088ff;
  --primary-press: #5d77f5;
  --primary-soft: rgba(112, 136, 255, .16);
  --on-primary: #0d1016;
  --accent: #f5c33b;
  --accent-soft: rgba(245, 195, 59, .14);
  --ok: #3cc98b;
  --ok-soft: rgba(60, 201, 139, .14);
  --warn: #f0a93a;
  --warn-soft: rgba(240, 169, 58, .14);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, .14);
  --der: #6aa1ff;
  --die: #ff7aa8;
  --das: #3cc98b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 20px; line-height: 1.25; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 17px; font-weight: 650; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
mark { background: var(--ok-soft); color: var(--ok); font-weight: 650; border-radius: 4px; padding: 0 2px; }
s { color: var(--bad); text-decoration-thickness: 2px; }
.ic { width: 22px; height: 22px; flex: none; display: block; }
.sm .ic, .ic.sm { width: 18px; height: 18px; }

/* ---------- Estructura ---------- */
#app { max-width: 600px; margin: 0 auto; min-height: 100dvh; position: relative; }
.view {
  padding: calc(16px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
  min-height: 100dvh;
  transition: opacity .18s ease, transform .18s ease;
}
.view.enter { opacity: 0; transform: translateY(6px); }
.is-full .view { padding-bottom: calc(24px + var(--safe-b)); }
.is-full #tabbar { display: none; }

#tabbar {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 600px; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 600; }
.tab.active { color: var(--primary); }
.tab .ic { width: 24px; height: 24px; }

/* ---------- Utilidades ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap { gap: 10px; } .gap-s { gap: 6px; } .gap-l { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mt-l { margin-top: 28px; }
.mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 14px; } .xs { font-size: 12.5px; }
.bold { font-weight: 650; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 12px; }
.stack-l > * + * { margin-top: 24px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.de { font-weight: 600; }
.select-text { user-select: text; -webkit-user-select: text; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { font-size: 18px; }
.section-title a, .section-title button { color: var(--primary); font-size: 14px; font-weight: 600; }

/* ---------- Cabeceras ---------- */
.topbar { display: flex; align-items: center; gap: 8px; margin: -4px -6px 12px; min-height: 44px; }
.topbar h1, .topbar h2 { flex: 1; min-width: 0; }
.topbar .title { flex: 1; min-width: 0; font-weight: 650; font-size: 17px; text-align: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--text); flex: none; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn.on { color: var(--primary); background: var(--primary-soft); }
.icon-btn.soft { background: var(--surface-2); }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 650; font-size: 16px; letter-spacing: -.005em;
  transition: transform .08s ease, background .15s ease, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:active { background: var(--primary-press); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-lg { min-height: 56px; font-size: 17px; border-radius: 16px; }
.link { color: var(--primary); font-weight: 600; }

/* ---------- Tarjetas y listas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card.tap { transition: transform .1s ease; display: block; }
.card.tap:active { transform: scale(.985); }
.card.tap.row { display: flex; }
.hero {
  border-radius: 22px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2f49d6 0%, #4f37c9 55%, #7a33b8 100%);
  box-shadow: 0 10px 30px rgba(52, 80, 224, .3);
}
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero .muted { color: rgba(255, 255, 255, .78); }
.hero .btn { background: #fff; color: #2f49d6; }
.hero-emoji { font-size: 34px; line-height: 1; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.item + .item { border-top: 1px solid var(--border); }
.item:active { background: var(--surface-2); }
.item .meta { flex: 1; min-width: 0; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 14px; margin-top: 1px; }
.item > .ic:last-child { color: var(--faint); }
.emoji-tile { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--surface-2); flex: none; }
.emoji-tile.sm { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 128px; box-shadow: var(--shadow); text-align: left; }
.tile:active { transform: scale(.98); }
.tile .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.tile .t { font-weight: 650; }
.tile .s { color: var(--muted); font-size: 13.5px; line-height: 1.3; }
.ico.blue { background: var(--primary-soft); color: var(--primary); }
.ico.gold { background: var(--accent-soft); color: var(--warn); }
.ico.green { background: var(--ok-soft); color: var(--ok); }
.ico.red { background: var(--bad-soft); color: var(--bad); }

/* ---------- Chips, badges, progreso ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip .ic { width: 17px; height: 17px; }
.chip.flame { color: #e8590c; } .chip.bolt { color: var(--warn); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); letter-spacing: .02em; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.gold { background: var(--accent-soft); color: var(--warn); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .4s ease; }
.progress.ok > i { background: var(--ok); }
.star { display: inline-block; color: var(--border); }
.star .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.star.on { color: var(--accent); }
.stars-lg .star .ic { width: 38px; height: 38px; }

.ring { position: relative; width: 64px; height: 64px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 72px; }
.week .bar { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.week .bar i { width: 100%; max-width: 26px; border-radius: 6px; background: var(--primary-soft); min-height: 4px; }
.week .bar.today i { background: var(--primary); }
.week .bar span { font-size: 11px; color: var(--faint); font-weight: 600; }

/* ---------- Control segmentado ---------- */
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 36px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Formularios ---------- */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; min-height: 48px; border-radius: 13px; border: 1.5px solid var(--border);
  background: var(--surface); padding: 12px 14px; outline: none; font-size: 16px;
  transition: border-color .15s;
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--border); background: var(--surface);
}
.option + .option { margin-top: 10px; }
.option.on { border-color: var(--primary); background: var(--primary-soft); }
.option .t { font-weight: 650; }
.option .s { font-size: 14px; color: var(--muted); }
.option .tick { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.option.on .tick { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.option .tick .ic { width: 14px; height: 14px; stroke-width: 3; }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
input[type="range"] { width: 100%; accent-color: var(--primary); }

/* ---------- Toast y hojas ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-size: 14.5px; font-weight: 600; max-width: calc(100% - 32px); text-align: center;
  transition: all .25s ease; box-shadow: var(--shadow-lg);
}
.is-full .toast { bottom: calc(var(--safe-b) + 110px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 16, .45); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 50%; bottom: 0; width: 100%; max-width: 600px; max-height: 88dvh; overflow-y: auto;
  transform: translate(-50%, 100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  background: var(--surface); border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + var(--safe-b));
  box-shadow: var(--shadow-lg);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: var(--border); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* ---------- Chat ---------- */
.chat-view { display: flex; flex-direction: column; height: 100dvh; padding: 0 !important; }
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: calc(8px + var(--safe-t)) 10px 8px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex: none;
}
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who .t { font-weight: 650; }
.chat-head .who .s { font-size: 13px; color: var(--muted); }
.goalbar { padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex: none; }
.goalbar .progress { flex: 1; height: 6px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px 14px 8px; -webkit-overflow-scrolling: touch; }
.scene { text-align: center; color: var(--muted); font-size: 14px; padding: 4px 18px 16px; }
.scene .emoji { font-size: 40px; margin-bottom: 6px; }

.msg { display: flex; flex-direction: column; margin-bottom: 14px; max-width: 88%; }
.msg.ai { align-items: flex-start; }
.msg.me { align-items: flex-end; margin-left: auto; }
.bubble { padding: 12px 14px; border-radius: 20px; font-size: 16.5px; line-height: 1.42; user-select: text; -webkit-user-select: text; overflow-wrap: anywhere; }
.msg.ai .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.me .bubble { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 6px; }
.bubble .tr { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 14.5px; }
.msg-tools { display: flex; gap: 2px; margin-top: 4px; }
.msg-tools button { height: 32px; padding: 0 10px; border-radius: 9px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.msg-tools button .ic { width: 17px; height: 17px; }
.msg-tools button:active { background: var(--surface-2); }
.msg-tools button.playing { color: var(--primary); }

.fb { margin-top: 6px; border-radius: 16px; padding: 10px 12px; font-size: 14.5px; max-width: 100%; text-align: left; border: 1px solid transparent; }
.fb .h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; }
.fb .h .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.fb .better { margin-top: 6px; font-size: 16px; font-weight: 600; color: var(--text); user-select: text; -webkit-user-select: text; }
.fb .why { margin-top: 4px; color: var(--muted); }
.fb .row { margin-top: 6px; }
.fb.perfect { background: var(--ok-soft); color: var(--ok); }
.fb.good { background: var(--accent-soft); color: var(--warn); }
.fb.fix { background: var(--bad-soft); color: var(--bad); }
.fb.help { background: var(--primary-soft); color: var(--primary); }
.fb .mini { height: 30px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 650; display: inline-flex; align-items: center; gap: 5px; background: var(--surface); color: var(--text); }
.fb .mini .ic { width: 15px; height: 15px; }

.typing { display: inline-flex; gap: 5px; padding: 16px 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.composer { flex: none; background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px calc(10px + var(--safe-b)); }
.suggest { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 10px; padding: 0 12px; }
.suggest::-webkit-scrollbar { display: none; }
.suggest button { flex: none; max-width: 78%; text-align: left; padding: 8px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; line-height: 1.3; }
.suggest button b { display: block; font-weight: 600; }
.suggest button span { color: var(--muted); font-size: 12.5px; }
.compose-row { display: flex; align-items: center; gap: 10px; }
.compose-row .side { width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; flex: none; color: var(--text); }
.mic {
  width: 72px; height: 72px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; margin: 0 auto; flex: none;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: transform .1s ease, background .2s;
}
.mic .ic { width: 30px; height: 30px; }
.mic:active { transform: scale(.95); }
.mic.rec { background: var(--bad); animation: pulse 1.4s infinite; }
.mic.busy { opacity: .5; pointer-events: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 55%, transparent); } 70% { box-shadow: 0 0 0 18px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.mic-hint { text-align: center; font-size: 13px; color: var(--muted); margin-top: 8px; min-height: 18px; }
.live { text-align: center; font-size: 16px; font-weight: 600; min-height: 22px; margin-bottom: 8px; color: var(--text); }
.text-row { display: flex; gap: 8px; align-items: flex-end; }
.text-row .textarea { min-height: 48px; max-height: 120px; padding: 12px 14px; resize: none; border-radius: 24px; }
.send { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }

/* ---------- Ejercicios ---------- */
.prompt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow); }
.prompt-card .kind { font-size: 13px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.prompt-card .p { font-size: 22px; font-weight: 650; margin-top: 10px; line-height: 1.3; user-select: text; -webkit-user-select: text; }
.answer-box { margin-top: 16px; min-height: 56px; border-radius: 16px; background: var(--surface-2); padding: 14px 16px; font-size: 17px; font-weight: 600; text-align: center; }
.answer-box.empty { color: var(--faint); font-weight: 500; }

.quiz-opt { display: block; width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; }
.quiz-opt + .quiz-opt { margin-top: 8px; }
.quiz-opt.right { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.quiz-opt.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.quiz-opt[disabled] { pointer-events: none; }
.explain { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14.5px; color: var(--muted); }

/* ---------- Contenido de lecciones ---------- */
.prose { font-size: 16px; line-height: 1.55; }
.prose > * + * { margin-top: 12px; }
.note { border-radius: 16px; padding: 12px 14px; border-left: 4px solid var(--faint); background: var(--surface-2); }
.note strong { display: block; margin-bottom: 2px; }
.note p + p { margin-top: 4px; }
.note--der { border-color: var(--der); background: color-mix(in srgb, var(--der) 9%, var(--surface)); }
.note--der strong { color: var(--der); }
.note--die { border-color: var(--die); background: color-mix(in srgb, var(--die) 9%, var(--surface)); }
.note--die strong { color: var(--die); }
.note--das { border-color: var(--das); background: color-mix(in srgb, var(--das) 9%, var(--surface)); }
.note--das strong { color: var(--das); }
.note--info { border-color: var(--primary); background: var(--primary-soft); }
.note--info strong { color: var(--primary); }
.note--warn { border-color: var(--warn); background: var(--warn-soft); }
.note--warn strong { color: var(--warn); }
.pattern { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.pattern > div + div { margin-top: 6px; }
.pattern b { color: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 14.5px; }
.grid2 > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }

.example { display: flex; align-items: center; gap: 10px; padding: 12px 14px; width: 100%; text-align: left; }
.example + .example { border-top: 1px solid var(--border); }
.example .ic { color: var(--primary); }
.example.playing .ic { color: var(--ok); }

.sentence { padding: 14px 16px; display: block; width: 100%; text-align: left; border-radius: 0; }
.sentence + .sentence { border-top: 1px solid var(--border); }
.sentence .de { font-size: 17px; line-height: 1.45; }
.sentence .es { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.sentence.playing { background: var(--primary-soft); }

/* ---------- Vocabulario ---------- */
.g-m { color: var(--der); } .g-f { color: var(--die); } .g-n { color: var(--das); }
.gdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--faint); }
.gdot.g-m { background: var(--der); } .gdot.g-f { background: var(--die); } .gdot.g-n { background: var(--das); }
.flash { perspective: 1200px; height: 340px; margin: 8px 0 20px; }
.flash-inner { position: relative; height: 100%; transition: transform .45s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 26px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center;
}
.flash-face.back { transform: rotateY(180deg); }
.flash-face .big { font-size: 30px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.flash-face .ex { margin-top: 14px; color: var(--muted); font-size: 15px; }
.flash-face .cue { position: absolute; bottom: 16px; font-size: 13px; color: var(--faint); }
.flash-face.g-m { border-top: 6px solid var(--der); } .flash-face.g-f { border-top: 6px solid var(--die); } .flash-face.g-n { border-top: 6px solid var(--das); }
.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grade .btn { flex-direction: column; gap: 0; min-height: 60px; font-size: 15px; }
.grade .btn small { font-weight: 500; font-size: 12px; opacity: .75; }

/* ---------- Resumen ---------- */
.result-hero { text-align: center; padding: 18px 0 8px; }
.result-hero .big-emoji { font-size: 64px; line-height: 1; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .e { font-size: 40px; margin-bottom: 8px; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px 20px; color: var(--muted); text-align: center; }

/* Onboarding */
.ob { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; }
.ob-body { flex: 1; }
.ob-foot { padding-top: 16px; }
.ob .logo { width: 84px; height: 84px; border-radius: 26px; margin: 24px auto 20px; display: block; box-shadow: var(--shadow-lg); }
.dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.dots i { width: 7px; height: 7px; border-radius: 9px; background: var(--border); transition: all .2s; }
.dots i.on { width: 22px; background: var(--primary); }

/* Netlify inyecta su barra en las vistas previas; nunca debe tapar la navegación. */
[data-netlify-deploy-id], .netlify-badge, #netlify-badge, iframe[src*="netlify"], div[class*="netlify-badge"] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.btn.playing { color: var(--primary); }
.example.playing, .sentence.playing .de { color: var(--primary); }

/* Nota del profesor (modo profesor) */
.tutor-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; padding: 8px 12px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); font-size: 14.5px; line-height: 1.35; max-width: 100%; text-align: left; }
.tutor-note .ic { margin-top: 1px; }
.tutor-note span { color: var(--text); }
