:root {
  --bg: #0b1220;
  --card: #141e33;
  --card2: #1a2744;
  --text: #e8eefc;
  --muted: #94a3b8;
  --accent: #8b5cf6;
  --accent2: #22d3ee;
  --good: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --wall: #94a3b8;
  --radius: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 12px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif; min-height: 100%; }
body { padding-bottom: calc(72px + var(--safe-bottom)); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(11,18,32,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid #24314d;
}
.brand { font-weight: 800; letter-spacing: .2px; }
.brand span { color: var(--accent2); }
.stats { display: flex; gap: 8px; font-size: 12px; }
.chip { background: var(--card2); border: 1px solid #2b3b5c; border-radius: 999px; padding: 4px 10px; }
.chip strong { color: var(--warn); }
main { padding: 16px; max-width: 560px; margin: 0 auto; }
.card {
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid #2a3a5c; border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 12px 16px; cursor: pointer; font-weight: 700;
  background: var(--accent); color: white; width: 100%; margin-top: 8px;
  transition: transform .12s ease, filter .12s;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: #334155; }
.btn.good { background: #059669; }
.btn.warn { background: #d97706; }
.btn.ghost { background: transparent; border: 1px solid #334155; color: var(--text); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: rgba(15,23,42,.96); border-top: 1px solid #24314d;
}
.nav button {
  background: transparent; border: 0; color: var(--muted); padding: 8px 4px; border-radius: 12px; cursor: pointer;
  font-size: 11px; font-weight: 600;
}
.nav button.active { color: white; background: #1e293b; }
.nav .ico { display: block; font-size: 18px; margin-bottom: 2px; }

/* Arena: monster | wall | kitten */
.arena {
  position: relative; height: 120px; border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
  border: 1px solid #334155; margin-bottom: 12px;
}
.arena svg { width: 100%; height: 100%; display: block; }
.arena.flash-red { animation: redflash .7s ease; }
@keyframes redflash {
  0%,100% { box-shadow: none; filter: none; }
  30% { box-shadow: inset 0 0 40px rgba(239,68,68,.7); filter: saturate(1.4); }
  50% { background: #4a1520; }
}
.monster-hit { animation: hit .35s ease; }
@keyframes hit {
  0% { transform: translateX(0); }
  40% { transform: translateX(10px); }
  100% { transform: translateX(0); }
}
.brick-break { animation: brickout .5s forwards; }
@keyframes brickout {
  to { opacity: 0; transform: translateY(20px) rotate(15deg); }
}
.wall-repair { animation: repair .4s ease; }
@keyframes repair {
  from { filter: brightness(1.6); }
  to { filter: none; }
}

.q-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.q-text { font-size: 1.05rem; line-height: 1.5; margin-bottom: 12px; font-weight: 600; }
.choices { display: grid; gap: 8px; }
.choice {
  text-align: left; background: #0f172a; border: 1px solid #334155; color: var(--text);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; font-weight: 600;
}
.choice:disabled { opacity: .85; cursor: default; }
.choice.correct { border-color: var(--good); background: rgba(52,211,153,.15); }
.choice.wrong { border-color: var(--bad); background: rgba(251,113,133,.12); }
.feedback { margin-top: 12px; padding: 12px; border-radius: 12px; background: #0f172a; border: 1px solid #334155; }
.feedback.good { border-color: var(--good); }
.feedback.bad { border-color: var(--bad); }
.progress-bar {
  height: 10px; background: #1e293b; border-radius: 999px; overflow: hidden; margin: 8px 0 4px;
}
.progress-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0%; transition: width .35s; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.break-card { text-align: center; padding: 24px 12px; }
.break-card .big { font-size: 2.5rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--warn); }
.celebrate {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.65); padding: 20px;
}
.celebrate .box {
  background: var(--card); border-radius: 20px; padding: 24px; text-align: center; max-width: 340px;
  border: 2px solid var(--warn); animation: pop .35s ease;
}
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.form-field { margin-bottom: 10px; }
.form-field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid #334155;
  background: #0f172a; color: var(--text);
}
.list-item {
  display: flex; justify-content: space-between; gap: 8px; padding: 10px 0;
  border-bottom: 1px solid #24314d; font-size: 14px;
}
.badge { display: inline-block; background: #312e81; color: #c7d2fe; border-radius: 8px; padding: 2px 8px; font-size: 11px; }
.chart {
  display: flex; align-items: flex-end; gap: 6px; height: 100px; padding-top: 8px;
}
.chart .bar {
  flex: 1; background: linear-gradient(180deg, var(--accent2), var(--accent));
  border-radius: 6px 6px 2px 2px; min-height: 4px; position: relative;
}
.chart .bar span {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted);
}
.pin-dots { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots i.on { background: var(--accent); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 240px; margin: 0 auto; }
.pad button { padding: 16px; border-radius: 16px; border: 1px solid #334155; background: #1e293b; color: white; font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.muted { color: var(--muted); font-size: 13px; }
.tag { background: #1e293b; border-radius: 8px; padding: 2px 8px; }

.action-row { margin-top: 10px; }
.action-row .btn { margin-top: 0; font-size: 0.92rem; padding: 10px 12px; }
.feedback.neutral { border-color: #64748b; }

/* Step-by-step solutions (7th grade readable) */
.cozum-wrap { margin-top: 8px; }
.cozum { font-size: 0.95rem; line-height: 1.55; color: var(--text); }
.cozum-block { margin-bottom: 10px; }
.cozum-kural {
  background: rgba(139,92,246,.15); border-left: 3px solid var(--accent);
  padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; font-weight: 600;
}
.cozum-neden {
  background: rgba(34,211,238,.1); border-left: 3px solid var(--accent2);
  padding: 8px 10px; border-radius: 8px; margin: 8px 0; color: #cfeff7;
}
.cozum-cevap {
  background: rgba(52,211,153,.15); border-left: 3px solid var(--good);
  padding: 8px 10px; border-radius: 8px; margin-top: 8px; font-weight: 800;
}
.cozum-step { padding: 2px 0 2px 2px; }
.cozum-steps {
  margin: 8px 0 8px 1.1rem; padding: 0;
  color: var(--text);
}
.cozum-steps li { margin: 4px 0; padding-left: 4px; }


/* Anlat modal — step-by-step child-friendly explain */
.anlat-modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,.55); padding: 12px;
}
.anlat-modal.hidden { display: none !important; }
.anlat-sheet {
  width: 100%; max-width: 520px; max-height: min(88vh, 720px);
  background: linear-gradient(180deg, #1a2744, #0f172a);
  border: 1px solid #3b4d74; border-radius: 20px 20px 16px 16px;
  box-shadow: 0 -8px 40px rgba(0,0,0,.45);
  display: flex; flex-direction: column; overflow: hidden;
  animation: pop .3s ease;
}
.anlat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px; border-bottom: 1px solid #24314d;
}
.anlat-head h2 { margin: 0; font-size: 1.1rem; }
.anlat-close {
  background: #1e293b; border: 1px solid #334155; color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 16px;
}
.anlat-body {
  padding: 14px 16px; overflow-y: auto; flex: 1;
}
.anlat-step-card {
  background: #141e33; border: 1px solid #2a3a5c; border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px;
}
.anlat-step-card.dim { opacity: .45; }
.anlat-step-card.active {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px rgba(34,211,238,.35);
}
.anlat-step-label {
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: var(--accent2); text-transform: uppercase; margin-bottom: 6px;
}
.anlat-step-card p { margin: 0; color: var(--text); line-height: 1.5; font-size: 0.98rem; }
.anlat-picked {
  background: rgba(251,113,133,.12); border-left: 3px solid var(--bad);
  padding: 10px 12px; border-radius: 10px; margin: 8px 0;
}
.anlat-tip {
  background: rgba(251,191,36,.12); border-left: 3px solid var(--warn);
  padding: 10px 12px; border-radius: 10px; margin-top: 8px; font-weight: 600;
}
.anlat-progress {
  display: flex; gap: 6px; justify-content: center; margin: 4px 0 10px;
}
.anlat-progress i {
  width: 8px; height: 8px; border-radius: 50%; background: #334155;
}
.anlat-progress i.on { background: var(--accent2); }
.anlat-actions {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px;
  padding: 10px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid #24314d;
}
.anlat-actions .btn { margin-top: 0; }
.anlat-actions .btn.good { grid-column: 1 / -1; }
.anlat-actions.final { grid-template-columns: 1fr; }
.btn.anlat {
  background: linear-gradient(90deg, #7c3aed, #2563eb);
}
.help-mini {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.help-mini .btn { width: auto; flex: 1; min-width: 120px; margin-top: 0; font-size: 0.9rem; padding: 10px 12px; }


/* Hero characters (original — not licensed game clones) */
.hero-row {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px;
}
.hero-svg-wrap {
  flex: 0 0 72px; width: 72px; height: 72px;
  border-radius: 16px; background: #0f172a; border: 2px solid #334155;
  overflow: hidden; position: relative;
}
.hero-svg-wrap svg { width: 100%; height: 100%; display: block; }
.hero-svg-wrap.react-good { animation: heroPop .45s ease; border-color: var(--good); }
.hero-svg-wrap.react-bad { animation: heroShake .45s ease; border-color: var(--bad); }
@keyframes heroPop {
  0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); }
}
@keyframes heroShake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.hero-bubble {
  flex: 1; background: #0f172a; border: 1px solid #334155; border-radius: 14px;
  padding: 10px 12px; position: relative; font-size: 0.92rem; line-height: 1.4;
  color: var(--text);
}
.hero-bubble::before {
  content: ""; position: absolute; left: -7px; top: 18px;
  border: 7px solid transparent; border-right-color: #334155;
}
.hero-bubble .hero-name {
  font-size: 11px; font-weight: 800; letter-spacing: .03em;
  color: var(--accent2); margin-bottom: 4px;
}
.hero-pick {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px;
}
.hero-pick button {
  background: #0f172a; border: 2px solid #334155; border-radius: 14px;
  padding: 10px 8px; color: var(--text); cursor: pointer; text-align: center;
}
.hero-pick button.active { border-color: var(--accent2); box-shadow: 0 0 0 1px rgba(34,211,238,.4); }
.hero-pick .mini { width: 48px; height: 48px; margin: 0 auto 6px; }
.hero-pick .mini svg { width: 100%; height: 100%; }
.hero-pick .label { font-size: 12px; font-weight: 700; }
.hero-pick .sub { font-size: 10px; color: var(--muted); }
.q-story { margin-bottom: 8px; }

/* Mastery + review */
.mastery-row { margin-bottom: 10px; }
.mastery-label { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; margin-bottom: 2px; }
.tag.tekrar { background: #7c2d12; color: #fed7aa; border: 1px solid #ea580c; }
.weekly-card h3 { color: var(--text); }
.stats .chip { font-size: 11px; padding: 3px 8px; }
@media (max-width: 380px) {
  .stats { gap: 4px; }
  .chip { padding: 3px 6px; }
}
