/* Nur fuer die Statistik-Seite: Kacheln, Kreisdiagramm, Leaderboard,
   Alkoholmenge und das Teilen-Bild. */

/* --- Kacheln mit den Kennzahlen --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 12px 6px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* Als <span> in den Umschalt-Kacheln brauchen beide ein eigenes display. */
.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-dark);
  line-height: 1.1;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Die drei Zeitraum-Kacheln sind Buttons: Rahmen immer reservieren, damit
   beim Aktivieren nichts springt. */
.stat-btn {
  font-family: inherit;
  /* Sichtbarer Rahmen auch im Ruhezustand - so ist erkennbar, dass diese drei
     Kacheln bedienbar sind und "Sorten" daneben nur anzeigt. */
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.stat-btn:active { transform: scale(0.96); }

.stat-btn.active {
  border-color: var(--accent);
  background: #fff6ec;
}

.stat-btn.active .stat-value { color: var(--accent); }

.stat-btn.active .stat-label { color: var(--accent-dark); }

/* "Sorten" ist kein Umschalter und bekommt denselben Rahmenplatz, damit die
   vier Kacheln gleich hoch bleiben. */
.stat-passive { border: 1px solid transparent; }

.stats-scope {
  text-align: center;
  font-size: 0.78rem;
  color: var(--accent-dark);
  background: #fbeedd;
  border-radius: 10px;
  padding: 5px 10px;
  margin-top: 8px;
}

.stats-scope[hidden] { display: none; }

/* --- Kreisdiagramm nach Art --- */
.chart-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

/* Ohne Daten gibt es keinen Ring - dann nur den Hinweis mittig zeigen. */
.chart-card.is-empty { display: block; }

.donut {
  flex-shrink: 0;
  width: 132px;
}

.donut-svg {
  display: block;
  width: 100%;
  height: auto;
}

.donut-track {
  fill: none;
  stroke: #f1e8dd;
  stroke-width: 22;
}

.donut-seg {
  fill: none;
  stroke-width: 22;
}

.donut-value {
  text-anchor: middle;
  font-family: inherit;
  font-size: 30px;
  font-weight: 700;
  fill: var(--accent-dark);
}

.donut-label {
  text-anchor: middle;
  font-family: inherit;
  font-size: 13px;
  fill: var(--muted);
}

.chart-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--muted);
  font-size: 0.76rem;
  flex-shrink: 0;
}

/* Auf schmalen Geraeten Ring oben, Legende darunter. */
@media (max-width: 400px) {
  .chart-card {
    flex-direction: column;
    gap: 12px;
  }
  .donut { width: 150px; }
  .chart-legend { width: 100%; }
}

/* --- Leaderboard --- */
.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

.board-row.podium { border: 1px solid #f2e2cb; }

.board-rank {
  flex-shrink: 0;
  width: 26px;
  text-align: center;
  font-size: 1.1rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.board-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.board-name {
  font-size: 0.95rem;
  font-weight: 500;
  overflow-wrap: break-word;
}

.board-cat {
  font-size: 0.72rem;
  color: var(--muted);
}

.board-bar {
  display: block;
  height: 6px;
  border-radius: 4px;
  background: #f1e8dd;
  overflow: hidden;
  margin-top: 2px;
}

.board-bar-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.board-count {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

/* --- Alkoholmenge --- */
.alc-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alc-figure {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.alc-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.alc-unit {
  font-size: 0.85rem;
  color: var(--muted);
}

.alc-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.alc-btn {
  margin-top: 10px;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.alc-btn:active { background: var(--accent-dark); }

.alc-btn:disabled {
  background: #e6ddd2;
  color: var(--muted);
  cursor: default;
}

.alc-note {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 10px;
}

.alc-note[hidden] { display: none; }

/* Popup mit den Vergleichen */
.alc-sheet { max-width: 440px; }

.alc-headline {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.alc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Reicht auf üblichen Handys für alle Vergleiche; auf sehr flachen
     Bildschirmen wird gescrollt. */
  max-height: 58vh;
  overflow-y: auto;
}

.alc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
}

.alc-row:nth-child(odd) { background: #fdf8f2; }

.alc-emoji {
  font-size: 1.35rem;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}

.alc-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.alc-titel {
  font-size: 0.9rem;
  overflow-wrap: break-word;
}

.alc-info {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1px;
}

.alc-wert {
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-dark);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.alc-disclaimer {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

/* --- Teilen als Story-Bild --- */
.share-fab {
  width: auto;
  height: 52px;
  border-radius: 26px;
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-fab[hidden] { display: none; }

.share-sheet {
  margin: auto;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.modal-overlay.open .share-sheet {
  transform: none;
  opacity: 1;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f4ece2;
  border-radius: 12px;
}

.seg-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  border-radius: 9px;
  background: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.share-preview {
  display: block;
  width: 100%;
  max-height: 58vh;
  object-fit: contain;
  border-radius: 14px;
  background: var(--bg);
}

.share-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  min-height: 18px;
}
