:root {
    --bg: #05080d;
    --panel: #0d151f;
    --panel-2: #111c29;
    --line: rgba(100, 220, 255, 0.18);
    --cyan: #64dcff;
    --cyan-light: #a1efff;
    --text: #f7fbff;
    --muted: #93a6b9;
    --danger: #ff6b78;
    --success: #52e6a2;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
    min-height: 100vh;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; }

.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 12%, rgba(100, 220, 255, 0.11), transparent 30%),
        radial-gradient(circle at 85% 75%, rgba(42, 159, 191, 0.08), transparent 35%),
        linear-gradient(180deg, #05080d, #080e16);
}
.ambient::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(100,220,255,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100,220,255,.05) 1px, transparent 1px);
    background-size: 70px 70px;
    mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.topbar {
    height: 72px;
    padding: 0 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    background: rgba(5, 8, 13, .82);
    backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 700;
}
.brand strong, .brand small { color: var(--cyan); }
.brand small { margin-left: .35rem; font-size: .68rem; letter-spacing: .12em; }
.brand-mark {
    width: 36px;
    height: 36px;
    border: 2px solid var(--cyan);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--cyan);
    font-size: .7rem;
    box-shadow: 0 0 20px rgba(100,220,255,.28);
}
.topbar nav { display: flex; gap: 1.5rem; color: var(--muted); font-size: .88rem; }
.topbar nav a:hover, .topbar nav .active { color: var(--cyan); }
.logout-form { margin: 0; }

main {
    width: min(1180px, 90vw);
    min-height: calc(100vh - 142px);
    margin: 0 auto;
    padding: 3rem 0 4rem;
}

