:root {
  --bg: #F3F6FE;
  --surface: #FFFFFF;
  --surface-2: #F8FAFF;
  --text: #0F1B3D;
  --text-2: #51618A;
  --primary: #2457F5;
  --primary-600: #1B45D1;
  --on-primary: #FFFFFF;
  --primary-soft: #E8EEFF;
  --accent: #14B8E6;
  --border: #DCE4F7;
  --ok: #0F8A5F;
  --ok-soft: #E2F6EE;
  --err: #C23B2E;
  --err-soft: #FCEAE7;
  --focus: #FF8A00;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 27, 61, .04), 0 6px 20px rgba(36, 87, 245, .08);
  --shadow-lg: 0 10px 30px rgba(36, 87, 245, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-he: "Noto Sans Hebrew", Heebo, "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A1124;
    --surface: #121B36;
    --surface-2: #17224A;
    --text: #E8EDFB;
    --text-2: #A2B1D6;
    --primary: #6C93FF;
    --primary-600: #8AAAFF;
    --on-primary: #07112B;
    --primary-soft: #1B2A58;
    --accent: #3CCBF2;
    --border: #25335F;
    --ok: #5DD3A2;
    --ok-soft: #12332A;
    --err: #FF9B8E;
    --err-soft: #3A1E1B;
    --focus: #FFB454;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  }
}

html { font-size: 100%; -webkit-text-size-adjust: 100%; }
html.size-large { font-size: 125%; }
html.size-xlarge { font-size: 150%; }

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .9rem; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
#app:focus, h1:focus { outline: none; }
.muted { color: var(--text-2); }
.small { font-size: .9rem; }

.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 18px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--on-primary); padding: .75rem 1rem; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

/* Cabecera */
.top { background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: -.01em; min-height: 48px; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-family: var(--font-he); font-size: 1.45rem; line-height: 1; box-shadow: var(--shadow-lg); }
.brand-name { font-size: 1.1rem; }
.main-nav { display: none; margin-left: auto; gap: 4px; }
.main-nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-weight: 600; }
.main-nav a:hover { color: var(--text); background: var(--primary-soft); }
.main-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.acct { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.main-nav + .acct { margin-left: 8px; }
.acct[hidden] { display: none; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; text-decoration: none; border: 2px solid var(--primary); }
.btn-top { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 700; text-decoration: none; box-shadow: var(--shadow-lg); }

/* Navegación inferior (móvil) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; text-decoration: none; color: var(--text-2); font-size: .72rem; font-weight: 700; }
.tabbar a[aria-current="page"] { color: var(--primary); }
.tabbar svg, .main-nav svg { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.main-nav svg { width: 18px; height: 18px; }
body { padding-bottom: 70px; }
@media (min-width: 760px) {
  .main-nav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 0; }
}

main { padding-top: 26px; padding-bottom: 36px; min-height: 70vh; }
.foot { color: var(--text-2); font-size: .85rem; padding-bottom: 40px; }

/* Tarjetas y botones */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0 0 14px; box-shadow: var(--shadow); }
.card.soft { background: var(--primary-soft); border-color: transparent; box-shadow: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: 14px;
  border: 2px solid var(--primary); background: var(--primary); color: var(--on-primary);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center;
  box-shadow: 0 4px 14px rgba(36, 87, 245, .25); transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-600); border-color: var(--primary-600); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); transform: none; }
.btn.small-btn { padding: 8px 14px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 4px; text-decoration: none; font-weight: 700; }

/* Portada */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 28px 24px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #3FD0F5 0%, rgba(63, 208, 245, 0) 55%), linear-gradient(135deg, #1B45D1 0%, #2457F5 55%, #4F86FF 100%);
  box-shadow: var(--shadow-lg); }
