:root {
    --bg-dark: #121212;
    --window-bg: #e8dbc3;
    --sidebar-bg: #dccaa5;
    --border-color: #4a3b2a;
    --gold-accent: #b89548;
    --ink: #2b2018;
    --ink-muted: #665243;
    
    /* Tab Colors */
    --tab-bg: #3d2f24; 
    --tab-text: #a89582;
    --tab-hover: #4f3d2f;
    
    /* Rarity Colors */
    --r-all: #555555;        /* Neutral Grey for All */
    --r-common: #a0a0a0;     /* Grey */
    --r-uncommon: #3bd26f;   /* Green */
    --r-rare: #0070dd;       /* Blue */
    --r-epic: #a335ee;       /* Purple */
    --r-legendary: #ff8000;  /* Orange */

    --font-title: "Cinzel", serif;
    --font-body: "Lato", sans-serif;
}

body {
    margin: 0;
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at center, #1f1f1f 0%, #050505 100%);
    color: var(--ink);
    font-family: var(--font-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

/* --- LAYOUT ANCHOR --- */
.layout-anchor {
    position: relative;
    width: 1200px;
    height: calc(94vh - 73px);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px auto 0;
}

/* --- MAIN FRAME --- */
.main-window {
    width: 100%;
    height: 100%;
    background: var(--window-bg);
    border: 6px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 
        0 0 0 2px #2a2118,
        0 30px 80px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    position: relative; 
    z-index: 20; 
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.7" numOctaves="3" stitchTiles="stitch"/></filter><rect width="200" height="200" filter="url(%23n)" opacity="0.04"/></svg>');
}

/* --- LEFT SIDE TABS --- */
.side-tabs-container {
    position: absolute;
    left: 0;
    top: 60px;
    width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.side-tab {
    position: relative;
    width: 190px;
    height: 48px;
    background: var(--tab-bg);
    color: var(--tab-text);
    font-family: var(--font-title);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 12px;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 8px 0 0 8px;
    border: 1px solid #2a2118;
    box-shadow: -4px 4px 10px rgba(0,0,0,0.5);
    left: -55px; 
    transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1), background 0.2s;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
}

.side-tab-icon {
    font-size: 1.4rem;
    min-width: 35px;
    text-align: center;
    margin-right: 12px;
    z-index: 2;
}

.side-tab-label {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    transform: translateX(-10px);
}

.side-tab:hover {
    left: -180px; 
    background-color: var(--tab-hover);
    color: #dccaa5;
}

.side-tab:hover .side-tab-label {
    opacity: 1;
    transform: translateX(0);
}

.side-tab.active {
    left: -180px;
    background: var(--tab-hover);
    color: #fff;
    box-shadow: -2px 2px 15px rgba(0,0,0,0.6);
    border-right: 1px solid var(--tab-hover);
}

.side-tab.active .side-tab-label {
    opacity: 1;
    font-weight: 700;
    color: var(--gold-accent);
}

/* --- RIGHT SIDE TABS --- */
.right-tabs-container {
    position: absolute;
    right: 0; 
    bottom: 60px; 
    width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10; 
    align-items: flex-end; 
}

.user-tab {
    position: relative;
    width: 220px;
    height: 56px;
    background: var(--tab-bg);
    color: var(--tab-text);
    font-family: var(--font-title);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    padding-right: 8px;
    box-sizing: border-box;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    border: 1px solid #2a2118;
    border-left: none; 
    box-shadow: 4px 4px 10px rgba(0,0,0,0.5);
    right: -66px; 
    transition: right 0.3s cubic-bezier(0.25, 1, 0.5, 1), background 0.2s;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
}

.user-tab-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--gold-accent);
    margin-left: 18px;
    object-fit: cover;
    background: #000;
    z-index: 2;
}

.user-tab-label {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    transform: translateX(10px);
    text-align: right;
    font-weight: 600;
}

.user-tab:hover {
    right: -210px; 
    background-color: var(--tab-hover);
    color: #dccaa5;
}

