/* Gerücht – Oberfläche. 1920er: Papier, Sepia, Art-déco-Linien. Handy zuerst. */
:root {
  --paper: #f2e9d8;
  --paper-2: #e9dcc3;
  --card: #fbf6ec;
  --ink: #231c14;
  --muted: #6e604f;
  --rule: #cdbb9b;
  --sepia: #8a5a2b;
  --brass: #b0843a;
  --red: #9c2f1f;
  --teal: #2f5d5a;
  --ok: #3f6b3a;
  --shadow: 0 1px 0 rgba(35, 28, 20, .08), 0 6px 18px rgba(35, 28, 20, .10);
  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 10px;
  --tap: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #18140f; --paper-2: #221c15; --card: #241e17; --ink: #efe4cf; --muted: #b3a48c;
    --rule: #4a3f31; --sepia: #d09a5e; --brass: #d6aa5c; --red: #e0735f; --teal: #79b3ad; --ok: #8fbf86;
    --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --paper: #18140f; --paper-2: #221c15; --card: #241e17; --ink: #efe4cf; --muted: #b3a48c;
  --rule: #4a3f31; --sepia: #d09a5e; --brass: #d6aa5c; --red: #e0735f; --teal: #79b3ad; --ok: #8fbf86;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }
html[data-fontsize="gross"] { font-size: 18px; }
html[data-fontsize="sehr-gross"] { font-size: 20px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.45 var(--sans); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chip, .btn { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* --- Screen frame --- */
/* V216: use --app-h (set from window.innerHeight in app.js) so iOS PWA with black-translucent
   status bar fills the full screen; 100dvh falls short by the status bar height there. */
.screen { display: flex; flex-direction: column; height: var(--app-h, 100dvh); max-width: 480px; margin: 0 auto; background: var(--paper); position: relative; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 10px; border-bottom: 3px double var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font: 700 1.25rem/1.1 var(--serif); margin: 0; flex: 1; letter-spacing: .01em; }
.topbar .sub { display: block; font: 500 0.75rem/1.2 var(--mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 3px; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--rule); background: var(--card); display: grid; place-items: center; font-size: 1.125rem; }
.content { flex: 1; min-height: 0; padding: 14px 16px calc(60px + env(safe-area-inset-bottom)); overflow-y: auto; }
.kicker { font: 600 0.6875rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--sepia); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.kicker::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

/* V175: tabbar removed — only svg.i (speed buttons) remains */
svg.i { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.speed svg.i { width: 18px; height: 18px; stroke-width: 2.4; vertical-align: middle; }

/* V175: title as notebook button */
.topbar-btn { background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 4px 8px; text-align: left; cursor: pointer; flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; }
.topbar-btn .i { flex: none; opacity: .6; }
.topbar-btn .title-line { font: 700 1.0625rem/1.1 var(--serif); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-btn .sub { display: block; font: 500 0.6875rem/1.2 var(--mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; white-space: nowrap; }

/* --- Cards, chips --- */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.card h3 { margin: 0 0 4px; font: 700 1rem/1.25 var(--serif); }
.card p { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 0.875rem; min-height: 36px; }
.chip[aria-pressed="true"], .chip.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip.dim { opacity: .55; }
.tag { display: inline-block; font: 600 0.6875rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: 4px; background: var(--paper-2); color: var(--sepia); }
.tag.red { background: var(--red); color: #fff; }
.tag.teal { background: var(--teal); color: #fff; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 16px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.fab { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 7; border-radius: 999px; padding: 12px 18px; box-shadow: var(--shadow); }

/* --- Avatar creation --- */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font: 600 0.8125rem/1 var(--sans); color: var(--muted); }
.field input { min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); }
.origins { display: grid; grid-auto-flow: column; grid-auto-columns: 78%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; padding-bottom: 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.origin { scroll-snap-align: start; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); padding: 12px 14px; text-align: left; }
.origin { position: relative; }
.origin[aria-checked="true"] { border: 3px solid var(--red); padding: 10px 12px; background: color-mix(in srgb, var(--red) 9%, var(--card)); }
.origin .chosen { position: absolute; top: 10px; right: 10px; font: 700 0.6875rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; background: var(--red); color: #fff; padding: 4px 7px; border-radius: 4px; }
.origin h3 { margin: 0 0 6px; font: 700 1.0625rem/1.2 var(--serif); }
.origin dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; font-size: 0.8125rem; }
.origin dt { color: var(--muted); }
.origin dd { margin: 0; }
.origin .secret { margin-top: 8px; font-size: 0.8125rem; font-style: italic; color: var(--red); }
.points { display: flex; justify-content: space-between; align-items: baseline; }
.points strong { font: 700 1.375rem/1 var(--serif); color: var(--ink); }
.stat { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.stat .name { font-weight: 600; }
.stat .hint { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: var(--card); font-size: 1.25rem; line-height: 1; }
.stepper output { width: 28px; text-align: center; font: 700 1.25rem/1 var(--serif); }
.pips { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.pips i { height: 6px; border-radius: 2px; background: var(--paper-2); }
.pips i.on { background: var(--sepia); }
.derived { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.derived div { background: var(--paper-2); border-radius: 8px; padding: 8px 4px; }
.derived b { display: block; font: 700 1.125rem/1.1 var(--serif); }
.derived span { font-size: 0.6875rem; color: var(--muted); }
/* V218: solid background + border-top instead of transparent gradient to prevent stat bleed-through. */
.sticky-cta { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--rule); z-index: 6; }

/* --- Agenda --- */
.budget { display: grid; gap: 6px; }
.budget .bar { height: 12px; border-radius: 6px; background: var(--paper-2); overflow: hidden; display: flex; }
.budget .bar i { display: block; height: 100%; }
.budget .bar .used { background: var(--sepia); }
.budget .bar .walk { background: repeating-linear-gradient(45deg, var(--brass), var(--brass) 4px, transparent 4px, transparent 8px); }
.budget .bar .free { background: transparent; }
.budget .bar .idle { background: color-mix(in srgb, var(--sepia) 22%, transparent); }
.budget .bar .over { background: var(--red); }
.budget .legend { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 52px; top: 0; bottom: 0; border-left: 2px solid var(--rule); }
.timeline li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; position: relative; }
.timeline .time { font: 600 0.8125rem/1.2 var(--mono); color: var(--muted); padding-top: 12px; text-align: right; }
.timeline .walk { padding: 6px 0 6px 0; font-size: 0.8125rem; color: var(--muted); }
.timeline .walk .time { padding-top: 6px; }
.timeline .block { margin: 6px 0; }
.timeline .block::before { content: ""; position: absolute; left: 47px; top: 16px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--sepia); }
.timeline .block.warn::before { border-color: var(--red); background: var(--red); }
.block .card { padding: 10px 12px; }
.block .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.block .head b { font: 700 0.9375rem/1.2 var(--serif); }
.block .dur { font: 500 0.75rem/1 var(--mono); color: var(--muted); white-space: nowrap; }
.notice { border-left: 4px solid var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card)); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 0.875rem; margin: 12px 0; }
.notice.info { border-color: var(--teal); background: color-mix(in srgb, var(--teal) 10%, var(--card)); }
.warn-self-harm { border-left: 4px solid var(--red); background: color-mix(in srgb, var(--red) 10%, var(--card)); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 0.875rem; margin: 8px 0 0; }

/* --- Map --- */
.map { position: relative; flex: 1; min-height: 0; background: #d9ccb0; overflow: hidden; touch-action: none; }
.map canvas, .map svg { display: block; width: 100%; height: 100%; }
.hud { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 4; }
.clock { background: var(--ink); color: var(--paper); border-radius: 999px; padding: 8px 14px; font: 700 0.9375rem/1 var(--mono); box-shadow: var(--shadow); }
.speed { display: flex; background: var(--card); border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; box-shadow: var(--shadow); }
.speed button { border: 0; background: none; min-width: 44px; height: 40px; font: 700 0.8125rem/1 var(--mono); }
.speed button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lens { position: absolute; right: 12px; top: 64px; z-index: 4; }
.ticker { position: absolute; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 4; display: grid; gap: 6px; }
.ticker .card { padding: 8px 12px; font-size: 0.875rem; display: flex; gap: 8px; align-items: flex-start; }
.ticker .card .t { font: 600 0.75rem/1.4 var(--mono); color: var(--muted); white-space: nowrap; }

/* --- Notebook --- */
.segmented { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.segmented button { flex: none; border: 1px solid var(--rule); background: var(--card); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 600; font-size: 0.875rem; }
.segmented button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rumor-card { border-left: 4px solid var(--brass); }
.rumor-card blockquote { margin: 0; font: 600 1rem/1.35 var(--serif); }
.rumor-card .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 0.8125rem; color: var(--muted); }
.gauge { display: inline-flex; gap: 2px; vertical-align: middle; }
.gauge i { width: 10px; height: 10px; border-radius: 2px; background: var(--paper-2); }
.gauge i.on { background: var(--sepia); }
.person { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.avatar-dot { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); font: 700 1rem/1 var(--serif); color: var(--sepia); border: 1px solid var(--rule); }

/* --- Incident --- */
.scrim { position: absolute; inset: 0; background: rgba(20, 14, 8, .55); z-index: 20; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--paper); border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border-top: 3px double var(--rule); }
.headline { text-align: center; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 8px 0 10px; margin: 6px 0 12px; }
.headline .paper { font: 600 0.6875rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.headline h2 { font: 800 1.75rem/1.05 var(--serif); margin: 6px 0 0; text-transform: uppercase; letter-spacing: .02em; }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choices .btn { flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; }
.choices .btn small { font-weight: 500; opacity: .8; }
.paused { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 21; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes row-highlight { 0% { background: rgba(176, 132, 58, .22); } 100% { background: transparent; } }
.just-cleaned { border-radius: 3px; animation: row-highlight 2.5s ease-out forwards; }

/* V442: «Fehler melden» oben rechts, auf jedem Bildschirm sichtbar, auch über Blättern (z-index über dem Scrim). */
.bug-btn { position: fixed; top: calc(6px + env(safe-area-inset-top)); right: 6px; z-index: 30; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; border-radius: 50%; opacity: .75; }
.bug-btn:hover, .bug-btn:focus-visible { opacity: 1; color: var(--ink); }
.topbar { padding-right: 56px; }
.bug-form textarea { width: 100%; min-height: 7em; box-sizing: border-box; font: inherit; padding: 8px; border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: inherit; }
.bug-form .hint { margin: 8px 0; }
