/* ============================================================
   Norsk Kjekt — estilos
   ============================================================ */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #101c33;
  --ink-soft: #3c4a63;
  --muted: #6b7a92;
  --line: #e3e7ee;
  --red: #ba0c2f;
  --red-soft: #fdecef;
  --blue: #00205b;
  --blue-soft: #eaeefb;
  --green: #12855a;
  --green-soft: #e6f6ef;
  --amber: #a86500;
  --amber-soft: #fff4e0;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 28, 51, .05), 0 8px 24px -12px rgba(16, 28, 51, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; }

.skip {
  position: absolute; inset-inline-start: -999px; top: 8px; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 10px;
  border: 0; font: inherit; cursor: pointer;
}
.skip:focus { inset-inline-start: 8px; }

/* ---------------- topbar ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(245, 246, 248, .86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; font-size: 1.05rem; letter-spacing: -.01em;
  margin-inline-end: auto; white-space: nowrap; flex: 0 0 auto;
}
.brand-text b { color: var(--red); }
.brand .flag { display: inline-flex; }

.nav { display: flex; gap: .12rem; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto;
  text-decoration: none; font-size: .85rem; font-weight: 550;
  color: var(--ink-soft); padding: .4rem .4rem; border-radius: 999px;
  transition: background .15s, color .15s;
}
.nav a:hover { background: #eceff4; color: var(--ink); }
.nav a.active { background: var(--ink); color: #fff; }

.hud { display: flex; gap: .4rem; align-items: center; }
.lang-switch {
  display: inline-flex; align-items: center; gap: 1px;
  padding: 2px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px;
}
.lang-switch button {
  border: 0; background: transparent; font: inherit; line-height: 1;
  font-size: .72rem; font-weight: 750; letter-spacing: .03em;
  color: var(--muted); padding: .3rem .45rem; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-switch button:hover:not(.active) { background: var(--bg); color: var(--ink); }
.lang-switch button.active { background: var(--ink); color: #fff; }
.lang-switch button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .82rem; font-variant-numeric: tabular-nums;
  background: var(--card); border: 1px solid var(--line);
  padding: .28rem .6rem; border-radius: 999px; color: var(--ink-soft);
}
.pill b { color: var(--ink); }

.pill.speed { gap: .3rem; padding: .22rem .5rem; cursor: pointer; }
.speed-label { font-size: .76rem; color: var(--muted); }
.pill.speed select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  padding: .12rem .1rem;
  cursor: pointer;
  outline: none;
}
.pill.speed:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 32, 91, .09); }
.pill.speed::after { content: "▾"; font-size: .68rem; color: var(--muted); margin-inline-start: -.1rem; }
@media (max-width: 640px) { .speed-label { display: none; } .app-pill span { display: none; } }

/* ---------------- layout ---------------- */

main {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2.75rem) clamp(1rem, 4vw, 2.5rem) 4rem;
  outline: none;
}

.section-title {
  font-size: 1.15rem; margin: 2.4rem 0 1rem;
  display: flex; align-items: baseline; gap: .6rem;
}
.section-title span { font-size: .85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid transparent; border-radius: 12px;
  padding: .62rem 1.05rem; font-weight: 600; font-size: .94rem;
  text-decoration: none; cursor: pointer;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
  background: #eceff4; color: var(--ink);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 6px 16px -8px rgba(186, 12, 47, .8); }
.btn.primary:hover { background: #a30a29; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: #fff; border-color: #cfd6e2; }
.btn.small { padding: .4rem .75rem; font-size: .85rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

.say {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.8rem; height: 1.8rem; flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; cursor: pointer; font-size: .85rem; line-height: 1;
  transition: background .15s, color .15s, transform .15s;
}
.say:hover { background: var(--blue-soft); color: var(--blue); transform: scale(1.06); }
.say.playing { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------------- hero ---------------- */

.hero {
  display: grid; grid-template-columns: 1.35fr .9fr; gap: 1.25rem;
  align-items: stretch;
}

.hero-text {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.5rem, 3.5vw, 2.6rem);
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero-text::after {
  content: "🇳🇴";
  position: absolute; right: -10px; bottom: -26px; font-size: 8rem; opacity: .07;
  transform: rotate(-8deg); pointer-events: none;
}
.eyebrow {
  display: inline-block; font-size: .74rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--red); background: var(--red-soft);
  padding: .3rem .6rem; border-radius: 999px; margin-bottom: .9rem;
}
.hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.6rem); }
.hero h1 em { font-style: normal; color: var(--red); }
.hero-text p { color: var(--ink-soft); margin-top: .8rem; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

.hero-card {
  background: var(--blue); color: #fff; border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1rem;
}
.hero-card h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; font-weight: 700; }
.big-num { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.big-num small { font-size: .8rem; font-weight: 600; opacity: .65; letter-spacing: 0; }

.meter { height: 7px; background: rgba(255, 255, 255, .18); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .5s ease; }

.wotd {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px; padding: .85rem; margin-top: auto;
}
.wotd .w-no { font-size: 1.15rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.wotd .w-es { font-size: .85rem; opacity: .78; }
.wotd .w-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; opacity: .6; margin-bottom: .3rem; }

/* ---------------- lesson grid ---------------- */

.grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.lesson-card {
  display: flex; flex-direction: column; gap: .55rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 0 1.05rem; text-decoration: none; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd6e2; }
.lesson-card .thumb {
  aspect-ratio: 8 / 5; background: var(--bg); overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.lesson-card .thumb img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.lesson-card:hover .thumb img { transform: scale(1.04); }
.lesson-card .top { display: flex; align-items: center; gap: .6rem; margin: .15rem 1.1rem 0; }
.lesson-card .emoji {
  font-size: 1.3rem; width: 2.4rem; height: 2.4rem; flex: 0 0 auto;
  display: grid; place-items: center; background: var(--bg); border-radius: 12px;
}
.lesson-card .num { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.lesson-card h3 { font-size: 1.02rem; margin: 0 1.1rem; }
.lesson-card .sub { font-size: .87rem; color: var(--ink-soft); margin: 0 1.1rem; }
.lesson-card .foot { display: flex; align-items: center; gap: .4rem; margin: .35rem 1.1rem 0; }

.chip {
  font-size: .7rem; font-weight: 700; letter-spacing: .05em;
  padding: .2rem .5rem; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue);
}
.chip.done { background: var(--green-soft); color: var(--green); }
.chip.plain { background: var(--bg); color: var(--muted); font-weight: 600; }

/* ---------------- lesson page ---------------- */

.crumbs { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.lesson-head {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 1.6rem; align-items: center; margin-bottom: 1.5rem;
}
.lesson-head .kicker { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.lesson-head .kicker .emoji { font-size: 1.6rem; }
.lesson-head h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); }
.lesson-head .lead { color: var(--ink-soft); margin-top: .35rem; }
.lesson-hero {
  margin: 0; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card);
}
.lesson-hero img { display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; }

@media (max-width: 820px) {
  .lesson-head { grid-template-columns: 1fr; gap: 1.1rem; }
  .lesson-hero { max-width: 560px; }
}

.goals { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .9rem; }
.goal {
  font-size: .82rem; color: var(--blue); background: var(--blue-soft);
  padding: .28rem .65rem; border-radius: 999px;
}
.goal::before { content: "✓ "; opacity: .6; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.1rem, 2.6vw, 1.6rem); box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  margin-bottom: 1rem;
}
.card > h2 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: .9rem;
}

