/* ============================================================
   "Nachtschicht" — Visual Guidelines siehe docs/VISUAL-GUIDELINES.md
   Bühne: dunkler Schreibtisch bei Nacht. Inhalt: helles Papier.
   ============================================================ */

:root {
  /* Desk (dunkel) */
  --desk: #0c0b09;
  --desk-warm: #1b160f;
  --ink: #e7e3d8;
  --muted: #9a978d;
  --line: #2a2d35;
  --accent: #c8a24a;      /* Gold — Progress, Fokus, Metall */
  --ok: #4f9d69;
  --danger: #c0492f;

  /* Papier (hell) */
  --paper: #f1e9d4;
  --paper-2: #e6dcc2;
  --paper-bright: #fbf6e8;
  --paper-ink: #2a251c;
  --paper-muted: #6e6350;
  --paper-line: rgba(42, 37, 28, 0.22);
  --stamp-red: #a3271b;
  --note: #f5e27a;

  /* Typografie */
  --type: "Special Elite", "Courier New", monospace;   /* Schreibmaschine */
  --mono: "Courier Prime", "Consolas", monospace;      /* lesbarer Mono */
  --hand: "Caveat", "Segoe Script", cursive;           /* Handschrift */
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  /* Papier-Korn (SVG-Noise, kein Asset) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.07'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--desk);
}

/* Schreibtisch bei Nacht: Lampen-Lichtkegel oben, sonst Dunkel */
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 50% -12%, var(--desk-warm) 0%, rgba(27, 22, 15, 0.4) 45%, transparent 70%) no-repeat fixed,
    var(--desk);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

.dossier {
  max-width: 620px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

/* ---- Dunkles Chrome: Kopf, Banderole, Progress ---- */

.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.classified {
  border: 1px dashed var(--stamp-red);
  color: #c4543f;
  font-family: var(--type);
  font-size: 10px;
  letter-spacing: 0.22em;
  padding: 5px 9px;
  display: inline-block;
  transform: rotate(-2deg);
  margin-bottom: 14px;
  opacity: 0.9;
}

header.case-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.case-no {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

h1 {
  font-family: var(--type);
  font-weight: 400;
  font-size: 26px;
  margin: 8px 0 4px;
  line-height: 1.2;
}

.progress {
  height: 6px;
  background: #1d2027;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 12px;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #e0c074);
  transition: width 0.5s ease;
}

/* Mute-Toggle (Sound) */
.mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 60;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(22, 24, 29, 0.85);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.mute-btn:hover { opacity: 1; }
.mute-btn:active { transform: scale(0.94); }

/* ============================================================
   PAPIER — das Rezept: heller Grund + Korn + Rotation + Schatten
   ============================================================ */

.card {
  position: relative;
  background: var(--paper);
  background-image: var(--grain);
  color: var(--paper-ink);
  border: none;
  border-radius: 2px;
  padding: 22px 20px;
  margin: 22px 0;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 10px 28px rgba(0, 0, 0, 0.55),
    inset 0 0 60px rgba(120, 100, 60, 0.07);
  --rot: -0.4deg;
  transform: rotate(var(--rot));
}
.card:nth-of-type(even) { --rot: 0.5deg; }
.card.flat { --rot: 0deg; } /* Formular-Karte: Interaktion bleibt gerade */

/* Büroklammer (Metall, CSS-gezeichnet) */
.clip::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 26px;
  width: 15px;
  height: 42px;
  border: 3.5px solid #8d8d94;
  border-radius: 8px;
  border-bottom: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 60%);
  box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.35);
  transform: rotate(3deg);
}

/* Briefkopf */
.letterhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-muted);
  border-bottom: 3px double var(--paper-line);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

/* Fließtext auf Papier: Schreibmaschine */
.briefing {
  white-space: pre-wrap;
  font-family: var(--type);
  font-size: 15.5px;
  line-height: 1.65;
}
.briefing strong { color: var(--stamp-red); font-weight: 400; }

/* dekorativer Redaction-Balken — NIE über echtem Inhalt */
.redacted {
  display: inline-block;
  background: #1c1913;
  color: transparent;
  border-radius: 1px;
  user-select: none;
}

/* Task: angetackerter Zettel am Blattende */
.task {
  position: relative;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--paper-ink);
  background: var(--paper-2);
  background-image: var(--grain);
  border-top: 2px dashed var(--paper-line);
  border-left: 3px solid var(--stamp-red);
  padding: 14px;
  margin: 18px -6px -8px;
  line-height: 1.55;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  transform: rotate(0.3deg);
}
.task::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 18px;
  width: 16px;
  height: 5px;
  background: #7c7c84;
  border-radius: 2px;
  box-shadow: 60px 0 0 #7c7c84;
}

