/* ====== TYPSNITT (lokalt – inga externa anrop) ====== */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/fredoka-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/fredoka-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ====== FÄRGER & MÅTT ====== */
:root {
  /* Palett */
  --sun: #FFD166;
  --sun-deep: #F7B733;
  --sun-soft: #FFE9A8;
  --coral: #EF476F;
  --coral-soft: #FFB7C5;
  --mint: #06D6A0;
  --mint-deep: #04B488;
  --mint-soft: #BFF3E0;
  --sky: #118AB2;
  --sky-soft: #B5DEFF;
  --grape: #8E7DBE;
  --cream: #FFF8E7;
  --ink: #2D3047;
  --ink-soft: rgba(45, 48, 71, 0.68);
  --surface: #FFFFFF;

  /* Roller */
  --bg: var(--cream);
  --bar: var(--sun);
  --good: var(--mint);
  --good-deep: var(--mint-deep);
  --bad: var(--coral);
  --link: var(--sky);

  --shadow: 0 6px 0 rgba(45, 48, 71, 0.14), 0 12px 26px rgba(45, 48, 71, 0.12);
  --shadow-pressed: 0 2px 0 rgba(45, 48, 71, 0.14), 0 4px 10px rgba(45, 48, 71, 0.10);
  --radius: 28px;
  --radius-sm: 18px;
  --tap: 56px; /* minsta tryckyta för små fingrar */
  --gap: clamp(12px, 3vw, 22px);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: "Fredoka", "Baloo 2", "Comic Sans MS", "Chalkboard SE", system-ui, -apple-system, sans-serif;

  /* Säkra ytor (notch/hemindikator). Capacitor kan sätta --safe-area-inset-* själv. */
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
}

/* ====== GRUND ====== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

html {
  height: 100%;
  overscroll-behavior: none; /* ingen gummibands-studs i iOS */
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--ink);
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none; /* ingen dra-för-att-uppdatera mitt i leken */
  background:
    radial-gradient(1200px 600px at 110% -10%, #FFE9B0 0%, transparent 55%),
    radial-gradient(1000px 500px at -10% 110%, #BFEFE0 0%, transparent 55%),
    linear-gradient(160deg, #FFFDF6 0%, var(--cream) 60%, #FFF1D6 100%);
}

button,
select {
  font-family: var(--font);
  color: var(--ink);
}

button {
  touch-action: manipulation;
  cursor: pointer;
}

:focus-visible {
  outline: 4px solid var(--sky);
  outline-offset: 3px;
}

/* Mjuka svävande dekor-bubblor i bakgrunden */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  opacity: 0.32;
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

body::before {
  width: 220px;
  height: 220px;
  top: 18%;
  left: -70px;
  background: radial-gradient(circle at 30% 30%, #A8E6CF, var(--mint));
  animation: float 12s ease-in-out infinite;
}

body::after {
  width: 180px;
  height: 180px;
  bottom: 12%;
  right: -60px;
  background: radial-gradient(circle at 30% 30%, var(--coral-soft), var(--coral));
  animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(14px, -26px); }
}

/* ====== TOPPLIST ====== */
#top-bar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: var(--tap) minmax(0, 1fr) var(--tap);
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--sat)) calc(12px + var(--sar)) 12px calc(12px + var(--sal));
  background: linear-gradient(180deg, #FFDD82 0%, var(--bar) 100%);
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
  box-shadow: 0 6px 18px rgba(45, 48, 71, 0.14);
  z-index: 10;
}

.bar-slot {
  display: flex;
  width: var(--tap);
  height: var(--tap);
}

.bar-slot [hidden] {
  display: none;
}

.bar-left [hidden] {
  display: block;
  visibility: hidden;
}

#screen-title {
  margin: 0;
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.45);
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  font-size: 26px;
  line-height: 1;
  box-shadow: var(--shadow);
}

/* ====== GEMENSAM TRYCKKÄNSLA ====== */
.icon-btn,
.age-card,
.category-card,
.item-card,
.quiz-card,
.word-toggle,
.replay-btn,
.test-btn,
.primary-btn,
.lang-btn {
  touch-action: manipulation;
  transition: transform 0.18s var(--bounce), box-shadow 0.15s ease, background-color 0.2s;
}

