/* Admin console — layered on top of style.css */
body.admin { overflow: auto; padding: 16px; }
.admin-login { max-width: 420px; margin: 10vh auto; }
.admin-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; max-width: 1300px; margin: 0 auto 12px; }
.admin-head h1 { margin: 0; font-size: 24px; }
.admin-head .tabs { border: none; margin: 0; }
.admin main, #console .tab-panel { max-width: 1300px; margin: 0 auto; }
#console .card { margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 26px; color: var(--accent); }
.stat span { color: var(--muted); font-size: 13px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
textarea { background: #10101f; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: var(--mono); width: 100%; }
#bounds-table input[type=number] { width: 90px; }
#bounds-table td { vertical-align: middle; }
#bounds-table .schema { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.preset-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; display: grid; gap: 6px; }
.preset-edit .row input { flex: 1; }
.actions { display: flex; gap: 4px; flex-wrap: wrap; }
code { font-family: var(--mono); color: var(--accent); }

/* ---------------------------------------------------------------- level editor */
body.editor { padding: 0; overflow: hidden; height: 100vh; }
#editor { display: flex; flex-direction: column; height: 100vh; max-width: none; }
#editor.hidden { display: none; }
.ed-head, .ed-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ed-head h1 { margin: 0; font-size: 18px; }
.ed-head input, .ed-bar input, .ed-bar select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; }
.ed-bar label { font-size: 12px; color: var(--muted); display: flex; flex-direction: row; gap: 4px; align-items: center; margin: 0; }
.ed-bar .sep { width: 1px; height: 22px; background: var(--line); }
.ed-body { flex: 1; display: grid; grid-template-columns: 150px 1fr 280px; min-height: 0; }
.ed-tools { overflow-y: auto; padding: 6px; border-right: 1px solid var(--line); display: grid; gap: 4px; align-content: start; }
.ed-tool { display: flex; gap: 6px; align-items: center; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; cursor: pointer; text-align: left; }
.ed-tool span { font-size: 18px; width: 22px; text-align: center; }
.ed-tool small { font-size: 11px; line-height: 1.2; }
.ed-tool.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ed-canvas-wrap { position: relative; min-width: 0; min-height: 0; }
#ed-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; outline: none; }
.ed-hint { position: absolute; left: 8px; bottom: 6px; font-size: 11px; color: var(--muted); background: rgba(0,0,0,0.5); padding: 2px 6px; border-radius: 6px; pointer-events: none; }
.ed-side { overflow-y: auto; padding: 8px; border-left: 1px solid var(--line); }
.ed-side .card { margin-bottom: 8px; padding: 10px; }
.ed-side h3 { margin: 0 0 6px; font-size: 14px; }
.ed-side .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.ed-side label { font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.ed-side input, .ed-side select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; width: 100%; }
.ed-errors { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: #ff8a8a; max-height: 260px; overflow-y: auto; }
.ed-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12px; }
.ed-counts .bad { color: #ff8a8a; }

/* ---------------------------------------------------------------- admin: players / levels */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; border: 1px solid var(--line); }
.chip.bad { color: #ff8a8a; border-color: #ff8a8a; }
.chip.warn { color: #ffd27f; border-color: #ffd27f; }
.chat-log { max-height: 220px; overflow-y: auto; font-size: 13px; background: #10101f; border-radius: 8px; padding: 6px 10px; }
.map-thumb { width: 160px; height: 70px; background: #0b0a14; border-radius: 6px; display: block; }

/* ---------------------------------------------------------------- admin: content / textures */
.content-table input, .content-table select, #pack-editor input, #pack-editor select, #skin-levels select, #skin-active, #pack-pick { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 5px; }
.content-table input.w-id { width: 90px; font-family: var(--mono); }
.content-table input.w-name { width: 130px; }
.content-table input.w-icon { width: 46px; text-align: center; }
.content-table input.w-blurb { width: 220px; }
.content-table input.w-num { width: 70px; }
.content-table tr.off { opacity: 0.45; }
.content-table td { vertical-align: middle; }
.look { width: 34px; height: 34px; display: grid; place-items: center; font-size: 22px; background: #10101f; border-radius: 6px; }
.look img { max-width: 32px; max-height: 32px; object-fit: contain; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.media-card { background: #10101f; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; gap: 4px; font-size: 11px; }
.media-card img { width: 100%; height: 90px; object-fit: contain; background: repeating-conic-gradient(#222 0 25%, #2c2c2c 0 50%) 0 0 / 16px 16px; border-radius: 4px; }
.media-card .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-meta { display: grid; grid-template-columns: 140px 1fr 2fr; gap: 8px; margin-bottom: 10px; }
.slot-table td { vertical-align: middle; }
.slot-table .slot-kind { width: 130px; font-family: var(--mono); }
.slot-table .w-num { width: 64px; }
.slot-prev { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; background: #10101f; }
.slot-quick { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
@media (max-width: 800px) { .pack-meta { grid-template-columns: 1fr; } .two-col { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- admin: modes & features */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.toggle { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; background: #10101f; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .switch { flex: none; width: 38px; height: 22px; border-radius: 11px; background: #3a3550; position: relative; transition: background 0.15s; margin-top: 1px; }
.toggle .switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cfcfe0; transition: transform 0.15s; }
.toggle input:checked + .switch { background: #2ecc71; }
.toggle input:checked + .switch::after { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle:has(input:not(:checked)) .tlabel { color: var(--muted); }
.toggle .tlabel { display: grid; gap: 2px; font-size: 14px; }
.toggle .tlabel small { color: var(--muted); font-size: 11px; line-height: 1.3; }
#console label.toggle { flex-direction: row; align-items: center; margin: 0; }
