/* =========================================================
   Okoska Játszótér – stílusok
   ========================================================= */
:root {
  --ink: #2b2d42;
  --muted: #6b6f80;
  --card: #ffffff;
  --line: #ebe6f3;
  --good: #2db86a;
  --good-d: #1e8a4d;
  --bad: #ef476f;
  --gold: #ffc533;

  --matek: #ff8a3d;      --matek-d: #d9661c;      --matek-l: #fff0e5;
  --betuk: #9b5de5;      --betuk-d: #7437c0;      --betuk-l: #f3eafd;
  --angol: #3a86ff;      --angol-d: #1f62d1;      --angol-l: #e7f0ff;
  --termeszet: #2db86a;  --termeszet-d: #1e8a4d;  --termeszet-l: #e3f7ec;

  --c: #ff8a3d; --cd: #d9661c; --cl: #fff0e5;
  --radius: 26px;
}
.theme-matek     { --c: var(--matek);     --cd: var(--matek-d);     --cl: var(--matek-l); }
.theme-betuk     { --c: var(--betuk);     --cd: var(--betuk-d);     --cl: var(--betuk-l); }
.theme-angol     { --c: var(--angol);     --cd: var(--angol-d);     --cl: var(--angol-l); }
.theme-termeszet { --c: var(--termeszet); --cd: var(--termeszet-d); --cl: var(--termeszet-l); }
.theme-olvasas   { --c: #e8508f; --cd: #bf2f6b; --cl: #fde8f1; }
.theme-szamok    { --c: #12a4a4; --cd: #0b7c7c; --cl: #e0f6f6; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  background-color: #fef6e4;
  background-image:
    radial-gradient(circle at 8% 12%, #ffe1c7 0 120px, transparent 121px),
    radial-gradient(circle at 92% 30%, #e5dcff 0 150px, transparent 151px),
    radial-gradient(circle at 15% 85%, #d6f5e3 0 130px, transparent 131px),
    radial-gradient(circle at 85% 92%, #dbe9ff 0 110px, transparent 111px);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2 { font-weight: 900; line-height: 1.15; margin: 0; }
:focus-visible { outline: 4px solid #ffd23f; outline-offset: 3px; }

/* ---------- Elrendezés: bal oldali menü + jobb oldali tartalom ---------- */
.layout { display: flex; min-height: 100vh; }
.content { flex: 1; min-width: 0; }

.sidebar {
  width: 280px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--card); padding: 18px 14px 24px;
  box-shadow: 6px 0 0 var(--line);
  z-index: 40;
}
.sidebar .brand { padding: 4px 10px 16px; border-bottom: 3px dashed var(--line); margin-bottom: 10px; line-height: 1.05; }
.sidebar .brand small { font-size: .95rem; color: var(--muted); font-weight: 800; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(43, 45, 66, .4); z-index: 35; }

.menu-home, .menu-head, .menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 16px; font-weight: 800;
  transition: background .15s, transform .1s;
}
.menu-home:hover, .menu-head:hover { background: #f4f1f9; }
.menu-home.active, .menu-head.active { background: var(--ink); color: #fff; }
.menu-section { margin-top: 14px; }
.menu-head { font-weight: 900; font-size: 1.12rem; }
.menu-section.open > .menu-head:not(.active) { color: var(--ink); background: #f4f1f9; }
.menu-section ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 10px; display: grid; gap: 6px; }
.menu-item { border-left: 6px solid var(--c); background: #fff; }
.menu-item:hover { background: var(--cl); transform: translateX(3px); }
.menu-item.active { background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--cd); }
.mi-icon { width: 30px; text-align: center; font-size: 1.35rem; flex-shrink: 0; }
.mi-title { flex: 1; line-height: 1.2; }
.mi-badge {
  font-size: .8rem; font-weight: 900; white-space: nowrap;
  background: var(--cl, #f4f1f9); color: var(--cd, var(--muted)); padding: 2px 8px; border-radius: 999px;
}
.menu-item.active .mi-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.menu-soon { margin: 18px 12px 0; color: var(--muted); font-size: .95rem; }

/* Összecsukható csoportok */
.menu-section { margin-top: 8px; }
.menu-head-row { display: flex; align-items: center; gap: 4px; }
.menu-head-row .menu-head { flex: 1; }
.mi-count {
  font-size: .8rem; font-weight: 900; color: var(--muted);
  background: #f4f1f9; border-radius: 999px; padding: 2px 9px;
}
.menu-head.active .mi-count { background: rgba(255, 255, 255, .2); color: inherit; }
.menu-toggle {
  width: 36px; height: 36px; flex-shrink: 0; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 1rem; transition: transform .2s, background .15s;
}
.menu-toggle:hover { background: #f4f1f9; color: var(--ink); }
.menu-section.open .menu-toggle { transform: rotate(90deg); }
.menu-section ul { animation: menuIn .2s ease-out; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } }
/* Egysoros, tömör menüpontok (a hosszú név végére … kerül, a teljes név a title-ben) */
.menu-item { padding: 6px 10px; border-left-width: 5px; font-size: .95rem; }
.menu-item .mi-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Hosszú lista + függőleges görgetősáv mellett se csússzon ki semmi oldalra */
.sidebar { overflow-x: hidden; }
.menu-section li { min-width: 0; }
.menu-item .mi-icon { font-size: 1.15rem; width: 26px; }
.menu-section ul { gap: 4px; }
.sidebar .brand { padding-bottom: 12px; margin-bottom: 6px; }

/* Alsó gombsor: matricák, szülők, gyerekváltás */
.menu-footer { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mf-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 14px; text-align: center; transition: background .15s;
}
.mf-btn:hover { background: #f4f1f9; }
.mf-btn.active { background: var(--ink); color: #fff; }
.mf-icon { font-size: 1.5rem; line-height: 1.1; }
.mf-btn small { font-size: .72rem; font-weight: 800; line-height: 1.1; }
.mf-badge {
  position: absolute; top: 2px; right: 8px; min-width: 20px; padding: 1px 5px; border-radius: 999px;
  background: var(--gold); color: var(--ink); font-size: .7rem; font-weight: 900;
}
[data-theme="dark"] .mi-count, [data-theme="dark"] .menu-toggle:hover, [data-theme="dark"] .mf-btn:hover { background: #34314d; }
[data-theme="dark"] .mf-btn.active { background: #e9e6f7; color: #1b1a2b; }

/* ---------- Felső sáv (a tartalom fölött) ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  max-width: 1000px; margin: 0 auto; padding: 14px 24px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.35rem; }
.brand-owl { font-size: 2rem; }
.brand-mobile, .menu-btn { display: none; }
.crumb { flex: 1; margin: 0; color: var(--muted); font-weight: 800; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.star-total {
  background: var(--card); border-radius: 999px; padding: 6px 14px;
  font-weight: 900; font-size: 1.1rem; box-shadow: 0 4px 0 var(--line);
}
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--card); font-size: 1.3rem; box-shadow: 0 4px 0 var(--line);
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }

main { max-width: 1000px; margin: 0 auto; padding: 4px 24px 48px; }
.section-page .section-title { margin-top: 6px; }

/* Keskenyebb képernyőn a menü egy kicsúszó fiók */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: auto;
    transform: translateX(-105%); transition: transform .25s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, .15);
  }
  body.menu-open .sidebar { transform: none; }
  body.menu-open { overflow: hidden; }
  .menu-btn { display: inline-grid; place-items: center; }
  .brand-mobile { display: flex; font-size: 1.2rem; }
  .brand-mobile .brand-owl { font-size: 1.7rem; }
  .crumb { display: none; }
  .topbar { padding: 12px 16px; }
  main { padding: 4px 16px 48px; }
}

/* ---------- Kezdőlap ---------- */
.hero {
  display: flex; align-items: center; gap: 20px;
  background: var(--card); border-radius: var(--radius); padding: 22px 26px;
  box-shadow: 0 8px 0 var(--line); margin-bottom: 26px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
.hero p { margin: 6px 0 0; color: var(--muted); font-size: 1.15rem; }
.hero-owl { font-size: 4.5rem; animation: bob 2.6s ease-in-out infinite; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.topic-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--c); color: #fff; border-radius: var(--radius); padding: 22px;
  box-shadow: 0 8px 0 var(--cd); transition: transform .12s, box-shadow .12s;
  position: relative; overflow: hidden;
}
.topic-card::after {
  content: ''; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px;
  border-radius: 50%; background: rgba(255,255,255,.14);
}
.topic-card:hover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 12px 0 var(--cd); }
.topic-card:active { transform: translateY(5px); box-shadow: 0 3px 0 var(--cd); }
.topic-icon { font-size: 3.4rem; line-height: 1; }
.topic-title { font-size: 1.55rem; font-weight: 900; margin-top: 6px; }
.topic-desc { opacity: .92; font-size: 1.02rem; }
.topic-progress { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; }
.bar { flex: 1; height: 12px; border-radius: 999px; background: rgba(0,0,0,.18); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.topic-stars { font-weight: 900; white-space: nowrap; }

/* ---------- Szintválasztó ---------- */
.back-btn {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 900;
  background: var(--card); padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 0 var(--line);
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.levels-head { display: flex; align-items: center; gap: 16px; margin: 20px 0; }
.levels-icon {
  font-size: 3rem; width: 84px; height: 84px; display: grid; place-items: center;
  background: var(--c); border-radius: 24px; box-shadow: 0 6px 0 var(--cd);
}
.levels-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.levels-head p { margin: 4px 0 0; color: var(--muted); font-size: 1.1rem; }
.level-list { display: grid; gap: 14px; }
.level-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: 22px; padding: 16px 20px;
  border: 3px solid var(--cl); box-shadow: 0 6px 0 var(--cl);
  transition: transform .12s;
}
.level-card:not(.disabled):hover { transform: translateX(6px); border-color: var(--c); }
.level-card.disabled { opacity: .55; }
.level-emoji {
  font-size: 2.2rem; width: 62px; height: 62px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--cl); border-radius: 18px;
}
.level-text { flex: 1; display: flex; flex-direction: column; }
.level-text strong { font-size: 1.3rem; font-weight: 900; }
.level-text small { color: var(--muted); font-size: 1rem; }
.stars { white-space: nowrap; font-size: 1.6rem; letter-spacing: 2px; }
.star { color: #e3dfea; }
.star.on { color: var(--gold); text-shadow: 0 2px 0 #e0a100; }

/* ---------- Kvíz ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.quiz-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.progress { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #e3dfea; transition: transform .2s; }
.dot.done { background: var(--c); }
.dot.now { background: var(--gold); transform: scale(1.35); }
.score { font-weight: 900; background: var(--card); padding: 8px 14px; border-radius: 999px; box-shadow: 0 4px 0 var(--line); }

.card {
  background: var(--card); border-radius: var(--radius); padding: 24px;
  box-shadow: 0 8px 0 var(--line); border-top: 10px solid var(--c);
}
.q-card { text-align: center; animation: pop .35s ease-out; }
.q-count { margin: 0 0 4px; color: var(--muted); font-size: .95rem; }
.q-title { font-size: clamp(1.4rem, 4vw, 1.9rem); }
.q-visual { margin: 18px 0 10px; }
.q-hint { color: var(--muted); margin: 6px 0 0; }

.big-emoji { font-size: clamp(4.5rem, 16vw, 6.5rem); line-height: 1.1; }
.hu-word { font-size: 1.4rem; font-weight: 900; color: var(--cd); margin: 4px 0 0; }
.color-blob {
  display: inline-block; width: 1em; height: 1em; border-radius: 50%;
  border: 4px solid #ddd6e8; vertical-align: middle;
}
.num-big { display: inline-block; font-weight: 900; color: var(--c); font-size: .95em; }

.sum-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; }
.sum-row > b { font-size: 2.4rem; color: var(--c); }
.emoji-group {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 260px;
  background: var(--cl); padding: 10px 12px; border-radius: 18px; font-size: 2rem;
}
.emoji-group .gone { opacity: .22; filter: grayscale(1); }
.equation { font-size: clamp(2.2rem, 8vw, 3.2rem); font-weight: 900; margin-top: 14px; letter-spacing: 1px; }
.blank, .tile.blank {
  display: inline-block; min-width: 1.4em; padding: 0 .2em; border-radius: 14px;
  background: #fff6d6; color: #d99a00; border: 3px dashed var(--gold);
}

.letters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tile {
  min-width: 58px; height: 64px; padding: 0 8px; display: grid; place-items: center;
  font-size: 2.1rem; font-weight: 900; border-radius: 16px;
  background: var(--cl); color: var(--cd); box-shadow: 0 4px 0 var(--line);
}

.speak-btn {
  margin: 4px 0 6px; border: 0; cursor: pointer; padding: 10px 20px; border-radius: 999px;
  background: var(--cl); color: var(--cd); font-weight: 900; font-size: 1.1rem;
  box-shadow: 0 4px 0 var(--line);
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.opt {
  position: relative; min-height: 84px; padding: 12px 16px; cursor: pointer;
  background: var(--card); border: 3px solid var(--line); border-radius: 20px;
  box-shadow: 0 6px 0 var(--line); font-size: 2rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  transition: transform .08s, background .15s, border-color .15s;
}
.opt:hover:not(:disabled) { border-color: var(--c); }
.opt:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.opt .key {
  position: absolute; top: 6px; left: 10px; font-size: .8rem; color: #b9b3c6;
}
.word-opts .opt { font-size: 1.35rem; }
.emoji-opts .opt { font-size: 3rem; min-height: 100px; }
.opt.correct {
  background: var(--good); border-color: var(--good-d); color: #fff;
  box-shadow: 0 6px 0 var(--good-d); animation: pop .35s;
}
.opt.correct .key { color: rgba(255,255,255,.7); }
.opt.wrong { background: #ffe3ea; border-color: var(--bad); color: var(--bad); animation: shake .4s; opacity: .7; cursor: default; }
.opt.dim { opacity: .45; }
.opt:disabled { cursor: default; }

.mascot-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.mascot { font-size: 3.4rem; display: inline-block; }
.mascot.happy { animation: jump .6s ease-out; }
.mascot.think { animation: tilt .5s ease-in-out; }
.bubble {
  position: relative; margin: 0; background: var(--card); padding: 12px 18px; border-radius: 20px;
  font-weight: 800; font-size: 1.15rem; box-shadow: 0 4px 0 var(--line);
}
.bubble::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  border: 10px solid transparent; border-right-color: var(--card); border-left: 0;
}

/* ---------- Eredmény ---------- */
.result { max-width: 620px; margin: 30px auto 0; }
.result-card { text-align: center; padding: 34px 24px; animation: pop .4s ease-out; }
.result-owl { font-size: 5rem; animation: jump 1s ease-out 2; }
.result-card h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-top: 8px; }
.result-stars .stars { font-size: 4rem; letter-spacing: 8px; }
.result-stars .star.on { animation: starIn .5s ease-out backwards; }
.result-stars .star:nth-child(2) { animation-delay: .25s; }
.result-stars .star:nth-child(3) { animation-delay: .5s; }
.result-score { font-size: 1.2rem; color: var(--muted); }
.new-record { font-weight: 900; color: var(--cd); font-size: 1.2rem; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 20px; }
.btn {
  display: inline-block; cursor: pointer; border: 0; padding: 14px 22px; border-radius: 18px;
  background: var(--c); color: #fff; font-weight: 900; font-size: 1.15rem;
  box-shadow: 0 6px 0 var(--cd); transition: transform .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--cd); }
.btn-alt { background: var(--gold); color: var(--ink); box-shadow: 0 6px 0 #e0a100; }
.btn-alt:active { box-shadow: 0 2px 0 #e0a100; }
.btn-ghost { background: var(--card); color: var(--ink); border: 3px solid var(--line); box-shadow: 0 6px 0 var(--line); }
.btn-ghost:active { box-shadow: 0 2px 0 var(--line); }

/* ---------- Konfetti ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
#confetti i {
  position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px;
  animation: fall linear forwards;
}

/* ---------- Animációk ---------- */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.92); opacity: .4; } 70% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes jump { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(-22px) scale(1.12); } }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg); } 70% { transform: rotate(10deg); } }
@keyframes starIn { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1); } }
@keyframes fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Kis képernyő ---------- */
@media (max-width: 560px) {
  .brand span:last-child { font-size: 1.1rem; }
  .hero { flex-direction: column; text-align: center; padding: 20px 18px; }
  .hero-owl { font-size: 3.6rem; }
  .card { padding: 18px 14px; }
  .options { gap: 10px; }
  .opt { min-height: 72px; font-size: 1.7rem; }
  .word-opts .opt { font-size: 1.1rem; padding: 12px 8px; }
  .emoji-opts .opt { font-size: 2.5rem; }
  .tile { min-width: 46px; height: 54px; font-size: 1.7rem; }
  .emoji-group { font-size: 1.6rem; max-width: 200px; }
  .quiz-head .back-btn { padding: 8px 12px; }
  .level-card { padding: 12px 14px; gap: 12px; }
  .level-emoji { width: 52px; height: 52px; font-size: 1.8rem; }
  .stars { font-size: 1.3rem; }
}

/* Telefonon a felső sávba férjen be minden gomb (profil, csillagok, esti mód, hang) */
@media (max-width: 560px) {
  .topbar { gap: 6px; padding: 10px 10px; }
  .topbar-right { gap: 6px; }
  .brand-mobile span:last-child { display: none; }
  .icon-btn { width: 40px; height: 40px; font-size: 1.15rem; }
  .star-total { padding: 5px 10px; font-size: 1rem; }
}
