:root {
    --bg-dark: #121212;
    --bg-section: #1e1e1e;
    --text-primary: #eee;
    --text-muted: #ccc;
    --accent: #ffcc00;
    --accent-hover: #ffd633;
    --warning: #ff4e50;
    --success: #3fa34d;
    --input-bg: #2a2a2a;
    --border-color: #444;
    --button-color: #000;
    --color-bg: #222;
    /* Track/Center (Dark) */
    --ring-track: hsl(0 0% 100% / .16);
}

/*noinspection CssUnusedSymbol*/
:root.light {
    --bg-dark: #f4f4f4;
    --bg-section: #fff;
    --text-primary: #111;
    --text-muted: #555;
    --input-bg: #fff;
    --border-color: #ddd;
    --accent: #ff4e50;
    --accent-hover: #ff6e70;
    --ring-track: hsl(0 0% 0% / .18);
}

/* Grundlayout */
body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    padding: 20px;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

header {
    background: var(--bg-section);
    padding: 16px 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-top h1 {
    font-size: 28px;
    color: var(--accent);
    margin: 0;
}

.header-top .steam-logout-btn {
    background: #171a21;
    color: #fff;
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.header-top .steam-logout-btn:hover {
    transform: scale(1.05);
}

.header-top .steam-login-btn {
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: bold;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.header-top .steam-login-btn:hover {
    transform: scale(1.05);
}

.header-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.header-controls input,
.header-controls select,
.header-controls button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 14px;
}

.header-controls button {
    background: var(--accent);
    color: var(--button-color);
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.header-controls button:hover {
    background: var(--accent-hover);
}

header h1 {
    margin: 0;
    font-size: 26px;
    color: var(--accent);
}

/*noinspection CssUnusedSymbol*/
.controls {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Suchfeld & Limit */
#searchInput, #limitSelect {
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
}

/* Dark Mode Button */
/*noinspection CssUnusedSymbol*/
#darkModeToggle {
    background: var(--accent);
    color: var(--button-color);
    border: none;
    padding: 10px 16px;
    font-weight: bold;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

/*noinspection CssUnusedSymbol*/
#darkModeToggle:hover {
    background: var(--accent-hover);
}

/* Steam Login */
.steam-login-btn {
    padding: 10px 16px;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
}

.steam-login-btn:hover {
    transform: scale(1.05);
}

/* Steam Login */
.steam-logout-btn {
    padding: 10px 16px;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
}

.steam-logout-btn:hover {
    transform: scale(1.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

/* Formulare */
/*noinspection CssUnusedSymbol*/
.form-container {
    background: var(--bg-section);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    margin-bottom: 30px;
}

.form-container form {
    display: grid;
    gap: 12px;
}

.form-container label {
    font-weight: bold;
    font-size: 14px;
    color: var(--text-muted);
}

/* Inputs */
.form-container input,
.form-container textarea,
.form-container select {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    transition: border 0.2s ease;
}

.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Checkbox */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Buttons */
.form-container button {
    background: var(--accent);
    color: var(--button-color);
    font-weight: bold;
    border: none;
    padding: 10px;
    border-radius: 9999px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.form-container button:hover {
    background: var(--accent-hover);
    transform: scale(1.03);
}

/* Game Cards */
.games-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.game-card {
    background: var(--bg-section);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.game-card:hover {
    transform: translateY(-4px);
}

.game-image img {
    width: 100%;
    height: auto;
    display: block;
}

.game-info {
    padding: 15px;
}

.game-info h3 {
    margin: 0 0 10px;
    color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #666;
    border-radius: 20px;
    transition: 0.4s;
    cursor: pointer;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(to right, #f9d423, #ff4e50);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translate(24px, -50%);
}

/* Modal */
/* Modal-Overlay */
.modal {
    display: none; /* Standard: versteckt */
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    padding-top: 60px;
}

/* Modal-Box */
.modal-content {
    background: var(--bg-section);
    margin: auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    position: relative;

    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Close-Button */
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    color: var(--text-muted);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-form {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 600px) {
    .modal-form {
        grid-template-columns: 1fr 1fr;
    }
}

.modal-form .form-row {
    display: flex;
    flex-direction: column;
}

/* Volle Breite für bestimmte Felder */
.modal-form .form-row.full-width {
    grid-column: 1 / -1;
}

.modal-form label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.modal-form input,
.modal-form textarea {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px;
    font-size: 14px;
}

.modal-form textarea {
    grid-column: span 2;
    min-height: 80px;
    resize: vertical;
}

.modal-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-section);
    position: sticky;
    bottom: 0;
    padding-bottom: 10px;
}

.modal-actions button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.modal-actions button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.modal-actions button[name="action"][value="add"] {
    background: linear-gradient(135deg, #28a745, #34d058);
    color: #fff;
}

.modal-actions button[name="action"][value="edit"] {
    background: linear-gradient(135deg, #ffc107, #ffd54f);
    color: #333;
}

.modal-actions button.danger-btn {
    background: linear-gradient(135deg, #dc3545, #ff6b6b);
    color: #fff;
}

/* Sekundär-Button (z.B. Abbrechen) */
/*noinspection CssUnusedSymbol*/
.modal-actions button.secondary {
    background: #6c757d;
    color: #fff;
}

/*noinspection CssUnusedSymbol*/
.modal-actions button.secondary:hover {
    background: #5a6268;
}

/*noinspection CssUnusedSymbol*/
.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: end;
}

/*noinspection CssUnusedSymbol*/
.form-row.two-col {
    grid-template-columns: 2fr 1fr;
}

/* Gleiche Höhe für mehrspaltige Eingabefelder */
.form-row.two-col > div {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Gleiche Höhe für Chip-Eingaben und Inputs in two-col */
.form-row.two-col > div input {
    min-height: 45px; /* gleiche Höhe wie Plattformen */
    box-sizing: border-box;
}

/*noinspection CssUnusedSymbol*/
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-row span {
    font-size: 14px;
    color: var(--text-primary);
}

.inline-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.inline-row label {
    margin-bottom: 0;
}

/* Edit Button */
.edit-btn {
    margin-top: 10px;
    background: var(--accent);
    color: var(--button-color);
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    text-decoration: none;
}

.edit-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.03);
}

/* Labels anpassen */
.form-row label {
    font-weight: 500;
    margin-bottom: 4px;
}

/* Allgemeine Buttons in Formularen */
.form-row button {
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-top: 6px;
}

/* Primäraktion (z.B. Daten laden) */
/*noinspection CssUnusedSymbol*/
.form-row button.primary {
    background: linear-gradient(135deg, #007bff, #3399ff);
    color: #fff;
}

/*noinspection CssUnusedSymbol*/
.form-row button.primary:hover {
    background: linear-gradient(135deg, #0069d9, #1a8cff);
    transform: scale(1.03);
}

/* Sekundäraktion (z.B. Alle Tags entfernen) */
/*noinspection CssUnusedSymbol*/
.form-row button.secondary {
    background: #6c757d;
    color: #fff;
}

/*noinspection CssUnusedSymbol*/
.form-row button.secondary:hover {
    background: #5a6268;
    transform: scale(1.03);
}

/* Modal-Actions Buttons */
.modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-actions button[name="action"][value="add"] {
    background: #28a745;
    color: #fff;
}

.modal-actions button[name="action"][value="edit"] {
    background: #ffc107;
    color: #333;
}

.modal-actions button.danger-btn {
    background: #dc3545;
    color: #fff;
}

.modal-actions button:hover {
    opacity: 0.9;
}

/* Einheitliche Höhe für alle Inputs im Modal */
.modal-form input[type="text"],
.modal-form input[type="number"],
.modal-form input[type="date"],
.modal-form input[type="file"],
.modal-form input[type="url"],
.modal-form .tags-input {
    min-height: 45px;
    padding: 8px 10px;
    box-sizing: border-box;
}

.modal-form input[type="number"] {
    -moz-appearance: textfield;
}

.modal-form input[type="number"]::-webkit-inner-spin-button,
.modal-form input[type="number"]::-webkit-outer-spin-button {
    height: 30px;
}

#addGameModal {
    z-index: 5000;
}

/* Select Modal */
#addGameModal select[multiple] {
    min-height: 120px;
    width: 100%;
    padding: 5px;
    box-sizing: border-box;
}

.custom-multiselect {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px;
}

.custom-multiselect input[type="text"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-size: 14px;
}

.options-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
}

.option-item.select-all {
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 6px;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.option-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

/* spinner */
#loadingOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 7000;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5em;
    flex-direction: column;
}

#loadingOverlay .spinner {
    border: 8px solid rgba(255, 255, 255, 0.2);
    border-top: 8px solid white;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Tags */
.tags-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 65px !important;
    max-height: 400px;
    overflow-y: auto;
    resize: vertical;
    width: 100%;
    box-sizing: border-box;
}

/* Chips */
/*noinspection CssUnusedSymbol*/
.tags-input .tag {
    display: inline-flex;
    align-items: center;
    background: #444;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    height: 32px;
    white-space: nowrap;
}

/* Eingabe im Tag-Feld */
.tags-input input {
    flex: 1;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    height: 32px;
    padding: 0;
}

/* Remove icon for chips */
/*noinspection CssUnusedSymbol*/
.tags-input .remove-tag {
    margin-left: 6px;
    font-weight: bold;
    cursor: pointer;
    color: #ccc;
}

/*noinspection CssUnusedSymbol*/
.tags-input .remove-tag:hover {
    color: #ff5555;
}

/*noinspection CssUnusedSymbol*/
.tag_highlight {
    background: #ff5555 !important;
    transition: background 0.2s;
}

#selectGameModal {
    z-index: 6000;
    padding-top: 6vh;
}

#selectGameModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* schneidet innen ab */
}

#selectGameModal h2 {
    margin: 0 0 12px;
}

/* Scrollbare Ergebnisliste */
#selectGameList {
    flex: 1 1 auto;
    min-height: 0; /* wichtig für Scroll in Flex-Containern */
    overflow: auto;
    padding-right: 6px;
    max-width: 100%;
}

#selectGameList > div {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

/* Spieloption im Modal */
/*noinspection CssUnusedSymbol*/
#selectGameList .game-option {
    display: flex;
    gap: 12px;
    padding: 8px;
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

/*noinspection CssUnusedSymbol*/
#selectGameList .game-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Spielbilder */
#selectGameList img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    max-height: none;
}

