/* Rechenhilfe am Aufgabenschild (Claude, 30.09.2026), Logik in rechenhilfe.js. */

.schild { position: relative; }
/* Rechts neben dem Schild, mittig (oben in der Ecke verdeckte er das Ende der Frage) */
.rh-knopf {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 34px;
  padding: 6px 8px 5px;
  transform: translateY(-50%);
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 0 var(--ink);
  color: var(--ink);
  font: 800 13px/1 var(--font-display);
  cursor: pointer;
  transition: transform .15s, background-color .15s;
}
.rh-knopf svg { width: 28px; height: 28px; }
.rh-knopf:hover { background: #fef9c3; transform: translateY(calc(-50% - 1px)); }
.rh-knopf:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.rh-knopf.is-offen { background: #fde68a; }
@media (max-width: 700px) {
  .rh-knopf { top: auto; bottom: -14px; left: auto; right: 8px; padding: 3px 5px; border-radius: 50%; transform: none; }
  .rh-knopf:hover { transform: none; }
  .rh-knopf svg { width: 24px; height: 24px; }
  .rh-knopf-text { display: none; }
}

/* Zentriert über left/right/margin, nicht mit translateX: Ein Kasten, der vor dem Verschieben rechts übersteht,
   lässt den Browser das Becken (overflow: hidden) seitlich rollen */
.rh {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  border: 3px solid var(--ink);
  border-radius: 22px;
  background: #fffdf7;
  box-shadow: inset -5px -6px 0 rgba(28, 34, 48, .1), 0 20px 40px -16px rgba(6, 28, 48, .6);
  overflow: hidden;
  animation: rh-rein .25s cubic-bezier(.2, .9, .3, 1.2);
}
.rh[hidden] { display: none; }
@keyframes rh-rein { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }

.rh-kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 8px 16px; border-bottom: 2px solid rgba(28, 34, 48, .12); background: #fff; }
.rh-titel { display: inline-flex; align-items: center; gap: 4px; font: 800 20px/1 var(--font-display); }
.rh-titel svg { width: 26px; height: 26px; margin-top: -3px; }
.rh-reiter { display: flex; flex-wrap: wrap; gap: 4px; margin-right: auto; padding: 3px; border-radius: 999px; background: var(--soft); }
.rh-reiter button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 15px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.rh-reiter button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 27, 45, .18); }
.rh-zu { display: grid; place-items: center; width: 38px; height: 38px; margin-left: auto; padding: 0; border: 2px solid var(--ink); border-radius: 50%; background: #fff; cursor: pointer; }
.rh-zu svg { width: 20px; height: 20px; }

.rh-inhalt { padding: 14px 18px 18px; overflow: auto; overscroll-behavior: contain; }
.rh-inhalt p { margin: 0; }

/* So rechnest du */
.rh-aufgabe { font: 800 clamp(28px, 3.4vw, 44px)/1.1 var(--font-display); text-align: center; }
.rh-aufgabe b, .rh-formel b { font-weight: inherit; }
.rh-weg-titel { margin: 12px 0 6px !important; color: var(--tone); font: 800 13px/1.2 var(--font); letter-spacing: .06em; text-transform: uppercase; }
.rh-zeilen { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rh-zeile {
  display: grid;
  grid-template-columns: minmax(150px, auto) 1fr;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  border: 2px solid rgba(28, 34, 48, .12);
  border-radius: 16px;
  background: #fff;
}
.rh-zeile:last-child { border-color: var(--tone); background: var(--tint); }
.rh-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 700 15px/1.2 var(--font); }
.rh-formel { font: 800 clamp(24px, 2.8vw, 36px)/1.15 var(--font-display); white-space: nowrap; }
.rh-q { display: inline-block; min-width: 1.1em; border-bottom: 4px dashed var(--tone); color: var(--tone); text-align: center; }
.rh-kette { white-space: normal; }
.rh-tipp { margin-top: 10px !important; color: #3f4656; font: 500 17px/1.4 var(--font); }
.rh-zwerg { width: 30px; height: 36px; flex: none; }
.rh-riese { width: 46px; height: 55px; flex: none; }
.rh-zeile.is-zwerg .rh-formel { font-size: clamp(20px, 2.2vw, 28px); }
.rh-zeile.is-riese .rh-formel { font-size: clamp(28px, 3.4vw, 44px); }

/* Rechentricks */
.rh-tricks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.rh-trick { display: grid; gap: 4px; padding: 10px 14px; border: 2px solid rgba(28, 34, 48, .12); border-radius: 16px; background: #fff; }
.rh-trick-name { color: var(--tone-deep); font: 800 17px/1.2 var(--font-display); }
.rh-trick-bsp { font: 600 17px/1.35 var(--font); }
.rh-trick-zr .rh-trick-bsp { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 12px; }
.rh-zr { display: inline-flex; align-items: flex-end; gap: 4px; font-size: 15px; }
.rh-zr-gross { font: 800 20px/1.2 var(--font-display); }

/* 10er- und 20er-Feld */
.rh-feld { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; max-width: 620px; margin: 4px auto 0; padding: 10px; border: 3px solid var(--ink); border-radius: 16px; background: #fff; }
.rh-feld > :nth-child(5n) { margin-right: 8px; }
.rh-feld > :nth-child(10n) { margin-right: 0; }
.rh-feld-20 > :nth-child(n + 11) { margin-top: 4px; }
.rh-punkt {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2.5px solid rgba(28, 34, 48, .3);
  border-radius: 50%;
  background: #fff;
}
.rh-punkt i { color: rgba(28, 34, 48, .45); font: 700 clamp(10px, 1.2vw, 14px)/1 var(--font); font-style: normal; }
.rh-punkt.is-rot { border-color: var(--ink); background: #f87171; }
.rh-punkt.is-blau { border-color: var(--ink); background: #60a5fa; }
.rh-punkt.is-gruen { border-color: var(--ink); background: #4ade80; }
.rh-punkt.is-rot i, .rh-punkt.is-blau i, .rh-punkt.is-gruen i { color: rgba(255, 255, 255, .9); }
.rh-punkt.is-weg { border-color: var(--ink); background: #fecaca; }
.rh-punkt.is-weg::after, .rh-punkt.is-frage-weg::after { content: ""; position: absolute; inset: 18%; background: linear-gradient(45deg, transparent 44%, var(--ink) 44% 56%, transparent 56%), linear-gradient(-45deg, transparent 44%, var(--ink) 44% 56%, transparent 56%); }
.rh-punkt.is-frage, .rh-punkt.is-frage-weg { border: 2.5px dashed var(--tone); background: var(--tint); }
.rh-legende { margin-top: 10px !important; color: #3f4656; font: 500 16px/1.5 var(--font); text-align: center; }
.rh-l { display: inline-block; width: 14px; height: 14px; margin: 0 2px -2px 0; border: 2px solid var(--ink); border-radius: 50%; vertical-align: baseline; }
.rh-l.is-rot { background: #f87171; }
.rh-l.is-blau { background: #60a5fa; }
.rh-l.is-gruen { background: #4ade80; }
.rh-l.is-weg { background: #fecaca; }
.rh-l.is-frage { border-style: dashed; border-color: var(--tone); background: var(--tint); }

/* Hundertertafel */
.rh-hundert { display: grid; grid-template-columns: repeat(10, 1fr); max-width: 520px; margin: 0 auto; border: 3px solid var(--ink); border-radius: 12px; background: #fff; overflow: hidden; }
.rh-hundert span { display: grid; place-items: center; min-height: 30px; border-right: 1px solid rgba(28, 34, 48, .15); border-bottom: 1px solid rgba(28, 34, 48, .15); font: 700 clamp(12px, 1.3vw, 16px)/1 var(--font); font-variant-numeric: tabular-nums; }
.rh-hundert span:nth-child(10n) { border-right: 0; }
.rh-hundert span:nth-child(n + 91) { border-bottom: 0; }
.rh-hundert span.is-fuenf { border-right: 2px solid rgba(28, 34, 48, .35); }
.rh-hundert span:nth-child(n + 41):nth-child(-n + 50) { border-bottom: 2px solid rgba(28, 34, 48, .35); }
.rh-hundert .is-weg { background: #bfdbfe; }
.rh-hundert .is-rot { background: #f87171; color: #fff; }
.rh-hundert .is-ziel { background: #fde68a; box-shadow: inset 0 0 0 3px var(--ink); }

/* Stellenwerttafel */
.rh-stellen { margin: 0 auto; border-collapse: separate; border-spacing: 6px; font: 800 clamp(26px, 3vw, 38px)/1 var(--font-display); }
.rh-stellen th { color: var(--muted); font: 800 18px/1 var(--font-display); }
.rh-stellen thead th { padding-bottom: 2px; }
.rh-stellen td { width: 1.6em; height: 1.5em; border: 2px solid rgba(28, 34, 48, .2); border-radius: 10px; background: #fff; text-align: center; vertical-align: middle; }
.rh-stellen thead th:nth-child(2), .rh-stellen td:nth-child(2) { color: #b45309; }
.rh-stellen thead th:nth-child(3), .rh-stellen td:nth-child(3) { color: #1d4ed8; }
.rh-stellen thead th:nth-child(4), .rh-stellen td:nth-child(4) { color: #15803d; }
.rh-stellen .rh-strich td { border-top-width: 4px; border-top-color: var(--ink); }
.rh-stellen td.is-frage { border-style: dashed; border-color: var(--tone); background: var(--tint); color: var(--tone); }

/* Einmaleins */
.rh-einmaleins { margin: 0 auto; border-collapse: collapse; font: 700 clamp(12px, 1.3vw, 16px)/1 var(--font); font-variant-numeric: tabular-nums; background: #fff; }
.rh-einmaleins th, .rh-einmaleins td { width: 2.6em; height: 2em; border: 1px solid rgba(28, 34, 48, .15); text-align: center; }
.rh-einmaleins th { background: var(--soft); color: var(--tone-deep); font-weight: 800; }
.rh-einmaleins .is-hell { background: #dbeafe; }
.rh-einmaleins th.is-hell { background: #93c5fd; color: var(--ink); }
.rh-einmaleins .is-ziel { background: #fde68a; box-shadow: inset 0 0 0 3px var(--ink); }

@media (max-width: 700px) {
  .rh { width: calc(100% - 12px); border-radius: 18px; }
  .rh-titel { display: none; }
  .rh-reiter button { min-height: 32px; padding: 0 10px; font-size: 13px; }
  .rh-inhalt { padding: 10px 10px 14px; }
  .rh-zeile { grid-template-columns: 1fr; gap: 4px; }
  .rh-formel { white-space: normal; }
  .rh-feld { gap: 4px; padding: 6px; }
  .rh-feld > :nth-child(5n) { margin-right: 4px; }
  .rh-hundert span { min-height: 24px; }
}
@media (prefers-reduced-motion: reduce) { .rh { animation: none; } }
