:root {
    --bg: #09090b;
    --panel: #121217;
    --panel-2: #19191f;
    --line: #2d2d35;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --red: #dc2626;
    --red-dark: #7f1d1d;
    --green: #22c55e;
    --shadow: 0 18px 52px rgba(0, 0, 0, .36);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 95% 0%, rgba(127, 29, 29, .24), transparent 35rem),
        radial-gradient(circle at 0 42%, rgba(220, 38, 38, .07), transparent 30rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.shell {
    width: min(1450px, calc(100% - 28px));
    margin: auto;
    padding: 28px 0 76px;
}

.hero,
.recommendations,
.toolbar,
.login-card,
.setup-card {
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero {
    padding: 29px;
    border-radius: 24px;
    background: linear-gradient(135deg, #1b1b21, #0d0d11);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
}

.eyebrow {
    color: #fca5a5;
    font-size: .74rem;
    font-weight: 850;
    letter-spacing: .17em;
    text-transform: uppercase;
}

h1 {
    margin: 10px 0 12px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: .98;
}

.lead,
.login-lead {
    max-width: 850px;
    color: var(--muted);
    line-height: 1.62;
}

.account-actions,
.profile-summary,
.toolbar-bottom {
    display: flex;
    gap: 9px;
    align-items: center;
    flex-wrap: wrap;
}

.profile-summary {
    margin-top: 22px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .025);
}

.profile-summary > div { flex: 1; }

.avatar {
    width: 58px;
    height: 58px;
    border-radius: 12px;
    border: 1px solid var(--line);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    background: #202027;
    color: var(--text);
    font-weight: 750;
}

.button:hover { background: #2a2a32; }
.button:disabled { cursor: wait; opacity: .65; }

.button-primary {
    background: var(--red-dark);
    border-color: #991b1b;
}

.button-danger { color: #fecaca; }

.stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 18px;
}

.stat {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .025);
}

.stat b {
    display: block;
    font-size: 1.45rem;
}

.stat span {
    color: var(--muted);
    font-size: .79rem;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    margin: 15px 0 7px;
    color: var(--muted);
    font-size: .84rem;
}

.progress {
    height: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: #292930;
}

.progress i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--red-dark), var(--red));
    transition: width .25s;
}

.recommendations {
    margin: 18px 0;
    padding: 19px;
    border-radius: 19px;
    background: linear-gradient(145deg, #15151b, #101014);
}

.game-menu-panel {
    margin: 18px 0;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: linear-gradient(145deg, #15151b, #101014);
    box-shadow: var(--shadow);
}

.game-menu-top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    max-height: 430px;
    margin-top: 10px;
    overflow: auto;
    padding-right: 3px;
}

.game-card {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel-2);
}

.game-card.active {
    border-color: #991b1b;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.game-card img,
.game-placeholder {
    width: 72px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #0b0b0e;
}

.game-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
}

.game-card-body {
    min-width: 0;
}

.game-card-body strong,
.tracked-game strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-card-body span,
.tracked-game span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .75rem;
}

.game-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    flex-wrap: wrap;
}

.button-small {
    min-height: 30px;
    padding: 6px 8px;
    font-size: .78rem;
}

.heart-button {
    width: 32px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    color: #fecaca;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #202027;
    font-size: 1rem;
    line-height: 1;
}

.heart-button.active {
    color: white;
    border-color: #991b1b;
    background: var(--red-dark);
}

.tracked-grid {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.tracked-game {
    min-width: 180px;
    max-width: 260px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 7px;
    align-items: center;
    padding: 9px 11px;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
}

.tracked-game.active {
    border-color: #991b1b;
    background: rgba(127, 29, 29, .22);
}

.tracked-game span {
    color: #fecaca;
    margin: 0;
}

.section-heading h2 { margin: 0; font-size: 1.2rem; }
.section-heading p { margin: 4px 0 13px; color: var(--muted); font-size: .83rem; }

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 9px;
}

.recommendation-card {
    min-width: 0;
    padding: 13px;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--panel-2);
}