/* ---- Formular auf Papier ---- */

label.field { display: block; margin-top: 4px; }
.field .lbl {
  display: inline-block;
  font-family: var(--type);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--stamp-red);
  border: 1.5px solid currentColor;
  padding: 3px 8px;
  transform: rotate(-1deg);
  opacity: 0.85;
}

input[type="text"] {
  width: 100%;
  margin-top: 10px;
  padding: 15px 14px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--paper-ink);
  background: var(--paper-bright);
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
}
input[type="text"]::placeholder { color: var(--paper-muted); opacity: 0.6; }
input[type="text"]:focus { outline: none; border-color: var(--stamp-red); }

/* Prüfen = roter Stempel */
.btn {
  display: inline-block;
  width: 100%;
  margin-top: 14px;
  padding: 15px;
  font-family: var(--type);
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  /* Default (dunkler Kontext): Gold */
  color: #14140f;
  background: var(--accent);
  border: none;
}
/* "seal", nicht "stamp" — .stamp ist die rotierte Inline-Stempel-Deko */
.btn.seal {
  color: var(--stamp-red);
  background: transparent;
  border: 3px solid var(--stamp-red);
  box-shadow: inset 0 0 14px rgba(163, 39, 27, 0.12);
}
.btn.seal:hover { background: rgba(163, 39, 27, 0.08); }
.btn.seal:active { transform: translateY(1px) scale(0.98); }
.btn.secondary { background: #1d2027; color: var(--ink); border: 1px solid var(--line); }

.feedback { min-height: 22px; margin-top: 12px; font-family: var(--type); font-size: 14.5px; }
.feedback.err { color: var(--stamp-red); }
.feedback.ok { color: #35714b; }

/* ---- Hints: gelbe Post-its, Handschrift ---- */

.hints { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.hint {
  position: relative;
  align-self: flex-start;
  background: var(--note);
  background-image: var(--grain);
  color: #4a3f18;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.35;
  padding: 16px 16px 14px;
  max-width: 92%;
  border-radius: 1px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  transform: rotate(-1.1deg);
  animation: noteIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.hint:nth-child(even) { transform: rotate(0.9deg); align-self: flex-end; }
.hint::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 64px;
  height: 18px;
  margin-left: -32px;
  background: rgba(252, 250, 240, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transform: rotate(-2deg);
}
.hint .h-lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: #8a7a2e;
  text-transform: uppercase;
}
@keyframes noteIn {
  from { opacity: 0; transform: translateY(10px) rotate(-4deg) scale(0.96); }
}

/* ---- Media: Polaroid + Audio-Slip ---- */

.polaroid {
  position: relative;
  background: #f6f3ea;
  padding: 10px 10px 30px;
  margin: 16px auto 10px;
  max-width: 88%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transform: rotate(1deg);
}
.polaroid img { display: block; width: 100%; margin: 0; border-radius: 0; }
.polaroid::before,
.polaroid::after {
  content: "";
  position: absolute;
  width: 62px;
  height: 20px;
  background: rgba(252, 250, 240, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.polaroid::before { top: -8px; left: -14px; transform: rotate(-38deg); }
.polaroid::after { top: -8px; right: -14px; transform: rotate(38deg); }

img { max-width: 100%; border-radius: 3px; margin: 10px 0; }
audio { width: 100%; margin-top: 12px; }

/* ---- Funkspruch-Toast (bleibt dunkel — kommt aus dem Äther) ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #16181d;
  color: var(--ink);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  max-width: 90vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }

.muted { color: var(--muted); }
.card .muted, .card p { color: inherit; }
.card .muted { color: var(--paper-muted); }

/* ---- Stempel (Inline-Variante, z.B. SPURENFUND / ERLEDIGT) ---- */

.stamp {
  font-family: var(--type);
  color: var(--stamp-red);
  border: 2.5px solid var(--stamp-red);
  border-radius: 4px;
  display: inline-block;
  padding: 4px 10px;
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transform: rotate(-3deg);
  opacity: 0.85;
}

/* ============================================================
   Motion & Eye Candy
   ============================================================ */

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Papier einlegen */
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(26px) rotate(0deg) scale(0.985); }
  to { opacity: 1; transform: rotate(var(--rot)); }
}
.card { animation: sheetIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.card:nth-of-type(2) { animation-delay: 0.1s; }

/* Button: Press + Loading-Spinner */
.btn { position: relative; overflow: hidden; transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.2s ease, background 0.15s ease; }
.btn:not(.secondary):not(.seal):hover { filter: brightness(1.08); box-shadow: 0 0 18px rgba(200, 162, 74, 0.35); }
.btn:active { transform: translateY(2px) scale(0.99); }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid rgba(163, 39, 27, 0.3); border-top-color: var(--stamp-red);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
.btn:not(.seal).loading::after { border-color: rgba(20, 20, 15, 0.35); border-top-color: #14140f; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ripple beim Klick */
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: rgba(120, 40, 20, 0.25); animation: ripple 0.55s ease-out;
  pointer-events: none;
}
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* Input-Feedback */
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}
.shake { animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
input.err-flash { border-color: var(--stamp-red) !important; box-shadow: 0 0 0 3px rgba(163, 39, 27, 0.2); }
input.ok-flash { border-color: var(--ok) !important; box-shadow: 0 0 0 3px rgba(79, 157, 105, 0.3); color: #35714b; }
input[type="text"] { transition: border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease; }

/* Erfolgs-Stempel-Overlay */
.stamp-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 9, 11, 0.72); backdrop-filter: blur(3px);
  animation: fade 0.25s ease both;
}
.stamp-overlay .big-stamp {
  font-family: var(--type); color: var(--ok);
  border: 4px solid var(--ok); border-radius: 8px;
  padding: 16px 26px; font-size: clamp(22px, 7vw, 40px);
  letter-spacing: 0.12em; text-transform: uppercase; text-align: center;
  box-shadow: 0 0 40px rgba(79, 157, 105, 0.35), inset 0 0 20px rgba(79, 157, 105, 0.15);
  animation: stampSlam 0.5s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}
.stamp-overlay .sub { display: block; font-size: 13px; color: var(--ink); margin-top: 10px; letter-spacing: 0.05em; opacity: 0.85; font-family: var(--mono); text-transform: none; }
.stamp-overlay .wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 20px; max-width: 90vw; }
.stamp-overlay .continue {
  font-family: var(--type); font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase;
  color: #14140f; background: var(--accent); border: none; border-radius: 8px;
  padding: 15px 28px; cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0; animation: fade 0.4s ease 0.75s both;
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.2s ease;
}
.stamp-overlay .continue:hover { filter: brightness(1.08); box-shadow: 0 0 22px rgba(200, 162, 74, 0.45); }
.stamp-overlay .continue:active { transform: translateY(2px) scale(0.99); }
@keyframes stampSlam {
  0% { transform: scale(2.6) rotate(-14deg); opacity: 0; }
  55% { transform: scale(0.92) rotate(-4deg); opacity: 1; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}

/* Scanline + Vignette (Nachtschicht-Atmosphäre) */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(120% 85% at 50% 25%, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
}
.dossier { position: relative; z-index: 6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; }
}

/* ============================================================
   Admin (/wache): Karteikarten auf dem gleichen Desk
   ============================================================ */

.wache { max-width: 760px; }
.chapter-row {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 12px 16px;
  margin: 10px 0;
  background: var(--paper);
  background-image: var(--grain);
  color: var(--paper-ink);
  border-radius: 2px;
  border-left: 4px solid var(--paper-line);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --rot: -0.2deg;
  transform: rotate(var(--rot));
}
.chapter-row:nth-of-type(even) { --rot: 0.25deg; }
.chapter-row.current { border-left-color: var(--stamp-red); }
.chapter-row .muted { color: var(--paper-muted); }
.badge { font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 3px; letter-spacing: 0.1em; }
.badge.live { background: rgba(79, 157, 105, 0.18); color: #35714b; }
.badge.coming_soon { background: rgba(163, 39, 27, 0.14); color: var(--stamp-red); }
.badge.done { background: rgba(138, 106, 30, 0.18); color: #7a6524; }
.row-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.mini { font-size: 12px; padding: 6px 10px; width: auto; margin: 0; font-family: var(--mono); letter-spacing: 0.04em; text-transform: none; }
.chapter-row .mini {
  background: transparent;
  color: var(--paper-ink);
  border: 1.5px solid var(--paper-line);
  border-radius: 3px;
}
.chapter-row .mini:not(.secondary) { border-color: var(--stamp-red); color: var(--stamp-red); }
.chapter-row .mini:hover { background: rgba(42, 37, 28, 0.06); filter: none; box-shadow: none; }
.msg-box { display: flex; gap: 8px; margin-top: 10px; }
.msg-box input { margin: 0; }
.msg-box .btn { margin: 0; width: auto; white-space: nowrap; }

/* ---- /spur: Beweisblatt ---- */
body.spur .dossier { padding-top: 48px; }
