/* Kleiser School - shared styles. Rule: no red anywhere. Mistakes use soft orange. */
:root {
  --bg: #F3F7FF;
  --card: #FFFFFF;
  --ink: #1E293B;
  --muted: #64748B;
  --brand: #3B82F6;
  --brand-dark: #1E40AF;
  --ok: #16A34A;
  --ok-soft: #DCFCE7;
  --oops: #C2410C;       /* soft orange text */
  --oops-soft: #FFEDD5;  /* soft orange background */
  --kid: #3B82F6;        /* replaced by the child's chosen color */
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Arial Hebrew", Arial, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 48px; }
.wrap.wide { max-width: 900px; }

header.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
}
.logo { font-size: 1.4rem; font-weight: 800; color: var(--brand-dark); }
.logo small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); }

.card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(30, 64, 175, .08);
}

h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
.choices + h2 { margin-top: 20px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .9rem; }
.hidden { display: none !important; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input, select {
  width: 100%; font: inherit; padding: 14px 16px;
  border: 2px solid #CBD5E1; border-radius: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--brand); }
input.ltr { direction: ltr; text-align: left; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 14px; padding: 14px 20px; min-height: 52px;
  background: var(--brand); color: #fff; width: 100%;
}
button:hover { background: var(--brand-dark); }
button:disabled { opacity: .55; cursor: default; }
button.ghost { background: transparent; color: var(--brand-dark); border: 2px solid #CBD5E1; }
button.small { width: auto; min-height: 40px; padding: 8px 14px; font-size: .9rem; }

.msg { border-radius: 12px; padding: 12px 14px; margin: 12px 0 0; font-weight: 600; }
.msg.oops { background: var(--oops-soft); color: var(--oops); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }

/* PIN pad */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 16px 0; direction: ltr; }
.pin-dots span {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--brand); background: transparent;
}
.pin-dots span.full { background: var(--brand); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; direction: ltr; }
.pad button { font-size: 1.5rem; min-height: 64px; background: #E0EAFF; color: var(--brand-dark); }
.pad button:hover { background: #C7D7FE; }

/* Kid area */
.kid-hello { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 76px; height: 76px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 2.6rem;
  background: var(--kid); box-shadow: 0 0 0 5px #fff, 0 0 0 8px var(--kid);
}
.subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.subject {
  border-radius: var(--radius); padding: 18px 12px; text-align: center;
  font-weight: 800; font-size: 1.15rem; background: var(--kid); color: #fff; min-height: 110px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.subject.soon { background: #E2E8F0; color: var(--muted); }
.subject .tag { font-size: .8rem; font-weight: 600; }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.choice {
  min-height: 64px; border-radius: 16px; border: 3px solid transparent;
  background: #F1F5F9; color: var(--ink); font-size: 2rem; padding: 6px;
}
.choice:hover { background: #E2E8F0; }
.choice.picked { border-color: var(--ink); }
.choice.color { font-size: 0; }

/* Admin */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: right; padding: 10px 8px; border-bottom: 1px solid #E2E8F0; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; }
.checks input { width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-scroll { overflow-x: auto; }

@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr; }
  .choices { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Stage 2: math practice ===== */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn.small { width: auto; }
a.logo { text-decoration: none; }
a.subject { text-decoration: none; }
a.subject:focus-visible, button:focus-visible, a.btn:focus-visible, input:focus-visible {
  outline: 3px solid var(--brand-dark); outline-offset: 2px;
}
.center { text-align: center; }
.tiny { font-size: .78rem; color: var(--muted); font-weight: 500; }

.big-cta {
  font-size: 1.3rem; min-height: 76px; margin-bottom: 16px;
  background: var(--kid); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(30, 64, 175, .15);
}
.big-cta:hover { filter: brightness(.95); background: var(--kid); }

.topics { display: grid; grid-template-columns: 1fr; gap: 10px; }
.topic {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
  background: #F1F5F9; color: var(--ink); text-align: right; border-radius: 16px; padding: 14px 16px;
}
.topic:hover { background: #E2E8F0; }
.topic .tiny { grid-column: 2 / 4; }
.topic-icon { font-size: 1.8rem; grid-row: span 2; }
.topic-name { font-size: 1.1rem; }
.stars { font-size: .95rem; letter-spacing: 1px; }

.practice-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pill { background: var(--kid); color: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 700; font-size: .95rem; }

.q-card { padding-top: 24px; }
.q-text { font-size: 1.2rem; font-weight: 700; text-align: center; }
.q-picture { display: flex; justify-content: center; margin: 8px 0 14px; color: var(--kid); }
.q-picture .pic { width: 100%; max-width: 300px; height: auto; }
.q-picture .pic.circle { max-width: 170px; }

.math-row {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 12px; font-size: 2rem; font-weight: 700; margin: 8px 0 18px; min-height: 48px;
}
.math-row.inline { display: inline-flex; font-size: 1.4rem; margin: 0; gap: 8px; vertical-align: middle; }
.frac { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
.frac .fn { border-bottom: 3px solid currentColor; padding: 0 6px; }
.frac .fd { padding: 0 6px; }
.mixed { display: inline-flex; align-items: center; gap: 4px; }
.qbox {
  display: inline-grid; place-items: center; min-width: 56px; height: 56px; padding: 0 8px;
  border: 3px dashed var(--kid); border-radius: 12px; color: var(--muted);
}
.op { color: var(--muted); }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.choice-grid.signs { grid-template-columns: 1fr 1fr 1fr; }
.ans-choice {
  background: #F1F5F9; color: var(--ink); font-size: 1.6rem; min-height: 80px;
  border: 3px solid transparent; display: flex; align-items: center; justify-content: center;
}
.ans-choice:hover { background: #E2E8F0; }
.ans-choice[aria-pressed="true"] { border-color: var(--kid); background: #fff; box-shadow: 0 0 0 3px var(--kid) inset; }

.frac-input { display: flex; justify-content: center; align-items: center; gap: 16px; margin-bottom: 8px; }
.whole-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.whole-wrap label { margin: 0; }
.frac-stack { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.frac-line { display: block; width: 92px; height: 4px; background: var(--ink); border-radius: 2px; }
.num-in {
  width: 92px; text-align: center; font-size: 1.6rem; font-weight: 700; padding: 10px 6px;
}
.num-in.wide { width: 180px; display: block; margin: 0 auto 14px; }
#fractionArea { margin-bottom: 14px; }

.msg.big { font-size: 1.25rem; text-align: center; }
.tip { text-align: center; color: var(--ok); font-weight: 600; margin-top: 8px; }

.explain {
  background: var(--oops-soft); border: 2px solid #FDBA74; border-radius: 16px;
  padding: 14px 16px; margin-top: 12px;
}
.explain-title { font-weight: 800; color: var(--oops); margin-bottom: 6px; }
.explain ol { margin: 0 0 10px; padding-inline-start: 22px; }
.explain li { margin-bottom: 6px; }
.vertical {
  background: #fff; border-radius: 10px; padding: 10px 14px; font-size: 1.3rem; line-height: 1.4;
  font-family: "Courier New", monospace; width: fit-content; margin: 0 auto 10px; text-align: left;
}
.answer-line { font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#nextBtn { margin-top: 14px; }
.big-emoji { font-size: 4rem; }
.ghost, a.btn.ghost { background: transparent; color: var(--brand-dark); border: 2px solid #CBD5E1; }
a.btn.ghost:hover { background: #E2E8F0; }

/* ===== v0003: language lessons ===== */
.progress-bar { height: 10px; background: #E2E8F0; border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--kid); transition: width .3s; }
.instr { display: flex; align-items: center; justify-content: center; gap: 8px; }
.instr .q-text { margin: 0; }
.tiny-sound { width: auto; min-height: 36px; padding: 4px 10px; background: #E0EAFF; color: var(--brand-dark); font-size: 1rem; }
.learn-card { text-align: center; margin: 10px 0; }
.pic-big { font-size: 5rem; line-height: 1.2; text-align: center; margin: 6px 0; }
.pic-mid { font-size: 2.4rem; }
.letter-big { font-size: 4.2rem; font-weight: 800; text-align: center; color: var(--kid); letter-spacing: 4px; }
.word-big { font-size: 2.2rem; font-weight: 800; text-align: center; margin: 4px 0; }
.word { font-size: 1.5rem; font-weight: 700; text-align: center; }
.meaning { text-align: center; color: var(--muted); font-size: 1.1rem; margin: 2px 0 10px; }
.sound-btn { background: #E0EAFF; color: var(--brand-dark); margin: 8px 0 12px; }
.sound-btn:hover { background: #C7D7FE; }
.next-btn { margin-top: 12px; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 6px; }
.pick { background: #F1F5F9; color: var(--ink); font-size: 3rem; min-height: 100px; border: 3px solid transparent; }
.pick:hover { background: #E2E8F0; }
.pick.pick-letter { font-size: 2.6rem; font-weight: 800; }
.pick.right { border-color: var(--ok); background: var(--ok-soft); }
.pick.wrong { border-color: #FDBA74; background: var(--oops-soft); }
.mic-btn { background: var(--kid); font-size: 1.15rem; min-height: 64px; }
.mic-btn:hover { background: var(--kid); filter: brightness(.95); }
.mic-btn:disabled { opacity: .8; }
.feedback { margin-top: 10px; }
.answer-pic { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.answer-pic .word { font-size: 1.3rem; }
.answer-pic .meaning { margin: 0; }
.spell-built {
  min-height: 60px; border: 3px dashed var(--kid); border-radius: 14px; margin: 6px 0 10px;
  font-size: 2rem; font-weight: 800; text-align: center; letter-spacing: 4px; padding: 6px;
}
.spell-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 10px; }
.tile { width: 56px; min-height: 56px; padding: 0; font-size: 1.6rem; background: #E0EAFF; color: var(--brand-dark); }
.tile:disabled { opacity: .3; }

/* ===== v0003: owner area ===== */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filters input, .filters select { padding: 10px 12px; font-size: .95rem; }
.edit-row td { background: #F8FAFC; }
.switch-row { display: flex; align-items: flex-start; gap: 10px; }
.switch-row input { width: 24px; height: 24px; margin-top: 4px; flex: none; }
.switch-row label { margin: 0; }
@media (max-width: 420px) { .filters { grid-template-columns: 1fr; } }

/* ===== v0004: teachers and "from class" ===== */
a.topic { text-decoration: none; }
.topic-class { background: #FEF9C3; }
.topic-class:hover { background: #FEF08A; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button { flex: 1; background: #F1F5F9; color: var(--ink); border: 3px solid transparent; }
.tabs button[aria-selected="true"] { border-color: var(--brand); background: #fff; }
textarea {
  width: 100%; font: inherit; padding: 12px 14px; min-height: 110px; resize: vertical;
  border: 2px solid #CBD5E1; border-radius: 14px; background: #fff; color: var(--ink);
}
textarea:focus { outline: none; border-color: var(--brand); }
.hint { font-size: .85rem; color: var(--muted); margin: 4px 0 0; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.badge.processing { background: #E0EAFF; color: var(--brand-dark); }
.badge.ready { background: #FEF3C7; color: #92400E; }
.badge.approved { background: var(--ok-soft); color: var(--ok); }
.badge.failed { background: var(--oops-soft); color: var(--oops); }
.badge.archived { background: #E2E8F0; color: var(--muted); }
.upload-item { border: 2px solid #E2E8F0; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.upload-item h3 { font-size: 1.05rem; margin: 0 0 4px; }
.ex-item { border-bottom: 1px solid #E2E8F0; padding: 10px 0; }
.ex-item.removed { opacity: .45; }
.ex-item ol { margin: 6px 0; padding-inline-start: 22px; }
.ex-item .is-answer { font-weight: 800; color: var(--ok); }
.terms-box {
  max-height: 260px; overflow-y: auto; border: 2px solid #CBD5E1; border-radius: 14px;
  padding: 12px 14px; background: #F8FAFC; white-space: pre-wrap; text-align: justify; font-size: .95rem;
}
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.check-row input { width: 24px; height: 24px; }
.check-row input:disabled + label { color: var(--muted); }
.pw-rules { list-style: none; padding: 0; margin: 6px 0 0; font-size: .85rem; }
.pw-rules li { color: var(--muted); }
.pw-rules li.ok { color: var(--ok); font-weight: 700; }
.pw-wrap { position: relative; }
.pw-wrap .eye { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: auto; min-height: 36px; padding: 4px 10px; background: transparent; color: var(--brand-dark); }
.link-box { direction: ltr; text-align: left; word-break: break-all; background: #F1F5F9; border-radius: 12px; padding: 10px 12px; font-family: monospace; font-size: .85rem; }
.text-answer { margin-bottom: 14px; }
.preview-img { max-width: 100%; max-height: 260px; border-radius: 12px; display: block; margin: 8px auto; }
.space-top { margin-top: 18px; }
.choice-list { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0; }
.pick.pick-text { font-size: 1.15rem; min-height: 60px; font-weight: 700; text-align: center; }
h3.space-top { font-size: 1.05rem; }
/* the eye button sits on the right, so it never covers the password (typed left-to-right) */
.pw-wrap .eye { left: auto; right: 8px; }
.pw-wrap input { padding-right: 56px; }
.linkish { background: transparent; color: var(--brand-dark); width: auto; min-height: 44px; padding: 8px 4px; text-decoration: underline; font-weight: 600; margin-top: 8px; }
.linkish:hover { background: transparent; color: var(--ink); }

/* In-page question window */
.ask-dialog {
  border: none;
  border-radius: 16px;
  padding: 24px;
  max-width: min(440px, 92vw);
  width: 100%;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
  color: #1E293B;
}
.ask-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.ask-dialog h2 { margin: 0 0 8px; font-size: 1.25rem; }
.ask-dialog p { margin: 0 0 12px; line-height: 1.6; }
.ask-dialog input { width: 100%; margin-bottom: 16px; }
.ask-dialog .row-actions { justify-content: flex-start; }
button.danger-soft { background: #92400E; border-color: #92400E; color: #FFFFFF; }
button.danger-soft:hover, button.danger-soft:focus-visible { background: #78350F; }
.small-note { font-size: .9rem; margin: 4px 0 0; }
.vertical.big-columns { font-size: 2rem; line-height: 1.35; margin: 8px auto 12px; width: fit-content; }

/* v0005: points */
.points-card h2 { margin-top: 0; }
.points-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.points-box { background: #F1F5F9; border-radius: 12px; padding: 12px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.points-num { font-size: 1.7rem; font-weight: 800; color: var(--brand-dark); }
.points-lbl { font-size: .9rem; color: #475569; }
.points-pop { display: inline-block; font-weight: 800; color: var(--brand-dark); margin-inline-start: 8px; }
