:root {
    --bg: #0d1117;
    --bg-soft: #161b22;
    --bg-hover: #1f2630;
    --line: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --gold: #e3b341;
    --gold-dim: #9a761a;
    --play: #f0883e;
    --wait: #3fb950;
    --done: #8b949e;
    --danger: #f85149;
    --radius: 14px;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(1200px 500px at 10% -10%, #1b2430 0%, var(--bg) 45%);
    color: var(--text);
    min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--line);
    background: rgba(13, 17, 23, 0.9);
    position: sticky;
    top: 0;
    z-index: 5;
}

.brand {
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.brand-mark {
    background: var(--gold);
    color: #111;
    border-radius: 8px;
    padding: 0.15rem 0.4rem;
    font-size: 0.85rem;
}

.topbar nav { display: flex; gap: 1rem; }
.topbar nav a { color: var(--muted); font-weight: 600; }
.topbar nav a.is-active, .topbar nav a:hover { color: var(--text); text-decoration: none; }

.page { width: min(1180px, calc(100% - 2rem)); margin: 1.5rem auto 4rem; }

.hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.hero h1, .card h2 { margin: 0 0 0.4rem; }
.hero p, .muted, .form-help { color: var(--muted); }

.btn {
    border: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--text);
    border-radius: 999px;
    padding: 0.55rem 1rem;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary { background: var(--gold); color: #111; border-color: var(--gold); }
.btn-ghost { background: transparent; }
.btn:hover { filter: brightness(1.08); }

.flash { padding: 0.8rem 1rem; border-radius: var(--radius); }
.flash-success { background: #12261a; color: #3fb950; }
.flash-error { background: #2b1212; color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.stat {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    color: var(--text);
    text-decoration: none;
}
.stat:hover { text-decoration: none; background: var(--bg-hover); }
.stat.is-active { border-color: var(--gold); }
.stat-label { color: var(--muted); font-size: 0.85rem; display: block; }
.stat strong { font-size: 1.6rem; }
.stat-play strong { color: var(--play); }
.stat-wait strong { color: var(--wait); }

.filters { margin: 1rem 0; }
.filters select, .actions select, input[type="text"], textarea {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.7rem;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.topics { width: 100%; border-collapse: collapse; background: var(--bg-soft); }
.topics th, .topics td { padding: 0.85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.topics th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.topic-title { color: var(--text); font-weight: 650; }
.topic-title:hover { color: var(--gold); }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
}
.badge-to_play { background: #3a2313; color: var(--play); }
.badge-waiting { background: #12261a; color: var(--wait); }
.badge-finished { background: #222; color: var(--done); }
.badge-ignored { background: #222; color: var(--muted); }

.empty, .card {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.2rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.character-list { list-style: none; padding: 0; margin: 0; }
.character-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--line);
}

label { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; font-weight: 600; }

@media (max-width: 800px) {
    .stats, .grid-2 { grid-template-columns: 1fr 1fr; }
    .hero { flex-direction: column; }
}

@media (max-width: 560px) {
    .stats, .grid-2 { grid-template-columns: 1fr; }
}
