/* ==========================================================
   Fallwerkstatt – Gestaltung (gleiche Farben und Schriften wie der Player)
   ========================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../player/assets/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../player/assets/fonts/literata.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("../player/assets/fonts/literata-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --mist: #e9efee;
  --paper: #f6f9f8;
  --ink: #12313a;
  --ink-soft: #3e5961;
  --line: rgba(18, 49, 58, .18);
  --screen: #0c181d;
  --saffron: #e8a630;
  --saffron-deep: #7a4f00;
  --sea: #3f7a68;
  --danger: #a3321f;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --text: "Literata", Georgia, serif;
  --gutter: clamp(16px, 3vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0; background: var(--mist); color: var(--ink);
  font-family: var(--text); font-size: 1.05rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); line-height: 1.1; letter-spacing: -.02em; margin: 0; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 4px; }

svg.ic { width: 1.2em; height: 1.2em; flex: none; }
svg.ic * { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.ic .solid { fill: currentColor; stroke: none; }
.ico { display: inline-flex; }

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

/* ---------- Bausteine ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent;
  font-family: var(--display); font-weight: 600; font-size: .98rem; text-decoration: none; cursor: pointer;
  color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--mist); }
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.btn.primary:hover { background: #f2b64a; border-color: #f2b64a; color: var(--ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .92rem; }
.btn.quiet { border-color: transparent; }
.btn.quiet:hover { background: rgba(18, 49, 58, .1); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

.linkbtn { border: 0; background: none; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--ink-soft); }
.linkbtn:hover { color: var(--ink); }

.field { margin-bottom: 22px; }
.field > label, .field > .lbl { display: block; font-family: var(--display); font-weight: 650; font-size: .98rem; margin-bottom: 6px; }
.hint { margin: 6px 0 0; font-size: .92rem; color: var(--ink-soft); }

input[type="text"], input[type="date"], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid rgba(18, 49, 58, .32); border-radius: 10px; background: var(--paper);
}
input[type="text"]:focus, input[type="date"]:focus, select:focus, textarea:focus { outline: 3px solid var(--saffron); outline-offset: 0; border-color: var(--ink); }
textarea { resize: vertical; line-height: 1.55; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  max-width: min(92vw, 560px); padding: 12px 20px; border-radius: 12px;
  background: var(--ink); color: #fff; font-family: var(--display); font-weight: 550;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.toast.warn { background: var(--saffron-deep); }

/* ---------- Dialoge ---------- */

dialog.modal {
  border: 0; border-radius: 18px; padding: 28px; width: min(92vw, 520px);
  background: var(--paper); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
dialog.modal::backdrop { background: rgba(12, 24, 29, .55); }
dialog.modal h2 { font-size: 1.5rem; margin-bottom: 14px; }
dialog.modal .actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }
dialog.modal progress { width: 100%; height: 10px; accent-color: var(--sea); }
dialog.preview { width: min(96vw, 1300px); height: min(92vh, 860px); padding: 0; display: none; flex-direction: column; overflow: hidden; }
dialog.preview[open] { display: flex; }
dialog.preview .phead { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
dialog.preview .phead strong { font-family: var(--display); flex: 1; }
dialog.preview iframe { flex: 1; width: 100%; border: 0; background: var(--mist); }

/* ---------- Kopfleiste ---------- */

.wbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px var(--gutter); background: var(--ink); color: var(--mist);
  position: sticky; top: 0; z-index: 10;
}
.wbar .brand img { display: inline-block; vertical-align: -8px; margin-right: 10px; background: #fff; border-radius: 8px; padding: 2px; }
.wbar .brand { font-family: var(--display); font-weight: 750; font-size: 1.25rem; letter-spacing: -.02em; }
.wbar .grow { flex: 1; }
.wbar .btn { border-color: rgba(255, 255, 255, .5); color: #fff; }
.wbar .btn:hover { background: #fff; color: var(--ink); }
.wbar .btn.primary { background: var(--saffron); border-color: var(--saffron); color: var(--ink); }
.wbar .btn.primary:hover { background: #f2b64a; }
.wbar .state { font-size: .92rem; color: #b9cdc9; }
.wbar .state.dirty { color: var(--saffron); font-weight: 600; }
.wbar .linkbtn { color: #b9cdc9; }
.wbar .linkbtn:hover { color: #fff; }

/* ---------- Verbinden ---------- */

.center { max-width: 640px; margin: 0 auto; padding: clamp(40px, 10vh, 120px) var(--gutter); }
.center h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); font-weight: 750; letter-spacing: -.035em; margin-bottom: 20px; }
.center p { max-width: 54ch; }
.center .btn { margin-top: 12px; }
.center .note { margin-top: 28px; font-size: .95rem; color: var(--ink-soft); }
.errorbox { margin-top: 20px; padding: 14px 18px; border-left: 4px solid var(--danger); background: var(--paper); border-radius: 0 10px 10px 0; }

/* ---------- Übersicht ---------- */

.home { max-width: 1040px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--gutter) 80px; }
.home .head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.home h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 750; letter-spacing: -.03em; }
.tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tools input[type="text"] { max-width: 280px; }
.seg { display: inline-flex; border: 1.5px solid rgba(18, 49, 58, .32); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 16px; cursor: pointer; font-family: var(--display); font-weight: 600; font-size: .92rem; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--mist); }

.cases { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.case {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center;
  padding: 20px 0; border-bottom: 1px solid var(--line);
}
.case h2 { font-size: 1.4rem; font-weight: 680; letter-spacing: -.02em; }
.case h2 a { color: inherit; text-decoration: none; }
.case h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.case .sub { margin: 2px 0 0; color: var(--ink-soft); font-style: italic; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: .95rem; color: var(--ink-soft); }
.meta .st { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.meta .st::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sea); }
.meta .st.pausiert::before { background: var(--saffron); }
.meta .st.abgeschlossen::before { background: var(--ink-soft); }
.meta .due { font-weight: 600; }
.meta .due.soon { color: var(--saffron-deep); }
.meta .due.over { color: var(--danger); }
.case .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.case.broken h2 { color: var(--ink-soft); }
.case .err { color: var(--danger); margin: 4px 0 0; }

.more { position: relative; }
.more summary { list-style: none; cursor: pointer; }
.more summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 240px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18); display: flex; flex-direction: column;
}
.menu button {
  text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 8px; cursor: pointer;
  font-family: var(--display); font-weight: 550;
}
.menu button:hover { background: rgba(18, 49, 58, .1); }
.menu button.danger { color: var(--danger); }

