/* ============================================================
   main.css — Rahmen der Hauptseiten (Startseite, My Map, Daily Fact, Weekly):
   Kopfzeile mit Navigation im Spielstein-Look, Streak-Chip, Fußzeile,
   Menü (Tablet) und Tab-Leiste (Handy). Inhalt der Startseite: css/start.css.
   ============================================================ */

* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Kopfzeile ---------- */
.kopf {
  --kante: #15122b;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 28px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}
:root[data-theme="light"] .kopf { --kante: #ddd5c3; }
.marke {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
/* Logo + Name führen zur Startseite */
a.marke { color: inherit; text-decoration: none; border-radius: 12px; transition: opacity .15s ease, transform .15s ease; }
a.marke:hover { opacity: .85; }
a.marke:active { transform: translateY(1px); }
a.marke:focus-visible { outline: 3px solid color-mix(in srgb, var(--mint) 60%, transparent); outline-offset: 4px; }
/* ---------- Navigation (Games / My Map / Daily Fact / Weekly Challenge) ----------
   Spielstein-Look: Links als Flächen, der aktive steht als Stein mit Unterkante hervor. */
.nav {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.8vw, 10px);
  margin: 0 auto 0 clamp(18px, 3vw, 40px);   /* neben dem Namen, Umschalter bleibt rechts */
}
.nav-link {
  position: relative;
  padding: 8px 15px;
  border: 2px solid transparent;
  border-radius: 14px;
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--bg-panel) 60%, transparent); }
.nav-link.aktiv { color: var(--ink); background: var(--bg-panel); border-color: var(--line); box-shadow: 0 4px 0 var(--kante); }
.nav-link:active { transform: translateY(2px); }
.nav-link:focus-visible { outline: none; color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 55%, transparent); }

/* ---------- Streak-Chip (js/streak.js): Flamme + Tage, links vom Hell/Dunkel-Schalter ---------- */
.streak-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 13px;
  border-radius: 14px; background: var(--bg-panel); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--kante);
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; cursor: default;
}
.streak-chip svg { width: 19px; height: 19px; color: #ff9632; }
.streak-chip.streak-null svg { color: var(--ink-muted); opacity: .55; }
.streak-chip.streak-null .streak-zahl { color: var(--ink-muted); }
/* „New“ an der Weekly Challenge: kleines leuchtendes Gold-Schild oben rechts neben dem Text.
   Es liegt außerhalb des Links (absolut), damit der Unterstrich nur unter dem Wort sitzt — mittig, auch auf der
   Weekly-Seite selbst. Platz dafür schafft der rechte Außenabstand.
   Verschwindet, sobald die Woche gespielt ist (js/weekly.js setzt data-weekly-fertig). */
.nav-weekly { margin-right: 1.6em; }
:root[data-weekly-fertig] .nav-weekly { margin-right: 0; }
.nav-neu {
  position: absolute;
  left: calc(100% - 6px);
  top: -7px;
  padding: 1px 6px 2px;
  border-radius: 999px;
  background: var(--amber);
  color: #1e1b34;
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.3;
  vertical-align: baseline;
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--amber) 70%, transparent);
  animation: nav-neu-leuchten 2.2s ease-in-out infinite;
}
:root[data-weekly-fertig] .nav-neu { display: none; }
@keyframes nav-neu-leuchten {
  0%, 100% { box-shadow: 0 0 4px 0 color-mix(in srgb, var(--amber) 55%, transparent); filter: brightness(1); }
  50% { box-shadow: 0 0 12px 3px color-mix(in srgb, var(--amber) 85%, transparent); filter: brightness(1.12); }
}
@media (prefers-reduced-motion: reduce) { .nav-neu { animation: none; } }
@media (max-width: 560px) {
  .kopf { padding-left: 14px; padding-right: 14px; gap: 8px; }
  /* Handy: Logo + Schalter oben, Navigation darunter in eigener Zeile */
  .kopf { flex-wrap: wrap; row-gap: 6px; }
  .kopf .marke { margin-right: auto; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-around; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { font-size: 0.9rem; }
}

.marke-logo {
  width: 38px;
  height: 39px;
  flex: none;
  display: block;
}
/* Landle-Logo: dunkle/helle Variante (assets/logo/, erzeugt von daten/skripte/landle-logo.py);
   im Dunkelmodus ein weicher Mint-Schein wie bei den Kacheln */
.marke-logo.logo-hell { display: none; }
.marke-logo.logo-dunkel { filter: drop-shadow(0 0 9px rgba(43, 217, 164, 0.42)); }
:root[data-theme="light"] .marke-logo.logo-dunkel { display: none; }
:root[data-theme="light"] .marke-logo.logo-hell { display: block; }

/* Hell/Dunkel-Schalter und Benutzer-Knopf (theme.css) in der Kopfzeile als Steine */
.kopf .thema, .kopf .rolle-knopf { border-width: 2px; border-radius: 14px; box-shadow: 0 4px 0 var(--kante); }
.kopf .rolle-knopf { height: 40px; }
.kopf .thema span { border-radius: 10px; }

/* ---------- Fuß (schlank) ---------- */
.fuss {
  flex: none;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- Menü am Handy (js/menue.js): ☰ links vom Logo, Panel klappt unter der Kopfzeile auf ---------- */
.menue-knopf, .menue, .menue-schleier { display: none; }
/* gilt, wenn die Navigation nicht in die Kopfzeile passt (js/menue.js setzt <html class="menue-modus">) */
:root.menue-modus .kopf { position: relative; flex-wrap: nowrap; }
:root.menue-modus .kopf .nav { display: none; }
:root.menue-modus .kopf .marke { margin-right: auto; }
:root.menue-modus .menue-knopf {
    position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 38px; padding: 0; margin-right: 2px;
    border-radius: 12px; cursor: pointer; background: var(--bg-panel); border: 1px solid var(--line); color: var(--ink);
  }
:root.menue-modus .menue-knopf:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 55%, transparent); }
:root.menue-modus .menue-striche, :root.menue-modus .menue-striche::before, :root.menue-modus .menue-striche::after {
    display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s ease, background .2s ease;
  }
