/* ==================================================================
   SCORIX Media Center — Design-System

   Marken-Grundlage ist die SMC-Startseite (SCORIX-Blau, Cyan-Akzent,
   General Sans). Der Hell-Satz und das Dual-Override-Muster stammen aus
   dem Vorgängerportal: die System-Präferenz greift per @media, eine
   ausdrückliche Wahl per [data-theme] gewinnt immer.
   ================================================================== */

@font-face {
  font-family: "General Sans";
  src: url("/static/fonts/GeneralSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Marke — fix, unabhängig vom Modus */
  --blue-950: #06182d;
  --blue-900: #08294d;
  --blue-700: #153b6e;
  --cyan: #33d4ff;
  --cyan-deep: #12b4e6;

  /* Adaptive Flächen — Standard ist dunkel wie die Startseite */
  --bg: #06182d;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --dim: rgba(255, 255, 255, 0.48);
  --danger: #ff6b6b;
  --ok: #4ade80;

  --radius-card: 20px;
  --radius-pill: 50px;
  --radius-sm: 10px;

  --font-sans: "General Sans", ui-sans-serif, system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;

  --cycle: 14s;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --border: #e2e6ef;
    --text: #06182d;
    --muted: #5b6472;
    --dim: #8a93a3;
  }
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: #e2e6ef;
  --text: #06182d;
  --muted: #5b6472;
  --dim: #8a93a3;
}

:root[data-theme="dark"] {
  --bg: #06182d;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --dim: rgba(255, 255, 255, 0.48);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 200ms ease, color 200ms ease;
}

/* Der Marken-Hintergrund gehört zum dunklen Erscheinungsbild. Im hellen
   Modus weicht er einer ruhigen Fläche — sonst stünden helle Karten auf
   dunklem Grund. */
body.app-bg {
  background: var(--bg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.app-bg {
    background:
      linear-gradient(120deg, rgba(6, 24, 45, 0.94), rgba(8, 41, 77, 0.88)),
      url("/static/brand/scorix-zahlen-bg-blau.webp") center / cover fixed,
      var(--blue-950);
  }
}

:root[data-theme="dark"] body.app-bg {
  background:
    linear-gradient(120deg, rgba(6, 24, 45, 0.94), rgba(8, 41, 77, 0.88)),
    url("/static/brand/scorix-zahlen-bg-blau.webp") center / cover fixed,
    var(--blue-950);
}

/* Startseite und Anmeldung tragen die Marke und bleiben deshalb immer dunkel,
   unabhängig von der Einstellung des Betriebssystems. */
body.always-dark {
  --bg: #06182d;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --dim: rgba(255, 255, 255, 0.48);
  background:
    linear-gradient(120deg, rgba(6, 24, 45, 0.94), rgba(8, 41, 77, 0.88)),
    url("/static/brand/scorix-zahlen-bg-blau.webp") center / cover fixed,
    var(--blue-950);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 22px;
}

.muted {
  color: var(--muted);
}

.dim {
  color: var(--dim);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nums {
  font-variant-numeric: tabular-nums;
}

/* ---------------- Kopfzeile ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 68px;
}

.header-logo img {
  display: block;
  height: 26px;
  width: auto;
}

/* Das Logo ist weiß — auf heller Fläche muss es umgekehrt werden. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .header-logo img {
    filter: invert(1) brightness(0.35);
  }
}

:root[data-theme="light"] .header-logo img {
  filter: invert(1) brightness(0.35);
}

:root[data-theme="dark"] .header-logo img {
  filter: none;
}

.pill-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.pill-nav a {
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 150ms ease, color 150ms ease;
}

.pill-nav a:hover {
  color: var(--text);
}

.pill-nav a.active {
  background: var(--cyan);
  color: var(--blue-950);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------------- Bedienelemente ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--cyan);
  color: var(--blue-950);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease,
    color 150ms ease;
}

.btn:hover {
  background: var(--cyan-deep);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  color: var(--danger);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}

.btn-sm {
  min-height: 32px;
  padding: 0 13px;
  font-size: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
}

.icon-btn:hover {
  background: var(--surface-2);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

input::placeholder {
  color: var(--dim);
}

/* ---------------- Karten ---------------- */

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
}

:root[data-theme="light"] .card {
  box-shadow: 0 1px 2px rgba(6, 24, 45, 0.04);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.card-head h2 {
  font-size: 19px;
  font-weight: 680;
}

.card-head .spacer {
  margin-left: auto;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.stat .value {
  display: block;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat .label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.badge-ok {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  color: var(--ok);
}

.badge-draft {
  border-color: color-mix(in srgb, var(--cyan) 45%, transparent);
  color: var(--cyan);
}

.notice {
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 14px;
}

.notice-error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  color: var(--danger);
}

.notice-ok {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  color: var(--ok);
}

/* ---------------- Mediathek ---------------- */

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.asset {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  overflow: hidden;
}

/* Schachbrett macht Transparenz sichtbar — für Overlays entscheidend. */
.asset .preview {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background-color: #ffffff;
  background-image:
    linear-gradient(45deg, #d8dde6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dde6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dde6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dde6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.asset .preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.asset .body {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
}

.asset .name {
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.asset .foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding: 0 15px 14px;
}

.asset .foot .spacer {
  margin-left: auto;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 34px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--cyan);
  background: var(--surface-2);
}

.dropzone strong {
  color: var(--text);
  font-size: 16px;
}

/* ---------------- Kampagnen ---------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.table th {
  padding: 0 12px 10px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}

.table td {
  padding: 13px 12px;
  border-top: 1px solid var(--border);
}

.table tr:hover td {
  background: var(--surface-2);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.slot {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.slot h3 {
  font-size: 16px;
  font-weight: 680;
}

.slot .hint {
  color: var(--dim);
  font-size: 13px;
}

.chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chooser .choice {
  position: relative;
  width: 84px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.chooser .choice img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #fff;
}

.chooser .choice[aria-pressed="true"] {
  border-color: var(--cyan);
}

.chooser .choice .order {
  position: absolute;
  top: 3px;
  left: 3px;
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--blue-950);
  font-size: 11px;
  font-weight: 700;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.url-row code {
  flex: 1;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ---------------- Startseite ---------------- */

.hero {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 76px);
  padding: 56px 0 44px;
}

.hero .brand {
  width: min(260px, 64vw);
  height: auto;
  margin-bottom: 52px;
}

.hero h1 {
  max-width: 820px;
  font-size: clamp(34px, 6.2vw, 76px);
  line-height: 0.98;
  font-weight: 760;
}

.hero .intro {
  max-width: 740px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.42;
  font-weight: 470;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

/* Ausspielfenster im Spielverlauf — Marke der Startseite */
.windows {
  margin-top: 58px;
}

.windows-label {
  margin: 0 0 15px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 9%, transparent);
  overflow: hidden;
}

.slot-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--from);
  width: calc(var(--to) - var(--from));
  background: var(--cyan);
  opacity: 0.28;
  animation: var(--cycle) linear infinite;
}

