/* Completionist: restyle. Selectors/class names unchanged. */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
    --background: #0a0f0c;
    --surface: #0d140f;
    --surface-raised: #121b15;
    --surface-hover: #17211b;

    --border: rgba(133, 183, 145, 0.3);
    --border-strong: rgba(145, 195, 157, 0.7);

    --text: #eef3ef;
    --text-soft: #c0ccc4;
    --text-muted: #8a9c8f;

    --green: #7fb784;
    --green-bright: #a7d6ab;

    --very-easy: #9ac4a7;
    --easy: #b8c78d;
    --average: #d3b879;
    --hard: #d49a73;
    --brutal: #c87979;

    --radius: 8px;
    --font: Roboto, Inter, ui-sans-serif, system-ui, -apple-system,
        "Segoe UI", sans-serif;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

:focus-visible {
    outline: 2px solid var(--green-bright);
    outline-offset: 2px;
}

.hidden { display: none !important; }

main, .site-header {
    width: min(1200px, calc(100% - 64px));
    margin-inline: auto;
}


/* HEADER */

.site-header { padding: 64px 0 44px; }

/* The wordmark is the eyebrow now, so the small label is hidden */
.eyebrow { display: none; }

.site-header h1 {
    margin: 0;
    font-size: clamp(2.4rem, 4.4vw, 3.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.site-header .intro {
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: 1.1rem;
    font-weight: 400;
}

.site-header .intro span {
    color: var(--green);
    font-weight: 700;
}

.section-label {
    margin: 0 0 6px;
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}


/* STEAM PANEL */

.steam-login {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 1.1fr);
    align-items: center;
    gap: 22px 32px;
    margin-bottom: 72px;
    padding: 28px 32px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
}

.steam-id-heading label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 600;
}

.steam-id-heading p {
    max-width: 44ch;
    margin: 0;
    color: var(--text-soft);
    font-size: 0.82rem;
    line-height: 1.45;
}

.load-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.load-controls input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    color: var(--text);
    background: #101812;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.load-controls input::placeholder { color: var(--text-muted); }

.load-controls input:focus {
    outline: none;
    border-color: var(--green-bright);
    box-shadow: 0 0 0 3px rgba(167, 214, 171, 0.18);
}

.load-controls button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 22px;
    color: #0a120d;
    background: var(--green);
    border: 0;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.15s, transform 0.15s;
}

.load-controls button:hover { background: var(--green-bright); }
.load-controls button:active { transform: translateY(1px); }
.load-controls button:disabled { cursor: wait; opacity: 0.55; }

.steam-info-note {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
    padding: 6px 14px;
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    line-height: 1.4;
}

#status {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

#status:empty { display: none; }

.progress {
    grid-column: 1 / -1;
    height: 4px;
    overflow: hidden;
    background: rgba(133, 183, 145, 0.15);
    border-radius: 999px;
}

.progress-bar {
    width: 0;
    height: 100%;
    background: var(--green);
    border-radius: inherit;
    transition: width 0.2s ease;
}


/* COMPLETED GAMES */

.completed-section { margin-bottom: 72px; }