:root.menue-modus .menue-striche { position: relative; }
:root.menue-modus .menue-striche::before, :root.menue-modus .menue-striche::after { content: ""; position: absolute; left: 0; }
:root.menue-modus .menue-striche::before { top: -6px; }
:root.menue-modus .menue-striche::after { top: 6px; }
:root.menue-modus .menue-knopf.offen .menue-striche { background: transparent; }
:root.menue-modus .menue-knopf.offen .menue-striche::before { transform: translateY(6px) rotate(45deg); }
:root.menue-modus .menue-knopf.offen .menue-striche::after { transform: translateY(-6px) rotate(-45deg); }
:root.menue-modus .menue-punkt {
    position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--amber);
    box-shadow: 0 0 0 2px var(--bg), 0 0 10px color-mix(in srgb, var(--amber) 80%, transparent);
  }
:root.menue-modus .menue-knopf.offen .menue-punkt, :root.menue-modus[data-weekly-fertig] .menue-punkt { display: none; }
:root.menue-modus .menue-schleier { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(10, 8, 30, .45); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
:root.menue-modus[data-theme="light"] .menue-schleier { background: rgba(40, 30, 10, .18); }
:root.menue-modus.menue-auf .kopf { z-index: 50; }
:root.menue-modus .menue {
    display: flex; flex-direction: column; gap: 2px; position: absolute; z-index: 50; top: calc(100% + 6px); left: 12px; right: 12px;
    padding: 8px; border-radius: 18px; background: var(--bg-panel); border: 1px solid var(--line); box-shadow: 0 24px 50px rgba(0, 0, 0, .35);
    transform-origin: top left; animation: menue-auf .18s ease-out;
  }
:root.menue-modus .menue[hidden], :root.menue-modus .menue-schleier[hidden] { display: none; }
:root.menue-modus .menue-link {
    display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 12px; text-decoration: none; color: var(--ink);
    font-family: var(--font-display); font-weight: 600; font-size: 1.08rem;
  }
:root.menue-modus .menue-link:hover, :root.menue-modus .menue-link:focus-visible { outline: none; background: color-mix(in srgb, var(--ink) 6%, transparent); }
:root.menue-modus .menue-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; font-size: 1rem; background: color-mix(in srgb, var(--ink) 7%, transparent); }
:root.menue-modus .menue-link.aktiv { background: color-mix(in srgb, var(--amber) 14%, transparent); }
:root.menue-modus .menue-link.aktiv .menue-ic { background: color-mix(in srgb, var(--amber) 30%, transparent); }
:root.menue-modus .menue-link.aktiv::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
:root.menue-modus .menue-neu {
    margin-left: auto; padding: 2px 8px; border-radius: 999px; font-family: var(--font-body, inherit); font-size: .66rem; font-weight: 800;
    letter-spacing: .06em; text-transform: uppercase; background: var(--amber); color: #1e1b34; box-shadow: 0 0 12px color-mix(in srgb, var(--amber) 55%, transparent);
  }
:root.menue-modus .menue-link.aktiv .menue-neu { margin-left: auto; }
:root.menue-modus .menue-link.aktiv:has(.menue-neu)::after { margin-left: 10px; }
:root.menue-modus[data-weekly-fertig] .menue-neu { display: none; }
@keyframes menue-auf { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

@media (prefers-reduced-motion: reduce) { .menue { animation: none; } .menue-striche, .menue-striche::before, .menue-striche::after { transition: none; } }

/* ---------- Tab-Leiste am Handy (js/menue.js): ersetzt dort das ☰-Menü ---------- */
.tabs { display: none; }
@media (max-width: 560px) {
  :root.menue-modus .menue-knopf { display: none; }
  .tabs {
    --kante: #15122b;
    display: flex; justify-content: space-around; gap: 4px;
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-panel); border-top: 2px solid var(--line);
  }
  :root[data-theme="light"] .tabs { --kante: #ddd5c3; }
  body.mit-tabs { padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .tab {
    position: relative; flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px 5px; border-radius: 12px; text-decoration: none; color: var(--ink-muted);
    font-family: var(--font-display); font-weight: 700; font-size: .72rem;
  }
  .tab svg { width: 22px; height: 22px; }
  .tab.aktiv { color: var(--ink); background: var(--bg-panel-2); box-shadow: 0 3px 0 var(--kante); }
  .tab:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 55%, transparent); }
  .tab-neu {
    position: absolute; top: 3px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%;
    background: var(--amber); box-shadow: 0 0 0 2px var(--bg-panel), 0 0 8px color-mix(in srgb, var(--amber) 80%, transparent);
  }
  :root[data-weekly-fertig] .tab-neu { display: none; }
}
