:root {
  --bg: #080808;
  --text: #f5f5f5;
  --panel: #151515;
  --muted: #a7a7a7;
  --line: #2b2b2b;
  --button: #ffffff;
  --danger: #ff4d4d;
  --success: #5dff9a;
  --font: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
a { color: var(--button); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.25); }
.brand { font-weight: 800; text-decoration: none; letter-spacing: .04em; }
nav { display: flex; gap: 14px; align-items: center; }
nav a { text-decoration: none; color: var(--text); opacity: .88; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px; }
.auth-card, .challenge-card, .game-shell, .loss-screen { max-width: 640px; margin: 40px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.game-shell { max-width: 760px; }
.loss-screen { text-align: center; border-color: var(--danger); }
.loss-screen h1 { color: var(--danger); font-size: clamp(2rem, 6vw, 4.5rem); line-height: .95; }
.level-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); margin-bottom: 20px; }
form { display: grid; gap: 16px; }
.inline { display: inline; }
.inline button { padding: 6px 10px; font-size: .9rem; }
label { display: grid; gap: 8px; color: var(--muted); }
label.check { display: flex; align-items: center; }
input, select, textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #050505; color: var(--text); font: inherit; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
button, .button { display: inline-block; width: fit-content; border: 0; border-radius: 999px; padding: 12px 18px; color: #050505; background: var(--button); text-decoration: none; font-weight: 800; cursor: pointer; }
.notice { padding: 12px 14px; border-radius: 10px; background: #252525; border: 1px solid var(--line); }
.notice.error { border-color: var(--danger); color: var(--danger); }
.notice.success { border-color: var(--success); color: var(--success); }
.small { color: var(--muted); font-size: .92rem; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.admin-nav a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stats div { background: var(--panel); border: 1px solid var(--line); padding: 22px; border-radius: 16px; }
.stats strong { display: block; font-size: 2.4rem; }
.stats span { color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .9rem; }
code { background: #050505; padding: 2px 5px; border-radius: 5px; }
hr { border: 0; border-top: 1px solid var(--line); width: 100%; }
.wide-form { max-width: 850px; }
@media (max-width: 700px) { .topbar { align-items: flex-start; flex-direction: column; gap: 12px; } table { display:block; overflow-x:auto; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin: 0 0 22px; }
.muted { color: var(--muted); }
.drop-zone { position: relative; display: grid; place-items: center; gap: 8px; min-height: 180px; border: 2px dashed var(--line); border-radius: 18px; background: rgba(255,255,255,.03); cursor: pointer; text-align: center; padding: 28px; }
.drop-zone strong { font-size: 1.35rem; }
.drop-zone span { color: var(--muted); }
.drop-zone.drag-over { border-color: var(--button); background: rgba(255,255,255,.08); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.warning-card { border-color: #6a5522; }
.checkbox-row { display: flex; align-items: center; gap: 10px; color: var(--text); }
.checkbox-row input[type="checkbox"] { width: auto; }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.small-button { padding: 7px 11px; font-size: .85rem; }
.panel-form { max-width: 760px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); padding: 16px; border-radius: 14px; }
.stat-card strong { display: block; color: var(--muted); font-size: .88rem; margin-bottom: 5px; }
.stat-card span { display: block; font-size: 1.4rem; font-weight: 800; }
.cards { margin: 4px 0; }
.level-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.level-prompt { margin: 14px 0 22px; line-height: 1.55; }
.level-form { max-width: 520px; }
.panel { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin: 8px 0; }
.panel h2 { margin-top: 0; }
.notice.warning { border-color: #f2c14e; color: #f2c14e; }
.notice.info { border-color: #8ab4ff; color: #cfe0ff; }
.pill { display: inline-block; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .82rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; color: var(--button); border: 0; padding: 0; border-radius: 0; font: inherit; text-decoration: underline; cursor: pointer; }
.link-button.danger { color: var(--danger); }
.test-frame { border: 1px solid var(--line); border-radius: 16px; padding: 20px; background: rgba(255,255,255,.025); margin-top: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.stat-link { display: block; background: var(--panel); border: 1px solid var(--line); padding: 22px; border-radius: 16px; text-decoration: none; color: var(--text); }
.stat-link:hover { border-color: var(--button); }
.stat-link small { display: block; margin-top: 6px; color: var(--muted); font-size: .82rem; }
.two-col { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.admin-dashboard-grid { margin: 22px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; }
.compact-table th, .compact-table td { padding: 8px 10px; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; margin: 18px 0 22px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.025); }
.filter-bar button, .filter-bar .button { margin-top: auto; }
.status { font-weight: 800; }
.status.good { color: var(--success); }
.status.bad { color: var(--danger); }
.severity-error { border-color: var(--danger); color: var(--danger); }
.severity-warning { border-color: #f2c14e; color: #f2c14e; }
.severity-info { border-color: #8ab4ff; color: #cfe0ff; }
.header-actions { margin: 10px 0 14px; }
.inline-check { display: flex; align-items: center; gap: 0.5rem; margin: 0.4rem 0 1rem; font-weight: 500; }
.inline-check input { width: auto; }
.hp-field { position: absolute !important; left: -99999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.brutal-card { text-align: center; }
.small-button.danger, button.danger { border-color: #ff7777; }

.destination-picker {
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 14px;
    padding: 1rem;
    margin: 1rem 0;
}
.destination-picker legend {
    font-weight: 800;
    padding: 0 .5rem;
}
.destination-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .75rem;
    margin-top: 1rem;
    max-height: 520px;
    overflow: auto;
    padding-right: .25rem;
}
.destination-card {
    display: block;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 14px;
    padding: .85rem;
    background: rgba(255,255,255,.045);
    cursor: pointer;
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.destination-card:hover {
    transform: translateY(-1px);
    border-color: rgba(255,255,255,.36);
    background: rgba(255,255,255,.075);
}
.destination-card input {
    float: right;
    width: auto;
    margin: .15rem 0 0 .5rem;
}
.destination-card:has(input:checked) {
    border-color: var(--button-color, #fff);
    background: rgba(255,255,255,.12);
    box-shadow: 0 0 0 1px rgba(255,255,255,.15) inset;
}
.destination-title {
    display: block;
    font-weight: 800;
    margin-bottom: .35rem;
}
.destination-description {
    display: block;
    font-size: .92rem;
    opacity: .82;
    line-height: 1.35;
}
.badge {
    display: inline-block;
    padding: .2rem .45rem;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    font-size: .78rem;
}
.badge.success {
    background: rgba(106, 255, 168, .16);
}
.button.small, button.small {
    padding: .35rem .55rem;
    font-size: .85rem;
}

.pagination {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}
.pagination-links {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.compact-list {
    columns: 2;
    column-gap: 2rem;
}
@media (max-width: 760px) {
    .compact-list { columns: 1; }
}

.bulk-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 1rem 0;
    padding: .75rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .75rem;
}
