/* ===== MATHE-BINGO — Eingabe + Mathe-Tastatur ===== */

.eingabe-karte {
  max-width: 620px;
}

.untertitel {
  text-align: center;
  font-size: 0.82rem;
  color: #7878a8;
  margin-bottom: 1.25rem;
  margin-top: -0.5rem;
  line-height: 1.6;
}

/* ===== Fortschritt ===== */
.fortschritt-wrap    { margin-bottom: 1.1rem; }
.fortschritt-info    { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.05em; color: #7878a8; margin-bottom: 0.35rem; text-align: right; }
.fortschritt-leiste  { width: 100%; height: 4px; background: #2a2a4a; border-radius: 99px; overflow: hidden; }
.fortschritt-balken  { height: 100%; background: var(--teal); border-radius: 99px; transition: width 0.25s ease; }
.fortschritt-balken.komplett { background: var(--gelb); }

/* ===== Bingo-Karten-Grid ===== */
.karten-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 1.25rem;
}

.karten-feld {
  aspect-ratio: 1 / 1;
  background: #1e1e3a;
  border: 1.5px solid #3a3a6a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
  padding: 4px;
}

.karten-feld:active {
  transform: scale(0.96);
}

.karten-feld.aktiv {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px #30D5C840;
}

.karten-feld.hat-wert {
  border-color: #3a5a5a;
}

/* Anzeigetext im Feld */
.feld-anzeige {
  font-family: 'Barlow', sans-serif;
  font-size: clamp(0.65rem, 2.8vw, 1rem);
  font-weight: 600;
  color: var(--gelb);
  text-align: center;
  line-height: 1.2;
  word-break: break-all;
  pointer-events: none;
}

.feld-anzeige.leer {
  color: #3a3a6a;
  font-size: clamp(0.8rem, 3vw, 1.1rem);
  font-weight: 400;
}

/* Bruch-Darstellung im Feld */
.feld-bruch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(0.55rem, 2vw, 0.8rem);
  line-height: 1.1;
}
.feld-bruch-z { border-bottom: 1.5px solid var(--gelb); padding-bottom: 1px; }
.feld-bruch-n { padding-top: 1px; }