/* Spielbeschreibung */
/*noinspection CssUnusedSymbol*/
#selectGameList .game-details {
    flex: 1;
}

#selectGameList .game-details h4 {
    margin: 0 0 4px;
    font-size: 16px;
    color: var(--accent);
}

#selectGameList .game-details p {
    margin: 0;
    font-size: 13px;
    color: inherit;
}

#selectGameList button[data-load-more] {
    background: var(--accent);
    color: var(--button-color);
    font-weight: bold;
    border: none;
    outline: none;
    padding: 8px 16px;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    white-space: nowrap;
}

#selectGameList button[data-load-more]:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    filter: brightness(1.05);
}

#selectGameList button[data-load-more]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

#selectGameList button[data-load-more]:disabled {
    opacity: 0.7;
    cursor: default;
}

/* spinner is always there, but hidden by default (keeps width) */
/*noinspection CssUnusedSymbol*/
#selectGameList .btn-spinner {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    border: 2px solid color-mix(in srgb, currentColor 40%, transparent);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    visibility: hidden;
}

/* fallback if color-mix isn't supported */
@supports not (border: 2px solid color-mix(in srgb, red 50%, transparent)) {
    /*noinspection CssUnusedSymbol*/
    #selectGameList .btn-spinner {
        border: 2px solid rgba(255, 255, 255, 0.4);
        border-top-color: currentColor;
    }
}

