:root {
    /* Color Palette - Cyberpunk/Sci-Fi */
    --bg-main: #050505;
    --bg-panel: rgba(20, 20, 30, 0.7);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    --primary: #00f0ff;
    --secondary: #7000ff;
    --accent: #ff003c;
    --text-main: #eeeeee;
    --text-dim: #8899a6;

    /* Tier Colors form Inspector Image */
    /* Element 0 (Green) */
    --tier-0: #1DDB16;
    /* Element 1 (Cyan/Blue) */
    --tier-1: #00E5FF;
    /* Element 2 (Orange) */
    --tier-2: #FF9100;
    /* Element 3 (Purple) */
    --tier-3: #D500F9;
    /* Element 4 (Red) */
    --tier-4: #FF1744;

    --font-head: 'Rajdhani', sans-serif;
    --font-body: 'Noto Sans KR', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #050505 100%);
    /* Scanline effect */
    position: relative;
}

.scan-line {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 240, 255, 0.1);
    animation: scan 6s linear infinite;
    pointer-events: none;
    z-index: 999;
}

@keyframes scan {
    0% {
        top: -10%;
    }

    100% {
        top: 110%;
    }
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* --- Sidebar --- */
.sidebar {
    width: 320px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand-title {
    font-family: var(--font-head);
    font-size: 24px;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.highlight {
    color: var(--primary);
}

.sidebar-header {
    padding: 30px 20px 20px;
    border-bottom: var(--glass-border);
}

.search-container input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    color: white;
    font-family: var(--font-head);
    letter-spacing: 1px;
    border-radius: 4px;
    transition: 0.3s;
}

.search-container input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.filter-container {
    padding: 15px 20px;
    border-bottom: var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.tier-buttons {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-dim);
    padding: 6px 10px;
    cursor: pointer;
    font-family: var(--font-head);
    font-weight: 700;
    flex: 1;
    transition: 0.2s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-btn.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

/* Tier Specific Colors for Filters */
.filter-btn.t0.active {
    background: var(--tier-0);
    border-color: var(--tier-0);
    box-shadow: 0 0 10px var(--tier-0);
}

.filter-btn.t1.active {
    background: var(--tier-1);
    border-color: var(--tier-1);
    box-shadow: 0 0 10px var(--tier-1);
}

.filter-btn.t2.active {
    background: var(--tier-2);
    border-color: var(--tier-2);
    box-shadow: 0 0 10px var(--tier-2);
}

.filter-btn.t3.active {
    background: var(--tier-3);
    border-color: var(--tier-3);
    box-shadow: 0 0 10px var(--tier-3);
}

.filter-btn.t4.active {
    background: var(--tier-4);
    border-color: var(--tier-4);
    box-shadow: 0 0 10px var(--tier-4);
}


.hero-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.custom-scroll::-webkit-scrollbar {
    width: 6px;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.hero-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 0 100%);
    /* Tech shape */
}

.hero-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.hero-item.active {
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.1) 0%, transparent 100%);
    border-left: 3px solid var(--primary);
}

.hero-list-img {
    width: 44px;
    height: 44px;
    margin-right: 15px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hero-list-info h4 {
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 2px;
}

.hero-list-info p {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-head);
    text-transform: uppercase;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    /* Grid pattern */
}

