/* Arithmetic trainer — app-specific styles. Layers on top of the global /style.css
   design system (dark two-tone SpecEnvoy theme). Each operation sets --op on #app
   so the whole UI re-themes (multiply=blue, add=green, subtract=orange, divide=purple,
   powers=pink). Kid-friendly: big touch targets, rounded, playful feedback. */

#app { --op: #3b6fe0; --op-soft: rgba(59,111,224,.14); text-align: left; }
#app[data-op="multiply"] { --op:#3b6fe0; --op-soft:rgba(59,111,224,.14); }
#app[data-op="add"]      { --op:#2fbf71; --op-soft:rgba(47,191,113,.15); }
#app[data-op="subtract"] { --op:#ff8a3d; --op-soft:rgba(255,138,61,.15); }
#app[data-op="divide"]   { --op:#a06bff; --op-soft:rgba(160,107,255,.16); }
#app[data-op="powers"]   { --op:#ff5d8f; --op-soft:rgba(255,93,143,.16); }
#app[data-op="mixed"]     { --op:#26c6c6; --op-soft:rgba(38,198,198,.16); }

/* the page is a bit wider than the marketing pages to fit the grid/quiz */
.edu-wrap { max-width: 860px; }

/* pointer to the divisibility guide, sits above the app */
.guide-link { margin: -22px 0 26px; font-size: 15px; }
.guide-link a { color: var(--accent); text-decoration: none; font-weight: 600; }
.guide-link a:hover { text-decoration: underline; }

/* ---- operation selector (segmented) ---- */
.op-bar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 8px 0 6px; }
.op-btn {
  appearance: none; cursor: pointer; flex: 0 1 auto; min-width: 96px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 14px; font-size: 15px; font-weight: 650;
  color: var(--ink); background: var(--card); border: 1px solid var(--border);
  transition: border-color .15s, background .15s, transform .12s;
}
.op-btn .sym { font-size: 20px; line-height: 1; font-weight: 700; }
.op-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.op-btn[aria-selected="true"] { border-color: var(--op); background: var(--op-soft); color: var(--ink); }
.op-btn[aria-selected="true"] .sym { color: var(--op); }
/* secondary ops (+ − ÷): compact, symbol-only squares */
.op-btn.op-compact { min-width: 52px; flex: 0 0 auto; padding: 12px 0; }
.op-btn.op-compact .sym { font-size: 23px; }

/* current-operation caption — keeps the symbol-only +,−,÷ unambiguous */
.op-caption { margin: 0 0 16px 2px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--op); }

/* ---- tab bar ---- */
.tab-bar { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab-btn {
  appearance: none; cursor: pointer; background: none; border: none; color: var(--muted);
  font-size: 15px; font-weight: 600; padding: 10px 14px; border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--op); }