/* show spinner only while loading */
/*noinspection CssUnusedSymbol*/
#selectGameList button[data-load-more].loading .btn-spinner {
    visibility: visible;
}

/* Game List */
/* Badges im Bild */
.game-image {
    position: relative;
    background: #000;
}

/* Position like before */
.score-ring {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    text-decoration: none;
}

/* Progress ring — starts top-left (≈10:30 / -135deg) and fills clockwise */
.score-ring .ring {
    --val: 0; /* 0–100 */
    --thickness: 7px; /* ring width */
    --start: 0deg; /* top-left opening */
    position: absolute;
    inset: 0;
    border-radius: 50%;

    /* Gradient only over the progressed arc; rest is track */
    background: conic-gradient(from var(--start),
    hsl(0 85% 55%) 0%,
    hsl(40 100% 50%) calc(var(--val) * .33%),
    hsl(120 70% 45%) calc(var(--val) * .66%),
    hsl(200 85% 55%) calc(var(--val) * 1%),
    var(--ring-track) 0
    );

    /* donut cutout (center is transparent) */
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thickness)), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--thickness)), #000 0);
}

/* Inner is fully transparent; we only center the number */
.score-ring .face {
    position: relative;
    z-index: 1;
    width: calc(100% - (var(--thickness) * 2));
    height: calc(100% - (var(--thickness) * 2));
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: transparent; /* no fill */
}

