*{box-sizing:border-box}:root{--bg:#eef2f7;--panel:#fff;--alt:#f6f8fb;--border:#cbd5e1;--text:#172033;--muted:#64748b;--accent:#335da8;--accent2:#e7eefb;--hero:#4f8c64;--enemy:#b45656;--warning:#b91c1c;--ten:#4f78c4;--one:#e0a43a}body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,"Segoe UI",sans-serif}button,input{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:not-allowed}.game-shell{width:min(1050px,calc(100% - 20px));margin:10px auto 32px;display:grid;gap:12px}.battle-panel,.problem-panel{background:var(--panel);border:1px solid var(--border);border-radius:18px}.battle-panel{padding:14px 16px}.problem-panel{padding:20px}.topbar{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.eyebrow{font-size:.74rem;font-weight:900;letter-spacing:.08em;color:var(--muted)}.muted{color:var(--muted)}.stats{display:flex;gap:8px}.stats span{background:var(--alt);border:1px solid var(--border);border-radius:10px;padding:7px 10px}.battle-stage{position:relative;display:grid;grid-template-columns:1fr minmax(170px,230px) 1fr;align-items:end;gap:14px;min-height:230px;margin-top:10px;padding:14px 16px;border-radius:16px;overflow:hidden;background:linear-gradient(#dceefa 0 58%,#d9e9cb 58%)}.fighter{position:relative;z-index:2;min-width:0}.enemy{text-align:right}.fighter-title{display:flex;gap:8px;align-items:center;font-weight:900}.fighter-title span{font-size:.8rem;color:var(--muted)}.enemy-title{justify-content:flex-end}.hp-line{display:flex;align-items:center;gap:7px;font-size:1.35rem;margin-top:5px}.enemy-hp{justify-content:flex-end}.hp-track{height:20px;max-width:245px;border-radius:999px;overflow:hidden;background:#fff;border:1px solid #9ca3af;margin-top:5px}.enemy-track{margin-left:auto}.hp-fill{height:100%;width:100%;transition:width .35s}.hero-fill{background:var(--hero)}.enemy-fill{background:var(--enemy)}.sprite-wrap{position:relative;min-height:115px;display:flex;align-items:flex-end}.enemy-wrap{justify-content:flex-end}.sprite{font-size:clamp(4.2rem,8vw,6.4rem);line-height:1;filter:drop-shadow(0 8px 5px #0002)}.intent-column{align-self:stretch;display:flex;flex-direction:column;justify-content:center;gap:8px}.battle-message{text-align:center;font-size:.78rem;font-weight:1000;letter-spacing:.08em;color:var(--muted)}.intent-card{background:#fffffff2;border:2px solid var(--border);border-radius:14px;padding:10px;text-align:center}.intent-card.danger{border-color:var(--warning);animation:pulse .8s infinite alternate}.intent-title{font-size:.69rem;font-weight:900;letter-spacing:.07em;color:var(--muted)}.intent-name{font-weight:1000;margin-top:3px}.intent-damage{font-size:1.15rem;font-weight:1000;margin-top:3px}.intent-card.danger .intent-damage{color:var(--warning)}.intent-note{font-size:.68rem;color:var(--muted);margin-top:4px}.damage-pop{position:absolute;top:22%;left:50%;transform:translateX(-50%);font-size:2rem;font-weight:1000;color:var(--warning);text-shadow:0 2px #fff;z-index:8}.enemy .damage-pop{left:55%}.shield-flash{position:absolute;left:45%;bottom:26px;font-size:4rem;z-index:8}.impact{position:absolute;right:22%;top:48%;font-size:4rem;z-index:9}.impact.power{font-size:5rem}.skills{padding:2px 0}.skill-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-top:7px}.skill{min-height:70px;text-align:left;padding:10px 12px;border:1px solid var(--border);border-radius:13px;background:#fff;color:var(--text)}.skill b,.skill small{display:block}.skill small{color:var(--muted);margin-top:4px;line-height:1.25}.skill.active{border-color:var(--accent);background:var(--accent2)}.skill.locked{background:#f1f5f9}.problem-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}.solve-label{margin-top:5px;color:var(--muted);font-size:.92rem;font-weight:700}.problem{font-size:clamp(2.7rem,7vw,4.6rem);font-weight:1000;margin-top:4px;line-height:1.05}.effect{text-align:right}.effect span,.effect b{display:block}.effect span{font-size:.78rem;color:var(--muted)}.answer-row{display:flex;align-items:end;gap:12px;margin-top:18px}.answer-row label{flex:1;font-weight:900}.answer-row input{display:block;width:100%;min-height:58px;margin-top:5px;border:2px solid var(--border);border-radius:12px;padding:8px 14px;font-size:1.9rem;font-weight:1000}.attack-button{min-height:58px}.primary,.secondary,.tool,.block-add{border-radius:10px;border:1px solid var(--border);padding:9px 15px;font-weight:900}.primary{background:var(--accent);border-color:var(--accent);color:#fff}.secondary,.tool,.block-add{background:#fff;color:var(--text)}.assist-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.hint{margin-top:12px;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--alt)}.workspace{margin-top:14px;padding:14px;background:var(--alt);border-radius:14px}.workspace-head h2{font-size:1.04rem;margin:0}.workspace-head p{margin:3px 0 0;color:var(--muted)}.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.tool.active{background:var(--accent2);border-color:var(--accent)}.ten-add{border-left:8px solid var(--ten)}.one-add{border-left:8px solid var(--one)}.danger{color:#a33}.board{min-height:225px;margin-top:13px;border:2px dashed var(--border);border-radius:14px;background:#fff;padding:16px}.empty{min-height:190px;display:grid;place-items:center;text-align:center;color:var(--muted)}.placed{min-height:190px;display:flex;align-items:flex-end;flex-wrap:wrap;gap:16px}.block-group{display:flex;align-items:flex-end;flex-wrap:wrap;gap:7px}.math-block{position:relative;display:grid;place-items:center;border:2px solid #17203344;font-weight:900}.math-block.ten{width:38px;height:150px;border-radius:7px;background:repeating-linear-gradient(to bottom,#ffffff2e 0,#ffffff2e 13px,#00000014 14px,#00000014 15px),var(--ten)}.math-block.one{width:38px;height:38px;border-radius:7px;background:var(--one)}.math-block.crossed{opacity:.55}.math-block.crossed:before,.math-block.crossed:after{content:"";position:absolute;left:4px;right:4px;top:50%;height:4px;background:#1f2937}.math-block.crossed:before{transform:rotate(45deg)}.math-block.crossed:after{transform:rotate(-45deg)}.feedback{min-height:28px;margin-top:12px;font-weight:800}.result{margin-top:14px;padding:16px;border-radius:14px;border:1px solid var(--accent);background:var(--accent2)}.reward-row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0 13px}.reward-pill{padding:7px 10px;border:1px solid var(--border);border-radius:999px;background:#fff;font-weight:800}.unlock-card{display:flex;gap:12px;align-items:center;padding:14px;border:1px solid var(--border);border-radius:14px;background:#fff;margin:12px 0}.unlock-icon{font-size:3rem}.unlock-card h3{margin:3px 0}.unlock-card p{margin:0;color:var(--muted)}.tutorial-overlay{position:fixed;inset:0;display:grid;place-items:center;padding:18px;background:#0f172a99;z-index:50}.tutorial-card{width:min(500px,100%);padding:22px;border-radius:18px;background:#fff;text-align:center}.tutorial-icon{font-size:4rem}.warning{margin:14px auto;padding:13px;border:2px solid var(--warning);border-radius:12px;color:var(--warning);font-weight:1000;max-width:250px}.tutorial-actions{display:flex;gap:8px;justify-content:center;flex-wrap:wrap}.hidden{display:none!important}.hero-lunge{animation:heroLunge .42s}.enemy-lunge{animation:enemyLunge .42s}.hit-shake{animation:shake .35s}.flash{animation:flash .32s}.pop{animation:pop .62s forwards}.slash-pop{animation:slash .36s forwards}.power-pop{animation:power .5s forwards}.shield-pop{animation:shield .5s forwards}@keyframes heroLunge{45%{transform:translateX(58px) scale(1.05)}}@keyframes enemyLunge{45%{transform:translateX(-58px) scale(1.05)}}@keyframes shake{20%{transform:translateX(-9px)}40%{transform:translateX(9px)}60%{transform:translateX(-7px)}80%{transform:translateX(7px)}}@keyframes flash{50%{filter:brightness(2.2) saturate(.2)}}@keyframes pop{0%{opacity:0;transform:translate(-50%,12px)}20%{opacity:1}100%{opacity:0;transform:translate(-50%,-42px)}}@keyframes slash{0%{opacity:0;transform:scale(.4) rotate(-20deg)}45%{opacity:1;transform:scale(1.3) rotate(10deg)}100%{opacity:0;transform:scale(.8) rotate(25deg)}}@keyframes power{0%{opacity:0;transform:scale(.25)}50%{opacity:1;transform:scale(1.7)}100%{opacity:0;transform:scale(.8)}}@keyframes shield{0%{opacity:0;transform:scale(.4)}50%{opacity:1;transform:scale(1.2)}100%{opacity:0;transform:scale(.8)}}@keyframes pulse{to{box-shadow:0 0 0 5px #b91c1c1f}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}}@media(max-width:760px){.skill-grid{grid-template-columns:repeat(2,1fr)}.battle-stage{grid-template-columns:1fr 145px 1fr;padding:11px;gap:7px}.problem-head{flex-direction:column}.effect{text-align:left}}@media(max-width:520px){.battle-stage{grid-template-columns:1fr 105px 1fr;min-height:220px}.sprite{font-size:4.3rem}.intent-note{display:none}.intent-damage{font-size:.9rem}.answer-row{flex-direction:column;align-items:stretch}.answer-row .primary{width:100%}}


/* Battle and chapter completion popups */
.modal-overlay{
  position:fixed;
  inset:0;
  z-index:60;
  display:grid;
  place-items:center;
  padding:18px;
  background:rgba(15,23,42,.62);
  backdrop-filter:blur(2px);
}

.modal-card{
  width:min(520px,100%);
  max-height:calc(100vh - 36px);
  overflow:auto;
  background:#fff;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:20px;
  padding:24px;
  text-align:center;
  box-shadow:0 18px 50px rgba(15,23,42,.24);
}

.modal-card h2{
  margin:6px 0 6px;
  font-size:clamp(1.8rem,5vw,2.5rem);
}

.modal-card > p{
  margin:0 0 14px;
  color:var(--muted);
}

.result-icon{
  font-size:3.5rem;
  line-height:1;
  margin-bottom:8px;
}

.centered-rewards{
  justify-content:center;
  margin:14px 0 18px;
}

.modal-primary{
  min-width:180px;
  min-height:50px;
  font-size:1.05rem;
}

.chapter-modal .unlock-card{
  text-align:left;
}

@media(max-width:520px){
  .modal-card{
    padding:20px 16px;
    border-radius:16px;
  }
}


.modal-secondary{
  margin-left:8px;
  min-height:50px;
}

@media(max-width:520px){
  .modal-secondary{
    display:block;
    width:100%;
    margin:8px 0 0;
  }

  .modal-primary{
    width:100%;
  }
}


/* Pixel-art character sprites */
.character-sprite{
  display:block;
  width:auto;
  height:118px;
  max-width:180px;
  object-fit:contain;
  object-position:center bottom;
  image-rendering:pixelated;
  filter:drop-shadow(0 8px 5px rgba(0,0,0,.16));
  transform-origin:center bottom;
}

.enemy .character-sprite{
  margin-left:auto;
}

@media(max-width:760px){
  .character-sprite{
    height:100px;
    max-width:145px;
  }
}

@media(max-width:520px){
  .character-sprite{
    height:82px;
    max-width:110px;
  }
}


/* v11: always-visible side-by-side learning workspace */
.problem-panel{
  padding:18px;
}

.learning-layout{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(430px,.95fr);
  gap:18px;
  align-items:stretch;
}

.question-side{
  min-width:0;
  padding:8px 4px 6px;
}

.workspace-side{
  min-width:0;
}

.workspace-side .workspace{
  margin-top:0;
  height:100%;
  min-height:100%;
  display:flex;
  flex-direction:column;
  padding:16px;
  border:1px solid var(--border);
  background:var(--alt);
}

.workspace-head{
  margin-bottom:2px;
}

.workspace-head h2{
  margin:3px 0 0;
  font-size:1.18rem;
}

.workspace-head p{
  margin:4px 0 0;
  font-size:.86rem;
  line-height:1.35;
}

.block-builder{
  margin-top:12px;
}

.block-builder .block-add{
  min-width:96px;
  min-height:48px;
  font-size:1.05rem;
}

.tool-picker{
  margin-top:8px;
}

.tool-picker .tool{
  padding:8px 10px;
  font-size:.86rem;
}

.workspace-side .board{
  flex:1;
  min-height:310px;
  margin-top:10px;
}

.workspace-side .empty{
  min-height:275px;
}

.workspace-side .placed{
  min-height:275px;
}

.question-side .problem{
  font-size:clamp(2.6rem,5.2vw,4.7rem);
  line-height:1.04;
  overflow-wrap:anywhere;
}

.question-side .answer-row{
  margin-top:22px;
}

.question-side .assist-row{
  margin-top:10px;
}

@media(max-width:900px){
  .learning-layout{
    grid-template-columns:1fr 1fr;
    gap:12px;
  }

  .workspace-side .workspace{
    padding:12px;
  }

  .workspace-side .board{
    min-height:260px;
  }

  .workspace-side .empty,
  .workspace-side .placed{
    min-height:225px;
  }

  .tool-picker .tool{
    flex:1 1 42%;
  }
}

@media(max-width:700px){
  .learning-layout{
    grid-template-columns:1fr;
  }

  .workspace-side .workspace{
    min-height:360px;
  }

  .question-side .problem{
    font-size:clamp(2.4rem,10vw,4rem);
  }
}


/* v12: experience and leveling */
.xp-row{
  max-width:245px;
  margin-top:6px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  font-size:.68rem;
  font-weight:900;
  letter-spacing:.04em;
  color:var(--muted);
}

.xp-track{
  height:8px;
  max-width:245px;
  margin-top:3px;
  overflow:hidden;
  border-radius:999px;
  background:rgba(255,255,255,.82);
  border:1px solid rgba(23,32,51,.15);
}

.xp-fill{
  height:100%;
  width:0;
  border-radius:inherit;
  background:#8b5cf6;
  transition:width .35s ease;
}

.level-up-modal{
  border:2px solid #8b5cf6;
}

.level-reward-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin:16px 0 20px;
}

