/* /app/src/pages/zeitvertreib/zeitvertreib.css
   Daily Whisper – komplette Spiel-UI
   Nutzt Theme-Variablen aus base.cleaned.css (--color-bg etc.)
*/

/* ============================================================
   Hub (/zeitvertreib)
   ============================================================ */
.whisper-hub {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 14px 16px;
  color: var(--color-text);
}

.whisper-intro-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-box);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  margin: 4px 0 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.whisper-intro-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.whisper-intro-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--color-muted);
  line-height: 1.4;
}

.whisper-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.whisper-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--color-box);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.whisper-card-emoji {
  font-size: 36px;
  line-height: 1;
  text-align: center;
}

.whisper-card-body h2 {
  font-size: 1.1rem;
  margin: 0 0 4px;
  color: var(--color-title);
}

.whisper-card-body p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.whisper-card-meta {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--color-muted);
  opacity: .85;
}

.whisper-card-actions {
  display: flex;
  gap: 8px;
}

.whisper-footnote {
  text-align: center;
  margin-top: 24px;
  font-size: 0.8rem;
}

/* ============================================================
   Generische Spiel-Page (Daily + Endless teilen sich das)
   ============================================================ */
.whisper-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 12px 24px;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  /* Keine Pinch-/Doppeltipp-Gesten: kein Zoom in dieser Route */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: contain;
}

.whisper-page,
.whisper-page * {
  touch-action: manipulation;
}

/* Meta-Zeile direkt unter dem Shell-Header (Datum + Streak / Stats) */
.whisper-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 12px;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 4px 0 12px;
  text-align: center;
  min-height: 20px;
}

.whisper-meta strong {
  color: var(--color-text);
  font-weight: 600;
}

.whisper-meta-date {
  font-weight: 500;
  color: var(--color-text);
  opacity: 0.9;
}

.whisper-meta span {
  white-space: nowrap;
}

.whisper-muted {
  color: var(--color-muted);
}

.whisper-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  padding: 8px 0;
  width: 100%;
}

/* ============================================================
   Spielfeld (Grid)
   ============================================================ */
.whisper-game {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  align-self: stretch;
}

.whisper-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: center;
}

.whisper-row {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.whisper-row[data-cols="4"] { grid-auto-columns: 56px; }
.whisper-row[data-cols="5"] { grid-auto-columns: 56px; }
.whisper-row[data-cols="6"] { grid-auto-columns: 50px; }

/* Mobil etwas kleiner */
@media (max-width: 380px) {
  .whisper-row[data-cols="4"] { grid-auto-columns: 50px; }
  .whisper-row[data-cols="5"] { grid-auto-columns: 50px; }
  .whisper-row[data-cols="6"] { grid-auto-columns: 44px; }
}

/* Grid braucht Spaltenzahl - oben war auto-flow column, jetzt korrigieren */
.whisper-grid > .whisper-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 6px;
}

/* (Re-)set per data attribute */
.whisper-grid[data-cols="4"] .whisper-row { grid-template-columns: repeat(4, 56px); }
.whisper-grid[data-cols="5"] .whisper-row { grid-template-columns: repeat(5, 56px); }
.whisper-grid[data-cols="6"] .whisper-row { grid-template-columns: repeat(6, 50px); }

@media (max-width: 380px) {
  .whisper-grid[data-cols="4"] .whisper-row { grid-template-columns: repeat(4, 50px); }
  .whisper-grid[data-cols="5"] .whisper-row { grid-template-columns: repeat(5, 50px); }
  .whisper-grid[data-cols="6"] .whisper-row { grid-template-columns: repeat(6, 44px); }
}

.whisper-cell {
  aspect-ratio: 1 / 1;
  border: 2px solid rgba(255,255,255,0.18);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-text);
  border-radius: 6px;
  user-select: none;
  transition: transform 120ms ease, border-color 200ms ease, background 200ms ease;
  perspective: 600px;
}

.whisper-cell.is-filled {
  border-color: rgba(255,255,255,0.55);
}

.whisper-cell-letter {
  display: inline-block;
  transition: transform 220ms ease;
}

.whisper-cell.pop {
  transform: scale(1.06);
}