.user-tab:hover .user-tab-label {
    opacity: 1;
    transform: translateX(0);
}

.user-tab.active {
    right: -210px;
    background: var(--tab-hover);
    color: #fff;
    box-shadow: 2px 2px 15px rgba(0,0,0,0.6);
    border-left: 1px solid var(--tab-hover);
}

.user-tab.active .user-tab-label {
    opacity: 1;
    font-weight: 700;
    color: var(--gold-accent);
}

/* --- INTERNAL SIDEBAR --- */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 2px solid rgba(74, 59, 42, 0.2);
    display: flex;
    flex-direction: column;
    box-shadow: inset -5px 0 15px rgba(0,0,0,0.03);
    padding: 25px;
    height: 100%;
    box-sizing: border-box;
}

.sidebar-header {
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--ink);
    border-bottom: 2px solid var(--gold-accent);
    padding-bottom: 5px;
    margin-bottom: 15px;
    margin-top: 10px;
}

.search-container { margin-bottom: 20px; }

.vintage-input {
    width: 100%;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(61, 43, 31, 0.3);
    padding: 10px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
}

/* --- RARITY ICONS --- */
.rarity-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 5px;
}

.rarity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.4), 0 2px 4px rgba(0,0,0,0.2);
}

.rarity-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255,255,255,0.6);
    z-index: 2;
}

/* ACTIVE STATE FOR RARITY ICONS */
.rarity-icon.active {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255,255,255,0.8), inset 0 0 10px rgba(255,255,255,0.5);
    transform: scale(1.15);
    z-index: 5;
}

.rarity-icon svg { width: 16px; height: 16px; opacity: 0.7; fill: rgba(0,0,0,0.5); }

.r-all { background: var(--r-all); }
.r-common { background: var(--r-common); }
.r-uncommon { background: var(--r-uncommon); }
.r-rare { background: var(--r-rare); }
.r-epic { background: var(--r-epic); }
.r-legendary { background: var(--r-legendary); }

.category-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.category-list::-webkit-scrollbar { width: 6px; }
.category-list::-webkit-scrollbar-track { background: transparent; }
.category-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius:3px; }

.cat-item {
    padding: 10px 12px;
    margin-bottom: 3px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--ink-muted);
    border-radius: 4px;
    transition: 0.1s;
}

.cat-item:hover {
    background: rgba(255,255,255,0.3);
    color: var(--ink);
}

.cat-item.active {
    background: rgba(184, 149, 72, 0.25);
    color: #2b1b00;
    font-weight: 700;
    border-left: 3px solid var(--gold-accent);
}

