/* =====================================================================
   STARK INDUSTRIES — HUD THEME
   Arc-Reaktor-Cyan + Hot-Rod-Gold auf Deep-Space-Schwarz.
   Nur CSS, keine externen Ressourcen (CSP-konform).
   ===================================================================== */
:root {
  --bg:          #05070d;
  --bg-2:        #0a0f1a;
  --surface:     rgba(13, 21, 37, 0.72);
  --surface-2:   rgba(20, 30, 50, 0.85);
  --border:      rgba(55, 213, 255, 0.18);
  --border-str:  rgba(55, 213, 255, 0.55);
  --text:        #d7e3f2;
  --muted:       #6d8299;
  --cyan:        #37d5ff;
  --cyan-dim:    #1a9cc4;
  --gold:        #ffc24b;
  --gold-dim:    #c8922a;
  --danger:      #ff5a5f;
  --ok:          #3ce0a1;
  --radius:      4px;
  --glow-cyan:   0 0 20px rgba(55, 213, 255, .30);
  --glow-gold:   0 0 20px rgba(255, 194, 75, .32);
  --mono:        ui-monospace, "Cascadia Code", "Segoe UI Mono", "Consolas", monospace;
  --sans:        "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  line-height: 1.55;
  background:
    radial-gradient(1200px 820px at 12% -12%, rgba(55,213,255,.12), transparent 58%),
    radial-gradient(1000px 720px at 112% 8%, rgba(255,194,75,.09), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

/* Gitter-Overlay + Scanline (dekorativ, klickt nicht) */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(55,213,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,213,255,.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 55%, transparent 100%);
}
body::after {
  content: "";
  position: fixed; left: 0; right: 0; height: 140px; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(55,213,255,.06) 45%, rgba(55,213,255,.10) 50%, transparent);
  animation: scan 11s linear infinite;
}
@keyframes scan { 0% { top: -160px; } 100% { top: 100%; } }
@media (prefers-reduced-motion: reduce) { body::after { display: none; } }

/* Sichtbarer Content über das Overlay heben */
#login-view, .topbar, .container, .modal, .toast { position: relative; z-index: 1; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: .88rem; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-shadow: var(--glow-cyan); }