.button {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: .72rem 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary {
    color: #041018;
    background: linear-gradient(90deg, #42c8f2, var(--cyan));
    box-shadow: 0 0 25px rgba(100,220,255,.25);
}
.button-primary:hover { box-shadow: 0 0 32px rgba(100,220,255,.4); }
.button-ghost { background: rgba(255,255,255,.03); border-color: rgba(255,255,255,.16); }
.button-ghost:hover { color: var(--cyan); border-color: rgba(100,220,255,.42); }
.button-full { width: 100%; margin-top: 1.3rem; }

.eyebrow {
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .7rem;
    font-weight: 800;
}
.muted { color: var(--muted); }

.flash {
    margin: 0 auto 1.2rem;
    padding: .85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(100,220,255,.06);
}
.flash-error { color: #ffd6da; border-color: rgba(255,107,120,.35); background: rgba(255,107,120,.08); }
.flash-success { color: #d4ffea; border-color: rgba(82,230,162,.35); background: rgba(82,230,162,.08); }

.login-shell {
    min-height: 680px;
    display: grid;
    grid-template-columns: 1.1fr .8fr;
    gap: clamp(2rem, 7vw, 7rem);
    align-items: center;
}
.login-copy h1, .dashboard-head h1 {
    margin-top: .55rem;
    font-size: clamp(2.5rem, 6vw, 4.8rem);
    line-height: 1.02;
    letter-spacing: -.045em;
}
.login-copy h1 em, .dashboard-head h1 em { color: var(--cyan); font-style: normal; }
.login-copy > p:not(.eyebrow) { max-width: 36rem; margin-top: 1.2rem; color: var(--muted); font-size: 1.03rem; }
.login-copy ul { margin-top: 1.8rem; display: grid; gap: .65rem; list-style: none; color: #dce7f0; }
.login-copy li::before { content: "✓"; color: var(--cyan); margin-right: .65rem; }

.login-card {
    padding: clamp(1.5rem, 4vw, 2.2rem);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(17,28,41,.96), rgba(10,17,26,.96));
    box-shadow: 0 24px 70px rgba(0,0,0,.45), 0 0 45px rgba(100,220,255,.05);
}
.login-card h2 { margin-top: .4rem; font-size: 1.8rem; }
.login-card > .muted { margin: .4rem 0 1.3rem; font-size: .88rem; }
.login-card label { display: block; margin: 1rem 0 .4rem; font-size: .78rem; color: #c8d5df; font-weight: 600; }
.login-card input, .character-picker select {
    width: 100%;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    padding: .85rem 1rem;
    color: var(--text);
    background: rgba(0,0,0,.28);
    outline: none;
}
.login-card input:focus, .character-picker select:focus {
    border-color: rgba(100,220,255,.65);
    box-shadow: 0 0 0 3px rgba(100,220,255,.1);
}
.password-field { position: relative; }
.password-field input { padding-right: 4rem; }
.password-field button {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    padding: .35rem .55rem;
    background: transparent;
    color: var(--cyan);
    cursor: pointer;
    font-size: .76rem;
    font-weight: 700;
}
.privacy { margin-top: 1rem; text-align: center; color: #718397; font-size: .72rem; }

.dashboard { padding-top: 1rem; }
.dashboard-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.dashboard-head h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
.dashboard-head .muted { margin-top: .45rem; }
.character-picker { min-width: 220px; }
.character-picker label { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .72rem; }
.picker-submit { width: 100%; margin-top: .45rem; padding: .5rem .8rem; font-size: .76rem; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: .75rem;
}
.stat-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    background: rgba(13,21,31,.85);
}
.stat-card span, .stat-card small { display: block; color: var(--muted); font-size: .7rem; }
.stat-card strong {
    display: block;
    margin: .3rem 0;
    color: var(--cyan-light);
    font-size: clamp(1rem, 2vw, 1.35rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.panel {
    padding: 1.25rem;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(17,28,41,.9), rgba(10,17,26,.9));
}
.panel-wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.panel-head h2 { margin-top: .15rem; font-size: 1.25rem; }
.count {
    min-width: 32px;
    height: 32px;
    padding: 0 .5rem;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--cyan);
    background: rgba(100,220,255,.1);
    font-size: .78rem;
    font-weight: 800;
}
.item-list, .compact-list { display: grid; gap: .6rem; }
.item-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .8rem;
    align-items: center;
    padding: .85rem;
    border-radius: 11px;
    background: rgba(0,0,0,.23);
}
.item-icon {
    width: 38px; height: 38px; border-radius: 10px;
    display: grid; place-items: center;
    color: var(--cyan); background: rgba(100,220,255,.1); font-weight: 800;
}
.item-main strong, .item-main span, .item-meta strong, .item-meta span { display: block; }
.item-main span, .item-meta span { color: var(--muted); font-size: .75rem; }
.item-meta { text-align: right; font-size: .8rem; }
.compact-list article {
    padding: .8rem;
    border-radius: 10px;
    background: rgba(0,0,0,.23);
}
.compact-list strong, .compact-list span { display: block; }
.compact-list span { margin-top: .18rem; color: var(--muted); font-size: .76rem; }
.empty { color: var(--muted); padding: 1rem 0; }

.account-strip {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    background: rgba(255,255,255,.07);
}
.account-strip div { min-width: 0; padding: 1rem; background: #0d151f; }
.account-strip span, .account-strip strong { display: block; }
.account-strip span { color: var(--muted); font-size: .7rem; }
.account-strip strong { margin-top: .25rem; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

footer {
    min-height: 70px;
    padding: 1.2rem 5vw;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: #718397;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: .75rem;
}

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .login-shell { grid-template-columns: 1fr; padding: 3rem 0; }
    .login-copy { text-align: center; }
    .login-copy > p:not(.eyebrow) { margin-left: auto; margin-right: auto; }
    .login-copy ul { display: none; }
}
@media (max-width: 700px) {
    .topbar { padding: 0 4vw; }
    .topbar nav { display: none; }
    main { width: 92vw; padding-top: 2rem; }
    .dashboard-head { align-items: stretch; flex-direction: column; }
    .character-picker { width: 100%; }
    .content-grid { grid-template-columns: 1fr; }
    .panel-wide { grid-column: auto; }
    .account-strip { grid-template-columns: 1fr 1fr; }
    .item-row { grid-template-columns: auto 1fr; }
    .item-meta { grid-column: 2; text-align: left; }
    footer { flex-direction: column; text-align: center; }
}
@media (max-width: 440px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .account-strip { grid-template-columns: 1fr; }
    .topbar > .button, .logout-form .button { padding: .55rem .7rem; font-size: .75rem; }
}