/* Number: outlined-only, with double-stroke for maximum contrast */
.score-ring .value {
    position: relative;
    font: 800 22.5px/1 system-ui, Segoe UI, Roboto, sans-serif;
    color: #ffffff;
}

/* outer dark stroke behind the bright one */
.score-ring .value::before {
    content: attr(data-v);
    position: absolute;
    inset: 0;
    -webkit-text-stroke: 1.5px rgba(0, 0, 0, .85); /* outer dark halo */
    pointer-events: none;
}

.owned-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #28a745, #34d058);
    color: #fff;
    padding: 6px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

/* Meta/Chips */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.pill {
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
}

.pill-green {
    background: rgba(63, 163, 77, .2);
    color: #8fe29a;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 8px;
}

.chip {
    padding: 4px 8px;
    background: #333;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 12px;
    color: var(--text-primary);
}

.chips.muted .chip {
    background: #2a2a2a;
    color: var(--text-muted);
}

.game-info .desc {
    max-height: 90px;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0));
    margin: 8px 0 12px;
    font-size: 14px;
}

/* Karten-Aktionen */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.actions .btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 13px;
    text-decoration: none;
    color: var(--text-primary);
}

.actions .btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Pagination */
.pagination {
    margin: 16px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pagination .page-btn {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
}

.pagination .page-btn:hover {
    background: rgba(255, 255, 255, .06);
}

.pagination .page-btn.active {
    background: var(--accent);
    color: var(--button-color);
    border-color: transparent;
    font-weight: 700;
}

.pagination .page-btn.disabled {
    opacity: .5;
    pointer-events: none;
}

.pagination .ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
}

.pagination .page-info {
    margin-left: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Platform Chips */
.chips-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 6px 0 8px;
}

.chips-title {
    font-size: 12px;
    color: var(--text-muted);
    flex: 0 0 auto;
    padding-top: 4px;
}

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

.chip {
    padding: 4px 8px;
    background: #333;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 12px;
    color: var(--text-primary);
}

.chips-row.owned .chip {
    background: rgba(63, 163, 77, .12);
    border-color: rgba(63, 163, 77, .35);
}

.chip-owned {
    position: relative;
}

.chip-owned::after {
    content: "✓";
    font-weight: 900;
    margin-left: 6px;
    opacity: .85;
}

/* Desc */
.desc-wrap {
    position: relative;
}

.desc {
    max-height: 96px;
    overflow: hidden;
    position: relative;
}

.desc[data-collapsed="true"] {
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0));
}

.desc[data-collapsed="false"] {
    max-height: none;
    mask-image: none;
}

.desc-toggle {
    margin-top: 6px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
}

.desc-toggle:hover {
    background: rgba(255, 255, 255, .06);
}

#ownedFilter {
    min-width: 160px;
}

/* Layout container + adaptive width */
.container {
    max-width: 1100px;
    width: 100%;
    margin-inline: auto;
    padding-inline: 12px;
    box-sizing: border-box;
}

/* New Appbar (sticky, glass) */
.appbar {
    position: sticky;
    top: 0;
    z-index: 4000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: color-mix(in oklab, var(--bg-section) 82%, transparent);
    border-bottom: 1px solid var(--border-color);
    transition: box-shadow .25s ease;
}

.appbar[data-elev="1"] {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.appbar-inner {
    display: grid;
    grid-template-columns: auto 1fr; /* Brand | Actions */
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.appbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* <- erlaubt Shrink der Kinder */
    flex-wrap: nowrap; /* kein Zeilenumbruch */
}

.search-wrap {
    flex: 1 1 420px; /* nimmt Restbreite, darf bis ~420px wachsen */
    min-width: 0; /* <- wichtig: darf kleiner werden! */
}

/* generische Icon-Basis */
.svg-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 18px;
    color: inherit;
    opacity: .65;
}

