/* ─────────────────────────────────────────────
   shared.css  –  Gemeinsame Stile für alle Seiten
   ───────────────────────────────────────────── */

@font-face {
  font-family: "CMB";
  src: local("CMB"), url("cmb.otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #1f3a2f;
  --card: #f9fbf7;
  --text: #1b2b22;
  --muted: #4f6156;
  --border: #cfd8ce;
  --shadow: 0 22px 60px rgba(9, 25, 16, 0.24);
  --btn: #173628;
  --brand-font: "CMB", "Comic Sans MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* ── Game-page body: centred, full viewport, never scrolls ── */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: url("images/background.png") center center / cover fixed, var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    calc(clamp(10px, 2vw, 20px) + env(safe-area-inset-top))
    calc(clamp(10px, 2vw, 20px) + env(safe-area-inset-right))
    calc(clamp(10px, 2vw, 20px) + env(safe-area-inset-bottom))
    calc(clamp(10px, 2vw, 20px) + env(safe-area-inset-left));
}

/* Legal/content pages: normal flow, scrollable like homepage */
body.scrollable {
  display: block;
  min-height: unset;
  height: auto;
  justify-content: unset;
  align-items: unset;
  padding: 0;
}

/* ── App-wrapper: fills available height ── */
.app {
  width: min(1180px, 100%);
  height: 100%;
  max-height: calc(100dvh - 2 * clamp(10px, 2vw, 20px) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Scrollable pages: auto height */
body.scrollable .app {
  height: auto;
  max-height: none;
  margin-inline: auto;
  padding:
    calc(clamp(14px, 3vw, 32px) + env(safe-area-inset-top))
    calc(clamp(14px, 3vw, 32px) + env(safe-area-inset-right))
    calc(clamp(14px, 3vw, 32px) + env(safe-area-inset-bottom))
    calc(clamp(14px, 3vw, 32px) + env(safe-area-inset-left));
  gap: clamp(10px, 2vw, 16px);
}

/* Mobile: allow scroll on game pages too */
@media (max-height: 500px), (max-width: 480px) {
  html, body { height: auto; }
  body { justify-content: flex-start; overflow: auto; }
  .app { height: auto; max-height: none; }
}

/* ── Topbar / Header ── */
.topbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
}

.topRight {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.topbarActions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Brand logo matches homepage style */
.brandLogo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.brandLogo .brandSlogan {
  font-size: clamp(10px, 1.2vw, 13px);
  color: rgba(230, 245, 225, 0.78);
  font-weight: 700;
  line-height: 1.1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.brandLogo .brandName {
  font-family: var(--brand-font);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 400;
  line-height: 1;
  color: #f0f7ec;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
  letter-spacing: 0.2px;
}

.brandLogo:hover { opacity: 0.9; }

/* ── Buttons ── */
button {
  border: 1px solid var(--border);
  background: var(--btn);
  color: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 850;
  cursor: pointer;
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1;
  transition: transform 0.06s ease, filter 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  white-space: nowrap;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }
button.secondary { background: rgba(255,255,255,0.18); color: #f0f7ec; border-color: rgba(255,255,255,0.28); backdrop-filter: blur(6px); }
button.secondary:hover { background: rgba(255,255,255,0.28); }
button:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

/* Link-Buttons (a-Tag statt button) */
.buttonLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.18);
  color: #f0f7ec;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 850;
  font-size: clamp(13px, 1.4vw, 15px);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.06s ease, filter 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  white-space: nowrap;
}

.buttonLink:hover { background: rgba(255,255,255,0.28); }
.buttonLink:active { transform: translateY(1px); }

/* ── Stage (weiße Hauptkarte) ── */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  background: linear-gradient(180deg, #fcfefb 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: clamp(12px, 1.8vw, 18px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.6vw, 14px);
}

body.scrollable .stage {
  flex: none;
  overflow: visible;
  display: block;
}

.screen { height: 100%; display: none; min-height: 0; overflow: hidden; }
.screen.active { display: flex; flex-direction: column; }

/* ── Setup-Layout (Spiele Startseite) ── */
.setup {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(12px, 1.8vw, 16px);
  overflow: hidden;
}

/* ── Hero (linke farbige Spalte) ── */
.hero {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* background: per Spiel in der jeweiligen CSS */
}

.heroInner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(14px, 2vw, 22px);
  height: 100%;
  position: relative;
  z-index: 1;
}

.heroTitle {
  margin: 0;
  font-family: var(--brand-font);
  font-size: clamp(22px, 3.2vw, 38px);
  font-weight: 400;
  color: #f7f9f2;
  text-shadow: 0 1px 0 rgba(8, 20, 14, 0.45);
  line-height: 1.1;
  text-align: center;
}

.heroDesc {
  margin: 0;
  color: rgba(247, 249, 242, 0.88);
  font-weight: 650;
  line-height: 1.4;
  font-size: clamp(13px, 1.3vw, 15px);
}

.heroDesc p { margin: 0 0 6px; }
.heroDesc p:last-child { margin-bottom: 0; }

/* Spacer pushes gameInfo + chips to bottom */
.heroSpacer { flex: 1 1 auto; }

/* ── Kompetenz-Box ── */
.gameInfo {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}

.gameInfoTitle {
  display: block;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 5px;
  text-align: center;
}

.gameInfoText {
  color: rgba(255,255,255,0.88);
  font-size: clamp(12px, 1.15vw, 13px);
  line-height: 1.45;
  font-weight: 650;
  text-align: center;
}

/* ── Chips (Spielmodi etc.) ── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 850;
  font-size: clamp(11px, 1.1vw, 13px);
  color: #173047;
  white-space: nowrap;
}

/* ── Settings-Panel (rechte Spalte) ── */
.settings {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: clamp(12px, 1.8vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

/* "Einstellungen" — gleicher Stil wie "Spieleauswahl" auf Startseite */
.settingsTitle {
  margin: 0 0 2px;
  font-family: inherit;
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 700;
  letter-spacing: 0.2px;
  letter-spacing: 0.2px;
  color: var(--text);
  flex: 0 0 auto;
}

.spacer { flex: 1 1 auto; }

.startRow {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.startRow button {
  flex: none;
}

/* Button inside settings (dark, not transparent) */
.settings button {
  background: var(--btn);
  color: #fff;
  border-color: transparent;
}

.settings button.secondary,
.screen button.secondary {
  background: #e8efea;
  color: #183424;
  border-color: var(--border);
  backdrop-filter: none;
}

/* ── Formular-Elemente ── */
.block {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px;
  flex: 0 0 auto;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 850;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #7aab8c;
  box-shadow: 0 0 0 3px rgba(38, 89, 63, 0.15);
}

/* ── Stat-Boxen ── */
.stat {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fafafa;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
}

.stat strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-family: var(--brand-font);
  font-weight: 400;
  font-size: 22px;
}

/* ── Settings: Zeilen-Layouts ── */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Settings: Modus-Buttons ── */
.modeBtns { display: flex; gap: 6px; flex-wrap: wrap; }
.modeBtn {
  flex: 1;
  background: #eef2ee;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 4px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  backdrop-filter: none;
}
.settings .modeBtn              { background: #eef2ee; color: var(--muted); border-color: var(--border); }
.settings .modeBtn:hover        { background: #e2ebe2; color: var(--text); filter: none; }
.settings .modeBtn.active       { background: var(--btn); color: #fff; border-color: var(--btn); }
.settings .modeBtn.active:hover { filter: none; }

/* ── Settings: Toggle-Switch ── */
.toggleRow { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; user-select: none; }
.toggleRow input[type="checkbox"] { display: none; }
.toggleTrack {
  width: 42px; height: 24px; background: #d0d5d0;
  border-radius: 999px; position: relative; flex-shrink: 0; transition: background 0.2s;
}
.toggleRow input:checked + .toggleTrack { background: #2f6d4f; }
.toggleThumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggleRow input:checked + .toggleTrack .toggleThumb { transform: translateX(18px); }
.toggleVal { font-size: 13px; font-weight: 850; color: var(--text); min-width: 6ch; }

/* ── Settings: Horizontaler Zähler ── */
.hCounterBox { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.hCounterBtn,
.settings .hCounterBtn {
  width: 34px; height: 34px; background: #eef2ee;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 18px; font-weight: 900; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: opacity 0.1s; backdrop-filter: none; padding: 0;
}
.hCounterBtn:hover,
.settings .hCounterBtn:hover { background: #eef2ee; filter: none; opacity: 0.7; }
.hCounterBtn:disabled,
.settings .hCounterBtn:disabled { opacity: 0.3; cursor: not-allowed; }
.hCounterVal {
  font-family: var(--brand-font);
  font-size: clamp(20px, 2.8vw, 30px); font-weight: 400;
  color: var(--text); min-width: 3ch; text-align: center; line-height: 1;
}
.hCounterVal.dimmed { opacity: 0.35; }

/* ── Settings: Vertikaler Spielerzähler + Namen ── */
.playerSetup { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; }
.playerCountCol { display: flex; flex-direction: column; gap: 6px; }
.counterBox { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.counterBtn,
.settings .counterBtn {
  width: 40px; height: 36px; background: #eef2ee;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 18px; font-weight: 900; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: opacity 0.1s; backdrop-filter: none; padding: 0;
}
.counterBtn:hover,
.settings .counterBtn:hover { background: #eef2ee; filter: none; opacity: 0.75; }
.counterVal {
  font-family: var(--brand-font);
  font-size: clamp(28px, 3.5vw, 38px); font-weight: 400;
  color: var(--text); line-height: 1; min-width: 2ch; text-align: center;
}
.playerNamesCol { display: flex; flex-direction: column; gap: 4px; }

textarea { resize: none; min-height: 120px; font-weight: 750; line-height: 1.25; }

/* ── Hilfsklassen ── */
.isHidden { display: none !important; }
.mt10 { margin-top: 10px; }
.small { font-size: 12px; color: var(--muted); font-weight: 750; margin-top: 6px; line-height: 1.25; }

/* ── Content-Seiten (Datenschutz, Impressum, Unsere Idee) ── */
body.scrollable .topbar { margin-bottom: 0; }

.contentCard {
  background: rgba(252, 254, 251, 0.97);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 36px);
  margin-bottom: clamp(10px, 2vw, 16px);
}

.contentCard h1 {
  font-family: var(--brand-font);
  font-size: clamp(24px, 3.5vw, 38px);
  font-weight: 400;
  color: var(--text);
  margin: 0 0 8px;
}

.contentCard h2 {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text);
  margin: 24px 0 8px;
}

.contentCard h2:first-of-type { margin-top: 16px; }

.contentCard p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 0 12px;
  font-size: clamp(14px, 1.4vw, 16px);
}

.contentCard a { color: var(--text); }

.contentLegalBar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0;
}

.contentLegalBar a {
  text-decoration: none;
  color: rgba(230, 245, 225, 0.85);
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: opacity 0.12s;
}

.contentLegalBar a + a::before {
  content: "|";
  color: rgba(230, 245, 225, 0.45);
  margin: 0 8px;
}

.contentLegalBar a:hover { opacity: 0.82; }

/* ── Responsive ── */
@media (max-width: 680px) {
  .setup {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .hero {
    min-height: 240px;
    flex: 0 0 auto;
  }

  .topRight { flex-wrap: wrap; gap: 8px; }

  .brandLogo .brandSlogan { display: none; }
}

@media (max-width: 400px) {
  .topbarActions { gap: 6px; }
  button, .buttonLink { padding: 10px 12px; font-size: 12px; }
}
