/* Spiele: Rechen-Memory und Zahlenstrahl */

/* ---- Rechen-Memory ---- */
.mem-info, .nl-info { display: flex; justify-content: space-between; gap: 10px; padding: 0 18px 8px; font-weight: 900; font-size: 1.25rem; flex-wrap: wrap; }
.mem-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px 16px 18px; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; width: min(100%, 860px); }
@media (orientation: portrait) { .mem-grid { grid-template-columns: repeat(3, 1fr); width: min(100%, 620px); } }
.mem-card { aspect-ratio: 4 / 3; min-height: 88px; border: none; padding: 0; background: none; perspective: 900px; cursor: pointer; touch-action: manipulation; }
@media (orientation: portrait) { .mem-card { aspect-ratio: 1 / 1; } }
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .35s ease; transform-style: preserve-3d; }
.mem-card.open .mem-inner { transform: rotateY(180deg); }
.mem-back, .mem-front { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 20px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow-s); font-weight: 900; }
.mem-back { background: linear-gradient(135deg, #9b7bff, #7c4dff); color: #fff; font-size: 2.4rem; }
.mem-front { transform: rotateY(180deg); background: #fff; color: var(--ink); font-size: clamp(1.4rem, 3.6vw, 2.2rem); border: 4px solid #e4defa; padding: 6px; text-align: center; }
.mem-card.is-a .mem-front { background: #fff7d6; border-color: #ffe08a; font-size: clamp(1.8rem, 4.6vw, 2.8rem); }
.mem-card.done .mem-front { border-color: #5cc97a; background: #e3f8e9; }
.mem-card.done { animation: bump .4s ease; }

/* ---- Zahlenstrahl ---- */
.nl-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 10px 36px 24px; }
.nl-target { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.nl-target b { font-size: 1.6em; color: var(--primary); background: #fff; border-radius: 18px; padding: 2px 18px; box-shadow: var(--shadow-s); }
.nl-zone { width: min(100%, 1040px); height: 212px; position: relative; background: #fff; border-radius: 26px; box-shadow: var(--shadow); padding: 0 34px; touch-action: none; cursor: pointer; }
.nl-track { position: absolute; left: 34px; right: 34px; top: 96px; height: 6px; background: var(--ink); border-radius: 3px; }
.nl-tick { position: absolute; top: -9px; width: 2px; height: 24px; margin-left: -1px; background: var(--ink-soft); }
.nl-tick.major { top: -15px; width: 4px; height: 36px; margin-left: -2px; background: var(--ink); }
.nl-tick b { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); font-size: 1.05rem; font-weight: 800; color: var(--ink); white-space: nowrap; }
.nl-marker, .nl-flag { position: absolute; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; transition: left .25s ease; }
.nl-marker { top: -78px; }
.nl-marker i { font-size: 2.2rem; font-style: normal; line-height: 1; transform: rotate(180deg); }
.nl-marker b { order: -1; background: var(--primary); color: #fff; border-radius: 10px; padding: 0 8px; font-size: 1rem; }
.nl-flag { top: 50px; }
.nl-flag i { font-size: 2rem; font-style: normal; line-height: 1; }
.nl-flag b { background: #23b26d; color: #fff; border-radius: 10px; padding: 0 8px; font-size: 1.05rem; }
.nl-feedback { min-height: 1.6em; font-size: 1.7rem; font-weight: 900; text-align: center; }
.nl-feedback.s3 { color: #1f9a55; }
.nl-feedback.s2, .nl-feedback.s1 { color: var(--primary); }
.nl-feedback.s0 { color: var(--ink-soft); }
.nl-next { min-height: 76px; }
/* leichter: Rückseiten zeigen, ob Rechnung (lila) oder Ergebnis (gelb); weniger Karten = größere Karten */
.mem-back { flex-direction: column; gap: 2px; font-size: 2rem; }
.mem-back small { font-size: .95rem; font-weight: 800; opacity: .9; }
.mem-card.is-a .mem-back { background: linear-gradient(135deg, #ffd66b, #ffb020); color: #5a3d00; }
.mem-grid.p3 { grid-template-columns: repeat(3, 1fr); width: min(100%, 700px); }
.mem-grid.p4 { grid-template-columns: repeat(4, 1fr); width: min(100%, 860px); }
.mem-grid.p5 { grid-template-columns: repeat(5, 1fr); width: min(100%, 980px); }
@media (orientation: portrait) {
  .mem-grid.p3 { grid-template-columns: repeat(2, 1fr); width: min(100%, 480px); }
  .mem-grid.p4, .mem-grid.p5 { grid-template-columns: repeat(3, 1fr); width: min(100%, 620px); }
}

/* Handy (schmal): Memory in 3 Spalten mit quadratischen Karten, Zahlenstrahl mit weniger Rand und halb so vielen Zahlen */
@media (max-width: 520px) {
  .mem-info, .nl-info { font-size: 1.02rem; padding: 0 12px 6px; }
  .mem-wrap { padding: 4px 10px 12px; }
  .mem-grid, .mem-grid.p3, .mem-grid.p4, .mem-grid.p5 { grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
  .mem-card, .mem-card.is-a { aspect-ratio: 1 / 1; min-height: 0; }
  .mem-back { font-size: 1.5rem; border-radius: 16px; }
  .mem-back small { font-size: .78rem; }
  .mem-front { font-size: 1.3rem; border-radius: 16px; }
  .mem-card.is-a .mem-front { font-size: 1.7rem; }
  .nl-wrap { padding: 8px 10px 16px; gap: 16px; }
  .nl-zone { padding: 0 18px; height: 190px; }
  .nl-track { left: 22px; right: 22px; }
  .nl-tick b { font-size: .9rem; }
  .nl-tick.alt b { display: none; }
}
/* Handy im Querformat (26.11.2026): höchstens zwei Reihen, damit alle Karten ohne Scrollen zu sehen sind */
@media (orientation: landscape) and (max-height: 500px) {
  .mem-grid, .mem-grid.p3, .mem-grid.p4, .mem-grid.p5 { gap: 8px; }
  .mem-grid.p3 { grid-template-columns: repeat(6, 1fr); width: 100%; }
  .mem-grid.p4 { grid-template-columns: repeat(4, 1fr); width: min(100%, 190vh); }
  .mem-grid.p5 { grid-template-columns: repeat(5, 1fr); width: min(100%, 236vh); }
  .mem-card { min-height: 0; }
  .mem-info { font-size: 1rem; padding-bottom: 2px; }
  .mem-wrap { padding: 2px 12px 8px; }
}