/* die Linse als Mask (damit färbbar via currentColor) */
.svg-icon-lens {
    background-color: currentColor;
    -webkit-mask: url("/img/icons/lens.svg") no-repeat center / content;
    mask: url("/img/icons/lens.svg") no-repeat center / contain;
}

.svg-icon-logout {
    background-color: currentColor;
    -webkit-mask: url("/img/icons/logout.svg") no-repeat center / content;
    mask: url("/img/icons/logout.svg") no-repeat center / contain;
    align-items: center;
}

.btn, .toggle-switch, .btn.icon.only, .user-pill {
    flex: 0 0 auto;
    white-space: nowrap;
}

.appbar, .appbar-inner, .container {
    overflow: hidden;
}

@media (max-width: 760px) {
    .search-wrap {
        flex-basis: 260px;
    }
}

@media (max-width: 560px) {
    .search-wrap {
        flex-basis: 0;
    }

    /* Suche wird kompakter */
    .btn.ghost {
        padding-inline: 10px;
    }
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 800;
    font-size: 20px;
    color: var(--text-primary);
}

.brand-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    box-shadow: 0 0 0 3px color-mix(in srgb, #0ea5e9 30%, transparent);
}

/* Right actions */
.appbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Search */
.search-wrap {
    display: grid;
    grid-template-columns: 24px 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 9999px;
    min-width: 280px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
}

.search-wrap svg {
    width: 18px;
    height: 18px;
    opacity: .65;
}

.search-wrap input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
}

/* Buttons */
.btn {
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: color-mix(in srgb, var(--input-bg) 75%, white 5%);
}

.btn.primary {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #051014;
    border: none;
}

.btn.ghost {
    background: transparent;
}

.btn.icon.only {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
}

/* User pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
}

.user-pill .avatar {
    width: 22px;
    height: 22px;
    border-radius: 9999px;
}

.user-pill .logout {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 4px;
}

/* Filterbar (collapsible) */
.filterbar {
    padding: 8px 0 12px;
}

.filterbar .row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
    align-items: end;
}

.filterbar .field {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filterbar .field.end {
    grid-column: span 3;
    display: flex;
    justify-content: flex-end;
}

.filterbar label {
    font-size: 12px;
    color: var(--text-muted);
}

.filterbar select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
}

/* Mobile */
@media (max-width: 820px) {
    .search-wrap {
        min-width: 0;
        width: 42vw;
    }

    .filterbar .field {
        grid-column: span 6;
    }

    .filterbar .field.end {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .btn.primary {
        width: 100%;
    }
}

/* Cards – feinere Abstände + Hover */
.games-list {
    gap: 18px;
}

.game-card {
    border: 1px solid var(--border-color);
    transform: translateY(0) scale(1);
    transition: transform .2s ease, box-shadow .2s ease;
}

.game-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .25);
}

/* Focus visibility */
:focus-visible {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
    border-radius: 8px;
}

/* LoadingOverlay */
#loadingOverlay {
    background: rgba(0, 0, 0, .66);
}

/* Logo */
.brand-logo {
    width: 38px; /* Größe anpassen */
    height: 38px;
    border-radius: 50%; /* macht es rund */
    object-fit: cover; /* Bild immer ausgefüllt */
    box-shadow: 0 0 0 2px var(--border-color);
    transition: transform 0.25s ease;
    margin-left: 2px;
}

.brand-logo:hover {
    transform: scale(1.05);
}

/* ===== Overview / Stats-Bar ===== */
.stats-bar {
    margin: 18px 0 8px;
}

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

.stat-card {
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
    background: color-mix(in srgb, var(--bg-section) 88%, white 4%);
}

.stat-label {
    font-size: 12px;
    letter-spacing: .2px;
    color: var(--text-muted);
}

