/* ============================================================
   Umami (med Miso) – stilar
   Palett från Flax: marin #182A45 / #243C60 / #34577B,
   gul #F4C843, gräddvit #FFF1CE, korall #EC8055
   ============================================================ */
:root {
  --navy: #182A45;
  --navy2: #243C60;
  --navy3: #34577B;
  --yellow: #F4C843;
  --yellow2: #FFE58C;
  --gold: #DBA529;
  --cream: #FFF1CE;
  --coral: #EC8055;
  --coral2: #C45B3B;
  --sky: #DDEEFF;
  --mint: #BFEBD8;
  --green: #2E9E6B;
  --lilac: #E4DDFB;
  --pink: #FFD9E0;

  --bg: #F6F3EA;
  --card: #FFFFFF;
  --ink: #182A45;
  --accent-ink: var(--navy3);
  --soft: #FAF8F2;
  --muted: #5B6B82;
  --line: #E7E0CC;
  --shadow: 0 2px 0 rgba(24, 42, 69, .06), 0 10px 30px -12px rgba(24, 42, 69, .25);
  --radius: 22px;
  --font-head: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --h: #F4C843;   /* handling */
  --i: #8FD3B9;   /* innehåll */
  --r: #A9C7F5;   /* ramar */
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(244, 200, 67, .18) 0 120px, transparent 121px),
    radial-gradient(circle at 92% 30%, rgba(169, 199, 245, .25) 0 160px, transparent 161px),
    radial-gradient(circle at 20% 90%, rgba(236, 128, 85, .10) 0 140px, transparent 141px);
  background-attachment: fixed;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4, .brand { font-family: var(--font-head); line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); margin: .2em 0 .5em; }
h3 { font-size: 1.2rem; margin: .8em 0 .4em; }
p { margin: .5em 0 .8em; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.hidden { display: none !important; }
code { background: var(--cream); padding: 1px 6px; border-radius: 6px; }
mark { background: var(--yellow2); padding: 0 3px; border-radius: 4px; }
.error { color: var(--coral2); font-weight: 700; }

input, textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--navy3); box-shadow: 0 0 0 4px rgba(52, 87, 123, .15); }
label { font-weight: 700; }

/* ---------- knappar ---------- */
.btn {
  --b: var(--navy);
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
  color: #fff; background: var(--b);
  border: 0; border-radius: 999px;
  padding: .7em 1.35em;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .22);
  transition: transform .12s, box-shadow .12s, filter .12s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .22); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.yellow { --b: var(--yellow); color: var(--ink); }
