:root {
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --border: #2e2e4a;
    --text: #e8e8f5;
    --muted: #9898b8;
    --primary: #5b8def;
    --primary-dark: #3d6fd4;
    --accent: #50b86c;
    --gold: #f0c040;
    --danger: #e74c3c;
    --tk: #4a90d9;
    --fm: #9b59b6;
    --bm: #e67e22;
    --ht: #50b86c;
    --radius: 14px;
    --shadow: 0 8px 32px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: "Segoe UI", Ubuntu, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.site-header {
    background: linear-gradient(90deg, #3d5a9e, #50b86c);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15rem;
}

.brand-icon { font-size: 1.4rem; }

nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

nav a, .btn-link {
    color: rgba(255,255,255,.9);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .92rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

nav a:hover, .btn-link:hover { background: rgba(255,255,255,.15); }
nav a.active { background: rgba(255,255,255,.22); color: #fff; }

.inline-form { display: inline; }

main.container { padding: 28px 20px 48px; }

.hero { margin-bottom: 24px; }
.hero h1 { font-size: 2rem; font-weight: 800; }
.hero-small h1 { font-size: 1.6rem; }
.hero-sub { color: var(--muted); margin-top: 6px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-narrow { max-width: 420px; }
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: #fff; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
}

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

.rank-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.rank-table th {
    text-align: left;
    padding: 12px 10px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.rank-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); }
.rank-table tbody tr:hover { background: var(--bg-card-hover); }
.rank-num { font-weight: 800; color: var(--muted); width: 40px; }
.top-1 .rank-num { color: var(--gold); font-size: 1.1rem; }
.top-2 .rank-num { color: #c0c0c0; }
.top-3 .rank-num { color: #cd7f32; }
.top-1 { background: rgba(240,192,64,.06); }
.top-2 { background: rgba(192,192,192,.04); }
.top-3 { background: rgba(205,127,50,.04); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}
.class-0 { background: rgba(74,144,217,.2); color: var(--tk); }
.class-1 { background: rgba(155,89,182,.2); color: var(--fm); }
.class-2 { background: rgba(230,126,34,.2); color: var(--bm); }
.class-3 { background: rgba(80,184,108,.2); color: var(--ht); }

.form label { display: block; margin-bottom: 14px; }
.form label span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.form input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #12121f;
    color: var(--text);
    font-size: 1rem;
}
.form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,141,239,.25);
}

.btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: .95rem;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: #fff;
    width: 100%;
}
.btn-secondary {
    background: #2a2a48;
    color: #c8d8ff;
    border: 1px solid var(--border);
}

.alert {
    padding: 16px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.45;
}
.alert-success {
    background: rgba(80,184,108,.22);
    border: 2px solid var(--accent);
    color: #9eecc0;
}
.alert-error {
    background: rgba(231,76,60,.18);
    border: 2px solid var(--danger);
    color: #ffb4a8;
}

.btn:disabled {
    opacity: .65;
    cursor: wait;
}

.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; }
.info-list dt { color: var(--muted); font-size: .88rem; }
.info-list dd { font-weight: 600; }

