:root {
    color-scheme: dark;
    --bg: #101210;
    --surface: #171a17;
    --surface-soft: #1c201c;
    --line: #2a302a;
    --line-bright: #3b453b;
    --text: #e7e9df;
    --muted: #9a9f93;
    --dim: #6f776c;
    --accent: #c4a86a;
    --accent-bright: #e1c98d;
    --danger: #d37b68;
    --success: #9bbd89;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 50% -18%, rgba(143, 125, 77, .12), transparent 45%),
        linear-gradient(180deg, #121512 0%, var(--bg) 45%);
}
button, input, select { font: inherit; }
.shell { width: min(1024px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--accent); color: var(--accent-bright); font: 600 22px Georgia, serif; }
.brand strong, .brand small { display: block; letter-spacing: .15em; }
.brand strong { font-size: 12px; }
.brand small { margin-top: 4px; color: var(--dim); font: 9px Consolas, monospace; }
.status, .account-chip { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 11px Consolas, monospace; letter-spacing: .04em; }
.status i, .online-state i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(196,168,106,.55); }
.account-chip { padding: 9px 12px; border: 1px solid var(--line); }
.account-chip strong { color: var(--accent-bright); font-size: 13px; }
.hero { padding: 72px 0 40px; text-align: center; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font: 10px Consolas, monospace; letter-spacing: .17em; }
h1, h2, p { margin-top: 0; }
.hero h1, .dashboard-heading h1 { margin: 0; font: 500 clamp(38px, 6vw, 58px)/1.08 Georgia, serif; letter-spacing: -.035em; }
.hero h1 em { color: var(--accent-bright); font-weight: 500; }
.intro { max-width: 510px; margin: 18px auto 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.hero-rule { margin: 29px auto 0; display: flex; width: min(360px, 90%); align-items: center; gap: 14px; color: var(--dim); }
.hero-rule span { flex: 1; height: 1px; background: var(--line); }
.hero-rule small { white-space: nowrap; font: 9px Consolas, monospace; letter-spacing: .13em; }
.auth-grid, .lower-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { padding: 27px 28px; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(27,31,27,.98), rgba(21,24,21,.98)); }
.panel-muted { background: linear-gradient(145deg, rgba(24,27,24,.98), rgba(19,22,19,.98)); }
.panel-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 23px; }
.step { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-bright); color: var(--accent); font: 11px Consolas, monospace; }
.panel-heading .eyebrow { margin: 1px 0 4px; font-size: 9px; }
h2 { margin: 0; font: 500 22px Georgia, serif; }
.form-stack { display: flex; flex-direction: column; gap: 15px; }
label { display: flex; flex-direction: column; gap: 7px; color: #c5c9bd; font-size: 11px; font-weight: 600; letter-spacing: .025em; }
input, select { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #333b33; border-radius: 0; outline: 0; background: #111411; color: var(--text); font-size: 13px; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(196,168,106,.1); }
input::placeholder { color: #60685d; }
select { appearance: auto; }
.field-note { margin: -4px 0 0; color: var(--dim); font-size: 11px; line-height: 1.55; }
.button { min-height: 43px; display: flex; justify-content: space-between; align-items: center; padding: 0 14px; border: 1px solid transparent; cursor: pointer; font-size: 12px; font-weight: 600; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.button span { font-size: 17px; font-weight: 400; }
.button-primary { margin-top: 3px; background: var(--accent); color: #171711; }
.button-primary:hover { background: var(--accent-bright); }
.button-outline { margin-top: 3px; border-color: #55503f; background: transparent; color: var(--accent-bright); }
.button-outline:hover { border-color: var(--accent); background: rgba(196,168,106,.06); }
.button-quiet { min-height: 36px; border-color: var(--line-bright); background: transparent; color: var(--muted); }
.button-quiet:hover { border-color: var(--accent); color: var(--text); }
.notice { margin: 18px 0 0; padding: 12px 15px; border: 1px solid var(--line-bright); font-size: 12px; line-height: 1.5; }
.notice-success { border-color: rgba(155,189,137,.35); background: rgba(155,189,137,.07); color: #c1d9b3; }
.notice-error { border-color: rgba(211,123,104,.4); background: rgba(211,123,104,.07); color: #e5aa9b; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 52px 0 28px; }
.dashboard-heading h1 { font-size: clamp(34px, 5vw, 46px); }
.dashboard-heading .intro { max-width: unset; margin: 10px 0 0; font-size: 13px; }
.dashboard-heading .intro strong { color: var(--accent-bright); font-family: Consolas, monospace; font-weight: 400; }
.character-panel { padding: 24px 28px 10px; }
.management-note { margin: 13px 0 0; color: var(--dim); font-size: 10px; line-height: 1.5; }
.ranking-panel { margin: 0 0 16px; padding: 24px 28px 14px; }
.ranking-heading { margin-bottom: 15px; }
.ranking-limit { padding: 5px 8px; border: 1px solid #554b36; color: var(--accent-bright); font: 9px Consolas, monospace; letter-spacing: .12em; }
.ranking-filters { display: grid; grid-template-columns: minmax(190px, 1fr) auto auto; gap: 18px; align-items: end; padding: 1px 0 17px; border-bottom: 1px solid var(--line); }
.ranking-filters select { height: 38px; }
.recent-toggle { min-height: 38px; display: inline-flex; flex-direction: row; align-items: center; gap: 9px; color: var(--muted); cursor: pointer; font-size: 11px; }
.switch-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
.switch-track { width: 34px; height: 19px; flex: 0 0 34px; display: inline-flex; align-items: center; padding: 2px; border: 1px solid #4b544a; border-radius: 12px; background: #111411; transition: background .15s ease, border-color .15s ease; }
.switch-track > span { width: 13px; height: 13px; border-radius: 50%; background: #7c8479; transition: transform .15s ease, background .15s ease; }
.switch-input:checked + .switch-track, .gender-switch[aria-checked="true"] .switch-track { border-color: #8c774a; background: rgba(196,168,106,.22); }
.switch-input:checked + .switch-track > span, .gender-switch[aria-checked="true"] .switch-track > span { transform: translateX(15px); background: var(--accent-bright); }
.button-filter { min-height: 38px; border-color: #55503f; background: transparent; color: var(--accent-bright); }
.button-filter:hover, .button-small:hover { border-color: var(--accent); background: rgba(196,168,106,.06); }
.ranking-table-wrap { overflow-x: auto; }
.ranking-table { width: 100%; border-collapse: collapse; text-align: left; }
.ranking-table th, .ranking-table td { padding: 12px 10px; border-bottom: 1px solid #252a25; }
.ranking-table thead th { color: var(--dim); font: 9px Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.ranking-table tbody tr:last-child th, .ranking-table tbody tr:last-child td { border-bottom: 0; }
.ranking-table tbody tr:hover { background: rgba(255,255,255,.015); }
.rank-position { width: 54px; color: var(--muted); font: 12px Consolas, monospace; }
.rank-position.rank-top { color: var(--accent-bright); }
.rank-name { color: var(--text); font: 500 15px Georgia, serif; }
.rank-vocation { color: var(--muted); font-size: 12px; }
.level-heading, .rank-level { width: 80px; text-align: right !important; }
.rank-level { color: var(--accent-bright); font: 13px Consolas, monospace; }
.ranking-empty { padding: 20px 10px 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-heading .eyebrow { margin-bottom: 5px; font-size: 9px; }
.section-heading h2 { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.count { min-width: 23px; height: 21px; display: grid; place-items: center; border: 1px solid var(--line-bright); color: var(--muted); font: 10px Consolas, monospace; }
.empty-state { padding: 35px 10px; text-align: center; }
.empty-icon { color: var(--accent); font-size: 22px; }
.empty-state p { margin: 10px 0 4px; font: 16px Georgia, serif; }
.empty-state small { color: var(--dim); font-size: 11px; }
.character-row { min-height: 75px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "avatar main state" "tools tools tools"; align-items: center; gap: 8px 14px; padding: 12px 0; border-bottom: 1px solid #252a25; }
.character-row:last-child { border-bottom: 0; }
.character-avatar { grid-area: avatar; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #65573a; color: var(--accent-bright); background: rgba(196,168,106,.07); font: 17px Consolas, monospace; }
.avatar-female { border-color: #70504e; color: #d79c98; background: rgba(190,112,107,.07); }
.character-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.character-main strong { overflow: hidden; color: var(--text); font: 500 16px Georgia, serif; text-overflow: ellipsis; white-space: nowrap; }
.character-main span { overflow: hidden; color: var(--dim); font: 10px Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.online-state { display: flex; align-items: center; gap: 7px; color: var(--dim); font: 10px Consolas, monospace; }
.character-row > .online-state { grid-area: state; }
.online-state i { width: 5px; height: 5px; background: #687164; box-shadow: none; }
.online-state.is-online { color: var(--success); }
.online-state.is-online i { background: var(--success); box-shadow: 0 0 8px rgba(155,189,137,.5); }
.character-tools { grid-area: tools; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 17px; padding-left: 50px; }
.character-tools form { margin: 0; }
.gender-switch { display: inline-flex; align-items: center; gap: 7px; padding: 3px 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: 10px Consolas, monospace; }
.gender-switch .switch-track { width: 30px; height: 17px; flex-basis: 30px; }
.gender-switch .switch-track > span { width: 11px; height: 11px; }
.gender-switch[aria-checked="true"] .switch-track > span { transform: translateX(13px); }
.gender-switch:disabled { opacity: .45; cursor: not-allowed; }
.rename-details { position: relative; color: var(--muted); font: 10px Consolas, monospace; }
.rename-details summary { cursor: pointer; list-style: none; }
.rename-details summary::-webkit-details-marker { display: none; }
.rename-details summary::before { content: "✎ "; color: var(--accent); }
.rename-details[open] { z-index: 1; }
.rename-form { display: flex; align-items: end; gap: 7px; margin-top: 8px !important; padding: 10px; border: 1px solid var(--line-bright); background: var(--surface); }
.rename-form input { width: 190px; height: 34px; font-size: 11px; }
.button-small { min-height: 34px; padding: 0 9px; border-color: #55503f; background: transparent; color: var(--accent-bright); font-size: 10px; }
.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; }
.icon-button { width: 30px; height: 30px; border: 1px solid transparent; background: transparent; color: var(--dim); cursor: pointer; font-size: 22px; line-height: 1; }
.icon-button:hover { border-color: rgba(211,123,104,.4); color: var(--danger); }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }
.lower-grid { margin-top: 16px; }
.lower-grid .panel { padding: 23px 25px; }
.lower-grid .panel-heading { margin-bottom: 18px; }
.lower-grid .panel-heading h2 { font-size: 20px; }
.lower-grid .form-stack { gap: 12px; }
footer { display: flex; justify-content: space-between; padding: 28px 0 35px; color: var(--dim); font: 9px Consolas, monospace; letter-spacing: .1em; }

@media (max-width: 680px) {
    .shell { width: min(100% - 28px, 540px); }
    .topbar { height: 72px; }
    .hero { padding: 52px 0 28px; }
    .hero .intro { font-size: 13px; }
    .auth-grid, .lower-grid { grid-template-columns: 1fr; }
    .panel { padding: 23px 20px; }
    .ranking-panel { padding: 20px 17px 12px; }
    .ranking-filters { grid-template-columns: 1fr; gap: 12px; }
    .ranking-filters select { height: 40px; }
    .recent-toggle { min-height: 28px; }
    .button-filter { justify-content: center; }
    .dashboard-heading { align-items: flex-start; flex-direction: column; padding: 38px 0 22px; }
    .character-panel { padding: 20px 17px 8px; }
    .character-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px 9px; }
    .character-tools { gap: 8px 12px; padding-left: 0; }
    .rename-form input { width: min(190px, 42vw); }
    .online-state { gap: 5px; font-size: 9px; }
    .character-main span { font-size: 9px; }
    footer { gap: 12px; font-size: 8px; }
}
