:root {
  --bg: #FFF7EE;
  --surface: #FFFFFF;
  --surface-2: #FFF1E2;
  --ink: #2B2340;
  --ink-2: #6B6380;
  --line: #EADFD2;
  --primary: #6D4AFF;
  --primary-ink: #FFFFFF;
  --primary-soft: #EEE9FF;
  --ok: #18A058;
  --ok-soft: #E3F7EC;
  --bad: #E5484D;
  --bad-soft: #FDE8E8;
  --warn: #F59E0B;
  --blue: #3B82F6; --blue-soft: #E6F0FF;
  --amber: #F59E0B; --amber-soft: #FFF2D6;
  --green: #16A34A; --green-soft: #E2F6E9;
  --red: #E5484D; --red-soft: #FDE8E8;
  --teal: #0EA5A4; --teal-soft: #DDF6F5;
  --purple: #8B5CF6; --purple-soft: #F0EAFF;
  --radius: 18px;
  --shadow: 0 2px 0 rgba(43,35,64,.06), 0 8px 24px rgba(43,35,64,.06);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { font-size: 18px; line-height: 1.45; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
.hidden { display: none !important; }

/* ---------- genel bileşenler ---------- */
.wrap { max-width: 980px; margin: 0 auto; padding: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: 999px; border: 2px solid transparent;
  background: var(--primary); color: var(--primary-ink); font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 0 #4B2FD6; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #4B2FD6; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.ok { background: var(--ok); box-shadow: 0 4px 0 #0E7A40; }
.btn.bad { background: var(--bad); box-shadow: 0 4px 0 #B42F34; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 15px; box-shadow: 0 3px 0 #4B2FD6; }
.btn.ghost.small { box-shadow: 0 2px 0 var(--line); }
.btn.icon { width: 52px; padding: 0; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 800; background: var(--surface-2); color: var(--ink-2); }
.muted { color: var(--ink-2); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 150%); z-index: 99;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700;
  transition: transform .25s; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); }
#toast.ok { background: var(--ok); }

.subject-blue { --sc: var(--blue); --sc-soft: var(--blue-soft); }
.subject-amber { --sc: var(--amber); --sc-soft: var(--amber-soft); }
.subject-green { --sc: var(--green); --sc-soft: var(--green-soft); }
.subject-red { --sc: var(--red); --sc-soft: var(--red-soft); }
.subject-teal { --sc: var(--teal); --sc-soft: var(--teal-soft); }
.subject-purple { --sc: var(--purple); --sc-soft: var(--purple-soft); }

/* ---------- giriş ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login .card { padding: 28px; width: min(420px, 100%); text-align: center; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pin-dots span { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--primary); }
.pin-dots span.on { background: var(--primary); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.numpad button { height: 68px; border-radius: 20px; border: 2px solid var(--line); background: var(--surface); font-size: 28px; font-weight: 800; box-shadow: 0 3px 0 var(--line); }
.numpad button:active { transform: translateY(2px); box-shadow: none; }
.field { display: grid; gap: 6px; text-align: left; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); outline: none; font-size: 17px;
}
.input:focus { border-color: var(--primary); }
textarea.input { min-height: 80px; resize: vertical; }

/* ---------- çocuk: ana ekran ---------- */
.kid-top { display: flex; align-items: center; gap: 16px; padding: 20px 0 8px; }
.kid-top .mascot { width: 92px; height: 92px; border-radius: 28px; object-fit: cover; flex: none; background: var(--primary-soft); }
.kid-top h1 { font-size: 30px; font-weight: 900; }
.kid-list { display: grid; gap: 14px; margin-top: 18px; }
.hw-card {
  display: flex; align-items: center; gap: 16px; padding: 18px; text-align: left; width: 100%;
  border: 2px solid var(--line); border-left: 10px solid var(--sc); background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--line);
}
.hw-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.hw-card .badge { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--sc-soft); color: var(--sc); font-weight: 900; font-size: 22px; flex: none; }
.hw-card h3 { font-size: 21px; font-weight: 900; }
.hw-card .meta { font-size: 15px; color: var(--ink-2); font-weight: 700; }
.hw-card.done { opacity: .8; }
.status-new { background: var(--primary-soft); color: var(--primary); }
.status-in_progress { background: var(--amber-soft); color: #B45309; }
.status-done { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 40px 20px; }
.empty .big { font-size: 64px; }

/* ---------- çocuk: ödev ekranı ---------- */
.hw-bar {
  position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 10px 0;
  display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--line);
}
.hw-bar h2 { font-size: 20px; font-weight: 900; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.progress { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 12px 0 4px; }
.progress > div { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.steps button { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 900; }
.steps button.cur { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps button.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.steps button.bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.steps button.seen { border-color: var(--primary); color: var(--primary); }

.section { padding: 20px; }
.section-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.section-head .tag { flex: none; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 14px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 900; }
.section-head h3 { font-size: 21px; font-weight: 900; }
.instr-tr { margin-top: 6px; padding: 10px 14px; background: var(--primary-soft); border-radius: 12px; font-size: 16px; font-weight: 700; color: #4B2FD6; }
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 2px dashed var(--line); border-radius: 14px; margin-bottom: 12px; }
.word-bank span { padding: 4px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 800; }

.items { display: grid; gap: 12px; }
.item { display: flex; gap: 12px; padding: 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); align-items: flex-start; }
.item .num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 900; font-size: 16px; }
.item .body { flex: 1; min-width: 0; font-size: 20px; line-height: 2.1; }
.item.ok { border-color: var(--ok); background: var(--ok-soft); }
.item.bad { border-color: var(--bad); background: var(--bad-soft); }
.item .mark { flex: none; font-size: 26px; font-weight: 900; }
.item.ok .mark::after { content: "✓"; color: var(--ok); }
.item.bad .mark::after { content: "✗"; color: var(--bad); }

.blank-input {
  display: inline-block; min-width: 110px; width: 8ch; height: 42px; padding: 0 10px; margin: 0 4px; vertical-align: middle;
  border: none; border-bottom: 3px solid var(--primary); border-radius: 10px 10px 4px 4px; background: var(--primary-soft);
  font-size: 20px; font-weight: 800; color: var(--ink); text-align: center; outline: none;
}
.blank-input:focus { background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.blank-btn {
  display: inline-flex; align-items: center; justify-content: center; min-width: 120px; height: 44px; padding: 0 14px; margin: 0 4px; vertical-align: middle;
  border-radius: 12px; border: 2px dashed var(--primary); background: var(--primary-soft); color: var(--primary); font-size: 19px; font-weight: 900;
}
.blank-btn.filled { border-style: solid; background: #fff; color: var(--ink); }
.item.ok .blank-input, .item.ok .blank-btn { border-color: var(--ok); background: #fff; }
.item.bad .blank-input, .item.bad .blank-btn { border-color: var(--bad); background: #fff; }

/* sıralama */
.reorder-line {
  min-height: 56px; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; border-radius: 14px;
  border: 2px dashed var(--primary); background: var(--primary-soft); margin-bottom: 10px; align-items: center;
}
.reorder-line:empty::before { content: "Kelimelere dokunarak cümleyi kur"; color: var(--primary); font-size: 16px; font-weight: 700; padding-left: 6px; }
.reorder-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
  padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 19px;
  box-shadow: 0 3px 0 var(--line); line-height: 1.3;
}
.tile:active { transform: translateY(2px); box-shadow: none; }
.tile.used { visibility: hidden; }
.reorder-line .tile { border-color: var(--primary); box-shadow: 0 3px 0 #C8BBFF; }

/* seçenek */
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; line-height: 1.3; }
.choice { padding: 10px 18px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 19px; box-shadow: 0 3px 0 var(--line); }
.choice.sel { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 3px 0 #4B2FD6; }
textarea.open { width: 100%; min-height: 70px; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); font-size: 20px; line-height: 1.5; outline: none; resize: vertical; background: #fff; }
textarea.open:focus { border-color: var(--primary); }

/* alt sayfa (bottom sheet) */
.sheet-back { position: fixed; inset: 0; background: rgba(43,35,64,.35); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: min(720px, 100%); border-radius: 26px 26px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); max-height: 80vh; overflow: auto; }
.sheet h3 { margin-bottom: 12px; }
.sheet .opts { display: flex; flex-wrap: wrap; gap: 10px; }
.sheet .opts button { padding: 12px 20px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 20px; box-shadow: 0 3px 0 var(--line); }
.sheet .opts button.taken { opacity: .45; }
.sheet .opts button.sel { border-color: var(--primary); background: var(--primary-soft); }

/* çizim */
.draw-wrap { position: relative; border-radius: 14px; overflow: hidden; border: 2px solid var(--line); background: #fff; }
.draw-wrap img, .draw-wrap canvas { display: block; width: 100%; height: auto; }
.draw-wrap canvas.ink { position: absolute; inset: 0; height: 100%; touch-action: none; cursor: crosshair; }
.draw-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; position: sticky; top: 66px; z-index: 5; background: var(--surface); padding: 8px 0; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch.sel { box-shadow: 0 0 0 3px var(--ink); }
.tool { height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 800; font-size: 15px; }
.tool.sel { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.foot { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin: 18px 0 40px; flex-wrap: wrap; }

/* sonuç */
.result { text-align: center; padding: 30px 20px; }
.result .stars { font-size: 56px; letter-spacing: 6px; }
.result .score { font-size: 54px; font-weight: 900; color: var(--primary); }
.review-item { text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); margin-bottom: 8px; background: #fff; }
.review-item.bad { border-color: var(--bad); }
.review-item .right { color: var(--ok); font-weight: 800; }

.modal-back { position: fixed; inset: 0; background: rgba(43,35,64,.5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 22px; padding: 18px; width: min(900px, 100%); max-height: 90vh; overflow: auto; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

/* ---------- veli paneli ---------- */
.parent .top { display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.parent .top h1 { font-size: 24px; font-weight: 900; }
.p-group h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin: 22px 0 10px; }
.p-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 10px; cursor: pointer; border-left: 8px solid var(--sc); }
.p-row h3 { font-size: 18px; font-weight: 800; }
.p-row .meta { font-size: 14px; color: var(--ink-2); }
.st-draft { background: var(--surface-2); color: var(--ink-2); }
.st-published { background: var(--primary-soft); color: var(--primary); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-in_progress { background: var(--amber-soft); color: #B45309; }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { position: relative; width: 120px; border-radius: 12px; overflow: hidden; border: 3px solid var(--line); background: #fff; }
.thumb img { display: block; }
.thumb.off { opacity: .35; border-style: dashed; }
.thumb label { position: absolute; left: 6px; top: 6px; background: #fff; border-radius: 8px; padding: 0 6px; font-size: 13px; font-weight: 800; display: flex; gap: 4px; align-items: center; }
.thumb .lbl { position: absolute; right: 6px; bottom: 6px; background: var(--ink); color: #fff; border-radius: 8px; padding: 0 6px; font-size: 12px; font-weight: 800; }
.steps-log { display: grid; gap: 6px; margin-top: 12px; font-size: 15px; }
.sec-edit { padding: 16px; margin-bottom: 14px; }
.sec-edit .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sec-edit .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.it-edit { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px dashed var(--line); }
.it-edit .n { font-weight: 900; color: var(--ink-2); padding-top: 12px; }
.it-edit .fields { display: grid; gap: 6px; }
.it-edit .input { min-height: 40px; font-size: 15px; padding: 6px 10px; border-radius: 10px; }
.hint { font-size: 13px; color: var(--ink-2); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; }
.seg button { border: none; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 800; }
.seg button.sel { background: var(--surface); box-shadow: var(--shadow); color: var(--primary); }
.res-item { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); font-size: 16px; }
.res-item .ans { font-weight: 800; }
.res-item .ans.ok { color: var(--ok); }
.res-item .ans.bad { color: var(--bad); }
.overlay-pair { position: relative; }
.overlay-pair img.ov { position: absolute; inset: 0; width: 100%; height: 100%; }
.badge-type { font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); }

a.btn { text-decoration: none; }
@media (max-width: 640px) {
  .parent .btn { min-height: 44px; padding: 8px 16px; font-size: 16px; }
  .parent .btn.icon { width: 44px; padding: 0; }
  .parent .top h1 { font-size: 22px; }
  body { font-size: 17px; }
  .item .body { font-size: 18px; }
  .sec-edit .grid2 { grid-template-columns: 1fr; }
  .kid-top h1 { font-size: 24px; }
  .kid-top .mascot { width: 70px; height: 70px; }
}