.text-body { display: flex; flex-direction: column; gap: 1rem; }
.para { display: flex; gap: .7rem; align-items: flex-start; }
.para .lines { display: flex; flex-direction: column; gap: .15rem; }
.para .no { font-size: 1.04rem; }
.para .es { font-size: .84rem; color: var(--muted); }
.para .es::before { content: "→ "; opacity: .6; }
.para .es.trans[hidden] { display: none; }
.t-toggle {
  align-self: flex-start; border: 0; background: none; padding: 0;
  font: inherit; font-size: .78rem; color: var(--blue); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.t-toggle:hover { color: var(--ink); }
.card > h2 .h2-note {
  margin-inline-start: .45rem; font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  text-transform: none; color: var(--blue);
}

.grammar-points {
  margin: 0 0 .9rem; padding-inline-start: 1.15rem;
  display: flex; flex-direction: column; gap: .4rem;
  font-size: .92rem; color: var(--ink-soft);
}
.grammar-points li::marker { color: var(--blue); }
.grammar-ex {
  display: flex; flex-direction: column; gap: .55rem;
  border-top: 1px dashed var(--line); padding-top: .85rem;
}
.gx { display: flex; align-items: flex-start; gap: .55rem; }
.gx .txt { display: flex; flex-direction: column; gap: .1rem; }
.gx .no { font-weight: 600; font-size: .96rem; }
.gx .es { font-size: .82rem; color: var(--muted); }
.gx .es::before { content: "→ "; opacity: .6; }

.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .55rem; }
.vocab .row {
  display: flex; align-items: center; gap: .55rem;
  border: 1px solid var(--line); border-radius: 12px; padding: .5rem .6rem;
  background: #fcfdff;
}
.vocab .w { font-weight: 650; font-size: .95rem; }
.vocab .t { font-size: .8rem; color: var(--muted); }
.vocab .txt { display: flex; flex-direction: column; gap: 0; min-width: 0; }

.phrases { display: flex; flex-direction: column; gap: .1rem; }
.phrase {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem 0; border-bottom: 1px dashed var(--line);
}
.phrase:last-child { border-bottom: 0; }
.phrase .txt { display: flex; flex-direction: column; }
.phrase .no { font-weight: 600; }
.phrase .es { font-size: .82rem; color: var(--muted); }