.char-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.char-card {
    background: #12121f;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.char-card h3 { font-size: 1rem; margin: 8px 0 6px; }
.char-slot { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
.char-card ul { list-style: none; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.char-card li { margin: 4px 0; }
.char-card strong { color: var(--accent); }

.empty { color: var(--muted); text-align: center; padding: 24px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 12px; }
.hint.warn { color: #f0ad4e; }
.hint code { background: #12121f; padding: 2px 6px; border-radius: 4px; }
.field-hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 6px; line-height: 1.45; }
.field-hint strong { color: var(--text); }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
}
.site-footer code { color: var(--primary); }

.nav-user {
    color: rgba(255,255,255,.75);
    font-size: .82rem;
    padding: 0 8px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold);
}

.stat-label {
    font-size: .82rem;
    color: var(--muted);
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-links .btn { width: auto; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 16px;
}

.form textarea,
.code-area {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #12121f;
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .88rem;
    line-height: 1.45;
    resize: vertical;
}

.form textarea:focus,
.code-area:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,141,239,.25);
}

.checkbox-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.checkbox-row span {
    margin: 0 !important;
    color: var(--text) !important;
}

.recovery-code-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.recovery-code-list li code {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #12121f;
    font-size: 1rem;
    letter-spacing: .06em;
    text-align: center;
    user-select: all;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
    width: auto;
}

.btn-danger {
    background: rgba(231,76,60,.25);
    color: #ffb4a8;
    border: 1px solid var(--danger);
}

.badge-ok { background: rgba(80,184,108,.2); color: var(--accent); }
.badge-danger { background: rgba(231,76,60,.2); color: #f1948a; }

.panel-account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.inline-dl { margin-bottom: 16px; }

.password-details {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.password-details summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    font-size: .9rem;
}

.rank-table.compact td,
.rank-table.compact th { padding: 8px 6px; font-size: .82rem; }

a { color: var(--primary); }

/* Home / content pages */
.hero-home { text-align: center; padding: 12px 0 8px; }
.hero-home h1 { font-size: 2.4rem; background: linear-gradient(90deg, #7eb0ff, #6fd48a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-meta { color: var(--muted); margin: 10px 0 18px; font-size: .95rem; }
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}

.btn-inline { width: auto; text-decoration: none; text-align: center; }
.btn-primary.btn-inline { width: auto; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: border-color .2s, transform .2s;
}
.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}
.feature-card h3 { color: var(--primary); margin-bottom: 8px; font-size: 1.05rem; }
.feature-card p { color: var(--muted); font-size: .92rem; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 1.15rem; }

.page-header { margin-bottom: 22px; }
.page-header h1 { font-size: 1.9rem; font-weight: 800; }
.page-header p { color: var(--muted); margin-top: 6px; }

.content-layout {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 800px) {
    .content-layout { grid-template-columns: 1fr; }
    nav { flex-wrap: wrap; justify-content: flex-end; }
}

.content-main h2 { margin: 22px 0 10px; font-size: 1.15rem; color: #fff; }
.content-main h2:first-child { margin-top: 0; }
.content-main p { color: var(--muted); margin-bottom: 12px; }

.content-list { margin: 10px 0 16px 1.2rem; color: var(--muted); }
.content-list li { margin: 6px 0; }
.content-list.numbered { list-style: decimal; }
.content-list strong { color: var(--text); }

.content-side .info-box h3 { margin-bottom: 12px; font-size: 1rem; }
.content-side .info-box p { color: var(--muted); margin: 8px 0; font-size: .92rem; }
.content-side .info-box.highlight { border-color: rgba(240,192,64,.35); }

.cta-band {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    margin: 24px 0 8px;
    box-shadow: var(--shadow);
}
.cta-band h2 { margin-bottom: 8px; }
.cta-band p { color: var(--muted); margin-bottom: 16px; }

.class-card-head { margin-bottom: 16px; }
.class-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 700px) {
    .class-card-body { grid-template-columns: 1fr; }
}
.class-card h3 { font-size: .95rem; color: #fff; margin: 12px 0 8px; }

.stat-bars { display: flex; flex-direction: column; gap: 10px; }
.stat-bar-row { display: grid; grid-template-columns: 42px 1fr; gap: 10px; align-items: center; }
.stat-bar-label { font-size: .78rem; color: var(--muted); font-weight: 700; }
.stat-bar-track {
    height: 10px;
    background: #12121f;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 999px;
}

.evolution-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}
.evolution-stage {
    background: #12121f;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 22px;
    text-align: center;
    min-width: 120px;
}
.evolution-stage span { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.evolution-stage .evo-req { color: var(--accent); font-size: .75rem; font-weight: 600; }
.evolution-arrow { color: var(--gold); font-size: 1.4rem; font-weight: 700; }

.toc-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 12px;
}
.toc-list a { font-weight: 600; text-decoration: none; }
.toc-list a:hover { text-decoration: underline; }

.guide-article h2 { margin-bottom: 12px; }
.guide-article h3 { margin: 16px 0 8px; font-size: 1rem; color: #c8d8ff; }
.guide-article p { color: var(--muted); margin-bottom: 10px; }

.guide-tip {
    margin-top: 14px;
    padding: 12px 14px;
    background: rgba(91,141,239,.12);
    border: 1px solid rgba(91,141,239,.35);
    border-radius: 10px;
    color: #b8d0ff;
    font-size: .92rem;
}

.faq-item { margin: 16px 0; padding-top: 12px; border-top: 1px solid var(--border); }
.faq-item:first-of-type { border-top: none; padding-top: 0; }
.faq-item h3 { font-size: 1rem; margin-bottom: 6px; }

.rarity-list { list-style: none; margin: 10px 0 16px; }
.rarity-list li { margin: 8px 0; color: var(--muted); }
.rarity {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: .78rem;
    margin-right: 6px;
    color: #fff;
}
.rarity-common { background: #888; }
.rarity-uncommon { background: #2dd82d; color: #061206; }
.rarity-rare { background: #0a7cf0; }
.rarity-epic { background: #9d35ff; }
.rarity-legendary { background: #ffd700; color: #000; }

kbd {
    background: #12121f;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .85rem;
    color: var(--text);
}