.empty { margin-top: 40px; max-width: 52ch; color: var(--ink-soft); }

/* ---------- Editor ---------- */

.edit { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 70px); }
.tree {
  border-right: 1px solid var(--line); padding: 20px 14px 40px var(--gutter);
  position: sticky; top: 70px; align-self: start; max-height: calc(100vh - 70px); overflow: auto;
}
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree .t-item {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 8px 12px; border-radius: 10px; line-height: 1.3;
}
.tree .t-item:hover { background: rgba(18, 49, 58, .08); }
.tree .t-item[aria-current="true"] { background: var(--ink); color: var(--mist); }
.tree .t-item small { display: block; font-size: .85rem; opacity: .75; }
.tree .t-termin { font-family: var(--display); font-weight: 650; margin-top: 10px; }
.tree .t-clips { margin: 0 0 0 12px; padding-left: 10px; border-left: 2px solid var(--line); }
.tree .t-clip { font-size: .95rem; }
.tree .btn { margin-top: 18px; }

.formwrap { padding: clamp(20px, 4vw, 44px) var(--gutter) 100px; min-width: 0; }
.form { max-width: 780px; }
.formhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.formhead h2 { font-size: 1.9rem; font-weight: 720; letter-spacing: -.03em; }
.formhead .btns { display: flex; gap: 6px; flex-wrap: wrap; }
.form h3 { font-size: 1.15rem; font-weight: 650; margin: 36px 0 12px; }