.stat-value {
    font-weight: 900;
    font-size: 26px;
    line-height: 1.1;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Section Header ===== */
.games-section .section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 10px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.games-section .section-head h2 {
    margin: 0;
    font-size: 20px;
    color: var(--accent);
}

.games-section .section-meta {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Optional: kleine optische Straffung der Cards in Main */
.games-section .game-card {
    border-radius: 12px;
}

/* Body-Scroll sperren, wenn ein Modal offen ist */
body.modal-open {
    overflow: hidden;
    /* optional: Layout-Shift vermeiden, wenn Scrollbar verschwindet */
    padding-right: var(--scrollbar-comp, 0px);
}

/* ===== Card v2: gestapelt, klare Sektionen, kompakt ===== */
.game-card--v2 {
    display: grid !important;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto; /* Bild | Info */
    align-content: start;
    border-radius: 12px;
    overflow: hidden;
}

/* Bildbereich (kein schwarzer Rest, wächst nicht mit) */
.game-image.v2 {
    position: relative;
    background: transparent !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    flex: 0 0 auto !important; /* falls irgendwo Flex greift */
}

.game-card--v2 .game-image {
    flex: 0 0 auto;
}

/* Safety */
.game-image.v2 img {
    display: block;
    width: 100%;
    height: auto;
    /* optional stabil: gleiche Cover-Proportionen */
    aspect-ratio: 2 / 3;
    object-fit: cover;
    filter: contrast(1.05) saturate(1.05);
}

.supports-svg-sharp .game-image.v2 img.maybe-sharp {
    filter: url(#unsharp-s);
}

/* Besitz-Badge */
.owned-badge.v2 {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #28a745, #34d058);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

.owned-badge.v2 .owned-label {
    opacity: .9;
}

/* Rund + flexibel (ab 3 Ziffern wird's eine Pill) */
.owned-badge.v2 .owned-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, .25);
    border: 2px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    transition: inline-size .2s ease;
}

.owned-badge.v2 .owned-count.count-wide {
    padding: 0 10px;
}

/* Info-Bereich */
.game-info.v2 {
    padding: 14px;
    display: grid;
    gap: 12px;
    margin-top: 0 !important;
}

.card-head .title {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.meta-row.compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-row.compact .meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-head, .meta-row.compact, .game-info.v2 {
    min-width: 0;
}

/* Sektionen */
.section {
    display: grid;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.section-title {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: .2px;
}

.own-grid {
    display: grid;
    gap: 8px;
}

/* Chips */
.game-card--v2[data-chips-align="left"] .chips {
    justify-content: flex-start;
}

.game-card--v2[data-chips-align="center"] .chips {
    justify-content: center;
}

.game-card--v2[data-chips-align="right"] .chips {
    justify-content: flex-end;
}

.chips .chip {
    line-height: 1;
    padding: 6px 10px;
}

/* Footer */
.actions.v2 {
    border-top: 1px dashed var(--border-color);
    padding-top: 8px;
    gap: 8px;
}

/* Responsive Feinschliff */
@media (min-width: 720px) {
    .card-head {
        display: grid;
        gap: 6px;
        grid-template-columns:1fr auto;
        align-items: baseline;
    }
}

/* Kompakte Info-Karte unter dem Titel */
.facts-card {
    position: relative;
    display: grid;
    gap: 6px;
    padding: 12px 56px 12px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-section) 92%, #000 8%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}

/* Einzelne Zeilen (Label | Wert) */
.facts-card .fact {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 10px;
    min-width: 0; /* truncation erlaubt */
    font-size: 13px;
}

.facts-card .k {
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: .2px;
}

.facts-card .v {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MP-Pill in der Karte (oben rechts) */
.facts-card .facts-mp {
    position: absolute;
    top: 10px;
    right: 10px;
    line-height: 1;
    padding: 4px 10px;
    white-space: nowrap;
}

/* Titel bleibt knackig */
.card-head .title {
    margin: 0 0 4px;
    font-size: 18px;
}

/* Responsive: bei schmalen Screens etwas größerer Abstand */
@media (max-width: 520px) {
    .facts-card {
        padding: 10px;
        border-radius: 10px;
    }

    .facts-card .fact {
        gap: 8px;
    }
}

/* Filter-Hide zuverlässig erzwingen */
.game-card.gdb-hidden,
.game-card[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap
}

.viewmode-select-wrap {
    display: flex;
    align-items: center
}

.viewmode-select {
    appearance: auto;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-section);
    color: var(--text-primary)
}
