/* lubanews - full-screen cards, dark first (it is read in bed and on the train). */
:root {
  --bg: #0d0f12;
  --card: #15181d;
  --raise: #1d2128;
  --line: #2a2f37;
  --text: #f2f3f5;
  --muted: #9aa1ac;
  --accent: #ff5a36;
  --hot: #ff5a36;
  --good: #4f9dff;
  --ok: #c7a24a;
  --low: #6b727d;
  --on-accent: #fff;
  --shade: linear-gradient(180deg, rgba(13, 15, 18, 0) 0%, rgba(13, 15, 18, .85) 70%, var(--card) 100%);
  --top: 56px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef0f3;
    --card: #ffffff;
    --raise: #f2f4f7;
    --line: #dde1e7;
    --text: #15181d;
    --muted: #5d6570;
    --accent: #e0431f;
    --hot: #e0431f;
    --good: #1f6fd6;
    --ok: #96741f;
    --low: #7a818c;
    --shade: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .85) 70%, var(--card) 100%);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------- header */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 5; height: var(--top);
  display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; flex: none; }
button.brand { border: 0; background: none; padding: 0; font-size: inherit; cursor: pointer; }
.brand img { width: 24px; height: 24px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--raise); border-radius: 999px;
  padding: 5px 12px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip small { color: var(--muted); font-size: 12px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on small { color: inherit; opacity: .7; }
.icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; cursor: pointer; }
.icon:hover { background: var(--raise); }

/* --------------------------------------------------------------- feed */
.feed {
  position: fixed; inset: var(--top) 0 0 0;
  overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }
.card {
  position: relative; height: calc(100dvh - var(--top)); scroll-snap-align: start; scroll-snap-stop: always;
  max-width: 560px; margin: 0 auto; background: var(--card);
  display: flex; flex-direction: column; overflow: hidden;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.media {
  position: relative; flex: 0 0 auto; aspect-ratio: 16 / 9; width: 100%; max-height: 33dvh; background: var(--raise);
  border: 0; padding: 0; display: block; overflow: hidden;
}
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.none { display: grid; place-items: center; aspect-ratio: 16 / 5;
  background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 30%, var(--raise)), var(--raise) 70%); }
.media.none span { font-weight: 700; font-size: 22px; opacity: .8; }
.media.video { cursor: pointer; }
.media.video .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .6); color: #fff;
}
.media.video .play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; margin-left: 4px; }
.media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media.playing .play { display: none; }

/* Never scrolls inside (fit() in app.js): a swipe always moves to the next card. */
.body { flex: 1; min-height: 0; overflow: hidden; padding: 12px 16px 8px; display: flex; flex-direction: column; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); align-items: center; }
.tag { color: var(--accent); font-weight: 600; }
.score { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 7px; border-radius: 999px;
  border: 1.5px solid currentColor; font-size: 13px; }
.score b { font-variant-numeric: tabular-nums; }
.score.hot { color: var(--hot); }
.score.good { color: var(--good); }
.score.ok { color: var(--ok); }
.score.low { color: var(--low); }
h2 { font-size: clamp(20px, 5.4vw, 26px); line-height: 1.2; margin: 10px 0 8px; letter-spacing: -.01em; text-wrap: balance;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; flex: none; }
.summary { margin: 0 0 8px; }
.summary.clamped { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
/* The place: world + country map and the name, a link to Google Maps (maps.js). */
.place {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 8px; padding: 6px 10px 8px 6px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--raise); text-decoration: none; color: var(--text);
}
/* the maps across the card, the name below; sized by width before maps.js draws, so fit() measures right */
.place .maps { display: flex; justify-content: space-between; align-items: center; flex: 0 0 100%; aspect-ratio: 4 / 1; }
.place svg.world { width: 64%; height: auto; aspect-ratio: 360 / 142; }
.place svg.local { width: 34%; height: auto; aspect-ratio: 100 / 70; }
.place .land { fill: color-mix(in srgb, var(--muted) 38%, var(--raise)); stroke: none; }
.place svg.local .land { stroke: var(--raise); stroke-width: .5; }
.place .mine { fill: color-mix(in srgb, var(--text) 75%, var(--raise)); stroke: var(--raise); stroke-width: .5; }
.place svg.world .mine { stroke: none; }
.place .halo { fill: color-mix(in srgb, var(--accent) 40%, transparent); }
.place .dot { fill: var(--accent); stroke: var(--raise); stroke-width: 1; }
.place .name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  font-size: 13px; font-weight: 600; line-height: 1.25; min-width: 0; }
.place .name svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; color: var(--accent); }
.place .name::after { content: " ↗"; color: var(--muted); font-weight: 400; }
.also { color: var(--muted); font-size: 13px; margin: 0; flex: none; }