.tip {
  border-left: 3px solid var(--amber); background: var(--amber-soft);
  border-radius: 0 12px 12px 0; padding: .85rem 1rem; font-size: .9rem; color: #5a3c05;
}
.tip b { color: #3f2a02; }

/* ---------------- exercises ---------------- */

.exercise { display: flex; flex-direction: column; gap: .9rem; }
.ex-top { display: flex; align-items: center; justify-content: space-between; font-size: .78rem; color: var(--muted); }
.ex-label { text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.ex-count { font-variant-numeric: tabular-nums; }

.dots { display: flex; gap: .3rem; }
.dot { height: 5px; flex: 1; background: var(--line); border-radius: 99px; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.dot.now { background: var(--blue); }

.ex-prompt { font-size: 1.05rem; font-weight: 650; }
.ex-hint { font-size: .85rem; color: var(--muted); }

.options { display: flex; flex-direction: column; gap: .45rem; }
.opt {
  text-align: start; padding: .7rem .85rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fcfdff; cursor: pointer;
  transition: border-color .12s, background .12s, transform .12s;
  display: flex; align-items: center; gap: .6rem;
}
.opt:hover:not([disabled]) { border-color: #b9c3d4; background: #fff; transform: translateX(2px); }
.opt .key {
  width: 1.4rem; height: 1.4rem; flex: 0 0 auto; border-radius: 6px;
  background: var(--bg); display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; color: var(--muted);
}
.opt.correct { border-color: var(--green); background: var(--green-soft); }
.opt.correct .key { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .key { background: var(--red); color: #fff; }
.opt[disabled] { cursor: default; }

.sentence { font-size: 1.15rem; padding: .5rem 0; }
.blank-input {
  font: inherit; font-size: 1.05rem; font-weight: 600;
  border: 0; border-bottom: 2px solid var(--blue); background: var(--blue-soft);
  padding: .1rem .45rem; border-radius: 6px 6px 0 0; min-width: 7ch; max-width: 18ch;
  color: var(--blue); outline: none;
}
.blank-input:focus { background: #dfe6fb; }
.blank-input.ok { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.blank-input.bad { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.bank { display: flex; flex-wrap: wrap; gap: .4rem; }
.word {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: .4rem .7rem; cursor: pointer; font-size: .95rem;
  transition: transform .1s, border-color .12s, background .12s;
}
.word:hover { border-color: #b9c3d4; transform: translateY(-1px); }
.word.used { opacity: .25; pointer-events: none; }
.word[disabled] { opacity: .35; cursor: default; pointer-events: none; }

.order-answer {
  min-height: 3rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: .55rem;
  background: #fcfdff;
}
.order-answer.filled { border-style: solid; border-color: #cfd6e2; }
.order-answer .placeholder { color: var(--muted); font-size: .85rem; }

/* cloze, dictado, transformación y emparejar */
.cloze-text { font-size: 1.06rem; line-height: 2.25; padding: .2rem 0; }
.cloze-text .blank-input { margin: 0 .15rem; }

.listen-box { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
#play.playing { background: var(--blue); box-shadow: none; }
#play.playing:hover { background: var(--blue); }
.listen-input, .transform-input {
  font: inherit; font-size: 1.05rem; font-weight: 600; width: 100%;
  padding: .7rem .85rem; border: 2px solid var(--line); border-radius: 12px;
  background: #fcfdff; color: var(--ink); outline: none;
  transition: border-color .12s, background .12s;
}
.listen-input:focus, .transform-input:focus { border-color: var(--blue); background: #fff; }
.listen-input.ok, .transform-input.ok {
  border-color: var(--green); background: var(--green-soft); color: #0b5c3f;
}
.listen-input.bad, .transform-input.bad {
  border-color: var(--red); background: var(--red-soft); color: #8a1029;
}
.listen-input { max-width: 46ch; }

.source {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem .8rem; background: var(--bg);
  border-left: 3px solid var(--blue); border-radius: 10px;
  font-size: 1.06rem; font-weight: 600;
}
.source span { min-width: 0; overflow-wrap: anywhere; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.m-col { display: flex; flex-direction: column; gap: .4rem; }
.m-cell { display: flex; align-items: stretch; gap: .3rem; }
.m-item {
  flex: 1; text-align: start; padding: .55rem .7rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fcfdff; cursor: pointer; font-size: .95rem;
  transition: border-color .12s, background .12s, transform .1s;
}
.m-item:hover:not(:disabled) { border-color: #b9c3d4; background: #fff; }
.m-item.sel { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.m-item.done { border-color: var(--green); background: var(--green-soft); color: #0b5c3f; opacity: .72; }
.m-item.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .25s; }
.m-item:disabled { cursor: default; }
.m-cell .say { align-self: center; }
@media (max-width: 560px) {
  .match { grid-template-columns: 1fr; }
  .match .m-col + .m-col { margin-top: .15rem; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.feedback { display: none; border-radius: 12px; padding: .75rem .9rem; font-size: .9rem; }
.feedback.show { display: block; animation: pop .18s ease; }
.feedback.ok { background: var(--green-soft); color: #0b5c3f; }
.feedback.bad { background: var(--red-soft); color: #8a1029; }
.feedback .head { font-weight: 700; display: flex; align-items: center; gap: .4rem; margin-bottom: .2rem; }
.feedback .answer-line { margin-top: .35rem; font-weight: 600; }
.feedback .trad { opacity: .8; font-size: .84rem; }

@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ---------------- result ---------------- */

.result { text-align: center; display: flex; flex-direction: column; gap: .6rem; align-items: center; padding: .5rem 0; }
.result .score { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; }
.result .score small { font-size: 1rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.result p { color: var(--ink-soft); max-width: 42ch; }
.result .actions { justify-content: center; margin-top: .4rem; }
.failed-list { width: 100%; text-align: start; margin-top: .8rem; display: flex; flex-direction: column; gap: .35rem; }
.failed-list .item {
  font-size: .85rem; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: .5rem .65rem; display: flex; gap: .5rem; align-items: flex-start;
}
.failed-list .item b { color: var(--red); }

/* ---------------- coloquial ---------------- */

.colo-intro {
  background: var(--blue); color: #fff; border-radius: var(--radius);
  padding: 1.4rem; margin-bottom: 1.2rem;
}
.colo-intro h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin-bottom: .4rem; }
.colo-intro p { opacity: .82; font-size: .92rem; max-width: 62ch; }

.filters { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: 1rem; }
.filters input {
  flex: 1 1 200px; min-width: 160px;
  padding: .55rem .8rem; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-size: .9rem; outline: none;
}
.filters input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 32, 91, .08); }
.fchip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: .35rem .75rem; font-size: .82rem; cursor: pointer; color: var(--ink-soft);
}
.fchip:hover { border-color: #b9c3d4; }
.fchip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.colo-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.colo-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  display: flex; flex-direction: column; gap: .5rem;
}
.colo-card .head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.colo-card .term { font-size: 1.12rem; font-weight: 750; letter-spacing: -.01em; }
.colo-card .literal { font-size: .76rem; color: var(--muted); font-style: italic; }
.colo-card .meaning { font-size: .92rem; color: var(--ink-soft); }
.colo-card .dialogue {
  border-top: 1px dashed var(--line); padding-top: .55rem; margin-top: auto;
  display: flex; flex-direction: column; gap: .2rem;
}
.colo-card .line { display: flex; gap: .45rem; align-items: center; font-size: .88rem; }
.colo-card .line .who { font-weight: 700; color: var(--muted); font-size: .75rem; width: .8rem; }
.colo-card .line .es { font-size: .78rem; color: var(--muted); display: block; }
.colo-card .tip { font-size: .8rem; border-left: 2px solid var(--amber); background: var(--amber-soft); padding: .5rem .6rem; border-radius: 0 9px 9px 0; color: #5a3c05; }

.reg { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .18rem .45rem; border-radius: 6px; }
.reg.neutro { background: var(--blue-soft); color: var(--blue); }
.reg.informal { background: var(--green-soft); color: var(--green); }
.reg.fuerte { background: var(--amber-soft); color: var(--amber); }
.reg.vulgar { background: var(--red-soft); color: var(--red); }
.reg.oral { background: #eef0f5; color: var(--muted); }

/* ---------------- review ---------------- */

.review-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.review-head h1 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
.review-head p { color: var(--muted); font-size: .9rem; margin-top: .2rem; }

.review-list { display: flex; flex-direction: column; gap: .5rem; }
.review-item {
  display: flex; align-items: center; gap: .7rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .85rem;
}
.review-item .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.review-item .meta b { font-size: .92rem; }
.review-item .meta span { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty .big { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* ---------------- tull & tøys ---------------- */

.fun-hero {
  display: grid; grid-template-columns: 1.45fr .85fr; gap: 1.25rem;
  align-items: stretch; margin-bottom: 1.6rem;
}

.fun-hero-text {
  background: linear-gradient(135deg, #fff 0%, #fff8ef 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.fun-hero-text::after {
  content: "🤡"; position: absolute; right: -12px; bottom: -30px;
  font-size: 8rem; opacity: .07; transform: rotate(-8deg); pointer-events: none;
}
.fun-hero-text h1 { font-size: clamp(2rem, 4.6vw, 3rem); }
.fun-hero-text p { color: var(--ink-soft); margin-top: .75rem; max-width: 58ch; }

.fun-hero-card {
  background: linear-gradient(160deg, #00205b, #101c33);
  color: #fff; border-radius: var(--radius); padding: 1.4rem;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 1rem;
}
.fun-hero-card h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; opacity: .65; font-weight: 700; }
.fun-quote {
  margin-top: auto; padding-top: .8rem; border-top: 1px solid rgba(255, 255, 255, .16);
  font-size: .85rem; font-style: italic; opacity: .86;
}
.fun-quote span { display: block; margin-top: .3rem; font-style: normal; font-size: .72rem; opacity: .6; }

.fun-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 2rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, var(--amber-soft), #fffdf9);
  border: 1px solid #f0d8ae; border-radius: var(--radius);
}
.fun-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.fun-banner p { color: #5a3c05; font-size: .9rem; max-width: 68ch; }
.fun-banner-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------------- samtaler ---------------- */

.dialogue-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 2rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, #e7f0fa, #fff);
  border: 1px solid #c9dcf0; border-radius: var(--radius);
}
.dialogue-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.dialogue-banner p { color: #14385c; font-size: .9rem; max-width: 68ch; }

.dialogue-intro {
  background: linear-gradient(135deg, var(--ink), var(--blue));
}
.dialogue-progress {
  display: flex; align-items: center; gap: .8rem; margin-top: 1rem;
  font-size: .82rem; color: rgba(255, 255, 255, .86);
}
.dialogue-progress .meter { flex: 0 1 240px; background: rgba(255, 255, 255, .22); }
.dialogue-progress .meter > i { background: #f0b64a; }

.dialogue-card { border-top: 3px solid var(--blue); }
.dialogue-card:nth-child(2) { border-top-color: var(--green); }
.dialogue-card:nth-child(3) { border-top-color: var(--amber); }
.dialogue-card .num { color: var(--blue); }

.dlg-intro-text { color: var(--muted); font-size: .9rem; margin-top: .6rem; max-width: 58ch; }

.dialogue-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.dialogue-toolbar h2 { margin: 0; }
.dialogue { display: flex; flex-direction: column; gap: .85rem; }
.dline { display: flex; align-items: flex-start; gap: .6rem; max-width: 86%; }
.dline.me { margin-inline-start: auto; flex-direction: row-reverse; }
.davatar {
  width: 2rem; height: 2rem; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--blue-soft); color: var(--blue);
  font-size: .72rem; font-weight: 800; letter-spacing: .02em;
}
.dline.me .davatar { background: var(--red-soft); color: var(--red); }
.dbubble {
  min-width: 0; padding: .62rem .8rem;
  background: #f8f9fc; border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
}
.dline.me .dbubble {
  background: #fff7f9; border-color: #f3d3da;
  border-radius: 14px 4px 14px 14px;
}
.dmeta { display: flex; align-items: center; gap: .4rem; margin-bottom: .18rem; }
.dwho {
  font-size: .7rem; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.dno { font-size: 1.02rem; line-height: 1.45; }
.des {
  margin-top: .35rem; padding-top: .32rem;
  border-top: 1px dashed var(--line);
  font-size: .84rem; color: var(--muted);
}
.des[hidden] { display: none; }
.des::before { content: "→ "; opacity: .6; }

/* ---------------- meldinger (WhatsApp noruego) ---------------- */

.chat-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 1rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, #e4f6ec, #fff);
  border: 1px solid #c2e6d1; border-radius: var(--radius);
}
.chat-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.chat-banner p { color: #0c4a38; font-size: .9rem; max-width: 68ch; }

.chat-intro { background: linear-gradient(135deg, #075e54, #128c7e); }

.app-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 1rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, #fdecef, #fff);
  border: 1px solid #f3c3cd; border-radius: var(--radius);
}
.app-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.app-banner p { color: #6d1226; font-size: .9rem; max-width: 68ch; }
.app-banner .install-hint { font-size: .78rem; opacity: .75; margin-top: .3rem; }

.app-intro { background: linear-gradient(135deg, #7a0a20, var(--red)); }
.app-options {
  display: grid; gap: 1rem; max-width: 680px;
  grid-template-columns: 1fr;
}
.app-option h2 { margin-top: .3rem; }
.app-option > p { color: var(--muted); font-size: .92rem; }
.app-ico { font-size: 2rem; line-height: 1; }
.app-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0; }
.app-steps {
  display: grid; gap: .35rem; margin: .6rem 0 0;
  padding-inline-start: 1.2rem; color: var(--ink-soft); font-size: .9rem;
}
.app-meta { margin-top: 1rem; }
.app-meta p { font-size: .9rem; }
.app-meta .muted { color: var(--muted); margin-top: .35rem; }
.install-hint { font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.install-hint:empty { display: none; }

.app-help { margin-top: 1rem; border-top: 1px dashed var(--line); padding-top: .8rem; }
.app-help summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.app-help ul {
  display: grid; gap: .35rem; margin: .6rem 0 0;
  padding-inline-start: 1.2rem; color: var(--ink-soft); font-size: .86rem;
}

.app-pill { text-decoration: none; }
.app-pill:hover { border-color: #b9c3d4; color: var(--ink); }
.site-foot a { color: var(--blue); }

.chat-card { border-top: 3px solid #128c7e; }
.chat-card .num { color: #128c7e; }
.chat-thumb {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px; background: #ece5dd; min-height: 148px;
  border-bottom: 1px solid var(--line);
}
.chat-thumb-emoji { font-size: 1.9rem; line-height: 1; }
.cb-mini {
  display: block; width: 72%; padding: 7px 9px;
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
.cb-mini.right { align-self: flex-end; width: 56%; background: #d9fdd3; }
.cb-mini i { display: block; height: 6px; border-radius: 3px; background: #d6dbe3; margin: 3px 0; }
.cb-mini i:last-child { width: 55%; }
.cb-mini.right i { background: #a7d99a; }

.chat-head-block { margin: .4rem 0 1.4rem; }

.chatphone {
  max-width: 470px; margin: .5rem auto 0;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow);
}
.chat-topbar {
  display: flex; align-items: center; gap: .6rem;
  background: #075e54; color: #fff; padding: .55rem .85rem;
}
.chat-back { font-size: 1.5rem; line-height: 1; opacity: .85; }
.chat-ava {
  width: 2.2rem; height: 2.2rem; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: 50%;
  background: #fff; font-size: 1.1rem;
}
.chat-titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.chat-titles b { font-size: .95rem; }
.chat-titles small { opacity: .82; font-size: .72rem; }
.chat-ico { margin-inline-start: auto; opacity: .92; }

.chat-body {
  display: flex; flex-direction: column; gap: .45rem;
  padding: 1rem .8rem 1.2rem; background: #efeae2; min-height: 320px;
}
.daysep { display: flex; justify-content: center; margin-bottom: .4rem; }
.daysep span {
  background: #fff; color: var(--muted); font-size: .68rem; font-weight: 700;
  padding: .22rem .75rem; border-radius: 999px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.cmsg { display: flex; }
.cbub {
  max-width: 82%; padding: .4rem .55rem .3rem;
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}
.cmsg.me { justify-content: flex-end; }
.cmsg.me .cbub { background: #d9fdd3; }
.cname { display: block; font-size: .72rem; font-weight: 800; margin-bottom: 1px; }
.cno { margin: 0; font-size: .92rem; line-height: 1.38; overflow-wrap: anywhere; }
.ces {
  margin: .28rem 0 0; padding-top: .25rem;
  border-top: 1px dashed var(--line);
  font-size: .8rem; color: var(--muted);
}
.ces[hidden] { display: none; }
.ces::before { content: "→ "; opacity: .6; }
.ctime { display: block; text-align: end; font-size: .64rem; color: #8696a0; margin-top: 2px; }
.ctime .ticks { color: #53bdeb; font-style: normal; }

.say.csay {
  width: 1.25rem; height: 1.25rem; font-size: .6rem;
  vertical-align: -2px; margin-inline-end: .3rem;
  background: transparent; border-color: transparent; color: #8696a0;
}
.say.csay:hover { background: rgba(0, 0, 0, .06); color: var(--ink); transform: none; }
.say.csay.playing { background: #128c7e; color: #fff; border-color: #128c7e; }
.g-item .say.csay { align-self: center; margin-inline-end: 0; color: var(--ink-soft); border-color: var(--line); background: #fff; }
.g-item .say.csay:hover { background: var(--blue-soft); color: var(--blue); }

.chat-input {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: #f0f2f5; padding: .5rem .8rem; color: #8696a0; font-size: .9rem;
}
.chat-input-text { flex: 1; background: #fff; border-radius: 999px; padding: .45rem .9rem; }

.glossary {
  display: grid; gap: .55rem;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.g-item {
  display: flex; align-items: baseline; gap: .55rem;
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .65rem;
}
.g-no { font-weight: 800; white-space: nowrap; }
.g-es { font-size: .84rem; color: var(--muted); }

.fun-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
.fun-card {
  display: flex; flex-direction: column; gap: .45rem;
  text-decoration: none; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  border-top: 4px solid var(--red);
}
.fun-card:nth-child(2) { border-top-color: var(--green); }
.fun-card:nth-child(3) { border-top-color: var(--blue); }
.fun-card:nth-child(4) { border-top-color: var(--amber); }
.fun-card:nth-child(5) { border-top-color: #6b4bb8; }
.fun-card:nth-child(6) { border-top-color: #0f7f8f; }
.fun-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd6e2; }
.fun-card .head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.fun-emoji { font-size: 1.65rem; line-height: 1; }
.fun-card h3 { font-size: 1.12rem; margin-top: .15rem; }
.fun-card p { font-size: .88rem; color: var(--ink-soft); }
.fun-card .foot { display: flex; align-items: center; gap: .4rem; margin-top: auto; padding-top: .45rem; flex-wrap: wrap; }
.fun-card .go { margin-inline-start: auto; font-size: .82rem; font-weight: 700; color: var(--red); }

/* tabla de palabras y verbos */
.word-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .55rem; }
.word-tools input, .word-tools select {
  font: inherit; font-size: .88rem; padding: .52rem .7rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); outline: none;
}
.word-tools input { flex: 2 1 220px; min-width: 170px; }
.word-tools select { flex: 1 1 150px; cursor: pointer; }
.word-tools input:focus, .word-tools select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 32, 91, .08);
}
.wb-switch {
  display: inline-flex; align-items: center; gap: .4rem; flex: 0 0 auto;
  font-size: .82rem; color: var(--ink-soft); padding: .45rem .6rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
  white-space: nowrap;
}
.wb-switch input { accent-color: var(--red); cursor: pointer; }
.wb-levels { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }

.wtable-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}
.wtable { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 620px; }
.wtable th {
  text-align: start; background: #f8f9fc; border-bottom: 1px solid var(--line);
  padding: 0; position: sticky; top: 0; z-index: 1;
}
.wb-sort {
  width: 100%; text-align: start; border: 0; background: transparent;
  padding: .62rem .7rem; font: inherit; font-size: .72rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted); cursor: pointer;
}
.wb-sort:hover { color: var(--ink); background: #f0f2f7; }
.sort-mark { opacity: .55; margin-inline-start: .2rem; }
.wtable td { padding: .55rem .7rem; border-top: 1px solid var(--line); vertical-align: top; }
.wtable tbody tr:hover { background: #fafbff; }
.wb-no { display: flex; align-items: center; gap: .45rem; font-weight: 650; }
.wb-es { color: var(--ink-soft); }
.wb-note { display: block; color: var(--muted); font-size: .76rem; margin-top: .12rem; font-weight: 400; }
.wb-level {
  display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .04em;
  padding: .15rem .42rem; border-radius: 6px; background: var(--blue-soft); color: var(--blue);
}
.wb-level.lvl-a1 { background: var(--green-soft); color: var(--green); }
.wb-level.lvl-a2 { background: #e8f3ff; color: #0b5d9c; }
.wb-level.lvl-b1 { background: var(--amber-soft); color: var(--amber); }
.wb-level.lvl-b2 { background: var(--red-soft); color: var(--red); }
.wb-level.lvl-c1 { background: #ede9fe; color: #6d28d9; }
.wb-level.lvl-c2 { background: #fce7f3; color: #be185d; }
.wb-tag {
  display: inline-block; font-size: .72rem; color: var(--muted);
  background: var(--bg); padding: .15rem .45rem; border-radius: 6px;
}
.wb-empty { text-align: center !important; color: var(--muted); padding: 1.6rem !important; }
.wb-dots { display: none; }
.wtable.hide-es tbody tr:not(.revealed) .wb-real,
.wtable.hide-es tbody tr:not(.revealed) .wb-note { display: none; }
.wtable.hide-es tbody tr:not(.revealed) .wb-dots {
  display: inline; color: var(--muted); letter-spacing: .15em;
}
.wtable.hide-es tbody tr:not(.revealed) { cursor: pointer; }
.wtable.hide-es tbody tr:not(.revealed):hover { background: var(--amber-soft); }

.verb-table { min-width: 560px; }
.vb-form { font-weight: 650; color: var(--blue); }
.verb-table.hide-forms .vb-form {
  color: transparent; position: relative; user-select: none;
}
.verb-table.hide-forms .vb-form::after {
  content: "•••"; color: var(--muted); position: absolute; inset: 0; letter-spacing: .08em;
}

/* odd, fix y memory */
.fix-sentence { font-size: 1.12rem; line-height: 2.15; }
.fix-word {
  font: inherit; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; padding: .13rem .4rem; margin: .05rem; cursor: pointer;
  color: var(--ink); transition: border-color .12s, background .12s, transform .1s;
}
.fix-word:hover:not([disabled]) { border-color: #b9c3d4; transform: translateY(-1px); }
.fix-word.correct { border-color: var(--green); background: var(--green-soft); color: #0b5c3f; font-weight: 700; }
.fix-word.wrong { border-color: var(--red); background: var(--red-soft); color: #8a1029; animation: shake .25s; }
.fix-word[disabled] { cursor: default; }

.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.mem-card {
  min-height: 5.4rem; padding: .45rem; border: 1px solid var(--line);
  border-radius: 12px; background: linear-gradient(145deg, #fff, #eef2fb);
  color: var(--ink); font: inherit; font-size: .9rem; font-weight: 650;
  cursor: pointer; display: grid; place-items: center; text-align: center;
  transition: border-color .12s, background .12s, transform .1s;
  overflow-wrap: anywhere;
}
.mem-card:hover:not(.flip):not(.done) { border-color: #b9c3d4; transform: translateY(-1px); }
.mem-card .mem-face { display: none; width: 100%; }
.mem-card .mem-back { display: flex; align-items: center; justify-content: center; font-size: 1.35rem; opacity: .75; }
.mem-card.flip .mem-back, .mem-card.done .mem-back { display: none; }
.mem-card.flip .mem-front, .mem-card.done .mem-front { display: flex; align-items: center; justify-content: center; }
.mem-card.flip { background: #fff; border-color: #b9c3d4; }
.mem-card.done { border-color: var(--green); background: var(--green-soft); color: #0b5c3f; }
.mem-card.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .25s; }

/* ---------------- simulacro de examen ---------------- */

.exam-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 1rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, var(--blue-soft), #f8faff);
  border: 1px solid #cfd9f4; border-radius: var(--radius);
}
.exam-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.exam-banner p { color: #24365e; font-size: .9rem; max-width: 68ch; }

.exam-hero { margin-bottom: .5rem; }
.exam-howto { margin: 0; padding-inline-start: 1.1rem; display: flex; flex-direction: column; gap: .5rem; font-size: .86rem; }
.exam-howto li::marker { color: #fff; opacity: .7; }

.exam-levels {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}
.exam-card {
  display: flex; flex-direction: column; gap: .45rem;
  text-decoration: none; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  border-top: 4px solid var(--blue);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.exam-card:nth-child(2) { border-top-color: var(--green); }
.exam-card:nth-child(3) { border-top-color: var(--amber); }
.exam-card:nth-child(4) { border-top-color: var(--red); }
.exam-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #cfd6e2; }
.exam-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.exam-level {
  width: 2.5rem; height: 2.5rem; border-radius: 12px; display: grid; place-items: center;
  background: var(--blue); color: #fff; font-weight: 800; font-size: .9rem; letter-spacing: .02em;
}
.exam-card:nth-child(2) .exam-level { background: var(--green); }
.exam-card:nth-child(3) .exam-level { background: var(--amber); }
.exam-card:nth-child(4) .exam-level { background: var(--red); }
.exam-card h3 { font-size: 1.12rem; margin-top: .15rem; }
.exam-card p { font-size: .88rem; color: var(--ink-soft); }
.exam-card-foot { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: auto; padding-top: .45rem; }
.exam-card .go { margin-inline-start: auto; font-size: .82rem; font-weight: 700; color: var(--blue); }
.exam-best { display: flex; flex-wrap: wrap; gap: .3rem; }
.exam-best .chip { background: #eef2fb; color: var(--blue); }

.exam-bar {
  display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin-bottom: 1rem; padding: .65rem .9rem;
  background: var(--blue); color: #fff; border-radius: 14px;
  box-shadow: 0 6px 18px -12px rgba(0, 32, 91, .9);
}
.exam-part { font-weight: 700; font-size: .86rem; }
.exam-timeleft { margin-inline-start: auto; font-size: .76rem; opacity: .7; }
.exam-clock {
  direction: ltr; unicode-bidi: isolate;
  font-variant-numeric: tabular-nums; font-size: 1rem; font-weight: 800;
  background: rgba(255, 255, 255, .14); padding: .22rem .6rem; border-radius: 9px;
  min-width: 4.2ch; text-align: center;
}
.exam-clock.low { background: var(--red); }

.exam-note {
  font-size: .86rem; color: #5a3c05; background: var(--amber-soft);
  border: 1px solid #f0d8ae; border-radius: 12px; padding: .6rem .8rem; margin-bottom: 1rem;
}

.exam-q { border-bottom: 1px dashed var(--line); padding-bottom: .9rem; margin-bottom: .9rem; }
.exam-q:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.exam-q-text { font-size: 1rem; font-weight: 600; margin-bottom: .55rem; }
.exam-prompt { font-size: 1rem; margin-bottom: .4rem; }
.exam-right { color: var(--green); font-size: .9rem; margin-top: .2rem; }

.opt.sel { border-color: var(--blue); background: var(--blue-soft); }
.opt.sel .key { background: var(--blue); color: #fff; }
.opt.sel:hover:not([disabled]) { border-color: var(--blue); background: var(--blue-soft); }

.exam-ta {
  width: 100%; min-height: 13rem; resize: vertical;
  font: inherit; font-size: 1rem; line-height: 1.65;
  padding: .85rem .95rem; border: 2px solid var(--line); border-radius: 12px;
  background: #fcfdff; color: var(--ink); outline: none;
  transition: border-color .12s, background .12s;
}
.exam-ta:focus { border-color: var(--blue); background: #fff; }

.exam-usertext {
  margin: .55rem 0 .85rem; padding: .6rem .8rem;
  border-inline-start: 3px solid var(--green); border-radius: 8px;
  background: var(--green-soft); color: #0b5c3f;
  font-size: .92rem; line-height: 1.55; white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.exam-check { display: grid; gap: .35rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.exam-check label {
  display: flex; align-items: flex-start; gap: .55rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: .5rem .65rem;
  font-size: .9rem; background: #fcfdff;
}
.exam-check label:hover { border-color: #b9c3d4; background: #fff; }
.exam-check input { accent-color: var(--green); margin-top: .18rem; flex: 0 0 auto; }
.exam-check input:checked + span { color: var(--green); font-weight: 600; }

.exam-speak { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.exam-count {
  direction: ltr; unicode-bidi: isolate;
  font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 800; color: var(--blue);
  min-width: 4.5ch;
}

.exam-plan { display: flex; flex-direction: column; gap: .1rem; }
.exam-plan-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem;
}
.exam-plan-row:last-child { border-bottom: 0; }
.exam-plan-row span { color: var(--muted); font-size: .86rem; text-align: end; }

.exam-nav { margin-top: .2rem; }
.exam-nav .btn.small { margin-inline-start: auto; }

.exam-report td { vertical-align: middle; }
.exam-report .meter { background: var(--line); min-width: 90px; }
.exam-report .meter > i { background: linear-gradient(90deg, var(--green), #38b781); }

.exam-wrong {
  border: 1px solid var(--line); border-radius: 12px;
  padding: .7rem .85rem; margin-bottom: .6rem; background: #fcfdff;
}
.exam-wrong:last-child { margin-bottom: 0; }
.exam-wrong .chip { margin-inline-end: .3rem; }

.exam-model { border-top: 1px dashed var(--line); padding: .7rem 0; }
.exam-model:first-of-type { border-top: 0; padding-top: 0; }
.exam-model:last-child { padding-bottom: 0; }
.exam-model-text { font-size: .94rem; color: var(--ink-soft); line-height: 1.6; }

html[dir="rtl"] .opt:hover:not([disabled]) { transform: translateX(-2px); }
html[dir="rtl"] .exam-text h2,
html[dir="rtl"] .exam-text .text-body p,
html[dir="rtl"] .exam-prompt,
html[dir="rtl"] .exam-q-text,
html[dir="rtl"] .opt,
html[dir="rtl"] .exam-model-text,
html[dir="rtl"] .exam-usertext {
  direction: ltr; unicode-bidi: isolate; text-align: start;
}

/* ---------------- historia: Lucía i Oslo ---------------- */

.story-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  margin-top: 1rem; padding: 1.3rem 1.4rem;
  background: linear-gradient(135deg, #f3efe4, #fffdf8);
  border: 1px solid #e3d8bd; border-radius: var(--radius);
}
.story-banner h2 { font-size: clamp(1.1rem, 2.4vw, 1.35rem); margin: .35rem 0 .25rem; }
.story-banner p { color: #514329; font-size: .9rem; max-width: 68ch; }

.story-intro { background: linear-gradient(135deg, #173b2c, #2e6b4f); }
.story-progress {
  display: flex; align-items: center; gap: .8rem; margin-top: 1rem;
  font-size: .82rem; color: rgba(255, 255, 255, .86);
}
.story-progress .meter { flex: 0 1 240px; background: rgba(255, 255, 255, .22); }
.story-progress .meter > i { background: #f0b64a; }
.story-actions { margin-top: 1rem; }

.story-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.story-card {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem 1.1rem; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  border-top: 3px solid var(--green); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 28, 51, .04);
  transition: transform .15s, box-shadow .15s;
}
.story-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 28, 51, .08); }
.story-card.soon { opacity: .62; border-top-color: var(--line); }
.story-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.story-emoji { font-size: 1.5rem; line-height: 1; }
.story-num {
  font-size: .68rem; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.story-card h3 { margin: .15rem 0 0; font-size: 1.08rem; }
.story-card .sub { color: var(--muted); font-size: .86rem; }
.story-place { color: var(--ink-soft); font-size: .78rem; margin: .15rem 0 .35rem; }
.story-card .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: .3rem; }
.story-note { margin-top: 1rem; }

.story-head { margin-bottom: .5rem; }
.story-intro-text { color: var(--muted); font-size: .9rem; margin-top: .55rem; max-width: 62ch; }
.story-meta { color: var(--ink-soft); font-size: .82rem; margin-top: .45rem; }
.places { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.place-chip {
  display: inline-flex; align-items: center; padding: .16rem .5rem;
  background: var(--green-soft); color: #0b5c3f;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.story-hero {
  min-height: 220px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .1rem;
  background: linear-gradient(150deg, #e7f2e9, #f8f4e8);
  border: 1px solid #d7e6d9; border-radius: var(--radius);
}
.story-hero span { font-size: 4rem; line-height: 1; }
.story-hero b { font-size: 1.15rem; color: #173b2c; }
.story-hero small { color: var(--muted); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; }

.story-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.story-toolbar h2 { margin: 0; }
.story-text { display: flex; flex-direction: column; gap: 1.15rem; }
.story-para { padding-bottom: 1.1rem; border-bottom: 1px dashed var(--line); }
.story-para:last-child { padding-bottom: 0; border-bottom: 0; }
.sp-no {
  display: flex; align-items: flex-start; gap: .45rem;
  font-size: 1.02rem; line-height: 1.65; color: var(--ink-soft);
}
.sp-no > span { min-width: 0; }
.story-es {
  margin-top: .45rem; padding-top: .4rem;
  border-top: 1px dashed var(--line);
  font-size: .87rem; line-height: 1.55; color: var(--muted);
}
.story-es[hidden] { display: none; }
.story-es::before { content: "→ "; opacity: .6; }
.story-tr-btn {
  display: inline-block; margin-top: .5rem; padding: 0;
  border: 0; background: transparent; cursor: pointer;
  color: var(--blue); font: inherit; font-size: .78rem; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
.story-tr-btn:hover { color: var(--red); }
.story-forms { display: block; font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.story-grammar-title { font-size: 1rem; margin: .2rem 0 .35rem; }
.story-grammar-text { color: var(--ink-soft); font-size: .9rem; line-height: 1.6; margin-bottom: .7rem; }
.story-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: .7rem; flex-wrap: wrap; margin-top: 1.2rem;
}
.story-nav .btn { flex: 0 1 auto; }
.story-more { color: var(--muted); font-size: .82rem; }

/* ---------------- footer ---------------- */

.site-foot {
  max-width: 1080px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: .3rem;
}
.muted { color: var(--muted); }

/* ---------------- responsive ---------------- */

@media (max-width: 1320px) {
  .topbar { flex-wrap: wrap; }
  .hud { margin-inline-start: auto; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; overflow: visible; row-gap: .12rem; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .8rem 1.4rem; }
  .hero-card > * { flex: 1 1 auto; }
  .wotd { flex-basis: 100%; margin-top: .2rem; }
  .fun-hero { grid-template-columns: 1fr; }
  .fun-hero-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .8rem 1.4rem; }
  .fun-hero-card > * { flex: 1 1 auto; }
  .fun-quote { flex-basis: 100%; margin-top: .2rem; }
  .fun-banner { flex-direction: column; align-items: flex-start; }
  .dialogue-banner { flex-direction: column; align-items: flex-start; }
  .story-banner { flex-direction: column; align-items: flex-start; }
  .chat-banner { flex-direction: column; align-items: flex-start; }
  .app-banner { flex-direction: column; align-items: flex-start; }
  .exam-banner { flex-direction: column; align-items: flex-start; }
  .story-head { grid-template-columns: 1fr; }
  .story-hero { min-height: 150px; }
}

@media (max-width: 640px) {
  .topbar { position: static; flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem .75rem; }
  .brand { font-size: 1rem; }
  .hud { margin-inline-start: auto; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; overflow: visible; row-gap: .15rem; }
  .nav a { padding: .34rem .55rem; font-size: .82rem; white-space: nowrap; }
  .vocab { grid-template-columns: 1fr 1fr; }
  .result .score { font-size: 2.1rem; }
  .para .no { font-size: .98rem; }
  .memory-grid { grid-template-columns: repeat(3, 1fr); }
  .mem-card { min-height: 4.7rem; font-size: .82rem; }
  .word-tools input, .word-tools select { flex-basis: 100%; }
  .wb-switch { width: 100%; justify-content: center; }
  .fix-sentence { font-size: 1.02rem; }
}

@media (max-width: 560px) {
  .dline { max-width: 100%; }
  .dialogue-toolbar { align-items: flex-start; }
  .dno { font-size: .98rem; }
  .dialogue-progress { flex-wrap: wrap; }
  .chatphone { max-width: none; }
  .cbub { max-width: 88%; }
}

@media (max-width: 440px) {
  .memory-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------- فارسی (rtl) ---------------- */

html[lang="fa"] {
  --font: Vazirmatn, "Segoe UI", Tahoma, "Iranian Sans", "Noto Naskh Arabic UI", "Noto Sans Arabic", system-ui, sans-serif;
}

/* el noruego se lee siempre de izquierda a derecha, incluso en la página RTL */
html[dir="rtl"] .para .no,
html[dir="rtl"] .gx .no, html[dir="rtl"] .vocab .no, html[dir="rtl"] .phrase .no,
html[dir="rtl"] .wb-no, html[dir="rtl"] .w-no, html[dir="rtl"] .dno,
html[dir="rtl"] .cno, html[dir="rtl"] .g-no,
html[dir="rtl"] .part-chip b, html[dir="rtl"] .part-title h3,
html[dir="rtl"] .b-sentence, html[dir="rtl"] .body-phrases .no,
html[dir="rtl"] .sp-no,
html[dir="rtl"] .sline .sno {
  direction: ltr; unicode-bidi: isolate; text-align: start;
}

html[dir="rtl"] .para .es::before { content: "← "; }
html[dir="rtl"] .des::before { content: "← "; }
html[dir="rtl"] .ces::before { content: "← "; }
html[dir="rtl"] .story-es::before { content: "← "; }

/* ---------------- práctica, progreso, nivel y entrenador ---------------- */

.practice-strip {
  display: grid; gap: .7rem; margin: 1.2rem 0 .6rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.practice-chip {
  display: flex; flex-direction: column; gap: .2rem;
  padding: .85rem 1rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.practice-chip b { font-size: .95rem; }
.practice-chip span { font-size: .8rem; color: var(--muted); }
.practice-chip:hover { border-color: var(--blue); transform: translateY(-1px); }

.prog-intro { background: linear-gradient(135deg, var(--ink), #24406b); }
.tr-intro { background: linear-gradient(135deg, #2b1a5e, #4b3a8f); }
.level-intro { background: linear-gradient(135deg, #0b4a3c, #12855a); }

.prog-stats {
  display: grid; gap: .8rem; margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.prog-stat {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: .9rem 1rem;
}
.prog-stat span {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.prog-stat b { font-size: 1.8rem; line-height: 1.15; }
.prog-stat small { color: var(--muted); font-size: .78rem; }

.prog-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; margin-bottom: .8rem;
}
.prog-card-head h2 { margin: 0; }

.heatmap {
  display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px; justify-content: start;
  gap: 3px; overflow-x: auto; padding-bottom: .3rem;
}
.hm { width: 12px; height: 12px; border-radius: 3px; background: var(--line); }
.hm.l0 { background: var(--line); }
.hm.l1 { background: #b9e3c6; }
.hm.l2 { background: #7fcb9a; }
.hm.l3 { background: #3da86f; }
.hm.l4 { background: #12855a; }
.hm.empty { background: transparent; }
.hm-legend {
  display: flex; align-items: center; gap: 4px; margin-top: .6rem;
  font-size: .7rem; color: var(--muted);
}

.badges { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .7rem; border: 1px dashed var(--line); border-radius: 12px;
  opacity: .5;
}
.badge.earned { opacity: 1; border-style: solid; background: var(--green-soft); }
.badge .b-ico { font-size: 1.4rem; line-height: 1.2; }
.badge b { font-size: .85rem; }
.badge small { font-size: .75rem; color: var(--muted); }

.prog-review { font-size: .95rem; }
.prog-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.file-btn { cursor: pointer; }

.level-start { margin-top: 1rem; }
.level-verdict { font-size: 1.15rem; margin: .4rem 0 1rem; }
.level-bars { display: grid; gap: .45rem; margin-bottom: 1.2rem; }
.level-row {
  display: grid; grid-template-columns: 2.5rem 1fr 3rem;
  align-items: center; gap: .6rem; font-size: .85rem;
}
.level-row .meter { background: var(--line); height: 8px; }
.level-row .meter > i { background: var(--green); }
.level-row small { text-align: end; color: var(--muted); }

.tr-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tr-card {
  display: flex; flex-direction: column; gap: .3rem;
  padding: 1.1rem; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.tr-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.tr-ico { font-size: 1.8rem; }
.tr-card b { font-size: 1.05rem; }
.tr-card span { font-size: .85rem; color: var(--muted); }
.tr-card em { font-style: normal; color: var(--red); font-weight: 700; font-size: .82rem; margin-top: .5rem; }

.kbd {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%);
  z-index: 80; display: flex; gap: .3rem; padding: .35rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.kbd button {
  width: 2.6rem; height: 2.4rem; font: inherit; font-weight: 800;
  font-size: 1.05rem; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); border-radius: 8px; cursor: pointer;
}
.kbd button:active { background: var(--blue-soft); }

.pill.theme-pill { cursor: pointer; font-size: .95rem; padding: .22rem .5rem; }
a.pill { text-decoration: none; }
.foot-links a { color: var(--blue); }

/* ---------------- modo oscuro ---------------- */

html[data-theme="dark"] {
  --bg: #0d1420;
  --card: #151f2d;
  --ink: #e9eff9;
  --ink-soft: #c3cedd;
  --muted: #93a2b8;
  --line: #273343;
  --red: #ef5a72;
  --red-soft: #3a1620;
  --blue: #8db4ff;
  --blue-soft: #182741;
  --green: #37c98f;
  --green-soft: #102e24;
  --amber: #f0b64a;
  --amber-soft: #3a2a12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 30px -12px rgba(0, 0, 0, .7);
}
html[data-theme="dark"] body { background: var(--bg); }
html[data-theme="dark"] .topbar { background: rgba(13, 20, 32, .9); border-bottom-color: var(--line); }
html[data-theme="dark"] .nav a:hover { background: #1c2838; color: var(--ink); }
html[data-theme="dark"] .nav a.active { background: var(--ink); color: #0d1420; }

html[data-theme="dark"] .opt,
html[data-theme="dark"] .word,
html[data-theme="dark"] .filters input,
html[data-theme="dark"] .word-tools input,
html[data-theme="dark"] .word-tools select,
html[data-theme="dark"] .blank-input,
html[data-theme="dark"] .listen-input,
html[data-theme="dark"] .transform-input,
html[data-theme="dark"] .fix-word,
html[data-theme="dark"] .m-item,
html[data-theme="dark"] .mem-card,
html[data-theme="dark"] .cbub,
html[data-theme="dark"] .chat-input-text,
html[data-theme="dark"] .cb-mini {
  background: #1b2635;
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea { background: #1b2635; color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .opt.correct { background: var(--green-soft); }
html[data-theme="dark"] .opt.wrong { background: var(--red-soft); }
html[data-theme="dark"] .opt:hover:not([disabled]) { background: #223143; }

html[data-theme="dark"] .dbubble { background: #1b2635; border-color: var(--line); }
html[data-theme="dark"] .dline.me .dbubble { background: #2a1d24; border-color: #4a2a34; }
html[data-theme="dark"] .chat-body { background: #0f171d; }
html[data-theme="dark"] .cmsg.me .cbub { background: #123f35; }
html[data-theme="dark"] .chat-thumb { background: #1a2320; }
html[data-theme="dark"] .cb-mini.right { background: #17453a; }
html[data-theme="dark"] .chat-input { background: #131d29; }
html[data-theme="dark"] .daysep span { background: #1c2937; color: var(--muted); }

html[data-theme="dark"] .dialogue-banner {
  background: linear-gradient(135deg, #152437, #151f2d); border-color: #2a3b52;
}
html[data-theme="dark"] .dialogue-banner p { color: #bcd2ea; }
html[data-theme="dark"] .chat-banner {
  background: linear-gradient(135deg, #13281f, #151f2d); border-color: #24402f;
}
html[data-theme="dark"] .chat-banner p { color: #b9e0c8; }
html[data-theme="dark"] .app-banner {
  background: linear-gradient(135deg, #33151d, #151f2d); border-color: #4a2530;
}
html[data-theme="dark"] .app-banner p { color: #f0c4cd; }
html[data-theme="dark"] .exam-banner {
  background: linear-gradient(135deg, #1a2438, #151f2d); border-color: #2c3d57;
}
html[data-theme="dark"] .fun-banner {
  background: linear-gradient(135deg, #2c2415, #151f2d); border-color: #4a3c24;
}
html[data-theme="dark"] .story-banner {
  background: linear-gradient(135deg, #2a2618, #151f2d); border-color: #4a4324;
}
html[data-theme="dark"] .story-banner p { color: #e2d6b4; }
html[data-theme="dark"] .story-card { background: var(--card); }
html[data-theme="dark"] .story-hero {
  background: linear-gradient(150deg, #16281f, #1a2432); border-color: #2a4033;
}
html[data-theme="dark"] .story-hero b { color: #bfe6ce; }
html[data-theme="dark"] .place-chip { background: #123126; color: #9fe0bb; }

html[data-theme="dark"] .hm.l1 { background: #1f5c43; }
html[data-theme="dark"] .hm.l2 { background: #27805c; }
html[data-theme="dark"] .hm.l3 { background: #31a878; }
html[data-theme="dark"] .hm.l4 { background: #46d39a; }

html[data-theme="dark"] .prog-intro {
  background: linear-gradient(135deg, #18263c, #101a29);
}
html[data-theme="dark"] .hero-card {
  background: linear-gradient(160deg, #17263d, #101a29);
  color: var(--ink);
}
html[data-theme="dark"] .vocab .row,
html[data-theme="dark"] .btn.ghost:hover,
html[data-theme="dark"] .fchip,
html[data-theme="dark"] .word-tools,
html[data-theme="dark"] .word-tools select,
html[data-theme="dark"] .wb-row,
html[data-theme="dark"] .exam-ta,
html[data-theme="dark"] .exam-check label,
html[data-theme="dark"] .exam-wrong,
html[data-theme="dark"] .g-item .say.csay {
  background: #1b2635;
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .tip,
html[data-theme="dark"] .colo-card .tip { color: var(--ink-soft); }
html[data-theme="dark"] .tip b { color: var(--ink); }
html[data-theme="dark"] .fun-banner p,
html[data-theme="dark"] .exam-banner p { color: var(--ink-soft); }

/* ---------------- kroppen ---------------- */

.body-intro { background: linear-gradient(135deg, #3b1220, #0e2a47); }
.body-disclaimer { font-size: .78rem; opacity: .75; margin-top: .5rem; }

.zone-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.zone-tab {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: .35rem .75rem; font: inherit; font-size: .82rem;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.zone-tab:hover { border-color: #b9c3d4; }
.zone-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.body-layout { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1.2rem; align-items: start; }
.bodymap-wrap {
  background: linear-gradient(180deg, #f2f6fb, #fff);
  border: 1px solid var(--line); border-radius: 16px; padding: .5rem;
}
.bodymap { display: block; width: 100%; max-width: 520px; margin: 0 auto; }
.bz { cursor: pointer; outline: none; }
.bz .bshape { transition: fill .15s; }
.bz:hover .bshape, .bz:focus-visible .bshape, .bz.active .bshape { fill: #f0b64a !important; }
.bmap-label { font-family: var(--font); font-size: 13px; fill: var(--muted); }

.zone-parts-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.zone-parts-head h3 { margin: 0; font-size: 1rem; }
.part-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .45rem; }
.part-chip {
  text-align: start; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: .45rem .55rem; cursor: pointer;
  display: flex; flex-direction: column;
}
.part-chip b { font-size: .9rem; }
.part-chip span { font-size: .75rem; color: var(--muted); }
.part-chip:hover { border-color: #b9c3d4; }
.part-chip.active { border-color: var(--red); background: var(--red-soft); }

.digit-wrap { display: flex; align-items: center; gap: .8rem; margin-bottom: .7rem; }
.digitmap { width: 130px; height: 120px; flex: 0 0 auto; background: var(--bg); border-radius: 12px; }
.digitmap .bz circle, .digitmap .bz rect { transition: fill .15s; }
.digitmap .bz:hover circle, .digitmap .bz:hover rect,
.digitmap .bz.active circle, .digitmap .bz.active rect { fill: #f0b64a; }

.part-detail { margin-top: .8rem; }
.part-detail-inner { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; background: var(--bg); }
.part-title { display: flex; align-items: center; gap: .5rem; }
.part-title h3 { margin: 0; }
.part-def { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.part-es { font-size: 1rem; font-weight: 600; margin: .3rem 0; }
.part-example { display: flex; align-items: center; gap: .45rem; font-size: .9rem; margin: .4rem 0 .6rem; }

.builder-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: .6rem; margin: .8rem 0; }
@media (max-width: 860px) { .builder-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .builder-grid { grid-template-columns: 1fr; } }
.builder-grid label {
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .72rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.builder-grid select {
  font: inherit; font-size: .9rem; font-weight: 500; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
  text-transform: none; letter-spacing: 0;
}
.builder-out { border: 1px solid var(--line); border-radius: 14px; padding: .9rem; background: var(--bg); }
.b-sentence { font-size: 1.08rem; font-weight: 700; margin: .4rem 0 .2rem; }
.b-gloss-label { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: .35rem; }
.b-gloss { font-size: .95rem; line-height: 1.5; color: var(--ink-soft); }

.body-phrases .phrase .no { font-weight: 600; }

.scenario { border-bottom: 1px dashed var(--line); padding: .5rem 0; }
.scenario:last-child { border-bottom: 0; }
.scenario summary { cursor: pointer; font-weight: 700; display: flex; flex-direction: column; gap: .1rem; position: relative; padding-inline-end: 1.2rem; }
.scenario summary::after { content: "▾"; position: absolute; inset-inline-end: 0; top: .1rem; color: var(--muted); transition: transform .15s; }
.scenario[open] summary::after { transform: rotate(180deg); }
.scenario summary span { font-weight: 400; font-size: .8rem; color: var(--muted); }
.sline {
  display: grid; grid-template-columns: 6.2rem 1.8rem 1fr;
  gap: .35rem .5rem; align-items: center;
  padding: .45rem 0; border-top: 1px dashed var(--line);
}
.sline .swho {
  font-size: .72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); grid-row: span 2;
}
.sline .sno { font-size: .92rem; }
.sline .ses { font-size: .8rem; color: var(--muted); grid-column: 3; }

.redflags { border-color: #f3c3cd; background: var(--red-soft); }
.redflags h2 { color: var(--red); }
.redflags ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; font-size: .9rem; display: grid; gap: .3rem; }

html[data-theme="dark"] .bodymap-wrap { background: #111a26; }
html[data-theme="dark"] .part-detail-inner,
html[data-theme="dark"] .builder-out,
html[data-theme="dark"] .digitmap { background: #111a26; }
html[data-theme="dark"] .body-intro { background: linear-gradient(135deg, #2a1420, #0e1c2d); }
html[data-theme="dark"] .zone-tab.active { background: var(--ink); color: #0d1420; border-color: var(--ink); }
html[data-theme="dark"] .redflags { background: #2a141b; border-color: #4a2530; }

@media (max-width: 860px) {
  .body-layout { grid-template-columns: 1fr; }
  .bodymap { max-width: 420px; }
}
@media (max-width: 560px) {
  .digit-wrap { flex-direction: column; align-items: flex-start; }
  .sline { grid-template-columns: 5.2rem 1.8rem 1fr; }
}

/* ---------------- lecciones ---------------- */

.lessons-intro { background: linear-gradient(135deg, #0e2a47, #1f4e79); }
.lessons-progress {
  display: flex; align-items: center; gap: .8rem; margin-top: 1rem;
  font-size: .82rem; color: rgba(255, 255, 255, .86);
}
.lessons-progress .meter { flex: 0 1 240px; background: rgba(255, 255, 255, .22); }
.lessons-progress .meter > i { background: #fff; }
.lessons-actions { margin-top: 1rem; }

.lessons-toolbar {
  display: flex; flex-wrap: wrap; gap: .6rem;
  align-items: center; margin: 1.2rem 0 .4rem;
}
.lessons-toolbar input {
  flex: 1 1 220px; min-width: 180px; padding: .6rem .9rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; font-size: .9rem;
  outline: none;
}
.lessons-toolbar input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 32, 91, .08); }
.level-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.level-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: .35rem .7rem; font: inherit; font-size: .82rem;
  min-width: 3.4rem; text-align: center;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.level-chip small { opacity: .6; font-size: .72rem; margin-inline-start: .15rem; }
.level-chip:hover { border-color: #b9c3d4; }
.level-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.lessons-home-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; margin-top: 1.6rem;
}
.lessons-home-head .section-title { margin: 0; }
.lessons-empty { margin-top: 1rem; }
.lesson-card.next-lesson { outline: 2px solid var(--red); outline-offset: 2px; }

html[data-theme="dark"] .level-chip.active { background: var(--ink); color: #0d1420; border-color: var(--ink); }


/* ---------------- kjerneord ---------------- */

.core-intro { background: linear-gradient(135deg, #3d2a6b, #0e2a47); }
.core-packs {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.core-pack {
  display: flex; flex-direction: column; gap: .35rem;
  padding: 1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; text-decoration: none; color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.core-pack:hover:not(.soon) { border-color: var(--blue); transform: translateY(-1px); }
.core-pack.soon { opacity: .58; }
.cp-top { display: flex; align-items: center; justify-content: space-between; font-size: 1.5rem; }
.core-pack h3 { font-size: 1rem; margin-top: .15rem; }
.core-pack p { font-size: .8rem; color: var(--muted); }
.cp-foot { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.cp-soon { margin-top: auto; padding-top: .5rem; font-size: .74rem; color: var(--muted); }
.core-note { font-size: .82rem; color: var(--muted); margin-top: 1rem; max-width: 72ch; }
.core-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }

.core-toolbar {
  display: flex; flex-wrap: wrap; gap: .6rem;
  align-items: center; margin-bottom: 1rem;
}
.core-toolbar input {
  flex: 1 1 220px; min-width: 180px; padding: .6rem .9rem;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; font-size: .9rem;
  outline: none;
}
.core-toolbar input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 32, 91, .08); }

.core-cat { font-size: .95rem; margin: 1.2rem 0 .5rem; }
.core-cat:first-child { margin-top: 0; }
.core-word-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.core-word {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem;
  border: 1px solid var(--line); border-radius: 12px;
  padding: .6rem .7rem; background: var(--bg);
}
.core-word.known { border-color: var(--green); background: var(--green-soft); }
.cw-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.cw-top { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.cw-no { font-size: 1rem; }
.cw-es { font-size: .82rem; color: var(--muted); }
.cw-forms { font-size: .74rem; color: var(--muted); }
.cw-know {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); border-radius: 999px; padding: .3rem .55rem;
  font: inherit; font-size: .72rem; cursor: pointer;
}
.cw-know:hover { border-color: var(--green); color: var(--green); }
.cw-know.on { background: var(--green); border-color: var(--green); color: #fff; }
.core-empty { margin-top: 1rem; }

html[dir="rtl"] .cw-no, html[dir="rtl"] .core-word .cw-forms { direction: ltr; unicode-bidi: isolate; text-align: start; }
