/* Layout: en smal spelkolumn mot en ljus himmel. Kamrat A är alltid blå, kamrat B alltid korall. */
:root {
  --sky: #BFE6FF;
  --sky-2: #E8F7FF;
  --ink: #1B2547;
  --ink-soft: #4A5677;
  --blue: #2F6BFF;
  --blue-deep: #1D4FD6;
  --coral: #FF6B3D;
  --coral-deep: #E04E20;
  --sun: #FFC83D;
  --leaf: #1FA866;
  --berry: #E23D7A;
  --grape: #7A5CFF;
  --card: #FFFFFF;
  --line: #9CCBEA;
  --shadow: rgba(27, 37, 71, 0.18);
  --display: 'Baloo 2', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: 17px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 30% at 15% 8%, var(--sky-2) 0 40%, transparent 41%),
    radial-gradient(ellipse 45% 22% at 90% 20%, var(--sky-2) 0 40%, transparent 41%),
    var(--sky);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 4px solid var(--sun); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0; text-wrap: balance; }

.app { max-width: 780px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 48px; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 6px 14px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: -0.01em; }
.logo { display: flex; align-items: flex-end; }
.logo span { width: 26px; height: 26px; border-radius: 50% 50% 46% 46%; position: relative; }
.logo span:first-child { background: var(--blue); }
.logo span:last-child { background: var(--coral); margin-left: -6px; height: 22px; width: 22px; }
.logo span::after { content: ""; position: absolute; top: 8px; left: 7px; width: 4px; height: 4px; border-radius: 50%; background: var(--card); box-shadow: 7px 0 0 var(--card); }
.logo span:last-child::after { top: 6px; left: 5px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 800; box-shadow: 0 3px 0 var(--shadow); font-variant-numeric: tabular-nums; }
.pill .star { color: var(--sun); font-size: 1.2rem; -webkit-text-stroke: 1px #D99A00; }
.icon-btn { width: 40px; height: 40px; justify-content: center; padding: 0; font-size: 1.15rem; }
.icon-btn[aria-pressed="false"] { opacity: 0.45; }
@media (max-width: 400px) {
  .brand-name { font-size: 1.25rem; }
  .logo span:first-child { width: 22px; height: 22px; }
  .logo span:last-child { width: 18px; height: 18px; }
  .top-actions { gap: 5px; }
  .pill { padding: 5px 9px; }
  .icon-btn { width: 36px; height: 36px; padding: 0; font-size: 1rem; }
}
@media (max-width: 345px) { .brand-name { font-size: 1.05rem; } .app { padding-inline: 12px; } }

.screen { animation: enter 0.35s ease both; }
@keyframes enter { from { opacity: 0.4; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Start */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-block: 6px 18px; }
.hero h1 { font-size: clamp(2.2rem, 8vw, 3.4rem); font-weight: 800; }
.hero p { margin: 4px 0 0; color: var(--ink-soft); font-weight: 700; }
.rank { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; background: var(--ink); color: var(--card); border-radius: 999px; padding: 4px 14px 4px 6px; font-weight: 800; font-size: 0.95rem; }
.rank b { background: var(--sun); color: var(--ink); border-radius: 999px; padding: 1px 10px; font-family: var(--display); }

.panel { background: var(--card); border-radius: 26px; padding: 18px; box-shadow: 0 6px 0 var(--shadow); }
.panel + .panel { margin-top: 16px; }
.label { font-family: var(--display); font-weight: 800; font-size: 1.35rem; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.label small { font-family: var(--body); font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }

.numgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (min-width: 640px) { .numgrid { grid-template-columns: repeat(10, 1fr); } }
.num {
  aspect-ratio: 1 / 1.1; max-width: 100%; border: 0; border-radius: 18px;
  background: var(--sky-2); box-shadow: inset 0 -5px 0 var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  font-family: var(--display); font-weight: 800; font-size: clamp(1.5rem, 5vw, 1.9rem); line-height: 1;
  transition: transform 0.12s ease;
}
.num:hover { transform: translateY(-3px) rotate(-2deg); }
.num:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--line); }
.num.big { background: #FFF1C9; box-shadow: inset 0 -5px 0 #F2C65A; }
.num .s { font-size: 0.7rem; letter-spacing: 1px; color: var(--line); margin-top: 4px; font-family: var(--body); }
.num .s .on { color: var(--sun); -webkit-text-stroke: 0.6px #D99A00; }

.mixrow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.mixrow .chunky { white-space: nowrap; font-size: clamp(1rem, 4.4vw, 1.2rem); padding-inline: 8px; }
.chunky {
  border: 0; border-radius: 18px; padding: 14px 16px; font-family: var(--display); font-weight: 800; font-size: 1.2rem;
  background: var(--blue); color: var(--card); box-shadow: 0 5px 0 var(--blue-deep); transition: transform 0.1s;
}
.chunky:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--blue-deep); }
.chunky.coral { background: var(--coral); box-shadow: 0 5px 0 var(--coral-deep); }
.chunky.ghost { background: var(--sky-2); color: var(--ink); box-shadow: 0 5px 0 var(--line); }
.chunky.sun { background: var(--sun); color: var(--ink); box-shadow: 0 5px 0 #D99A00; }

.foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 16px; }
.namefield { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.namefield input { width: 9.5em; border: 3px solid var(--line); border-radius: 12px; padding: 6px 10px; font: inherit; color: var(--ink); background: var(--card); }
.textbtn { background: none; border: 0; text-decoration: underline; color: var(--ink-soft); font-weight: 700; padding: 6px; }

/* Mascot */
.buddy-row { display: flex; align-items: flex-end; gap: 12px; }
.mascot { width: 74px; height: 66px; flex: none; position: relative; border-radius: 50% 50% 44% 44%; background: var(--blue); box-shadow: inset -8px -8px 0 rgba(0,0,0,0.12); transition: transform 0.2s; }
.mascot::before { content: ""; position: absolute; right: -18px; bottom: 0; width: 40px; height: 36px; border-radius: 50% 50% 44% 44%; background: var(--coral); box-shadow: inset -5px -5px 0 rgba(0,0,0,0.12); }
.mascot .eyes { position: absolute; top: 20px; left: 16px; display: flex; gap: 14px; }
.mascot .eyes i { width: 10px; height: 13px; background: var(--card); border-radius: 50%; position: relative; }
.mascot .eyes i::after { content: ""; position: absolute; width: 5px; height: 6px; background: var(--ink); border-radius: 50%; left: 3px; top: 4px; }
.mascot .mouth { position: absolute; left: 25px; top: 38px; width: 22px; height: 11px; border-radius: 0 0 14px 14px; background: var(--ink); }
.mascot.happy { animation: hop 0.6s ease 2; }
.mascot.happy .mouth { height: 15px; }
.mascot.oops { animation: tilt 0.5s ease; }
.mascot.oops .mouth { height: 5px; border-radius: 6px; top: 42px; }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-16px) rotate(-6deg); } }
@keyframes tilt { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-10deg); } 70% { transform: rotate(8deg); } }
.speech { position: relative; background: var(--card); border-radius: 18px; padding: 10px 14px; font-weight: 800; box-shadow: 0 4px 0 var(--shadow); margin: 0 0 18px 14px; min-width: 0; flex: 1; }
.speech::before { content: ""; position: absolute; left: -10px; bottom: 12px; border: 10px solid transparent; border-right-color: var(--card); border-left: 0; }

