:root {
  --red: #e64415;          /* SPIEGEL-Signalrot */
  --red-dark: #c23610;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f2;
  --text: #16181c;
  --muted: #71767b;
  --border: #e4e4e1;
  --header-bg: #ffffff;
  --nav-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 480px;
  --nav-h: 60px;
  --header-h: 54px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f12;
    --surface: #16181c;
    --surface-2: #202429;
    --text: #f2f3f5;
    --muted: #9aa0a6;
    --border: #2a2e34;
    --header-bg: #0d0f12;
    --nav-bg: #101317;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.4;
  overscroll-behavior-y: none;
}
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.06);
}

/* ---------- Header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 3px solid var(--red);
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.hdr .logo {
  font-family: var(--serif);
  font-weight: 700; font-size: 22px; letter-spacing: -.5px;
  color: var(--text);
  display: flex; align-items: center; gap: 7px;
}
.hdr .logo .mark {
  background: var(--red); color: #fff; font-family: var(--sans);
  font-weight: 800; width: 26px; height: 26px; border-radius: 5px;
  display: grid; place-items: center; font-size: 17px;
  transform: rotate(-4deg);
}
.hdr .logo b { color: var(--red); }
.hdr .plus {
  position: absolute; right: 12px; font-size: 11px; font-weight: 800;
  color: #fff; background: var(--red); padding: 3px 7px; border-radius: 4px;
  letter-spacing: .5px;
}

/* ---------- Views ---------- */
main#view { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); min-height: calc(100vh - var(--header-h)); }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

.section-label {
  font-size: 12px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--red); padding: 16px 16px 4px;
}
.lead {
  font-family: var(--serif); font-size: 15px; color: var(--muted);
  padding: 0 16px 8px;
}

/* ---------- Feed cards ---------- */
.card { border-bottom: 8px solid var(--surface-2); background: var(--bg); }
.card .thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--surface-2); }
.thumb.news { position: relative; aspect-ratio: 16/9; padding: 0; overflow: hidden; background: #000; }
.thumb.news .bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(22px) brightness(.5); transform: scale(1.2); }
.thumb.news img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.card .body { padding: 12px 16px 16px; }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--red); margin-bottom: 5px; }
.kicker.plus::before { content: "SPITZE+ "; color: var(--red); }
.headline { font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1.22; margin: 0 0 6px; letter-spacing: -.3px; }
.teaser { font-size: 14px; color: var(--muted); margin: 0; }
.card .meta { font-size: 11px; color: var(--muted); margin-top: 10px; text-transform: uppercase; letter-spacing: .5px; }

