/* app.css — Messe-Begleiter
   Bildwelt der bisherigen Apps: Spieltisch aus Filz, Kartonagen-Cremeweiß,
   Meeple-Spielerfarben, Zahlen im Scoreboard-Monospace. */

:root {
  --felt: #1f3d34;
  --felt-2: #26493d;
  --felt-3: #2f5a4b;
  --paper: #faf6ec;
  --paper-2: #f1ead8;
  --ink: #21201c;
  --muted: #7c766a;
  --line: #e2d9c4;
  --gold: #e0a530;
  --gold-d: #b9821a;
  --good: #3f8a5f;
  --bad: #c43d50;
  --warn: #c98d1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .18);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(140% 100% at 50% -10%, var(--felt-2), var(--felt) 60%) fixed;
  background-color: var(--felt);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-d); }
.hidden { display: none !important; }
.boot { color: var(--paper); opacity: .7; padding: 40vh 16px 0; text-align: center; font-family: var(--mono); }

/* ---------------------------------------------------------------- Rahmen */
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 32px; }
.wrap.narrow { max-width: 440px; }
.page { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  color: var(--paper);
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(31, 61, 52, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .2px; min-width: 0; }
.brand .meeple { width: 28px; height: 28px; flex: 0 0 auto; }
.brand-text { min-width: 0; }
.brand-text small { display: block; font-weight: 500; opacity: .7; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.chip {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .4px;
  background: rgba(255, 255, 255, .12); color: var(--paper);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; border: 0;
}
.chip.warn { background: var(--warn); color: #fff; }
.avatar-btn { background: none; border: 0; padding: 4px 4px 4px 10px; cursor: pointer; border-radius: 999px; display: flex; align-items: center; gap: 8px;
  color: var(--paper); text-decoration: none; min-width: 0; }
.avatar-btn:hover { background: rgba(255, 255, 255, .08); }
.avatar-name { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.avatar-btn:focus-visible, .nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.banner {
  background: var(--warn); color: #fff; font-weight: 600; text-align: center;
  padding: 8px 16px; font-size: .9rem;
}

/* ---------------------------------------------------------------- Navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--paper); box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; text-decoration: none; color: var(--muted);
  font-size: .72rem; font-weight: 700; letter-spacing: .2px; min-height: var(--nav-h);
}
.nav a svg { width: 24px; height: 24px; }
.nav a.active { color: var(--felt); }
.nav a.active svg { color: var(--gold-d); }

@media (min-width: 900px) {
  .nav {
    top: 0; bottom: 0; right: auto; width: 96px; flex-direction: column; justify-content: flex-start;
    padding-top: 84px; box-shadow: 4px 0 20px rgba(0, 0, 0, .15);
  }
  .nav a { flex: 0 0 auto; padding: 14px 4px; }
  .layout { padding-left: 96px; }
  .topbar { padding-left: 112px; }
  .page { padding-bottom: 32px; }
  .wrap { max-width: 760px; }
}

/* ---------------------------------------------------------------- Karten und Text */
.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card.tight { padding: 14px 16px; }
.eyebrow {
  font-family: var(--mono); font-size: .7rem; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--gold-d);
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 800; }
h3 { font-size: 1rem; font-weight: 800; }
.page-title { color: var(--paper); margin: 8px 2px 14px; }
.page-title .eyebrow { color: var(--gold); }
.muted { color: var(--muted); }
.lead { margin: 8px 0 0; color: #4a463d; }
.small { font-size: .85rem; }
p { margin: 8px 0 0; }

/* ---------------------------------------------------------------- Formulare */
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: .8rem; font-weight: 700; color: #4a463d; margin-bottom: 5px; }
.field .hint { display: block; font-size: .78rem; color: var(--muted); margin-top: 4px; font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; outline: none; font-size: 1rem;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 165, 48, .2); }
.form-error {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #fbe9ec; color: var(--bad); font-weight: 600; font-size: .9rem;
}
.form-ok {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #e5f4e4; color: var(--good); font-weight: 600; font-size: .9rem;
}
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--felt); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 10px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .95rem; text-decoration: none;
  background: var(--paper-2); color: var(--ink);
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--felt); color: var(--paper); }
.btn.gold { background: var(--gold); color: #2b2210; }
.btn.danger { background: #fbe9ec; color: var(--bad); }
.btn.ghost { background: transparent; color: var(--felt); padding: 8px 10px; }
.btn.block { width: 100%; margin-top: 18px; }
.btn.small { padding: 7px 11px; font-size: .82rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* ---------------------------------------------------------------- Farbwahl */
.colors { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.color-opt { border: 0; background: none; padding: 3px; border-radius: 999px; cursor: pointer; display: flex; }
.color-opt[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.color-opt svg { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .name { font-weight: 800; }
.list .sub { font-size: .8rem; color: var(--muted); }
.list .meeple { width: 30px; height: 30px; flex: 0 0 auto; }
.menu-link { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.menu-link:first-of-type { border-top: 0; }
.menu-link .grow { flex: 1; }
.menu-link .chev { color: var(--muted); font-size: 1.2rem; }

.tag {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 999px; background: var(--paper-2); color: #55503f;
  border: 1px solid var(--line); margin-right: 4px; white-space: nowrap;
}
.tag.admin { background: #fff3d6; border-color: #ecd59c; color: #7a5a10; }
.tag.off { background: #fbe9ec; border-color: #f0c5cc; color: var(--bad); }
.tag.open { background: #e7f1fb; border-color: #c3dbf2; color: #2c5d8a; }

/* Prüfliste */
.checks .st { font-family: var(--mono); font-weight: 800; width: 22px; text-align: center; }
.checks .st.ok { color: var(--good); }
.checks .st.warn { color: var(--warn); }
.checks .st.error { color: var(--bad); }

/* ---------------------------------------------------------------- Dialog */
.dialog-bg {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 20, 16, .6);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
  overflow-y: auto;
}
@media (min-width: 600px) { .dialog-bg { align-items: center; } }
.dialog {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 480px; padding: 20px; position: relative; max-height: calc(100vh - 32px); overflow-y: auto;
}
.dialog .close {
  position: absolute; top: 10px; right: 10px; background: none; border: 0; font-size: 1.5rem;
  line-height: 1; padding: 6px 10px; cursor: pointer; color: var(--muted); border-radius: 8px;
}
.dialog h2 { padding-right: 34px; }

/* Link mit QR-Code */
.linkbox { margin-top: 14px; text-align: center; }
.linkbox .qr { width: 220px; height: 220px; background: #fff; padding: 10px; border-radius: 10px; border: 1px solid var(--line); }
.linkbox .url {
  font-family: var(--mono); font-size: .75rem; word-break: break-all; background: #fff;
  border: 1px dashed var(--line); padding: 8px; border-radius: 8px; margin-top: 10px; text-align: left;
}

/* ---------------------------------------------------------------- Hinweise */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 200;
  transform: translateX(-50%); background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center;
}
.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .meeple { width: 48px; height: 48px; opacity: .5; }

/* Platzhalter für spätere Meilensteine */
.soon { text-align: center; padding: 34px 16px; }
.soon .meeple { width: 56px; height: 56px; opacity: .55; }
.soon h2 { margin-top: 10px; }

/* Lasttest */
.progress { height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; background: var(--gold); width: 0; transition: width .2s; }
.mono { font-family: var(--mono); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .9rem; margin-top: 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.meeple.inline { width: 22px; height: 22px; vertical-align: -5px; }
.lead .meeple.inline { margin-right: 4px; }
.avatar-btn .meeple { width: 32px; height: 32px; display: block; }
.name .tag { margin-left: 6px; vertical-align: 2px; }
.menu-link .name { font-weight: 800; }

/* ---------------------------------------------------------------- Katalog */
.filters .input[type=search] { margin-bottom: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  border: 1.5px solid var(--line); background: #fff; color: #4a463d; border-radius: 999px;
  padding: 6px 12px; font-weight: 700; font-size: .82rem; cursor: pointer;
}
.chip-btn[aria-pressed="true"] { background: var(--felt); border-color: var(--felt); color: var(--paper); }
.count { margin-top: 10px; font-size: .78rem; color: var(--muted); font-family: var(--mono); }

.list.games > li { padding: 0; }
.game-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; width: 100%; color: var(--ink); text-decoration: none; }
.game-row .chev { color: var(--muted); font-size: 1.2rem; }
.thumb, .noimg.thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; background: var(--paper-2); }
.noimg { display: flex; align-items: center; justify-content: center; background: var(--paper-2); }
.noimg .meeple { width: 55%; height: 55%; opacity: .6; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; }
.meta .tag { margin-right: 0; }
.tag.ev { background: #eef3ef; border-color: #cfdcd2; color: #355b48; }
.tag.ev.current, .tag.current { background: #fff3d6; border-color: #ecd59c; color: #7a5a10; }
.tag.bought { background: #e5f4e4; border-color: #bfe0bd; color: var(--good); }
.dots { display: inline-flex; gap: 1px; margin-left: 2px; }
.list .meeple.dot, .meeple.dot { width: 18px; height: 18px; }

/* Spielseite */
.back { display: inline-block; color: var(--paper); text-decoration: none; font-weight: 700; margin: 4px 2px 12px; opacity: .85; }
.back:hover { opacity: 1; }
.game-hero { display: flex; gap: 16px; flex-wrap: wrap; }
.game-hero .cover { flex: 0 0 140px; }
.game-hero .cover img, .game-hero .cover .noimg { width: 140px; height: auto; min-height: 140px; border-radius: 10px; display: block; object-fit: contain; background: var(--paper-2); }
.game-hero .grow { flex: 1 1 220px; min-width: 0; }
.game-hero h1 { font-size: 1.5rem; margin: 0; }
@media (max-width: 420px) { .game-hero .cover { flex-basis: 100%; } .game-hero .cover img, .game-hero .cover .noimg { width: 100%; max-height: 320px; } }
.desc { white-space: pre-line; }
.card h2 .tag { margin-left: 6px; vertical-align: 3px; }
.strip { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 4px; scroll-snap-type: x mandatory; }
.shot { flex: 0 0 auto; border: 0; padding: 0; background: none; cursor: zoom-in; scroll-snap-align: start; border-radius: 8px; overflow: hidden; }
.shot img { height: 120px; width: auto; display: block; }
.dialog.wide { max-width: 900px; }
img.big { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; border-radius: 8px; background: #000; }
.btn-row.center { justify-content: center; align-items: center; }
.score { font-family: var(--mono); font-weight: 800; font-size: 1.05rem; }
.score.big { margin-left: auto; font-size: 1.3rem; color: var(--gold-d); }
h2.with-score { display: flex; align-items: baseline; gap: 8px; }
.pair { display: flex; align-items: center; gap: 8px; }
.pair .input { flex: 1; min-width: 0; }

/* Veranstaltungen */
.events { display: grid; gap: 12px; margin-bottom: 4px; }
.events .card { margin: 0; }
.ev-card { display: block; width: 100%; text-align: left; border: 0; font: inherit; color: inherit; }
.ev-card.clickable { cursor: pointer; }
.ev-card.clickable:hover { box-shadow: 0 0 0 2px var(--gold), var(--shadow); }
.ev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-head h2 { margin: 0; margin-right: auto; }
.progress.thin { height: 6px; margin-top: 10px; }
.tag.phase-messe { background: #e7f1fb; border-color: #c3dbf2; color: #2c5d8a; }
.tag.phase-vorab { background: #f1e9fb; border-color: #dccbf1; color: #5d3e8a; }
.tag.phase-archiv { background: #eee; border-color: #ddd; color: #666; }

/* Meeples in Auswahllisten (Stellvertretung, Teilnehmer) */
.check .meeple { width: 24px; height: 24px; flex: 0 0 auto; }
.check .tag { margin-left: 2px; }
