/* JUZKO LIBRARY - Unified with Sto_style minimalist layout */
:root {
    /* Colors - Matched with Sto_style */
    --bg-dark: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #1f242c;
    --bg-badge: #21262d;

    --primary: #58a6ff;
    --primary-glow: rgba(88, 166, 255, 0.15);
    --accent: #58a6ff;

    --text-main: #f0f6fc;
    --text-muted: #8b949e;
    --border: #30363d;

    /* Platform Colors */
    --ps-blue: #3b6ea5;
    --xbox-green: #4a8c4a;
    --switch-red: #a84040;
    --pc-white: #a0a0a5;

    /* Status Colors */
    --success: #4ade80;
    --danger: #f87171;
    --warning: #f7b955;

    /* Typography - SYSTEM UI from Sto_style */
    --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Sizing - Flattened to match Sto_style */
    --border-radius: 0px;
    --border-radius-sm: 0px;
    --container-width: 1400px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === AUTH SCREEN === */
.auth-container {
    width: 100%;
    max-width: 380px;
    text-align: center;
    padding: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 25px;
    color: var(--text-main);
}

.logo span {
    color: var(--primary);
}

.logo sub {
    font-size: 12px;
    background: none;
    -webkit-text-fill-color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 1px;
}

.auth-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.auth-box h2 {
    margin: 0 0 20px 0;
    font-weight: 500;
    color: var(--text-main);
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input,
select,
textarea {
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    padding: 12px 15px;
    color: var(--text-main);
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-size: 14px;
    transition: border-color 0.2s ease;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

select {
    cursor: pointer;
}

select option {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 10px;
}

button {
    background: var(--primary);
    border: none;
    padding: 0.75rem;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--border-radius);
    text-transform: uppercase;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

button:hover {
    background: var(--primary-hover);
}

button.secondary {
    background: var(--bg-badge);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

button.secondary:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.switch-link {
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 20px;
    transition: color 0.2s;
}

.switch-link:hover {
    color: var(--primary);
}

/* === APP LAYOUT === */
.app-layout {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    padding: 2rem;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-dark);
}

/* === MODULE BAR (Wallet + Actions - below unified topbar) === */
.header.module-bar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: auto;
    padding: 0.5rem 2rem;
    position: sticky;
    top: 48px;
    /* Below unified topbar */
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header.module-bar .header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* .logo styles removed — handled by shared topbar */

.logo-icon {
    font-size: 1.5rem;
}

.module-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.wallet-display {
    display: flex;
    gap: 10px;
}

.token-pill {
    background: var(--bg-badge);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.token-pill.base {
    color: var(--primary);
}

.token-pill.bank {
    color: var(--warning);
}

.header-icon-btn {
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    padding: 4px;
    background: none;
    border: none;
    cursor: pointer;
}

.header-icon-btn:hover {
    color: var(--text-main);
}

.user-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.user-profile-link:hover .user-name {
    color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.user-avatar-placeholder {
    background: var(--bg-badge);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    width: 32px;
    height: 32px;
}

.user-name {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* === CONTROLS & FILTERS === */
.controls-bar {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.admin-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.action-btn {
    font-size: 13px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-badge);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.action-btn:hover {
    color: var(--text-main);
    border-color: var(--text-main);
    background-color: var(--bg-hover);
}

.filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.search-wrapper {
    flex: 2;
    min-width: 180px;
    box-sizing: border-box;
}

.search-box {
    background-color: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 8px 15px;
    font-size: 12px;
    width: 100%;
    color: var(--text-main);
    box-sizing: border-box;
}

.search-box:focus {
    border-color: var(--primary);
}

.platform-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.platform-tab {
    background: var(--bg-badge);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-weight: 500;
}

.platform-tab:hover {
    color: var(--text-main);
    background-color: var(--bg-hover);
}

.platform-tab.active {
    background: var(--bg-badge);
    color: var(--text-main);
    font-weight: 600;
    border-color: var(--primary);
}

.platform-tab[data-platform="PS5"].active,
.platform-tab[data-platform="PS4"].active {
    border-color: var(--ps-blue);
    color: var(--ps-blue);
}

.platform-tab[data-platform="XBOX"].active {
    border-color: var(--xbox-green);
    color: var(--xbox-green);
}

.platform-tab[data-platform="SWITCH"].active {
    border-color: var(--switch-red);
    color: var(--switch-red);
}

.sort-select {
    width: auto;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    font-size: 12px;
    border-radius: var(--border-radius);
}

/* === GAME GRID === */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding-bottom: 60px;
    max-width: var(--container-width);
    margin: 0 auto;
}

.game-card {
    background-color: transparent;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.game-card:hover {
    border-color: var(--primary);
    z-index: 1;
}

.game-cover {
    width: 100%;
    aspect-ratio: 1/1;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: filter 0.2s ease;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.5));
}

.game-cover picture,
.game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
}

.game-card:hover .game-cover {
    filter: brightness(1.1);
}

.game-info {
    padding: 0.5rem 0.75rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.platform-badge {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    color: var(--text-main);
}

.platform-badge i {
    opacity: 0.7;
    font-size: 0.8rem;
}

.game-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.6em;
    line-height: 1.3;
    white-space: normal;
}

.card-footer-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.25rem;
}

.card-footer-inline .buy-btn {
    width: auto;
    margin: 0;
    padding: 4px 8px;
}

.buy-btn {
    background-color: var(--bg-badge);
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.buy-btn:hover:not(.disabled) {
    color: var(--text-main);
    border-color: var(--text-main);
    background-color: var(--bg-hover);
}

.buy-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--text-muted);
}

.buy-btn.return-btn {
    color: var(--warning);
    border-color: var(--warning);
}

.buy-btn.return-btn:hover {
    background-color: var(--warning);
    color: var(--bg-dark);
}

.buy-btn.elite-key-btn {
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.08);
    font-weight: 700;
}

.buy-btn.elite-key-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.buy-btn.admin-reset-btn {
    color: var(--danger);
    border-color: var(--danger);
}

.stock-status {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.status-available {
    color: var(--success);
}

.status-borrowed {
    color: var(--danger);
}

.status-cooldown {
    color: var(--warning);
}

/* === KEYSHOP-MATCHED CARD ELEMENTS === */
.status-row {
    margin-top: 2px;
    margin-bottom: 0;
}

.price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--warning);
    white-space: nowrap;
}