/* Überschriften — technisch, HUD */
h1, h2, h3 {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(55,213,255,.25);
  font-weight: 600;
}
h2 { font-size: 1rem; }
h2::before { content: "▚ "; color: var(--gold); text-shadow: var(--glow-gold); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  font-family: var(--mono);
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .58rem 1.05rem;
  border: 1px solid var(--border-str);
  background: rgba(10, 18, 32, .6);
  color: var(--cyan);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, color .15s, transform .05s;
}
.btn:hover { background: rgba(55,213,255,.12); box-shadow: var(--glow-cyan); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #ffd571, #f0a92a);
  border-color: var(--gold);
  color: #1a1200;
  font-weight: 700;
  box-shadow: 0 0 16px rgba(255,194,75,.28);
}
.btn.primary:hover { background: linear-gradient(180deg, #ffe08c, #ffb63e); box-shadow: var(--glow-gold); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255,90,95,.12); border-color: var(--danger); color: #ff9498; }
.btn.danger:hover { background: rgba(255,90,95,.22); box-shadow: 0 0 18px rgba(255,90,95,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------------------------------------------------------------- Inputs */
input, select, textarea {
  font-family: var(--sans);
  font-size: .95rem;
  padding: .58rem .75rem;
  width: 100%;
  color: var(--text);
  background: rgba(6, 12, 22, .72);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #4c6076; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), var(--glow-cyan);
}
textarea {
  min-height: 160px;
  resize: vertical;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.5;
}
#manual-wrap { margin-bottom: .7rem; }
#manual-wrap .muted { margin: .4rem 0 0; }
select option { background: var(--bg-2); color: var(--text); }
label {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  margin-bottom: .85rem;
}
label input, label select { margin-top: .35rem; }

/* HUD-Ecke (Panels, Login, Modal) */
.hud {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(9px);
  box-shadow: inset 0 0 0 1px rgba(55,213,255,.04), 0 8px 30px rgba(0,0,0,.5), 0 0 40px rgba(55,213,255,.05);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.hud::before {
  content: "";
  position: absolute; top: 0; left: 14px; right: 34px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  box-shadow: var(--glow-cyan);
}

/* ---------------------------------------------------------------- Login */
#login-view { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-str);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 60px rgba(55,213,255,.10), 0 12px 40px rgba(0,0,0,.6);
  padding: 2.2rem;
  width: 100%; max-width: 380px;
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 20px 100%, 0 calc(100% - 20px));
}
/* Arc-Reaktor-Glimmen hinter der Login-Karte */
.login-card::after {
  content: "";
  position: absolute; inset: -40% -20% auto; height: 200px; z-index: -1;
  background: radial-gradient(closest-side, rgba(55,213,255,.22), transparent 70%);
  filter: blur(6px);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .login-card::after { animation: none; } }
.login-card h1 { font-size: 1.1rem; margin: 0 0 .3rem; }

/* ---------------------------------------------------------------- Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; flex-wrap: wrap;
  padding: .8rem 1.4rem;
  background: rgba(5, 9, 16, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-str);
  box-shadow: 0 1px 0 rgba(55,213,255,.15), 0 6px 24px rgba(0,0,0,.5);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(55,213,255,.4);
  display: flex; align-items: center; gap: .55rem;
}
.brand::before {
  content: "";
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #bff2ff 0%, var(--cyan) 45%, transparent 72%);
  box-shadow: 0 0 12px var(--cyan), 0 0 24px rgba(55,213,255,.6);
  animation: pulse 3s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .brand::before { animation: none; } }
.top-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }

/* Menüleiste */
.menubar { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1 1 auto; }
.navbtn {
  font-family: var(--mono);
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .5rem .9rem;
  cursor: pointer;
  transition: color .14s, background .14s, box-shadow .14s;
}
.navbtn:hover { color: var(--cyan); background: rgba(55,213,255,.08); }
.navbtn.active {
  color: var(--cyan);
  border-color: var(--border-str);
  background: rgba(55,213,255,.10);
  box-shadow: inset 0 -2px 0 var(--gold), 0 0 14px rgba(55,213,255,.15);
}
#who { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; color: var(--gold); text-transform: uppercase; }

.container { max-width: 1040px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* ---------------------------------------------------------------- Panels */
.panel, .filterbar {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(9px);
  box-shadow: 0 8px 30px rgba(0,0,0,.45), 0 0 40px rgba(55,213,255,.04);
  padding: 1.4rem;
  margin-bottom: 1.4rem;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.panel::before {
  content: "";
  position: absolute; top: 0; left: 14px; right: 34px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  box-shadow: var(--glow-cyan);
}
.panel h2 { margin: 0 0 1.1rem; }

.row { display: flex; gap: .7rem; margin-bottom: .7rem; }
.row.wrap { flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.row .btn { flex: 0 0 auto; }

.filterbar { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.filterbar select { max-width: 280px; }

.status { margin: .6rem 0 0; font-family: var(--mono); font-size: .82rem; letter-spacing: .04em; }
.status.working { color: var(--cyan); }
.status.working::before { content: "▶ "; color: var(--gold); }
.status.ok { color: var(--ok); }
.status.ok::before { content: "✔ "; }
.error, .status.err { color: var(--danger); }
.status.err::before { content: "⚠ "; }
.error { font-family: var(--mono); font-size: .85rem; }

/* ---------------------------------------------------------------- Cards */
.cards { display: flex; flex-direction: column; gap: .9rem; }
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: row; align-items: stretch;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 22px rgba(0,0,0,.45);
  transition: transform .14s, box-shadow .14s, border-color .14s;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.card:hover {
  transform: translateX(3px);
  border-color: var(--border-str);
  box-shadow: 0 10px 34px rgba(0,0,0,.6), var(--glow-cyan);
}
.card .thumb {
  width: 240px; flex: 0 0 240px; aspect-ratio: 16/9; object-fit: cover;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  filter: saturate(1.05) contrast(1.03);
}
.card .body { flex: 1; min-width: 0; padding: .9rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
@media (max-width: 640px) {
  .card { flex-direction: column; }
  .card .thumb { width: 100%; flex: none; border-right: none; border-bottom: 1px solid var(--border); }
}
.card .title { font-weight: 600; font-size: .98rem; color: #e8f3ff; }
.card .tldr {
  font-size: .86rem; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .75rem; color: var(--muted); }
.badge {
  font-family: var(--mono);
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--cyan);
  background: rgba(55,213,255,.08);
  border: 1px solid var(--border-str);
  border-radius: 2px;
  padding: .12rem .5rem;
}
.card .muted { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; }

/* ---------------------------------------------------------------- Modal */
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(2, 5, 10, .72);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 1rem;
}
.modal-box {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border-str);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 60px rgba(55,213,255,.10), 0 20px 60px rgba(0,0,0,.7);
  width: 100%; max-width: 700px; max-height: 88vh; overflow: auto;
  padding: 1.7rem;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
}
.modal-close {
  position: absolute; top: .8rem; right: 1rem;
  background: none; border: none; cursor: pointer;
  font-size: 1.15rem; color: var(--muted);
}
.modal-close:hover { color: var(--cyan); text-shadow: var(--glow-cyan); }

.summary-body { margin-top: 1.1rem; color: var(--text); }
.summary-body h1, .summary-body h2, .summary-body h3 {
  line-height: 1.3; color: var(--cyan); letter-spacing: .06em;
}
.summary-body h2::before { content: none; }
.summary-body pre { background: rgba(6,12,22,.8); border: 1px solid var(--border); padding: .8rem; border-radius: var(--radius); overflow: auto; }
.summary-body code { background: rgba(55,213,255,.08); color: var(--cyan); padding: .1rem .35rem; border-radius: 2px; font-family: var(--mono); }
.summary-body ul, .summary-body ol { padding-left: 1.4rem; }
.summary-body a { color: var(--gold); }
.summary-body strong { color: #eaf5ff; }

/* Kategorien-Liste */
.cat-list { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.cat-list li {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.cat-list li .name { flex: 1; }
.cat-list li .count { font-family: var(--mono); color: var(--gold-dim); font-size: .74rem; letter-spacing: .06em; }

/* Toast */
.toast {
  position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  z-index: 100;
  font-family: var(--mono); font-size: .84rem; letter-spacing: .04em;
  color: var(--cyan);
  background: rgba(8, 14, 24, .92);
  border: 1px solid var(--border-str);
  border-radius: var(--radius);
  padding: .7rem 1.15rem;
  box-shadow: 0 0 30px rgba(55,213,255,.18), 0 10px 30px rgba(0,0,0,.6);
}

/* ---------------------------------------------------------------- Tags */
.tagcloud { display: flex; flex-wrap: wrap; gap: .55rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--mono);
  font-size: .74rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--cyan);
  background: rgba(55,213,255,.06);
  border: 1px solid var(--border-str);
  border-radius: 2px;
  padding: .28rem .6rem;
  cursor: pointer;
  transition: background .14s, box-shadow .14s, color .14s, border-color .14s;
}
.tag-chip:hover { background: rgba(55,213,255,.16); box-shadow: var(--glow-cyan); }
.tag-chip.active {
  color: #1a1200; background: var(--gold); border-color: var(--gold);
  box-shadow: var(--glow-gold);
}
.tag-chip .tag-count {
  font-size: .68rem; color: var(--gold);
  background: rgba(255,194,75,.12); border-radius: 2px; padding: 0 .32rem;
}
.tag-chip.active .tag-count { color: #1a1200; background: rgba(0,0,0,.18); }
.tag-chip.mini {
  cursor: default; text-transform: none; letter-spacing: .02em;
  padding: .12rem .45rem; font-size: .68rem;
  color: var(--cyan-dim); border-color: var(--border);
  background: rgba(55,213,255,.05);
}
.card-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.tagrow { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.active-tag-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  margin-bottom: .9rem; font-family: var(--mono); font-size: .78rem;
  letter-spacing: .06em; color: var(--muted);
}
.tagcloud-panel { margin-top: .4rem; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--cyan-dim) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(55,213,255,.35); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--cyan); }