.hero::after { content: "א"; position: absolute; right: -10px; bottom: -48px; font-family: var(--font-he); font-size: 11rem; line-height: 1; font-weight: 800; color: rgba(255, 255, 255, .12); pointer-events: none; }
.hero h1 { font-size: 1.85rem; letter-spacing: -.02em; margin: 0 0 6px; position: relative; }
.hero p { font-size: 1.05rem; color: rgba(255, 255, 255, .9); max-width: 34rem; position: relative; }
.hero .btn { background: #fff; color: #1B45D1; border-color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); position: relative; }
.hero .btn.ghost { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .5); box-shadow: none; }
.hero .progress { background: rgba(255, 255, 255, .25); max-width: 28rem; position: relative; }
.hero .progress > i { background: #fff; }
.hero .meta-line { font-weight: 700; opacity: .95; position: relative; margin: 0 0 4px; }
.steps { list-style: none; counter-reset: paso; padding: 0; margin: 0; display: grid; gap: 12px; }
.steps li { counter-increment: paso; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(paso); flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-h h2 { margin: 0; }
.lessons { display: grid; gap: 12px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 640px) { .lessons { grid-template-columns: 1fr 1fr; } }
.lesson-card { display: flex; gap: 14px; align-items: center; min-height: 88px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); height: 100%; box-shadow: var(--shadow); transition: transform .12s, border-color .15s; }
.lesson-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.lesson-card .ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); font-size: 1.7rem; line-height: 1; flex: none; }
.lesson-card strong { display: block; }
.lesson-card span.sub { color: var(--text-2); font-size: .92rem; display: block; line-height: 1.35; }
.badge { margin-left: auto; flex: none; font-size: .82rem; font-weight: 800; color: var(--ok); background: var(--ok-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.rtl-note { display: flex; gap: 12px; align-items: flex-start; }
.promo { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.promo p { margin: 0; flex: 1 1 14rem; }

/* Hebreo */
.he { font-family: var(--font-he); font-size: 1.85rem; line-height: 1.65; font-weight: 500; direction: rtl; unicode-bidi: isolate; }
.he-sm { font-family: var(--font-he); font-size: 1.35rem; direction: rtl; unicode-bidi: isolate; }
.tr { color: var(--primary); font-weight: 600; font-size: 1.05rem; letter-spacing: .01em; }
.es { color: var(--text-2); }
body.no-tr .tr { display: none; }

/* Frases */
.phrase { padding: 16px 18px; }
.phrase .he { margin-bottom: 2px; }
.note { margin: 8px 0 0; padding: 8px 12px; background: var(--primary-soft); border-radius: 10px; font-size: .95rem; }
.aud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.aud .btn { min-height: 48px; padding: 8px 14px; font-size: .95rem; }

/* Vocabulario */
.vocab { display: grid; gap: 10px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
.vocab li { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.vocab .he-sm { display: block; }
.vocab .btn { flex: none; width: 48px; padding: 0; }
@media (min-width: 700px) { .vocab { grid-template-columns: 1fr 1fr; } }

/* Diálogo */
.line { padding: 14px 16px; margin: 0 0 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.line.me { background: var(--primary-soft); border-color: transparent; }
.line .who { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 2px; }

/* Regional y consejos */
.regional { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.regional li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.regional .t { font-weight: 700; }
.tips { padding-left: 1.2rem; margin: 0; }
.tips li { margin-bottom: .5rem; }

/* Práctica */
.progress { height: 10px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; margin: 6px 0 16px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width .3s; }
.q-prompt { font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.q-big { margin-bottom: 14px; }
.opts { display: grid; gap: 10px; }
.opt { width: 100%; min-height: 56px; padding: 12px 16px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 12px; cursor: pointer; }
.opt.he-opt { font-family: var(--font-he); font-size: 1.4rem; direction: rtl; text-align: right; }
.opt-row { display: flex; gap: 8px; align-items: stretch; }
.opt-row .opt { flex: 1; min-width: 0; }
.opt-row .btn { flex: none; width: 56px; min-height: 56px; padding: 0; font-size: 1.15rem; }
.opt:hover:not([disabled]) { border-color: var(--primary); }
.opt[disabled] { cursor: default; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--err); background: var(--err-soft); }
.opt.right::before { content: "✓ "; font-weight: 700; color: var(--ok); }
.opt.wrong::before { content: "✗ "; font-weight: 700; color: var(--err); }
.opt.he-opt.right::before, .opt.he-opt.wrong::before { content: none; }
.opt.he-opt.right::after { content: " ✓"; color: var(--ok); font-weight: 700; }
.opt.he-opt.wrong::after { content: " ✗"; color: var(--err); font-weight: 700; }
.fb { margin-top: 14px; }
.fb .verdict { font-weight: 700; font-size: 1.1rem; }
.fb .verdict.ok { color: var(--ok); }
.fb .verdict.bad { color: var(--err); }
.score { font-size: 3.2rem; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }

/* Ajustes */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 18px 8px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.choice input { width: 24px; height: 24px; flex: none; accent-color: var(--primary); }
.hint { color: var(--text-2); font-size: .92rem; margin: 0 0 8px; }

/* Pronunciación */
.sound { display: grid; grid-template-columns: 64px 1fr; gap: 6px 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.sound:last-child { border-bottom: 0; }
.sound .sym { font-weight: 800; font-size: 1.4rem; color: var(--primary); }
.sound .ex { margin-top: 4px; }

/* Aviso */
.aviso { position: fixed; left: 12px; right: 12px; bottom: 12px; max-width: 560px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 14px 16px; border-radius: 12px; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.aviso button { margin-left: 8px; background: transparent; color: inherit; border: 1px solid currentColor; border-radius: 8px; min-height: 40px; padding: 0 12px; font: inherit; cursor: pointer; }

@media (max-width: 380px) {
  .brand-name { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Formularios */
.lbl { display: block; font-weight: 700; margin: 10px 0 4px; }
.field { width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--border); border-radius: 12px; }
.field:focus-visible { border-color: var(--primary); }

/* Diccionario de verbos */
.verbs { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.verbs li[hidden] { display: none; }
.verbs a { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 56px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); height: 100%; }
.verbs a:hover { border-color: var(--primary); }
.verbs .he-sm { flex: none; }
.verbs a > span:last-child { text-align: left; flex: 1; }
.vhead { text-align: center; }
.vhead .he { font-size: 2.6rem; }
.vhead .aud { justify-content: center; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; text-align: left; margin: 14px 0 0; }
.meta dt { color: var(--text-2); font-weight: 600; }
.meta dd { margin: 0; }
.conj h3 { margin-bottom: 4px; }
.forms { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.forms li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "fl btn" "fh btn" "ft btn"; gap: 0 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.forms li:first-child { border-top: 0; }
.forms .fl { grid-area: fl; color: var(--text-2); font-size: .88rem; }
.forms .fh { grid-area: fh; text-align: left; font-size: 1.45rem; }
.forms .ft { grid-area: ft; font-size: 1rem; }
.forms .btn { grid-area: btn; width: 48px; padding: 0; }
@media (min-width: 700px) {
  .forms li { grid-template-columns: 11rem 1fr 1fr auto; grid-template-areas: "fl fh ft btn"; }
}
.letra { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: start; }
.letra .lg { font-size: 3.6rem; line-height: 1; text-align: center; color: var(--primary); }
.letra h3 { margin-bottom: 2px; }
.letra .snd { margin: 0 0 6px; }
.letra .vocab { margin-top: 10px; grid-template-columns: 1fr; }
.small-btn { min-height: 44px; padding: 6px 12px; }
.hint { color: var(--text-2); font-size: .92rem; margin: 0 0 8px; }

/* Cuenta y autenticación */
.auth-wrap { max-width: 440px; margin: 0 auto; }
.auth-card { padding: 26px 22px; }
.auth-card h1 { font-size: 1.6rem; letter-spacing: -.02em; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--primary-soft); padding: 4px; border-radius: 14px; margin: 0 0 18px; }
.tabs a { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 11px; text-decoration: none; color: var(--text-2); font-weight: 700; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.btn-google:hover { border-color: var(--primary); }
.btn-google svg { width: 20px; height: 20px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: .88rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.alert { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; font-size: .95rem; }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--primary-soft); color: var(--text); }
.pw { position: relative; }
.pw .field { padding-right: 76px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 12px; border-radius: 10px; border: 0; background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); font-weight: 700; cursor: pointer; text-decoration: underline; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile .avatar { width: 56px; height: 56px; font-size: 1.4rem; flex: none; }
.profile p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--primary-soft); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 1.5rem; color: var(--primary); line-height: 1.2; }
.stat span { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.sync-state { font-size: .85rem; color: var(--text-2); }
