:root {
  --bg: #121213;
  --text: #ffffff;
  --rahmen: #3a3a3c;
  --rahmen-hell: #565758;
  --gruen: #6aaa64;
  --gelb: #c9b458;   /* schon vordefiniert – brauchst du in M2 */
  --grau: #3a3a3c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  text-align: center;
  padding: 16px;
  border-bottom: 1px solid var(--rahmen);
}
.app-header h1 {
  margin: 0;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-size: 1.6rem;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}

/* ---- Raster ---- */
.raster {
  display: grid;
  grid-template-columns: repeat(5, 60px);
  grid-auto-rows: 60px;
  gap: 6px;
  margin-bottom: 16px;
}

.feld {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--rahmen);
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  user-select: none;
}
.feld.gefuellt { border-color: var(--rahmen-hell); }

/* Auswertungs-Farben */
.feld.gruen { background: var(--gruen); border-color: var(--gruen); }
.feld.gelb  { background: var(--gelb);  border-color: var(--gelb); }
.feld.grau  { background: var(--grau);  border-color: var(--grau); }

.meldung {
  min-height: 1.4em;
  font-weight: 600;
  text-align: center;
}

.hint {
  max-width: 360px;
  text-align: center;
  color: #a1a1aa;
  font-size: 0.88rem;
  line-height: 1.5;
}
code {
  background: rgba(255,255,255,0.1);
  padding: 1px 6px;
  border-radius: 6px;
}

.app-footer {
  text-align: center;
  padding: 12px;
  color: #6b7280;
  font-size: 0.8rem;
}

/* Auf kleinen Handys die Felder etwas verkleinern */
@media (max-width: 360px) {
  .raster { grid-template-columns: repeat(5, 52px); grid-auto-rows: 52px; }
  .feld { font-size: 1.6rem; }
}

.neustart {
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--gruen);
  cursor: pointer;
}

.tastatur {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  width: 100%;
  max-width: 500px;
}
.tasten-reihe {
  display: flex;
  justify-content: center;
  gap: 6px;
}
.taste {
  flex: 1;
  min-width: 30px;
  height: 48px;
  padding: 0 6px;
  border: none;
  border-radius: 6px;
  background: #818384;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}
.taste-breit { flex: 1.5; font-size: 0.8rem; }
.taste.gruen { background: var(--gruen); }
.taste.gelb  { background: var(--gelb); }
.taste.grau  { background: #3a3a3c; }

/* Aufdeck-Animation (M6) */
@keyframes aufdecken {
  0%   { transform: scaleY(1); }
  50%  { transform: scaleY(0); }
  100% { transform: scaleY(1); }
}
.feld.aufgedeckt { animation: aufdecken 0.5s ease; }

.teilen {
  margin-top: 8px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #4f46e5;
  cursor: pointer;
}
.statistik {
  margin-top: 12px;
  color: #a1a1aa;
  font-size: 0.85rem;
  text-align: center;
}

.modus-wahl { display: flex; gap: 6px; margin-bottom: 14px; }
.modus-knopf {
  border: 1px solid var(--rahmen);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.modus-knopf.aktiv { background: #4f46e5; border-color: transparent; }

/* Aktives Feld hervorheben (anklickbar) */
.feld.aktiv-feld {
  border-color: #4f46e5;
  box-shadow: inset 0 0 0 2px #4f46e5;
}

/* Alles ohne Scrollen auf den Schirm bringen */
html, body { height: 100%; }
body { height: 100dvh; overflow: hidden; }
.app-header { padding: 8px; }
.app-header h1 { font-size: 1.3rem; }
main { min-height: 0; padding: 8px; gap: 2px; justify-content: flex-start; }
.raster {
  grid-template-columns: repeat(5, min(58px, 14vw));
  grid-auto-rows: min(58px, 14vw);
  margin-bottom: 8px;
}
.feld { font-size: min(2rem, 7.5vw); }
.hint { display: none; }
#tastatur { margin-top: 6px; }
.taste { height: clamp(38px, 6.5vh, 48px); }
.app-footer {
  display: block;
  position: fixed;
  bottom: 2px;
  right: 6px;
  padding: 0;
  margin: 0;
  font-size: 0.62rem;
  color: #555;
  pointer-events: none;
}
.raster { margin-bottom: 2px; }
.meldung { min-height: 1.2em; margin: 0; }
.statistik { margin-top: 2px; }
#tastatur { margin-top: 4px; }

.app-header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.logo {
  height: 1.4em;
  width: 1.4em;
  border-radius: 6px;
}

.tasten-reihe { gap: 4px; }
.taste {
  min-width: 0;
  padding: 0;
  flex: 1 1 0;
}
.taste-breit { font-size: 1rem; }

/* Sprach-Knopf mit Flagge, rechts oben in der Kopfzeile */
.app-header { position: relative; }
.sprache-knopf {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  padding: 2px;
  border: 1px solid var(--rahmen);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  line-height: 0;
}
.sprache-knopf img {
  width: 30px;
  height: 20px;
  display: block;
  object-fit: cover;
  border-radius: 3px;
}

/* Weiße Katzen-Silhouette, links oben auf Höhe der Flagge */
.katze-ecke {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  height: 24px;
  width: auto;
  pointer-events: none;
}

/* Doppeltipp-Zoom auf dem Handy verhindern */
body { touch-action: manipulation; }
.taste, .feld, .modus-knopf, .neustart, .teilen, .sprache-knopf {
  touch-action: manipulation;
}

/* Tagesrätsel-Frage (neues Wort vs. altes weiterspielen) */
.tages-frage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0;
  font-size: 0.85rem;
  color: var(--text);
}
.tages-frage[hidden] { display: none; }