:root {
  --bg: #0e151d; --bg2: #131d28; --card: #17222e; --card2: #1d2a38; --line: #273647;
  --text: #e6edf3; --muted: #8d9bab; --gold: #f2b84b; --gold2: #ffd27a; --crystal: #6fd3ff;
  --ok: #3fb950; --warn: #e3b341; --danger: #f85149; --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5;
  background-image: radial-gradient(1200px 500px at 70% -10%, rgba(242, 184, 75, .10), transparent 60%), radial-gradient(900px 400px at 0% 0%, rgba(111, 211, 255, .06), transparent 60%);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--gold2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 2rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.center { text-align: center; padding-top: 60px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.ok { color: var(--ok); } .warn { color: var(--warn); }
.pre { white-space: pre-wrap; }

/* Kopfzeile */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(14, 21, 29, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--text); letter-spacing: .5px; }
.brand:hover { text-decoration: none; }
#nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
#nav a, #nav .linklike { color: var(--text); padding: 6px 12px; border-radius: 8px; font-size: .95rem; }
#nav a:hover, #nav .linklike:hover { background: var(--card); text-decoration: none; }
#nav .admin-link { color: var(--gold); }
.linklike { background: none; border: 0; cursor: pointer; font: inherit; }
.lang { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-weight: 700; margin-left: 6px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 24px 0; margin-top: 60px; }

/* Bausteine */
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 60px auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; transition: transform .08s, background .15s, border-color .15s; }
.btn:hover:not(:disabled) { border-color: #3a4d63; background: #223244; text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241800; border-color: transparent; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe0a0, var(--gold2)); }
.btn.danger { color: #ffb4ae; border-color: rgba(248, 81, 73, .4); }
.btn.danger:hover:not(:disabled) { background: rgba(248, 81, 73, .15); }
.btn.big { font-size: 1.1rem; padding: 14px 26px; border-radius: 14px; }
.btn.small { padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn.tiny { padding: 1px 7px; font-size: .8rem; border-radius: 6px; }
input, select, textarea { background: #0f1822; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(242, 184, 75, .5); outline-offset: 0; border-color: var(--gold); }
input[type=checkbox] { width: auto; accent-color: var(--gold); }
input.num { width: 90px; padding: 4px 6px; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
label > input, label > select, label > textarea, label > div { margin-top: 4px; color: var(--text); }
label:not(.check):not(.mini):not(.inline) > input.num { display: block; width: 100%; padding: 8px 10px; }
label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
label.mini { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: .75rem; }
label.mini input { margin: 0; padding: 3px 6px; }
.ltext { min-width: 160px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 20px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .35); color: #ffc1bb; padding: 10px 14px; border-radius: 10px; }
.badge { display: inline-block; background: rgba(242, 184, 75, .15); color: var(--gold2); border: 1px solid rgba(242, 184, 75, .35); border-radius: 99px; font-size: .72rem; padding: 1px 8px; margin-left: 8px; vertical-align: middle; font-weight: 700; }
.badge.danger { background: rgba(248, 81, 73, .15); color: #ffb4ae; border-color: rgba(248, 81, 73, .35); }
.tag { display: inline-block; font-size: .72rem; font-weight: 800; background: #24364a; color: var(--crystal); border-radius: 6px; padding: 0 6px; margin-left: 6px; letter-spacing: .5px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { background: #213044; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; font-size: .82rem; color: var(--text); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline.between { justify-content: space-between; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.toolbar input[type=search] { max-width: 360px; }
.scroll-x { overflow-x: auto; }

/* Hero */
.hero { padding: 48px 0 28px; }
.hero-inner { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 3rem; display: flex; align-items: center; gap: 14px; margin-bottom: .2em; letter-spacing: 1px; background: linear-gradient(180deg, #fff, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 1.25rem; color: #c8d3de; margin: 0 0 22px; }
.download { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.download .icon { font-size: 1.2rem; }
.hero-art { position: relative; }
.hero-art canvas { border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06); transform: perspective(1000px) rotateY(-8deg) rotateX(4deg); width: 100%; }
.changelog { margin-top: 10px; color: var(--muted); }
.changelog pre { white-space: pre-wrap; font-family: inherit; font-size: .9rem; background: var(--card); padding: 10px; border-radius: 10px; }
.map-preview { border-radius: 10px; display: block; margin: 8px 0; }

/* Spalten */
.columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.features { margin-top: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature .ficon { font-size: 2rem; margin-bottom: 8px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold2); border-bottom-color: var(--gold); }
.filters { display: flex; gap: 8px; margin-bottom: 10px; }
.filters:empty { display: none; }
.filters select { max-width: 320px; }

/* Bestenlisten */
table { border-collapse: collapse; width: 100%; }
.board td, .board th { padding: 8px 10px; border-bottom: 1px solid rgba(39, 54, 71, .6); text-align: left; }
.board th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.board tr.me td { background: rgba(242, 184, 75, .08); }
.board tr.gap td { text-align: center; color: var(--muted); padding: 2px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.rank { width: 48px; font-weight: 700; color: var(--muted); }
.medal { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #1a1200; font-weight: 800; font-size: .85rem; }
.medal.m1 { background: linear-gradient(180deg, #ffe08a, #e0a526); } .medal.m2 { background: linear-gradient(180deg, #eef2f6, #a9b4bf); } .medal.m3 { background: linear-gradient(180deg, #f2b98a, #b46a35); }
.player { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.avatar { border-radius: 50%; object-fit: cover; background: var(--card2); flex: none; }
.avatar.placeholder { display: inline-grid; place-items: center; background: linear-gradient(135deg, #2b405a, #1c2a3a); color: var(--gold2); font-weight: 800; }
.empty { padding: 20px 0; text-align: center; }

/* Tägliche */
.daily h3 { margin-top: 10px; }
.countdown { font-variant-numeric: tabular-nums; color: var(--gold2); font-weight: 700; }
.news { border-bottom: 1px solid var(--line); padding: 10px 0; }
.news:last-child { border-bottom: 0; }
.news h3 { margin: 0; }
.news p { margin: 6px 0 0; white-space: pre-wrap; color: #c8d3de; }
.news.pinned h3 { color: var(--gold2); }

/* Profil */
.profile-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.profile-head h1 { margin: 0 0 4px; }
.profile-head .bio { margin: 8px 0 0; max-width: 520px; white-space: pre-wrap; }
.global-score { margin-left: auto; text-align: right; }
.big-num { font-size: 2.2rem; font-weight: 800; color: var(--gold2); font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat-val { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-key { color: var(--muted); font-size: .8rem; }
.achievements { list-style: none; padding: 0; margin: 0; }
.achievements li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(39, 54, 71, .6); opacity: .5; }
.achievements li.done { opacity: 1; }
.ach-icon { font-size: 1.3rem; }

/* Toast, Modal, Drawer */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--card2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: slidein .25s ease-out; transition: opacity .4s, transform .4s; }
.toast.warn { border-left-color: var(--warn); } .toast.error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateX(30px); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }
.modal-bg, .drawer-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 50; display: grid; place-items: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); width: min(620px, 94vw); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: var(--shadow); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.errors li { color: #ffc1bb; margin-bottom: 4px; }
.drawer-bg { place-items: stretch end; }
.drawer { background: var(--card); border-left: 1px solid var(--line); width: min(560px, 100vw); height: 100vh; overflow: auto; padding: 24px; position: relative; animation: drawer .2s ease-out; }
@keyframes drawer { from { transform: translateX(40px); opacity: 0; } }
.drawer .close { position: absolute; top: 14px; right: 16px; background: none; border: 0; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.drawer-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.drawer-head h2 { margin: 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0 0 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 20px; }
.actions .inline input { width: 220px; }

/* Admin */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.admin-nav { background: var(--bg2); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 60px; height: calc(100vh - 60px); }
.admin-nav a { display: flex; gap: 10px; align-items: center; color: var(--text); padding: 9px 12px; border-radius: 9px; font-weight: 500; }
.admin-nav a:hover { background: var(--card); text-decoration: none; }
.admin-nav a.active { background: rgba(242, 184, 75, .12); color: var(--gold2); }
.admin-main { padding: 20px 28px; min-width: 0; }
.status-bar { position: sticky; top: 60px; z-index: 10; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: rgba(23, 34, 46, .95); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.kpi { padding: 14px; margin: 0; }
.kpi-val { font-size: 1.7rem; font-weight: 800; color: var(--gold2); }
.kpi-label { color: var(--muted); font-size: .85rem; }
.data td, .data th { padding: 6px 8px; border-bottom: 1px solid rgba(39, 54, 71, .6); text-align: left; vertical-align: middle; }
.data th { color: var(--muted); font-weight: 600; font-size: .78rem; white-space: nowrap; }
.data.compact td, .data.compact th { padding: 3px 4px; }
.data.compact input.num { width: 72px; }
.data.compact select { padding: 4px; min-width: 110px; }
.data tr.clickable { cursor: pointer; }
.data tr.clickable:hover td { background: rgba(255, 255, 255, .03); }
.stats-table th:first-child { position: sticky; left: 0; background: var(--card); }
.stats-table tr.cost td, .stats-table tr.cost th { background: rgba(242, 184, 75, .06); }
.bar { position: relative; background: var(--bg); border-radius: 6px; height: 18px; min-width: 120px; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; opacity: .6; }
.bar span { position: relative; padding-left: 6px; font-size: .78rem; font-weight: 700; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; align-items: end; }
.form-grid .full { grid-column: 1 / -1; }
textarea.json { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; min-height: 60vh; white-space: pre; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
code.details { color: var(--muted); word-break: break-all; }
.boss { margin-bottom: 12px; }

/* Level-Editor */
.editor { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
.editor-side { grid-column: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; align-items: start; }
.level-list { display: flex; flex-direction: column; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; max-height: calc(100vh - 180px); overflow: auto; position: sticky; top: 130px; }
.level-item { display: flex; gap: 8px; align-items: center; text-align: left; background: none; border: 0; color: var(--text); padding: 6px 8px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .9rem; }
.level-item:hover { background: var(--card); }
.level-item.active { background: rgba(242, 184, 75, .14); color: var(--gold2); }
.lid { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .78rem; min-width: 30px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; }
.editor-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.editor-tools select { width: auto; padding: 3px 6px; }
.editor-tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.legend { font-size: .8rem; }
.canvas-wrap { overflow: auto; border-radius: 10px; }
.editor-canvas { display: block; touch-action: none; border-radius: 10px; }
.editor-info { margin-top: 6px; }
.wave { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; background: var(--bg2); }
.wave-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.wave-head label { margin: 0; }
.wave-head input.num { width: 70px; }
.level-props label.chip { margin: 0; }

@media (max-width: 1300px) { .editor-side { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .hero-inner, .columns { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  .editor, .editor-side { grid-template-columns: 1fr; display: grid; }
  .editor-side { grid-column: 1; }
  .level-list { position: static; max-height: 240px; }
  .hero h1 { font-size: 2.3rem; }
}
@media (max-width: 560px) { .grid4 { grid-template-columns: 1fr; } .global-score { margin-left: 0; text-align: left; } }
main > .container:first-child { padding-top: 28px; }