.actions { flex: none; display: flex; gap: 8px; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.act {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--raise); color: var(--text); font-size: 14px;
  text-decoration: none; cursor: pointer;
}
.act svg { width: 18px; height: 18px; }
.act.read { margin-left: auto; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); font-weight: 600; }
.act.up.on { background: var(--good); border-color: var(--good); color: #fff; }
.act.down.on { background: var(--low); border-color: var(--low); color: #fff; }

.card.end { display: grid; place-items: center; text-align: center; padding: 24px; }
.card.end > div { max-width: 340px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Pull down on the first card to reload (app.js): a round bubble slides out under the
   header, its ring fills while pulling (--p, 0..1), turns accent when a release reloads,
   then spins until the page is back. */
.pull {
  position: fixed; top: var(--top); left: 50%; z-index: 4; width: 42px; height: 42px; margin-left: -21px;
  display: grid; place-items: center; border-radius: 50%; pointer-events: none;
  background: var(--raise); border: 1px solid var(--line); color: var(--muted);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  opacity: 0; transform: translateY(-52px) scale(.6);
  transition: transform .32s cubic-bezier(.2, .9, .3, 1.2), opacity .2s, color .15s;
}
.pull.drag { transition: color .15s; }
.pull svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.pull .track { stroke: var(--line); }
.pull .arc { stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0) * 85); transition: stroke-dashoffset .1s; }
.pull.ready { color: var(--accent); }
.pull.busy { color: var(--accent); }
.pull.busy .arc { stroke-dashoffset: 72; }
.pull.busy svg { animation: pull-spin .75s linear infinite; }
@keyframes pull-spin { to { transform: rotate(360deg); } }
.feed.pulled { transition: transform .32s cubic-bezier(.2, .9, .3, 1); }

/* -------------------------------------------------------------- sheet */
.btn { border: 1px solid var(--line); background: var(--raise); border-radius: 10px; padding: 9px 16px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.big { padding: 13px 24px; font-size: 17px; margin: 8px 0; }
.btn.ghost { background: none; margin-top: 18px; }
.sheet { position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, .5); display: flex; justify-content: flex-end; }
.sheet[hidden] { display: none; }
.sheet-panel { width: min(420px, 100%); height: 100%; overflow-y: auto; background: var(--card); padding: 16px; border-left: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field p { margin: 0; font-size: 14px; }
.field .btn { align-self: flex-start; }
select, textarea { background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; width: 100%; }
textarea { resize: vertical; font-size: 15px; line-height: 1.4; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
#votes { font-size: 13px; }

/* -------------------------------------------------------------- login */
.login-mitte { min-height: 100dvh; display: grid; place-items: center; padding: 16px; overflow: auto; }
.login-karte { width: min(360px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.login-karte .brand { font-size: 20px; margin-bottom: 4px; }
.feld { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.feld input { background: var(--raise); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; }
.meldung { background: color-mix(in srgb, var(--hot) 15%, transparent); color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
body.login { overflow: auto; }

@media (min-width: 700px) {
  .card { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