.price-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.owner-tag {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 0;
}

.owner-tag:hover {
    color: var(--primary);
}

.card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    border-top: 1px solid var(--border);
    padding-top: 4px;
}

.card-action-btn {
    flex: 1;
    padding: 6px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    background: var(--bg-badge);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.card-action-btn:hover {
    color: var(--text-main);
    border-color: var(--text-main);
    background: var(--bg-hover);
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    text-align: center;
    color: var(--text-main);
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-lg {
    max-width: 800px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

/* --- RENT DURATION PICKER (Sesja 6) --- */
.rent-picker .rent-picker-body { margin-top: 1rem; }
.rent-picker .rent-days-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 6px;
}
.rent-picker .rent-step-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.rent-picker .rent-step-btn:hover { background: rgba(255,255,255,0.05); }
.rent-picker .rent-step-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.rent-picker #rent-days-input {
    width: 70px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-main);
    -moz-appearance: textfield;
}
.rent-picker #rent-days-input::-webkit-outer-spin-button,
.rent-picker #rent-days-input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.rent-picker .rent-days-suffix { opacity: 0.75; font-size: 14px; }
.rent-picker .rent-bounds {
    text-align: center;
    font-size: 12px;
    opacity: 0.65;
    margin-bottom: 14px;
}
.rent-picker .rent-preview {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}
.rent-picker .rent-preview-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.rent-picker .rent-preview-row + .rent-preview-row { border-top: 1px dashed rgba(255,255,255,0.08); }
.rent-picker .rent-preview-row strong { color: var(--text-main); }
.rent-picker .rent-preview-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255,255,255,0.08);
    font-size: 12px;
    opacity: 0.7;
    text-align: center;
}

/* iOS Safari auto-zoom workaround (early-access tester report #3).
   Safari triggers an automatic zoom on focus into any input whose computed
   font-size is below 16px — the page then has to be pinch-shrunk back. The
   global input style above is 14px (linia ~119), which trips this for every
   modal (rent picker, add/edit game, confirm dialogs, etc.). Bumping to 16px
   only on small viewports keeps desktop typography unchanged while removing
   the zoom dance on phones. Applies to all .modal descendants so we don't
   have to maintain a per-modal allowlist. */
@media (max-width: 768px) {
    .modal input,
    .modal select,
    .modal textarea {
        font-size: 16px;
    }
}

.modal-lg #admin-stats-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

/* === STATS / ADMIN === */
.stat-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.pending-codes {
    background: var(--bg-dark);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-top: 20px;
    border: 1px solid var(--border);
}

.invite-code {
    background: var(--bg-badge);
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.invite-code:hover {
    background: var(--primary);
    color: #fff;
}

.owner-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.owner-link:hover {
    text-decoration: underline;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: var(--text-main);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* === HISTORY PANEL (fullscreen overlay, card-based, mobile-first) === */
.hist-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hist-overlay.hidden {
    display: none !important;
}

.hist-panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: var(--bg-card);
}

@media (min-width: 600px) {
    .hist-panel {
        max-width: 560px;
        max-height: 80vh;
        height: auto;
        border: 1px solid var(--border);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    }

    .hist-list {
        min-height: 300px;
    }
}

.hist-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.hist-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.hist-back:hover {
    color: var(--text-main);
    border-color: var(--text-main);
}

.hist-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.hist-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.hist-tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s, border-color 0.15s;
}