.level-reward{
  padding:14px 10px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--alt);
}

.level-reward span,
.level-reward strong,
.level-reward small{
  display:block;
}

.level-reward-icon{
  font-size:2rem;
  margin-bottom:6px;
}

.level-reward small{
  margin-top:4px;
  color:var(--muted);
  line-height:1.3;
}

@media(max-width:520px){
  .level-reward-grid{
    grid-template-columns:1fr;
  }
}


/* v13: opening story */
.story-modal{
  width:min(620px,100%);
  text-align:left;
}

.story-modal .result-icon,
.story-modal > .eyebrow,
.story-modal > h2{
  text-align:center;
}

.story-copy{
  margin:16px 0 20px;
  padding:16px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--alt);
}

.story-copy p{
  margin:0 0 12px;
  line-height:1.55;
}

.story-copy p:last-child{
  margin-bottom:0;
}

.story-modal .modal-primary{
  display:block;
  margin:0 auto;
}


/* v15: post-battle XP animation */
.battle-xp-panel{
  margin:14px 0 18px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--alt);
  text-align:left;
}

.battle-xp-heading,
.battle-xp-level-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.battle-xp-heading{
  font-weight:900;
}

.battle-xp-heading strong{
  color:#7c3aed;
}

.battle-xp-level-row{
  margin-top:8px;
  font-size:.82rem;
  color:var(--muted);
}

