/* ================================================================
   SchergenBOFH – Styles
   Farbwelt wie überall in Schergen Corp; dazu eine Leseschrift
   für die Geschichten und Gelb für die Zettel an der Wand.
   ================================================================ */

:root {
  color-scheme: dark;                      /* dunkle Scrollbalken im Textfeld */
  --bg:            #0e1016;
  --bg-2:          #151925;
  --surface:       rgba(255, 255, 255, .045);
  --surface-2:     rgba(255, 255, 255, .075);
  --line:          rgba(255, 255, 255, .10);
  --line-soft:     rgba(255, 255, 255, .06);
  --text:          #e8ebf2;
  --text-dim:      #98a1b5;
  --accent:        #7aa2ff;
  --accent-strong: #5b86ff;
  --open:          #ff5468;
  --open-bg:       rgba(255, 84, 104, .13);
  --done:          #2fd68b;
  --done-bg:       rgba(47, 214, 139, .13);
  --warn:          #ffc861;
  --radius:        14px;
  --shadow:        0 18px 45px rgba(0, 0, 0, .45);

  --read:          #dfe3ec;                 /* Fließtext, etwas weicher als --text */
  --note:          #ffe680;                 /* Post-it */
  --note-ink:      #2b2410;
  --serif:         "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text",
                   Cambria, Georgia, "Times New Roman", serif;
  --mono:          ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono",
                   Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -10%, #26304a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #3a1f2c 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.dim  { color: var(--text-dim); margin: .2rem 0 0; font-size: .88rem; }
.dim a { color: var(--text-dim); text-decoration: none; }
.dim a:hover { color: var(--accent); }
.mono { font-family: var(--mono); font-size: .92em; }
.hint { color: var(--text-dim); font-size: .82rem; margin: -.4rem 0 1rem; }

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: .5rem .9rem;
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover   { background: var(--surface-2); border-color: rgba(255,255,255,.18); }
.btn:active  { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: #0b1020;
  font-weight: 650;
}
.btn--primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.btn--ghost { background: transparent; }
.btn--sm    { padding: .32rem .7rem; font-size: .85rem; border-radius: 9px; }
.btn--bad   { color: #ffc3ca; border-color: rgba(255, 84, 104, .4); }
.btn--bad:hover { background: var(--open-bg); border-color: var(--open); }

/* ----------------------------------------------------------------
   Kopfzeile
   ---------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  padding: .85rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(14, 16, 22, .72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__right { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.topbar__user  {
  color: var(--text-dim);
  font-size: .86rem;
  padding: .3rem .7rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.01em;
}
.brand__logo   { font-size: 1.25rem; }
.brand__name   { font-family: var(--mono); font-size: 1.02rem; }
.brand__accent { color: var(--open); }
.brand__cursor { color: var(--done); animation: blink 1.1s steps(1) infinite; }
.brand__sub {
  color: var(--text-dim);
  font-size: .8rem;
  font-weight: 600;
  padding: .15rem .55rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .brand__cursor { animation: none; } }

/* ----------------------------------------------------------------
   Seitenrahmen
   ---------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2rem) 3rem;
  flex: 1;
}
.shell--read { max-width: 760px; }
.shell--desk { max-width: 1180px; }

/* ----------------------------------------------------------------
   Startseite: Kopf und Karten
   ---------------------------------------------------------------- */
.hero { margin-bottom: 2.2rem; }
.hero__title {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: -.03em;
}
.hero__claim { color: var(--text-dim); max-width: 46ch; margin: .6rem 0 0; font-size: 1.02rem; }

.cards { display: grid; gap: 1rem; }

.card {
  display: block;
  padding: 1.3rem 1.4rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s, background .15s;
}
.card:hover {
  border-color: rgba(122, 162, 255, .45);
  transform: translateY(-2px);
}
.card__meta, .story__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .9rem;
  margin: 0 0 .45rem;
  color: var(--text-dim);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card__meta span:first-child, .story__meta span:first-child { color: var(--open); font-weight: 650; }
.card__title  { font-size: 1.35rem; line-height: 1.25; }
.card__teaser { font-family: var(--serif); color: var(--read); margin: .55rem 0 .7rem; font-size: 1.02rem; line-height: 1.6; }
.card__more   { color: var(--accent); font-size: .88rem; font-weight: 600; }

/* ----------------------------------------------------------------
   Eine Geschichte
   ---------------------------------------------------------------- */
.story__title {
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 1.8rem;
}
.story__body {
  font-family: var(--serif);
  font-size: clamp(1.06rem, 1.1vw + .8rem, 1.2rem);
  line-height: 1.72;
  color: var(--read);
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.story__body p { margin: 0 0 1.05em; }
.story__body em { font-style: italic; }
.story__body strong { color: var(--text); }

/* Erster Absatz als Auftakt etwas größer */
.story__body > p:first-child { font-size: 1.1em; color: var(--text); }

/* Szenenwechsel */
.break {
  border: 0;
  height: 1em;
  margin: 2rem 0;
  text-align: center;
}
.break::before {
  content: "* * *";
  color: var(--text-dim);
  letter-spacing: .6em;
  font-family: var(--mono);
}

/* Der gelbe Zettel */
.note {
  position: relative;
  max-width: 30rem;
  margin: 1.6rem auto 1.9rem;
  padding: 1.1rem 1.3rem 1.2rem;
  background: linear-gradient(180deg, #fff0a3, var(--note) 30%, #f8d95c);
  color: var(--note-ink);
  border-radius: 2px 2px 3px 18px / 2px 2px 3px 10px;
  box-shadow: 0 14px 26px rgba(0, 0, 0, .45), 0 2px 0 rgba(0, 0, 0, .15);
  transform: rotate(-1.2deg);
  font-family: "Segoe Print", "Bradley Hand", "Marker Felt", "Comic Neue", "Chalkboard SE", cursive;
  font-size: .95em;
  line-height: 1.5;
  hyphens: manual;
}
.note::before {                           /* Klebestreifen */
  content: "";
  position: absolute;
  top: -.55rem;
  left: 50%;
  width: 4.5rem;
  height: 1.1rem;
  margin-left: -2.25rem;
  background: rgba(255, 255, 255, .35);
  transform: rotate(2deg);
}
.story__body .note:nth-of-type(even) { transform: rotate(1deg); }
.note p { margin: 0; }
.note strong { color: inherit; }

/* Vorlesen */
/* Umschalter zwischen den Fassungen einer Geschichte */
.fassungen { display: flex; gap: .4rem; flex-wrap: wrap; margin: -1rem 0 1.4rem; }
.fassungen .btn[aria-current] { border-color: var(--accent); color: var(--accent); }
.fassungen + .banner { margin-top: -.6rem; }
.fassungen .is-aus { opacity: .6; border-style: dashed; }
.fassungen ~ .listen { margin-top: 0; }
.listen { display: flex; gap: .5rem; flex-wrap: wrap; margin: -1rem 0 1.6rem; }
.listen[hidden], .listen [hidden] { display: none; }   /* sonst gewinnt display von .btn */
.listen.is-playing .btn:first-child { border-color: var(--accent); color: var(--accent); }
.story__title.is-reading,
.story__body p.is-reading {
  border-radius: 4px;
  background: rgba(122, 162, 255, .10);
  box-shadow: 0 0 0 .3em rgba(122, 162, 255, .10);
  transition: background .2s, box-shadow .2s;
}
.listen.is-playing ~ .story__body p { cursor: pointer; }
.story__body .note p.is-reading { background: rgba(0, 0, 0, .07); box-shadow: none; }

.story__end { text-align: center; color: var(--open); margin: 2.4rem 0 0; font-size: .8rem; }

.banner {
  margin: 0 0 1.5rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 200, 97, .4);
  background: rgba(255, 200, 97, .12);
  color: #ffdca0;
  font-size: .9rem;
}
.banner a { color: #ffe6b8; font-weight: 650; margin-left: .3rem; }

/* ----------------------------------------------------------------
   Weitersagen
   ---------------------------------------------------------------- */
.share {
  margin: 2.6rem 0 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.share--desk { margin: 0 0 1.4rem; }
.share__title {
  margin: 0 0 .6rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
}
.share__row { display: flex; gap: .6rem; flex-wrap: wrap; }
.share__url {
  flex: 1;
  min-width: 0;
  padding: .55rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font-family: var(--mono);
  font-size: .86rem;
}
.share__url:focus { outline: none; border-color: var(--accent); }

.editbar { margin: 1.2rem 0 0; }

/* ----------------------------------------------------------------
   Vor und zurück
   ---------------------------------------------------------------- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2.2rem 0 0;
}
.pager__link {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s;
}
.pager__link:hover { border-color: rgba(122, 162, 255, .45); }
.pager__link--newer { text-align: right; grid-column: 2; }
.pager__dir  { color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.pager__name { font-weight: 600; }

.back { text-align: center; margin: 2rem 0 0; }
.back a { color: var(--text-dim); text-decoration: none; font-size: .9rem; }
.back a:hover { color: var(--accent); }

/* ----------------------------------------------------------------
   Leer und nicht gefunden
   ---------------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty h1, .empty h2 { font-size: 1.4rem; }
.empty p { color: var(--text-dim); max-width: 40ch; margin: .6rem auto 1.4rem; }
.empty__code {
  font-family: var(--mono);
  font-size: 3.5rem;
  color: var(--open);
  margin: 0 0 .4rem !important;
  line-height: 1;
}

/* ----------------------------------------------------------------
   Fußzeile
   ---------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line-soft);
  padding: 1.3rem clamp(1rem, 4vw, 2rem) 1.6rem;
  text-align: center;
  color: var(--text-dim);
  font-size: .84rem;
}
.foot p { margin: .25rem 0; }
.foot__excuse { font-family: var(--mono); font-size: .82rem; color: var(--text); }
.foot__excuse span {
  font-family: inherit;
  color: var(--done);
  margin-right: .4rem;
}
.foot__excuse span::after { content: " $"; color: var(--text-dim); }
.foot__links a { color: var(--text-dim); }
.foot__links a:hover { color: var(--accent); }

/* ----------------------------------------------------------------
   Meldung unten
   ---------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  padding: .6rem 1rem;
  border-radius: 10px;
  background: #1d2231;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ================================================================
   Redaktion
   ================================================================ */
.deskhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.deskhead h1 { font-size: 1.6rem; }

.flash {
  margin: 0 0 1.4rem;
  padding: .8rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.flash p { margin: 0; }
.flash .share__row { margin-top: .7rem; }
.flash--ok  { border-color: rgba(47,214,139,.4);  background: rgba(47,214,139,.10);  color: #8ae9bf; }
.flash--bad { border-color: rgba(255,84,104,.4);  background: rgba(255,84,104,.12);  color: #ffc3ca; }

.chip {
  display: inline-block;
  padding: .08rem .55rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .02em;
  border: 1px solid var(--line);
}
.chip--pub   { color: var(--done); background: var(--done-bg); border-color: rgba(47,214,139,.35); }
.chip--draft { color: var(--warn); background: rgba(255,200,97,.12); border-color: rgba(255,200,97,.35); }
.chip--plan  { color: var(--accent); background: rgba(122,162,255,.12); border-color: rgba(122,162,255,.35); }
.chip--rs24  { color: #ff6b81; background: rgba(255,59,85,.12); border-color: rgba(255,59,85,.35); }

.hits { color: var(--text); font-variant-numeric: tabular-nums; }

/* Reihenfolge am selben Tag */
.order { display: flex; flex-direction: column; gap: .2rem; }
.order form { margin: 0; }
.order__btn {
  width: 1.8rem;
  height: 1.3rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: .62rem;
  line-height: 1;
  cursor: pointer;
}
.order__btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.order__btn:disabled { opacity: .25; cursor: default; }

.field--date input { width: auto; min-width: 12rem; }
/* Haken mit Beschriftung daneben statt darüber */
.field--check { display: flex; align-items: center; gap: .6rem; cursor: pointer; }
.field--check > span { margin: 0; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text); }
.field--check input { width: 1.1rem; height: 1.1rem; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .8rem 1rem;
  padding: .9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.row__main  { min-width: 0; flex: 1 1 18rem; }
.row__title { color: var(--text); font-weight: 650; font-size: 1.05rem; text-decoration: none; }
.row__title:hover { color: var(--accent); }
.row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .8rem;
  margin: .3rem 0 0;
  color: var(--text-dim);
  font-size: .82rem;
}
.row__actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 1.5rem;
  align-items: start;
}

.field { display: block; margin-bottom: 1rem; }
.field > span {
  display: block;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: .35rem;
}
.field > span em { text-transform: none; letter-spacing: 0; font-style: normal; opacity: .8; }
.field input, .field textarea {
  width: 100%;
  padding: .65rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .28);
  color: var(--text);
  font: inherit;
}
.field input[name="title"] { font-size: 1.15rem; font-weight: 600; }
.field input[name="slug"]  { font-family: var(--mono); font-size: .9rem; }
.field textarea {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 22rem;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, .18);
}
.counter { color: var(--text-dim); font-size: .82rem; margin: -.6rem 0 1rem; min-height: 1.2em; }

.editor__buttons { display: flex; flex-wrap: wrap; gap: .6rem; }

.editor__help {
  position: sticky;
  top: 5rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .88rem;
}
.editor__help h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  margin-bottom: .7rem;
}
.editor__help .hint { margin: 1rem 0 0; }
.cheat { margin: 0; }
.cheat dt { font-weight: 650; margin-top: .6rem; }
.cheat dt.mono { color: var(--warn); }
.cheat dd { margin: .1rem 0 0; color: var(--text-dim); }

.danger {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-soft);
}
.danger form { margin: 0; }

/* ----------------------------------------------------------------
   Schmal
   ---------------------------------------------------------------- */
@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; }
  .editor__help { position: static; }
}
@media (max-width: 560px) {
  .pager { grid-template-columns: 1fr; }
  .pager__link--newer { grid-column: 1; }
  .share__row .btn { width: 100%; }
  .row__actions { width: 100%; }
  .topbar__user { display: none; }
}

/* ---------- Wer ist wer? (eigenes Fenster) ---------- */
.wer { padding: 0; border: 0; background: transparent; max-width: min(720px, calc(100vw - 24px)); width: 100%; max-height: calc(100vh - 40px); color: var(--text); }
.wer::backdrop { background: rgba(0, 0, 0, .6); }
.wer__box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px 18px; max-height: calc(100vh - 40px); overflow-y: auto; box-sizing: border-box; }
.wer__kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wer__kopf h2 { margin: 0; font-size: 1.35rem; }
.wer__intro { color: var(--text-dim); margin: 8px 0 4px; }
.wer__gruppe { margin: 20px 0 8px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.wer__liste { margin: 0; display: grid; gap: 10px; }
.wer__eintrag { display: grid; grid-template-columns: 180px 1fr; gap: 4px 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.wer__eintrag:last-child { border-bottom: 0; }
.wer__eintrag dt { font-weight: 700; }
.wer__eintrag dd { margin: 0; color: var(--read); line-height: 1.5; }
.wer__in { display: block; margin-top: 4px; font-size: .84rem; color: var(--text-dim); }
.wer__in a { color: var(--accent); }
@media (max-width: 600px) { .wer__eintrag { grid-template-columns: 1fr; } .wer__box { padding: 18px 16px 14px; } }