/* Reveal-Flip */
@keyframes whisper-flip {
  0%   { transform: rotateX(0deg); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

.whisper-cell.is-flipping {
  animation: whisper-flip 440ms ease;
}

.whisper-cell.is-correct {
  background: #2fa44a;
  border-color: #2fa44a;
  color: #fff;
}
.whisper-cell.is-present {
  background: #c9a227;
  border-color: #c9a227;
  color: #fff;
}
.whisper-cell.is-absent {
  background: #4a3a6e;
  border-color: #4a3a6e;
  color: rgba(255,255,255,0.85);
}

/* Shake bei ungültigem Wort */
@keyframes whisper-shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
.whisper-row.shake { animation: whisper-shake 480ms ease; }

/* Bounce bei Sieg */
@keyframes whisper-bounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-12px); }
  50%  { transform: translateY(0); }
  70%  { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
.whisper-cell.bounce { animation: whisper-bounce 600ms ease; }

/* ============================================================
   Message-Toast (oberhalb Tastatur)
   ============================================================ */
.whisper-message {
  min-height: 28px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  background: rgba(0,0,0,0.35);
  padding: 6px 12px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  text-align: center;
  align-self: center;
}
.whisper-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Tastatur (rein On-Screen, immer klickbar)
   ============================================================ */
.whisper-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  align-self: stretch;
  box-sizing: border-box;
  padding: 0 4px env(safe-area-inset-bottom);
}

@media (min-width: 720px) {
  .whisper-keyboard {
    max-width: 560px;
    align-self: center;
  }
}

.whisper-kb-row {
  display: flex;
  gap: 5px;
  justify-content: center;
}

.whisper-key {
  flex: 1 0 0;
  min-width: 0;
  height: 52px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.16);
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background 160ms ease, color 160ms ease, transform 80ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.whisper-key:active {
  transform: scale(0.96);
}
.whisper-key-wide {
  flex: 1.6 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.whisper-key.is-correct {
  background: #2fa44a;
  color: #fff;
}
.whisper-key.is-present {
  background: #c9a227;
  color: #fff;
}
.whisper-key.is-absent {
  background: #2a1d4a;
  color: rgba(255,255,255,0.55);
}

@media (max-width: 380px) {
  .whisper-key {
    height: 46px;
    font-size: 0.98rem;
  }
  .whisper-kb-row { gap: 4px; }
}

/* iPhone SE und sehr schmale Geräte: Spielfeld etwas kleiner, Tastatur bleibt komfortabel */
@media (max-width: 360px) {
  .whisper-grid[data-cols="4"] .whisper-row { grid-template-columns: repeat(4, 46px); }
  .whisper-grid[data-cols="5"] .whisper-row { grid-template-columns: repeat(5, 46px); }
  .whisper-grid[data-cols="6"] .whisper-row { grid-template-columns: repeat(6, 40px); }
}

/* ============================================================
   Buttons / Aktionen
   ============================================================ */
.whisper-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.whisper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 140ms ease, transform 80ms ease;
}
.whisper-btn:active { transform: scale(0.97); }

.whisper-btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-text);
}
.whisper-btn-primary:hover {
  background: var(--color-primary-hover);
}

.whisper-btn-secondary {
  background: rgba(255,255,255,0.12);
  color: var(--color-text);
}
.whisper-btn-secondary:hover {
  background: rgba(255,255,255,0.18);
}

/* ============================================================
   "Heute schon gespielt"-Card (Daily)
   ============================================================ */
.whisper-already {
  background: var(--color-box);
  border-radius: var(--border-radius);
  padding: 28px 20px;
  text-align: center;
  max-width: 420px;
  margin: 24px auto;
  box-shadow: 0 2px 14px rgba(0,0,0,.2);
}

.whisper-already-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.whisper-already h2 {
  margin: 0 0 6px;
  color: var(--color-title);
}

/* ============================================================
   Overlay nach Spielende
   ============================================================ */
.whisper-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 8, 38, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
  backdrop-filter: blur(4px);
  animation: whisper-fade 220ms ease;
}
@keyframes whisper-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.whisper-overlay[hidden] { display: none; }

.whisper-overlay-card {
  background: var(--color-box);
  border-radius: var(--border-radius);
  padding: 28px 22px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.42);
  animation: whisper-pop 260ms cubic-bezier(.2,.8,.2,1.2);
}
@keyframes whisper-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.whisper-overlay-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.whisper-overlay-card h2 {
  margin: 0 0 8px;
  color: var(--color-title);
}

.whisper-streak-line {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.whisper-points {
  margin: 6px 0 0;
  font-weight: 700;
  color: var(--color-active);
}

/* ============================================================
   Filter-Button "active"-State (für Top-Menu Tabs)
   ============================================================ */
.filter-btn.is-active {
  background: var(--color-primary);
  color: var(--color-primary-text);
}