.battle-xp-track{
  height:16px;
  margin-top:7px;
  overflow:hidden;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
}

.battle-xp-fill{
  height:100%;
  width:0;
  border-radius:inherit;
  background:#8b5cf6;
  transition:width .8s cubic-bezier(.2,.7,.2,1);
}

.battle-xp-fill.level-flash{
  animation:xpLevelFlash .65s ease;
}

.battle-xp-message{
  min-height:20px;
  margin-top:8px;
  text-align:center;
  font-size:.84rem;
  font-weight:900;
  color:var(--muted);
}

@keyframes xpLevelFlash{
  0%,100%{
    filter:brightness(1);
  }
  50%{
    filter:brightness(1.8);
  }
}


/* v16: battle XP is awarded only after victory */
.battle-xp-panel{
  position:relative;
  overflow:hidden;
}

.battle-xp-panel::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(
    90deg,
    transparent,
    rgba(139,92,246,.06),
    transparent
  );
}

.battle-xp-heading strong{
  font-size:1.05rem;
}

.battle-xp-message{
  transition:transform .2s ease, color .2s ease;
}

.battle-xp-fill.level-flash + .battle-xp-message{
  color:#7c3aed;
}


/* v17: keep equations on one line */
.question-side .problem{
  white-space:nowrap;
  overflow-wrap:normal;
  word-break:normal;
  letter-spacing:-.02em;
}

