/* OLSAT Practice. Periwinkle paper, indigo ink, chunky press-down buttons, one colour per skill. */
:root {
  --bg: #e8ebff;
  --paper: #ffffff;
  --ink: #171b4b;
  --ink2: #4a4f86;
  --line: #171b4b;
  --sun: #ffc93c;
  --mint: #2fd0a0;
  --mint-soft: #d6f7ec;
  --coral: #ff6b57;
  --coral-soft: #ffe3de;
  --pink: #ff5da2;
  --sky: #4cc3ff;
  --accent: #7c6cff;
  --r: 20px;
  --press: 5px;
  --font: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 20px; line-height: 1.4;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  min-height: 100vh;
}
textarea, input { -webkit-user-select: text; user-select: text; }
#app { max-width: 1040px; margin: 0 auto; padding: 18px 20px 48px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 40px; font-weight: 800; }
h2 { font-size: 28px; font-weight: 800; }
h3 { font-size: 21px; font-weight: 800; }
p { margin: 0 0 10px; }
.muted { color: var(--ink2); }
.small { font-size: 16px; }

/* ---------- buttons ---------- */
.btn {
  appearance: none; font: inherit; font-weight: 800; color: var(--ink); background: var(--paper);
  border: 3px solid var(--line); border-radius: 18px; padding: 12px 22px; min-height: 56px;
  box-shadow: 0 var(--press) 0 var(--line); cursor: pointer; transition: transform .06s, box-shadow .06s;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-align: center;
}
.btn:active, .btn.down { transform: translateY(calc(var(--press) - 1px)); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--sun); }
.btn.good { background: var(--mint); }
.btn.ghost { box-shadow: none; background: transparent; border-color: transparent; text-decoration: underline; min-height: 44px; }
.btn.ghost:active { transform: none; }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 17px; border-radius: 14px; box-shadow: 0 3px 0 var(--line); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.wide { width: 100%; }
:focus-visible { outline: 4px solid var(--pink); outline-offset: 3px; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.brand { font-weight: 800; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; background: var(--pink); border: 3px solid var(--line); box-shadow: 0 3px 0 var(--line); display: grid; place-items: center; color: #fff; font-size: 22px; }
.streak:empty { visibility: hidden; }
.streak { font-weight: 800; background: var(--paper); border: 3px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 17px; }

/* ---------- home ---------- */
.hero { background: var(--paper); border: 3px solid var(--line); border-radius: 28px; box-shadow: 0 8px 0 var(--line); padding: 26px 26px 22px; margin-bottom: 26px; }
.hero h1 { margin-bottom: 6px; }
.hero .lead { font-size: 22px; color: var(--ink2); margin-bottom: 18px; }
.skyline { display: grid; grid-template-columns: repeat(15, 1fr); gap: 7px; align-items: end; height: 140px; padding: 0 2px; border-bottom: 3px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent calc(25% - 2px), #d5d9f7 calc(25% - 2px), #d5d9f7 25%); }
.skyline .bar { border: 3px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; min-height: 10px; background: var(--c); position: relative; }
.skyline .bar::after { content: ""; position: absolute; left: 4px; right: 4px; top: 6px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.55); }
.skyline-cap { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 16px; color: var(--ink2); flex-wrap: wrap; }
.levelpill { display: inline-block; font-weight: 800; background: var(--sun); border: 3px solid var(--line); border-radius: 999px; padding: 2px 14px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; margin-bottom: 22px; }
.mode { text-align: left; background: var(--paper); border: 3px solid var(--line); border-radius: 24px; box-shadow: 0 7px 0 var(--line); padding: 20px 22px 22px; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 8px; min-height: 190px; transition: transform .06s, box-shadow .06s; }
.mode:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--line); }
.mode .big { font-size: 27px; font-weight: 800; }
.mode .meta { margin-top: auto; font-weight: 800; font-size: 17px; background: var(--c, var(--sun)); border: 3px solid var(--line); border-radius: 999px; padding: 4px 14px; align-self: flex-start; }
.links { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.tip { background: var(--paper); border: 3px dashed var(--line); border-radius: 18px; padding: 12px 16px; margin: 14px 0; font-size: 17px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.resume { background: var(--sun); border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 6px 0 var(--line); padding: 14px 18px; margin-bottom: 20px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- skills ---------- */
.group { margin: 26px 0 8px; }
.group h3 { margin-bottom: 12px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.skill { text-align: left; font: inherit; color: inherit; background: var(--paper); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 5px 0 var(--line); padding: 14px 16px 14px; cursor: pointer; display: grid; gap: 4px; border-left: 14px solid var(--c); min-height: 112px; transition: transform .06s, box-shadow .06s; }
.skill:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.skill b { font-size: 21px; }
.meter { height: 12px; border: 3px solid var(--line); border-radius: 999px; background: #fff; overflow: hidden; margin-top: 4px; }
.meter i { display: block; height: 100%; background: var(--c, var(--accent)); }

/* ---------- question card ---------- */
.pips { display: flex; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap; }
.pip { width: 20px; height: 20px; border-radius: 7px; border: 3px solid var(--line); background: #fff; }
.pip.now { background: var(--sun); transform: scale(1.12); }
.pip.ok { background: var(--mint); }
.pip.no { background: var(--coral); }
.qcard { background: var(--paper); border: 3px solid var(--line); border-radius: 28px; box-shadow: 0 8px 0 var(--line); padding: 22px 24px 26px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.tag { font-weight: 800; font-size: 17px; background: var(--accent); border: 3px solid var(--line); border-radius: 999px; padding: 3px 14px; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.challenge { display: flex; gap: 5px; align-items: center; font-size: 15px; color: var(--ink2); }
.challenge i { width: 12px; height: 12px; border: 2.5px solid var(--line); border-radius: 50%; background: #fff; display: inline-block; }
.challenge i.on { background: var(--accent); }
.stem { font-size: 26px; font-weight: 700; line-height: 1.35; margin-bottom: 16px; max-width: 46em; }
.stem .w { font-weight: 800; background: var(--sun); border-radius: 8px; padding: 0 8px; border: 2.5px solid var(--line); }
.stem .q2 { margin-top: 10px; font-weight: 800; }
.sent { font-size: 27px; font-weight: 600; margin-top: 12px; line-height: 1.5; }
.blank { display: inline-block; width: 120px; height: 0; border-bottom: 4px solid var(--ink); margin: 0 6px; transform: translateY(2px); }
.visual { margin: 6px 0 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { font-weight: 800; font-size: 24px; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 8px 16px; box-shadow: 0 3px 0 var(--line); display: inline-block; }
.sent .chip { margin: 0 8px 8px 0; }

.options { display: grid; gap: 14px; }
.options.o-text { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.options.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 560px; }
.options.o-num { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.options.o-fig { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.opt { position: relative; appearance: none; font: inherit; color: var(--ink); text-align: left; background: #fff; border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 var(--press) 0 var(--line); padding: 10px 14px 10px 62px; min-height: 68px; display: flex; align-items: center; cursor: pointer; transition: transform .06s, box-shadow .06s, background .12s; }
.opt .badge { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 12px; border: 3px solid var(--line); background: var(--bg); display: grid; place-items: center; font-weight: 800; font-size: 19px; }
.opt .content { font-size: 25px; font-weight: 700; }
.options.o-num .opt { justify-content: center; padding: 10px 12px 10px 56px; }
.options.o-num .content { font-size: 34px; font-weight: 800; }
.options.o-fig .opt { padding: 38px 10px 10px; justify-content: center; min-height: 160px; }
.options.o-fig .opt .badge { left: 10px; top: 10px; transform: none; width: 34px; height: 34px; font-size: 17px; }
.options.o-fig .opt .fig { width: 112px; height: 112px; }
.opt:active { transform: translateY(calc(var(--press) - 1px)); box-shadow: 0 1px 0 var(--line); }
.opt.picked { background: var(--sun); }
.opt.picked .badge { background: #fff; }
.locked .opt { pointer-events: none; }
.opt.correct { background: var(--mint-soft); border-color: #0b8f6a; box-shadow: 0 var(--press) 0 #0b8f6a; }
.opt.correct .badge { background: var(--mint); color: var(--ink); }
.opt.wrong { background: var(--coral-soft); border-color: #c63a27; box-shadow: 0 var(--press) 0 #c63a27; }
.opt.wrong .badge { background: var(--coral); color: #fff; }
.opt.dim { opacity: .55; }
.hintrow { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hintbox { margin-top: 14px; background: #fff7d6; border: 3px solid var(--line); border-radius: 16px; padding: 12px 16px; font-size: 20px; }
.feedback { margin-top: 20px; border: 3px solid var(--line); border-radius: 22px; padding: 16px 20px 18px; }
.feedback.good { background: var(--mint-soft); }
.feedback.bad { background: var(--coral-soft); }
.fbtitle { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.why { font-size: 21px; margin: 6px 0 14px; }
.repeatnote { font-size: 15px; color: var(--ink2); margin-top: 8px; }

/* figures and visuals */
.fig { width: 96px; height: 96px; display: block; flex: none; }
.fig-q .qbox { fill: #fff6cc; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 7 6; }
.fig-q .qmark { fill: var(--ink); font-family: var(--font); }
.figrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.figrow .fig { border: 3px solid var(--line); border-radius: 16px; background: #fff; width: 100px; height: 100px; }
.figrow .fig-q { border: 0; }
.analogy { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.apair { display: flex; align-items: center; gap: 12px; }
.analogy .fig { width: 112px; height: 112px; border: 3px solid var(--line); border-radius: 18px; background: #fff; }
.analogy .fig-q { border: 0; }
.arrow { font-size: 40px; font-weight: 800; }
.ais { font-weight: 800; font-size: 22px; color: var(--ink2); }
.fmatrix { display: grid; gap: 8px; width: min(100%, 360px); }
.fmatrix.n3 { grid-template-columns: repeat(3, 1fr); }
.fmatrix.n2 { grid-template-columns: repeat(2, 1fr); width: min(100%, 250px); }
.fmatrix .mc { border: 3px solid var(--line); border-radius: 14px; background: #fff; aspect-ratio: 1; }
.fmatrix .mc .fig { width: 100%; height: 100%; }
.fmatrix .mc .fig-q { border: 0; }
.numrow { display: flex; flex-wrap: wrap; gap: 10px; }
.nchip { min-width: 70px; height: 70px; padding: 0 14px; display: grid; place-items: center; font-size: 32px; font-weight: 800; background: #fff; border: 3px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line); }
.nchip.q, .ncell.q, .wcell.q { background: #fff6cc; border-style: dashed; }
.nmatrix { display: grid; grid-template-columns: repeat(3, 84px); gap: 8px; }
.ncell { height: 72px; display: grid; place-items: center; font-size: 30px; font-weight: 800; border: 3px solid var(--line); border-radius: 14px; background: #fff; }
.ncell.lt { letter-spacing: .04em; }
.wmatrix { display: grid; grid-template-columns: minmax(120px, 190px) 36px minmax(120px, 190px); gap: 8px; align-items: center; }
.wcell { min-height: 62px; display: grid; place-items: center; font-size: 25px; font-weight: 800; border: 3px solid var(--line); border-radius: 14px; background: #fff; padding: 4px 10px; text-align: center; }
.warrow { font-size: 28px; font-weight: 800; text-align: center; }
.eqs { display: grid; gap: 10px; }
.eq { display: flex; align-items: center; gap: 10px; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 8px 16px; width: fit-content; min-height: 70px; }
.eq.ask { background: #fff6cc; margin-top: 4px; }
.eq .op { font-size: 34px; font-weight: 800; }
.eq .q { color: var(--coral); }
.sym { width: 50px; height: 50px; }

/* ---------- summary / progress / settings ---------- */
.panel { background: var(--paper); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 7px 0 var(--line); padding: 22px 24px; margin-bottom: 22px; }
.bigscore { font-size: 64px; font-weight: 800; line-height: 1; }
.row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr auto; gap: 14px; align-items: center; padding: 8px 0; border-bottom: 2px dashed #c6caf2; }
.row:last-child { border-bottom: 0; }
.row .name { font-weight: 800; }
.delta { font-weight: 800; font-size: 17px; min-width: 64px; text-align: right; }
.delta.up { color: #0b8f6a; } .delta.down { color: #c63a27; }
.actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.seg button { font: inherit; font-weight: 800; color: var(--ink); background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 8px 16px; min-height: 48px; cursor: pointer; box-shadow: 0 3px 0 var(--line); }
.seg button.on { background: var(--sun); }
.field { padding: 14px 0; border-bottom: 2px dashed #c6caf2; }
.field:last-child { border-bottom: 0; }
.field label, .field .lab { font-weight: 800; display: block; margin-bottom: 4px; }
.field .hint { color: var(--ink2); font-size: 16px; margin-bottom: 10px; }
input[type=range] { width: 100%; max-width: 480px; height: 40px; accent-color: var(--pink); }
.rangeline { display: flex; align-items: center; gap: 14px; }
.rangeline output { font-weight: 800; min-width: 64px; }
.tog { display: flex; flex-wrap: wrap; gap: 10px; }
.tog button { font: inherit; font-weight: 700; font-size: 17px; border: 3px solid var(--line); border-radius: 12px; background: #fff; padding: 6px 12px; cursor: pointer; min-height: 44px; }
.tog button.on { background: var(--mint-soft); box-shadow: inset 0 0 0 2px var(--mint); }
textarea { width: 100%; min-height: 120px; font: 14px ui-monospace, Menlo, monospace; border: 3px solid var(--line); border-radius: 14px; padding: 10px; }
.skillrow { display: grid; grid-template-columns: minmax(160px, 250px) 1fr 70px; gap: 12px; align-items: center; padding: 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 16px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 2.5px solid var(--line); background: var(--c); }
.spark { width: 100%; height: 120px; }
table.t { width: 100%; border-collapse: collapse; font-size: 18px; }
table.t th, table.t td { text-align: left; padding: 6px 8px; border-bottom: 2px dashed #c6caf2; }

/* ---------- mock test ---------- */
.mocktop { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.timer { font-weight: 800; font-size: 30px; font-variant-numeric: tabular-nums; background: #fff; border: 3px solid var(--line); border-radius: 14px; padding: 2px 16px; }
.timer.low { background: var(--coral-soft); }
.mocknav { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px; }
.cell { font: inherit; font-weight: 800; font-size: 19px; height: 56px; border: 3px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; position: relative; }
.cell.done { background: var(--sky); }
.cell.flag::after { content: "⚑"; position: absolute; top: -9px; right: -6px; font-size: 20px; color: var(--coral); text-shadow: 0 0 0 var(--ink); }
.cell.now { outline: 4px solid var(--pink); outline-offset: 2px; }
.overlay { position: fixed; inset: 0; background: rgba(23,27,75,.86); display: grid; place-items: center; z-index: 10; padding: 24px; }
.overlay .panel { max-width: 520px; text-align: center; }

@media (max-width: 760px) {
  #app { padding: 14px 14px 40px; }
  h1 { font-size: 32px; }
  .stem { font-size: 23px; }
  .skyline { height: 110px; gap: 4px; }
  .row { grid-template-columns: 1fr auto; }
  .row .meter { grid-column: 1 / -1; order: 3; }
  .nmatrix { grid-template-columns: repeat(3, 72px); }
}
@media (prefers-reduced-motion: no-preference) {
  .opt.correct { animation: pop .28s ease-out; }
  .opt.wrong { animation: shake .28s ease-out; }
  .skyline .bar { animation: grow .6s cubic-bezier(.2,.9,.3,1.2) both; transform-origin: bottom; }
  .skyline .bar:nth-child(n) { animation-delay: calc(var(--i) * 30ms); }
}
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes grow { from { transform: scaleY(.05); } }