.playhead {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 2px;
  background: var(--text);
  box-shadow: 0 0 12px color-mix(in srgb, var(--text) 85%, transparent);
  animation: run var(--cycle) linear infinite;
}

.legend {
  display: grid;
  grid-template-columns: 24fr 24fr 22fr 24fr;
  gap: 22px;
  margin: 22px 0 0;
  padding: 0 0 0 6%;
  list-style: none;
}

.legend li {
  position: relative;
  padding-left: 16px;
}

.legend .dot {
  position: absolute;
  top: 7px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.28;
  animation: var(--cycle) linear infinite;
}

.legend .name {
  display: block;
  font-size: 15px;
  font-weight: 620;
}

.legend .meta {
  display: block;
  margin-top: 3px;
  color: var(--dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.s1 { animation-name: lit-1; }
.s2 { animation-name: lit-2; }
.s3 { animation-name: lit-3; }
.s4 { animation-name: lit-4; }

@keyframes run {
  from { left: 0; }
  to   { left: 100%; }
}

@keyframes lit-1 {
  0%, 5.9%    { opacity: 0.28; }
  6%, 12%     { opacity: 1; }
  12.1%, 100% { opacity: 0.28; }
}

@keyframes lit-2 {
  0%, 29.9%   { opacity: 0.28; }
  30%, 36%    { opacity: 1; }
  36.1%, 100% { opacity: 0.28; }
}

@keyframes lit-3 {
  0%, 53.9%   { opacity: 0.28; }
  54%, 59%    { opacity: 1; }
  59.1%, 100% { opacity: 0.28; }
}

@keyframes lit-4 {
  0%, 75.9% { opacity: 0.28; }
  76%, 100% { opacity: 1; }
}

/* ---------------- Login ---------------- */

.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 0;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: color-mix(in srgb, var(--surface) 100%, transparent);
  backdrop-filter: blur(12px);
}

.login-card .logo {
  width: 168px;
  margin-bottom: 26px;
}

/* ---------------- Fußzeile ---------------- */

footer.site-footer {
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(10px);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  color: var(--muted);
  font-size: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
}

.footer-links a:hover {
  color: var(--text);
}

.page-main {
  padding: 32px 0 56px;
}

/* ---------------- Schmale Ansichten ---------------- */

@media (max-width: 860px) {
  .legend {
    grid-template-columns: repeat(2, 1fr);
    padding-left: 0;
  }
}

@media (max-width: 700px) {
  body.app-bg {
    background-attachment: scroll, scroll, scroll;
  }

  .shell {
    width: min(100% - 28px, 1180px);
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
  }

  .pill-nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .pill-nav a {
    padding: 7px 11px;
    font-size: 13px;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }

  .legend {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 96px;
    padding: 18px 0;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slot-mark,
  .legend .dot {
    animation: none;
    opacity: 0.7;
  }

  .playhead {
    display: none;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