.question-side .problem.compact-problem{
  font-size:clamp(2rem,4vw,3.4rem);
}

@media(max-width:900px){
  .question-side .problem.compact-problem{
    font-size:clamp(1.9rem,3.7vw,3rem);
  }
}

@media(max-width:700px){
  .question-side .problem,
  .question-side .problem.compact-problem{
    font-size:clamp(2.2rem,9vw,3.8rem);
  }
}


/* v18 world select */
.compact-control{
  min-height:auto;
  padding:6px 10px;
  font-size:.8rem;
}

.world-select-modal{
  width:min(760px,100%);
}

.world-select-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  margin:16px 0 18px;
}

.world-card{
  min-height:120px;
  padding:14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--alt);
  color:var(--text);
  text-align:left;
}

.world-card span,
.world-card strong,
.world-card small{
  display:block;
}

.world-card-number{
  margin-bottom:5px;
  color:var(--muted);
  font-size:.72rem;
  font-weight:900;
  letter-spacing:.05em;
  text-transform:uppercase;
}

.world-card strong{
  font-size:1.05rem;
}

.world-card small{
  margin-top:5px;
  color:var(--muted);
  line-height:1.35;
}

.enemy-wrap[data-emoji]::before{
  content:attr(data-emoji);
  display:block;
  margin-left:auto;
  font-size:5.5rem;
  line-height:1;
  filter:drop-shadow(0 8px 5px rgba(0,0,0,.12));
}

