/* Sticker Badge Board refresh (2026-10). Loaded after style.css; visual only.
   Acton navy, green and cream; Nunito for text and numbers, DM Serif Display for titles. */
@font-face { font-family: 'Nunito'; src: url(/fonts/nunito-latin.woff2) format('woff2'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'DM Serif Display'; src: url(/fonts/dm-serif-display-latin.woff2) format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --navy: #0B2A4A; --green: #27AE60; --green-d: #1E8449; --green-l: #E8F5EE;
  --cream: #FAF8F5; --cream-2: #F3EEE6; --line: #E5E7EB; --muted: #667085;
  --learned: #3B82F6; --learned-d: #2563EB; --gold: #E9B949;
  --color-primary: #0B2A4A; --color-primary-light: #163B63; --color-primary-bg: #F3EEE6;
  --color-success: #27AE60; --color-success-bg: #E8F5EE;
  --color-text: #1D2939; --color-text-light: #667085; --color-bg: #FFFFFF; --color-border: #E5E7EB;
  --radius: 18px; --radius-sm: 12px;
  --shadow: none; --shadow-md: 0 2px 0 #E5E7EB; --shadow-lg: 0 12px 32px rgba(11,42,74,.08);
  --font-sans: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
}
body { font-weight: 700; background: #fff; }
h1, h2, .board-title h1 { font-family: var(--font-serif); font-weight: 400; color: var(--navy); letter-spacing: -.01em; }

/* Nav */
.top-nav { padding: .7rem 1.5rem; border-bottom: 2px solid var(--line); }
.nav-brand { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.nav-brand .mm-logo { display: block; flex: none; overflow: visible; filter: drop-shadow(0 2px 2px rgba(11,42,74,.18)); }
.nav-word { font-family: var(--font-sans); font-weight: 900; font-size: 1.3rem; letter-spacing: -.02em; color: var(--navy); line-height: 1; }
.nav-chip { background: var(--cream-2); color: var(--navy); font-weight: 900; padding: .3rem .7rem; }
.nav-name { color: var(--muted); font-weight: 800; }
.nav-link { color: var(--muted); font-weight: 800; }
.nav-avatar { border-radius: 50%; }

/* Buttons: flat with a solid bottom edge */
.btn { font-family: var(--font-sans); font-weight: 900; letter-spacing: .02em; border-radius: 14px; border: 0; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-d); }
.btn-primary:hover:not(:disabled) { background: #2DBE6A; box-shadow: 0 4px 0 var(--green-d); transform: none; }
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-d); }
.btn-secondary { background: #fff; color: var(--navy); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-sm { padding: .5rem 1rem; font-size: .9rem; border-radius: 12px; }
.card { border: 2px solid var(--line); border-radius: 22px; box-shadow: none; }

/* XP bars: mastered green then learned blue, no text under the bar */
.xp-bar, .progress-bar.xp-bar { display: flex; height: 12px; border-radius: 999px; background: #EDEFF3; overflow: hidden; }
.xp-mastered { background: var(--green); }
.xp-learned { background: var(--learned); }

/* Monsters (views/partials/monster.ejs) */
.mon { display: block; overflow: visible; filter: drop-shadow(0 3px 3px rgba(11,42,74,.20)); }
.mon .m-key * { fill: #fff; stroke: #fff; stroke-linejoin: round; stroke-linecap: round; }
.mon .m-body * { fill: var(--mc); stroke: var(--mc); }
.mon .m-face * { fill: #fff; }
.mon .m-face path.m-smile, .mon .m-done path { fill: none; stroke: #fff; stroke-width: 3.6; stroke-linecap: round; }
.mon .m-smile { stroke-width: 3; }
.mon .m-mark * { fill: #fff; opacity: .95; }
.mon .m-face { display: none; }
.mon.is-ready .m-ready, .mon.is-current .m-current, .mon.is-earned .m-done, .mon.is-celebrate .m-done { display: inline; }
.mon.is-earned .m-body * { fill: var(--ms); stroke: var(--ms); }
.mon.is-earned .m-done path { stroke: var(--mc); stroke-width: 4.6; }
.mon.is-earned .m-cel { display: none; }
.mon.is-earned .m-mark * { fill: var(--mc); }
.mon.is-celebrate .m-done path { stroke-width: 4.6; }
.mon.is-celebrate .m-done path.m-cel { stroke-width: 3.2; }
.mon.is-locked { filter: drop-shadow(0 2px 2px rgba(11,42,74,.08)); }
.mon.is-locked .m-body * { fill: #DCE0E6; stroke: #DCE0E6; }
.mon.is-locked .m-mark { display: none; }

/* Home: badge board */
.container.board { max-width: 960px; padding-top: 2.25rem; }
.board-head { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.board-title h1 { font-size: 2.6rem; line-height: 1.1; margin: 0; }
.board-title .subtitle { color: var(--muted); font-size: 1.05rem; margin-top: .35rem; }
.board .stats-bar { display: flex; gap: .75rem; margin: 0; background: none; border: 0; box-shadow: none; padding: 0; }
.board .stat { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: .7rem 1rem; min-width: 132px; text-align: left; display: flex; flex-direction: column; }
.board .stat-value { font-size: 1.6rem; font-weight: 900; color: var(--navy); line-height: 1.1; }
.board .stat-value small { font-size: .9rem; color: var(--muted); font-weight: 800; margin-left: 1px; }
.board .stat-label { white-space: nowrap; font-size: .8rem; color: var(--muted); font-weight: 800; text-transform: none; letter-spacing: 0; }

.now-card { display: flex; align-items: center; gap: 1.75rem; padding: 1.4rem 1.75rem; margin-bottom: 2.25rem; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 24px; background: #fff; text-decoration: none; color: inherit; }
.now-card:hover { border-color: #D0D5DD; }
.now-mon { flex: none; width: 168px; height: 168px; border-radius: 50%; background: var(--cream-2); display: grid; place-items: center; }
.now-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .5rem; }
.chip-now { align-self: flex-start; background: var(--green-l); color: var(--green-d); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; padding: .25rem .65rem; border-radius: 999px; }
.now-title { font-family: var(--font-serif); font-size: 1.9rem; color: var(--navy); line-height: 1.15; }
.xp-line { display: flex; flex-direction: column; gap: .4rem; margin: .25rem 0 .5rem; }
.xp-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); font-weight: 900; }
.xp-label b { color: var(--navy); font-size: 1rem; }
.now-btn { align-self: flex-start; padding: .8rem 2.4rem; font-size: 1.05rem; }

.board-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.75rem; }
.badge-section { margin-bottom: 2rem; min-width: 0; }
.badge-section.is-wide { grid-column: 1 / -1; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.section-head h2 { font-size: 1.6rem; margin: 0; }
.section-xp { font-size: .9rem; font-weight: 900; color: var(--navy); background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: .2rem .75rem; white-space: nowrap; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(134px, 1fr)); gap: .75rem; }
.badge-tile { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; padding: 1.1rem .9rem 1rem; background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 20px; text-decoration: none; color: inherit; transition: border-color .15s; }
a.badge-tile:hover { border-color: #D0D5DD; }
.badge-tile.is-now { border-color: var(--green); }
.badge-tile.is-locked { background: #FCFCFD; border-style: dashed; border-bottom-width: 2px; }
.tile-mon { position: relative; width: 100px; height: 100px; border-radius: 50%; background: var(--cream-2); display: grid; place-items: center; margin-bottom: .35rem; }
.is-locked .tile-mon { background: #F2F4F7; }
.tile-check, .tile-lock { position: absolute; right: 2px; bottom: 2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 3px solid #fff; }
.tile-check { background: var(--green); }
.tile-lock { background: #E4E7EC; color: #98A2B3; }
.is-earned .tile-mon { box-shadow: 0 0 0 4px var(--gold); }
.tile-title { font-weight: 900; font-size: .92rem; color: var(--navy); line-height: 1.2; }
.is-locked .tile-title { color: #98A2B3; }
.tile-note { font-size: .8rem; color: #98A2B3; font-weight: 800; line-height: 1.3; }
.tile-xp { font-size: .85rem; font-weight: 900; color: var(--muted); }
.tile-xp-wrap { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 100%; max-width: none; }
.badge-tile .xp-bar { width: 100%; height: 9px; }
.xp-dashboard.xp-line, .now-card .xp-dashboard { max-width: none; }
.board .mm-tip-bubble { right: auto; left: 50%; transform: translate(-50%, -4px); }
.board .mm-tip:hover .mm-tip-bubble, .board .mm-tip:focus .mm-tip-bubble, .board .mm-tip:focus-within .mm-tip-bubble { transform: translate(-50%, 0); }
.tile-chip { margin-top: .35rem; font-size: .75rem; font-weight: 900; color: var(--navy); background: var(--cream-2); border-radius: 999px; padding: .15rem .65rem; }
.tile-chip.chip-earned { background: var(--green-l); color: var(--green-d); }

.retention-section { margin-top: .5rem; }
.retention-card { background: #fff; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 20px; box-shadow: none; }
.retention-card-icon { background: var(--cream-2); color: var(--navy); }

/* Challenge page (problems) */
.challenge-container { max-width: 720px; padding-top: 1.4rem; }
.challenge-data-bar { border: 0; border-radius: 0; padding: 0; margin-bottom: 1rem; box-shadow: none; background: none; }
.data-bar-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.back-btn { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); display: grid; place-items: center; color: var(--muted); background: #fff; }
.back-btn:hover { border-color: #D0D5DD; color: var(--navy); }
.data-bar-who { flex: 1; min-width: 0; }
.data-bar-kicker { display: block; font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--green-d); }
.challenge-data-bar .data-bar-title { font-family: var(--font-serif); font-weight: 400; font-size: 1.75rem; color: var(--navy); margin: 0; line-height: 1.1; }
.challenge-data-bar .data-bar-stats { display: flex; gap: .5rem; margin: 0; }
.challenge-data-bar .data-bar-stat { display: flex; align-items: baseline; gap: .4rem; text-align: left; border-radius: 14px; padding: .4rem .8rem; }
.stat-learned { background: #EFF5FF; } .stat-learned .data-bar-label { color: var(--learned-d); }
.stat-mastered { background: var(--green-l); } .stat-mastered .data-bar-label { color: var(--green-d); }
.challenge-data-bar .data-bar-value { display: inline; font-size: 1.35rem; font-weight: 900; }
.challenge-data-bar .data-bar-label { font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.challenge-data-bar .xp-progress { display: flex; align-items: center; gap: .8rem; max-width: none; }
.challenge-data-bar .xp-bar { flex: 1; margin: 0; }
.challenge-data-bar .data-bar-pct { flex: none; order: 2; margin: 0; text-align: right; font-size: .95rem; font-weight: 900; color: var(--navy); white-space: nowrap; }

.challenge-problem-area.stage { position: relative; margin-top: 4.6rem; border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 28px; padding: 4.2rem 1.5rem 2.2rem; box-shadow: none; background: #fff; }
.stage-face { position: absolute; left: 50%; top: -58px; transform: translateX(-50%); width: 116px; height: 116px; border-radius: 50%; background: var(--cream-2); border: 6px solid #fff; display: grid; place-items: center; }
.stage-top { position: absolute; left: 1.2rem; right: 1.2rem; top: .9rem; display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; pointer-events: none; }
.stage-top > * { pointer-events: auto; }
.variation-label { text-align: left; max-width: calc(50% - 72px); line-height: 1.6; margin: 0; font-size: .75rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.variation-label .window-count { display: block; letter-spacing: .02em; text-transform: none; font-weight: 800; }
.progress-dot.filled { background: var(--green); }
.run-streak { flex: none; display: inline-flex; align-items: center; gap: .25rem; background: var(--cream-2); color: var(--navy); border-radius: 999px; padding: .3rem .7rem; }
.run-streak-number { font-weight: 900; font-size: .95rem; color: var(--navy); }
.run-streak-label { font-weight: 800; font-size: .75rem; color: var(--muted); text-transform: none; }
.stage .fluency-timer { max-width: 440px; margin: 0 auto 1rem; }
.stage .problem-visual-area { max-width: 440px; margin-left: auto; margin-right: auto; }
.challenge-operand, .challenge-operator, .challenge-equals { font-family: var(--font-sans); font-weight: 900; color: var(--navy); }
.challenge-operator, .challenge-equals { color: #98A2B3; }
.challenge-operand.challenge-blank { background: var(--cream-2); border: 0; border-bottom: 4px solid #E4DCCF; border-radius: 16px; min-width: 74px; padding: .35rem .7rem; line-height: 1; color: var(--navy); }
.challenge-answer-input { font-family: var(--font-sans); font-weight: 900; color: var(--navy); border: 2.5px solid var(--navy); border-radius: 16px; width: 150px; height: 62px; }
.challenge-answer-input.answer-wide { width: 200px; }
.submit-answer-btn { height: 62px; padding: 0 2.2rem; border-radius: 16px; font-size: 1.15rem; }
.mic-btn { width: 62px; height: 62px; border-radius: 16px; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); background: #fff; }

/* Progress grid */
.fact-grid-section { margin-top: 2.2rem; }
.grid-legend { justify-content: flex-end; gap: .9rem; font-size: .78rem; color: var(--muted); font-weight: 800; margin-bottom: .8rem; }
.grid-legend-swatch { border-radius: 3px; border: 0; }
.grid-legend-swatch.not-started { background: #F5F6F8; box-shadow: inset 0 0 0 1px #E4E7EC; }
.grid-legend-swatch.in-progress { background: #FFF4DC; }
.grid-legend-swatch.accurate { background: #E3EDFF; }
.grid-legend-swatch.mastered { background: #DDF3E6; }
.grid-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .8rem; }
.grid-title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: 1.3rem; color: var(--navy); }
.grid-head .grid-legend { margin: 0; }
.fact-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 5px; margin-top: 0; }
.fact-cell { font-size: .72rem; padding: .42rem 0; }
.challenge-operand { font-size: 3.6rem; }
.challenge-operator, .challenge-equals { font-size: 2.8rem; }
.fact-cell { border: 0; border-radius: 9px; background: #F5F6F8; color: #98A2B3; font-family: var(--font-sans); font-weight: 800; box-shadow: none; }
.fact-cell.in-progress { background: #FFF4DC; color: #9A6A12; }
.fact-cell.accurate { background: #E3EDFF; color: #2D5FC4; }
.fact-cell.mastered { background: #DDF3E6; color: #1E8449; }
.fact-cell .fact-check, .fact-cell .fact-accurate-mark, .fact-cell .fact-streak, .skill-cell .fact-check, .skill-cell .fact-accurate-mark, .skill-cell .fact-streak { display: none; }
.skill-cell { border: 0; border-radius: 12px; background: #F5F6F8; color: var(--muted); font-family: var(--font-sans); font-weight: 800; box-shadow: none; }
.skill-cell.in-progress { background: #FFF4DC; color: #9A6A12; }
.skill-cell.accurate { background: #E3EDFF; color: #2D5FC4; }
.skill-cell.mastered { background: #DDF3E6; color: #1E8449; }
.fact-grid-section .grid-toggle { width: auto; background: none; color: var(--muted); font-family: var(--font-sans); font-weight: 900; font-size: .95rem; }

/* Celebrate page (complete) */
.container.celebrate { max-width: 560px; padding-top: 3rem; text-align: center; }
.celebrate-hero { position: relative; width: 300px; height: 250px; margin: 0 auto; }
.celebrate-ring { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); width: 200px; height: 200px; border-radius: 50%; background: var(--cream-2); box-shadow: 0 0 0 8px var(--gold); display: grid; place-items: center; }
.celebrate-check { position: absolute; right: 6px; bottom: 6px; width: 46px; height: 46px; border-radius: 50%; background: var(--green); border: 4px solid #fff; display: grid; place-items: center; }
.cf { position: absolute; font-weight: 900; font-size: 1.5rem; line-height: 1; opacity: .85; }
.celebrate-kicker { margin-top: .6rem; font-size: .8rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--green-d); }
.container.celebrate h1 { font-size: 2.8rem; line-height: 1.1; margin: .25rem 0 .5rem; }
.celebrate-sub { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.8rem; text-wrap: balance; }
.celebrate-xp { display: flex; align-items: center; gap: .8rem; max-width: 400px; margin: 0 auto; }
.celebrate-bar { flex: 1; height: 14px; border-radius: 999px; background: var(--green); }
.celebrate-xpl { font-weight: 900; color: var(--navy); white-space: nowrap; }
.celebrate-pills { display: flex; justify-content: center; gap: .6rem; margin: 1.1rem 0 2.2rem; }
.celebrate-pill { border-radius: 14px; padding: .5rem .95rem; display: flex; align-items: baseline; gap: .4rem; background: var(--cream-2); }
.celebrate-pill b { font-size: 1.3rem; font-weight: 900; color: var(--navy); }
.celebrate-pill span { font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.celebrate-pill.is-mastered { background: var(--green-l); }
.celebrate-pill.is-mastered b { color: var(--green); }
.celebrate-pill.is-mastered span { color: var(--green-d); }
.celebrate-btn { display: flex; width: 100%; max-width: 400px; margin: 0 auto; justify-content: center; padding: 1rem; font-size: 1.1rem; border-radius: 16px; }

@media (max-width: 640px) {
  .top-nav { padding: .6rem .9rem; gap: .5rem; }
  .nav-brand { white-space: nowrap; font-size: 1.1rem; gap: .45rem; }
  .nav-brand .mm-logo { width: 30px; height: 30px; }
 .nav-word { font-size: 1.1rem; }
  .nav-right { gap: .45rem; }
  .nav-chip { padding: .25rem .55rem; font-size: .85rem; white-space: nowrap; }
  .nav-name { display: none; }
  .nav-link { font-size: .8rem; white-space: nowrap; }
  .container.board { padding: 1.25rem 1rem 3rem; }
  .board-title h1 { font-size: 2rem; }
  .board .stats-bar { width: 100%; }
  .board .stat { flex: 1; min-width: 0; padding: .6rem .7rem; }
  .board .stat-value { font-size: 1.35rem; }
  .board .stat-label { font-size: .72rem; white-space: normal; line-height: 1.2; }
  .now-card { flex-direction: column; text-align: center; gap: 1rem; padding: 1.25rem; }
  .now-body { width: 100%; }
  .chip-now, .now-btn { align-self: center; }
  .now-btn { width: 100%; justify-content: center; display: flex; }
  .now-mon { width: 140px; height: 140px; }
  .board-sections { grid-template-columns: 1fr; }
  .badge-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
  .tile-mon { width: 92px; height: 92px; }
  .section-head h2 { font-size: 1.35rem; }
   .challenge-container { padding: 1rem 1rem 2rem; }
 .data-bar-top { flex-wrap: wrap; gap: .7rem; }
 .back-btn { width: 36px; height: 36px; }
 .challenge-data-bar .data-bar-title { font-size: 1.4rem; }
 .challenge-data-bar .data-bar-stats { width: 100%; }
 .challenge-data-bar .data-bar-stat { flex: 1; padding: .45rem .7rem; }
 .challenge-problem-area.stage { margin-top: 3.9rem; padding: 3.7rem .9rem 1.6rem; }
 .stage-face { width: 100px; height: 100px; top: -50px; }
 .stage-face .mon { width: 88px; height: 88px; }
 .stage-top { position: static; justify-content: center; align-items: center; margin-bottom: .6rem; }
 .variation-label { font-size: .68rem; max-width: none; text-align: center; }
 .challenge-answer-input { width: 128px; height: 58px; }
 .submit-answer-btn { height: 58px; padding: 0 1.6rem; }
 .mic-btn { width: 58px; height: 58px; }
 .fact-grid-section { text-align: center; }
 .grid-head { justify-content: center; }
 .fact-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
 .challenge-operand { font-size: 3rem; }
 .challenge-operator, .challenge-equals { font-size: 2.3rem; }
  .container.celebrate { padding: 2.2rem 1.25rem 2rem; }
 .celebrate-hero { width: 280px; height: 230px; }
 .celebrate-ring { width: 180px; height: 180px; }
 .celebrate-ring .mon { width: 136px; height: 136px; }
  .container.celebrate h1 { font-size: 2.2rem; }
}
/* Phones: the nav must never be wider than the screen (a wide page makes iOS zoom out).
   The wordmark sits on a hidden second line of the brand box, so it shows only when it fits
   next to the chips, avatar and Log out; otherwise the logo stands alone. If even that is too
   wide, the right side wraps instead of pushing past the edge. */
@media (max-width: 640px) {
  .nav-brand { display: flex; flex-wrap: wrap; align-content: flex-start; row-gap: 40px; flex: 1 1 auto; min-width: 34px; height: 36px; padding: 2px 2px 4px; margin: -2px -2px -4px; overflow: hidden; } /* padding keeps the logo's drop shadow */
  .nav-right { flex: none; max-width: calc(100% - 38px); flex-wrap: wrap; justify-content: flex-end; row-gap: .35rem; }
  /* Nav tooltips hang from the whole nav bar, not their chip, so a 240px bubble can't run off the left edge. */
  .top-nav .mm-tip { position: static; }
  .top-nav .mm-tip-bubble { right: .75rem; top: calc(100% + 4px); max-width: min(240px, calc(100% - 1.5rem)); }
  .mm-tip-bubble { max-width: min(240px, calc(100vw - 24px)); }
}

/* Quiet brand line on every page */
.acton-foot { text-align: center; font-family: var(--font-sans); font-size: 12px; font-weight: 700; color: #98A2B3; padding: 28px 16px 32px; }
.acton-foot a { color: inherit; text-decoration: underline; text-decoration-color: #D0D5DD; text-underline-offset: 2px; }
.acton-foot a:hover { color: var(--muted); }

/* Answer area: a soft answer slot, one big Check button, then a quiet row of icon tools */
.stage .answer-row { flex-direction: column; gap: 0; margin: 1.1rem 0 0; }
.stage .challenge-answer-form { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; width: 100%; }
.stage .challenge-answer-input {
  background: var(--cream); border: 2px solid #E9E2D6; border-radius: 16px;
  caret-color: var(--green); transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.stage .challenge-answer-input::placeholder { color: #C9BFAF; }
.stage .challenge-answer-input:focus { outline: none; background: #fff; border-color: var(--green); box-shadow: 0 0 0 4px rgba(39, 174, 96, .14); }
.stage .challenge-answer-input:disabled { opacity: 1; color: var(--navy); }
.stage:has(.challenge-fb.correct) .challenge-answer-input { background: var(--green-l); border-color: #A9DDBF; color: var(--green-d); box-shadow: none; }
.stage:has(.challenge-fb.incorrect) .challenge-answer-input { background: #FEF3F2; border-color: #F6C8C3; box-shadow: none; }
.stage .submit-answer-btn {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; padding: 0 1.5rem;
  border-radius: 16px; font-size: 1.2rem; letter-spacing: .03em; box-shadow: 0 5px 0 var(--green-d); margin-bottom: 5px;
}
.stage .submit-answer-btn:hover:not(:disabled) { box-shadow: 0 5px 0 var(--green-d); }
.stage .submit-answer-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--green-d); }
.stage .submit-answer-btn:focus-visible { outline: 3px solid rgba(39, 174, 96, .35); outline-offset: 3px; }
.stage .answer-hint { margin-top: .5rem; }
.stage .answer-hint:empty { display: none; }
.stage .challenge-feedback { margin-top: 1rem; min-height: 0; }
.stage .challenge-feedback:empty { margin-top: 0; }
.answer-tools { display: flex; justify-content: center; align-items: center; gap: .6rem; margin-top: 1rem; }
.answer-tools:not(:has(.help-btn, .mic-btn[style*="flex"])) { display: none; }
.stage .answer-tools .mic-btn, .stage .answer-tools .help-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); box-shadow: none; background: #fff;
  color: var(--muted); font-family: var(--font-sans); font-size: 1rem; font-weight: 900;
}
.stage .answer-tools .mic-btn:hover, .stage .answer-tools .help-btn:hover { border-color: #D0D5DD; color: var(--navy); background: #fff; }
.stage .answer-tools .mic-btn.voice-active { border-color: var(--green); color: var(--green-d); background: var(--green-l); }
.stage .answer-tools .mic-btn.listening { border-color: #EF4444; color: #EF4444; background: #FEE2E2; }
.stage .answer-tools button:focus-visible { outline: 3px solid rgba(39, 174, 96, .35); outline-offset: 2px; }

/* Stacked (vertical) problems: the answer slot sits under the line, right-aligned with the digits, centered with the problem */
.problem-stack.is-stacked { --slot-pad: 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.problem-stack.is-stacked > * { grid-column: 1 / -1; }
.problem-stack.is-stacked > .problem-visual-area { grid-column: 2; margin: 0; max-width: none; overflow: visible; }
.problem-stack.is-stacked .md-stacked { display: flex; margin: .25rem 0 0; }
.problem-stack.is-stacked .challenge-skill-prompt:empty { display: none; }
.problem-stack.is-stacked .answer-row, .problem-stack.is-stacked .challenge-answer-form { display: contents; }
.problem-stack.is-stacked .challenge-answer-input,
.problem-stack.is-stacked .challenge-answer-input.answer-wide {
  grid-column: 2; justify-self: center; contain: inline-size; min-width: 0; max-width: none;
  width: calc(100% + 2 * var(--slot-pad)); height: auto; margin: .7rem calc(-1 * var(--slot-pad)) 0; padding: .2rem calc(var(--slot-pad) - 2px) .1rem var(--slot-pad);
  text-align: right; font-family: var(--font-serif); font-size: 2.5rem; font-weight: 700; letter-spacing: .15em; line-height: 1.25; color: var(--navy);
}
.problem-stack.is-stacked .submit-answer-btn { grid-column: 1 / -1; margin-top: 1.25rem; }
@media (max-width: 600px) {
  .problem-stack.is-stacked { --slot-pad: 14px; }
  .problem-stack.is-stacked .challenge-answer-input,
  .problem-stack.is-stacked .challenge-answer-input.answer-wide { font-size: 1.8rem; letter-spacing: .1em; }
}
.challenge-problem-area.stage { padding-bottom: 1.6rem; }
@media (max-width: 640px) {
  .challenge-problem-area.stage { padding-bottom: 1.25rem; }
  .stage .submit-answer-btn { height: 58px; }
}