/* --- RIGHT CONTENT AREA --- */
.content-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.content-header {
    padding: 40px 50px 20px 50px;
    border-bottom: 2px solid rgba(74, 59, 42, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    background: rgba(255,255,255,0.1);
}

.content-header h1 {
    font-family: var(--font-title);
    margin: 0;
    font-size: 2.4rem;
    color: #2b1b00;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

.stats-display {
    font-size: 1rem;
    color: var(--ink-muted);
    text-align: right;
}
.points-total {
    font-family: var(--font-title);
    font-size: 1.6rem;
    color: var(--ink);
    font-weight: 700;
    display: block;
}

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px 50px;
}

.scroll-container::-webkit-scrollbar { width: 10px; }
.scroll-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
.scroll-container::-webkit-scrollbar-thumb { 
    background: #c4b08b; 
    border: 2px solid var(--window-bg); 
    border-radius: 6px; 
}

/* --- ACHIEVEMENT CARD STYLES --- */
.ach-card {
    display: flex;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 12px;
    padding: 15px;
    border-radius: 4px;
    align-items: center;
    position: relative;
}
.ach-card:hover {
    background: rgba(255,255,255,0.7);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.ach-card.earned {
    background: linear-gradient(to right, rgba(79, 143, 0, 0.05), rgba(0,0,0,0));
    border-left: 4px solid #4f8f00;
}

/* Icon Border Dynamic via inline style */
.ach-icon {
    width: 52px;
    height: 52px;
    background: #2a2118;
    border: 3px solid #444; /* Default override by inline style */
    margin-right: 20px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}
.ach-icon img { width: 100%; height: 100%; object-fit: cover; }

.ach-info { flex: 1; }
.ach-title { font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; color: #2b1b00; }
.ach-desc { font-size: 0.95rem; color: var(--ink-muted); margin-top: 4px; }

/* New Right Side Layout */
.ach-meta { 
    text-align: center; 
    min-width: 110px; 
    margin-left: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* POINT SHAPE (Diamond/Rhombus) */
.point-shape {
    width: 36px;
    height: 36px;
    background: #2a2118;
    border: 2px solid #555;
    color: #fff;
    transform: rotate(45deg); /* Diamond shape */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: all 0.3s;
}

/* Counter-rotate text so it's straight */
.point-shape span {
    transform: rotate(-45deg);
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 0.9rem;
}

/* GLOW VARIATIONS */
.glow-Common { border-color: var(--r-common); box-shadow: 0 0 2px var(--r-common); }
.glow-Uncommon { border-color: var(--r-uncommon); box-shadow: 0 0 6px var(--r-uncommon); }
.glow-Rare { border-color: var(--r-rare); box-shadow: 0 0 10px var(--r-rare); }
.glow-Epic { border-color: var(--r-epic); box-shadow: 0 0 12px var(--r-epic); }
.glow-Legendary { 
    border-color: var(--r-legendary); 
    box-shadow: 0 0 20px var(--r-legendary), inset 0 0 10px var(--r-legendary);
    background: #4a2c00; 
}

/* Progress Bar */
.prog-bar-bg {
    width: 90px;
    height: 6px;
    background: rgba(0,0,0,0.1);
    margin-top: 4px;
    border-radius: 4px;
    overflow: hidden;
}
.prog-bar-fill { height: 100%; background: #b89548; }

/* Date Text */
.meta-bottom {
    font-size: 0.7rem;
    color: var(--ink-muted);
    margin-top: 4px;
    font-weight: 600;
}

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

/* --- CUSTOM CURSOR TOOLTIP --- */
.custom-tooltip {
    position: fixed;
    background: var(--tab-bg);
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    color: var(--tab-text);
    border: 1px solid #555;
    border-radius: 5px;
    padding: 12px;
    min-width: 200px;
    max-width: 350px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.tt-title {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.tt-type {
    font-family: var(--font-body);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.tt-desc {
    color: #ffd100;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.4;
}

.tt-divider {
    height: 1px;
    background: #444;
    margin: 8px 0;
    width: 100%;
}

.tt-flavor {
    color: #aaa;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.3;
}
/* Nav bar */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 40px;
    background: var(--tab-bg);
    border-bottom: 3px solid #2a2118;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.05), rgba(0,0,0,0.2));
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}
.nav-bar a {
    color: var(--tab-text);
    text-decoration: none;
    font-family: var(--font-title);
    font-size: 0.95rem;
    padding: 6px 16px;
    border-radius: 4px;
    transition: all 0.2s;
}
.nav-bar a:hover { background: var(--tab-hover); color: #dccaa5; }
.nav-bar a.active { color: var(--gold-accent); font-weight: 700; }
.nav-title {
    color: var(--gold-accent);
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}
.nav-bar a.nav-title { color: var(--gold-accent); font-size: 1.1rem; font-weight: 700; letter-spacing: 1px; padding: 0; background: none; }
.nav-bar a.nav-title:hover { background: none; color: #dccaa5; }
/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    body {
        overflow: auto;
        align-items: flex-start;
    }

    .layout-anchor {
        width: 100%;
        height: auto;
        min-height: 100vh;
    }

    .main-window {
        border: none;
        border-radius: 0;
        box-shadow: none;
        height: auto;
        min-height: 100vh;
    }

    /* Hide desktop side tabs */
    .side-tabs-container,
    .right-tabs-container {
        display: none !important;
    }

    /* Nav bar mobile */
    .nav-bar {
        padding: 10px 15px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .nav-title { font-size: 0.9rem; }
    .nav-bar a { font-size: 0.8rem; padding: 4px 10px; }

    /* Mobile user strip */
    .mobile-user-strip {
        display: flex !important;
        gap: 8px;
        padding: 10px 15px;
        background: var(--tab-bg);
        overflow-x: auto;
        border-bottom: 2px solid #2a2118;
    }
    .mobile-user-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        background: rgba(255,255,255,0.1);
        border: 1px solid #555;
        border-radius: 20px;
        padding: 6px 12px;
        color: var(--tab-text);
        font-family: var(--font-title);
        font-size: 0.8rem;
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.2s;
    }
    .mobile-user-btn.active {
        background: var(--tab-hover);
        border-color: var(--gold-accent);
        color: var(--gold-accent);
        font-weight: 700;
    }
    .mobile-user-btn img {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: 1px solid var(--gold-accent);
        object-fit: cover;
    }

    /* Mobile filter bar */
    .mobile-filter-bar {
        display: flex !important;
        gap: 6px;
        padding: 8px 15px;
        background: var(--sidebar-bg);
        overflow-x: auto;
        border-bottom: 1px solid rgba(74,59,42,0.2);
        align-items: center;
    }
    .mobile-filter-btn {
        background: rgba(255,255,255,0.3);
        border: 1px solid rgba(0,0,0,0.1);
        border-radius: 16px;
        padding: 5px 12px;
        font-family: var(--font-body);
        font-size: 0.75rem;
        color: var(--ink-muted);
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.2s;
    }
    .mobile-filter-btn.active {
        background: rgba(184,149,72,0.25);
        color: #2b1b00;
        font-weight: 700;
        border-color: var(--gold-accent);
    }

    /* Mobile sidebar toggle */
    .mobile-sidebar-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.3);
        border: 1px solid rgba(0,0,0,0.1);
        border-radius: 16px;
        padding: 5px 12px;
        font-size: 0.75rem;
        color: var(--ink-muted);
        cursor: pointer;
        white-space: nowrap;
    }

    /* Sidebar as overlay */
    .sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        z-index: 1000;
        box-shadow: 5px 0 20px rgba(0,0,0,0.5);
        padding: 20px;
    }
    .sidebar.mobile-open {
        display: flex;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.visible {
        display: block;
    }

    /* Content area mobile */
    .content-header {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .content-header h1 { font-size: 1.4rem; }
    .content-header a { display: none; }
    .stats-display { text-align: left; }
    .points-total { font-size: 1.2rem; }

    .scroll-container {
        padding: 10px 12px;
    }

    /* Achievement cards mobile */
    .ach-card {
        padding: 10px;
        gap: 10px;
    }
    .ach-icon {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
    .ach-title { font-size: 0.9rem; }
    .ach-desc { font-size: 0.8rem; }
    .ach-meta { min-width: 60px; margin-left: 8px; }
    .point-shape { width: 28px; height: 28px; }
    .point-shape span { font-size: 0.7rem; }
    .prog-bar-bg { width: 55px; }
    .meta-bottom { font-size: 0.6rem; }

    /* Rarity row mobile */
    .rarity-row { gap: 8px; justify-content: flex-start; }
    .rarity-icon { width: 28px; height: 28px; }

    /* Tooltip - tap friendly */
    .custom-tooltip {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        max-width: 280px;
        min-width: 200px;
        z-index: 10000;
    }

    /* Hide main flex layout, use column */
    .main-window > div[style*="display:flex"] {
        flex-direction: column !important;
    }
}

/* Hide mobile elements on desktop */
.mobile-user-strip,
.mobile-filter-bar,
.mobile-sidebar-toggle,
.sidebar-overlay {
    display: none;
}