:root {
  --accent: #9146ff;
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-2: #232329;
  --text: #efeff1;
  --muted: #a1a1aa;
  --border: #2f2f35;
  --danger: #e5484d;
  --ok: #30a46c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Öffentliche Seite ---------- */
body.public {
  background:
    radial-gradient(900px 500px at 50% -150px, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 48px 16px 32px; }
.profile { text-align: center; margin-bottom: 28px; }
.avatar {
  width: 112px; height: 112px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 20%, transparent);
}
.avatar-fallback {
  display: inline-grid; place-items: center; background: var(--surface-2);
  font-size: 2.2rem; font-weight: 700;
}
.profile h1 { margin: 16px 0 4px; font-size: 1.8rem; }
.bio { color: var(--muted); margin: 0 auto; max-width: 480px; white-space: pre-line; }

.player { aspect-ratio: 16 / 9; margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.links { display: grid; gap: 12px; margin-bottom: 40px; }
.link {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 600;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.link:hover, .link:focus-visible { transform: translateY(-2px); border-color: var(--accent); background: var(--surface-2); }
.badge {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.badge svg { width: 22px; height: 22px; display: block; }
.link-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.arrow { color: var(--muted); }

.post {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px; overflow-wrap: anywhere;
}
.post-img { display: block; width: calc(100% + 40px); margin: -20px -20px 16px; max-width: none; border-radius: var(--radius) var(--radius) 0 0; }
.post h3 { margin: 4px 0 8px; font-size: 1.2rem; }
.post-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.post-body p { margin: 0 0 .8em; }
.post-body p:last-child { margin-bottom: 0; }
.pin { background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 99px; font-weight: 600; }

/* Streamplan */
.schedule { margin-bottom: 40px; }
.schedule h2, .posts h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sch-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sch-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--border); }
.sch-row:first-child { border-top: 0; }
.sch-row.today { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 4px 0 0 var(--accent); }
.sch-day { width: 104px; flex: none; font-weight: 700; }
.sch-day .short { display: none; }
.sch-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sch-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.sch-title { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.sch-badge { flex: none; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--accent); color: #fff; }
.sch-badge.live { background: #eb0400; }
.sch-badge.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: 1px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.sch-note { color: var(--muted); font-size: .88rem; margin: 10px 4px 0; }
@media (max-width: 480px) {
  .sch-day { width: 36px; }
  .sch-day .long { display: none; }
  .sch-day .short { display: inline; }
  .sch-row { gap: 12px; padding: 12px 14px; }
}

/* ---------- Admin ---------- */
body.admin { background: #111114; }
.admin-top {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.admin-top nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.admin-top nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.admin-top nav a.on, .admin-top nav a:hover { color: var(--text); background: var(--surface-2); }
.admin-top form { margin: 0; }
.admin-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.form { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #0e0e10; color: var(--text); font: inherit;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type=color] { width: 64px; height: 40px; padding: 2px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .35; cursor: default; filter: none; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.actions.end { justify-content: flex-end; }
@media (min-width: 641px) { .table .actions.end { flex-wrap: nowrap; } }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.tag.ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: #6ee7a8; }
.tag.pin { background: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--text); }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); border: 1px solid var(--ok); }
.flash-error { background: color-mix(in srgb, var(--danger) 18%, transparent); border: 1px solid var(--danger); }

.link-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.link-edit { display: grid; gap: 10px; padding: 14px; }
.link-form { display: grid; grid-template-columns: 1fr 2fr auto auto; gap: 8px; align-items: center; margin: 0; }
.link-form.add { grid-template-columns: 1fr 2fr auto; }
.link-tools { display: flex; gap: 6px; justify-content: flex-end; }
.link-tools form { margin: 0; }

h2.sub { font-size: 1.05rem; margin: 28px 0 10px; }
.sch-edit { display: flex; gap: 8px; align-items: center; padding: 12px; }
.sch-edit > form:last-child { margin: 0; }
.sch-form { display: grid; grid-template-columns: 150px 150px 150px 1fr auto; gap: 8px; align-items: center; margin: 0; flex: 1; }
.sch-form.add { grid-template-columns: 150px 150px 150px 1fr auto; align-items: end; }
.sch-form.add label { font-size: .85rem; }

.avatar-card { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.avatar-card .avatar { width: 112px; height: 112px; }
.avatar-forms { flex: 1; min-width: 240px; display: grid; gap: 10px; }
.avatar-forms form { margin: 0; }
.avatar-forms p { margin: 0; }
.avatar-upload { display: flex; gap: 8px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; display: inline-flex; font-weight: 600; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.avatar-url summary { cursor: pointer; }
.avatar-url form { margin-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; }
.stat strong { font-size: 1.1rem; }
.stat.warn { border-color: #d9a400; background: color-mix(in srgb, #d9a400 12%, var(--surface)); }
.error-text { color: var(--danger); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .85em; overflow-wrap: anywhere; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.login h1 { margin: 0; }

@media (max-width: 640px) {
  .link-form, .link-form.add { grid-template-columns: 1fr; }
  .sch-form, .sch-form.add { grid-template-columns: 1fr 1fr; }
  .sch-form input[name=title], .sch-form label:nth-child(5) { grid-column: 1 / -1; }
  .sch-form select { grid-column: 1 / -1; }
  .sch-form.add label:nth-child(2) { grid-column: 1 / -1; }
  .sch-edit { flex-direction: column; align-items: stretch; }
  .table thead { display: none; }
  .table tr { display: grid; border-bottom: 1px solid var(--border); }
  .table td { border: 0; padding: 8px 14px; }
  .actions.end { justify-content: flex-start; padding-bottom: 6px; }
}
