/* Pub.Crawl (Browser-Version) – Look identisch zur lokalen Python-Version */

[hidden] { display: none !important; }
main.container { max-width: 1080px; }
header {
  position: sticky; top: 0; z-index: 70;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: .6rem; padding: .65rem 0 .75rem 0;
  background: color-mix(in srgb, var(--pico-background-color, #fff) 94%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.2));
}
.authors { margin: .1rem 0 .25rem 0; font-size: .95rem; color: var(--pico-muted-color, #777); }
header .brand { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 1.2rem; white-space: nowrap; }
header nav { display: flex; gap: .4rem; align-items: center; }
header .rightside { display: flex; gap: .5rem; flex: 1; justify-content: flex-end; align-items: center; }
#q { flex: 1; min-width: 220px; max-width: 340px; margin: 0; }
#searchBtn { display: none; }

/* Handy: Zeile 1 Logo + Symbol-Knöpfe, Zeile 2 Navigation, Suche nur nach Tippen auf 🔍 */
@media (max-width: 600px) {
  header { gap: .45rem .4rem; padding: .5rem 0 .55rem; }
  header .brand, header .rightside { display: contents; }
  header h1 { order: 1; flex: 1; font-size: 1.1rem; }
  header .hbtn { order: 2; height: 2.2rem; }
  header .hbtn.icon, #sortBtn, #viewBtn { width: 2.2rem; padding: 0; font-size: 1.05rem; }
  #sortBtn .lbl, #viewBtn .lbl { display: none; }
  #searchBtn { display: inline-flex; }
  header nav { order: 3; flex-basis: 100%; gap: 1.2rem; justify-content: flex-start; font-size: .92rem; }
  body.deck #list { margin-top: .7rem; }
  header nav a { padding: .1rem 0; }
  #q { order: 4; display: none; flex-basis: 100%; min-width: 0; max-width: none; }
  header.searching #q:not([hidden]) { display: block; }
  header.searching #searchBtn { border-color: var(--pico-primary, #0172ad); }
}

.meta { color: var(--muted-color); font-size: .92rem; }
.meta a.meta-link, .meta button.meta-link {
  margin-left: .5rem; font-size: .85rem; text-decoration: underline;
}
.meta button.meta-link {
  background: none; border: none; padding: 0; margin: 0 0 0 .5rem;
  color: var(--pico-primary, #0172ad); font-size: .85rem; line-height: inherit;
  cursor: pointer; width: auto; display: inline; vertical-align: baseline; box-shadow: none;
}

.item {
  border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.28));
  border-radius: 14px;
  padding: 1rem;
  background: var(--pico-card-background-color, var(--pico-background-color, transparent));
  transition: transform .06s ease, background .2s ease, box-shadow .2s ease;
}
.item + .item { margin-top: .8rem; }
.item.hidden { display: none; }
.item.gone { display: none; }
.item.active { outline: 2px solid var(--primary); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip {
  border: 1px solid var(--muted-border-color);
  border-radius: 999px; padding: .15rem .6rem; font-size: .85rem;
  background: color-mix(in hsl, var(--muted-color-bg) 85%, transparent);
  white-space: nowrap;
}
.chip.rel {
  border-color: color-mix(in hsl, var(--primary) 55%, transparent);
  background: color-mix(in hsl, var(--primary) 16%, var(--muted-color-bg));
}

/* Choice-Bar (Feed) */
.choicebar { display: flex; justify-content: center; gap: 1.1rem; margin-top: .7rem; }
.choice {
  width: 3.2rem; height: 3.2rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.35);
  background: color-mix(in hsl, var(--muted-color-bg) 80%, transparent);
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
}
[data-theme="light"] .choice { border-color: rgba(0,0,0,0.25); }
.choice:hover { transform: scale(1.08); box-shadow: 0 8px 18px rgba(0,0,0,.18); }
.choice:active { transform: scale(0.95); }
.choice.like {
  color: var(--primary);
  background: color-mix(in hsl, var(--primary) 20%, var(--muted-color-bg));
  border-color: color-mix(in hsl, var(--primary) 65%, #000);
}
.choice.like:hover {
  background: color-mix(in hsl, var(--primary) 35%, var(--muted-color-bg));
  border-color: color-mix(in hsl, var(--primary) 85%, #000);
}
.choice.skip {
  color: #d33;
  background: color-mix(in hsl, #d33 18%, var(--muted-color-bg));
  border-color: color-mix(in hsl, #d33 65%, #000);
}
.choice.skip:hover {
  background: color-mix(in hsl, #d33 28%, var(--muted-color-bg));
  border-color: color-mix(in hsl, #d33 85%, #000);
}
.choice svg { width: 30px; height: 30px; display: block; }

/* Undo-Toast */
#toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(2rem);
  display: flex; align-items: center; gap: 1rem;
  width: max-content; max-width: calc(100vw - 2rem);   /* sonst nur halbe Breite (left: 50%) */
  padding: .6rem 1rem; border-radius: 12px;
  background: var(--contrast, #222); color: var(--contrast-inverse, #fff);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; z-index: 70;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast .toast-undo {
  background: none; border: none; padding: 0; margin: 0; width: auto;
  color: inherit; font-weight: 600; text-decoration: underline; cursor: pointer;
}

/* Hilfe-Overlay */
#help {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45);
}
#help.show { display: flex; }
#help .help-card {
  background: var(--background-color); border: 1px solid var(--muted-border-color);
  border-radius: 14px; padding: 1.2rem 1.6rem; max-width: 360px; color: var(--color);
}
#help kbd {
  display: inline-block; min-width: 1.4rem; text-align: center;
  padding: .1rem .4rem; border: 1px solid var(--muted-border-color);
  border-radius: 6px; background: var(--muted-color-bg);
  color: inherit; font-size: .85rem; font-family: inherit;
}
#help table { width: 100%; }
#help td { padding: .3rem .4rem; }

/* Status-Leiste */
#statusbar { display: flex; justify-content: center; margin: .4rem 0 .7rem 0; }
#statusbar #statustext {
  font-size: .85rem; color: var(--muted-color); white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding: .3rem .9rem; border-radius: 999px;
  background: var(--muted-color-bg); border: 1px solid var(--muted-border-color);
}
#statusbar[hidden] { display: none; }

.hbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  height: 2.4rem; width: auto; padding: 0 .7rem; margin: 0; box-sizing: border-box;
  font-size: .85rem; line-height: 1; white-space: nowrap;
  border-radius: 8px; border: 1px solid var(--muted-border-color);
  background: var(--muted-color-bg); color: inherit;
  cursor: pointer; text-decoration: none;
}
.hbtn:hover { border-color: var(--primary); }
.hbtn.icon { width: 2.4rem; padding: 0; font-size: 1.1rem; }

/* Abstract aufklappen */
.abstract { margin: .2rem 0 .25rem 0; }
.abstract.clamped {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.more-btn {
  background: none; border: none; padding: 0; margin: 0 0 .5rem 0; width: auto;
  color: var(--primary); cursor: pointer; font-size: .85rem; text-decoration: underline;
}

/* Notiz in der Leseliste */
.note-wrap { margin: .5rem 0 .2rem 0; }
.note-label {
  display: block; font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  color: #5b6b7c; margin-bottom: .2rem;
}
[data-theme="dark"] .note-label { color: #9aa6b4; }
textarea.note {
  width: 100%; padding: .5rem .7rem; margin: 0;
  font-size: .9rem; line-height: 1.4; resize: none; overflow: hidden; min-height: 0;
  border-radius: 8px;
  background: #eef2f7; border: 1px solid #cfd8e3; color: #2b3038;
}
[data-theme="dark"] textarea.note { background: #20262f; border-color: #38414e; color: #e6eaf0; }
textarea.note::placeholder { color: #97a3b2; }
[data-theme="dark"] textarea.note::placeholder { color: #74808f; }

/* Mülleimer in der Ecke (Leseliste) */
.item-star { position: relative; }
.trash-btn {
  position: absolute; top: .55rem; right: .55rem;
  width: 2rem; height: 2rem; padding: 0; line-height: 1; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid transparent;
  background: none; color: var(--muted-color); cursor: pointer; opacity: .6;
  transition: opacity .15s ease, background .15s ease, border-color .15s ease;
}
.trash-btn:hover {
  opacity: 1; background: color-mix(in hsl, #d33 14%, transparent);
  border-color: color-mix(in hsl, #d33 50%, transparent);
}
.item-star h4 { padding-right: 2.2rem; }

/* Onboarding */
.onboard {
  margin-top: 1rem; padding: 1.5rem 1.7rem; border-radius: 14px;
  border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.28));
  background: var(--pico-card-background-color, var(--pico-background-color, #fff));
  text-align: center;
}
.onboard p { color: var(--muted-color); margin: .4rem 0 1rem 0; }

.notice { padding: .5rem .8rem; margin-top: .8rem; font-size: .9rem; }
.notice.warn { border-left: 3px solid #d33; }
.notice.info { border-left: 3px solid var(--primary); }

/* Inbox-Zero */
#done { text-align: center; padding: 2.5rem 1rem; color: var(--muted-color); }
#done .done-emoji { font-size: 3.2rem; line-height: 1; animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Konfetti */
.confetti {
  position: fixed; top: -12px; width: 8px; height: 14px; z-index: 45;
  pointer-events: none; border-radius: 2px; animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(106vh) rotate(560deg); opacity: 1; } }

/* Stapel-Modus */
body.deck #statusbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 1rem; z-index: 40;
  margin: 0; pointer-events: none;
}
/* wegfliegende Karten sollen die Seite nicht seitlich scrollbar machen */
body { overflow-x: clip; }
body.deck #list { position: relative; min-height: 62vh; padding-bottom: 2rem; }
body.deck #list.empty { min-height: 0; }
body.deck .item {
  position: absolute; top: 0; left: 0; right: 0; margin: 0 auto; width: min(720px, 94%);
  padding: 1.5rem 1.7rem 1.8rem;
  overflow: hidden;
  transition: transform .3s ease, opacity .3s ease, height .3s ease, box-shadow .3s ease;
  background: var(--pico-card-background-color, var(--pico-background-color, #fff));
  border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.28));
}
body.deck .item + .item { margin-top: 0; }
body.deck .item.d0 .choicebar { margin-top: 1.4rem; }
body.deck .item:not(.d0):not(.d1):not(.d2):not(.d3):not(.d4),
body.deck .item.hidden, body.deck .item.gone { display: none; }
body.deck .item.d0 {
  z-index: 50; overflow: visible;
  box-shadow: 0 18px 40px rgba(0,0,0,.24);
}
body.deck .item.d1 { z-index: 49; opacity: .97; transform: translate(-9px, 12px) rotate(-1.8deg); }
body.deck .item.d2 { z-index: 48; opacity: .92; transform: translate(-18px, 22px) rotate(-3.6deg); }
body.deck .item.d3 { z-index: 47; opacity: .87; transform: translate(-27px, 32px) rotate(-5.4deg); }
body.deck .item.d4 { z-index: 46; opacity: .82; transform: translate(-36px, 42px) rotate(-7.2deg); }
body.deck .item:not(.d0) { pointer-events: none; }
body.deck .item.d1::after, body.deck .item.d2::after,
body.deck .item.d3::after, body.deck .item.d4::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5rem;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent,
    var(--pico-card-background-color, var(--pico-background-color, #fff)));
}
#list { transition: opacity .12s ease; }

/* Einstellungen */
.muted { color: var(--muted-color); font-size: .95rem; }
.row { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
#view-settings table { width: 100%; }
#view-settings td, #view-settings th { vertical-align: middle; }
#view-settings td a { word-break: break-all; font-size: .9rem; }
#view-settings td button { padding: .3rem .7rem; font-size: .85rem; margin: 0; }
#view-settings textarea:not(.note) { min-height: 8rem; }
#view-settings .row button, #view-settings .row a[role=button] { width: auto; }
#view-settings fieldset { margin-bottom: .8rem; }
#view-settings code { word-break: break-all; }

/* Lade-Bildschirm */
#loading {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: var(--pico-background-color, #fff);
}
#loading[hidden] { display: none; }
#loading .splash { text-align: center; max-width: 440px; padding: 2rem; }
#loading .logo { font-size: 2.4rem; font-weight: 700; margin: 0; }
#loading .spinner {
  width: 48px; height: 48px; margin: 1.8rem auto;
  border-radius: 50%;
  border: 4px solid var(--pico-muted-border-color, rgba(127,127,127,.3));
  border-top-color: var(--pico-primary, #1095c1);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading .hint { font-size: .82rem; color: var(--pico-muted-color, #999); margin-top: .4rem; }

/* ---- Einstellungen: Abschnitte, Hilfe-Bubbles, Filter-Wörter ---------------- */
#view-settings section.set {
  margin: 1.6rem 0; padding-top: 1.2rem;
  border-top: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.25));
}
#view-settings section.set > h3 { display: flex; align-items: center; gap: .1rem; flex-wrap: wrap; margin-bottom: .8rem; }
#view-settings .saved { font-size: .85rem; font-weight: 400; margin-left: .6rem; }
#view-settings details { margin: .8rem 0; }
#view-settings details summary { display: flex; align-items: center; gap: .1rem; }

.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; margin-left: .4rem; flex: none;
  border-radius: 50%; border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.4));
  font-size: .72rem; font-weight: 600; line-height: 1; cursor: help;
  color: var(--pico-muted-color, #777); vertical-align: middle;
}
.tip::after {
  content: attr(data-tip);
  position: absolute; left: -.5rem; top: calc(100% + .45rem); z-index: 30;
  width: max-content; max-width: min(340px, 78vw);
  padding: .6rem .75rem; border-radius: .5rem;
  background: var(--pico-contrast-background, #1f2937); color: var(--pico-contrast-inverse, #fff);
  font-size: .82rem; font-weight: 400; line-height: 1.4; text-align: left; white-space: normal;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  display: none; pointer-events: none;
  transform: translateX(var(--tip-dx, 0px));     /* am rechten Rand nach links schieben (app.js) */
}
.tip:hover::after, .tip:focus-visible::after, .tip.open::after { display: block; }
.tip:focus { outline: 2px solid var(--pico-primary, #0172ad); outline-offset: 2px; }

.term-label { margin: .6rem 0 .35rem; }
.term-box {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  padding: .45rem .5rem; margin-bottom: 1rem; border-radius: var(--pico-border-radius, .25rem);
  border: 1px solid var(--pico-form-element-border-color, rgba(127,127,127,.35));
  background: var(--pico-form-element-background-color, transparent);
}
.term-box:focus-within { border-color: var(--pico-primary, #0172ad); }
.term {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .15rem .25rem .15rem .6rem; border-radius: 999px; font-size: .88rem;
  background: var(--pico-primary-background, #0172ad); color: var(--pico-primary-inverse, #fff);
}
.term.raw { font-family: var(--pico-font-family-monospace, monospace); font-size: .8rem; }
.term button {
  all: unset; cursor: pointer; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; line-height: 1;
}
.term button:hover { background: rgba(255,255,255,.25); }
#view-settings .term-box .term-input {
  flex: 1; min-width: 12rem; width: auto; margin: 0; padding: .3rem .4rem; height: auto;
  border: none; background: transparent; box-shadow: none;
}

table.journals td { padding: .45rem .5rem; }
table.journals input[role=switch] { margin: 0; }
table.journals tr.off td:nth-child(2) { opacity: .45; text-decoration: line-through; }
#view-settings .row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
#view-settings .row > button, #view-settings .file-btn { width: auto; margin: 0; }
.file-btn { cursor: pointer; }

.filter-note a { margin-left: .2rem; }

/* ---- Fußzeile ---------------------------------------------------------------- */
footer.site {
  margin: 3rem 0 4.5rem; padding-top: 1rem; text-align: center; font-size: .82rem;
  color: var(--pico-muted-color, #777);
  border-top: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.2));
}
footer.site a { color: inherit; }

/* Filter-Treffer: ohne Innenabstand, sonst reißt die Markierung Wörter auseinander */
#list mark { padding: 0; border-radius: 2px; }

/* ---- Wischen (Touch) ---------------------------------------------------------- */
/* Senkrecht scrollt weiter der Browser, waagerecht übernimmt swipe.js */
body.deck .item.d0 { touch-action: pan-y; }
body.deck .item.d0.dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
body.deck .item.d0 a { -webkit-user-drag: none; }

.swipe-hint { display: none; }
body.deck .item.d0 .swipe-hint {
  display: block; position: absolute; top: 1.1rem; z-index: 3; pointer-events: none;
  padding: .2rem .65rem; border: 3px solid currentColor; border-radius: .5rem;
  font-weight: 800; font-size: 1.1rem; letter-spacing: .03em; text-transform: uppercase;
  background: var(--pico-card-background-color, #fff);
  opacity: 0;
}
body.deck .item.d0 .swipe-hint.like {
  left: 1.1rem; color: #1a9e4b; transform: rotate(-10deg);
  opacity: clamp(0, calc(var(--swipe, 0) * 1.6), 1);
}
body.deck .item.d0 .swipe-hint.skip {
  right: 1.1rem; color: #d6334b; transform: rotate(10deg);
  opacity: clamp(0, calc(var(--swipe, 0) * -1.6), 1);
}

/* ---- „Neue Artikel"-Knopf und laufendes Neuladen ------------------------------ */
.new-pill {
  display: block; width: auto; margin: .2rem auto .8rem; padding: .4rem 1rem;
  border-radius: 999px; font-size: .88rem; box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.hbtn.spinning { animation: pc-spin 1s linear infinite; pointer-events: none; }
.hbtn[aria-busy=true]::before { display: none; }          /* Picos eigenen Lade-Kreisel aus */
@keyframes pc-spin { to { transform: rotate(360deg); } }

/* ---- Leseliste: Reiter, Tags, Knöpfe ----------------------------------------- */
#listTitle { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.3)); border-radius: 999px; overflow: hidden; }
.seg button {
  all: unset; cursor: pointer; padding: .3rem .85rem; font-size: .85rem; font-weight: 500;
  color: var(--pico-muted-color, #777);
}
.seg button[aria-selected=true] { background: var(--pico-primary-background, #0172ad); color: var(--pico-primary-inverse, #fff); }
.seg button:focus-visible { outline: 2px solid var(--pico-primary, #0172ad); outline-offset: -2px; }
#tagbar { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.2rem 0 .9rem; }
#tagbar .tag {
  all: unset; cursor: pointer; padding: .15rem .6rem; border-radius: 999px; font-size: .82rem;
  border: 1px solid var(--pico-muted-border-color, rgba(127,127,127,.35)); color: var(--pico-muted-color, #777);
}
#tagbar .tag.active { border-color: var(--pico-primary, #0172ad); color: var(--pico-primary, #0172ad); font-weight: 600; }
.card-tools { position: absolute; top: .55rem; right: .55rem; display: flex; gap: .2rem; }
.card-tools button {
  width: 2rem; height: 2rem; padding: 0; margin: 0; line-height: 1; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid transparent; background: none;
  color: var(--pico-muted-color, #777); cursor: pointer; opacity: .65;
}
.card-tools button:hover { opacity: 1; border-color: var(--pico-muted-border-color, rgba(127,127,127,.4)); }
.card-tools [data-act=done]:hover { color: #1a9e4b; border-color: #1a9e4b; }
.card-tools .trash:hover { background: color-mix(in hsl, #d33 14%, transparent); border-color: color-mix(in hsl, #d33 50%, transparent); }
.item-star h4 { padding-right: 4.6rem; }

#view-settings .catalog-search { margin: .3rem 0 1rem; }