.recommendation-card:hover { border-color: #4b4b55; }
.recommendation-card span { color: #fca5a5; font-size: .72rem; font-weight: 900; }
.recommendation-card strong { display: block; margin: 6px 0; font-size: .91rem; overflow-wrap: anywhere; }
.recommendation-card small { color: var(--muted); line-height: 1.4; }

.toolbar {
    position: sticky;
    top: 6px;
    z-index: 20;
    margin: 18px 0;
    padding: 12px;
    border-radius: 17px;
    background: rgba(14, 14, 18, .9);
    backdrop-filter: blur(15px);
}

.filters {
    display: grid;
    grid-template-columns: minmax(210px, 1.5fr) repeat(4, minmax(125px, .65fr));
    gap: 8px;
}

input,
select {
    width: 100%;
    padding: 10px 11px;
    color: var(--text);
    outline: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
}

input:focus,
select:focus {
    border-color: var(--red-dark);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .11);
}

.toolbar-bottom {
    justify-content: space-between;
    margin-top: 8px;
}

.toolbar-bottom select { width: auto; }

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.achievement-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(145deg, var(--panel), #0f0f13);
    transition: transform .18s, border-color .18s, opacity .18s;
}

.achievement-card:hover {
    transform: translateY(-2px);
    border-color: #494952;
}

.achievement-card.done { opacity: .75; }

.achievement-icon {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #0b0b0e;
}

.achievement-content { min-width: 0; }

.achievement-title-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.achievement-title-row h3 {
    margin: 0;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.steam-check {
    white-space: nowrap;
    padding: 4px 7px;
    color: #bbf7d0;
    font-size: .65rem;
    font-weight: 850;
    border: 1px solid rgba(34, 197, 94, .35);
    border-radius: 999px;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}

.badge {
    padding: 4px 7px;
    font-size: .65rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.badge.killer { color: #fecaca; background: rgba(127, 29, 29, .22); }
.badge.survivor { color: #bfdbfe; background: rgba(30, 64, 175, .2); }
.badge.general { color: #ddd6fe; background: rgba(76, 29, 149, .2); }
.badge.easy { color: #bbf7d0; }
.badge.medium { color: #fde68a; }
.badge.hard { color: #fecaca; }

.achievement-content p {
    margin: 7px 0 10px;
    color: var(--muted);
    font-size: .87rem;
    line-height: 1.44;
}

.unlock-date {
    margin: 7px 0;
    color: #bbf7d0;
    font-size: .81rem;
    font-weight: 700;
}

.rarity {
    color: var(--muted);
    font-size: .78rem;
}

.rarity strong { color: var(--text); }

.alert {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 11px;
}

.alert-error {
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, .38);
    background: rgba(127, 29, 29, .22);
}

.empty {
    grid-column: 1 / -1;
    padding: 43px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 15px;
}

.muted { color: var(--muted); }

.footer {
    margin-top: 27px;
    color: var(--muted);
    font-size: .79rem;
    line-height: 1.55;
    text-align: center;
}

.login-shell,
.setup-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.login-card,
.setup-card {
    width: min(660px, 100%);
    padding: clamp(24px, 5vw, 46px);
    border-radius: 24px;
    background: linear-gradient(145deg, #18181e, #0e0e12);
}

.steam-login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding: 15px 18px;
    color: white;
    font-size: 1.05rem;
    font-weight: 850;
    border: 1px solid #467ca5;
    border-radius: 12px;
    background: linear-gradient(135deg, #1b6a93, #173a59);
}

.steam-login-button:hover { filter: brightness(1.08); }
.steam-logo { font-size: 1.45rem; }

.privacy-note {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
    text-align: center;
}

.setup-card h1 { font-size: clamp(2rem, 7vw, 3rem); }

.setup-form {
    display: grid;
    gap: 15px;
    margin-top: 22px;
}

.setup-form label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .83rem;
}

.setup-help {
    margin-top: 18px;
    padding: 13px;
    color: var(--muted);
    font-size: .83rem;
    line-height: 1.55;
    border: 1px solid var(--line);
    border-radius: 12px;
}

@media (max-width: 1100px) {
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .recommendation-grid { grid-template-columns: repeat(3, 1fr); }
    .filters { grid-template-columns: 1fr 1fr 1fr; }
    .stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
    .shell {
        width: calc(100% - 18px);
        padding-top: 9px;
    }

    .hero { padding: 21px 16px; }
    .hero-top { display: block; }
    .account-actions { margin-top: 16px; }
    .stats { grid-template-columns: 1fr 1fr; }
    .game-menu-top { grid-template-columns: 1fr; }
    .game-grid,
    .recommendation-grid,
    .achievement-grid,
    .filters { grid-template-columns: 1fr; }
    .recommendation-grid .recommendation-card:nth-child(n + 4) { display: none; }
    .toolbar { top: 4px; }
    .achievement-card { grid-template-columns: 52px 1fr; }
    .achievement-icon { width: 52px; height: 52px; }
}