/* ---- shared number chips ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.chip {
  appearance: none; cursor: pointer; min-width: 46px; height: 46px; padding: 0 12px;
  border-radius: 12px; font-size: 17px; font-weight: 650; color: var(--ink);
  background: var(--card); border: 1px solid var(--border);
  transition: border-color .12s, background .12s, transform .1s;
}
.chip:hover { transform: translateY(-1px); border-color: var(--op); }
.chip[aria-pressed="true"], .chip.active { border-color: var(--op); background: var(--op-soft); color: var(--ink); }
.chip-all { font-size: 14px; min-width: auto; }

.panel-hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* 🎲 mixed: which operations to blend */
.op-include { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.op-inc {
  appearance: none; cursor: pointer; display: flex; align-items: center; gap: 7px;
  padding: 9px 13px; border-radius: 12px; font-size: 14px; font-weight: 650;
  color: var(--muted); background: var(--card); border: 1px solid var(--border);
  transition: border-color .12s, background .12s, color .12s, transform .1s;
}
.op-inc .sym { font-size: 17px; font-weight: 700; }
.op-inc:hover { transform: translateY(-1px); color: var(--ink); }
.op-inc[aria-pressed="true"] { color: var(--ink); border-color: var(--op); background: var(--op-soft); }
.op-inc.op-multiply[aria-pressed="true"] { border-color:#3b6fe0; background:rgba(59,111,224,.14); }
.op-inc.op-add[aria-pressed="true"]      { border-color:#2fbf71; background:rgba(47,191,113,.15); }
.op-inc.op-subtract[aria-pressed="true"] { border-color:#ff8a3d; background:rgba(255,138,61,.15); }
.op-inc.op-divide[aria-pressed="true"]   { border-color:#a06bff; background:rgba(160,107,255,.16); }
.row-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 8px; }
.toggle-link { appearance:none; background:none; border:none; cursor:pointer; color: var(--op); font-size:14px; font-weight:600; padding:0; }

/* ---- LEARN: single-table list ---- */
.table-list { list-style: none; margin: 8px 0 0; padding: 0; columns: 2; column-gap: 18px; }
@media (max-width: 520px) { .table-list { columns: 1; } }
.table-list li {
  break-inside: avoid; display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px;
  padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; font-size: 17px;
}
.table-list .eq { color: var(--muted); }
.table-list .res { margin-left: auto; font-weight: 700; color: var(--op); font-size: 19px; }

/* ---- LEARN: full multiplication grid ---- */
.grid-wrap { overflow-x: auto; margin-top: 14px; -webkit-overflow-scrolling: touch; }
table.times-grid { border-collapse: collapse; margin: 0 auto; }
.times-grid th, .times-grid td {
  width: 46px; height: 42px; text-align: center; font-size: 15px;
  border: 1px solid var(--border); transition: background .1s;
}
.times-grid th { color: var(--muted); font-weight: 700; background: rgba(255,255,255,.03); }
.times-grid th.corner { color: var(--op); }
.times-grid td { color: var(--ink); cursor: default; }
.times-grid td.hl-row, .times-grid td.hl-col { background: var(--op-soft); }
.times-grid td.hl-cell { background: var(--op); color: #fff; font-weight: 700; }
.times-grid th.hl-head { color: var(--op); background: var(--op-soft); }

/* ---- FLASHCARD ---- */
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 8px; }
.flashcard {
  width: min(100%, 420px); aspect-ratio: 3 / 2; cursor: pointer; perspective: 1200px; background: none; border: none; padding: 0;
}
.flash-inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-radius: 22px; border: 1px solid var(--border); background: var(--card);
}
.flash-face .q { font-size: clamp(34px, 9vw, 56px); font-weight: 700; letter-spacing: -.02em; }
.flash-face .hint { color: var(--muted); font-size: 14px; }
.flash-back { transform: rotateY(180deg); background: var(--op-soft); border-color: var(--op); }
.flash-back .a { font-size: clamp(40px, 11vw, 68px); font-weight: 800; color: var(--op); }
.flash-controls { display: flex; gap: 10px; }
.flash-counter { color: var(--muted); font-size: 14px; }

/* ---- QUIZ ---- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.progress { flex: 1; height: 8px; border-radius: 6px; background: var(--card); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--op); transition: width .3s; }
.quiz-score { font-size: 14px; color: var(--muted); white-space: nowrap; }
.quiz-q { text-align: center; font-size: clamp(40px, 11vw, 64px); font-weight: 800; letter-spacing: -.02em; margin: 18px 0 18px; }
.quiz-q .qmark { color: var(--op); }
.answer-form { margin: 0 auto; max-width: 420px; }
.answer-row { display: flex; gap: 10px; align-items: stretch; }
.answer-input {
  flex: 1; min-width: 0; font-size: 28px; font-weight: 700; text-align: center;
  padding: 14px 16px; border-radius: 14px; color: var(--ink);
  background: var(--card); border: 2px solid var(--border); outline: none;
  transition: border-color .12s;
}
.answer-input:focus { border-color: var(--op); }
.answer-input:disabled { opacity: .7; }
/* hide spinner arrows so it reads like a clean answer box */
.answer-input::-webkit-outer-spin-button, .answer-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.answer-input { -moz-appearance: textfield; }
.answer-row .btn-op { font-size: 17px; padding: 0 22px; }
.feedback { text-align: center; min-height: 26px; margin-top: 16px; font-size: 17px; font-weight: 650; }

/* answered-question history (correct / incorrect) */
.history { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.hchip { padding: 10px 14px; border-radius: 12px; font-size: 16px; font-weight: 600; border: 1px solid var(--border); }
.hchip.ok { background: rgba(47,191,113,.14); border-color: rgba(47,191,113,.5); color: #8df0b6; }
.hchip.bad { background: rgba(255,93,108,.12); border-color: rgba(255,93,108,.5); color: #ffaab1; }
.feedback.good { color: #6ee7a8; }
.feedback.bad { color: #ff9aa3; }

/* quiz start / result cards */
.quiz-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 26px 24px; text-align: center; }
.quiz-card h3 { margin: 0 0 6px; font-size: 20px; }
.quiz-card .big { font-size: clamp(44px, 12vw, 72px); font-weight: 800; color: var(--op); line-height: 1.1; margin: 6px 0; }
.quiz-card .stars { font-size: 30px; letter-spacing: 4px; margin: 6px 0 4px; }
.quiz-card .best { color: var(--muted); font-size: 14px; }

.btn-op { display:inline-block; cursor:pointer; appearance:none; text-decoration:none; font-weight:700; font-size:16px;
  padding:13px 26px; border-radius:12px; border:none; background: var(--op); color:#fff; transition: filter .15s, transform .12s; }
.btn-op:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-op.ghost { background: transparent; color: var(--ink); border:1px solid var(--border); }

/* breadcrumb */
.crumbs { font-size: 13px; color: var(--muted); margin: -6px 0 18px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: .5; margin: 0 7px; }