.btn.coral { --b: var(--coral); }
.btn.green { --b: var(--green); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { background: var(--card); }
.btn.small { font-size: .9rem; padding: .45em 1em; }
.btn.big { font-size: 1.2rem; padding: .8em 1.6em; }
.btn.block { display: flex; width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--card); box-shadow: var(--shadow); font-size: 1.2rem;
  display: inline-grid; place-items: center; color: var(--ink);
}
.icon-btn.active { background: var(--coral); color: #fff; animation: pulse 1.2s infinite; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

/* ---------- inloggning ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #243C60 0%, #34577B 55%, #F6F3EA 55.1%); }
.login-card { width: min(420px, 100%); text-align: center; position: relative; z-index: 2; padding-top: 10px; }
.login-card form { text-align: left; margin-top: 10px; }
.login-card label { display: block; margin: 12px 0 4px; }
.login-card .btn { margin-top: 18px; }
.login-owl { width: 190px; margin-top: -90px; filter: drop-shadow(0 10px 12px rgba(0,0,0,.2)); }
.brand { font-size: 2rem; margin: 0; }
.brand span { color: var(--coral); }
.login-sky span { position: absolute; width: 6px; height: 6px; background: var(--yellow); border-radius: 50%; animation: twinkle 3s infinite; }
.login-sky span:nth-child(1) { top: 10%; left: 15%; }
.login-sky span:nth-child(2) { top: 20%; left: 80%; animation-delay: .6s; }
.login-sky span:nth-child(3) { top: 35%; left: 30%; animation-delay: 1.2s; width: 4px; height: 4px; }
.login-sky span:nth-child(4) { top: 8%; left: 60%; animation-delay: 1.8s; }
.login-sky span:nth-child(5) { top: 42%; left: 88%; animation-delay: 2.1s; width: 4px; height: 4px; }
.login-sky span:nth-child(6) { top: 28%; left: 6%; animation-delay: .3s; }

.boot { min-height: 80vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.boot img { width: 160px; margin: 0 auto; }

/* ---------- ramverk ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px clamp(14px, 3vw, 28px);
  background: rgba(246, 243, 234, .88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(231, 224, 204, .7);
}
.topbar .logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.topbar .logo img { width: 42px; }
.topbar .logo span b { color: var(--coral); }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 700; padding: 8px 14px; border-radius: 999px;
  font-size: .95rem; white-space: nowrap;
}
.nav a:hover { background: var(--card); color: var(--ink); }
.nav a.active { background: var(--navy); color: #fff; }
.spacer { flex: 1; }
.points-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--navy); color: #fff; border-radius: 999px;
  padding: 5px 16px 5px 6px; font-family: var(--font-head); font-weight: 700;
  box-shadow: 0 3px 0 rgba(0,0,0,.2); cursor: pointer; border: 0; font-size: 1rem;
}
.points-pill .star { width: 30px; height: 30px; display: grid; place-items: center; background: var(--yellow); border-radius: 50%; color: var(--ink); font-size: 1rem; }
.points-pill .reel { display: inline-flex; overflow: hidden; height: 1.3em; line-height: 1.3em; }
.points-pill .reel .digit { display: inline-block; width: .62em; text-align: center; position: relative; }
.points-pill .reel .digit > span { display: block; transition: transform .9s cubic-bezier(.2, 1.4, .4, 1); }
.points-pill.bump { animation: bump .5s; }
.level-chip { font-size: .8rem; font-weight: 800; color: var(--accent-ink); background: var(--card); padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap; }

main.view { max-width: 1100px; margin: 0 auto; padding: 24px clamp(14px, 3vw, 28px) 120px; }

/* ---------- hem / karta ---------- */
.hero { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: center; margin-bottom: 26px; }
.hero .flax-holder { width: 220px; }
.hero h1 { margin: 0 0 6px; }
.bubble {
  position: relative; background: var(--card); border-radius: 22px; padding: 16px 20px; box-shadow: var(--shadow);
  font-size: 1.08rem;
}
.bubble::before {
  content: ''; position: absolute; left: -12px; top: 30px; border: 12px solid transparent; border-right-color: var(--card); border-left: 0;
}
.quick-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.section-title { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 14px; }
.section-title h2 { margin: 0; }

.journey { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.station {
  position: relative; text-decoration: none; color: var(--ink);
  background: var(--card); border-radius: 24px; padding: 18px 18px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px; min-height: 172px;
  transition: transform .18s, box-shadow .18s;
  overflow: hidden; border: 3px solid transparent;
}
.station:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 16px 34px -14px rgba(24, 42, 69, .4); }
.station .num { position: absolute; top: 12px; right: 14px; font-family: var(--font-head); font-weight: 700; color: var(--muted); opacity: .6; }
.station .ico { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; font-size: 1.7rem; background: var(--tint, var(--cream)); }
.station h3 { margin: 6px 0 0; font-size: 1.15rem; }
.station p { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.4; }
.station .meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; font-size: .82rem; font-weight: 800; color: var(--muted); padding-top: 8px; }
.station .bar { height: 8px; border-radius: 99px; background: #F0EBDD; overflow: hidden; flex: 1; margin-right: 10px; }
.station .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--coral)); border-radius: 99px; }
.station.done { border-color: var(--yellow); }
.station.done::after { content: '★'; position: absolute; right: -8px; bottom: -14px; font-size: 5rem; color: var(--yellow); opacity: .25; }
.station.suggested { border-color: var(--navy3); }
.station.suggested .num::before { content: 'Nästa → '; color: var(--coral); opacity: 1; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); cursor: pointer; border: 0; text-align: left; font: inherit; }
.tile img { width: 76px; flex: none; }
.tile h3 { margin: 0 0 2px; }
.tile p { margin: 0; color: var(--muted); font-size: .92rem; }
.tile.navy { background: var(--navy); color: #fff; }
.tile.navy p { color: #C9D6EA; }
.tile.yellow { background: var(--yellow); }
.tile.yellow p { color: var(--ink); }

/* ---------- modul ---------- */
.module-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.module-head h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dots button { width: 14px; height: 14px; border-radius: 50%; border: 0; background: #E3DCC8; cursor: pointer; padding: 0; transition: transform .2s; }
.dots button.done { background: var(--yellow); }
.dots button.current { background: var(--navy); transform: scale(1.35); }
.stage { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.stage .side { position: sticky; top: 86px; }
.stage .side .flax-holder { width: 100%; max-width: 250px; margin: 0 auto; }
.stage .side .bubble { margin-top: 8px; }
.stage .side .bubble::before { left: 50%; top: -12px; transform: translateX(-50%); border: 12px solid transparent; border-bottom-color: var(--card); border-top: 0; }
.step-card { min-height: 320px; animation: slideIn .35s ease-out; }
.step-card h2 { margin-top: 0; }
.step-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.kicker { font-family: var(--font-head); font-weight: 600; color: var(--coral); text-transform: uppercase; letter-spacing: .06em; font-size: .82rem; }

.lesson p, .lesson li { font-size: 1.05rem; }
.lesson ul { padding-left: 1.2em; }
.lesson li { margin: .3em 0; }
.callout { border-radius: 18px; padding: 14px 18px; margin: 14px 0; background: var(--cream); }
.callout.blue { background: var(--sky); }
.callout.mint { background: var(--mint); }
.callout.pink { background: var(--pink); }
.callout.lilac { background: var(--lilac); }
.callout b:first-child { font-family: var(--font-head); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .92rem; cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.source { font-size: .8rem; color: var(--muted); margin-top: 14px; }
.source a { color: var(--muted); }

.sfsk { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0; }
.sfsk div { border-radius: 18px; padding: 14px 12px; text-align: center; font-weight: 700; }
.sfsk div b { display: block; font-family: var(--font-head); font-size: 2rem; line-height: 1; margin-bottom: 4px; }
.sfsk div small { display: block; font-weight: 600; font-size: .82rem; opacity: .85; margin-top: 4px; }
.stairs { display: flex; align-items: flex-end; gap: 8px; margin: 18px 0; }
.stairs div { flex: 1; border-radius: 14px 14px 0 0; padding: 10px; font-weight: 800; font-size: .92rem; display: flex; flex-direction: column; justify-content: flex-end; }
.stairs div small { font-weight: 600; }

/* ---------- övningar ---------- */
.options { display: grid; gap: 10px; margin: 14px 0; }
.opt {
  text-align: left; font: inherit; font-weight: 600; color: var(--ink);
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 13px 16px; cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s; display: flex; gap: 12px; align-items: flex-start;
}
.opt:hover { border-color: var(--navy3); }
.opt .letter { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cream); display: grid; place-items: center; font-family: var(--font-head); }
.opt.right { border-color: var(--green); background: #E7F7EF; }
.opt.right .letter { background: var(--green); color: #fff; }
.opt.wrong { border-color: var(--coral); background: #FFF0EA; animation: shake .35s; }
.opt.wrong .letter { background: var(--coral); color: #fff; }
.opt[disabled] { cursor: default; }
.why { font-size: .95rem; font-weight: 600; margin-top: 4px; color: var(--ink); }
.feedback { border-radius: 16px; padding: 12px 16px; margin-top: 12px; font-weight: 600; animation: slideIn .25s; }
.feedback.good { background: #E7F7EF; }
.feedback.meh { background: var(--cream); }
.feedback.bad { background: #FFF0EA; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 16px 0; }
.match .col { display: grid; gap: 10px; align-content: start; }
.tag {
  font: inherit; font-weight: 700; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 11px 14px;
  cursor: pointer; transition: all .15s; color: var(--ink);
}
.tag:hover { border-color: var(--navy3); }
.tag.sel { border-color: var(--navy); background: var(--sky); transform: scale(1.02); }
.tag.done { border-color: var(--green); background: #E7F7EF; cursor: default; }
.tag.bad { animation: shake .35s; border-color: var(--coral); }
.tag .pairno { float: right; font-family: var(--font-head); color: var(--green); }

.buckets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.bucket { border: 3px dashed var(--line); border-radius: 18px; padding: 12px; min-height: 110px; cursor: pointer; transition: all .15s; background: color-mix(in srgb, var(--card) 50%, transparent); }
.bucket h4 { margin: 0 0 8px; font-family: var(--font-head); }
.bucket.ready { border-color: var(--navy3); background: var(--sky); }
.bucket .tag { display: block; margin-top: 6px; font-size: .92rem; padding: 8px 10px; cursor: default; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; min-height: 50px; }

.qtext { font-size: 1.25rem; font-weight: 700; line-height: 1.9; background: var(--cream); padding: 16px 18px; border-radius: 18px; }
.chunk { cursor: pointer; padding: 3px 6px; border-radius: 8px; border-bottom: 3px solid transparent; transition: background .15s; }
.chunk:hover { background: rgba(255,255,255,.7); }
.chunk.H { background: var(--h); } .chunk.I { background: var(--i); } .chunk.R { background: var(--r); }
.chunk.miss { outline: 3px dashed var(--coral); }
.pens { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.pen { border: 3px solid transparent; border-radius: 999px; padding: 8px 16px; font-weight: 800; cursor: pointer; font: inherit; font-weight: 800; }
.pen.H { background: var(--h); } .pen.I { background: var(--i); } .pen.R { background: var(--r); } .pen.X { background: var(--card); border-color: var(--line); }
.pen.on { border-color: var(--navy); transform: scale(1.06); }

.sentences { display: grid; gap: 8px; margin: 14px 0; }
.sent { text-align: left; font: inherit; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; color: var(--ink); position: relative; }
.sent.cut { text-decoration: line-through; text-decoration-color: var(--coral); text-decoration-thickness: 3px; opacity: .6; background: #FFF6F2; }
.sent.ok { border-color: var(--green); }
.sent.nok { border-color: var(--coral); }
.sent .note { display: block; font-size: .88rem; font-weight: 700; color: var(--accent-ink); margin-top: 4px; text-decoration: none; opacity: 1; }

.orderlist { display: grid; gap: 8px; margin: 14px 0; }
.orderlist .tag { display: flex; gap: 10px; align-items: center; }
.orderlist .tag .n { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--cream); display: grid; place-items: center; font-family: var(--font-head); }
.orderlist .tag.placed .n { background: var(--navy); color: #fff; }

/* flip-kort */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.flip { perspective: 900px; height: 190px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.flip .inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.3, 1.4, .5, 1); transform-style: preserve-3d; }
.flip.open .inner { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 18px; padding: 12px; display: flex; flex-direction: column; justify-content: center; box-shadow: var(--shadow); }
.flip .front { background: var(--navy); color: #fff; align-items: center; text-align: center; }
.flip .front b { font-family: var(--font-head); font-size: 1.35rem; }
.flip .front small { color: var(--yellow); margin-top: 6px; font-weight: 700; }
.flip .back { background: var(--card); transform: rotateY(180deg); font-size: .82rem; line-height: 1.35; text-align: left; justify-content: flex-start; overflow: auto; }
.flip .back b { font-family: var(--font-head); font-size: 1rem; }
.flip.seen .front::after { content: '✓'; position: absolute; top: 8px; right: 12px; color: var(--yellow); font-weight: 900; }

/* AI-bedömning */
.ai-box { margin-top: 16px; }
.ai-thinking { display: flex; gap: 12px; align-items: center; color: var(--muted); font-weight: 700; padding: 10px 0; }
.ai-thinking .dots3 span { display: inline-block; width: 9px; height: 9px; margin: 0 2px; background: var(--navy3); border-radius: 50%; animation: dot 1.2s infinite; }
.ai-thinking .dots3 span:nth-child(2) { animation-delay: .15s; } .ai-thinking .dots3 span:nth-child(3) { animation-delay: .3s; }
.stars { font-size: 2rem; letter-spacing: 4px; color: #E3DCC8; }
.stars .on { color: var(--yellow); text-shadow: 0 2px 0 var(--gold); display: inline-block; animation: starpop .6s both; }
.stars .on:nth-child(2) { animation-delay: .15s; } .stars .on:nth-child(3) { animation-delay: .3s; }
.parts { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.parts li { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 12px; padding: 8px 12px; }
.parts li .st { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; }
.st.ja { background: var(--green); } .st.delvis { background: var(--yellow); color: var(--ink) !important; } .st.nej { background: var(--coral); }
.hl-answer { line-height: 2; font-size: 1.02rem; background: var(--soft); padding: 12px 14px; border-radius: 14px; }
.hl { padding: 2px 4px; border-radius: 6px; margin-right: 2px; position: relative; cursor: help; }
.hl.svar { background: #FFE58C; } .hl.förklaring { background: #C9E8FF; } .hl.stöd { background: #CFF1DF; }
.hl.utsvävning { background: #FFD4C6; text-decoration: wavy underline var(--coral); } .hl.upprepning { background: #EDE3FF; text-decoration: wavy underline #8A6FD1; } .hl.fel { background: #FFC2C2; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; font-weight: 800; margin: 8px 0; }
.legend span { padding: 2px 8px; border-radius: 6px; }
.tip { background: var(--sky); border-radius: 14px; padding: 10px 14px; font-weight: 600; margin-top: 10px; }
.demo-note { font-size: .8rem; color: var(--coral2); font-weight: 700; }

.input-row { display: flex; gap: 8px; align-items: flex-end; }
.input-row textarea, .input-row input { flex: 1; }
.mic { flex: none; }

/* trappan */
.ladder-steps { display: grid; gap: 8px; margin: 12px 0; }
.ladder-step { background: var(--soft); border-left: 6px solid var(--yellow); border-radius: 10px; padding: 8px 12px; animation: slideIn .3s; }
.ladder-step small { font-weight: 800; color: var(--muted); display: block; }
.level-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.level-meter div { text-align: center; font-weight: 800; font-size: .82rem; padding: 10px 4px; border-radius: 12px; background: #F0EBDD; color: var(--muted); transition: all .4s; }
.level-meter div.on { background: var(--yellow); color: var(--ink); transform: translateY(-4px); box-shadow: 0 4px 0 var(--gold); }

/* lär flax / chat */
.convo { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; max-height: 420px; overflow-y: auto; padding: 4px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; line-height: 1.45; animation: slideIn .25s; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 6px; }
.msg.flax { align-self: flex-start; background: var(--cream); border-bottom-left-radius: 6px; display: flex; gap: 10px; white-space: normal; }
.msg.flax img { width: 44px; height: 44px; flex: none; }
.msg.flax .t p { margin: 0 0 .4em; } .msg.flax .t p:last-child { margin: 0; }
.msg.flax .t ul { margin: .2em 0; padding-left: 1.2em; }

.chat-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--yellow); box-shadow: 0 6px 0 var(--gold), 0 14px 30px -8px rgba(0,0,0,.35);
  display: grid; place-items: center; padding: 0; transition: transform .2s;
}
.chat-fab:hover { transform: scale(1.06) rotate(-4deg); }
.chat-fab img { width: 78px; margin-top: 6px; }
.chat-fab .lbl { position: absolute; bottom: -8px; background: var(--navy); color: #fff; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.drawer {
  position: fixed; right: 18px; bottom: 116px; z-index: 45;
  width: min(420px, calc(100vw - 24px)); height: min(640px, calc(100vh - 150px));
  background: var(--card); border-radius: 26px; box-shadow: 0 30px 60px -20px rgba(24, 42, 69, .5);
  display: flex; flex-direction: column; overflow: hidden;
  transform-origin: bottom right; animation: popIn .3s cubic-bezier(.3, 1.5, .5, 1);
}
.drawer header { background: var(--navy); color: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.drawer header img { width: 48px; }
.drawer header h3 { margin: 0; color: #fff; }
.drawer header small { color: #C9D6EA; display: block; font-size: .78rem; }
.drawer header .icon-btn { width: 36px; height: 36px; font-size: 1rem; }
.drawer .convo { flex: 1; max-height: none; padding: 14px; margin: 0; background: #FBF9F4; }
.drawer .composer { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.drawer .composer textarea { min-height: 46px; max-height: 140px; height: 46px; padding: 10px 12px; }
.drawer .suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; background: #FBF9F4; }
.drawer .suggest button { font-size: .8rem; padding: 5px 10px; }

/* ---------- Flax ---------- */
.flax-holder { position: relative; aspect-ratio: 560 / 520; }
.flax-holder svg { width: 100%; height: 100%; overflow: visible; display: block; }
.flax-holder.idle .a-body { animation: breathe 3.6s ease-in-out infinite; transform-box: view-box; transform-origin: 240px 470px; }
.flax-holder .a-eye { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.flax-holder .a-head { transform-box: view-box; transform-origin: 238px 209px; }
.flax-holder .a-wing-l { transform-box: view-box; transform-origin: 142px 278px; }
.flax-holder .a-wing-r { transform-box: view-box; transform-origin: 338px 278px; }
.flax-holder.talk .a-head { animation: nod .9s ease-in-out 2; }
.flax-holder.flap .a-wing-l { animation: flapL .35s ease-in-out 4; }
.flax-holder.flap .a-wing-r { animation: flapR .35s ease-in-out 4; }
.flax-holder.hop svg { animation: hop .6s cubic-bezier(.3, 1.6, .5, 1) 2; }
.flax-holder.swap svg { animation: swap .35s ease-out; }
.flax-holder::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: 1%; height: 5%; background: radial-gradient(closest-side, rgba(24,42,69,.18), transparent); z-index: -1; }

/* ---------- FX ---------- */
#fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.fx-star { position: absolute; font-size: 26px; will-change: transform, opacity; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.fx-plus {
  position: absolute; font-family: var(--font-head); font-weight: 700; font-size: 2.4rem; color: var(--yellow);
  -webkit-text-stroke: 2px var(--navy); paint-order: stroke fill; text-shadow: 0 4px 0 var(--navy);
  animation: plusUp 1.5s ease-out forwards; white-space: nowrap;
}
.fx-ring { position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 4px solid var(--yellow); animation: ring .7s ease-out forwards; }
.fx-confetti { position: absolute; width: 10px; height: 14px; border-radius: 2px; will-change: transform; }
.jackpot {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(24, 42, 69, .72); backdrop-filter: blur(4px); animation: fadeIn .3s; padding: 16px;
}
.jackpot .burst { position: absolute; width: 900px; height: 900px; left: 50%; top: 50%; margin: -450px 0 0 -450px;
  background: repeating-conic-gradient(from 0deg, rgba(244, 200, 67, .22) 0 10deg, transparent 10deg 20deg);
  animation: spin 14s linear infinite; border-radius: 50%; mask: radial-gradient(closest-side, #000 40%, transparent); -webkit-mask: radial-gradient(closest-side, #000 40%, transparent); }
.jackpot .panel { position: relative; background: var(--card); border-radius: 30px; padding: 24px 28px 26px; text-align: center; width: min(440px, 100%); animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.jackpot .panel .flax-holder { width: 200px; margin: -110px auto 0; }
.jackpot .badge { width: 110px; height: 110px; margin: 6px auto; border-radius: 50%; display: grid; place-items: center; font-size: 3.2rem;
  background: radial-gradient(circle at 35% 30%, #FFF6C9, var(--yellow) 55%, var(--gold)); box-shadow: 0 6px 0 #B9861A, inset 0 -6px 0 rgba(0,0,0,.08); animation: badgeDrop .8s .2s both cubic-bezier(.3, 1.6, .5, 1); }
.jackpot .big-points { font-family: var(--font-head); font-size: 3rem; font-weight: 700; color: var(--ink); line-height: 1; margin: 8px 0; }
.jackpot .slot { display: inline-flex; gap: 6px; margin: 8px 0 4px; }
.jackpot .slot span { width: 54px; height: 64px; border-radius: 12px; background: var(--navy); color: var(--yellow); font-size: 2rem; display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); }
.jackpot .slot span i { font-style: normal; display: block; animation: reel .12s linear infinite; }

/* ---------- verktyg: tid ---------- */
.timeline { display: flex; height: 58px; border-radius: 16px; overflow: hidden; margin: 14px 0 6px; box-shadow: inset 0 0 0 2px var(--line); position: relative; }
.timeline div { display: grid; place-items: center; font-size: .78rem; font-weight: 800; overflow: hidden; white-space: nowrap; border-right: 2px solid #fff; transition: flex-grow .3s; min-width: 0; }
.timeline .ov { background: var(--sky); } .timeline .ck { background: var(--mint); }
.timeline .q { background: var(--cream); } .timeline .q:nth-child(odd) { background: #FFE9A8; }
.timeline .half { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--coral); border: 0; }
.timeline .half::after { content: 'Hållpunkt'; position: absolute; top: -18px; left: -26px; font-size: .7rem; color: var(--coral2); font-weight: 800; }
.range-row { display: grid; grid-template-columns: 170px 1fr 70px; gap: 12px; align-items: center; margin: 8px 0; }
.range-row input[type=range] { accent-color: var(--navy); padding: 0; border: 0; }
.budget-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.budget-table td, .budget-table th { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.budget-table th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* scenario */
.clock-big { display: flex; align-items: center; gap: 14px; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 18px; margin-bottom: 14px; }
.clock-big .face { width: 56px; height: 56px; border-radius: 50%; background: var(--card); position: relative; flex: none; }
.clock-big .face i { position: absolute; left: 50%; top: 50%; width: 3px; height: 22px; background: var(--coral); transform-origin: 50% 0; border-radius: 2px; transition: transform 1s; }
.clock-big .face::after { content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; background: var(--navy); border-radius: 50%; }
.clock-big b { font-family: var(--font-head); font-size: 1.5rem; }
.clock-big .prog { flex: 1; height: 10px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.clock-big .prog i { display: block; height: 100%; background: var(--yellow); transition: width 1s; }

/* breathe */
.breathe-wrap { display: grid; place-items: center; padding: 20px 0; }
.breathe-circle { width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, var(--sky), #B9D7F7); display: grid; place-items: center; font-family: var(--font-head); font-size: 1.3rem; color: var(--ink); transition: transform 4s ease-in-out; box-shadow: 0 0 0 16px rgba(169, 199, 245, .25); }
.breathe-circle.in { transform: scale(1.3); }

/* genrep / miniprov */
.exam-shell { display: grid; grid-template-columns: 200px 1fr; gap: 18px; }
.exam-nav { display: grid; gap: 8px; align-content: start; }
.exam-nav button { text-align: left; font: inherit; font-weight: 700; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); cursor: pointer; display: flex; justify-content: space-between; gap: 6px; color: var(--ink); }
.exam-nav button.cur { border-color: var(--navy); background: var(--sky); }
.exam-nav button.answered { border-left: 8px solid var(--green); }
.exam-nav button.parked { border-left: 8px solid var(--yellow); }
.exam-timer { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; }
.exam-timer.low { color: var(--coral2); animation: pulse 1s infinite; }
.qcard { background: var(--cream); border-radius: 18px; padding: 16px 18px; font-size: 1.12rem; font-weight: 700; }
.qcard small { display: block; color: var(--muted); font-weight: 800; font-size: .82rem; margin-bottom: 4px; }

/* provcoach */
.exam-list { display: grid; gap: 14px; }
.exam-item { display: grid; grid-template-columns: 86px 1fr auto; gap: 16px; align-items: center; }
.cal { background: var(--coral); color: #fff; border-radius: 18px; text-align: center; padding: 8px 4px; font-family: var(--font-head); line-height: 1.1; box-shadow: 0 4px 0 var(--coral2); }
.cal b { display: block; font-size: 1.9rem; }
.cal small { font-size: .8rem; text-transform: uppercase; }
.countdown { font-weight: 800; color: var(--coral2); }
.sessions { display: grid; gap: 10px; margin-top: 12px; }
.session { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: start; background: var(--soft); border-radius: 16px; padding: 12px 14px; }
.session.today { background: var(--sky); outline: 3px solid var(--navy3); }
.session.done { opacity: .7; }
.session .chk { width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--navy3); background: var(--card); cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; }
.session.done .chk { background: var(--green); border-color: var(--green); color: #fff; }
.session ul { margin: 4px 0 0; padding-left: 1.1em; font-size: .95rem; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.formgrid .full { grid-column: 1 / -1; }
.formgrid label { display: block; margin-bottom: 4px; font-size: .92rem; }

/* kompass */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.badge-item { text-align: center; font-weight: 700; font-size: .85rem; }
.badge-item .b { width: 84px; height: 84px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-size: 2.3rem; background: #EFE9D8; filter: grayscale(1); opacity: .5; }
.badge-item.got .b { background: radial-gradient(circle at 35% 30%, #FFF6C9, var(--yellow) 55%, var(--gold)); filter: none; opacity: 1; box-shadow: 0 4px 0 #B9861A; }
.level-bar { height: 16px; border-radius: 99px; background: #EFE9D8; overflow: hidden; margin: 8px 0; }
.level-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--coral)); border-radius: 99px; transition: width 1s; }
.compass-card { background: var(--navy); color: #fff; border-radius: 26px; padding: 24px; position: relative; overflow: hidden; }
.compass-card h2 { color: var(--yellow); }
.compass-card ol { font-size: 1.1rem; }
.compass-card img { position: absolute; right: -10px; bottom: -20px; width: 160px; opacity: .95; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #D8D0BB; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: var(--card); border-radius: 50%; transition: .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(22px); }

/* föräldravy */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat small { color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: .72rem; letter-spacing: .05em; }
.stat b { display: block; font-family: var(--font-head); font-size: 1.7rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 10px; }
.bars div { flex: 1; background: var(--navy3); border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.bars div:hover::after { content: attr(data-t); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; font-size: .72rem; padding: 3px 6px; border-radius: 6px; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom) + 26px)); transform: translateX(-50%); z-index: 120; background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 16px; font-weight: 700; box-shadow: var(--shadow); animation: slideUp .3s; max-width: calc(100vw - 32px); }
.toast.warn { background: var(--coral2); }

/* ---------- animationer ---------- */
@keyframes breathe { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-3px) scale(1.01, .995); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
@keyframes nod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-4deg); } 65% { transform: rotate(3deg); } }
@keyframes flapL { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(18deg); } }
@keyframes flapR { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-34px) scale(.98, 1.03); } 80% { transform: translateY(0) scale(1.04, .95); } }
@keyframes swap { from { opacity: .3; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.bob { animation: bob 3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .2; transform: scale(.6); } 50% { opacity: 1; transform: scale(1.3); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.pop-in { animation: popIn .5s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.25) rotate(-3deg); } 60% { transform: scale(.95); } 100% { transform: scale(1); } }
@keyframes dot { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-6px); opacity: 1; } }
@keyframes starpop { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.4) rotate(10deg); } 100% { transform: scale(1); } }
@keyframes plusUp { 0% { transform: translate(-50%, 0) scale(.4); opacity: 0; } 15% { transform: translate(-50%, -10px) scale(1.25); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -90px) scale(1); opacity: 0; } }
@keyframes ring { from { transform: translate(-50%, -50%) scale(1); opacity: 1; } to { transform: translate(-50%, -50%) scale(9); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes badgeDrop { from { transform: translateY(-80px) scale(.3) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes reel { from { transform: translateY(-100%); } to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- responsivt ---------- */
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .stage .side { position: static; display: grid; grid-template-columns: 110px 1fr; gap: 12px; align-items: center; }
  .stage .side .flax-holder { max-width: 110px; }
  .stage .side .bubble { margin-top: 0; }
  .stage .side .bubble::before { left: -12px; top: 26px; transform: none; border: 12px solid transparent; border-right-color: var(--card); border-left: 0; }
  .nav a { padding: 8px 10px; }
  .exam-shell { grid-template-columns: 1fr; }
  .exam-nav { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  main.view { padding-bottom: 150px; }
  .toast { bottom: 90px; }
  .topbar .logo span { display: none; }
  .level-chip { display: none; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); justify-content: space-around; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); margin: 0; box-shadow: 0 -6px 20px rgba(0,0,0,.08); z-index: 35; }
  .nav a { font-size: .8rem; }
  .chat-fab { bottom: 76px; width: 70px; height: 70px; }
  .chat-fab img { width: 64px; }
  .drawer { bottom: 12px; right: 12px; height: calc(100vh - 100px); }
  .hero { grid-template-columns: 110px 1fr; }
  .hero .flax-holder { width: 110px; }
  .match { grid-template-columns: 1fr; }
  .sfsk { grid-template-columns: 1fr 1fr; }
  .formgrid { grid-template-columns: 1fr; }
  .range-row { grid-template-columns: 1fr 60px; }
  .range-row label { grid-column: 1 / -1; }
  .exam-item { grid-template-columns: 70px 1fr; }
  .exam-item > :last-child { grid-column: 1 / -1; }
}

/* utskrift av provkompassen */
@media print {
  body { background: var(--card); }
  .topbar, .chat-fab, .drawer, .no-print, .nav { display: none !important; }
  .compass-card { background: var(--card) !important; color: var(--ink) !important; border: 4px solid var(--navy); }
  .compass-card h2 { color: var(--ink) !important; }
}

/* ---------- Känsla vs verklighet ---------- */
.stepper-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.stepper { background: var(--soft); border-radius: 16px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.stepper > div { display: flex; align-items: center; gap: 12px; }
.stepper b { font-family: var(--font-head); font-size: 1.6rem; min-width: 2ch; text-align: center; }
.stepper .icon-btn { width: 38px; height: 38px; }
.cam-bar { display: flex; height: 46px; border-radius: 14px; overflow: hidden; margin-top: 6px; gap: 2px; background: var(--card); }
.cam-bar div { display: grid; place-items: center; font-weight: 800; font-size: .85rem; min-width: 0; overflow: hidden; transition: flex-grow .6s; }
.cam-svart { background: #F5B39A; } .cam-okej { background: #FFE58C; } .cam-latt { background: #BFEBD8; }
.cam-legend { display: flex; gap: 8px; margin-top: 8px; font-size: .8rem; font-weight: 800; }
.cam-legend span { padding: 2px 10px; border-radius: 99px; }
.camera-result { animation: slideIn .4s; }
.verdict { background: #FFFDF6; border: 3px double var(--navy2); border-radius: 18px; padding: 16px 18px; animation: popIn .4s; }
.verdict h3 { margin: .2em 0 .4em; }

/* Känsla vs verklighet – graf */
.calib-chart { width: 100%; height: auto; display: block; }
.calib-chart .grid { stroke: #ECE6D6; stroke-width: 1; }
.calib-chart .axis-t { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.calib-chart .row-t { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); }
.calib-chart .link { stroke: #C9C2B0; stroke-width: 2; }
.calib-chart .guess { fill: #fff; stroke: #2F6DB0; stroke-width: 2.5; }
.calib-chart .actual { fill: #E0703F; stroke: #fff; stroke-width: 2; }
.calib-chart .hit { fill: transparent; cursor: pointer; }
.calib-legend { display: flex; gap: 16px; font-size: .85rem; font-weight: 700; margin: 6px 0; flex-wrap: wrap; }
.calib-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.calib-tip { position: fixed; z-index: 80; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: .85rem; pointer-events: none; max-width: 260px; }
.calib-summary { font-size: 1.05rem; }
.range-big { width: 100%; accent-color: var(--coral); }
.guess-val { font-family: var(--font-head); font-size: 2.4rem; font-weight: 700; color: var(--ink); }
.talk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.talk-cards .tc { border-radius: 18px; padding: 14px 16px; }
.talk-cards .tc h4 { margin: 0 0 6px; font-family: var(--font-head); }
.talk-cards .tc ul { margin: 0; padding-left: 1.1em; }

/* ---------- Förhörsläge ---------- */
.quiz-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(24, 42, 69, .82); display: grid; place-items: center; padding: 16px; animation: fadeIn .25s; }
.quiz-panel { position: relative; background: var(--card); border-radius: 28px; padding: 28px 28px 24px; width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto; animation: popIn .35s cubic-bezier(.3, 1.5, .5, 1); }
.quiz-q { font-size: clamp(1.4rem, 3.4vw, 2rem); margin: .3em 0 .6em; }
.quiz-hint, .quiz-ans { border-radius: 16px; padding: 12px 16px; margin: 10px 0; font-size: 1.1rem; animation: slideIn .25s; }
.quiz-hint { background: var(--sky); } .quiz-ans { background: var(--mint); }
.quiz-rate { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.quiz-x { position: absolute; top: 12px; right: 12px; }
@media print {
  body.print-forhor main.view > *:not(:has(.print-list)) { display: none !important; }
  body.print-forhor .print-list { box-shadow: none; }
  body.print-forhor .exam-list, body.print-forhor .hero, body.print-forhor .chips, body.print-forhor .card:not(.print-list), body.print-forhor .btn, body.print-forhor .demo-note, body.print-forhor main.view > p { display: none !important; }
}

/* =====================================================================
   iPad först: touch, safe areas, hemskärmsläge
   ===================================================================== */
html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
button, .btn, .chip, .tag, .opt, .nav a, .station, .sent, .flip, .pen, .chunk { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn, .chip, .tag, .opt, .nav a, .pen, .points-pill, .station { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
.btn { min-height: 46px; }
.btn.small { min-height: 38px; }
.chip { padding: 8px 16px; min-height: 40px; }
.icon-btn { min-width: 44px; min-height: 44px; }

@media (pointer: coarse) and (min-width: 700px) {
  body { font-size: 18px; }
  .opt { padding: 16px 18px; }
  .tag { padding: 14px 16px; }
  .nav a { padding: 10px 16px; font-size: 1rem; }
  .dots button { width: 18px; height: 18px; }
  .range-row input[type=range] { height: 36px; }
}
@media (hover: none) {
  .station:hover, .btn:hover, .chat-fab:hover { transform: none; }
  .station:active { transform: scale(.98); }
}
/* iPad stående (834 pt) – behåll två kolumner i stationerna så länge det får plats */
@media (min-width: 761px) and (max-width: 900px) {
  .stage { grid-template-columns: 210px 1fr; gap: 18px; }
  .stage .side { position: sticky; top: 86px; display: block; }
  .stage .side .flax-holder { max-width: 210px; }
  .stage .side .bubble { margin-top: 8px; }
  .stage .side .bubble::before { left: 50%; top: -12px; transform: translateX(-50%); border: 12px solid transparent; border-bottom-color: var(--card); border-top: 0; }
}
@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; }
}
/* Hemskärmsläge (standalone) */
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
  .chat-fab { bottom: calc(18px + env(safe-area-inset-bottom)); }
  .drawer { height: min(700px, calc(100dvh - 150px - env(safe-area-inset-top))); }
}
.drawer { bottom: calc(116px + var(--kb, 0px)); height: min(680px, calc(100dvh - 150px - var(--kb, 0px))); }

/* =====================================================================
   Bildbaserad följeslagare (Miso)
   ===================================================================== */
.flax-holder.img-char { position: relative; }
.flax-holder.img-char .ci { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s ease; pointer-events: none; }
.flax-holder.img-char .ci.on { opacity: 1; }
.flax-holder.img-char.seq .ci { transition-duration: .12s; }
.flax-holder.img-char.idle .ci.on { animation: catBreathe 5s ease-in-out infinite; transform-origin: 50% 96%; }
.flax-holder.img-char.talk .ci.on { animation: catTilt 1s ease-in-out; transform-origin: 50% 96%; }
.flax-holder.img-char.hop .ci.on { animation: catHop .7s cubic-bezier(.3, 1.5, .5, 1) 2; transform-origin: 50% 96%; }
.flax-holder.img-char.flap .ci.on { animation: catTilt .8s ease-in-out; }
.flax-holder.img-char::after { bottom: 4.2%; height: 4.4%; left: 20%; right: 20%; background: radial-gradient(closest-side, rgba(30, 47, 85, .26), transparent); transition: opacity .3s, left .3s, right .3s; }
.flax-holder.img-char.airborne::after { left: 33%; right: 33%; opacity: .5; }
.flax-holder.img-char.seq::after { opacity: .6; }
.flax-holder.img-char.bust::after { display: none; }
@keyframes catBreathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.008, .994); } }
@keyframes catTilt { 0%, 100% { transform: rotate(0); } 35% { transform: rotate(-2.2deg); } 70% { transform: rotate(1.4deg); } }
@keyframes catHop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-22px) scale(.99, 1.02); } 80% { transform: translateY(0) scale(1.02, .98); } }

/* =====================================================================
   Tema: Miso – blått bläck, dimma, bärnsten
   ===================================================================== */
.theme-miso {
  --navy: #1E2F55;
  --navy2: #2B4577;
  --navy3: #3F6CA8;
  --yellow: #E8A93A;
  --yellow2: #F7E0AE;
  --gold: #B97F1E;
  --cream: #F2EEE2;
  --coral: #D9776B;
  --coral2: #B0564B;
  --sky: #DCEAF6;
  --mint: #D5EEE6;
  --green: #2F8F72;
  --lilac: #E4E6F8;
  --pink: #F6E0E1;
  --bg: #EAF1F7;
  --card: #FFFFFF;
  --ink: #1E2F55;
  --muted: #5A6B86;
  --line: #D6E1EC;
  --shadow: 0 1px 0 rgba(30, 47, 85, .05), 0 12px 30px -14px rgba(30, 47, 85, .28);
  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --h: #F7D98E; --i: #A9DDCB; --r: #B9D2F2;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 8% 0%, rgba(127, 169, 208, .35), transparent 70%),
    radial-gradient(ellipse 45% 35% at 100% 30%, rgba(63, 108, 168, .18), transparent 70%),
    radial-gradient(ellipse 50% 40% at 15% 100%, rgba(232, 169, 58, .10), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(234, 241, 247, .75), rgba(234, 241, 247, .35) 70%, transparent),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='32' viewBox='0 0 64 32'%3E%3Cg fill='none' stroke='%236E9AC7' stroke-width='1.2' stroke-opacity='.36'%3E%3Ccircle cx='0' cy='0' r='31.4' fill='%23EAF1F7'/%3E%3Ccircle cx='0' cy='0' r='25'/%3E%3Ccircle cx='0' cy='0' r='18.5'/%3E%3Ccircle cx='0' cy='0' r='12'/%3E%3Ccircle cx='0' cy='0' r='5.5'/%3E%3Ccircle cx='64' cy='0' r='31.4' fill='%23EAF1F7'/%3E%3Ccircle cx='64' cy='0' r='25'/%3E%3Ccircle cx='64' cy='0' r='18.5'/%3E%3Ccircle cx='64' cy='0' r='12'/%3E%3Ccircle cx='64' cy='0' r='5.5'/%3E%3Ccircle cx='32' cy='16.0' r='31.4' fill='%23EAF1F7'/%3E%3Ccircle cx='32' cy='16.0' r='25'/%3E%3Ccircle cx='32' cy='16.0' r='18.5'/%3E%3Ccircle cx='32' cy='16.0' r='12'/%3E%3Ccircle cx='32' cy='16.0' r='5.5'/%3E%3Ccircle cx='0' cy='32' r='31.4' fill='%23EAF1F7'/%3E%3Ccircle cx='0' cy='32' r='25'/%3E%3Ccircle cx='0' cy='32' r='18.5'/%3E%3Ccircle cx='0' cy='32' r='12'/%3E%3Ccircle cx='0' cy='32' r='5.5'/%3E%3Ccircle cx='64' cy='32' r='31.4' fill='%23EAF1F7'/%3E%3Ccircle cx='64' cy='32' r='25'/%3E%3Ccircle cx='64' cy='32' r='18.5'/%3E%3Ccircle cx='64' cy='32' r='12'/%3E%3Ccircle cx='64' cy='32' r='5.5'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
}
.theme-miso h1, .theme-miso h2, .theme-miso h3, .theme-miso .brand { font-weight: 600; letter-spacing: -.015em; }
.theme-miso .btn { font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; letter-spacing: .01em; box-shadow: 0 3px 0 rgba(0, 0, 0, .18); }
.theme-miso .btn.yellow { color: #2A1F08; }
.theme-miso .kicker { font-family: 'Nunito', sans-serif; font-weight: 800; color: var(--accent-ink); }
.theme-miso .topbar { background: rgba(234, 241, 247, .9); border-bottom-color: rgba(214, 225, 236, .8); }
.theme-miso .topbar .logo img { width: 42px; height: 42px; object-fit: cover; border-radius: 50%; background: var(--sky); }
.theme-miso .topbar .logo span b { color: var(--accent-ink); }
.theme-miso .brand span { color: var(--accent-ink); }
.theme-miso .points-pill .star { background: var(--yellow); }
.theme-miso .bubble { border: 1px solid var(--line); }
.theme-miso .bubble::before { filter: drop-shadow(-1px 0 0 var(--line)); }
.theme-miso .station { border-radius: 20px; }
.theme-miso .station.done { border-color: var(--navy3); }
.theme-miso .station.done::after { content: '✦'; color: var(--accent-ink); opacity: .18; }
.theme-miso .station .bar i, .theme-miso .level-bar i { background: linear-gradient(90deg, #7FA9D0, var(--navy3)); }
.theme-miso .tile.yellow { background: linear-gradient(135deg, #F7E0AE, #E8C27A); }
.theme-miso .tile.navy { background: linear-gradient(135deg, #1E2F55, #2B4577); }
.theme-miso .chat-fab { background: radial-gradient(circle at 50% 40%, #DCEAF6, #9CC3E0); box-shadow: 0 6px 0 #3F6CA8, 0 14px 30px -8px rgba(0, 0, 0, .35); overflow: visible; }
.theme-miso .chat-fab img { width: 84px; height: 84px; object-fit: cover; border-radius: 50%; margin-top: 0; }
.theme-miso .drawer header { background: linear-gradient(135deg, #1E2F55, #2B4577); }
.theme-miso .drawer header img, .theme-miso .msg.flax img { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; background: var(--sky); flex: none; }
.theme-miso .msg.flax { background: #EEF4FA; }
.theme-miso .login-wrap { background: linear-gradient(180deg, #1E2F55 0%, #3F6CA8 55%, #EAF1F7 55.1%); }
.theme-miso .login-sky span { background: #BFD9F0; }
.theme-miso .login-owl { width: 220px; }
.theme-miso .boot img { width: 200px; }
.theme-miso .jackpot { background: rgba(20, 32, 60, .78); }
.theme-miso .jackpot .burst { background: repeating-conic-gradient(from 0deg, rgba(127, 169, 208, .22) 0 10deg, transparent 10deg 20deg); }
.theme-miso .jackpot .badge { background: radial-gradient(circle at 35% 30%, #FFFFFF, #BFD9F0 55%, #7FA9D0); box-shadow: 0 6px 0 #3F6CA8, inset 0 -6px 0 rgba(0, 0, 0, .06); }
.theme-miso .jackpot .slot span { background: var(--navy); color: #F7E0AE; }
.theme-miso .fx-plus { color: #F7E0AE; -webkit-text-stroke-color: var(--navy); text-shadow: 0 4px 0 var(--navy); font-family: 'Fraunces', serif; }
.theme-miso .fx-ring { border-color: #7FA9D0; }
.theme-miso .cal { background: var(--navy3); box-shadow: 0 4px 0 var(--navy2); }
.theme-miso .compass-card h2 { color: #F7E0AE; }
.theme-miso .hero .flax-holder, .theme-miso .jackpot .panel .flax-holder { width: 240px; }
.theme-miso .jackpot .panel .flax-holder { width: 230px; margin-top: -150px; }
.theme-miso .ai-thinking img { object-fit: cover; border-radius: 50%; background: var(--sky); width: 48px; height: 48px; }
.theme-miso .quiz-panel { border: 1px solid var(--line); }
button, input, select, textarea { font-family: inherit; }
.topbar .logo span { white-space: nowrap; }
@media (max-width: 1000px) { .topbar .logo span { display: none; } }
.flax-holder.img-char.bust .ci { -webkit-mask-image: linear-gradient(#000 82%, transparent 99%); mask-image: linear-gradient(#000 82%, transparent 99%); }

/* =====================================================================
   Stående iPad / högt fönster: följeslagaren i ett band överst,
   stegkortet fyller resten av höjden och knapparna hamnar längst ner.
   ===================================================================== */
@media (orientation: portrait) and (min-width: 700px) {
  main.view.module-page { display: flex; flex-direction: column; min-height: calc(100dvh - 70px); padding-bottom: 110px; }
  .module-page .stage { display: flex; flex-direction: column; align-items: stretch; gap: 20px; }
  .module-page .stage .side { position: static; display: grid; grid-template-columns: minmax(200px, 30%) 1fr; gap: 22px; align-items: center; }
  .module-page .stage .side .flax-holder { max-width: 280px; width: 100%; margin: 0; }
  .module-page .stage .side .bubble { margin-top: 0; font-size: 1.2rem; padding: 20px 24px; }
  .module-page .stage .side .bubble::before { left: -12px; top: 50%; transform: translateY(-50%); border: 12px solid transparent; border-right-color: var(--card); border-left: 0; }
  .theme-miso .module-page .stage .side .bubble::before { filter: drop-shadow(-1px 0 0 var(--line)); }
  .module-page .step-card { min-height: 0; padding: 28px 30px; }
  .module-page .step-foot { margin-top: 24px; }
  .module-page .stage .side .flax-holder { max-width: 280px; }
  .module-page .stage .side { grid-template-columns: minmax(220px, 33%) 1fr; }
  .module-page .step-card h2 { font-size: 1.9rem; }
  .module-page .lesson p, .module-page .lesson li, .module-page .callout { font-size: 1.14rem; }
  .module-page .opt, .module-page .tag { font-size: 1.08rem; }
}
.brand-sub { margin: -2px 0 6px; font-weight: 800; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); }
.theme-miso .brand { font-size: 2.6rem; }

/* Miso ska stå/sitta stadigt – ingen flytande upp-och-ner-animation */
.theme-miso .bob { animation: none; }

/* Trygghetsvarningar */
.alert-dot { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--coral); color: #fff; font-size: .72rem; font-weight: 800; margin-left: 4px; }
.alert-card.has { border: 2px solid var(--coral); }
.alert-count { background: var(--coral); color: #fff; border-radius: 99px; padding: 1px 8px; margin-left: 6px; font-size: .75rem; }
.alert-list { display: grid; gap: 8px; }
.alert-row { border-radius: 14px; padding: 10px 14px; background: #FFF4F1; border-left: 6px solid var(--coral); display: grid; gap: 4px; }
.alert-row.sev-hög { background: #FFE6E1; border-left-color: var(--coral2); }
.alert-row.sev-låg { background: #FFF9EC; border-left-color: var(--yellow); }
.alert-row.seen { opacity: .6; }
.alert-row .excerpt { background: var(--card); border-radius: 10px; padding: 8px 10px; margin: 6px 0 0; white-space: pre-wrap; }
.alert-row .btn { justify-self: start; }
.alert-card.has.sys { border-color: var(--navy3); }
.alert-row.sys-row { background: var(--sky); border-left-color: var(--navy3); }
.service-msg { background: #FFF8EA !important; }

/* ---------- Det här minns Miso ---------- */
.memory-panel { width: min(640px, 100%); }
.mem-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; padding-right: 40px; }
.mem-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.mem-head h2 { margin: 0; }
.mem-list { margin: 14px 0; display: grid; gap: 14px; }
.mem-group h4 { margin: 0 0 6px; font-family: var(--font-head); }
.mem-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.mem-group li { display: flex; align-items: center; gap: 10px; background: var(--sky, #EEF4FB); border-radius: 14px; padding: 8px 8px 8px 14px; transition: opacity .2s, transform .2s; }
.mem-group li span { flex: 1; }
.mem-group li small { white-space: nowrap; }
.mem-group li .icon-btn { width: 34px; height: 34px; min-height: 34px; flex: none; }
.mem-group li.gone { opacity: 0; transform: translateX(20px); }
.mem-empty { background: var(--sky, #EEF4FB); border-radius: 16px; padding: 14px 16px; }
.mem-add { margin: 8px 0 12px; }
.mem-add summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.mem-add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.mem-add-row select { flex: 0 0 auto; }
.mem-add-row input { flex: 1 1 220px; }
.mem-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.btn.warn { background: #F6D5C7; }
.mem-card { display: flex; align-items: center; gap: 14px; }
.mem-card img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.msg.flax .t.streaming::after { content: '▍'; opacity: .5; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Resans delar (sektioner) ---------- */
.sec-head { display: flex; align-items: center; gap: 12px; margin: 22px 0 10px; }
.sec-head h3 { margin: 0; font-family: var(--font-head); font-size: 1.25rem; }
.sec-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; background: var(--card); box-shadow: var(--shadow); flex: none; }
.sec-count { margin-left: auto; font-weight: 800; color: var(--muted); }
.sec-lock { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; margin: 22px 0 8px; padding: 18px 20px; border-radius: var(--radius); border: 2px dashed var(--line); background: color-mix(in srgb, var(--card) 55%, transparent); }
.sec-lock.wait { border-style: solid; border-color: var(--navy3); background: linear-gradient(135deg, #1E2F55, #2B4577); color: #EAF1F7; }
.sec-lock.wait .kicker { color: #BFD9F0; }
.sec-lock.wait h3 { color: #fff; }
.sec-lock h3 { margin: 2px 0 6px; font-family: var(--font-head); }
.sec-lock p { margin: 6px 0 0; }
.lock-ico { font-size: 2rem; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(127, 169, 208, .18); }
.lock-mods { display: flex; flex-wrap: wrap; gap: 6px; }
.lock-mods span { font-size: .82rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(127, 169, 208, .18); }
.sec-lock:not(.wait) { opacity: .8; }
.countdown { text-align: center; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 18px; padding: 10px 16px; min-width: 128px; }
.countdown small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #BFD9F0; font-weight: 800; }
.countdown b { font-family: var(--font-head); font-size: 1.7rem; font-variant-numeric: tabular-nums; color: #F7E0AE; }
.sec-rest { margin: 6px 4px 0; }
.sec-done-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sec-done { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }
.sec-done[open] { grid-column: 1 / -1; }
.sec-done summary { list-style: none; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.sec-done summary::-webkit-details-marker { display: none; }
.sec-done summary .sec-ico { box-shadow: none; background: var(--sky); }
.sec-done summary .badges { margin-left: auto; font-size: 1.2rem; letter-spacing: 2px; }
.sec-done .journey { margin-top: 12px; }
@media (max-width: 620px) { .sec-lock { grid-template-columns: auto 1fr; } .countdown { grid-column: 1 / -1; } }

/* =====================================================================
   Natt (mörkt läge) – efter solnedgången i Stockholm, med stjärnhimmel
   ===================================================================== */
.theme-miso.night {
  --navy: #2E4E8A;
  --navy2: #26406F;
  --navy3: #7FA9D0;
  --accent-ink: #9CC3E8;
  --yellow: #E8A93A;
  --yellow2: #4A3C1E;
  --cream: #22325A;
  --sky: #203660;
  --mint: #1C4640;
  --lilac: #2A2F5E;
  --pink: #4A2C3C;
  --bg: #0D172E;
  --card: #16233F;
  --soft: #1B2A4A;
  --ink: #E4ECF7;
  --muted: #9AADC9;
  --line: #2A3C63;
  --shadow: 0 1px 0 rgba(0, 0, 0, .25), 0 14px 34px -14px rgba(0, 0, 0, .6);
  --h: #6B5A2A; --i: #2D5E52; --r: #33507E;
  color-scheme: dark;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 50% at 80% 0%, rgba(63, 108, 168, .35), transparent 70%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(90, 70, 160, .22), transparent 70%),
    linear-gradient(180deg, #0B1428 0%, #111E3B 60%, #16254A 100%);
}
.theme-miso.night .topbar { background: rgba(13, 23, 46, .86); border-bottom-color: rgba(42, 60, 99, .8); }
.theme-miso.night .topbar .logo img, .theme-miso.night .drawer header img, .theme-miso.night .msg.flax img, .theme-miso.night .ai-thinking img { background: #203660; }
.theme-miso.night .msg.flax { background: #1D2D52; }
.theme-miso.night .msg.me { background: #3F6CA8; }
.theme-miso.night .drawer .convo, .theme-miso.night .drawer .suggest { background: #111D38; }
.theme-miso.night .tile.yellow { background: linear-gradient(135deg, #3A3220, #5A4520); color: #F7E0AE; }
.theme-miso.night .tile.yellow h3, .theme-miso.night .tile.yellow p { color: #F7E0AE; }
.theme-miso.night .station .bar, .theme-miso.night .level-bar { background: #26365A; }
.theme-miso.night .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.theme-miso.night .btn.yellow { color: #2A1F08; }
.theme-miso.night input, .theme-miso.night textarea, .theme-miso.night select { background: #101C37; color: var(--ink); border-color: var(--line); }
.theme-miso.night input::placeholder, .theme-miso.night textarea::placeholder { color: #6F83A3; }
.theme-miso.night .bubble::before { filter: none; }
.theme-miso.night .chip { background: #1B2A4A; color: var(--ink); border-color: var(--line); }
.theme-miso.night .sec-lock.wait { background: linear-gradient(135deg, #1B2E58, #243D72); }
.theme-miso.night .quiz-overlay { background: rgba(5, 10, 22, .8); }
.theme-miso.night .chat-fab { box-shadow: 0 6px 0 #2B4577, 0 14px 30px -8px rgba(0, 0, 0, .6); }
.theme-miso.night .flax-holder.img-char::after { opacity: .35; }
.theme-miso.night img.emoji-dark, .theme-miso.night .calib-chart text { fill: var(--muted); }

/* Stjärnhimmel */
.night-sky { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.night-sky i { position: absolute; border-radius: 50%; background: #F7E9C4; animation: twinkle var(--d, 3s) ease-in-out infinite; animation-delay: var(--dl, 0s); opacity: .3; }
.night-sky b { position: absolute; width: var(--s, 12px); height: var(--s, 12px); background: #F7E0AE;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: glint var(--d, 5s) ease-in-out infinite; animation-delay: var(--dl, 0s); opacity: 0; filter: drop-shadow(0 0 4px rgba(247, 224, 174, .8)); }
.night-sky .shoot { position: absolute; width: 120px; height: 2px; background: linear-gradient(90deg, rgba(247, 233, 196, .9), transparent); border-radius: 2px; transform: rotate(-18deg); opacity: 0; animation: shoot 11s linear infinite; }
@keyframes glint { 0%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 45% { opacity: .95; transform: scale(1) rotate(45deg); } 60% { opacity: .5; } }
@keyframes shoot { 0%, 88% { opacity: 0; translate: 0 0; } 90% { opacity: 1; } 100% { opacity: 0; translate: -340px 110px; } }
@media (prefers-reduced-motion: reduce) { .night-sky i, .night-sky b, .night-sky .shoot { animation: none; opacity: .6; } .night-sky .shoot { display: none; } }
.theme-miso.night .timeline div { border-right-color: var(--bg); }
.theme-miso.night .timeline .q:nth-child(odd) { background: #4A3C1E; color: #F7E0AE; }
.theme-miso.night .timeline .q { color: var(--ink); }
.theme-miso.night .opt.right, .theme-miso.night .feedback.good, .theme-miso.night .tag.done { background: #173D33; }
.theme-miso.night .opt.wrong, .theme-miso.night .feedback.bad { background: #45262A; }
.theme-miso.night .sent.cut { background: #3A2A2E; }
.theme-miso.night .hl { color: #1E2F55; }
.theme-miso.night .stars { color: #34466B; }
.theme-miso.night .level-meter div, .theme-miso.night .badge-item .b { background: #22325A; }
.theme-miso.night .dots button, .theme-miso.night .switch span { background: #34466B; }
.theme-miso.night .alert-row { background: #3A262A; }
.theme-miso.night .alert-row.sev-hög { background: #4A2A2E; }
.theme-miso.night .alert-row.sev-låg, .theme-miso.night .service-msg { background: #3A3320 !important; }
.theme-miso.night .chip.on { background: #3F6CA8; color: #fff; border-color: #7FA9D0; }

/* ---------- Läroplanen ---------- */
.lgr-pick { margin-top: 10px; border: 1px dashed var(--line); border-radius: 16px; padding: 10px 14px; background: var(--soft); }
.lgr-pick summary { cursor: pointer; font-weight: 800; }
.lgr-body { margin-top: 8px; display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.lgr-subj { margin: 6px 0 0; font-family: var(--font-head); }
.lgr-sec b { display: block; font-size: .9rem; margin-bottom: 4px; }
.lgr-items { display: flex; flex-direction: column; gap: 6px; }
.lgr-item { text-align: left; font: inherit; font-size: .88rem; line-height: 1.35; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.lgr-item.on { border-color: var(--navy3); background: var(--sky); }
.lgr-item.on::before { content: '✓ '; font-weight: 800; color: var(--accent-ink); }
.lgr-sec ul { margin: 4px 0 12px; padding-left: 1.2em; }
.lgr-sec li.hit { font-weight: 700; }
.lgr-crit { margin-top: 8px; }
.lgr-crit summary { cursor: pointer; font-weight: 800; }
.crit-block { border-left: 4px solid var(--navy3); padding: 2px 12px; margin: 10px 0; }
.grade-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; }
.grade-steps .gs { border-radius: 14px; padding: 10px 12px; background: var(--sky); display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.grade-steps .gs b { font-family: var(--font-head); font-size: 1.4rem; }
.grade-steps .gs-C { background: var(--mint); } .grade-steps .gs-A { background: var(--yellow2); }
@media (max-width: 620px) { .grade-steps { grid-template-columns: 1fr; } }

/* ---------- Leitner-lådan & små diagram ---------- */
.leit-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 14px; }
.leit-box { border-radius: 14px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }
.leit-box .n { font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; }
.leit-box.b1 { background: var(--pink); } .leit-box.b2 { background: var(--yellow2); } .leit-box.b3 { background: var(--mint); }
.leit-card { border: 2px solid var(--line); border-radius: 20px; padding: 18px 20px; background: var(--soft); animation: popIn .3s; }
.leit-card .q { font-size: 1.25rem; font-weight: 700; margin: .3em 0 .6em; }
.leit-card .a { border-top: 2px dashed var(--line); padding-top: 8px; margin-bottom: 10px; }
.mini-chart { margin: 8px 0 14px; color: var(--ink); }
.mini-chart svg { width: 100%; max-width: 460px; height: auto; display: block; }
.step-pre { margin-bottom: 8px; }

/* Låsta delar med sina stationer */
.sec-locked { position: relative; margin: 22px 0 10px; padding: 16px; border-radius: calc(var(--radius) + 6px); border: 2px dashed var(--line);
  background: color-mix(in srgb, var(--card) 45%, transparent); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sec-locked.wait { border-style: solid; border-color: var(--navy3); }
.sec-locked-head { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin-bottom: 12px; }
.sec-locked-head h3 { margin: 2px 0 4px; font-family: var(--font-head); }
.sec-locked-head p { margin: 0; }
.sec-locked .countdown { background: linear-gradient(135deg, #1E2F55, #2B4577); border: 0; }
.locked-cards .station.is-locked { opacity: .55; filter: saturate(.6); pointer-events: none; box-shadow: none; }
.locked-cards .station.is-locked .num::before { content: '🔒 '; }
.theme-miso.night .sec-locked { background: color-mix(in srgb, var(--card) 40%, transparent); }
@media (max-width: 620px) { .sec-locked-head { grid-template-columns: auto 1fr; } .sec-locked-head .countdown { grid-column: 1 / -1; } }

/* =====================================================================
   Mobil (telefon): chatten överst, Miso i bottennavigeringen
   ===================================================================== */
.chatui { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.drawer .chatui .convo { flex: 1; max-height: none; padding: 14px; margin: 0; background: #FBF9F4; }
.drawer .chatui .composer { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.drawer .chatui .composer textarea { min-height: 46px; max-height: 140px; height: 46px; padding: 10px 12px; }
.drawer .chatui .suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 8px; background: #FBF9F4; }
.drawer .chatui .suggest button { font-size: .8rem; padding: 5px 10px; }
.theme-miso.night .drawer .chatui .convo, .theme-miso.night .drawer .chatui .suggest { background: #111D38; }
.nav a.nav-chat { display: none; }
.nav a.nav-chat img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--sky); }
.home-chat { padding: 14px; margin-bottom: 18px; }
.home-chat-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.home-chat-head img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: var(--sky); flex: none; }
.home-chat-head h1 { font-size: 1.35rem; margin: 0; }
.home-chat-head small { font-size: .75rem; }
.home-chat-head .icon-btn { width: 38px; height: 38px; flex: none; }
.home-chat .convo { max-height: 42vh; min-height: 120px; overflow-y: auto; padding: 4px 2px; margin: 0; }
.home-chat .suggest { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; scrollbar-width: none; }
.home-chat .suggest::-webkit-scrollbar { display: none; }
.home-chat .suggest .chip { flex: none; font-size: .82rem; padding: 6px 12px; white-space: nowrap; }
.home-chat .suggest .chip.go { background: var(--yellow); border-color: var(--yellow); color: #2A1F08; font-weight: 800; text-decoration: none; }
.home-chat .composer { display: flex; gap: 8px; align-items: flex-end; }
.home-chat .composer textarea { min-height: 46px; height: 46px; max-height: 120px; padding: 10px 12px; }
@media (max-width: 600px) {
  .chat-fab { display: none !important; }
  .nav a.nav-chat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; font-size: .72rem; }
  .drawer { inset: 0 !important; width: 100% !important; height: calc(100dvh - var(--kb, 0px)) !important; border-radius: 0; z-index: 60; animation: fadeIn .2s; }
  .drawer header { padding-top: calc(12px + env(safe-area-inset-top)); }
  main.view { padding-bottom: 110px; }
  .journey { grid-template-columns: 1fr 1fr; gap: 10px; }
  .station { padding: 12px; min-height: 0; }
  .station p { display: none; }
  .station h3 { font-size: 1rem; }
  .station .ico { width: 42px; height: 42px; font-size: 1.3rem; border-radius: 14px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile img { display: none; }
  .tile p { font-size: .8rem; }
  .tile h3 { font-size: 1rem; }
  .sec-locked { padding: 12px; }
}
.nav a .ni { margin-right: 4px; }
@media (max-width: 600px) {
  .nav { padding-top: 6px; }
  .nav a { flex: 1; border-radius: 14px; padding: 6px 4px; font-size: .7rem; line-height: 1.1; }
  .nav a .ni { margin: 0; font-size: 1.25rem; line-height: 26px; height: 26px; }
  .nav a.nav-chat img.ni { width: 26px; height: 26px; }
  .nav a.active { background: var(--sky); color: var(--ink); }
  .nav a .alert-dot { position: absolute; margin-left: 22px; }
}

/* Märkesbilder (batch 02) */
.badge-img { display: block; width: 100%; height: 100%; object-fit: contain; }
.badge-img.sm { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; }
.sec-done .badges .badge-img.sm { width: 28px; height: 28px; margin-left: -4px; }
.badge-item .b:has(.badge-img) { background: none !important; box-shadow: none !important; padding: 0; width: 96px; height: 96px; }
.badge-item.got .b:has(.badge-img) { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25)); }
.jackpot .badge:has(.badge-img) { width: 150px; height: 150px; background: none !important; box-shadow: none !important; }

/* =====================================================================
   Övningsprov från foton
   ===================================================================== */
.practice { display: grid; gap: 16px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.thumb .no { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .72rem; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; min-height: 28px; font-size: .8rem; }
label.btn { cursor: pointer; }
.ptest { border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-top: 10px; background: var(--soft); }
.ptest.new { border-color: var(--navy3); animation: popIn .4s; }
.ptest-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.ptest-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.img-viewer img { max-width: 94vw; max-height: 88vh; border-radius: 10px; background: #fff; }
.img-viewer .prev, .img-viewer .next { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 1.6rem; }
.img-viewer .prev { left: 12px; } .img-viewer .next { right: 12px; }

/* Tidscoachen */
.coachbar { position: sticky; top: 64px; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 10px 14px; margin-bottom: 12px; }
.coachbar.flash { animation: cbFlash 1.2s ease; }
@keyframes cbFlash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 4px var(--yellow), var(--shadow); } }
.cb-clock, .cb-now { text-align: center; min-width: 74px; }
.cb-clock small, .cb-now small { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
.cb-clock b { font-family: var(--font-head); font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.coachbar.low .cb-clock b { color: var(--coral2); }
.cb-now b { font-size: .95rem; }
.cb-prog { position: relative; height: 10px; border-radius: 99px; background: var(--soft); overflow: visible; border: 1px solid var(--line); }
.cb-prog i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #7FA9D0, var(--navy3)); }
.cb-prog .mk { position: absolute; top: -4px; width: 2px; height: 16px; background: var(--navy); opacity: .5; }
.cb-prog .mk.half { background: var(--yellow); opacity: 1; width: 3px; }
.cb-prog .mk.chk { background: var(--green); opacity: 1; }
.cb-msg { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: .88rem; line-height: 1.3; min-height: 36px; }
.cb-msg img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--sky); flex: none; }
.plan-t { margin: 10px 0; }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.qn { width: 38px; height: 38px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-weight: 800; cursor: pointer; }
.qn.ans { background: var(--mint); } .qn.park { background: var(--yellow2); border-color: var(--yellow); } .qn.on { border-color: var(--navy3); box-shadow: 0 0 0 2px var(--navy3); }
.qhead { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; margin-bottom: 12px; }
.qno { font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; }
.qprompt { font-size: 1.08rem; font-weight: 700; line-height: 1.4; }
.qpts { font-size: .8rem; color: var(--muted); font-weight: 800; white-space: nowrap; }
.tf-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tf-btns { display: flex; gap: 6px; flex: none; }
.match-terms { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.m-row { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: center; padding: 6px 0; }
.m-row select { padding: 8px; }
.sub { margin-bottom: 10px; } .sub label { display: block; font-weight: 700; margin-bottom: 4px; }
.open-ta { min-height: 160px; }
.wc { text-align: right; margin-top: 4px; }
.park-note { background: var(--yellow2); border-radius: 12px; padding: 6px 12px; }
.qfoot { margin-top: 12px; justify-content: space-between; }
.paper-coach { text-align: center; }
.paper-coach img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--sky); }
.paper-coach .clock { font-family: var(--font-head); font-size: clamp(3.5rem, 14vw, 6rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.paper-coach .say { font-size: 1.1rem; max-width: 560px; margin: 10px auto; }
.btn.pulse { animation: pulse 1.2s infinite; }

/* Resultat */
.result-head { display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: center; }
.result-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--sky); }
.result-head .score { font-family: var(--font-head); font-size: 2.6rem; font-weight: 700; }
.result-head .score small { font-size: 1.1rem; color: var(--muted); }
.res-list { display: grid; gap: 8px; margin-top: 14px; }
.res-q { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 10px 14px; border-left: 5px solid var(--line); }
.res-q.v-rätt { border-left-color: var(--green); } .res-q.v-delvis { border-left-color: var(--yellow); } .res-q.v-fel, .res-q.v-tomt { border-left-color: var(--coral); }
.res-q summary { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: center; cursor: pointer; list-style: none; }
.res-q summary::-webkit-details-marker { display: none; }
.res-q .qp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-q .pts { font-weight: 800; }
.res-body { margin-top: 8px; }
.transcript { background: var(--soft); border-radius: 12px; padding: 8px 12px; white-space: pre-wrap; font-size: .92rem; margin-bottom: 8px; }
.sharpen { background: var(--yellow2); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.warn-chip { background: #F6D5C7 !important; }
.model summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.theme-miso.night .warn-chip { background: #4A2C2A !important; }
@media (max-width: 600px) {
  .coachbar { top: 8px; grid-template-columns: auto 1fr; }
  .cb-now { display: none; }
  .qfoot .btn { flex: 1; }
  .result-head { grid-template-columns: 64px 1fr; } .result-head img { width: 64px; height: 64px; }
}
.runner.paper .cb-clock, .runner.paper .cb-msg, .runner.paper .cb-now { display: none; }
.runner.paper .coachbar { grid-template-columns: 1fr; position: static; }
@media (max-width: 600px) {
  .qfoot { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; }
  .qfoot .lbl { display: none; }
  .qfoot .done { grid-column: 1 / -1; }
  .coachbar { scroll-margin-top: 8px; }
}
.coachbar { scroll-margin-top: 72px; }
