:root {
  --bg: #f3f1ec; --card: #fff; --ink: #1f2430; --muted: #6b7280; --line: #e4e1da;
  --accent: #1f6f5c; --accent-ink: #fff; --warn: #b45309; --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
h1, h2, h3 { margin: 0 0 .35em; line-height: 1.2; }
h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .7em; }

.top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; padding-top: env(safe-area-inset-top); }
.top-inner { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px; }
.tour-title { font-weight: 700; font-size: 1.05rem; }
.who { font-size: .9rem; opacity: .85; margin-top: 2px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; color: #fff; margin-left: 4px; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: #888; }
.conn.on { background: #34d399; } .conn.off { background: #f87171; }
.tabs { display: flex; padding: 0 8px; }
.tab { flex: 1; background: none; border: 0; color: #fff; opacity: .65; padding: 10px; font: inherit; font-weight: 600; border-bottom: 3px solid transparent; }
.tab.active { opacity: 1; border-color: #34d399; }
.count:not(:empty) { background: #34d399; color: var(--ink); border-radius: 99px; padding: 0 7px; font-size: .8rem; margin-left: 4px; }

main { max-width: 560px; margin: 0 auto; padding: 14px 12px 80px; }
main.simple { padding: 40px 20px; text-align: center; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 1px solid var(--line); }
.card.open { border-left: 5px solid var(--accent); animation: pop .35s ease-out; }
.card.done { opacity: .9; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-type { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }

.btn { display: block; width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 600; color: var(--ink); text-align: center; cursor: pointer; margin-top: 8px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .55; }
.btn.option { text-align: left; }
.photo-pick { background: #eef6f3; border-color: #cfe5dd; }
textarea, input { width: 100%; font: inherit; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
textarea { resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; } .row .btn { width: auto; margin: 0; padding: 11px 18px; }
.preview { width: 100%; border-radius: 10px; margin-top: 10px; }
.thumb { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; }
.question { font-weight: 600; }
.loc { background: #f6f4ef; border-radius: 10px; padding: 12px; }
.loc-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.manual { margin-top: 10px; } .manual summary { color: var(--muted); font-size: .9rem; cursor: pointer; padding: 4px 0 8px; }
.ok { color: var(--accent); font-weight: 600; }
blockquote { margin: 0; padding: 8px 12px; background: #f6f4ef; border-radius: 8px; }

.results { display: grid; gap: 6px; }
.res { position: relative; display: flex; justify-content: space-between; padding: 8px 10px; border-radius: 8px; background: #f2f2f2; overflow: hidden; font-size: .92rem; }
.res .bar { position: absolute; inset: 0 auto 0 0; background: #d7ebe4; z-index: 0; transition: width .4s; }
.res.mine .bar { background: #a9d6c6; }
.res span, .res b { position: relative; z-index: 1; }

details#doneWrap > summary { color: var(--muted); font-weight: 600; padding: 10px 4px; cursor: pointer; }
.banner { background: #fff7e6; border: 1px solid #f3d9a4; color: #7a4b00; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.post { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.post-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.post-head time { margin-left: auto; color: var(--muted); font-weight: 400; }
.post img { width: 100%; border-radius: 10px; }
.post p { margin: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.25); z-index: 20; max-width: 90vw; text-align: center; }

/* ---------- Mehrzeilige Texte aus dem Story-Skript ---------- */
.card > p, .pinned-body { white-space: pre-line; }

/* ---------- Angeheftete Karte (z. B. Rollenkarte) ---------- */
.pinned { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.pinned summary { padding: 12px 16px; font-weight: 700; cursor: pointer; }
.pinned-body { padding: 0 16px 16px; }

/* ---------- Kartenstile ---------- */
.card.style-secret, .pinned.style-secret { border-color: #7f1d1d; box-shadow: 0 0 0 1px #7f1d1d inset; }
.card.style-reveal { border-left: 5px solid #b8860b; }

/* ---------- Thema „noir“ (Krimidinner) ---------- */
html.theme-noir { background: #15161b; }
body.theme-noir .who span#myName { font-weight: 600; }
body.theme-noir {
  min-height: 100vh;
  --bg: #15161b; --card: #20222a; --ink: #ece6d8; --muted: #9a958a; --line: #34363f;
  --accent: #b8860b; --accent-ink: #15161b;
  background: radial-gradient(ellipse at top, #24252d 0%, #15161b 60%) fixed;
}
body.theme-noir h1, body.theme-noir h2, body.theme-noir h3, body.theme-noir .tour-title, body.theme-noir .pinned summary {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif; letter-spacing: .01em;
}
body.theme-noir .top { background: #0d0e12; border-bottom: 1px solid #2a2b33; }
body.theme-noir .tab.active { border-color: var(--accent); }
body.theme-noir .count:not(:empty) { background: var(--accent); }
body.theme-noir .card { box-shadow: 0 2px 10px rgba(0,0,0,.35); }
body.theme-noir .card > p { line-height: 1.55; }
body.theme-noir .btn { background: #2a2c35; color: var(--ink); border-color: #3a3c46; }
body.theme-noir .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
body.theme-noir textarea, body.theme-noir input { background: #15161b; color: var(--ink); border-color: #3a3c46; }
body.theme-noir .res { background: #2a2c35; }
body.theme-noir .res .bar { background: #4a3d1c; } body.theme-noir .res.mine .bar { background: #7a6020; }
body.theme-noir blockquote, body.theme-noir .loc { background: #2a2c35; }
body.theme-noir .banner { background: #2a2416; border-color: #5a4a20; color: #e8d7a8; }
body.theme-noir .toast { background: var(--accent); color: var(--accent-ink); }
body.theme-noir .card.style-secret { background: linear-gradient(180deg, #2a1416, #20222a 40%); border-color: #7f1d1d; }
body.theme-noir .card.style-reveal { background: linear-gradient(180deg, #2b2513, #20222a 50%); }
body.theme-noir .pinned.style-secret summary { color: #f2a1a1; }
body.theme-noir .ok { color: var(--accent); }
