/* Mathe Klasse 1 bis 3 – große Ziffern, klare Flächen, kindgerecht */
.mg-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mg-tab { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: #fff; border: 2px solid var(--line); color: var(--text); text-decoration: none; box-shadow: 0 3px 0 var(--line); }
.mg-tab small { display: block; color: var(--muted); font-size: .85rem; }
.mg-tab-n { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--gruen-soft); color: var(--gruen-dark); font: 800 1.6rem/1 "Bricolage", sans-serif; }
.mg-tab[aria-current="page"] { border-color: var(--gruen); box-shadow: 0 3px 0 var(--gruen-dark); }
.mg-tab[aria-current="page"] .mg-tab-n { background: var(--gruen); color: #fff; }

.mg-intro { display: flex; align-items: center; gap: 16px; }
.mg-intro .kompi-mini { width: 96px; }
.mg-bubble { position: relative; background: #fff; border: 2px solid var(--gruen-soft); border-radius: 18px; padding: 14px 18px; flex: 1; }
.mg-bubble p { margin: 0 0 6px; }
.mg-bubble::before { content: ""; position: absolute; left: -11px; top: 26px; border: 10px solid transparent; border-right-color: var(--gruen-soft); border-left: 0; }

.mg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mg-card { position: relative; background: #fff; border-radius: 20px; padding: 18px 16px 16px; box-shadow: 0 0 0 2px var(--line), 0 4px 0 var(--line); display: flex; flex-direction: column; gap: 6px; }
.mg-card h3 { margin: 0; font-size: 1.1rem; }
.mg-card p { margin: 0; font-size: .92rem; }
.mg-card .tag { align-self: flex-start; }
.mg-card .mg-go { align-self: flex-start; margin-top: 6px; }
.mg-card.is-locked { opacity: .78; }
.mg-num { position: absolute; top: 12px; right: 14px; color: var(--muted); font: 700 .85rem "Bricolage", sans-serif; }
.mg-emoji { font-size: 2rem; line-height: 1; }
.mg-stars { color: #d7dbe6; font-size: 1.25rem; letter-spacing: 2px; }
.mg-stars .on { color: var(--sonne); text-shadow: 0 1px 0 #c98f00; }
.mg-stars-inline { font-size: 1.1rem; vertical-align: -1px; }
.mg-parents { background: var(--gruen-soft); box-shadow: none; }

/* Spielseite */
.mg-head .row-between { align-items: flex-end; gap: 16px; }
.mg-read-toggle { display: inline-flex; align-items: center; gap: 8px; background: #fff; padding: 10px 14px; border-radius: 999px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 0 var(--line); }
.mg-read-toggle input { width: 20px; height: 20px; accent-color: var(--gruen); }

.mg-explain { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; background: #fff; border-radius: 24px; padding: 22px; box-shadow: 0 0 0 3px var(--gruen-soft), 0 6px 0 var(--gruen-soft); }
.mg-explain .kompi-mini { width: 150px; }
.mg-explain-h { margin: 0 0 6px; font-size: 1.5rem; color: var(--gruen-dark); }
.mg-steps { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
.mg-steps li { counter-increment: s; position: relative; padding-left: 40px; font-size: 1.15rem; line-height: 1.45; }
.mg-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--gruen); color: #fff; font: 800 1rem/28px "Bricolage", sans-serif; text-align: center; }
.mg-example { background: var(--sonne-soft); border-radius: 14px; padding: 10px 14px; font-size: 1.1rem; margin-bottom: 10px; }
.mg-example-label { display: inline-block; background: var(--sonne); color: #5a3d00; font-weight: 800; border-radius: 8px; padding: 1px 8px; margin-right: 6px; font-size: .85rem; }
.mg-example-visual:empty { display: none; }
.mg-example-visual { margin: 0 0 12px; }
.mg-example-visual .mg-svg { max-height: 150px; }
.mg-note { margin: 10px 0 0; font-size: .9rem; }

.mg-progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.mg-progress span { width: 22px; height: 10px; border-radius: 6px; background: #dfe5f2; transition: background .2s; }
.mg-progress span.now { background: var(--sonne); }
.mg-progress span.ok { background: var(--gruen); }
.mg-progress span.half { background: var(--orange); }
.mg-progress span.no { background: var(--rot); }

.mg-stage { display: grid; grid-template-columns: 1fr 190px; gap: 16px; align-items: stretch; }
.mg-task { position: relative; background: #fff; border-radius: 24px; padding: 22px 22px 18px; box-shadow: 0 0 0 3px var(--line), 0 6px 0 var(--line); text-align: center; display: flex; flex-direction: column; justify-content: center; min-height: 240px; }
.mg-visual { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mg-svg { max-width: 100%; height: auto; }
.mg-field { width: 360px; }
.mg-blocks { max-height: 170px; width: auto; }
.mg-table { width: 290px; }
.mg-clock { width: 200px; }
.mg-money { width: 360px; }
.mg-shape { width: 150px; }
.mg-array { max-width: 240px; max-height: 200px; width: auto; }
.mg-q { font: 700 clamp(1.25rem, 2.6vw, 1.6rem)/1.35 "Atkinson", sans-serif; margin: 14px 0 0; }
.mg-eq { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font: 800 clamp(2rem, 6vw, 3.2rem)/1.1 "Bricolage", sans-serif; color: var(--nacht); }
.mg-box { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.3em; padding: 0 .2em; border: 3px dashed var(--gruen); border-radius: 12px; color: var(--gruen-dark); background: var(--gruen-soft); }
.mg-eq + .mg-q, .mg-svg + .mg-q { margin-top: 10px; }
.mg-line { display: flex; justify-content: center; gap: 10px; font: 800 2.6rem/1 "Bricolage", sans-serif; }
.mg-line > span:not(.mg-box) { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.4em; border-radius: 12px; background: var(--blau-soft); color: var(--blau-dark); }
.mg-line .mg-box { min-width: 1.6em; height: 1.4em; }
.mg-emoji-big { font-size: 3.2rem; line-height: 1; }
.mg-speak { top: 14px; right: 14px; }

.mg-coach { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mg-coach .kompi-mini { width: 150px; }
.mg-say { position: relative; background: #fff; border-radius: 16px; padding: 10px 12px; font-weight: 700; text-align: center; box-shadow: 0 0 0 2px var(--line); width: 100%; font-size: .98rem; line-height: 1.35; }
.mg-say::before { content: ""; position: absolute; top: -10px; left: 50%; margin-left: -9px; border: 9px solid transparent; border-bottom-color: #fff; border-top: 0; }
.mg-say.is-ok { background: var(--gruen-soft); color: var(--gruen-dark); }
.mg-say.is-hint { background: var(--sonne-soft); color: #6b4a00; font-weight: 400; text-align: left; }
.mg-say.is-solution { background: var(--rot-soft); color: var(--rot-dark); }
.mg-say.is-ok::before { border-bottom-color: var(--gruen-soft); }
.mg-say.is-hint::before { border-bottom-color: var(--sonne-soft); }
.mg-say.is-solution::before { border-bottom-color: var(--rot-soft); }

.mg-answer { margin-top: 18px; }
.mg-input-wrap { display: flex; gap: 10px; justify-content: center; }
.mg-input-wrap input { width: 180px; font: 800 2.2rem/1 "Bricolage", sans-serif; text-align: center; padding: 10px; border-radius: 16px; border: 3px solid var(--line); background: #fff; color: var(--nacht); }
.mg-input-wrap input:focus { outline: none; border-color: var(--gruen); }
.mg-input-wrap .mg-check { font-size: 1.15rem; padding: 0 22px; }
.mg-input-wrap.is-ok input { border-color: var(--gruen); background: var(--gruen-soft); }
.mg-input-wrap.is-no input { border-color: var(--rot); animation: mgShake .35s; }
.mg-input-wrap.is-solution input { border-color: var(--orange); background: var(--orange-soft); }
.mg-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 8px; justify-content: center; margin-top: 12px; }
.mg-pad button { height: 58px; border-radius: 16px; border: 0; background: #fff; box-shadow: 0 0 0 2px var(--line), 0 4px 0 var(--line); font: 800 1.6rem/1 "Bricolage", sans-serif; color: var(--nacht); cursor: pointer; }
.mg-pad button:active { transform: translateY(3px); box-shadow: 0 0 0 2px var(--line), 0 1px 0 var(--line); }
.mg-pad .mg-pad-ok { background: var(--gruen); color: #fff; box-shadow: 0 4px 0 var(--gruen-dark); }
.mg-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 520px; margin: 0 auto; }
.mg-choice { min-height: 64px; border-radius: 18px; border: 0; background: #fff; box-shadow: 0 0 0 2px var(--line), 0 4px 0 var(--line); font: 800 1.35rem/1.2 "Bricolage", sans-serif; color: var(--nacht); cursor: pointer; padding: 8px 12px; }
.mg-choice-sign { font-size: 2.4rem; }
.mg-choices:has(.mg-choice-sign) { grid-template-columns: repeat(3, 90px); justify-content: center; }
.mg-choice:hover:not(:disabled) { box-shadow: 0 0 0 3px var(--gruen), 0 4px 0 var(--gruen-dark); }
.mg-choice.is-ok { background: var(--gruen); color: #fff; box-shadow: 0 4px 0 var(--gruen-dark); }
.mg-choice.is-no { background: var(--rot-soft); color: var(--rot-dark); animation: mgShake .35s; }
.mg-choice.is-solution { background: var(--orange-soft); box-shadow: 0 0 0 3px var(--orange); }
.mg-choice:disabled { cursor: default; }
.mg-next { margin-top: 6px; }

.mg-done { text-align: center; background: #fff; border-radius: 24px; padding: 26px 20px; box-shadow: 0 0 0 3px var(--sonne-soft), 0 6px 0 var(--sonne-soft); }
.mg-done .kompi-mini { width: 160px; display: block; margin: 0 auto; }
.mg-bigstars { font-size: 3.4rem; letter-spacing: 6px; color: #d7dbe6; }
.mg-bigstars .on { color: var(--sonne); text-shadow: 0 2px 0 #c98f00; display: inline-block; animation: mgPop .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.mg-bigstars .on:nth-child(2) { animation-delay: .2s; }
.mg-bigstars .on:nth-child(3) { animation-delay: .4s; }

@keyframes mgShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes mgPop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .mg-bigstars .on, .mg-input-wrap.is-no input, .mg-choice.is-no { animation: none; } }

@media (max-width: 760px) {
  .mg-tabs { grid-template-columns: 1fr; }
  .mg-explain { grid-template-columns: 1fr; padding: 18px; }
  .mg-explain-kompi { display: flex; justify-content: center; }
  .mg-explain .kompi-mini { width: 110px; }
  .mg-stage { grid-template-columns: 1fr; }
  .mg-coach { flex-direction: row; }
  .mg-coach .kompi-mini { width: 74px; flex: none; }
  .mg-say::before { top: 50%; left: -9px; margin: -9px 0 0; border: 9px solid transparent; border-right-color: inherit; border-left: 0; }
  .mg-say.is-ok::before { border-right-color: var(--gruen-soft); } .mg-say.is-hint::before { border-right-color: var(--sonne-soft); } .mg-say.is-solution::before { border-right-color: var(--rot-soft); }
  .mg-say::before { border-right-color: #fff; border-bottom-color: transparent; }
  .mg-task { padding: 18px 12px 14px; min-height: 0; }
  .mg-field, .mg-money { width: 100%; }
  .mg-pad { grid-template-columns: repeat(3, minmax(0, 88px)); }
  .mg-intro .kompi-mini { width: 70px; }
  .mg-head .row-between { flex-direction: column; align-items: flex-start; }
}
.mg-h1-grade { font-size: .45em; vertical-align: middle; background: var(--gruen); color: #fff; border-radius: 999px; padding: 4px 12px; font-family: "Atkinson", sans-serif; font-weight: 700; }
