:root {
    --bg: #070b09;
    --panel: #0e1512;
    --panel2: #131c18;
    --line: rgba(255, 255, 255, 0.08);
    --text: #eaf3ee;
    --muted: #8a9b92;
    --a1: #7dffbd;
    --a2: #2fd68a;
    --neg: #ff4b4b;
    --warn: #ffc857;
    --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    background: radial-gradient(900px 500px at 15% -10%, rgba(47, 214, 138, 0.14), transparent 60%), var(--bg);
    color: var(--text);
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Zugang */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-card {
    width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
    padding: 32px 28px; text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.gate-card img { width: 150px; margin-bottom: 8px; }
.gate-card h1 { margin: 6px 0 4px; font-size: 24px; }
.gate-card p { margin: 0 0 20px; color: var(--muted); }
.code-input {
    width: 100%; text-align: center; letter-spacing: 0.14em; font-size: 22px; font-weight: 700; text-transform: uppercase;
    background: #0a100d; border: 1px solid var(--line); border-radius: 12px; padding: 14px; outline: none;
}
.code-input:focus { border-color: var(--a2); box-shadow: 0 0 0 3px rgba(47, 214, 138, 0.18); }
.err { color: var(--neg); min-height: 20px; margin: 10px 0 0; font-size: 13px; }

.btn {
    border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 9px 14px; font-weight: 600;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: rgba(125, 255, 189, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--a1), var(--a2)); color: #04130c; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.06); border-color: transparent; }
.btn-danger { color: var(--neg); }
.btn-sm { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.gate-card .btn { width: 100%; margin-top: 14px; padding: 12px; }

/* Layout */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line);
    background: rgba(14, 21, 18, 0.9); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.topbar img { height: 34px; }
.topbar .t { font-weight: 700; }
.topbar .meta { color: var(--muted); font-size: 12.5px; }
.topbar .sp { flex: 1; }
.chip { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(125, 255, 189, 0.12); color: var(--a1); }
.chip.warn { background: rgba(255, 200, 87, 0.14); color: var(--warn); }
.chip.bad { background: rgba(255, 75, 75, 0.14); color: var(--neg); }
.chip.muted { background: rgba(255, 255, 255, 0.07); color: var(--muted); }

.layout { flex: 1; display: grid; grid-template-columns: 270px minmax(0, 1fr) 310px; gap: 14px; padding: 14px 18px 18px; align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card + .card { margin-top: 12px; }
.card h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.f input[type=text], label.f input[type=number], label.f select, label.f textarea {
    width: 100%; background: #0a100d; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: var(--text); outline: none;
}
label.f input:focus, label.f select:focus, label.f textarea:focus { border-color: var(--a2); }
label.f input[type=color] { width: 100%; height: 34px; padding: 2px; background: #0a100d; border: 1px solid var(--line); border-radius: 8px; }
label.f input[type=range] { width: 100%; accent-color: var(--a2); }
.check { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 13px; }
.check input { accent-color: var(--a2); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: transparent; font-weight: 600; }
.tab.on { background: linear-gradient(135deg, var(--a1), var(--a2)); color: #04130c; border-color: transparent; }

.stage-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stage {
    position: relative; width: 100%; max-width: min(100%, 78vh); margin: 0 auto; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
    background: conic-gradient(#1a2420 25%, #121a17 0 50%, #1a2420 0 75%, #121a17 0) 0 0 / 24px 24px;
    touch-action: none;
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage .ov { cursor: default; }
.stagebar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.stagebar .sp { flex: 1; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

.layers { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.lyr {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--panel2); cursor: pointer;
}
.lyr.on { border-color: var(--a2); background: rgba(47, 214, 138, 0.1); }
.lyr .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lyr .ic { color: var(--a1); width: 18px; text-align: center; }
.lyr button { border: 0; background: transparent; color: var(--muted); padding: 2px 5px; border-radius: 6px; }
.lyr button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }

.mine { display: grid; gap: 8px; }
.mine .it { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.mine img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #0a100d; border: 1px solid var(--line); }
.mine .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine .why { color: var(--neg); font-size: 12px; margin-top: 2px; }
.mine .why.ok { color: var(--warn); }

.submit { display: grid; gap: 8px; }
.empty { color: var(--muted); font-size: 13px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--a2); border-radius: 10px; padding: 10px 14px; max-width: 340px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.toast.bad { border-left-color: var(--neg); }

@media (max-width: 1100px) {
    .layout { grid-template-columns: 1fr; }
    .stage { max-width: 100%; }
}