/* Quickstart tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 6px;
}
.tile .ic { font-size: 26px; }
.tile .t { font-weight: 800; font-size: 15px; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile.hero { grid-column: 1 / -1; background: var(--red); color: #fff; border: none; }
.tile.hero .s { color: rgba(255,255,255,.85); }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: block; width: 100%; border: none; border-radius: 10px;
  padding: 15px; font-size: 16px; font-weight: 800; cursor: pointer;
  background: var(--red); color: #fff; font-family: var(--sans);
}
.btn:active { background: var(--red-dark); }
.btn.secondary { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; }
.field { padding: 6px 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 14px; font-size: 18px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font-family: var(--sans);
}
.pad { padding: 16px; }

/* ---------- Line configurator ---------- */
.line-stage {
  margin: 12px 16px; padding: 18px; border-radius: 14px;
  background: linear-gradient(145deg, #1b1d22, #0b0c0f);
  border: 1px solid #2a2e34; position: relative; overflow: hidden;
}
.line-stage .glass-hint { color: #8b9098; font-size: 12px; text-align: center; margin-bottom: 10px; letter-spacing: .5px; }
#lineCanvas, #consumeCanvas { width: 100%; display: block; border-radius: 8px; }
.calc-readout { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #7fd18c; white-space: pre-wrap; min-height: 54px; padding: 8px 0; }
.result-big { text-align: center; font-family: var(--serif); }
.result-big .n { font-size: 40px; font-weight: 800; color: var(--red); }
.result-big .u { font-size: 14px; color: var(--muted); }
.result-big .adjust { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 4px 0 6px; }
.result-big .adj { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); color: var(--red); font-size: 28px; font-weight: 800; line-height: 1; cursor: pointer; font-family: var(--sans); }
.result-big .adj:active { background: var(--surface-2); }
.result-big .rd .unit { font-size: 16px; color: var(--muted); }

/* ---------- Consume overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: #05060a; color: #fff;
  flex-direction: column; align-items: center; justify-content: center;
}
.overlay.active { display: flex; }
.countdown { font-size: 120px; font-weight: 900; font-family: var(--sans); line-height: 1; }
.count-sub { color: #9aa0a6; margin-top: 10px; letter-spacing: 3px; text-transform: uppercase; font-size: 13px; }
.bubble {
  position: absolute; top: 12%; background: #fff; color: #16181c; padding: 12px 18px;
  border-radius: 16px; font-weight: 800; font-size: 18px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .3s; text-align: center;
}
.bubble.show { opacity: 1; }
.bubble::after { content: ""; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); border: 8px solid transparent; border-top-color: #fff; }
.reply-btn {
  position: absolute; bottom: 14%; background: var(--red); color: #fff; border: none;
  padding: 14px 22px; border-radius: 30px; font-weight: 800; font-size: 16px; cursor: pointer;
  opacity: 0; transform: translateY(10px); transition: .3s; pointer-events: none;
}
/* Bereit-Button ganz an der Seite (Querformat, Daumen rechts) */
.side-btn {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: var(--red); color: #fff; border: none; border-radius: 16px;
  padding: 26px 18px; font-size: 20px; font-weight: 900; letter-spacing: 1px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(230,68,21,.5); z-index: 3;
}
.side-btn:active { background: var(--red-dark); }
/* Lineal-Hinweis oben */
.build-hint {
  position: absolute; top: 14px; left: 0; right: 0; text-align: center;
  color: #e7eaee; font-size: 15px; font-weight: 700; padding: 0 90px; line-height: 1.4;
}
.build-hint b { color: #fff; }
.reply-btn.show { opacity: 1; transform: none; pointer-events: auto; }
.swipe-hint { position: absolute; bottom: 30%; color: #cfd3d8; font-size: 14px; letter-spacing: 1px; }

/* ---------- Leaderboard ---------- */
.tabs { display: flex; gap: 8px; padding: 12px 16px; }
.tabs button { flex: 1; padding: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 8px; font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--red); color: #fff; border-color: var(--red); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.rank-row .pos { font-family: var(--serif); font-weight: 800; font-size: 20px; width: 26px; text-align: center; color: var(--muted); }
.rank-row.me { background: color-mix(in srgb, var(--red) 8%, var(--bg)); }
.rank-row .pos.medal { color: var(--red); }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top center; background: var(--surface-2); flex: none; display:grid; place-items:center; font-weight:800; color:#fff; }
.rank-row .nm { font-weight: 800; font-size: 15px; }
.rank-row .sub { font-size: 12px; color: var(--muted); }
.rank-row .val { margin-left: auto; text-align: right; }
.rank-row .val .big { font-weight: 800; color: var(--red); font-size: 16px; }
.rank-row .val .small { font-size: 11px; color: var(--muted); }
.quip { font-family: var(--serif); font-style: italic; color: var(--muted); padding: 14px 16px; font-size: 14px; text-align:center; }

/* ---------- Wrapped ---------- */
.wrap-stories { position: relative; }
.story {
  display: none; min-height: 78vh; border-radius: 0; color: #fff; padding: 28px 22px;
  flex-direction: column; justify-content: center; gap: 14px; text-align: center;
}
.story.active { display: flex; animation: fade .25s; }
.story h2 { font-family: var(--serif); font-size: 15px; letter-spacing: 2px; text-transform: uppercase; opacity: .8; margin: 0; font-weight: 700; }
.story .huge { font-size: 64px; font-weight: 900; line-height: 1; }
.story .cap { font-size: 17px; opacity: .95; }
.story .foot { font-size: 13px; opacity: .7; margin-top: 8px; }
.story-progress { position: absolute; top: 8px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 2; }
.story-progress span { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; }
.story-progress span.on { background: #fff; }
.story-tap { position: absolute; inset: 0; display: flex; z-index: 1; }
.story-tap div { flex: 1; }

/* ---------- Profil ---------- */
.people { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px; }
.person { text-align: center; cursor: pointer; position: relative; }
.person .cam {
  position: absolute; top: 2px; left: 50%; margin-left: 18px;
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  border: 2px solid var(--bg); background: var(--red); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.person.add .cam { display: none; }
.person .avatar { width: 72px; height: 72px; margin: 0 auto 6px; font-size: 24px; }
.person.sel .avatar { outline: 3px solid var(--red); outline-offset: 2px; }
.person .pn { font-size: 13px; font-weight: 700; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--maxw); height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nav-bg); border-top: 1px solid var(--border);
  display: flex; z-index: 50;
}
.nav button {
  flex: 1; background: none; border: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .3px;
}
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--red); }
.nav .center { position: relative; }
.nav .center .fab {
  width: 46px; height: 46px; border-radius: 50%; background: var(--red); color: #fff;
  display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(230,68,21,.45);
}
.nav .center .fab svg { width: 24px; height: 24px; }

/* ---------- Foto-Thumbs im Feed (Freisteller auf Verlauf) ---------- */
.photo-thumb { position: relative; overflow: hidden; display: grid; place-items: center; }
.photo-thumb .ph-glow { position: absolute; bottom: -30%; left: 50%; transform: translateX(-50%); width: 78%; height: 115%; background: radial-gradient(ellipse at center, rgba(255,255,255,.42), transparent 66%); }
.photo-thumb .ph-emoji { font-size: 54px; opacity: .92; z-index: 1; filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }
.photo-thumb.has-img .ph-emoji { display: none; }
.photo-thumb .ph-img { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); max-height: 98%; max-width: 84%; object-fit: contain; z-index: 2; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }

/* „Neu"-Kachel im Namensschritt */
.person.add .avatar { background: var(--surface-2); color: var(--red); border: 2px dashed var(--border); font-size: 30px; }

/* ---------- Satire-Footer (unten auf jeder Seite) ---------- */
.site-foot {
  display: block; margin-top: 16px; padding: 16px 20px 22px;
  border-top: 1px solid var(--border);
  font-size: 11px; line-height: 1.55; color: var(--muted); text-align: center;
}
.muted { color: var(--muted); }
.center-txt { text-align: center; }
