/* Hem: lektionsvägen med avsnitt, enheter, steg, sidopanelens kort och mobilens meny. */
/* ---------- Hem: väg och sidopanel ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; max-width: 1080px; margin: 0 auto; padding: 20px 16px 140px; }
.path-col { width: 100%; max-width: 600px; margin: 0 auto; }
.side { display: none; }
@media (min-width: 1060px) {
  .home { grid-template-columns: minmax(0, 600px) 340px; justify-content: center; gap: 56px; padding-top: 28px; }
  .side { position: sticky; top: calc(var(--topbar-h) + 24px); display: grid; gap: 18px; align-self: start; }
  .mobile-status, .fab { display: none !important; }
}

/* Nivåerna överst på vägen: Lätt, Medel och Svår med framsteg för var och en. */
.levels-wrap { margin-bottom: 28px; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.level {
  --level: var(--green);
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px 14px 11px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 3px 0 var(--line);
  color: var(--ink);
  text-align: left;
  transition: transform 60ms, box-shadow 60ms, background 100ms;
}
.level:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.level--2 { --level: var(--blue-face); }
.level--3 { --level: #a560e8; }
.level.is-active { border-color: var(--level); background: color-mix(in srgb, var(--level) 9%, var(--panel)); box-shadow: 0 3px 0 var(--level); }
@media (hover: hover) { .level:not(.is-active):hover { background: var(--soft); } }
.level-top { display: grid; min-width: 0; line-height: 1.15; }
.level-top small { overflow: hidden; color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: 0.06em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.level-top strong { margin-top: 2px; overflow: hidden; color: var(--ink-strong); font-size: 16px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.level-meter { display: block; height: 8px; overflow: hidden; border-radius: 99px; background: var(--line); }
.level-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--level); transition: width 300ms; }
.level-count { color: var(--muted); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.level-summary { margin-top: 12px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.path-end--done { display: grid; justify-items: center; gap: 14px; }
.path-end--done p { color: var(--ink); font-weight: 800; }
.meter-label { flex: none; width: 72px; color: var(--ink); font-size: 14px; font-weight: 800; }
.meter--level-1 > span { background: var(--green); }
.meter--level-2 > span { background: var(--blue-face); }
.meter--level-3 > span { background: #a560e8; }

.unit { margin-bottom: 48px; }
.unit-banner {
  position: sticky;
  top: calc(var(--topbar-h) + 10px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 16px 20px;
  border-radius: var(--radius);
  background: var(--tone);
  box-shadow: 0 4px 0 var(--tone-shadow);
  color: var(--tone-text);
}
.unit-banner::before { position: absolute; top: -12px; right: -8px; left: -8px; height: 12px; background: var(--bg); content: ""; }
.unit-kicker { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.unit-banner h2 { margin-top: 2px; font-size: 21px; font-weight: 900; line-height: 1.2; }
.unit-meta { margin-top: 3px; font-size: 14px; font-weight: 700; }
.guide-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border: 2px solid color-mix(in srgb, var(--tone-text) 40%, transparent);
  border-radius: 14px;
  color: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-decoration: none;
  text-transform: uppercase;
}
@media (hover: hover) { .guide-btn:hover { background: color-mix(in srgb, var(--tone-text) 12%, transparent); } }
.guide-btn .icon { width: 22px; height: 22px; }

.path { --amp: 46px; display: flex; flex-direction: column; align-items: center; gap: 26px; margin: 44px 0 0; padding: 0; list-style: none; }
.path-item { position: relative; z-index: 1; transform: translateX(calc(var(--x) * var(--amp))); }
.path-item.is-open { z-index: 20; }
/* Plats för bubblan, så att den går fri från stegets kant ovanför även när den gungar. */
.path-item:has(> .start-bubble) { margin-top: 60px; }
.path > .path-item:has(> .start-bubble):first-child { margin-top: 38px; }
.node {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  height: 66px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 7px 0 var(--tone-shadow);
  color: #ffffff;
  transition: transform 80ms, box-shadow 80ms, filter 150ms;
}
.node .icon { width: 32px; height: 32px; }
@media (hover: hover) { .node:hover { filter: brightness(1.07); } }
.node:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--tone-shadow); }
.tone-8 .node { color: #4a3700; }
.node.is-future { background: var(--line); box-shadow: 0 7px 0 var(--line-strong); color: var(--faint); }
.path-item.is-current::before {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 96px;
  height: 96px;
  border: 8px solid var(--line);
  border-radius: 50%;
  content: "";
}
.path-item.is-new .node { animation: node-done 700ms cubic-bezier(0.3, 1.6, 0.5, 1); }
.start-bubble {
  position: absolute;
  bottom: calc(100% + 22px);
  left: 50%;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--tone-ink);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  animation: bob 1.5s ease-in-out infinite;
}
.start-bubble::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background: var(--panel);
  content: "";
  transform: translate(-50%, -5px) rotate(45deg);
}
.popover {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  z-index: 5;
  width: min(330px, calc(100vw - 32px));
  padding: 18px;
  border-radius: var(--radius);
  background: var(--tone);
  box-shadow: 0 4px 0 var(--tone-shadow);
  color: var(--tone-text);
  transform: translateX(calc(-50% - var(--x) * var(--amp)));
  animation: pop-in 140ms ease-out;
}
.popover::before {
  position: absolute;
  top: -8px;
  left: calc(50% + var(--x) * var(--amp));
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: var(--tone);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}
.popover-kicker { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.popover h3 { margin-top: 2px; font-size: 19px; font-weight: 900; line-height: 1.25; }
.popover p { margin: 6px 0 16px; font-size: 15px; font-weight: 700; line-height: 1.4; }
.popover.is-future { border: 2px solid var(--line); background: var(--panel); box-shadow: 0 4px 0 var(--line); color: var(--ink); }
.popover.is-future::before { border-top: 2px solid var(--line); border-left: 2px solid var(--line); background: var(--panel); }
.popover.is-future .popover-kicker { color: var(--tone-ink); }
.popover.is-future p { color: var(--muted); }

.card { padding: 18px 20px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head .icon { width: 26px; height: 26px; }
.card h2 { color: var(--ink-strong); font-size: 18px; font-weight: 900; line-height: 1.25; }
.card p { color: var(--muted); font-size: 15px; }
.card .btn { margin-top: 14px; }
.card--exam .card-head .icon { color: var(--red-face); }
.card--goal .card-head .icon { color: var(--orange); }
.card--practice .card-head .icon { color: var(--blue-face); }
.card--progress .card-head .icon { color: var(--gold); }
.exam-parts { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; color: var(--ink); font-size: 14px; }
.meter { position: relative; height: 16px; overflow: hidden; border-radius: 99px; background: var(--line); }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--gold); transition: width 300ms; }
.meter--green > span { background: var(--green); }
.meter-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.meter-row .meter { flex: 1; }
.meter-row span:last-child { color: var(--muted); font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress-facts { display: grid; gap: 4px; margin: 12px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 14px; }
.mobile-status { display: grid; gap: 12px; margin-bottom: 28px; }
.mobile-status .card { padding: 14px 16px; }
.mobile-status .card-head { margin-bottom: 0; }
.mobile-status .card h2 { font-size: 16px; }
.mobile-status .card p { font-size: 14px; }
.fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 30;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 99px;
}
.fab-count { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: #ffffff; color: var(--blue-shadow); font-size: 13px; letter-spacing: 0; }
.path-end { margin: 12px 0 0; color: var(--muted); font-size: 15px; text-align: center; }