.icon-btn:active,
.age-card:active,
.category-card:active,
.item-card:active,
.quiz-card:active,
.replay-btn:active,
.test-btn:active,
.primary-btn:active {
  transform: translateY(4px) scale(0.96);
  box-shadow: var(--shadow-pressed);
  transition-duration: 0.06s;
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover,
  .replay-btn:hover { transform: translateY(-2px); }
  .age-card:hover,
  .category-card:hover,
  .item-card:hover,
  .quiz-card:hover { transform: translateY(-4px); }
}

/* ====== LAYOUT ====== */
#app {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px calc(14px + var(--sar)) calc(28px + var(--sab)) calc(14px + var(--sal));
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.big-heading {
  font-size: clamp(26px, 6vw, 42px);
  font-weight: 600;
  margin: 6px 0 24px;
  text-align: center;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}

/* Insvävning med liten fördröjning per kort.
   "backwards" (inte "both") så att :active-transform fungerar efter animationen. */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.age-card,
.category-card,
.item-tile,
.quiz-card {
  animation: cardIn 0.42s var(--bounce) backwards;
}

.age-card:nth-child(2),
.category-card:nth-child(2),
.item-tile:nth-child(2),
.quiz-card:nth-child(2) { animation-delay: 0.05s; }
.age-card:nth-child(3),
.category-card:nth-child(3),
.item-tile:nth-child(3),
.quiz-card:nth-child(3) { animation-delay: 0.1s; }
.category-card:nth-child(4),
.item-tile:nth-child(4),
.quiz-card:nth-child(4) { animation-delay: 0.15s; }
.category-card:nth-child(5),
.item-tile:nth-child(5) { animation-delay: 0.2s; }
.category-card:nth-child(6),
.item-tile:nth-child(6) { animation-delay: 0.25s; }
.item-tile:nth-child(n+7) { animation-delay: 0.3s; }

/* Glansig topp på korten */
.age-card::before,
.category-card::before,
.item-card::before,
.quiz-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 45%);
  pointer-events: none;
}

/* ====== ÅLDERSVAL ====== */
.age-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: 900px;
}

.age-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 16px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-height: clamp(150px, 30vh, 220px);
  overflow: hidden;
}