.hist-tab:hover {
    color: var(--text-main);
}

.hist-tab.active {
    color: var(--text-main);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.hist-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px 24px;
}

/* --- Transaction card --- */
.hist-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.hist-card:last-child {
    border-bottom: none;
}

.hist-card-body {
    flex: 1;
    min-width: 0;
}

.hist-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    word-break: break-word;
}

.hist-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.hist-card-meta span {
    white-space: nowrap;
}

.hist-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.hist-cost {
    font-size: 14px;
    font-weight: 700;
    color: var(--warning);
    white-space: nowrap;
}

.hist-status {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.hist-status.returned { color: var(--text-muted); }
.hist-status.active   { color: var(--success); }

.hist-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}

.rating-stars {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    gap: 5px;
    margin: 20px 0;
}

.rating-stars input {
    display: none;
}

.rating-stars label {
    font-size: 32px;
    color: var(--border);
    cursor: pointer;
    transition: color 0.2s;
}

.rating-stars label:hover,
.rating-stars label:hover~label,
.rating-stars input:checked~label {
    color: var(--warning);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.invite-msg {
    background: var(--bg-badge);
    border: 1px solid var(--border);
    color: var(--primary);
    padding: 15px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-family: monospace;
    font-size: 16px;
}

.msg-area {
    margin-top: 20px;
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.contact-link-modal {
    display: inline-block;
    background-color: var(--primary);
    color: #fff;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    margin-top: 10px;
}

.contact-link-modal:hover {
    background-color: var(--primary-hover);
}

/* === PROFILE CARD (Flattened) === */
.profile-card {
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--bg-badge);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 auto 15px;
}

.profile-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.profile-rating {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.profile-rating .rating-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--warning);
}

.profile-rating .rating-stars {
    color: var(--warning);
}

.profile-rating .rating-count {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-stats {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
}

.profile-stats .stat {
    text-align: center;
}

.profile-stats .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.profile-stats .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.profile-contact {
    margin: 15px 0;
}

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

/* (old .history-table removed — replaced by .hist-card in history panel section) */

/* === FEEDBACK ITEMS === */
.feedback-section {
    margin-top: 20px;
    text-align: left;
}

.feedback-item {
    background: var(--bg-dark);
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid var(--warning);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.fb-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.fb-stars {
    color: var(--warning);
}

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

.fb-comment {
    margin: 5px 0;
    color: var(--text-main);
}

.fb-from {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}

.no-feedback {
    color: var(--text-muted);
    font-style: italic;
}

.error,
.error-state {
    color: var(--danger);
    text-align: center;
    padding: 30px;
}

.empty,
.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
    font-style: italic;
}

/* === RECENT ACTIVITY === */
.recent-activity {
    margin-top: 20px;
    text-align: left;
}

.recent-activity h4 {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.recent-activity ul {
    list-style: none;
}

.recent-activity li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.stat-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 5px;
}

.stat-sub .available {
    color: var(--success);
}

.stat-sub .borrowed {
    color: var(--danger);
}

.stat-sub .cooldown {
    color: var(--warning);
}

.admin-reset-btn {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
}

.admin-reset-btn:hover {
    background: var(--danger) !important;
    color: #fff !important;
}

.profile-contact a {
    display: inline-block;
    background: var(--bg-badge);
    color: var(--primary);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: 1px solid var(--border);
}

.profile-contact a:hover {
    background: var(--primary);
    color: #fff;
}

/* === PROFILE DRAWER (Allegro/eBay Style) === */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.7);
    z-index: 9998;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.drawer-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.profile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 450px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.profile-drawer.closed {
    transform: translateX(100%);
}

.drawer-close-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background: var(--bg-badge);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s;
}

.drawer-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
    border-color: var(--text-main);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border) var(--bg-dark);
}

/* Header Section */
.drawer-header-section {
    padding: 60px 20px 20px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-dark);
}

.drawer-avatar-box {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: var(--bg-badge);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 10px;
}

.drawer-rank-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.drawer-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-username {
    font-size: 1.4rem;
    color: var(--text-main);
    font-weight: 700;
}

.drawer-joined {
    font-size: 13px;
    color: var(--text-muted);
}

.drawer-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-badge);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-left: 10px;
    vertical-align: middle;
}

.rank-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* Rating Summary */
.drawer-rating-summary {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    border-bottom: 1px solid var(--border);
}

