/* Game OS - Enhanced Styles */

/* Root Variables */
:root {
    --primary-color: #6c63ff;
    --primary-dark: #5a52d5;
    --secondary-color: #00b4d8;
    --secondary-dark: #0096b4;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #22c55e;
    --info-color: #00b4d8;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --bg-color: #0f172a;
    --bg-card: #1e293b;
    --white: #ffffff;
    --border-color: #334155;
    --border-light: #e2e8f0;
    --shadow: 0 4px 20px rgba(0,0,0,0.25);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-color);
}

.container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 900px;
    width: 100%;
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    color: var(--white);
    padding: 24px 30px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 14px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Navigation */
nav {
    margin-top: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

#guestNav,
#userNav {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 7px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9em;
    border: 1px solid rgba(255,255,255,0.15);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* Main Content */
main {
    padding: 40px;
    background: #f8fafc;
}

/* Form Container */
.form-container {
    max-width: 450px;
    margin: 0 auto;
}

.form-container h2 {
    color: var(--text-color);
    font-size: 1.8em;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
}

.form-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 28px;
    font-size: 0.95em;
}

/* Forms */
.auth-form {
    background: var(--white);
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 1em;
    transition: all 0.2s ease;
    background: var(--white);
    color: var(--text-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}

.form-group input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    font-size: 0.9em;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.checkbox-label span {
    color: var(--text-color);
}

.link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 11px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #4a43b5);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(108,99,255,0.4);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(0,180,216,0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-dark), #007a96);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,180,216,0.4);
}

.btn-block {
    width: 100%;
    display: block;
}

/* Messages */
.message {
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
    font-size: 0.9em;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--success-color);
}

.message.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger-color);
}

.message.info {
    background-color: #f0f9ff;
    color: #075985;
    border: 1px solid #bae6fd;
    border-left: 4px solid var(--info-color);
}

.message.warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--warning-color);
}

/* Connection Status */
.status {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 600;
    margin: 8px 0;
}

.status.connected {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status.disconnected {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Form Footer */
.form-footer {
    text-align: center;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-light);
}

.form-footer p {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Footer */
footer {
    background: #f8fafc;
    padding: 18px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    border-top: 1px solid var(--border-light);
}

/* User Info Display */
.user-info {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f0f4ff, #e8f5e9);
    border-radius: var(--radius-sm);
    margin: 16px 0;
    border: 1px solid #c7d2fe;
}

.welcome-text {
    color: var(--text-color);
    font-size: 1em;
}

/* Home Page Styles */
.hero-section {
    text-align: center;
    padding: 48px 20px 36px;
}

.hero-section h2 {
    font-size: 2.4em;
    color: var(--text-color);
    margin-bottom: 16px;
    font-weight: 700;
}

.hero-section p {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 28px;
    line-height: 1.7;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 36px;
}

.feature-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-light);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2em;
    font-weight: 700;
}