.glass-panel {
    background: rgba(20, 20, 25, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.hero-detail {
    width: 900px;
    height: 85%;
    padding: 40px;
    border-radius: 12px;
    position: relative;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header */
.detail-header {
    display: flex;
    margin-bottom: 40px;
    align-items: flex-end;
}

.portrait-frame {
    width: 140px;
    height: 140px;
    background: #000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portrait-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-family: var(--font-head);
    font-weight: 700;
}

.glow-border {
    border: 1px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.portrait-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 40px;
}

.tier-indicator {
    margin-top: 10px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 18px;
    padding: 4px 16px;
    background: #000;
    border: 1px solid white;
    color: white;
    letter-spacing: 2px;
}

.header-info {
    flex: 1;
    padding-bottom: 10px;
}

.name-eng {
    font-family: var(--font-head);
    font-size: 24px;
    color: var(--primary);
    letter-spacing: 4px;
    opacity: 0.8;
    margin-bottom: 5px;
}

.name-kor {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.divider {
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    margin: 15px 0;
}

.unit-id {
    font-family: var(--font-head);
    color: var(--text-dim);
}

/* Stats */
.section-title {
    font-family: var(--font-head);
    font-size: 18px;
    color: var(--text-dim);
    margin-bottom: 20px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
    letter-spacing: 2px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 50px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.stat-card .label {
    font-family: var(--font-head);
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 300;
    font-family: var(--font-head);
}

.stat-card .value.highlight {
    color: var(--accent);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 0, 60, 0.4);
}

.bar-bg {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 10px;
    position: relative;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 10px var(--primary);
}

/* Skills */
.skills-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-item {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.2s;
}

.skill-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.skill-icon-frame {
    width: 64px;
    height: 64px;
    background: #000;
    border: 1px solid #444;
    margin-right: 20px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.skill-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.skill-info h4 {
    font-size: 18px;
    color: var(--primary);
    margin-bottom: 8px;
    font-family: var(--font-body);
}

.skill-info p {
    font-size: 14px;
    color: #ccc;
    line-height: 1.6;
}

/* Utilities */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-state {
    text-align: center;
    color: var(--text-dim);
}

.empty-state h2 {
    font-family: var(--font-head);
    font-size: 30px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

/* Dynamic Tier Colors */
[data-tier-color="0"] {
    --tier-c: var(--tier-0);
}

[data-tier-color="1"] {
    --tier-c: var(--tier-1);
}

[data-tier-color="2"] {
    --tier-c: var(--tier-2);
}

[data-tier-color="3"] {
    --tier-c: var(--tier-3);
}

[data-tier-color="4"] {
    --tier-c: var(--tier-4);
}

/* =========================================
   MOBILE RESPONSIVENESS (Deep Thought Plan)
   ========================================= */
@media (max-width: 768px) {

    /* 1. Unlock Viewport & Enable Native Scrolling */
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* 2. Switch to Stacked Layout */
    .app-container {
        flex-direction: column;
        height: auto;
    }

    /* 3. Transform Sidebar to Top Navigation with Drawer */
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid var(--primary);
        position: relative;
        z-index: 1000;
        flex-shrink: 0;
        background: rgba(10, 10, 12, 0.95);
        padding-bottom: 10px;
    }

    .sidebar-header {
        padding: 10px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .brand-title {
        font-size: 18px;
        margin: 0;
    }

    .search-container {
        flex: 1;
        margin-left: 15px;
    }

    .search-container input {
        padding: 8px;
        font-size: 14px;
    }

    /* Filter Bar as Toggle Trigger */
    .filter-container {
        padding: 5px 10px;
        background: transparent;
        border: none;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tier-buttons {
        justify-content: center;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 14px;
        flex: 0 0 auto;
    }

    /* 4. Collapsible Grid Drawer */
    .hero-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* 2 Column Grid */
        gap: 8px;
        padding: 0 10px;

        /* Drawer Logic */
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
        background: rgba(0, 0, 0, 0.8);
    }

    .hero-list.expanded {
        max-height: 60vh;
        /* Drawer Open Height */
        opacity: 1;
        overflow-y: auto;
        padding: 15px 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 10px;
    }

    /* 5. Compact Grid Cards */
    .hero-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px;
        background: rgba(255, 255, 255, 0.05);
        clip-path: none;
        border-radius: 6px;
    }

    .hero-list-img {
        width: 60px;
        height: 60px;
        margin-right: 0;
        margin-bottom: 8px;
    }

    .hero-list-info h4 {
        font-size: 13px;
        color: var(--text-main);
    }

    .hero-list-info p {
        display: none;
        /* Hide English name for space */
    }

    /* 6. Fluid Main Content */
    .main-content {
        width: 100%;
        flex: 1;
        display: block;
        padding-top: 20px;
    }

    .hero-detail {
        width: 100%;
        max-width: 100%;
        height: auto;
        border-radius: 0;
        border: none;
        background: transparent;
        box-shadow: none;
        padding: 10px 20px 40px;
    }

    /* 7. Mobile Header & Portrait */
    .detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 30px;
    }

    .portrait-container {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .portrait-frame {
        width: 140px;
        height: 140px;
    }

    .name-kor {
        font-size: 32px;
    }

    .name-eng {
        font-size: 16px;
    }

    .unit-id {
        font-size: 12px;
    }

    /* 8. Single Column Grid for Stats */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .stat-card .label {
        font-size: 12px;
        margin-bottom: 0;
    }

    .stat-card .value {
        font-size: 20px;
    }

    .bar-bg {
        display: none;
        /* Hide bars on mobile for cleaner look in 1-row */
    }
}