.drawer-rating-score {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.drawer-score-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.drawer-score-max {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 600;
}

.drawer-rating-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.drawer-rating-stars {
    color: var(--warning);
    font-size: 16px;
    letter-spacing: 2px;
}

.drawer-rating-text {
    font-size: 13px;
    color: var(--text-muted);
}

/* Stats */
.drawer-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--border);
}

.drawer-stat-box {
    padding: 15px 10px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.drawer-stat-box:last-child {
    border-right: none;
}

.drawer-stat-num {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
}

.drawer-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Contact Action */
.drawer-contact-action {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.drawer-contact-btn {
    width: 100%;
    padding: 12px;
    text-align: center;
    background: var(--bg-badge);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.drawer-contact-btn:hover:not(.disabled) {
    background: var(--bg-hover);
    border-color: var(--text-main);
    color: var(--text-main);
}

.drawer-contact-btn.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Feedback Section eBay style */
.drawer-feedback-section {
    padding: 20px;
}

.drawer-feedback-section h4 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drawer-feedback-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.drawer-feedback-item {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.drawer-feedback-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.drawer-fb-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.drawer-fb-stars {
    color: var(--warning);
    font-size: 13px;
}

.drawer-fb-date {
    font-size: 12px;
    color: var(--text-muted);
}

.drawer-fb-comment {
    font-size: 14px;
    color: var(--text-main);
    line-height: 1.4;
    margin-bottom: 5px;
    font-style: italic;
}

.drawer-fb-game {
    font-size: 12px;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 2px;
}

.drawer-fb-user {
    font-size: 12px;
    color: var(--text-muted);
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }

    .filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .platform-tabs {
        justify-content: center;
    }

    .platform-tab {
        flex: 0 1 auto;
        text-align: center;
        padding: 8px 10px;
    }

    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .card-info {
        padding: 0.5rem;
    }

    .card-info h3 {
        font-size: 0.85rem;
    }

    .details {
        font-size: 0.7rem;
    }

    .rent-btn {
        padding: 4px;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .filter-bar {
        gap: 8px;
    }

    .sort-wrapper,
    .limit-wrapper {
        min-width: 80px;
    }

    .sort-select {
        font-size: 12px;
        padding: 6px 8px;
    }

    .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .wallet-display {
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }

    .token-pill {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    .controls-bar {
        justify-content: center;
    }

    .controls-bar button {
        width: 100%;
        justify-content: center;
    }

    .profile-drawer {
        width: 100%;
    }
}

/* === BUNDLE & LOCKED CARDS LOGIC === */
.status-locked {
    color: var(--text-muted);
}

.bundle-badge {
    background-color: var(--bg-badge);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 5px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

/* Wizualne "zgaszenie" okładki gdy inna gra z paczki jest używana */
.game-card.locked-card .game-cover {
    filter: grayscale(80%) brightness(0.6);
    opacity: 0.7;
}

.game-card.locked-card:hover .game-cover {
    filter: grayscale(50%) brightness(0.8);
}

/* === PAGINATION === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 3rem 0;
    flex-wrap: wrap;
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.page-btn {
    background: var(--bg-badge);
    border: 1px solid var(--border);
    color: var(--text-muted);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.page-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
    background: var(--bg-card-hover);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-dots {
    color: var(--text-muted);
    padding: 0 5px;
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }

    .search-wrapper {
        width: 100%;
        flex: none;
        min-width: 0;
    }

    .platform-tabs {
        width: 100%;
        flex: none;
    }

    .sort-wrapper,
    .limit-wrapper {
        flex: 1 1 0;
        min-width: 100px;
    }

    .sort-wrapper .sort-select,
    .limit-wrapper .sort-select {
        width: 100%;
        box-sizing: border-box;
    }

    .pagination {
        gap: 5px;
    }

    .page-btn {
        min-width: 35px;
        height: 35px;
        font-size: 12px;
    }
}
/* ==================== Scroll lock when any modal is open ====================
   Pure CSS — no JS hooks to maintain. Catches every overlay class used in
   the library (modal-overlay, hist-overlay, drawer-overlay), so any modal
   or panel that toggles `.hidden` automatically locks page scroll behind it.

   :has() support: Chrome 105+, Safari 15.4+, Firefox 121+ (Dec 2023). For
   older browsers we fall back to per-modal JS overflow toggles that already
   exist in app.js (openHistoryModal, openProfileDrawer, etc.) — they remain
   in place so nothing breaks.
   =============================================================================*/
body:has(.modal-overlay:not(.hidden)),
body:has(.hist-overlay:not(.hidden)),
body:has(.drawer-overlay:not(.hidden)) {
    overflow: hidden;
}