.character-sprite.emoji-enemy{
  display:none;
}

@media(max-width:620px){
  .world-select-grid{
    grid-template-columns:1fr;
  }
}


/* v19 visual money and clock questions */
.problem-visual{
  margin-top:16px;
}

.coin-row{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
  align-items:center;
  min-height:92px;
}

.coin{
  width:72px;
  height:72px;
  display:grid;
  place-items:center;
  border-radius:50%;
  border:4px solid rgba(23,32,51,.24);
  box-shadow:
    inset 0 0 0 5px rgba(255,255,255,.22),
    0 4px 0 rgba(23,32,51,.12);
  font-weight:1000;
  font-size:1.15rem;
}

.coin-penny{
  background:#c98253;
}

.coin-nickel{
  background:#c6cbd3;
}

.coin-dime{
  width:62px;
  height:62px;
  background:#d8dce2;
}

.coin-quarter{
  width:82px;
  height:82px;
  background:#bfc5ce;
}

.clock-face{
  display:block;
  width:min(260px,100%);
  max-height:260px;
  margin:0 auto;
}

.clock-ring{
  fill:#fff;
  stroke:#334155;
  stroke-width:5;
}

.clock-number{
  fill:#172033;
  font-size:18px;
  font-weight:900;
  font-family:system-ui,-apple-system,"Segoe UI",sans-serif;
}

.clock-hand{
  stroke:#172033;
  stroke-linecap:round;
}

.clock-hour{
  stroke-width:8;
}

.clock-minute{
  stroke-width:5;
}

.clock-center{
  fill:#172033;
}

.time-answer-group{
  flex:1;
  min-width:0;
}

.time-answer-label{
  display:block;
  font-weight:900;
}

.time-answer-fields{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:5px;
}

.time-answer-fields input{
  width:92px;
  min-height:58px;
  border:2px solid var(--border);
  border-radius:12px;
  padding:8px 10px;
  text-align:center;
  font-size:1.9rem;
  font-weight:1000;
}

.time-colon{
  font-size:2rem;
  font-weight:1000;
  line-height:1;
}

@media(max-width:700px){
  .coin{
    width:60px;
    height:60px;
  }

  .coin-quarter{
    width:68px;
    height:68px;
  }

  .coin-dime{
    width:54px;
    height:54px;
  }
}


/* v20: world-specific tools, interactive coin tray, elapsed-time challenges */
.learning-layout.single-column-learning{
  grid-template-columns:minmax(0,1fr);
}