.age-card:nth-child(1) { background: linear-gradient(160deg, #FFEFC2, #FFD970); }
.age-card:nth-child(2) { background: linear-gradient(160deg, #C5F1DE, #8CE0BE); }
.age-card:nth-child(3) { background: linear-gradient(160deg, #FFD0DA, #FFA9B8); }

.age-emoji {
  font-size: clamp(56px, 16vw, 80px);
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(45, 48, 71, 0.18));
}

.age-label {
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 700;
}

.age-sub {
  font-size: 18px;
  color: var(--ink-soft);
}

/* ====== KATEGORIER ====== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: 1100px;
}

.category-card {
  --cat: var(--sun-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 22px 10px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  background: var(--cat);
  background: linear-gradient(160deg, color-mix(in srgb, var(--cat) 45%, white), var(--cat));
  box-shadow: var(--shadow);
  min-height: clamp(140px, 24vh, 190px);
  overflow: hidden;
}

.category-emoji {
  font-size: clamp(52px, 13vw, 68px);
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(45, 48, 71, 0.18));
}

.category-label {
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 700;
}

/* ====== ORD-KORT (djur, mat etc) ====== */
.items-screen,
.quiz-screen {
  --cat: var(--sun-soft);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(132px, 100%), 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: 1100px;
}

/* Större kort för 1–2-åringar */
.items-screen[data-age="1-2"] .items-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
}

@media (min-width: 700px) {
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .items-screen[data-age="1-2"] .items-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

.item-tile {
  position: relative;
  display: flex;
}

.item-card {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: var(--surface);
  background: linear-gradient(165deg, #FFFFFF 35%, color-mix(in srgb, var(--cat) 40%, white));
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: clamp(140px, 22vh, 180px);
  overflow: hidden;
}

.items-screen[data-age="1-2"] .item-card {
  min-height: clamp(160px, 28vh, 240px);
}

.item-emoji {
  font-size: clamp(64px, 18vw, 96px);
  line-height: 1;
  display: inline-block;
  transition: transform 0.4s, font-size 0.3s, opacity 0.3s;
  filter: drop-shadow(0 5px 8px rgba(45, 48, 71, 0.18));
}

.items-screen[data-age="1-2"] .item-emoji {
  font-size: clamp(80px, 22vw, 130px);
}

.item-card.tapped .item-emoji {
  animation: wiggle 0.6s ease-in-out;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-12deg) scale(1.18); }
  40% { transform: rotate(12deg) scale(1.18); }
  60% { transform: rotate(-8deg) scale(1.1); }
  80% { transform: rotate(8deg) scale(1.1); }
}

.item-card.idle .item-emoji {
  animation: gentleBounce 2.6s ease-in-out infinite;
}

/* Lite förskjutning så att korten inte studsar i takt */
.item-tile:nth-child(2n) .item-card.idle .item-emoji { animation-delay: -0.8s; }
.item-tile:nth-child(3n) .item-card.idle .item-emoji { animation-delay: -1.6s; }

@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.item-label {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  opacity: 0;
  max-height: 0;
  transition: opacity 0.3s, max-height 0.3s;
}

.item-card.show-word .item-label {
  opacity: 1;
  max-height: 52px;
  font-size: clamp(24px, 7vw, 36px);
}

.item-card.show-word .item-emoji {
  font-size: clamp(44px, 12vw, 60px);
  opacity: 0.4;
}

.items-screen[data-age="1-2"] .item-card.show-word .item-emoji {
  font-size: 80px;
}

.word-toggle {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: var(--tap);
  height: var(--tap);
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--sun);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(45, 48, 71, 0.18);
  z-index: 2;
}

.word-toggle[aria-pressed="true"] {
  background: var(--mint);
  color: var(--surface);
}

.word-toggle:active {
  transform: translateY(2px) scale(0.92);
  box-shadow: 0 1px 0 rgba(45, 48, 71, 0.18);
}

/* ====== QUIZ ====== */
.quiz-streak {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: clamp(20px, 5vw, 26px);
  min-height: 36px;
  margin-bottom: 2px;
}

.streak-star {
  display: inline-block;
}

.streak-star.new {
  animation: starPop 0.5s var(--bounce);
}

.streak-more {
  margin-left: 6px;
  font-weight: 700;
  color: var(--sun-deep);
}

@keyframes starPop {
  0% { transform: scale(0) rotate(-90deg); }
  100% { transform: scale(1) rotate(0); }
}

.quiz-question-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 16px;
  max-width: 100%;
}

.quiz-question-row .big-heading {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.replay-btn {
  flex-shrink: 0;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(160deg, #FFE69A, var(--sun));
  font-size: 26px;
  box-shadow: var(--shadow);
}

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  width: 100%;
  max-width: 640px;
}

.quiz-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 0.85;
  min-height: 120px;
  padding: 0;
  background: var(--surface);
  background: linear-gradient(165deg, #FFFFFF 35%, color-mix(in srgb, var(--cat) 35%, white));
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: clamp(60px, 18vw, 100px);
  line-height: 1;
  overflow: hidden;
}

.quiz-card.correct {
  background: linear-gradient(160deg, #2BE3AE, var(--good));
  border-color: #E6FFF6;
  animation: pop 0.5s var(--bounce);
  z-index: 1;
}

.quiz-card.wrong {
  background: linear-gradient(160deg, #FF6B8B, var(--bad));
  animation: shake 0.4s;
}

/* Redan testat fel kort: tonas ner så barnet ser vad som är kvar */
.quiz-card.tried:not(.wrong) {
  opacity: 0.45;
  filter: grayscale(0.6);
  box-shadow: var(--shadow-pressed);
}

.quiz-grid.solved .quiz-card:not(.correct) {
  opacity: 0.4;
  transform: scale(0.94);
}

@keyframes pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.14) rotate(-3deg); }
  70% { transform: scale(0.98) rotate(2deg); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

.quiz-feedback {
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  text-align: center;
  min-height: 48px;
  margin-top: 14px;
}

.quiz-feedback.show {
  animation: feedbackIn 0.4s var(--bounce);
}

.quiz-feedback.good { color: var(--good-deep); }
.quiz-feedback.bad { color: var(--bad); }

@keyframes feedbackIn {
  from { opacity: 0; transform: translateY(8px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ====== KONFETTI ====== */
#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 90;
}

.confetti-piece {
  position: absolute;
  top: -40px;
  font-size: 26px;
  will-change: transform, opacity;
  animation: confettiFall 1.3s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

/* ====== INSTÄLLNINGAR ====== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(45, 48, 71, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(16px + var(--sab)) calc(16px + var(--sal));
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: fadeIn 0.2s;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 26px 22px;
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  overflow-y: auto;
  margin: auto;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: cardIn 0.3s ease-out backwards;
}

.modal-card h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  text-align: center;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-label {
  font-size: 20px;
  font-weight: 700;
}

.lang-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lang-btn {
  min-height: var(--tap);
  padding: 12px 8px;
  border: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-size: clamp(16px, 4.5vw, 20px);
}

.lang-btn:active {
  transform: scale(0.96);
}

.lang-btn.active {
  background: var(--sun);
  border-color: var(--ink);
}

.voice-row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.voice-row .settings-label {
  width: 100%;
}

.settings-select {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
}

.test-btn {
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(160deg, #2BE3AE, var(--good));
  font-size: 26px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.primary-btn {
  min-height: var(--tap);
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(160deg, #2BE3AE, var(--good-deep));
  color: var(--surface);
  font-size: 24px;
  font-weight: 700;
  box-shadow: var(--shadow);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

.link-btn {
  min-height: 44px;
  background: none;
  border: none;
  color: var(--link);
  font-size: 16px;
  padding: 4px;
  text-align: center;
  text-decoration: underline;
}

#about-section {
  font-size: 14px;
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

#about-section,
#about-section * {
  user-select: text;
  -webkit-user-select: text;
}

#about-section h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

#about-section p {
  margin: 6px 0;
}

#about-section details {
  margin: 8px 0;
}

#about-section summary {
  cursor: pointer;
  font-weight: 700;
  padding: 8px 0;
}

#about-section ul {
  padding-left: 20px;
  margin: 6px 0;
}

#about-section li {
  margin: 4px 0;
}

#about-section a {
  color: var(--link);
}

.about-repo {
  text-align: center;
  margin-top: 12px !important;
}

/* ====== LIGGANDE MOBIL (låg höjd) ====== */
@media (orientation: landscape) and (max-height: 520px) {
  #top-bar {
    padding-top: calc(6px + var(--sat));
    padding-bottom: 6px;
  }
  #screen-title { font-size: 22px; }
  #app { padding-top: 12px; }
  .big-heading { font-size: 24px; margin: 0 0 12px; }

  .age-grid { grid-template-columns: repeat(3, 1fr); }
  .age-card { min-height: 0; padding: 14px 10px; }
  .age-emoji { font-size: 52px; }
  .age-label { font-size: 24px; }
  .age-sub { font-size: 15px; }

  .category-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .category-card { min-height: 112px; padding: 12px 8px; }
  .category-emoji { font-size: 44px; }
  .category-label { font-size: 19px; }

  .items-grid,
  .items-screen[data-age="1-2"] .items-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .item-card,
  .items-screen[data-age="1-2"] .item-card { min-height: 120px; padding: 12px 8px; }
  .item-emoji,
  .items-screen[data-age="1-2"] .item-emoji { font-size: 64px; }

  .quiz-streak { min-height: 28px; font-size: 20px; }
  .quiz-question-row { margin: 0 0 10px; }
  .quiz-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 820px; }
  .quiz-card { aspect-ratio: 1 / 1; min-height: 0; font-size: clamp(48px, 9vw, 80px); }
  .quiz-feedback { margin-top: 8px; min-height: 36px; font-size: 24px; }
}

/* ====== SURFPLATTA ====== */
@media (min-width: 900px) and (min-height: 600px) {
  #app { padding-top: 32px; }
  .quiz-grid { max-width: 720px; }
}

/* Liggande surfplatta: fyra svarskort på rad så allt syns utan att scrolla */
@media (orientation: landscape) and (min-height: 521px) and (min-width: 900px) {
  .quiz-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 1000px; }
  .quiz-card { aspect-ratio: 1 / 1; }
}

/* ====== TILLGÄNGLIGHET: minska rörelse ====== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05ms !important;
    scroll-behavior: auto !important;
  }
  body::before,
  body::after,
  .item-card.idle .item-emoji,
  .item-card.tapped .item-emoji { animation: none !important; }
}
