:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --ink: #1c1e21;
    --muted: #6b7280;
    --line: #e3e5e9;
    --accent: #2563eb;
    --accent-ink: #ffffff;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --card: #1f2227;
        --ink: #e8eaed;
        --muted: #9aa0a6;
        --line: #31353b;
        --accent: #4f86f7;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; max-width: 900px; margin: 0 auto; }
nav a { color: var(--ink); text-decoration: none; padding: 7px 12px; border-radius: 8px; }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--accent); color: var(--accent-ink); }
nav .spacer { flex: 1; }

main { max-width: 900px; margin: 0 auto; padding: 20px 16px 60px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=url], textarea, select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
}
textarea { min-height: 150px; resize: vertical; }

.editor {
    min-height: 150px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    overflow-y: auto;
}
.editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.toolbar { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.toolbar button {
    padding: 5px 11px; font-size: 13px; background: var(--card);
    border: 1px solid var(--line); border-radius: 6px; cursor: pointer; color: var(--ink);
}
.toolbar button:hover { background: var(--bg); }

.btn {
    display: inline-block; padding: 9px 16px; border-radius: 8px;
    background: var(--accent); color: var(--accent-ink);
    border: none; cursor: pointer; font: inherit; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }

.item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 0; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: none; }
.item .grow { flex: 1; min-width: 0; }
.item .name { font-weight: 600; }
.item .meta { color: var(--muted); font-size: 12px; }
.item a.name { color: var(--ink); text-decoration: none; }
.item a.name:hover { color: var(--accent); }

.tag { font-size: 11px; padding: 2px 7px; border-radius: 20px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.tag.off { color: var(--danger); border-color: var(--danger); }
.tag.on { color: var(--ok); border-color: var(--ok); }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { width: 130px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.thumb img, .thumb video { width: 100%; height: 95px; object-fit: cover; display: block; }
.thumb .bar { display: flex; gap: 2px; padding: 4px; justify-content: center; }
.thumb .bar button { flex: 1; padding: 3px; font-size: 12px; cursor: pointer; background: var(--card); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }
.thumb .placeholder { height: 95px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }

.stat { display: flex; gap: 22px; flex-wrap: wrap; }
.stat div { min-width: 110px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .cap { color: var(--muted); font-size: 12px; }

.notice { padding: 11px 14px; border-radius: 8px; background: #fef3c7; color: #78350f; margin-bottom: 14px; font-size: 14px; }
.error { padding: 11px 14px; border-radius: 8px; background: #fee2e2; color: #7f1d1d; margin-bottom: 14px; }

.login-wrap { max-width: 340px; margin: 14vh auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 12px 0 0; }
.check input { width: auto; }
.indent { display: inline-block; }
