/* ============ ACCESS DENIED SCREEN ============ */
.denied-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}
.denied-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: deniedPulse 2s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.2);
}
.denied-icon {
    font-size: 48px;
}
.denied-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}
.denied-subtitle {
    font-size: 14px;
    color: var(--text3);
    margin-bottom: 20px;
    max-width: 300px;
    line-height: 1.5;
}
.denied-footer {
    font-size: 12px;
    color: var(--text3);
    padding: 10px 20px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
}
.denied-footer span {
    color: var(--accent-glow);
    font-weight: 600;
}
@keyframes deniedPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 0 60px rgba(239, 68, 68, 0.4); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


:root {
    --bg: #07071a;
    --surface: #0f0f2a;
    --surface2: #181835;
    --border: #252545;
    --border-light: #333358;
    --accent: #7c3aed;
    --accent-glow: #a78bfa;
    --gold: #f59e0b;
    --gold-glow: #fbbf24;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --text3: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Loader */
.loader {
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    height:100vh;
    gap:16px;
    color:var(--text2);
    font-size:14px;
}
.loader-ring {
    width:40px;height:40px;
    border:3px solid var(--border);
    border-top-color:var(--accent);
    border-radius:50%;
    animation:spin 0.8s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg);} }

/* Header */
.app-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:12px 16px;
    background:var(--surface);
    border-bottom:1px solid var(--border);
    position:sticky;
    top:0;
    z-index:100;
    backdrop-filter:blur(20px);
}
.header-left {
    display:flex;
    align-items:center;
    gap:10px;
}
.header-logo {
    font-size:24px;
    font-weight:800;
    background:linear-gradient(135deg, var(--accent-glow), var(--gold));
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}
.header-right {
    display:flex;
    align-items:center;
    gap:8px;
    cursor:pointer;
}
.user-avatar {
    width:34px;height:34px;
    border-radius:50%;
    background:var(--surface2);
    border:2px solid var(--border-light);
    display:flex;
    align-items:center;
    justify-content:center;
    font-weight:700;
    font-size:14px;
    color:var(--accent-glow);
    overflow:hidden;
}
.user-avatar img {
    width:100%;height:100%;
    object-fit:cover;
}
.user-name {
    font-size:13px;
    font-weight:600;
    color:var(--text);
    max-width:100px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.premium-dot {
    width:8px;height:8px;
    border-radius:50%;
    background:var(--gold);
    box-shadow:0 0 8px var(--gold-glow);
    display:none;
}
.premium-dot.active { display:block; }

/* Navigation */
.nav-tabs {
    display:flex;
    gap:0;
    padding:0 16px;
    background:var(--surface);
    border-bottom:1px solid var(--border);
    position:sticky;
    top:58px;
    z-index:99;
}
.nav-tab {
    flex:1;
    padding:12px;
    text-align:center;
    font-size:13px;
    font-weight:600;
    color:var(--text3);
    cursor:pointer;
    border-bottom:2px solid transparent;
    transition:0.2s;
}
.nav-tab.active {
    color:var(--accent-glow);
    border-bottom-color:var(--accent);
}

/* Card Grid */
.card-grid {
    display:grid;
    grid-template-columns:repeat(2, 1fr);
    gap:12px;
    padding:16px;
    max-width:500px;
    margin:0 auto;
    padding-bottom:100px;
}

/* Card Preview */
.card-preview {
    aspect-ratio:1;
    border-radius:var(--radius);
    overflow:hidden;
    cursor:pointer;
    transition:all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border:1px solid var(--border);
    background:var(--surface);
    position:relative;
}
.card-preview:active {
    transform:scale(0.95);
}
.card-preview .preview-thumb {
    width:100%;height:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:48px;
    position:relative;
}
.card-preview .preview-thumb-bg {
    position:absolute;
    inset:0;
    z-index:0;
}
.card-preview .preview-thumb-icon {
    position:relative;
    z-index:1;
    filter:drop-shadow(0 4px 12px rgba(0,0,0,0.5));
}
.card-preview .preview-info {
    position:absolute;
    bottom:0;left:0;right:0;
    background:linear-gradient(transparent, rgba(0,0,0,0.85));
    padding:20px 10px 10px;
    z-index:2;
}
.card-preview .preview-name {
    font-size:12px;
    font-weight:700;
    color:#fff;
}
.card-preview .preview-price {
    font-size:11px;
    color:var(--gold);
    font-weight:600;
}
.card-preview .pos-badge {
    position:absolute;
    top:8px;left:8px;
    background:rgba(0,0,0,0.7);
    color:var(--text2);
    width:22px;height:22px;
    border-radius:50%;
    font-size:10px;
    font-weight:700;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:3;
    border:1px solid var(--border-light);
}
.card-preview.sold-out .preview-thumb {
    opacity:0.3;
}
.card-preview.sold-out::after {
    content:'SOLD';
    position:absolute;
    top:50%;left:50%;
    transform:translate(-50%,-50%) rotate(-25deg);
    font-size:32px;
    font-weight:900;
    color:var(--danger);
    border:3px solid var(--danger);
    padding:6px 18px;
    border-radius:6px;
    opacity:0.7;
    z-index:4;
}

/* Card Detail */
.card-detail {
    max-width:500px;
    margin:0 auto;
    padding:16px;
}
.card-display {
    width:100%;
    aspect-ratio:1;
    border-radius:20px;
    overflow:hidden;
    border:2px solid var(--border);
    margin-bottom:20px;
    position:relative;
}
.card-display iframe {
    width:100%;height:100%;
    border:none;
    pointer-events:none;
}
.card-display .locked-overlay {
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.7);
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    z-index:2;
    backdrop-filter:blur(8px);
}
.locked-overlay .lock-icon {
    font-size:56px;
    margin-bottom:12px;
}
.locked-overlay .lock-text {
    font-size:16px;
    font-weight:600;
    color:#fff;
    text-align:center;
}
.detail-meta {
    text-align:center;
}
.detail-position {
    font-size:12px;
    color:var(--text3);
    text-transform:uppercase;
    letter-spacing:2px;
    margin-bottom:4px;
}
.detail-name {
    font-size:28px;
    font-weight:800;
    margin-bottom:8px;
    background:linear-gradient(135deg, #fff, var(--text2));
    -webkit-background-clip:text;
    -webkit-text-fill-color:transparent;
    background-clip:text;
}
.detail-tags {
    display:flex;
    gap:6px;
    justify-content:center;
    margin-bottom:16px;
    flex-wrap:wrap;
}
.detail-tag {
    padding:4px 12px;
    border-radius:20px;
    font-size:11px;
    font-weight:600;
    background:var(--surface2);
    color:var(--text2);
    border:1px solid var(--border-light);
}
.detail-price-row {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:8px;
    margin-bottom:20px;
}
.detail-price {
    font-size:32px;
    font-weight:900;
    color:var(--gold);
    display:flex;
    align-items:center;
    gap:4px;
}
.detail-price .star-icon {
    font-size:24px;
}
.buy-btn {
    width:100%;
    padding:16px;
    border-radius:var(--radius);
    border:none;
    font-size:17px;
    font-weight:700;
    cursor:pointer;
    transition:all 0.3s;
    letter-spacing:0.5px;
}
.buy-btn.primary {
    background:linear-gradient(135deg, var(--accent), #6d28d9);
    color:#fff;
    box-shadow:0 4px 20px rgba(124,58,237,0.3);
}
.buy-btn.primary:active {
    transform:scale(0.97);
}
.buy-btn.sold-out-btn {
    background:var(--surface2);
    color:var(--text3);
    cursor:not-allowed;
}
.buy-btn.owned-btn {
    background:var(--success);
    color:#000;
    cursor:default;
}

/* Collection */
.collection-grid {
    display:grid;
    grid-template-columns:repeat(2, 1fr);
    gap:12px;
    padding:16px;
    max-width:500px;
    margin:0 auto;
}
.empty-state {
    text-align:center;
    padding:60px 20px;
    color:var(--text3);
}
.empty-state .empty-icon {
    font-size:56px;
    margin-bottom:12px;
}
.empty-state .empty-text {
    font-size:16px;
    font-weight:600;
    color:var(--text2);
    margin-bottom:4px;
}

/* Toast */
.toast {
    position:fixed;
    top:20px;
    left:50%;
    transform:translateX(-50%);
    padding:12px 20px;
    border-radius:30px;
    font-weight:600;
    font-size:14px;
    z-index:9999;
    animation:toastIn 0.3s ease;
    box-shadow:var(--shadow);
}
.toast.success { background:var(--success); color:#000; }
.toast.error { background:var(--danger); color:#fff; }
@keyframes toastIn {
    from{opacity:0;transform:translateX(-50%) translateY(-20px);}
    to{opacity:1;transform:translateX(-50%) translateY(0);}
}

/* Scrollbar */
::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:10px; }

/* Bottom safe area for mobile */
@media (max-width:480px) {
    .card-grid, .collection-grid {
        padding-bottom:120px;
    }
}