/* ===== Aktionsbereich ===== */
.aktionen {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.spielen-btn {
  background: var(--teal);
  color: #0a0a1a;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 2rem;
  font-family: 'Barlow', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s, opacity 0.2s, transform 0.1s;
}
.spielen-btn:disabled           { opacity: 0.3; cursor: not-allowed; }
.spielen-btn:not(:disabled):hover  { background: var(--gelb); }
.spielen-btn:not(:disabled):active { transform: scale(0.97); }

.fehler-box {
  margin-top: 0.75rem;
  background: #2a0a12;
  border: 1.5px solid #ff3366;
  border-radius: var(--radius);
  color: #ff8099;
  padding: 0.7rem 1rem;
  font-size: 0.82rem;
  text-align: center;
}
.fehler-box.versteckt { display: none; }

/* ===== Tastatur-Overlay ===== */
.tastatur-overlay {
  position: fixed;
  inset: 0;
  background: #00000070;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tastatur-overlay.versteckt { display: none; }

.tastatur-panel {
  background: #12122e;
  border-top: 1.5px solid #3a3a7a;
  border-radius: 18px 18px 0 0;
  padding: 1rem 1rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 -8px 40px #00000080;
}

/* ===== Vorschau ===== */
.tastatur-vorschau-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.tastatur-vorschau {
  flex: 1;
  min-height: 52px;
  background: #1e1e42;
  border: 1.5px solid #3a3a7a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gelb);
  letter-spacing: 0.05em;
}

.tastatur-vorschau .vorschau-bruch {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 1rem;
  line-height: 1.15;
}
.vorschau-bruch-z { border-bottom: 1.5px solid var(--gelb); padding: 0 4px 2px; }
.vorschau-bruch-n { padding: 2px 4px 0; }

.tastatur-vorschau .vorschau-wurzel {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.vorschau-wurzel-sym { font-size: 1.5rem; line-height: 1; }
.vorschau-wurzel-zahl { border-top: 1.5px solid var(--gelb); padding: 0 3px; }

.tastatur-nav {
  background: #1e2a42;
  border: 1.5px solid #2a4a6a;
  border-radius: 10px;
  color: var(--teal);
  font-size: 1rem;
  width: 44px;
  height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  flex-shrink: 0;
}
.tastatur-nav:active { background: #253550; }

.tastatur-loeschen {
  background: #2a1a3a;
  border: 1.5px solid #5a3a7a;
  border-radius: 10px;
  color: #c090e0;
  font-size: 1.4rem;
  width: 52px;
  height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  flex-shrink: 0;
}
.tastatur-loeschen:active { background: #3a1a4a; }

.tastatur-cursor {
  color: var(--teal);
  font-weight: 300;
  animation: cursor-blink 1s step-start infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ===== Tastenzeilen ===== */
.tastatur-zeile {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.taste {
  flex: 1;
  min-height: 52px;
  border-radius: 8px;
  border: 1.5px solid #3a3a6a;
  font-family: 'Barlow', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.taste:active { transform: scale(0.93); }

.taste-zahl {
  background: #2a2a50;
  color: #e0e0ff;
  font-size: 1.25rem;
}
.taste-zahl:active { background: #3a3a70; }

.taste-sonder {
  background: #1e2a42;
  color: var(--teal);
  font-size: 1rem;
  border-color: #2a4a6a;
}
.taste-sonder:active { background: #253550; }

.taste-bruch {
  background: #1e1e42;
  color: #c0b0ff;
  border-color: #4a3a8a;
  font-size: 0.75rem;
  flex-direction: column;
  gap: 1px;
}
.taste-bruch:active { background: #252555; }

.taste-breit { flex: 2; }

/* Bruch-Darstellung auf Taste */
.bruch-anzeige {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  font-size: 0.8rem;
  font-weight: 700;
}
.bruch-z {
  border-bottom: 1.5px solid #c0b0ff;
  padding: 0 3px 1px;
  min-width: 14px;
  text-align: center;
}
.bruch-s {
  padding: 1px 3px 0;
  min-width: 14px;
  text-align: center;
}

.taste-var {
  background: #1a2a3a;
  color: #7ec8e3;
  border-color: #2a4a6a;
  font-size: 1.15rem;
  font-style: italic;
}
.taste-var:active { background: #253550; }

.taste-op {
  background: #2a1e3a;
  color: #c0a0ff;
  border-color: #4a3a7a;
  font-size: 1.2rem;
}
.taste-op:active { background: #382850; }

.tastatur-trennlinie {
  height: 1px;
  background: #2a2a5a;
  margin: 4px 0 8px;
}

.tastatur-aktionen { margin-top: 4px; }

.taste-abbrechen {
  background: #2a1a2a;
  color: #a08090;
  border-color: #4a2a4a;
  font-size: 0.9rem;
}
.taste-abbrechen:active { background: #3a203a; }

.taste-ok {
  background: var(--teal);
  color: #0a0a1a;
  border-color: var(--teal);
  font-size: 0.95rem;
  font-weight: 700;
}
.taste-ok:active { background: #20b8ac; }

/* ===== Bruch-Popup ===== */
.bruch-popup {
  position: fixed;
  inset: 0;
  background: #00000088;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.bruch-popup.versteckt { display: none; }

.bruch-popup-inhalt {
  background: #1a1a38;
  border: 1.5px solid #4a3a8a;
  border-radius: 16px;
  padding: 1.5rem;
  width: min(320px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bruch-popup-titel {
  font-family: 'Barlow', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #c0b0ff;
  text-align: center;
}

.bruch-eingabe-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.bruch-eingabe-wrap input {
  width: 120px;
  background: #12122a;
  border: 1.5px solid #3a3a7a;
  border-radius: 8px;
  color: var(--gelb);
  font-family: 'Barlow', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
  -webkit-appearance: none;
  appearance: none;
}
.bruch-eingabe-wrap input:focus {
  outline: none;
  border-color: var(--teal);
}

.bruch-strich-anzeige {
  color: #c0b0ff;
  font-size: 0.9rem;
  letter-spacing: -0.1em;
}

.bruch-popup-aktionen {
  display: flex;
  gap: 0.75rem;
}
.bruch-popup-aktionen button {
  flex: 1;
  min-height: 44px;
  border-radius: 8px;
  border: 1.5px solid #3a3a7a;
  background: #2a2a50;
  color: #a0a0d0;
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.bruch-popup-aktionen .taste-ok {
  background: var(--teal);
  color: #0a0a1a;
  border-color: var(--teal);
}

@media (max-width: 380px) {
  .karten-grid { gap: 4px; }
  .taste { min-height: 46px; }
}