.learning-layout.single-column-learning .question-side{
  max-width:900px;
  width:100%;
  margin:0 auto;
}

.coin-workspace{
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:1;
  margin-top:12px;
}

.coin-tray-section{
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--panel);
}

.coin-tray-section h3{
  margin:0;
  font-size:1rem;
}

.coin-tray-section p{
  margin:3px 0 10px;
  color:var(--muted);
  font-size:.82rem;
}

.coin-tray-zone{
  min-height:108px;
  display:flex;
  flex-wrap:wrap;
  align-content:flex-start;
  gap:12px;
  padding:10px;
  border:2px dashed var(--border);
  border-radius:12px;
}

.given-away-section{
  background:rgba(0,0,0,.025);
}

.removed-zone .tray-coin{
  opacity:.72;
}

.tray-coin{
  appearance:none;
  cursor:pointer;
  padding:0;
  transition:transform .12s ease, opacity .12s ease;
}

.tray-coin:hover{
  transform:translateY(-2px);
}

.tray-coin:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:3px;
}

.coin-tray-arrow{
  text-align:center;
  font-size:1.5rem;
  font-weight:900;
  color:var(--muted);
}

.coin-tray-empty{
  width:100%;
  align-self:center;
  text-align:center;
  color:var(--muted);
  font-size:.85rem;
}

.single-column-learning .clock-face{
  width:min(340px,100%);
  max-height:340px;
}

.single-column-learning .problem-visual{
  margin-top:20px;
}

@media(max-width:700px){
  .coin-tray-zone{
    min-height:90px;
    gap:8px;
  }
}


/* v21: recognizable U.S.-style coin faces, no printed cent values */
.coin{
  position:relative;
  display:grid;
  place-items:center;
  width:72px;
  height:72px;
  padding:0;
  overflow:hidden;
  border-radius:50%;
  border:0;
  background:transparent;
  box-shadow:0 4px 7px rgba(15,23,42,.22);
  color:inherit;
}

.coin svg{
  display:block;
  width:100%;
  height:100%;
  filter:drop-shadow(0 1px 1px rgba(255,255,255,.4));
}

.coin-penny{ width:68px; height:68px; background:transparent; }
.coin-nickel{ width:76px; height:76px; background:transparent; }
.coin-dime{ width:61px; height:61px; background:transparent; }
.coin-quarter{ width:86px; height:86px; background:transparent; }

.coin-penny .coin-rim,
.coin-penny .coin-field{
  fill:#b76532;
  stroke:#7d3f21;
}

