:root {
    color-scheme: dark;
    --bg: #080717;
    --surface: rgba(25, 21, 50, .82);
    --surface-strong: #17132d;
    --line: rgba(255, 255, 255, .1);
    --text: #fbf8f0;
    --muted: #aaa5bb;
    --coral: #ff6b52;
    --pink: #f45d9b;
    --violet: #8b5cf6;
    --blue: #64d8ff;
    --green: #69e5ae;
    --danger: #ff7080;
    font-family: Inter, ui-rounded, "SF Pro Rounded", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 85% -10%, rgba(26, 65, 185, .32), transparent 38rem),
        radial-gradient(circle at 4% 42%, rgba(104, 37, 186, .2), transparent 35rem),
        linear-gradient(155deg, #060613 0%, #0d0921 58%, #14091c 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { -webkit-tap-highlight-color: transparent; }

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.ambient::before,
.ambient::after {
    content: "";
    position: absolute;
    width: 32rem;
    height: 32rem;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .14;
}

.ambient::before { background: var(--violet); top: 20%; left: -18rem; }
.ambient::after { background: var(--coral); right: -22rem; bottom: -8rem; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 76px;
    padding: 12px clamp(18px, 4vw, 54px);
    border-bottom: 1px solid var(--line);
    background: rgba(7, 6, 18, .76);
    backdrop-filter: blur(22px);
}

.brand { display: flex; align-items: center; gap: 11px; font-weight: 850; letter-spacing: -.5px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(145deg, #252b35, #090b10);
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 10px 28px rgba(255, 107, 82, .12), inset 0 1px rgba(255, 255, 255, .08);
    font-size: 13px;
}
.brand-text { font-size: 21px; }
.brand-text span { color: #f45d9b; }

.nav { display: flex; align-items: center; gap: 6px; flex: 1; }
.nav a {
    padding: 10px 13px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}
.nav a:hover, .nav a.active { color: var(--text); background: rgba(255, 255, 255, .075); }
.account { display: flex; gap: 8px; align-items: center; }

.page { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 44px 0 72px; }
.page.narrow { width: min(680px, calc(100% - 36px)); }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; color: var(--coral); font-size: 12px; font-weight: 850; letter-spacing: 2px; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); line-height: 1.04; letter-spacing: -2px; }
h2, h3, p { margin-top: 0; }
.lede { max-width: 640px; margin: 12px 0 0; color: var(--muted); line-height: 1.7; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, .055);
    font-weight: 750;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .1); }
.button.primary { color: #110b1b; border-color: transparent; background: linear-gradient(110deg, #6edcff, #fff0d9 53%, #ff6b52); box-shadow: 0 12px 32px rgba(255, 107, 82, .16); }
.button.danger { color: #ff9da8; border-color: rgba(255, 112, 128, .22); }
.button.small { min-height: 34px; padding: 7px 11px; border-radius: 11px; font-size: 13px; }
.button.icon { width: 36px; min-height: 36px; padding: 0; }
.link-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 30px; }
.stat, .panel, .content-card {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .2);
    backdrop-filter: blur(20px);
}
.stat { min-height: 130px; padding: 21px; border-radius: 24px; }
.stat strong { display: block; margin-top: 16px; font-size: 34px; letter-spacing: -1.5px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.panel { padding: clamp(18px, 3vw, 30px); border-radius: 28px; }
.panel + .panel { margin-top: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 22px; }

.hierarchy { display: grid; gap: 14px; }
.category-block { padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.028); }
.category-block-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--accent, var(--coral)); box-shadow: 0 0 15px var(--accent, var(--coral)); }
.category-block-header strong { font-size: 18px; }
.category-block-header span { margin-left: auto; color: var(--muted); font-size: 12px; }
.deck-chips { display: flex; flex-wrap: wrap; gap: 9px; }
.deck-chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: 13px; background: rgba(255,255,255,.06); color: #ddd9e8; font-size: 13px; }
.deck-chip b { color: var(--muted); font-size: 11px; }

.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.toolbar .filter { flex: 1; min-width: 220px; }
.content-list { display: grid; gap: 12px; }
.content-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 20px; }
.content-card.inactive { opacity: .58; }
.content-main { min-width: 0; flex: 1; }
.content-main h3 { margin: 0 0 6px; font-size: 18px; }
.content-main p { margin: 0; color: var(--muted); line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.055); font-size: 11px; font-weight: 750; }
.badge.on { color: var(--green); background: rgba(105,229,174,.09); }
.badge.off { color: #ff9ca8; background: rgba(255,112,128,.09); }
.actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 7px; }
.art { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 17px; font-size: 28px; background: linear-gradient(135deg, var(--from, #291759), var(--to, #4d1f78)); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #d8d4e4; font-size: 13px; font-weight: 750; }
.field small { color: var(--muted); line-height: 1.5; }
input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    color: var(--text);
    background: rgba(4, 4, 14, .52);
}
input:focus, select:focus, textarea:focus { border-color: rgba(110, 220, 255, .55); box-shadow: 0 0 0 4px rgba(110, 220, 255, .08); }
input[type="color"] { padding: 6px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.check { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.check input { width: 20px; min-height: 20px; accent-color: var(--coral); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.error { color: #ff9da8; font-size: 12px; }

.notice { margin-bottom: 18px; padding: 13px 16px; border: 1px solid rgba(105,229,174,.2); border-radius: 15px; color: #aaf4d2; background: rgba(105,229,174,.08); }
.notice.error-list { border-color: rgba(255,112,128,.22); color: #ffc0c7; background: rgba(255,112,128,.08); }
.notice ul { margin: 0; padding-left: 20px; }

.login-shell { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-card { width: min(460px, 100%); padding: clamp(26px, 7vw, 44px); border: 1px solid var(--line); border-radius: 32px; background: rgba(17,14,37,.84); box-shadow: 0 34px 100px rgba(0,0,0,.38); backdrop-filter: blur(24px); }
.login-card .brand { margin-bottom: 40px; }
.login-card h1 { font-size: 38px; }
.login-card form { display: grid; gap: 17px; margin-top: 28px; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }
.question-number { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; color: #160d22; background: linear-gradient(135deg, #6edcff, #ff8068); font-weight: 900; }
.batch { margin-bottom: 22px; background: linear-gradient(135deg, rgba(100,216,255,.07), rgba(255,107,82,.06)); }
.batch textarea { min-height: 170px; }

@media (max-width: 820px) {
    .topbar { align-items: flex-start; flex-wrap: wrap; gap: 10px; padding: 11px 18px; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .nav a { white-space: nowrap; }
    .account { margin-left: auto; }
    .account .email { display: none; }
    .page { padding-top: 30px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .page-header { align-items: flex-start; flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
}

@media (max-width: 580px) {
    .content-card { align-items: flex-start; flex-wrap: wrap; }
    .content-main { width: calc(100% - 74px); }
    .actions { width: 100%; justify-content: flex-start; padding-left: 54px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { min-height: 104px; padding: 16px; }
    .stat strong { margin-top: 10px; font-size: 28px; }
    .panel { border-radius: 22px; }
}