.feature-card p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.93em;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .form-container {
        padding: 0 10px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .user-info {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    header {
        padding: 18px;
    }
    
    header h1 {
        font-size: 1.6em;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes steam-indeterminate {
    0%   { transform: translateX(-150%); }
    100% { transform: translateX(350%); }
}
.steam-progress-bar {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    border-radius: 999px;
    animation: steam-indeterminate 1.4s ease-in-out infinite;
}

/* Nav button (styled like nav-link but as a <button>) */
.nav-btn {
    background: none;
    border: none;
    font-size: 1em;
    cursor: pointer;
    font-family: inherit;
}

/* Account Page */
.account-container {
    max-width: 560px;
}

.account-details-card {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.account-details-card h3,
.update-section h3 {
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.account-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.account-detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    color: var(--text-color);
    font-size: 0.95em;
}

.update-section {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none !important;
}

/* Friends Section */
/* ── Inbox Section ────────────────────────────────────────────────────────── */
.inbox-section {
    margin-bottom: 24px;
    padding: 22px 24px;
    background: #f0f9ff;
    border-radius: var(--radius);
    border: 1px solid #bae6fd;
}

.inbox-section h3 {
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.inbox-badge {
    background: var(--danger-color);
    color: var(--white);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.78em;
    font-weight: 700;
}

.inbox-list {
    margin-top: 5px;
}

.friends-section {
    margin-bottom: 24px;
    padding: 22px 24px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.friends-section h3 {
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.friends-count {
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.78em;
    font-weight: 700;
}

.friend-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.friend-search input {
    flex: 1;
    padding: 9px 13px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    transition: border-color 0.2s ease;
}

.friend-search input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}

.friends-list {
    margin-top: 10px;
}

.friend-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.friend-item:last-child {
    border-bottom: none;
}

.friend-name {
    font-weight: 500;
    color: var(--text-color);
}

.friend-name-link {
    font-weight: 600;
    color: var(--primary-color);
    transition: color 0.15s;
}

.friend-name-link:hover {
    color: var(--primary-dark);
    text-decoration: underline !important;
}

.btn-remove-friend {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-friend:hover {
    background: var(--danger-color);
    color: var(--white);
}

.friend-requests-section {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px dashed var(--secondary-color);
}

.friend-requests-title {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

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

.btn-accept-friend {
    background: var(--success-color);
    border: none;
    color: var(--white);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-accept-friend:hover {
    background: #16a34a;
}

.btn-decline-friend {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-decline-friend:hover {
    background: var(--danger-color);
    color: var(--white);
}

.friend-pending-badge {
    font-size: 0.78em;
    color: var(--warning-color);
    font-weight: 600;
    margin-right: auto;
    margin-left: 8px;
}

/* ── Danger Zone ──────────────────────────────────────────────────────────── */
.danger-zone {
    margin-top: 2rem;
    padding: 1.25rem;
    border: 1px solid var(--danger-color);
    border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.04);
}

.danger-zone h3 {
    color: var(--danger-color);
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1em;
}

.danger-zone p {
    color: var(--text-muted);
    font-size: 0.88em;
    margin-bottom: 1rem;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s ease;
    font-weight: 600;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .friend-search {
        flex-direction: column;
    }
}

/* ── Message (chat) button ────────────────────────────────────────────────── */
.btn-message-friend {
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-message-friend:hover {
    background: var(--secondary-color);
    color: var(--white);
}

/* ── Chat panel (fullscreen overlay) ─────────────────────────────────────── */
.chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    background: var(--white);
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: var(--white);
    font-weight: 600;
    font-size: 1.05em;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.4em;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
    opacity: 0.85;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f8fafc;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chat-message-me {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message-them {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-bubble {
    background: var(--primary-color);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 16px 16px 4px 16px;
    font-size: 0.88em;
    word-break: break-word;
    line-height: 1.4;
}

.chat-message-them .chat-bubble {
    background: #e2e8f0;
    color: var(--text-color);
    border-radius: 16px 16px 16px 4px;
}

.chat-time {
    font-size: 0.7em;
    color: #94a3b8;
    margin-top: 2px;
    padding: 0 4px;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-light);
    background: var(--white);
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid var(--border-light);
    border-radius: 20px;
    font-size: 0.88em;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.chat-send-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.88em;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.chat-send-btn:hover {
    background: var(--primary-dark);
}



/* ── Games Library / Browse ───────────────────────────────── */
.games-tab-row {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0;
}

.games-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 10px 18px;
    font-size: 0.92em;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.games-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.games-tab:hover {
    color: var(--primary-color);
}

.games-select {
    padding: 8px 12px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    background: var(--white);
    cursor: pointer;
    transition: border-color 0.2s ease;
    color: var(--text-color);
}

.games-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.games-search-row {
    margin-bottom: 14px;
}

.games-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.92em;
    transition: border-color 0.2s ease;
    color: var(--text-color);
}

.games-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

.games-browse-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.games-browse-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.games-browse-item:hover {
    background: #f0f4ff;
    border-color: #c7d2fe;
}

.games-browse-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.games-browse-title {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.92em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.games-browse-id {
    font-size: 0.76em;
    color: #94a3b8;
    font-family: monospace;
}

.btn-add-game {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--white);
    border: none;
    border-radius: 6px;
    padding: 5px 13px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.btn-add-game:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-dark), #4a43b5);
    transform: translateY(-1px);
}

.btn-add-game.btn-owned {
    background: linear-gradient(135deg, var(--success-color), #16a34a);
    cursor: default;
}

.btn-add-game:disabled {
    opacity: 0.7;
}

.btn-wishlist {
    background: transparent;
    border: 1px solid #f59e0b;
    color: #f59e0b;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1em;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-wishlist:hover:not(:disabled) {
    background: #fef3c7;
}

.btn-wishlist.btn-wishlisted {
    background: #fef3c7;
    border-color: #d97706;
    color: #d97706;
}

.btn-wishlist:disabled {
    opacity: 0.7;
}

.btn-remove-game {
    background: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8em;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.btn-remove-game:hover {
    background: var(--danger-color);
    color: var(--white);
}

.games-list-empty {
    color: #666;
    font-size: 0.95em;
}

.owned-platform-group {
    margin-bottom: 20px;
}

.owned-platform-header {
    color: var(--text-color);
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.owned-platform-header.collapsible {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.owned-platform-header.collapsible::after {
    content: '▶';
    margin-left: auto;
    font-size: 0.7em;
    transition: transform 0.2s;
}

.owned-platform-header.collapsible.expanded::after {
    transform: rotate(90deg);
}

.platform-games-list {
    display: none;
}

.platform-games-list.expanded {
    display: block;
    padding-top: 8px;
}

.games-count-badge {
    background: var(--primary-color);
    color: var(--white);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.76em;
    font-weight: 700;
}

.load-more-wrap {
    text-align: center;
    padding: 12px 0;
}

.load-more-btn {
    font-size: 0.88em;
    padding: 7px 18px;
}

.game-friends-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.76em;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .games-browse-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .btn-add-game,
    .btn-remove-game,
    .btn-wishlist {
        margin-left: 0;
    }
}

/* ── Game cover icon ──────────────────────────────────────── */
.game-cover-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: #fff;
    margin-right: 10px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.game-cover-icon--img {
    background: #1a1a2e;
    overflow: hidden;
    padding: 0;
}

.game-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.games-browse-item.clickable {
    cursor: pointer;
}

.games-browse-item.clickable:hover {
    background: #f0f4ff;
}

/* ── Game detail modal ────────────────────────────────────── */
.game-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}

.game-modal {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.game-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #fff;
}

.game-modal-cover-large {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    background: rgba(255,255,255,0.15);
}

.game-modal-cover-large--img {
    background: #1a1a2e;
    overflow: hidden;
    padding: 0;
}

.game-modal-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
}

.game-modal-title {
    font-size: 1.1em;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.3;
}

.game-modal-platform {
    font-size: 0.8em;
    opacity: 0.8;
    margin: 0;
}

.btn-modal-wishlist {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.45);
    color: #fff;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 1.2em;
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-start;
    transition: all 0.2s ease;
    line-height: 1;
}
.btn-modal-wishlist:hover:not(:disabled) {
    background: rgba(255,255,255,0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}
.btn-modal-wishlist.btn-wishlisted {
    background: rgba(251,191,36,0.2);
    border-color: #fbbf24;
    color: #fbbf24;
}
.btn-modal-wishlist:disabled { opacity: 0.6; }

/* ── Admin Edit button in game detail modal header ─────── */
.btn-modal-edit {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.45);
    color: #fff;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.85em;
    cursor: pointer;
    flex-shrink: 0;
    align-self: flex-start;
    transition: all 0.2s ease;
    line-height: 1.3;
    font-family: inherit;
}
.btn-modal-edit:hover {
    background: rgba(255,255,255,0.15);
    border-color: #93c5fd;
    color: #93c5fd;
}

.game-modal-close {
    margin-left: 6px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.8;
    flex-shrink: 0;
    align-self: flex-start;
}

.game-modal-close:hover { opacity: 1; }

.game-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.game-modal-field {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88em;
}

.game-modal-field:last-child { border-bottom: none; }

.game-modal-field-label {
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
    min-width: 110px;
}

.game-modal-field-value {
    color: var(--text-color);
    text-align: right;
    word-break: break-word;
}

@media (max-width: 480px) {
    .game-modal-field {
        flex-direction: column;
        gap: 2px;
    }
    .game-modal-field-value {
        text-align: left;
    }
}

/* ── Game modal background image gallery ─────────────────── */
.game-modal-bg-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.game-modal-bg-img {
    flex-shrink: 0;
    height: 130px;
    width: auto;
    max-width: 80%;
    border-radius: 6px;
    object-fit: cover;
    scroll-snap-align: start;
    cursor: pointer;
}

/* ── Game modal trailer embed ─────────────────────────────── */
.game-modal-trailer {
    margin-bottom: 16px;
}

.game-modal-trailer-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.88em;
    margin-bottom: 8px;
}

.game-modal-trailer-wrap {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #000;
}

.game-modal-trailer-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: var(--radius-sm);
}

/* ── Game modal friends list ──────────────────────────────── */
.game-modal-friends-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.game-friends-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    width: 100%;
}

.game-friends-list-item {
    display: block;
    padding: 5px 10px;
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.86em;
    font-weight: 500;
    transition: background 0.15s;
}

.game-friends-list-item:hover {
    background: #e0e7ff;
    color: var(--primary-dark);
}


/* ── Online/Offline Status Badge ─────────────────────────── */
.online-badge {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.online-badge.online  { background: var(--success-color); }
.online-badge.offline { background: #94a3b8; }

.friend-status-label {
    font-size: 0.76em;
    color: #94a3b8;
    font-weight: 400;
    margin-left: 4px;
}
.friend-status-label.online { color: var(--success-color); }

/* ── User Count Banner ────────────────────────────────────── */
.user-count-banner {
    display: inline-block;
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid rgba(108, 99, 255, 0.25);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 0.88em;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 8px;
}

/* ── Guest Notice on Games Page ───────────────────────────── */
.guest-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 18px;
    font-size: 0.9em;
    color: #0369a1;
}
.guest-notice a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}
.guest-notice a:hover { text-decoration: underline; }

/* ── Utility ──────────────────────────────────────────────── */
.text-center { text-align: center; }

/* ============================================================
   ADMIN GAME EDIT MODAL
   ============================================================ */

.admin-edit-modal {
    max-width: 660px;
    max-height: 92vh;
}

.admin-form-group {
    margin-bottom: 18px;
}

.admin-form-label {
    display: block;
    font-size: 0.78em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text-color);
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
    font-family: inherit;
}
.admin-form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}

.admin-form-textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

/* Cover image row */
.admin-cover-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.admin-cover-preview {
    width: 80px;
    height: 104px;
    flex-shrink: 0;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    border: 1.5px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 0.78em;
    color: #94a3b8;
    text-align: center;
    padding: 4px;
}

.admin-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: calc(var(--radius-sm) - 2px);
}

/* SteamGridDB inline search row */
.admin-sgdb-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.admin-sgdb-row .admin-form-input { flex: 1; }

/* Image picker grid (SGDB results) */
.admin-img-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}

.admin-img-pick-item {
    width: 80px;
    height: 80px;
    border: 2.5px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, transform 0.1s;
}
.admin-img-pick-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.04);
}
.admin-img-pick-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Background URL rows */
.admin-bg-field {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}
.admin-bg-field .admin-form-input { flex: 1; }

.admin-btn-remove {
    background: none;
    border: 1.5px solid #fca5a5;
    color: #ef4444;
    border-radius: 6px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 0.82em;
    flex-shrink: 0;
    transition: background 0.15s;
    font-family: inherit;
}
.admin-btn-remove:hover { background: #fee2e2; }

/* Outline utility button used throughout edit form */
.admin-btn-outline {
    background: none;
    border: 1.5px solid #cbd5e1;
    color: var(--text-color);
    border-radius: 6px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.83em;
    transition: border-color 0.15s, color 0.15s;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}
.admin-btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* YouTube trailer preview */
.admin-trailer-preview { margin-top: 10px; }

/* Save / Cancel actions row */
.admin-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 0 4px;
    flex-wrap: wrap;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
}

/* Status message inside edit form */
.admin-edit-msg {
    flex: 1;
    font-size: 0.86em;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    min-width: 0;
    word-break: break-word;
}
.admin-edit-msg--success {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}
.admin-edit-msg--error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Mod link button (game modal) */
.btn-mod-link {
    display: inline-block;
    padding: 4px 10px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 6px;
    font-size: 0.82em;
    text-decoration: none;
    margin: 2px 4px 2px 0;
    transition: background 0.15s, border-color 0.15s;
}
.btn-mod-link:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* Mods field value */
.game-modal-mods {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* System specs grid inside game modal */
.game-specs-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-end;
}
.game-specs-col { min-width: 140px; }
.game-specs-col-title {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.game-spec-row {
    display: flex;
    gap: 6px;
    font-size: 0.83em;
    margin-bottom: 2px;
}
.game-spec-key {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 42px;
    flex-shrink: 0;
}
.game-spec-val { color: var(--text-color); }

/* Specs field — allow full-width layout */
.game-modal-specs-field {
    flex-direction: column;
    align-items: flex-start;
}
.game-modal-specs-field .game-modal-field-value {
    text-align: left;
    width: 100%;
    margin-top: 6px;
}

/* Admin edit form: mod link rows */
.admin-mod-field {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

/* Admin edit form: system spec 2×2 grid */
.admin-spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}
@media (max-width: 480px) {
    .admin-spec-grid { grid-template-columns: 1fr; }
    .game-specs-grid { flex-direction: column; }
    .game-modal-mods { justify-content: flex-start; }
}

/* ── Achievement cards ────────────────────────────────────── */
.game-modal-achievements {
    margin-bottom: 16px;
}
.game-modal-achievements-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.88em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ach-count {
    background: var(--primary-color);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.8em;
    font-weight: 700;
}
.ach-loading {
    color: var(--text-muted);
    font-size: 0.88em;
}
/* Legacy grid (kept for compatibility) */
.ach-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
/* Swipeable carousel */
.ach-carousel-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ach-carousel {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    padding-bottom: 4px;
}
.ach-carousel::-webkit-scrollbar { display: none; }
.ach-nav {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.3em;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.ach-nav:hover { opacity: 1; }
.ach-card {
    position: relative;
    width: 110px;
    height: 110px;
    border-radius: var(--radius-sm);
    background-color: #1e293b;
    background-size: cover;
    background-position: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
    scroll-snap-align: start;
}
.ach-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
    z-index: 1;
}
.ach-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.82));
    padding: 6px 6px 5px;
}
.ach-card-name {
    font-size: 0.72em;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ach-card-desc {
    font-size: 0.65em;
    color: rgba(255,255,255,0.75);
    line-height: 1.2;
    margin-top: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* "Add Achievement" button in label */
.ach-add-btn {
    margin-left: auto;
    background: none;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ach-add-btn:hover {
    background: var(--primary-color);
    color: #fff;
}
/* Inline "Add Achievement" form */
.ach-add-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ach-add-input {
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.88em;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}
.ach-add-input:focus { border-color: var(--primary-color); }
.ach-add-save, .ach-add-cancel {
    padding: 6px 16px;
    border: none;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
}
.ach-add-save { background: var(--primary-color); color: #fff; }
.ach-add-save:hover { opacity: 0.9; }
.ach-add-cancel { background: #e2e8f0; color: #475569; }
.ach-add-cancel:hover { background: #cbd5e1; }
@media (max-width: 480px) {
    .ach-card { width: 90px; height: 90px; }
    .ach-nav { width: 24px; height: 24px; font-size: 1.1em; }
}
/* ── Achievement detail popup ─────────────────────────────── */
.ach-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(2px);
}
.ach-detail-popup {
    background: #1e293b;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    max-width: 340px;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #fff;
}
.ach-detail-img {
    width: 100%;
    height: 160px;
    background-color: #0f172a;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4em;
}
.ach-detail-body {
    padding: 16px;
}
.ach-detail-name {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 8px;
}
.ach-detail-desc {
    font-size: 0.88em;
    color: rgba(255,255,255,0.75);
    line-height: 1.5;
}
.ach-detail-close {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.ach-detail-close:hover { background: rgba(255,255,255,0.2); }

