/* Kunskapsmolnet — lekfull, barnvänlig stil. Stora ytor, mjuka former, glada färger. */
:root {
  --bg: #eaf4ff;
  --ink: #2b3a55;
  --cloud: #ffffff;
  --brand: #4a7dff;
  --brand-dark: #2f5fe0;
  --green: #3cc168;
  --red: #ff6b6b;
  --yellow: #ffce45;
  --shadow: 0 8px 0 rgba(43, 58, 85, 0.12);
  --radius: 22px;
  font-size: 18px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, #fff8d6 0, transparent 38%),
    radial-gradient(circle at 88% 8%, #ffe1f0 0, transparent 34%),
    var(--bg);
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--cloud);
  box-shadow: 0 4px 0 rgba(43, 58, 85, 0.06); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand__cloud { font-size: 2rem; }
.brand__text { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.brand__text strong { color: var(--brand); }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.timer, .score {
  display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.1rem;
  padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow);
}
.timer { background: #e3edff; color: var(--brand-dark); }
.score { background: var(--yellow); color: #7a5b00; }
.score.pop { animation: pop 0.4s ease; }

/* Layout + views */
.layout { max-width: 940px; margin: 0 auto; padding: 24px 18px 70px; }
.view { animation: fade 0.3s ease; }
.hero__title { font-size: 2rem; text-align: center; margin: 18px 0 6px; }
.hero__sub { text-align: center; color: #5b6b89; margin: 0 0 26px; font-size: 1.1rem; }
.section__title { font-size: 1.6rem; margin: 6px 0 20px; }

/* Grids of cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.tile {
  border: none; cursor: pointer; text-align: left; background: var(--cloud);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex; flex-direction: column; gap: 8px; border-bottom: 6px solid var(--accent, var(--brand));
}
.tile:hover, .tile:focus-visible { transform: translateY(-4px); box-shadow: 0 12px 0 rgba(43,58,85,0.12); outline: none; }
.tile__emoji { font-size: 2.6rem; }
.tile__title { font-size: 1.3rem; font-weight: 800; margin: 0; }
.tile__desc { color: #5b6b89; font-size: 0.98rem; }

/* Buttons */
.btn { font-family: inherit; font-weight: 800; cursor: pointer; border: none; border-radius: 999px; padding: 12px 22px; font-size: 1.05rem; }
.btn--back { background: var(--cloud); color: var(--ink); box-shadow: var(--shadow); margin-bottom: 16px; }
.btn--back:hover { transform: translateY(-2px); }

/* Play view */
.card { background: var(--cloud); border-radius: var(--radius); box-shadow: var(--shadow); }
.play { padding: 26px; text-align: center; }
.play__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.play__title { font-size: 1.4rem; margin: 0; }
.play__progress { color: #5b6b89; font-weight: 700; }
.play__question { font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 800; margin: 24px 0; line-height: 1.3; min-height: 1.3em; }
.emoji-row { font-size: clamp(1.8rem, 7vw, 2.6rem); letter-spacing: 4px; }
.big-symbol { font-size: clamp(4rem, 18vw, 7rem); line-height: 1; margin-bottom: 8px; }
.big-word { font-size: clamp(2.4rem, 10vw, 4rem); letter-spacing: 8px; font-weight: 800; margin-top: 10px; }
.swatch { width: 120px; height: 120px; border-radius: 24px; margin: 0 auto 14px; box-shadow: var(--shadow); }
.clock-face { width: clamp(130px, 40vw, 190px); height: clamp(130px, 40vw, 190px); display: block; margin: 0 auto 14px; }

.answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; max-width: 480px; margin: 0 auto; }
.answers.big .answer { font-size: 2.4rem; }
.answer {
  font-family: inherit; font-weight: 800; font-size: 1.6rem; cursor: pointer; color: #fff;
  background: var(--brand); border: none; border-radius: 16px; padding: 18px;
  box-shadow: 0 5px 0 var(--brand-dark); transition: transform 0.1s ease;
}
.answer:hover:not(:disabled) { transform: translateY(-2px); }
.answer:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--brand-dark); }
.answer:disabled { cursor: default; opacity: 0.95; }
.answer.correct { background: var(--green); box-shadow: 0 5px 0 #2a9a4f; }
.answer.wrong { background: var(--red); box-shadow: 0 5px 0 #d94f4f; }

.play__feedback { font-size: 1.4rem; font-weight: 800; min-height: 1.6em; margin-top: 20px; }
.play__feedback.good { color: var(--green); }
.play__feedback.bad { color: var(--red); }

/* Memory game */
.memory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 460px; margin: 10px auto; }
.mcard {
  aspect-ratio: 1; border: none; border-radius: 16px; cursor: pointer; font-size: clamp(1.8rem, 9vw, 2.8rem);
  background: var(--brand); box-shadow: 0 5px 0 var(--brand-dark); color: transparent; transition: transform 0.15s;
}
.mcard.up { background: #fff; color: inherit; box-shadow: 0 5px 0 #d7e0f3; }
.mcard.done { background: #d7f5e1; color: inherit; box-shadow: 0 5px 0 #b6e8c9; cursor: default; }

.footer { text-align: center; color: #7084a6; padding: 20px; font-size: 0.95rem; }
.footer a { color: #7084a6; }

/* Reward overlay */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(20, 30, 50, 0.72); animation: fade 0.3s ease; padding: 20px;
}
.overlay__card { background: var(--cloud); border-radius: 26px; padding: 32px; max-width: 420px; text-align: center; box-shadow: var(--shadow); }
.overlay__emoji { font-size: 4rem; }
.overlay__title { font-size: 1.7rem; margin: 10px 0 6px; }
.overlay__text { color: #5b6b89; margin: 0 0 20px; }
.overlay .btn { background: var(--green); color: #fff; box-shadow: 0 5px 0 #2a9a4f; }
.overlay .btn.secondary { background: #e3edff; color: var(--brand-dark); box-shadow: 0 5px 0 #c7d6f3; margin-left: 8px; }

@keyframes pop { 0%{transform:scale(1)} 40%{transform:scale(1.25)} 100%{transform:scale(1)} }
@keyframes fade { from{opacity:0; transform: translateY(8px)} to{opacity:1; transform:none} }

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

/* Topplista nav pill */
.pill {
  display: flex; align-items: center; gap: 6px; font-family: inherit; font-weight: 800;
  font-size: 1rem; cursor: pointer; border: none; border-radius: 999px; padding: 8px 14px;
  background: var(--cloud); color: var(--brand-dark); box-shadow: var(--shadow);
}
.pill:hover { transform: translateY(-2px); }
@media (max-width: 560px) { .pill span { display: none; } }

/* Result screen */
.result { text-align: center; padding: 18px 6px; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.result__stars { font-size: 3rem; }
.result__score { font-size: 1.3rem; }
.result__save { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 420px; }
.result__save .input {
  flex: 1; min-width: 150px; font-family: inherit; font-size: 1.1rem; font-weight: 700;
  padding: 12px 16px; border: 3px solid #d7e3fb; border-radius: 999px; text-align: center; color: var(--ink);
}
.result__save .input:focus { outline: none; border-color: var(--brand); }
.result__actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn--soft { background: #e7eefb; color: var(--brand-dark); box-shadow: var(--shadow); }
.btn--soft:hover { transform: translateY(-2px); }
.saved { font-weight: 800; color: var(--green); font-size: 1.15rem; }

/* Leaderboard */
.scorebar { padding: 18px 18px 0; }
.select {
  font-family: inherit; font-weight: 700; font-size: 1rem; width: 100%; padding: 12px 16px;
  border: 3px solid #d7e3fb; border-radius: 16px; background: #fff; color: var(--ink);
}
.leaderboard { padding: 14px 18px 22px; display: flex; flex-direction: column; gap: 8px; }
.lb__row {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 14px; background: #f3f7ff; font-weight: 700;
}
.lb__row.is-me { background: #fff3cf; box-shadow: inset 0 0 0 2px var(--yellow); }
.lb__pos { font-size: 1.4rem; text-align: center; }
.lb__rank { font-size: 1rem; color: #8595ad; font-weight: 800; }
.lb__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb__ex { display: block; font-size: 0.78rem; color: #8595ad; font-weight: 600; }
.lb__pts { color: var(--brand-dark); font-weight: 900; }
.lb__rt { color: #5b6b89; font-size: 0.9rem; }
.muted { color: #8595ad; text-align: center; padding: 24px; font-weight: 700; }
