/*
  Styles for the login gate and the Math warmup drill.
  Layered on top of style.css — reuses the same CSS variables/fonts.
*/

/* ---------- Login page ---------- */

.auth-shell {
  min-height: calc(100vh - 84px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: min(400px, 100%);
  padding: 36px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 8px;
  font-family: "Bungee", sans-serif;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.auth-card p:not(.eyebrow) {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 0.9rem;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
}

.field input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Password visibility toggle (2026-08-21) — button sits inside the field,
   right-aligned, over the input's own padding. */
.password-field {
  position: relative;
}

.password-field input {
  padding-right: 72px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--primary-dark);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle:hover {
  background: var(--secondary);
  color: var(--text);
}

.auth-submit {
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin-top: 8px;
}

.auth-error {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fdecec;
  color: #9b2c2c;
  font-size: 0.9rem;
  font-weight: 600;
  display: none;
}

.auth-error.visible {
  display: block;
}

/* ---------- Math warmup drill ---------- */

.drill-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.logout-link {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.session-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.session-controls select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.drill-card {
  padding: 40px 32px;
  text-align: center;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  overflow: hidden;
  margin-bottom: 28px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
  transition: width 0.25s ease;
}

.prompt-skill {
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.prompt-text {
  font-family: "Bungee", sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

/* Superscript characters (², ³) embedded in fact templates — Bungee has no
   real small-caps/superscript metrics, so shrink + raise them by hand.
   2026-08-23: switched from `vertical-align: super` to an explicit
   `position: relative; top:` offset — `super`'s raise amount is computed
   against the surrounding line's baseline, which got unpredictable once a
   preceding .prompt-paren (below) could be taller than the line; a fixed
   offset is deterministic regardless of what's next to it. Pinned to at
   least the top of a tall paren, per the user ("at least ... top of the
   parenthesis") — may still need a real-browser pass to fine-tune (no
   browser in this environment — see PROJECT.md). */
.prompt-sup {
  position: relative;
  top: -0.8em; /* was -0.65em — the new e2e suite measured it landing ~1.4px
                  below the paren's top instead of at/above it (2026-08-24,
                  first real-browser confirmation of this) */
  font-size: 0.55em;
  line-height: 0;
}

/* Parentheses, taller than whatever they envelop — text or the answer box
   (2026-08-23, applied everywhere a prompt has "(" ")", per the user: sin
   (30°), (−4)², a masked (□°) — modest scale, not exaggerated).
   2026-08-23: dropped `transform: scaleY()` — transforms are paint-only,
   they don't affect layout, so a same-line sibling (like .prompt-sup right
   after a closing paren) was computing its position against the paren's
   UN-scaled box, causing exactly the misalignment reported. A bigger
   `font-size` alone still reads as "taller" and keeps layout/baseline
   calculations honest for whatever sits next to it. */
.prompt-paren {
  display: inline-block;
  font-size: 1.5em;
  line-height: 1;
  vertical-align: middle;
  color: var(--text);
}

/* A small, spaced-out connector word inside a [bracketed] template segment
   (2026-08-23, arithmetic_words' "3 [AND] 4") — brackets themselves are
   stripped before this ever renders. The margin is what visually spaces
   the two numbers apart. */
.prompt-connector {
  display: inline-block;
  margin: 0 0.4em;
  font-size: 0.5em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: middle;
}

/* First line of a multi-line prompt (arithmetic_words' "ADD" / "3 AND 4" /
   □ layout) — styled BIG (2026-08-23: it's the dominant element now, e.g.
   the operation name, not a small label above the numbers). */
.prompt-label-line {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 1.3em;
  color: var(--text);
}

/* Extra breathing room before the answer box on a multi-line prompt
   (2026-08-23) — see the `.includes("\n")` check in renderPrompt(). */
.prompt-input-gap {
  height: 14px;
}

/* The answer box lives inline, in place of the □ in the equation itself
   (e.g. "1² = [___]") rather than in a disconnected box below it. No CSS
   `width` set HERE — fastmath-app.js sets it inline, in `ch` units, and
   grows/shrinks it live as the student types (2026-08-23: switched from
   the HTML `size` attribute to explicit CSS width — see the comment in
   renderPrompt() for why); min-width below is just a floor so a 1–2
   character box stays tappable.
   2026-08-23: vertical padding bumped up (was 4px top/bottom) so the box's
   HEIGHT matches the now-taller LHS (parens, boxed numbers) rather than
   looking short next to it — kept equal between this and the --tight
   variant below on purpose, so only width/font shrink there, not height. */
.prompt-inline-input {
  display: inline-block;
  min-width: 56px;
  margin: 0 4px;
  padding: 12px 10px;
  font: inherit;
  font-size: 0.75em;
  text-align: center;
  color: var(--text);
  background: var(--surface-strong);
  border: 3px solid var(--border);
  border-radius: 10px;
  vertical-align: middle;
}

/* Smaller box specifically when the prompt has parentheses (2026-08-23) —
   next to a taller ( ), the normal-size box read as oversized/competing
   for attention; shrinking it keeps the parens the visually dominant
   "this is grouped" cue. See the `.includes("(")` check in renderPrompt().
   Vertical padding intentionally NOT reduced here — see the comment above. */
.prompt-inline-input--tight {
  min-width: 44px;
  padding: 12px 7px;
  font-size: 0.6em;
}

/* "Canvas" boxes around each operand on arithmetic_words' numbers line
   (2026-08-23, "two large canvas areas... aligned with the input box") —
   same border/radius/padding as .prompt-inline-input so the numbers line
   visually matches the answer box below it. Comes from a |piped| template
   segment (see fastmath-app.js's SPECIAL regex) — separate from
   .prompt-connector, which is the small word between two of these boxes. */
.prompt-number-box {
  display: inline-block;
  min-width: 56px;
  margin: 0 6px;
  padding: 12px 10px;
  border: 3px solid var(--border);
  border-radius: 10px;
  background: var(--surface-strong);
  text-align: center;
  vertical-align: middle;
}

.prompt-inline-input:focus {
  outline: 3px solid var(--secondary);
  outline-offset: 2px;
}

.prompt-inline-input:disabled {
  opacity: 0.75;
}

/* Explicit submit control (2026-08-21) — a typed answer previously had no
   visible way to submit, only Enter. */
.answer-continue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

/* Disabled until the box has something in it (2026-08-28) — style.css's
   .button has no disabled state, so without this it keeps the full yellow
   fill, hard shadow, and press animation while doing nothing. */
.answer-continue .button:disabled {
  cursor: not-allowed;
  background: var(--cream);
  border-color: var(--muted);
  color: var(--muted);
  box-shadow: none;
}

.answer-continue .button:disabled:hover,
.answer-continue .button:disabled:active {
  transform: none;
  box-shadow: none;
}

.answer-continue-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Floating symbol palette (2026-08-21) — trig answers are free text now,
   but √ isn't on a keyboard. A few insert-at-cursor buttons under the
   prompt, shown only for text-kind items. */
.symbol-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}

.symbol-key {
  min-width: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.symbol-key:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.answer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}

.chip-btn {
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.chip-btn:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

/* Hint cards (2026-08-21) — same contrast-lines/exposure-table content the
   old mid-session remediation popup used, now rendered into the
   end-of-session summary instead (#hints-review in fastmath.html). */
#hints-review h3 {
  margin: 8px 0 14px;
  font-family: "Bungee", sans-serif;
  font-size: 1.1rem;
}

.hint-card {
  padding: 20px;
  margin-bottom: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.hint-skill {
  margin: 0 0 10px;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 800;
}

.contrast-lines {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.contrast-lines div {
  padding: 14px;
  border-radius: 14px;
  background: var(--accent);
  font-family: "Bungee", sans-serif;
  font-size: 1.2rem;
}

.exposure-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.exposure-table th,
.exposure-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.exposure-table th {
  background: var(--accent);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.summary-stat {
  padding: 18px;
  border-radius: 18px;
  background: var(--accent);
  text-align: center;
}

.summary-stat .value {
  display: block;
  font-family: "Bungee", sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.summary-stat .label {
  color: var(--muted);
  font-size: 0.85rem;
}

#mistakes-review h3 {
  margin: 8px 0 14px;
  font-family: "Bungee", sans-serif;
  font-size: 1.1rem;
}

/* Grouped by topic (2026-08-21) — native <details>/<summary> so each topic
   is click-to-expand, closed by default, no JS toggle logic needed. */
.mistake-group {
  margin-bottom: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  overflow: hidden;
}

.mistake-group-summary {
  padding: 14px 16px;
  cursor: pointer;
  font-family: "Bungee", sans-serif;
  font-size: 0.92rem;
  list-style: none; /* hide the default marker, ::-webkit-details-marker below covers Chrome/Safari */
}

.mistake-group-summary::-webkit-details-marker {
  display: none;
}

.mistake-group-summary::before {
  content: "▸ ";
  color: var(--primary-dark);
}

.mistake-group[open] .mistake-group-summary::before {
  content: "▾ ";
}

.mistake-group .mistake-list {
  padding: 0 16px 16px;
}

.mistake-list {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
}

.mistake-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--accent);
  text-align: left;
}

.mistake-prompt {
  font-family: "Bungee", sans-serif;
  font-size: 1rem;
}

.mistake-answer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.85rem;
}

.mistake-given {
  color: var(--muted);
  text-decoration: line-through;
}

.mistake-correct {
  font-weight: 800;
  color: var(--primary-dark);
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .drill-card {
    padding: 26px 20px;
  }
}