.coin-penny .coin-field{ fill:#c97a4b; }

.coin-nickel .coin-rim,
.coin-nickel .coin-field,
.coin-dime .coin-rim,
.coin-dime .coin-field,
.coin-quarter .coin-rim,
.coin-quarter .coin-field{
  fill:#bfc4ca;
  stroke:#777f87;
}

.coin-nickel .coin-field{ fill:#d2d5d9; }
.coin-dime .coin-field{ fill:#d9dde1; }
.coin-quarter .coin-field{ fill:#c9ced3; }

.coin-rim{ stroke-width:2.4; }
.coin-field{ stroke-width:1.3; }
.ridged{ stroke-dasharray:2.2 1.3; stroke-width:3; }

.coin-portrait,
.coin-building,
.coin-torch,
.coin-eagle{
  fill:#737a80;
  stroke:#5e6469;
  stroke-width:1.1;
  stroke-linejoin:round;
}

.coin-penny .coin-portrait,
.coin-penny .coin-building{
  fill:#8c4a29;
  stroke:#743b22;
}

.coin-detail,
.coin-branch{
  fill:none;
  stroke:#666d73;
  stroke-width:1.4;
  stroke-linecap:round;
}

.coin-penny .coin-detail{ stroke:#754126; }

.coin-microtext,
.coin-sideword,
.coin-year,
.coin-reverseword{
  fill:#52585e;
  font-family:Georgia,serif;
  font-weight:700;
  text-anchor:middle;
  letter-spacing:.4px;
}

.coin-penny .coin-microtext,
.coin-penny .coin-sideword,
.coin-penny .coin-year,
.coin-penny .coin-reverseword{ fill:#6f371f; }

.coin-microtext{ font-size:5.5px; }
.coin-sideword{ font-size:6.5px; }
.coin-year{ font-size:6px; }
.coin-reverseword{ font-size:6px; }

.tray-coin{
  background:transparent;
  border:0;
  min-width:44px;
  min-height:44px;
}

.tray-coin:hover{
  transform:translateY(-3px) scale(1.03);
}

.tray-coin:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:4px;
}

.removed-zone .tray-coin{
  opacity:.58;
  filter:saturate(.65);
}

@media(max-width:700px){
  .coin-penny{ width:58px; height:58px; }
  .coin-nickel{ width:64px; height:64px; }
  .coin-dime{ width:52px; height:52px; }
  .coin-quarter{ width:72px; height:72px; }
}


/* v22: clearer coin recognition + bounded word problems */
.question-side .problem.word-problem,
.single-column-learning .problem.word-problem{
  white-space:normal;
  width:100%;
  max-width:760px;
  overflow-wrap:break-word;
  word-break:normal;
  font-size:clamp(1.65rem,3.4vw,2.75rem);
  line-height:1.18;
  letter-spacing:0;
}

.single-column-learning .question-side{
  min-width:0;
  width:100%;
  max-width:100%;
}

.single-column-learning .problem-head{
  min-width:0;
  max-width:100%;
}

/* Make the silver coins much easier to distinguish by size, edge and tone. */
.coin-nickel{ width:82px; height:82px; }
.coin-dime{ width:56px; height:56px; }
.coin-quarter{ width:98px; height:98px; }

.coin-nickel .coin-rim,
.coin-nickel .coin-field{
  fill:#d8dce0;
  stroke:#8e959c;
}

.coin-dime .coin-rim,
.coin-dime .coin-field{
  fill:#eef0f2;
  stroke:#686f76;
}

.coin-quarter .coin-rim,
.coin-quarter .coin-field{
  fill:#bfc5cb;
  stroke:#5f6871;
}

.coin-nickel .coin-rim{
  stroke-width:2.1;
  stroke-dasharray:none;
}

.coin-dime .coin-rim,
.coin-quarter .coin-rim{
  stroke-width:3.4;
  stroke-dasharray:2.3 1.25;
}

.coin-nickel .coin-portrait{
  transform:translate(-2px,1px) scale(.93);
  transform-origin:center;
}

.coin-dime .coin-portrait{
  transform:translate(2px,-1px) scale(.9);
  transform-origin:center;
}

.coin-quarter .coin-portrait{
  transform:translate(4px,-2px) scale(1.04);
  transform-origin:center;
}

@media(max-width:700px){
  .coin-nickel{ width:70px; height:70px; }
  .coin-dime{ width:48px; height:48px; }
  .coin-quarter{ width:82px; height:82px; }

  .question-side .problem.word-problem,
  .single-column-learning .problem.word-problem{
    font-size:clamp(1.45rem,6.2vw,2.15rem);
  }
}


/* v23: use the supplied pixel-art U.S. coin images */
.coin{
  overflow:hidden;
  padding:0;
  background:transparent;
  border:none;
  box-shadow:none;
}

.coin-image{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:50%;
  image-rendering:pixelated;
  user-select:none;
  pointer-events:none;
}

.tray-coin{
  border:none;
  background:transparent;
}

.tray-coin:focus-visible{
  outline:3px solid var(--accent);
  outline-offset:4px;
}


/* v24: long prompts and word problems must stay inside the card */
.question-side,
.question-side > *,
.problem{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}

.question-side .problem{
  white-space:normal !important;
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.08;
  max-width:100%;
}

.question-side .problem.equation-problem{
  white-space:nowrap !important;
  overflow-wrap:normal;
  word-break:normal;
}

.question-side .problem.story-problem{
  font-size:clamp(1.8rem,3.4vw,3rem);
  line-height:1.14;
  letter-spacing:-.025em;
}

/* Keep narrative prompts from forcing the whole battle area wider. */
.question-side{
  overflow:hidden;
}

@media(max-width:900px){
  .question-side .problem.story-problem{
    font-size:clamp(1.65rem,4.5vw,2.5rem);
  }
}

@media(max-width:700px){
  .question-side .problem.story-problem{
    font-size:clamp(1.45rem,7vw,2.15rem);
    line-height:1.16;
  }
}

/* v24: make the supplied penny visibly copper while retaining pixel shading */
.coin-penny .coin-image,
.tray-coin.coin-penny .coin-image{
  filter:saturate(1.18) contrast(1.04);
}