.list { list-style: none; margin: 0 0 10px; padding: 0; }
.list li { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.list li input { flex: 1; }

.drop {
  border: 2px dashed rgba(18, 49, 58, .35); border-radius: 14px; padding: 22px; text-align: center; color: var(--ink-soft);
  transition: background .15s, border-color .15s;
}
.drop.over { background: rgba(232, 166, 48, .18); border-color: var(--saffron); }
.drop .btn { margin-top: 8px; }

.clipcards { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; }
.clipcards li { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.clipcards .pic { aspect-ratio: 16 / 9; border-radius: 8px; background: var(--screen); overflow: hidden; }
.clipcards .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clipcards .ct { background: none; border: 0; text-align: left; cursor: pointer; padding: 0; font-family: var(--display); font-weight: 650; font-size: 1.1rem; }
.clipcards .ct:hover { text-decoration: underline; text-underline-offset: 3px; }
.clipcards .ct small { display: block; font-weight: 500; font-size: .9rem; color: var(--ink-soft); }
.clipcards .acts { display: flex; gap: 2px; }

.iconbtn {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.iconbtn:hover { background: rgba(18, 49, 58, .12); }
.iconbtn[disabled] { opacity: .3; pointer-events: none; }

.vidbox { background: var(--screen); border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.vidbox video { display: block; width: 100%; max-height: 420px; background: #000; }
.vidbox .msg { padding: 28px; color: #fff; }
.vidbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.vidbar .file { color: var(--ink-soft); font-size: .92rem; word-break: break-all; }

.marks { list-style: none; margin: 0 0 10px; padding: 0; }
.marks li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.marks input.time { font-family: var(--display); font-variant-numeric: tabular-nums; font-weight: 600; text-align: center; }

.posterbox { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.posterbox img { width: 192px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: var(--screen); display: block; }
.posterbox .ph { width: 192px; aspect-ratio: 16 / 9; border-radius: 10px; background: rgba(18, 49, 58, .12); display: grid; place-items: center; color: var(--ink-soft); font-size: .9rem; }

.manage { display: flex; gap: 10px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 18px; font-size: .95rem; color: var(--ink-soft); margin: 0 0 14px; }
.kv dt { font-weight: 650; color: var(--ink); font-family: var(--display); }
.kv dd { margin: 0; word-break: break-all; }

@media (max-width: 900px) {
  .edit { grid-template-columns: minmax(0, 1fr); }
  .tree { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding-right: var(--gutter); }
  .row2 { grid-template-columns: 1fr; }
  .case { grid-template-columns: 1fr; }
  .case .acts { justify-content: flex-start; }
  .clipcards li { grid-template-columns: 90px minmax(0, 1fr); }
  .clipcards .acts { grid-column: 1 / -1; }
  .marks li { grid-template-columns: 84px minmax(0, 1fr) auto auto auto; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Favoriten ---------- */

.iconbtn.star.on svg.ic path { fill: var(--saffron); stroke: var(--ink); }

.favcards { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 20px; }
.favcards li {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; align-items: start;
  padding-bottom: 20px; border-bottom: 1px solid var(--line);
}
.favcards .pic { aspect-ratio: 16 / 9; border-radius: 8px; background: var(--screen); overflow: hidden; }
.favcards .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.favcards .ct { background: none; border: 0; text-align: left; cursor: pointer; padding: 0; font-family: var(--display); font-weight: 650; font-size: 1.15rem; }
.favcards .ct:hover { text-decoration: underline; text-underline-offset: 3px; }
.favcards .ct small { display: block; font-weight: 500; font-size: .9rem; color: var(--ink-soft); }
.favcards textarea { margin-top: 10px; }
.favcards .acts { display: flex; gap: 2px; }

@media (max-width: 900px) {
  .favcards li { grid-template-columns: 100px minmax(0, 1fr); }
  .favcards .acts { grid-column: 1 / -1; }
}

/* ---------- Merkliste übernehmen ---------- */

.memoimport { list-style: none; margin: 12px 0 16px; padding: 0; max-height: 40vh; overflow: auto; display: grid; gap: 12px; }
.memoimport label { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; cursor: pointer; }
.memoimport small { display: block; color: var(--ink-soft); }
.memoimport input, .chk input { width: 20px; height: 20px; accent-color: var(--sea); margin: 2px 0 0; }
.chk { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; }

.madeby { margin-top: 40px; }
.madeby a { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-soft); text-decoration: none; font-weight: 600; min-height: 44px; }
.madeby a:hover { text-decoration: underline; text-underline-offset: 3px; }


/* ---------- Lizenz ---------- */
.keyinput { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .08em; font-size: 1.15rem; max-width: 22em; }
.banner { margin: 0 0 20px; padding: 14px 18px; border-left: 4px solid var(--saffron); background: #fff6e3; border-radius: 0 10px 10px 0; }
.banner .btn { margin-left: 8px; }
.spende a, .center a { color: var(--ink); }
.fw-footer { max-width: 1100px; margin: 24px auto 0; padding: 20px var(--gutter) 36px; color: var(--ink-soft); font-size: .95rem; border-top: 1px solid var(--line); }
.fw-footer .linkbtn { color: var(--ink-soft); text-decoration: underline; }
.modal h3 { margin: 18px 0 6px; font-size: 1.05rem; }

.headacts { display: inline-flex; gap: 10px; flex-wrap: wrap; }

/* Bedienung per Finger (iPad, Tablets): größere Trefferflächen */
@media (pointer: coarse) {
  .btn, .btn.small, .iconbtn, .linkbtn, .seg button, .more summary { min-height: 46px; }
  .iconbtn { min-width: 46px; }
  input[type="text"], input[type="date"], select, textarea { font-size: 16px; }
  .menu button { min-height: 48px; }
}