/* Mode */
.back { margin-bottom: 10px; }
.mode-title { font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; margin-block: 4px 14px; }
.mode-title em { font-style: normal; color: var(--coral); }
.modes { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 560px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode-card { text-align: left; border: 0; border-radius: 26px; padding: 18px; background: var(--card); box-shadow: 0 6px 0 var(--shadow); display: grid; gap: 6px; transition: transform 0.12s; }
.mode-card:hover { transform: translateY(-3px); }
.mode-card h3 { font-size: 1.6rem; font-weight: 800; }
.mode-card p { margin: 0; color: var(--ink-soft); font-weight: 700; }
.mode-card .demo { font-family: var(--display); font-size: 2rem; font-weight: 800; }
.mode-card .best { font-size: 0.9rem; font-weight: 800; color: var(--ink-soft); }
.a { color: var(--blue); }
.b { color: var(--coral); }

details.friends { margin-top: 16px; }
details.friends summary { font-family: var(--display); font-weight: 800; font-size: 1.2rem; cursor: pointer; }
.pairs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.domino { display: inline-flex; border-radius: 12px; overflow: hidden; font-family: var(--display); font-weight: 800; font-size: 1.25rem; box-shadow: 0 3px 0 var(--shadow); font-variant-numeric: tabular-nums; }
.domino span { padding: 4px 12px; color: var(--card); min-width: 2.2em; text-align: center; }
.domino span:first-child { background: var(--blue); }
.domino span:last-child { background: var(--coral); }

/* Play common */
.playhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; }
.progress i { width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: inset 0 -3px 0 var(--line); }
.progress i.done { background: var(--leaf); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }
#findProgress, #bubProgress { justify-content: center; margin-bottom: 12px; }
.progress i.miss { background: var(--coral); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2); }
.progress i.now { background: var(--sun); transform: scale(1.25); }
.streak { font-family: var(--display); font-weight: 800; background: var(--ink); color: var(--sun); border-radius: 999px; padding: 2px 12px; transition: transform 0.2s; }
.streak.bump { animation: bump 0.4s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

.stage { background: var(--card); border-radius: 30px; padding: 20px 16px 22px; box-shadow: 0 6px 0 var(--shadow); text-align: center; }
.equation { display: flex; justify-content: center; align-items: center; gap: 0.25em; flex-wrap: wrap; font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 12vw, 4.4rem); line-height: 1; margin-block: 4px 16px; font-variant-numeric: tabular-nums; }
.equation .op { color: var(--ink-soft); }
.equation .gap { min-width: 1.4em; padding: 0.08em 0.2em 0; border: 4px dashed var(--coral); border-radius: 18px; color: var(--coral); background: #FFF0EA; }
.equation .gap.filled { border-style: solid; background: var(--coral); color: var(--card); animation: bump 0.4s ease; }
.equation .total { background: var(--sun); border-radius: 18px; padding: 0.08em 0.25em 0; }

.beads { display: grid; gap: 8px; justify-content: center; margin-bottom: 18px; }
.beadrow { display: flex; gap: 14px; justify-content: center; }
.five { display: flex; gap: 5px; }
.bead { width: clamp(22px, 6.4vw, 32px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; color: var(--card); }
.bead.ka { background: var(--blue); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.18); }
.bead.kb { background: var(--coral); box-shadow: inset -3px -3px 0 rgba(0,0,0,0.18); animation: popin 0.35s ease both; }
.bead.empty { border: 3px dashed var(--coral); color: var(--coral); }
.bead.hint { animation: pulse 0.9s ease infinite; }
@keyframes popin { from { transform: scale(0); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
@keyframes pulse { 50% { transform: scale(1.18); background: #FFE2D7; } }

.answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .answers { grid-template-columns: repeat(4, 1fr); } }
.answers.two { grid-template-columns: repeat(2, 1fr); }
.ans {
  border: 0; border-radius: 22px; min-height: 84px; font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1;
  background: var(--sky-2); box-shadow: inset 0 -6px 0 var(--line); transition: transform 0.1s;
}
.ans:hover:not(:disabled) { transform: translateY(-3px); }
.ans:active:not(:disabled) { transform: translateY(2px); }
.ans.right { background: var(--leaf); color: var(--card); box-shadow: inset 0 -6px 0 rgba(0,0,0,0.2); animation: bump 0.4s ease; }
.ans.wrong { background: #ECEFF5; color: #A3ACC2; box-shadow: none; animation: shake 0.4s ease; cursor: not-allowed; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.explain { min-height: 1.6em; margin: 14px 0 0; font-weight: 800; color: var(--ink-soft); }

/* Bubbles */
.bubble-goal { font-family: var(--display); font-weight: 800; font-size: 1.5rem; margin-bottom: 10px; }
.bubble-goal b { background: var(--sun); border-radius: 12px; padding: 0 10px; }
.pond { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; padding-block: 8px; }
.bubble {
  --c: var(--blue);
  width: clamp(64px, 19vw, 84px); aspect-ratio: 1; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.85) 0 12%, transparent 13%), var(--c);
  box-shadow: inset -6px -8px 0 rgba(0,0,0,0.15), 0 5px 0 var(--shadow);
  color: var(--card); font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1;
  animation: float 3s ease-in-out infinite; animation-delay: var(--d, 0s);
  transition: transform 0.15s;
}
.bubble.sel { outline: 5px solid var(--sun); outline-offset: 3px; transform: scale(1.12); animation: none; }
.bubble.wobble { animation: shake 0.45s ease; }
.bubble.popped { animation: popout 0.4s ease forwards; pointer-events: none; }
.bubble.tip { animation: pulse 0.8s ease 3; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes popout { 40% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(0.2); opacity: 0; } }
.found { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 40px; margin-top: 14px; }
.tiprow { display: flex; justify-content: center; margin-top: 12px; }

/* Done */
.done { text-align: center; }
.done h2 { font-size: clamp(2.6rem, 11vw, 4.2rem); font-weight: 800; color: var(--coral); }
.bigstars { display: flex; justify-content: center; gap: 10px; margin-block: 12px; }
.bigstars span { font-size: clamp(3rem, 14vw, 4.5rem); color: #DDE3EE; line-height: 1; }
.bigstars span.on { color: var(--sun); -webkit-text-stroke: 2px #D99A00; animation: starin 0.5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes starin { from { transform: scale(0) rotate(-90deg); } to { transform: scale(1) rotate(0); } }
.stats { font-weight: 800; color: var(--ink-soft); margin: 0 0 14px; }
.reward { display: grid; justify-items: center; gap: 4px; background: var(--sky-2); border-radius: 22px; padding: 14px; margin-block: 14px; }
.reward .em { font-size: 4.5rem; line-height: 1.1; animation: spinin 0.8s cubic-bezier(.3,1.5,.5,1) 0.6s both; }
@keyframes spinin { from { transform: scale(0) rotate(-200deg); } to { transform: scale(1) rotate(0); } }
.reward p { margin: 0; font-weight: 800; }
.unlock { background: var(--ink); color: var(--card); border-radius: 18px; padding: 10px 14px; font-weight: 800; margin-bottom: 14px; }
.unlock b { color: var(--sun); }
.done-actions { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .done-actions { grid-template-columns: 1fr 1fr 1fr; } }

/* Stickers */
.book { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.slot { aspect-ratio: 1; max-width: 100%; border-radius: 18px; background: var(--sky-2); display: grid; place-items: center; text-align: center; padding: 6px; }
.slot .em { font-size: 2.4rem; line-height: 1; }
.slot small { font-size: 0.7rem; font-weight: 800; color: var(--ink-soft); }
.slot.missing { border: 3px dashed var(--line); background: transparent; color: var(--line); font-family: var(--display); font-weight: 800; font-size: 1.8rem; }
.slot .x { font-size: 0.7rem; background: var(--berry); color: var(--card); border-radius: 999px; padding: 0 6px; }

/* Hemskärmens kort */
.cardrow { display: grid; gap: 12px; margin-top: 16px; }
.cardrow .panel { margin: 0; display: grid; gap: 10px; align-content: space-between; }
.cardrow .panel + .panel { margin-top: 0; }
.cardrow .chunky { width: 100%; }
.cardrow p { margin: 0; color: var(--ink-soft); font-weight: 700; font-size: 0.95rem; }
.wide { width: 100%; }
.road-cta { background: var(--ink); color: var(--card); display: grid; gap: 12px; }
.road-cta .label small { color: #B9C3E0; }
.road-cta .next { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; }
.road-cta .next span { color: var(--sun); }
.meter { height: 16px; border-radius: 999px; background: rgba(255,255,255,0.18); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--sun), var(--coral)); transition: width 0.6s ease; }
.panel .meter { background: var(--sky-2); }
.tricky-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tricky-panel p { margin: 0; font-weight: 700; color: var(--ink-soft); min-width: 0; flex: 1 1 14em; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 800; color: var(--ink-soft); }
.avatar-big { width: 74px; height: 74px; flex: none; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 2.8rem; box-shadow: 0 5px 0 var(--shadow); }
.playlabel { font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: var(--ink-soft); }
.progress.many i { width: 11px; height: 11px; }

/* Vägen till expert */
.zone { position: relative; padding: 18px 16px 22px; overflow: hidden; }
.zone + .zone { margin-top: 16px; }
.zone-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: relative; z-index: 1; margin-bottom: 8px; }
.zone-head h3 { font-size: 1.6rem; font-weight: 800; }
.zone-head small { display: block; font-weight: 800; color: var(--ink-soft); font-family: var(--body); font-size: 0.9rem; }
.medal { font-size: 2.4rem; line-height: 1; filter: grayscale(1); opacity: 0.35; }
.medal.on { filter: none; opacity: 1; animation: bump 0.5s ease; }
.road { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.road .bed { fill: none; stroke: #F3DDA4; stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.road .dash { fill: none; stroke: var(--card); stroke-width: 3; stroke-dasharray: 8 10; stroke-linecap: round; }
.stops { position: relative; z-index: 1; display: grid; gap: 14px; padding-top: 22px; }
.stop { display: flex; align-items: center; gap: 12px; margin-left: var(--x, 0%); max-width: calc(100% - var(--x, 0%)); background: none; border: 0; padding: 0; text-align: left; }
.stop .node {
  width: 62px; height: 62px; flex: none; border-radius: 50%; display: grid; place-items: center; position: relative;
  font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1;
  background: #DCE3EE; color: #8792AA; box-shadow: inset 0 -5px 0 rgba(0,0,0,0.12);
}
.stop .node.kind-test, .stop .node.kind-final { border-radius: 18px; }
.stop .node.kind-challenge { border-radius: 50% 50% 50% 12px; }
.stop.done .node { background: var(--leaf); color: var(--card); }
.stop.open .node { background: var(--sun); color: var(--ink); animation: ring 1.6s ease infinite; }
.stop.open .node::after { content: attr(data-me); position: absolute; top: -20px; left: -18px; font-size: 1.7rem; animation: hop 1.2s ease infinite; }
@keyframes ring { 0%, 100% { box-shadow: inset 0 -5px 0 rgba(0,0,0,0.12), 0 0 0 0 rgba(255,200,61,0.7); } 50% { box-shadow: inset 0 -5px 0 rgba(0,0,0,0.12), 0 0 0 12px rgba(255,200,61,0); } }
.stop .txt { min-width: 0; background: var(--card); border-radius: 14px; padding: 6px 10px; box-shadow: 0 3px 0 var(--shadow); }
.stop .txt b { display: block; font-family: var(--display); font-size: 1.1rem; line-height: 1.1; }
.stop .txt small { display: block; font-weight: 700; color: var(--ink-soft); font-size: 0.82rem; }
.stop .txt .on { color: var(--sun); -webkit-text-stroke: 0.6px #D99A00; }
.stop:disabled { cursor: default; }
.stop:disabled .txt { opacity: 0.6; }
.stop:not(:disabled):hover .node { transform: scale(1.06); }
.goal-card { text-align: center; display: grid; gap: 6px; justify-items: center; }
.goal-card .em { font-size: 3rem; line-height: 1; }

/* Prov / utmaning – intro */
.intro { text-align: center; display: grid; gap: 12px; justify-items: center; }
.intro h2 { font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 800; }
.intro ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-weight: 800; color: var(--ink-soft); }
.intro .chunky { min-width: 12em; }

/* Utmaning på tid */
.timer { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-bottom: 12px; }
.timebar { height: 18px; border-radius: 999px; background: var(--sky-2); overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,0.06); }
.timebar i { display: block; height: 100%; background: var(--leaf); border-radius: inherit; transition: width 0.1s linear, background 0.3s; }
.timebar i.low { background: var(--coral); }
.secs { font-family: var(--display); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; min-width: 2.4em; text-align: right; }
.scorebox { font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.scorebox b { font-size: 2rem; color: var(--leaf); }
.countdown { font-family: var(--display); font-weight: 800; font-size: clamp(5rem, 30vw, 9rem); color: var(--coral); line-height: 1; animation: bump 0.5s ease; }
.ans.correct-was { outline: 4px solid var(--leaf); outline-offset: 2px; }

/* Klass-inloggning */
.join h2 { font-size: clamp(1.8rem, 7vw, 2.4rem); font-weight: 800; margin-bottom: 6px; }
.join p.lead { margin: 0 0 14px; font-weight: 700; color: var(--ink-soft); }
.codefield { width: 100%; font-family: var(--display); font-weight: 800; font-size: 2rem; text-align: center; letter-spacing: 0.08em; text-transform: uppercase; border: 4px solid var(--line); border-radius: 18px; padding: 8px; color: var(--ink); background: var(--card); }
.textfield { width: 100%; font: inherit; font-weight: 800; font-size: 1.3rem; border: 4px solid var(--line); border-radius: 16px; padding: 10px 12px; color: var(--ink); background: var(--card); }
.formstack { display: grid; gap: 14px; }
.error { color: var(--berry); font-weight: 800; min-height: 1.4em; margin: 0; }
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.kid { border: 0; border-radius: 18px; background: var(--sky-2); box-shadow: inset 0 -5px 0 var(--line); padding: 10px 6px; display: grid; justify-items: center; gap: 2px; font-weight: 800; min-width: 0; }
.kid .em { font-size: 2.2rem; line-height: 1.1; }
.kid span:last-child { max-width: 100%; overflow-wrap: anywhere; }
.kid.new { background: #FFF1C9; box-shadow: inset 0 -5px 0 #F2C65A; }
.pickrow { display: flex; flex-wrap: wrap; gap: 8px; }
.pickrow button { width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--sky-2); font-size: 1.9rem; box-shadow: inset 0 -4px 0 var(--line); }
.pickrow button[aria-pressed="true"] { background: var(--sun); box-shadow: inset 0 -4px 0 #D99A00; transform: scale(1.08); }
.pinslots { display: flex; justify-content: center; gap: 12px; margin-bottom: 14px; }
.pinslots span { width: 64px; height: 64px; border-radius: 18px; border: 4px dashed var(--line); display: grid; place-items: center; font-size: 2.2rem; }
.pinslots span.full { border-style: solid; border-color: var(--blue); background: var(--sky-2); animation: bump 0.25s ease; }
.pinpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 360px; margin: 0 auto; }
.pinpad button { aspect-ratio: 1; max-width: 100%; border: 0; border-radius: 18px; background: var(--sky-2); box-shadow: inset 0 -5px 0 var(--line); font-size: 2.1rem; }
.pinpad button:active { transform: translateY(2px); }
.pinactions { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }

/* Klassen */
.jar { display: grid; gap: 8px; }
.jar .big { font-family: var(--display); font-weight: 800; font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.jar .big span { color: var(--sun); -webkit-text-stroke: 1px #D99A00; }
.mates { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.mate { background: var(--sky-2); border-radius: 18px; padding: 10px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; min-width: 0; }
.mate.me { background: #FFF1C9; outline: 3px solid var(--sun); }
.mate .em { font-size: 2rem; grid-row: span 2; }
.mate b { font-family: var(--display); font-size: 1.1rem; overflow-wrap: anywhere; line-height: 1.1; }
.mate > * { min-width: 0; }
.mate small { overflow-wrap: anywhere; font-size: 0.8rem; font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mate .medals { grid-column: 1 / -1; font-size: 1.1rem; min-height: 1.3em; letter-spacing: 2px; }

/* Diplom */
.diploma { grid-template-columns: minmax(0, 1fr); background: var(--card); border-radius: 12px; padding: 28px 16px; text-align: center; box-shadow: 0 8px 0 var(--shadow); border: 10px double var(--sun); display: grid; gap: 8px; justify-items: center; }
.diploma .kicker { letter-spacing: 0.3em; font-weight: 800; color: var(--ink-soft); font-size: 0.85rem; text-transform: uppercase; }
.diploma h2 { max-width: 100%; overflow-wrap: anywhere; font-size: clamp(1.7rem, 8.4vw, 3.6rem); font-weight: 800; color: var(--blue); }
.diploma .name { font-family: var(--display); font-weight: 800; font-size: clamp(2rem, 9vw, 3rem); color: var(--coral); border-bottom: 3px solid var(--line); padding: 0 16px; }
.diploma p { margin: 0; font-weight: 700; max-width: 30em; }
.seal { font-size: 3.6rem; line-height: 1; animation: spinin 0.9s cubic-bezier(.3,1.5,.5,1) 0.3s both; }
.diploma .date { font-weight: 800; color: var(--ink-soft); }
@media print {
  .topbar, .no-print, #fx { display: none !important; }
  body { background: #fff; }
}

/* Medaljer i klistermärkesboken */
.medal-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.medal-row .slot { background: #FFF1C9; }
.medal-row .slot.missing { background: transparent; }

/* Världsflikar */
.worldtabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--card); border-radius: 18px; padding: 6px; box-shadow: 0 4px 0 var(--shadow); margin-block: 16px; }
.worldtabs button { border: 0; border-radius: 13px; padding: 10px 6px; background: transparent; font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--ink-soft); }
.worldtabs button[aria-pressed="true"] { background: var(--ink); color: var(--sun); }
#road .worldtabs { margin-top: 0; }

/* Dagens utmaning */
.daily { background: linear-gradient(135deg, var(--coral), var(--berry)); color: var(--card); display: grid; gap: 10px; }
.daily-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.daily .kicker { font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.78rem; opacity: 0.9; }
.daily h2 { font-size: clamp(1.6rem, 7vw, 2.1rem); font-weight: 800; }
.daily p { margin: 0; font-weight: 700; }
.daily .flame { background: rgba(0,0,0,0.22); border-radius: 999px; padding: 4px 12px; font-weight: 800; white-space: nowrap; }
.daily .chunky.coral { background: var(--sun); color: var(--ink); box-shadow: 0 5px 0 #D99A00; }
.daily.is-done { background: linear-gradient(135deg, var(--leaf), #138A52); }
.daily.is-done .chunky.coral { background: rgba(255,255,255,0.2); color: var(--card); box-shadow: 0 5px 0 rgba(0,0,0,0.2); }

/* Husdjuret */
.petpanel { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.petstage { width: 112px; height: 112px; border: 0; border-radius: 26px; background: radial-gradient(circle at 50% 85%, #E3DAFF 0 38%, var(--sky-2) 39%); display: grid; place-items: end center; padding: 0 0 12px; }
.petinfo { display: grid; gap: 6px; min-width: 0; }
.petinfo .label { margin: 0; }
.petinfo p { margin: 0; font-weight: 700; color: var(--ink-soft); }
.petinfo .meter { background: var(--sky-2); height: 12px; }
.petinfo .meter i { background: linear-gradient(90deg, var(--grape), var(--berry)); }
.petnext { font-weight: 700; color: var(--ink-soft); }
.petinfo .textbtn { justify-self: start; padding: 0; font-size: 0.9rem; }
.pet-name-input { font: inherit; font-family: var(--display); font-weight: 800; width: 8em; border: 3px solid var(--line); border-radius: 10px; padding: 0 6px; }
.pet { --s: 1; position: relative; width: calc(46px * var(--s)); height: calc(42px * var(--s)); border-radius: 50% 50% 42% 42%; background: var(--grape); box-shadow: inset -6px -6px 0 rgba(0,0,0,0.14); animation: petbob 2.4s ease-in-out infinite; }
.pet.stage-2 { --s: 1.2; } .pet.stage-3 { --s: 1.4; } .pet.stage-4 { --s: 1.55; } .pet.stage-5 { --s: 1.7; }
.pet i { position: absolute; display: block; }
.pet .belly { left: 22%; right: 22%; bottom: 8%; height: 40%; border-radius: 50%; background: #CBBDFF; }
.pet .eye { top: 26%; width: 18%; height: 22%; background: var(--card); border-radius: 50%; }
.pet .eye::after { content: ""; position: absolute; width: 50%; height: 55%; left: 30%; top: 30%; background: var(--ink); border-radius: 50%; }
.pet .e1 { left: 22%; } .pet .e2 { right: 22%; }
.pet .mouth { left: 40%; width: 20%; top: 54%; height: 12%; border-radius: 0 0 10px 10px; background: var(--ink); }
.pet .cheek { top: 48%; width: 14%; height: 9%; border-radius: 50%; background: #FF9EC0; }
.pet .c1 { left: 9%; } .pet .c2 { right: 9%; }
.pet .horn { top: -14%; width: 0; height: 0; border-left: calc(5px * var(--s)) solid transparent; border-right: calc(5px * var(--s)) solid transparent; border-bottom: calc(10px * var(--s)) solid var(--sun); }
.pet .h1 { left: 22%; } .pet .h2 { right: 22%; }
.pet .wing { top: 22%; width: 30%; height: 40%; background: #E3DAFF; border-radius: 50% 10% 50% 50%; z-index: -1; }
.pet .w1 { left: -18%; transform: rotate(-20deg); } .pet .w2 { right: -18%; transform: scaleX(-1) rotate(-20deg); }
.pet .crown { position: absolute; top: -48%; left: 50%; transform: translateX(-50%); font-size: calc(18px * var(--s)); line-height: 1; }
.pet.mood-hungry { filter: saturate(0.6); animation: petsad 3s ease-in-out infinite; }
.pet.mood-hungry .mouth { height: 5%; border-radius: 4px; top: 60%; }
.pet.mood-hungry .eye { height: 14%; top: 32%; }
.pet.egg { width: 50px; height: 62px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%; background: #FFF6E0; box-shadow: inset -6px -6px 0 rgba(0,0,0,0.08); animation: wobble 2.2s ease-in-out infinite; }
.pet.egg .spot { width: 12px; height: 10px; border-radius: 50%; background: var(--grape); opacity: 0.7; }
.pet.egg .s1 { left: 10px; top: 14px; } .pet.egg .s2 { right: 9px; top: 26px; width: 9px; height: 8px; } .pet.egg .s3 { left: 18px; bottom: 12px; width: 14px; }
.pet.jump { animation: petjump 0.6s ease; }
@keyframes petbob { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-4px) scaleY(1.03); } }
@keyframes petsad { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes wobble { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-9deg); } 86% { transform: rotate(8deg); } 94% { transform: rotate(-4deg); } }
@keyframes petjump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-26px) scale(1.08, 0.94); } 70% { transform: translateY(0) scale(1.1, 0.9); } }

/* Frisk-träningens rutnät */
.num .pre { font-size: 0.55em; margin-right: 1px; vertical-align: 0.3em; color: var(--ink-soft); }
.equation .word { font-family: var(--body); font-size: 0.42em; font-weight: 800; color: var(--ink-soft); align-self: center; }
.bead.gone { background: #E6EAF1; position: relative; }
.bead.gone::before, .bead.gone::after { content: ""; position: absolute; left: 15%; right: 15%; top: 50%; height: 3px; margin-top: -1.5px; background: #9AA4BB; border-radius: 2px; transform: rotate(45deg); }
.bead.gone::after { transform: rotate(-45deg); }

/* Kort på startsidan */
.cardrow { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.badge { justify-self: start; background: var(--berry); color: var(--card); border-radius: 999px; padding: 2px 10px; font-weight: 800; font-size: 0.9rem; animation: bump 0.6s ease 2; }

/* Val-chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 800; background: var(--sky-2); box-shadow: inset 0 -3px 0 var(--line); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sun); box-shadow: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 700; color: var(--ink-soft); }
.check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
.duel-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duel-names label { display: grid; gap: 6px; font-weight: 800; min-width: 0; }
@media (max-width: 420px) { .duel-names { grid-template-columns: 1fr; } }

/* Kompisduell */
.duel-mode .topbar { display: none; }
.duelplay { position: relative; display: grid; grid-template-rows: 1fr auto 1fr; gap: 8px; min-height: calc(100dvh - 24px); }
.half { background: var(--card); border-radius: 24px; padding: 12px; display: grid; align-content: center; gap: 10px; box-shadow: 0 5px 0 var(--shadow); transition: background 0.2s; }
#half1 { background: #FFF1EA; }
.duelplay.flip #half1 { transform: rotate(180deg); }
.half .dhead { display: flex; justify-content: space-between; align-items: center; font-family: var(--display); font-weight: 800; font-size: 1.3rem; }
.half .dscore { background: var(--ink); color: var(--sun); border-radius: 12px; min-width: 2em; text-align: center; padding: 0 8px; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.half .equation { font-size: clamp(2rem, 9vw, 3.2rem); margin: 0; }
.half .ans { min-height: 64px; font-size: 2.1rem; }
.half .dmsg { margin: 0; min-height: 1.4em; text-align: center; font-weight: 800; color: var(--ink-soft); }
.half.won { background: #D9F7E7 !important; }
.half.locked .ans { opacity: 0.4; }
.duel-mid { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; }
.duel-mid .chunky { padding: 6px 14px; font-size: 1rem; }
.duelwin { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(27, 37, 71, 0.55); border-radius: 24px; padding: 16px; z-index: 5; }
.duelwin .stage { display: grid; gap: 8px; justify-items: center; width: min(100%, 420px); }
.duelwin h2 { font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; color: var(--coral); }
.winscore { font-family: var(--display); font-weight: 800; font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.done-actions.two { grid-template-columns: 1fr 1fr; width: 100%; }
.done-actions.spaced { margin-top: 16px; }

/* Klassen: uppdrag och flöde */
.cheer-news { background: var(--berry); color: var(--card); font-weight: 800; border-radius: 16px; padding: 10px 14px; margin: 0 0 14px; animation: bump 0.6s ease 2; }
.mission { background: var(--grape); color: var(--card); }
.mission .label small, .mission .stats { color: #E6DFFF; }
.mission .meter { background: rgba(255,255,255,0.2); }
.mission .meter i { background: linear-gradient(90deg, var(--sun), #FFE58A); }
.mission-title { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.15; margin-bottom: 10px; }
.mission .stats { margin: 8px 0 0; }
.panel.mission + .panel, .panel + .panel.mission { margin-top: 16px; }
.feed { display: grid; gap: 8px; }
.event { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--sky-2); border-radius: 16px; padding: 8px 10px; }
.event.mine { background: #FFF1C9; }
.event .em { font-size: 1.8rem; }
.event p { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.event small { color: var(--ink-soft); font-weight: 700; }
.heja { border: 0; border-radius: 999px; padding: 6px 12px; font-weight: 800; background: var(--sun); box-shadow: inset 0 -3px 0 #D99A00; white-space: nowrap; }
.heja:disabled { background: transparent; box-shadow: none; cursor: default; }
.error.center { text-align: center; }

/* Välkomstskärmen */
.welcome { display: grid; gap: 16px; }
.welcome-hero { display: grid; justify-items: center; text-align: center; gap: 8px; padding-block: 12px 4px; }
.welcome-hero h1 { font-size: clamp(2rem, 8vw, 3rem); font-weight: 800; }
.welcome-hero p { margin: 0; font-weight: 700; color: var(--ink-soft); max-width: 30em; }
.welcome-class { background: var(--ink); color: var(--card); display: grid; gap: 10px; }
.welcome-class p { margin: 0; font-weight: 700; color: #DCE3F5; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); font-weight: 800; }
.or::before, .or::after { content: ""; flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.welcome .panel + .panel { margin-top: 0; }

/* Klassen överst på startsidan */
.classtop { background: var(--grape); color: var(--card); display: grid; gap: 10px; margin-bottom: 16px; }
.classtop.is-done { background: linear-gradient(135deg, var(--grape), var(--berry)); }
.ct-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.classtop .kicker { font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.78rem; color: #E6DFFF; }
.ct-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 6vw, 1.8rem); line-height: 1.1; }
.classtop .meter { background: rgba(255,255,255,0.2); }
.classtop .meter i { background: linear-gradient(90deg, var(--sun), #FFE58A); }
.ct-row { display: flex; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; font-weight: 700; color: #F1EDFF; }
.ct-row b { color: var(--card); }
.ct-event { margin: 0; background: rgba(255,255,255,0.14); border-radius: 12px; padding: 8px 10px; font-weight: 700; overflow-wrap: anywhere; }
.joincard { background: var(--ink); color: var(--card); display: grid; gap: 10px; margin-bottom: 16px; }
.joincard p { margin: 0; font-weight: 700; color: #DCE3F5; }
#classTop + .panel, #joinCard + .panel { margin-top: 0; }

/* Husdjurets önskan */
.wish { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; background: #FFF6DA; border-radius: 18px; padding: 10px 12px; }
.wish-icon { font-size: 2.4rem; line-height: 1; animation: wobble 2.6s ease-in-out infinite; }
.wish-body { display: grid; gap: 6px; min-width: 0; }
.wish-body b { font-weight: 800; line-height: 1.25; }
.wish-body .meter { background: var(--card); height: 10px; }
.wish-body .meter i { background: linear-gradient(90deg, var(--sun), var(--coral)); }
.wish-body small { font-weight: 800; color: var(--ink-soft); }
.wish .chunky { grid-column: 1 / -1; }

/* Installera som app */
.installcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; align-items: center; margin-top: 16px; }
.installcard p { margin: 2px 0 0; font-weight: 700; color: var(--ink-soft); }
.install-icon img { border-radius: 12px; display: block; }
.install-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Lärarens fokus och svaga pärlor */
.ct-focus { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: rgba(255,255,255,0.16); border-radius: 14px; padding: 8px 10px; font-weight: 800; }
.ct-focus .chunky { padding: 8px 14px; font-size: 1rem; }
.beads.faint .bead { opacity: 0.35; }
.beads.faint .bead.empty { border-style: dotted; }

/* Effects */
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
.cheer {
  position: fixed; left: 50%; top: 38%; z-index: 60; pointer-events: none;
  width: min(92vw, 720px); text-align: center; line-height: 1; text-wrap: balance;
  font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 13vw, 5rem); color: var(--sun);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink);
  animation: cheer 1.25s ease forwards;
}
.cheer.mega { color: var(--coral); font-size: clamp(3rem, 15vw, 6rem); }
@keyframes cheer {
  0% { transform: translate(-50%, -50%) scale(0.2) rotate(-12deg); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15) rotate(4deg); opacity: 1; }
  35% { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  75% { opacity: 1; }
  100% { transform: translate(-50%, -110%) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .cheer { animation: none; transform: translate(-50%, -50%); opacity: 1; }
}