.completed-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.completed-heading h2,
.library-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.completed-count {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.completed-count span { color: var(--text-soft); font-weight: 700; }

.completed-games { display: flex; flex-wrap: wrap; gap: 10px; }

.completed-badge {
    display: flex;
    align-items: center;
    width: 270px;
    min-width: 0;
    padding: 8px 10px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: left;
    transition: background 0.16s, border-color 0.16s;
}

.completed-badge:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.completed-badge-image {
    flex: 0 0 64px;
    width: 64px;
    height: 37px;
    overflow: hidden;
    background: #0b100d;
    border-radius: 4px;
}

.completed-badge-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.completed-badge-name {
    min-width: 0;
    margin-left: 10px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.completed-check {
    margin-left: auto;
    padding-left: 8px;
    color: var(--green);
    font-weight: 800;
}


/* LIBRARY HEADER + CONTROLS */

.library-header { margin-bottom: 24px; }

/* Filters stay hidden until the game grid has content */
.library-controls {
    display: none;
    align-items: end;
    justify-content: flex-start;
    gap: 24px;
    margin-bottom: 36px;
}

main:has(.game-grid > *) .library-controls { display: flex; }

.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.filter-group label {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.filter-group select {
    min-width: 190px;
    height: 38px;
    padding: 0 12px;
    color: var(--text-soft);
    background: #111914;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.filter-group select:hover,
.filter-group select:focus {
    outline: none;
    border-color: var(--border-strong);
}


/* GAME GRID + CARD */

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    padding-bottom: 70px;
}

.game-card {
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.18s, border-color 0.18s, background 0.18s;
}

.game-card:hover {
    background: var(--surface-raised);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.game-image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 616 / 353;
    overflow: hidden;
    background: #0d130f;
}

.game-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s;
}

.game-card:hover .game-image { transform: scale(1.025); }

.difficulty-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    color: #0a0f0c;
    background: var(--green);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.difficulty-badge.very-easy { background: var(--very-easy); }
.difficulty-badge.easy { background: var(--easy); }
.difficulty-badge.average { background: var(--average); }
.difficulty-badge.hard { background: var(--hard); }
.difficulty-badge.brutal { color: #fff5f2; background: var(--brutal); }

.game-card-content { padding: 16px; }

.game-card h3 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.game-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.game-stats span { position: relative; }

.game-stats span:not(:last-child)::after {
    content: "·";
    position: absolute;
    right: -9px;
    color: #566359;
}

.game-stats strong { color: var(--text-soft); font-weight: 600; }

.completion-bar {
    height: 4px;
    margin: -2px 0 14px;
    overflow: hidden;
    background: rgba(133, 183, 145, 0.15);
    border-radius: 999px;
}

.completion-fill {
    height: 100%;
    background: var(--green);
    border-radius: inherit;
}

.game-reason {
    min-height: 42px;
    margin: 0 0 16px;
    color: var(--text-soft);
    font-size: 0.86rem;
    line-height: 1.55;
}

.analysis-button {
    width: 100%;
    min-height: 40px;
    color: var(--green);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.analysis-button:hover {
    color: #0a120d;
    background: var(--green);
}


/* ERROR */

.error {
    display: none;
    margin: 0 0 40px;
    padding: 13px 15px;
    color: #e8b0b0;
    background: rgba(145, 65, 65, 0.14);
    border: 1px solid rgba(200, 121, 121, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
}

.error.visible { display: block; }


/* MODAL */

body.modal-open { overflow: hidden; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 5, 0.8);
    backdrop-filter: blur(5px);
}

.analysis-panel {
    position: relative;
    z-index: 1;
    width: min(640px, 100%);
    max-height: min(740px, calc(100vh - 48px));
    overflow-y: auto;
    padding: 30px;
    background: #111914;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
}

.close-button {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.close-button:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

.analysis-panel h2 {
    max-width: calc(100% - 40px);
    margin: 0 0 20px;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.analysis-score { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }

.analysis-score-number {
    color: var(--green-bright);
    font-size: 3.4rem;
    font-weight: 500;
    letter-spacing: -0.05em;
    line-height: 1;
}

.analysis-score-label { color: var(--text-soft); font-size: 0.95rem; font-weight: 600; }

.analysis-reason {
    margin: 0 0 24px;
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1.6;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 28px;
}

.analysis-stats div {
    padding: 12px;
    background: #0d140f;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.analysis-stats span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.analysis-stats strong { font-size: 0.95rem; font-weight: 600; }

.analysis-factors { padding-top: 22px; border-top: 1px solid var(--border); }

.analysis-factors h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; }

.analysis-factors p {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 0;
    padding: 9px 0;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(154, 194, 166, 0.1);
    font-size: 0.85rem;
}

.analysis-factors p:last-child { border-bottom: 0; }
.analysis-factors strong { color: var(--text-soft); font-weight: 600; }

.analysis-note {
    margin: 20px 0 0;
    padding: 12px 14px;
    color: var(--text-muted);
    background: rgba(154, 196, 167, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.5;
}


/* RESPONSIVE */

@media (max-width: 1050px) {
    main, .site-header { width: min(100% - 40px, 900px); }
    .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    main, .site-header { width: calc(100% - 28px); }
    .site-header { padding: 40px 0 32px; }
    .steam-login { grid-template-columns: minmax(0, 1fr); padding: 20px; margin-bottom: 48px; }
    .completed-section { margin-bottom: 48px; }
    .steam-id-heading p { max-width: none; }
    .completed-heading { align-items: start; flex-direction: column; gap: 6px; }
    .completed-badge { width: 100%; }
    .library-controls { align-items: stretch; flex-direction: column; }
    .filter-group select { width: 100%; }
    .game-grid { grid-template-columns: 1fr; gap: 16px; }
    .analysis-panel { padding: 24px 18px; }
    .analysis-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analysis-factors p { flex-direction: column; gap: 3px; }
}

@media (max-width: 420px) {
    .load-controls { flex-direction: column; align-items: stretch; }
    .load-controls button { width: 100%; }
    .analysis-stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}