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

:root {
    --bg-primary: #050509;
    --bg-secondary: #0a0a12;
    --bg-tertiary: #12121d;
    --bg-card: rgba(18, 12, 28, 0.95);
    --bg-card-dark: rgba(15, 10, 22, 0.98);
    --accent-primary: #9370db;
    --accent-secondary: #7952b3;
    --accent-tertiary: #a98cd4;
    --accent-obsidian: #c5a3ff;
    --accent-gold: #ffd700;
    --accent-gold-dark: #ffb700;
    --accent-amber: #ffcc00;
    --accent-purple: #9370db;
    --accent-pink: #e91e63;
    --accent-blue: #4169e1;
    --accent-red: #ef4444;
    --text-primary: #ffffff;
    --text-secondary: #e8dff5;
    --text-tertiary: #b8a8d1;
    --border-color: rgba(147, 112, 219, 0.4);
    --border-glow: rgba(255, 215, 0, 0.8);
    --shadow-primary: 0 4px 20px rgba(0, 0, 0, 0.9), 0 0 30px rgba(147, 112, 219, 0.3);
    --shadow-secondary: 0 6px 30px rgba(0, 0, 0, 0.95), 0 0 40px rgba(255, 215, 0, 0.5);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(197, 163, 255, 0.2);
    --card-border-soft: rgba(255, 255, 255, 0.05);
    --card-border-strong: rgba(255, 255, 255, 0.12);
    --surface-muted: rgba(255, 255, 255, 0.04);
    --surface-bright: rgba(255, 255, 255, 0.08);
    --portrait-backdrop-soft: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.08), transparent 55%);
    --portrait-backdrop-dark: linear-gradient(165deg, rgba(6, 5, 10, 0.95), rgba(21, 16, 30, 0.85));
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Obsidian texture background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('Obsidian texture.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
}

/* Dark overlay to ensure text readability */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.75);
    z-index: -1;
    pointer-events: none;
}

@keyframes gridScroll {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(50px);
    }
}

#app {
    width: 100%;
    min-height: 100vh;
}

.view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view.active {
    display: block;
    opacity: 1;
    animation: fadeInTech 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInTech {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Global Navigation Styles */
.global-nav {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-card-dark);
    border-bottom: 2px solid var(--accent-amber);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 204, 0, 0.15);
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    overflow: visible;
    position: relative;
}

/* Scrollbar removed from nav-container - page will scroll as whole */

.nav-brand {
    flex-shrink: 0;
    justify-self: start;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-amber);
    letter-spacing: 0.5px;
    margin: 0;
    padding: 1rem 0;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: min-content;
    justify-self: center;
    grid-column: 2;
    margin-left: 17%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: transparent;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    border: 1px solid transparent;
    flex-shrink: 0;
    white-space: nowrap;
}

.nav-link svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(147, 112, 219, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.nav-link:hover svg {
    transform: scale(1.1);
}

.nav-link.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(255, 204, 0, 0.15), rgba(147, 112, 219, 0.15));
    border-color: var(--accent-amber);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.2);
}

/* Hero Database link - center aligned with page title */
.nav-link-main {
    /* Uses default nav-link styling */
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-amber);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.5);
}

.nav-link-external {
    opacity: 0.8;
}

.wip-badge-small {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: var(--accent-red);
    color: white;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.new-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: #22c55e;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* WIP Disclaimer - now outside nav */
.wip-disclaimer {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid var(--accent-red);
    padding: 1rem 2rem;
    margin: 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Page Content Wrapper */
.page-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

#hero-grid-view .page-content {
    padding-top: 0.5rem;
}

.page-content.team-builder-page {
    max-width: 100%;
    padding: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-amber);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-amber);
    margin: 0;
}

.page-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Header Styles - Obsidian Theme */
.header {
    padding: 2rem 0 2rem;
    text-align: center;
    background: transparent;
    position: relative;
}

.header::before {
    content: '✦';
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--accent-amber);
    font-size: 1rem;
    opacity: 0.4;
}

.header::after {
    content: '';
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 2px;
    background: var(--accent-amber);
    box-shadow: 0 0 8px rgba(255, 204, 0, 0.25);
}

.title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent-amber);
    margin-bottom: 1.5rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    position: relative;
    filter: drop-shadow(0 2px 8px rgba(255, 204, 0, 0.3));
}

/* WIP Disclaimer Banner */
.wip-disclaimer {
    max-width: 1000px;
    margin: 0 auto 0.25rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 204, 0, 0.12);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 204, 0, 0.4);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 204, 0, 0.2),
        0 0 30px rgba(255, 204, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.wip-disclaimer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 204, 0, 0.1), transparent 70%);
    pointer-events: none;
}

.wip-disclaimer strong {
    color: var(--accent-amber);
    font-weight: 700;
    letter-spacing: 0.05em;
}

@media (max-width: 640px) {
    body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .nav-container {
        padding: 0 1rem;
        max-width: 100%;
    }

    .page-content {
        padding: 1rem;
        max-width: 100%;
    }

    .wip-disclaimer {
        font-size: 0.85rem;
        padding: 0.9rem 1.2rem;
        margin-bottom: 1.5rem;
        margin-left: 1rem;
        margin-right: 1rem;
    }
}

.hero-database-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-amber);
    letter-spacing: 0.5px;
    margin: 0 0 1rem 0;
    text-align: center;
}

.hero-database-content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(30px);
    border-radius: 20px;
    border: 2px solid var(--border-color);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.95),
        inset 0 1px 0 rgba(197, 163, 255, 0.15);
    overflow: hidden;
}

.filters-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 100%;
    margin: 0 0 1.5rem 0;
    padding: 0;
}

.search-container {
    position: relative;
}

.filters-row {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
}

.dropdown-filters-group {
    display: flex;
    gap: 1.2rem;
    flex: 1;
    min-width: 0;
}

.effect-filter-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    z-index: 1001;
}

.search-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--accent-primary);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(12px);
}

.search-container:focus-within::before {
    opacity: 0.8;
}

.search-input {
    width: 100%;
    padding: 1.2rem 1.8rem;
    background: rgba(15, 10, 22, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
    font-size: 1.05rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(147, 112, 219, 0.08);
    position: relative;
    z-index: 1;
}

.search-input:focus {
    border-color: var(--accent-amber);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 204, 0, 0.15);
    transform: translateY(-2px);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* Effect Filter Dropdown (Searchable) */
.effect-filter-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--accent-primary);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(12px);
}

.effect-filter-container:focus-within {
    z-index: 1002;
}

.effect-filter-container:focus-within::before {
    opacity: 0.8;
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.effect-search-input {
    width: 100%;
    padding: 1.2rem 3rem 1.2rem 1.8rem;
    background: rgba(15, 10, 22, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
    font-size: 1.05rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.9), inset 0 0 15px rgba(147, 112, 219, 0.08);
    position: relative;
    z-index: 1;
    cursor: text;
}

.effect-search-input:focus {
    border-color: var(--accent-amber);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6), 0 0 10px rgba(255, 204, 0, 0.15);
    transform: translateY(-2px);
}

.effect-search-input::placeholder {
    color: var(--text-tertiary);
}

/* Mobile overlay for easier dropdown dismissal */
.mobile-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.mobile-dropdown-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.effect-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(15, 10, 22, 0.98);
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.95), inset 0 0 20px rgba(147, 112, 219, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.effect-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.effect-dropdown::-webkit-scrollbar {
    width: 10px;
}

.effect-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.effect-dropdown::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
    border: 2px solid rgba(18, 18, 29, 0.5);
}

.effect-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent-obsidian);
}

.effect-option {
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.effect-option:hover {
    background: rgba(138, 138, 160, 0.15);
    color: var(--text-primary);
    border-left-color: var(--accent-amber);
    padding-left: 1.8rem;
}

.effect-option.selected {
    background: rgba(138, 138, 160, 0.25);
    color: var(--accent-amber);
    border-left-color: var(--accent-amber);
    font-weight: 600;
}

.effect-option.hidden {
    display: none;
}

.dropdown-empty {
    padding: 1rem 1.5rem;
    color: var(--text-tertiary);
    font-style: italic;
    border-top: 1px solid var(--card-border-soft);
}

.clear-effect-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    border: none;
    background: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.clear-effect-btn:hover {
    background: rgba(239, 68, 68, 0.5);
    transform: translateY(-50%) scale(1.15);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.clear-effect-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Type Filter with Icons */
.type-filter-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.filter-label {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.type-button-group {
    display: flex;
    gap: 0.5rem;
    background: rgba(15, 10, 22, 0.8);
    padding: 0.4rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.type-filter-button {
    width: 48px;
    height: 48px;
    padding: 0.5rem;
    background: rgba(20, 15, 30, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.type-filter-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(147, 112, 219, 0.2), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.type-filter-button:hover::before {
    opacity: 1;
}

.type-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0.85) saturate(0.9);
    transition: all 0.25s ease;
}

.type-icon-all {
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}

.type-filter-button:hover {
    background: rgba(30, 22, 45, 0.95);
    border-color: var(--accent-amber);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 204, 0, 0.3);
}

.type-filter-button:hover .type-icon {
    filter: brightness(1.1) saturate(1.2);
    transform: scale(1.1);
}

.type-filter-button:hover .type-icon-all {
    color: var(--accent-amber);
    transform: scale(1.1);
}

.type-filter-button.active {
    background: rgba(255, 204, 0, 0.2);
    border-color: var(--accent-amber);
    box-shadow: 0 4px 16px rgba(255, 204, 0, 0.4), inset 0 0 20px rgba(255, 204, 0, 0.15);
}

.type-filter-button.active .type-icon {
    filter: brightness(1.15) saturate(1.3) drop-shadow(0 0 8px rgba(255, 204, 0, 0.5));
}

.type-filter-button.active .type-icon-all {
    color: var(--accent-amber);
    text-shadow: 0 0 12px rgba(255, 204, 0, 0.6);
}

.type-filter-button:active {
    transform: translateY(-1px) scale(1.02);
}

.target-filter-container {
    position: relative;
    flex: 1;
    min-width: 200px;
    z-index: 1000;
}

/* Target Filter uses same dropdown styles as effect filter */
.target-filter-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: var(--accent-primary);
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(12px);
}

.target-filter-container:focus-within::before {
    opacity: 0.8;
}

/* Heroes Grid */
.heroes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-card {
    background: linear-gradient(180deg, rgba(8, 7, 14, 0.95), rgba(17, 14, 24, 0.95));
    backdrop-filter: blur(20px);
    border: 2px solid var(--card-border-soft);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    width: 100%;
    text-align: left;
    padding: 0;
    display: block;
    color: var(--text-primary);
    font: inherit;
    outline: none;
    box-shadow:
        0 12px 36px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(197, 163, 255, 0.18),
        inset 0 0 30px rgba(147, 112, 219, 0.08);
    --hero-type-color: rgba(147, 112, 219, 0.5);
    --hero-type-glow: rgba(147, 112, 219, 0.3);
}

.hero-card:focus-visible {
    outline: 3px solid var(--accent-amber);
    outline-offset: 4px;
}

.hero-card[data-hero-type="attack"] {
    --hero-type-color: rgba(255, 70, 70, 0.85);
    --hero-type-glow: rgba(255, 60, 60, 0.6);
    border-color: rgba(255, 80, 80, 0.65);
}

.hero-card[data-hero-type="magic"] {
    --hero-type-color: rgba(90, 150, 255, 0.85);
    --hero-type-glow: rgba(80, 140, 255, 0.6);
    border-color: rgba(90, 150, 255, 0.65);
}

.hero-card[data-hero-type="defense"],
.hero-card[data-hero-type="defence"] {
    --hero-type-color: rgba(230, 160, 80, 0.85);
    --hero-type-glow: rgba(220, 150, 70, 0.6);
    border-color: rgba(220, 150, 80, 0.65);
}

.hero-card[data-hero-type="support"] {
    --hero-type-color: rgba(255, 210, 70, 0.85);
    --hero-type-glow: rgba(255, 200, 60, 0.6);
    border-color: rgba(255, 210, 80, 0.65);
}

.hero-card[data-hero-type="universal"] {
    --hero-type-color: rgba(170, 120, 255, 0.85);
    --hero-type-glow: rgba(160, 110, 245, 0.6);
    border-color: rgba(170, 120, 255, 0.65);
}

/* Type color edge glow */
.hero-card::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 18px;
    padding: 3px;
    background: var(--hero-type-color);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.9;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* Inner glow on hover */
.hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    box-shadow:
        inset 0 0 40px var(--hero-type-color),
        inset 0 0 25px var(--hero-type-glow),
        inset 0 0 15px var(--hero-type-glow);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.hero-card:hover {
    transform: translateY(-8px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.9),
        0 0 35px var(--hero-type-glow),
        0 0 20px var(--hero-type-color),
        0 0 10px var(--hero-type-color);
    border-color: var(--hero-type-color);
}

.hero-card:hover::before {
    opacity: 1;
}

.hero-card:hover::after {
    opacity: 0.4;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

.hero-image-container {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background:
        var(--portrait-backdrop-soft),
        var(--portrait-backdrop-dark);
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--card-border-soft);
    isolation: isolate;
}

/* Rarity Badge */
.rarity-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px;
    min-width: 36px;
    min-height: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 12px 0 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.6),
        -2px 2px 4px rgba(0, 0, 0, 0.3);
    border-left: 1.5px solid;
    border-bottom: 1.5px solid;
}

/* L++ Rarity - Prismatic Blue/Pink/Purple */
.rarity-lplusplus {
    background: linear-gradient(135deg,
        rgba(255, 150, 230, 0.95) 0%,
        rgba(180, 200, 255, 0.95) 20%,
        rgba(80, 120, 200, 0.95) 40%,
        rgba(100, 50, 180, 0.95) 50%,
        rgba(80, 120, 200, 0.95) 60%,
        rgba(200, 180, 255, 0.95) 80%,
        rgba(255, 150, 230, 0.95) 100%);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8), 0 0 4px rgba(0, 0, 0, 0.6);
    /* Removed infinite animation - now only glows on hover */
    background-size: 200% 200%;
}

/* L+ Rarity - Bright Gold */
.rarity-lplus {
    background: linear-gradient(135deg,
        rgba(255, 215, 0, 0.95) 0%,
        rgba(255, 140, 0, 0.95) 50%,
        rgba(255, 215, 0, 0.95) 100%);
    color: #1a0f00;
    border-color: rgba(255, 255, 255, 0.6);
    /* Removed infinite animation - now only glows on hover */
}

/* L Rarity - Gold */
.rarity-l {
    background: linear-gradient(135deg,
        rgba(218, 165, 32, 0.92) 0%,
        rgba(184, 134, 11, 0.92) 100%);
    color: #fff;
    border-color: rgba(255, 215, 0, 0.5);
}

/* Rare Rarity - Purple */
.rarity-rare {
    background: linear-gradient(135deg,
        rgba(147, 112, 219, 0.92) 0%,
        rgba(121, 82, 179, 0.92) 100%);
    color: #fff;
    border-color: rgba(147, 112, 219, 0.5);
}

/* Unknown Rarity - Gray */
.rarity-unknown {
    background: linear-gradient(135deg,
        rgba(100, 100, 100, 0.85) 0%,
        rgba(70, 70, 70, 0.85) 100%);
    color: #fff;
    border-color: rgba(120, 120, 120, 0.4);
}

/* Hover effects for rarity badges - only glow when hovering over hero card */
.hero-card:hover .rarity-lplusplus {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                0 0 20px rgba(100, 180, 255, 0.5),
                0 0 30px rgba(255, 150, 230, 0.4);
}

.hero-card:hover .rarity-lplus {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                0 0 25px rgba(255, 215, 0, 0.7),
                0 0 35px rgba(255, 140, 0, 0.4);
}

@keyframes rarityGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                    0 0 15px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                    0 0 25px rgba(255, 215, 0, 0.7),
                    0 0 35px rgba(255, 140, 0, 0.4);
    }
}

@keyframes rarityGlowPrismatic {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                    0 0 20px rgba(255, 0, 150, 0.5),
                    0 0 30px rgba(150, 0, 255, 0.3);
    }
    33% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                    0 0 20px rgba(255, 215, 0, 0.5),
                    0 0 30px rgba(255, 100, 0, 0.3);
    }
    66% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6),
                    0 0 20px rgba(0, 255, 150, 0.5),
                    0 0 30px rgba(0, 150, 255, 0.3);
    }
}

@keyframes prismShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Type Icon Badge (opposite corner from rarity) */
.type-icon-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 6px;
    min-width: 36px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 14px 0 0;
    z-index: 5;
    background: linear-gradient(135deg,
        rgba(18, 12, 28, 0.98) 0%,
        rgba(12, 8, 18, 0.98) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        inset 0 1px 2px rgba(197, 163, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.type-icon-badge img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0.95) saturate(1.0) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
    transition: all 0.3s ease;
}

.hero-image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.18);
    transition: left 0.6s ease;
    z-index: 2;
    mix-blend-mode: screen;
}

.hero-image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(18, 10, 32, 0.7);
    opacity: 0.6;
    transition: opacity 0.6s ease;
    z-index: 3;
    pointer-events: none;
}

.hero-card:hover .hero-image-container::before {
    left: 100%;
}

.hero-card:hover .hero-image-container::after {
    opacity: 0.1;
}

.hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: brightness(0.98) contrast(1.08) saturate(1.02);
    transform: scale(1.1);
    transform-origin: center;
    z-index: 1;
}

.hero-card:hover .hero-image {
    transform: scale(1.2);
    filter: brightness(1.04) contrast(1.12) saturate(1.08);
}

.hero-name {
    padding: 1.2rem;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, rgba(18, 12, 28, 0.98) 0%, rgba(12, 8, 18, 0.98) 100%);
    backdrop-filter: blur(10px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 1);
    transition: all 0.3s ease;
    border-top: 2px solid rgba(147, 112, 219, 0.4);
}

.hero-card:hover .hero-name {
    color: var(--hero-type-color);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 1), 0 0 15px var(--hero-type-glow), 0 0 8px var(--hero-type-glow);
    border-top-color: var(--hero-type-color);
}

.hero-card:hover .type-icon-badge {
    background: linear-gradient(135deg,
        rgba(18, 12, 28, 0.98) 0%,
        rgba(12, 8, 18, 0.98) 100%);
    border-right-color: rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 3px rgba(197, 163, 255, 0.15),
        0 2px 12px rgba(0, 0, 0, 0.6),
        0 0 8px var(--hero-type-glow);
}

.hero-card:hover .type-icon-badge img {
    filter: brightness(1.15) saturate(1.25) drop-shadow(0 0 6px var(--hero-type-glow)) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
    transform: scale(1.05);
}

/* Hero Detail View */
.detail-header {
    padding: 2rem 2rem 1rem;
    position: relative;
    background: transparent;
}

.detail-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 2px;
    background: var(--accent-amber);
    box-shadow: 0 0 12px rgba(255, 204, 0, 0.25);
}


.back-button {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1rem 1.8rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(197, 163, 255, 0.1),
        inset 0 0 20px rgba(147, 112, 219, 0.06);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    position: relative;
    z-index: 10;
}

.back-button svg {
    pointer-events: none;
}

.back-button:hover {
    border-color: var(--accent-obsidian);
    transform: translateX(-4px);
    color: var(--accent-obsidian);
}

.back-button:active {
    transform: translateX(-2px);
}

.hero-detail-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.hero-detail-top {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.hero-name-large {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-amber);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    filter: drop-shadow(0 3px 15px rgba(121, 82, 179, 0.4)) drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
    line-height: 1.1;
    text-align: center;
    margin-bottom: 0;
    /* Center the text by accounting for the back button width */
    margin-left: -200px;
}

.hero-header {
    display: flex;
    gap: 2rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
    padding: 2rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(30px);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.95),
        inset 0 1px 0 rgba(197, 163, 255, 0.15),
        inset 0 0 30px rgba(147, 112, 219, 0.08);
}

.hero-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(147, 112, 219, 0.6);
    opacity: 0.5;
}

.hero-header::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(179, 136, 255, 0.08) 0%, rgba(121, 82, 179, 0.04) 50%, transparent 70%);
    pointer-events: none;
}

/* Hero Portrait Section */
.hero-portrait-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* Hero Portrait Card - Matches grid card style without tint/hover */
.hero-portrait-card {
    width: 220px;
}

.hero-portrait-card-container {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
    background:
        var(--portrait-backdrop-soft),
        var(--portrait-backdrop-dark);
    border-radius: 12px;
    border: 2px solid var(--card-border-soft);
    box-shadow:
        0 12px 36px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(197, 163, 255, 0.18),
        inset 0 0 30px rgba(147, 112, 219, 0.08);
    isolation: isolate;
}

/* Rarity Badge */
.hero-portrait-card .rarity-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 6px;
    min-width: 36px;
    min-height: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 12px 0 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.6),
        -2px 2px 4px rgba(0, 0, 0, 0.3);
    border-left: 1.5px solid;
    border-bottom: 1.5px solid;
}

/* Type Icon Badge */
.hero-portrait-card .type-icon-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    padding: 6px;
    min-width: 36px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 14px 0 0;
    z-index: 5;
    background: linear-gradient(135deg,
        rgba(18, 12, 28, 0.98) 0%,
        rgba(12, 8, 18, 0.98) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        inset 0 1px 2px rgba(197, 163, 255, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-portrait-card .type-icon-badge img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0.95) saturate(1.0) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.hero-portrait-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.98) contrast(1.08) saturate(1.02);
    transform: scale(1.1);
    transform-origin: center;
    z-index: 1;
}

.hero-title-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.hero-meta-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding: 1rem;
    background: rgba(15, 10, 22, 0.95);
    border-radius: 12px;
    border: 2px solid rgba(147, 112, 219, 0.3);
    box-shadow:
        inset 0 2px 10px rgba(0, 0, 0, 0.7),
        0 4px 16px rgba(0, 0, 0, 0.85);
}

.hero-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.6rem 0.8rem;
    background: rgba(20, 15, 30, 0.9);
    border-radius: 8px;
    border-left: 3px solid rgba(147, 112, 219, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.meta-label {
    font-weight: 700;
    color: var(--accent-obsidian);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.meta-value {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.meta-value-with-icon {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.hero-type-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: brightness(1.1) saturate(1.2) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.hero-type-item {
    background: rgba(30, 22, 45, 0.7);
    border-left-color: var(--accent-obsidian);
    position: relative;
    overflow: hidden;
}

.hero-type-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at left, rgba(147, 112, 219, 0.15), transparent 70%);
    pointer-events: none;
}

.hero-sections {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.hero-section {
    padding: 1.8rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(30px);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(197, 163, 255, 0.1),
        inset 0 0 25px rgba(147, 112, 219, 0.06);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-obsidian);
}


.hero-section h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    filter: drop-shadow(0 2px 8px rgba(147, 112, 219, 0.3)) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.8));
    position: relative;
    padding-bottom: 0.6rem;
}

.hero-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--accent-obsidian);
}

.subsection {
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid rgba(147, 112, 219, 0.4);
}

.subsection h3 {
    color: var(--accent-obsidian);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.subsection-content {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.section-placeholder {
    padding: 3rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.9), rgba(15, 10, 22, 0.95));
    backdrop-filter: blur(20px);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.section-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(179, 136, 255, 0.08) 0%, rgba(121, 82, 179, 0.04) 50%, transparent 70%);
    animation: pulseGlow 3s ease-in-out infinite;
}

/* Desktop: Align filters with hero cards */
@media (min-width: 1025px) {
    .hero-database-title {
        max-width: 1400px;
        margin-left: auto;
        margin-right: auto;
        padding: 0 2rem;
        margin-bottom: 0.75rem;
    }

    .hero-database-content-wrapper {
        padding: 2rem;
    }

    .filters-container {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        gap: 0.5rem;
    }

    .heroes-grid {
        padding: 0;
        grid-template-columns: repeat(5, 1fr);
        gap: 2rem;
    }

    .filters-row {
        width: 100%;
        max-width: 100%;
        gap: 0.8rem;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .search-container {
        flex: 0 1 auto;
        min-width: 0;
        width: auto;
        max-width: 600px;
    }

    .type-filter-container {
        flex: 0 0 auto;
        margin-left: 0;
        flex-shrink: 0;
    }

    .search-container + .type-filter-container {
        margin-left: 0.4rem;
    }

    .dropdown-filters-group {
        flex: 0 0 auto;
        display: flex;
        gap: 0.8rem;
        min-width: 0;
    }

    .effect-filter-container {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 300px;
    }

    .target-filter-container {
        flex: 0 1 auto;
        min-width: 0;
        max-width: 800px;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-database-title {
        font-size: 1.75rem;
        padding: 0 1.5rem;
        margin-bottom: 0.75rem;
    }

    .hero-database-content-wrapper {
        padding: 1.5rem;
    }

    .heroes-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1.5rem;
        padding: 0;
    }

    .hero-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .hero-portrait-card {
        width: 220px;
    }

    .hero-detail-top {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .hero-name-large {
        font-size: 2.2rem;
        text-align: center;
        margin-left: 0;
    }

    .hero-meta-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .title {
        font-size: 2.5rem;
    }

    .hero-database-title {
        font-size: 1.5rem;
        padding: 0 0.5rem;
        margin-bottom: 0.75rem;
    }

    .hero-database-content-wrapper {
        padding: 1rem;
        margin: 0 0.5rem;
        max-width: calc(100vw - 2rem);
        border-radius: 12px;
    }

    .filters-container {
        gap: 0.8rem;
    }

    .filters-row {
        flex-direction: column;
        gap: 0.8rem;
        width: 100%;
    }

    .search-container {
        width: 100%;
    }

    .effect-filter-container,
    .target-filter-container {
        width: 100%;
        min-width: unset;
    }

    .type-filter-container {
        width: 100%;
        justify-content: center;
    }

    .dropdown-filters-group {
        flex-direction: column;
        width: 100%;
    }

    .type-button-group {
        width: 100%;
        justify-content: center;
    }

    .type-filter-button {
        width: 44px;
        height: 44px;
    }

    .heroes-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
        padding: 0;
    }

    .hero-card {
        /* Optimize card spacing */
        border-radius: 12px;
    }

    .hero-image-container {
        /* Reduce image container height slightly */
        padding-top: 95%;
    }

    .rarity-badge {
        /* Smaller badge on mobile */
        padding: 4px 6px;
        min-width: 28px;
        min-height: 18px;
        font-size: 9px;
        border-radius: 0 10px 0 12px;
    }

    .type-icon-badge {
        /* Smaller type badge on mobile */
        padding: 4px;
        min-width: 28px;
        min-height: 20px;
        border-radius: 0 0 0 10px;
    }

    .type-icon-badge img {
        width: 16px;
        height: 16px;
    }

    .hero-name {
        font-size: 0.85rem;
        padding: 0.6rem 0.5rem;
        line-height: 1.2;
    }

    .hero-portrait-card {
        width: 220px;
    }

    .hero-name-large {
        font-size: 1.8rem;
    }

    .hero-meta-info {
        grid-template-columns: 1fr;
    }

    .meta-label {
        font-size: 0.65rem;
    }

    .hero-section {
        padding: 1.2rem;
    }

    .tips-section,
    .effects-section {
        padding: 1.2rem;
    }

    .hero-header {
        padding: 1.2rem;
    }

    .meta-value-with-icon {
        gap: 0.4rem;
    }
}

/* Enhanced Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid rgba(147, 112, 219, 0.25);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-amber);
    border-radius: 8px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

/* Selection styling */
::selection {
    background: rgba(147, 112, 219, 0.4);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(147, 112, 219, 0.4);
    color: var(--text-primary);
}

/* Gear Cards Grid Layout */
.gear-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(410px, 410px));
    gap: 0.8rem;
    margin-top: 0.6rem;
    justify-content: start;
}

.gear-card {
    background: rgba(15, 10, 22, 0.95);
    border: 2px solid rgba(147, 112, 219, 0.35);
    border-radius: 12px;
    padding: 0.9rem;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(197, 163, 255, 0.08),
        inset 0 0 20px rgba(147, 112, 219, 0.06);
}

.gear-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    line-height: 1.15;
}

.gear-card-content {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.gear-card-image {
    flex-shrink: 0;
    width: 168px;
    height: 168px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(147, 112, 219, 0.4);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.85),
        inset 0 0 15px rgba(147, 112, 219, 0.05);
}

.gear-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gear-card-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    justify-content: center;
}

.gear-stat-item {
    padding: 0.4rem 0.7rem;
    background: rgba(20, 15, 30, 0.9);
    border-radius: 6px;
    border-left: 3px solid rgba(147, 112, 219, 0.5);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.gear-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gear-stat-value {
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.3;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Tier sections for PvE/PvP */
.tier-section {
    margin-bottom: 1rem;
}

.tier-section:last-child {
    margin-bottom: 0;
}

.tier-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(147, 112, 219, 0.4);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* Responsive adjustments for gear cards */
@media (max-width: 768px) {
    .gear-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .gear-card {
        padding: 0.7rem;
    }

    .gear-card-title {
        font-size: 0.7rem;
        margin-bottom: 0.5rem;
    }

    .gear-card-content {
        gap: 0.6rem;
        flex-direction: column;
    }

    .gear-card-image {
        width: 100%;
        max-width: 200px;
        height: auto;
        aspect-ratio: 1;
        margin: 0 auto;
    }

    .gear-card-stats {
        width: 100%;
        gap: 0.35rem;
    }

    .gear-stat-item {
        padding: 0.35rem 0.6rem;
    }

    .gear-stat-label {
        font-size: 0.6rem;
        margin-bottom: 0.15rem;
    }

    .gear-stat-value {
        font-size: 0.68rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .tier-section-title {
        font-size: 0.85rem;
    }
}

/* Side-by-side layout for Tips and Effect List */
.tips-effects-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.tips-section,
.effects-section {
    padding: 1.8rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(30px);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.9),
        inset 0 1px 0 rgba(197, 163, 255, 0.1),
        inset 0 0 25px rgba(147, 112, 219, 0.06);
}

.tips-section::before,
.effects-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent-obsidian);
}

.tips-section h2,
.effects-section h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    filter: drop-shadow(0 2px 8px rgba(147, 112, 219, 0.3)) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.8));
    position: relative;
    padding-bottom: 0.6rem;
}

.tips-section h2::after,
.effects-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 80px;
    height: 2px;
    background: var(--accent-obsidian);
}

.effect-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.effect-list.collapsed {
    display: none;
}

.effects-toggle-btn {
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.2), rgba(147, 112, 219, 0.1));
    border: 1px solid var(--accent-obsidian);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    text-transform: none;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.effects-toggle-btn:hover {
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.3), rgba(147, 112, 219, 0.2));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 112, 219, 0.4);
}

.effects-toggle-btn::before {
    content: '▶';
    transition: transform 0.2s ease;
    display: inline-block;
    font-size: 0.7rem;
}

.effects-toggle-btn:not(.collapsed)::before {
    content: '▼';
}

.effect-item {
    padding: 0.5rem 0.8rem;
    background: rgba(20, 15, 30, 0.9);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Responsive layout for tips and effects */
@media (max-width: 1024px) {
    .tips-effects-container {
        grid-template-columns: 1fr;
    }
}

/* Responsive filters */
@media (max-width: 768px) {
    .filters-row {
        flex-direction: column;
        gap: 0.8rem;
    }

    .search-container {
        width: 100%;
    }

    .dropdown-filters-group {
        flex-direction: column;
        width: 100%;
    }

    .effect-filter-container,
    .target-filter-container {
        min-width: auto;
        width: 100%;
    }

    .type-filter-container {
        width: 100%;
        justify-content: center;
    }
}

/* Utility header links */
.utility-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pill-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 1.4rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(20, 15, 30, 0.9);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.7);
}

.pill-link:hover {
    border-color: var(--accent-gold);
    color: var(--accent-obsidian);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 12px rgba(255, 215, 0, 0.3);
}

/* Work in progress pill styling */
.pill-link.wip-pill {
    background: rgba(139, 115, 15, 0.3);
    border-color: rgb(218, 165, 32);
    color: rgb(255, 215, 0);
}

.pill-link.wip-pill:hover {
    background: rgba(139, 115, 15, 0.5);
    border-color: rgb(255, 215, 0);
    color: rgb(255, 235, 100);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(218, 165, 32, 0.5);
}

.wip-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* Speed guide layout */
.guide-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.2rem 2rem;
}

.guide-header {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1.25rem;
}

.guide-header-text {
    flex: 1;
}

.guide-badge {
    display: inline-block;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent-amber);
}

.guide-title {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin-bottom: 0.5rem;
}

.guide-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 640px;
    line-height: 1.6;
}

.guide-back-link {
    align-self: flex-start;
    margin-bottom: 0.1rem;
}

.guide-content {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.guide-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.guide-card {
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    border: 1px solid rgba(147, 112, 219, 0.35);
    border-radius: 14px;
    padding: 1.8rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

.guide-card h2,
.guide-card h3 {
    font-weight: 800;
    margin-bottom: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.guide-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.guide-intro-card {
    border: 1px solid rgba(255, 215, 0, 0.35);
    background: radial-gradient(circle at top, rgba(255, 215, 0, 0.08), transparent 60%), var(--bg-card);
}

.guide-intro-footnote {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.guide-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.15);
}

.section-heading {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.section-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--accent-amber);
}

.guide-grid {
    display: grid;
    gap: 1.2rem;
}

.guide-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.guide-grid.three-col {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.guide-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.guide-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(147, 112, 219, 0.15);
    border: 1px solid rgba(147, 112, 219, 0.4);
    color: var(--text-primary);
}

.guide-chip.positive {
    border-color: rgba(65, 217, 167, 0.6);
    color: #41d9a7;
}

.guide-chip.mixed {
    border-color: rgba(255, 204, 0, 0.5);
    color: var(--accent-amber);
}

.guide-chip.negative {
    border-color: rgba(239, 68, 68, 0.6);
    color: var(--accent-red);
}

.guide-chip.lock {
    border-color: rgba(121, 82, 179, 0.7);
    color: var(--accent-secondary);
}

.guide-chip.goal {
    border-color: rgba(156, 81, 218, 0.7);
    color: var(--accent-tertiary);
}

.emphasis-card {
    border: 1px solid rgba(65, 217, 167, 0.4);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.9);
}

.neutral-card {
    border: 1px solid rgba(255, 204, 0, 0.4);
}

.danger-card {
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.success-card {
    border: 1px solid rgba(65, 217, 167, 0.4);
}

.apex-card {
    border: 1px solid rgba(147, 112, 219, 0.5);
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(70, 38, 110, 0.35));
}

.guide-callout {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    display: flex;
    gap: 0.8rem;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.guide-callout.danger {
    border-left: 4px solid var(--accent-red);
}

.guide-callout.success {
    border-left: 4px solid var(--accent-amber);
}

.guide-icon {
    font-size: 1.4rem;
}

.guide-flow {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.flow-card {
    flex: 1 1 280px;
}

.flow-connector {
    flex: 0 0 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.flow-connector span {
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
}

@media (max-width: 768px) {
    .guide-header {
        text-align: center;
        align-items: center;
    }

    .guide-back-link {
        align-self: center;
    }

    .guide-intro-footnote {
        flex-direction: column;
        align-items: flex-start;
    }

    .flow-connector {
        display: none;
    }
}

/* Speed chart specific layout */
.speed-chart-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 4rem;
}

.chart-context {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.context-card {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 1px solid rgba(147, 112, 219, 0.35);
    background: rgba(10, 8, 16, 0.85);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.8);
}

.context-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.35em;
    color: var(--accent-amber);
    margin-bottom: 0.4rem;
}

.context-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.4;
    font-size: 0.9rem;
}

.node-eyebrow {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.4em;
    color: var(--accent-amber);
    margin-bottom: 0.4rem;
}

.node-title {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.node-note {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.95rem;
}

.trees-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.tree-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--accent-obsidian);
    letter-spacing: 0.05em;
}

.flow-diagram {
    background: linear-gradient(135deg, rgba(18, 12, 28, 0.95), rgba(10, 8, 18, 0.92));
    border: 1px solid rgba(147, 112, 219, 0.45);
    border-radius: 24px;
    padding: 1.5rem 1.5rem 2rem;
    position: relative;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.diagram-start {
    display: flex;
    justify-content: center;
}

.diagram-node {
    width: min(720px, 100%);
    padding: 1.8rem;
    border-radius: 18px;
    border: 1px solid rgba(147, 112, 219, 0.35);
    background: rgba(5, 5, 15, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 30px rgba(0, 0, 0, 0.9);
}

.diagram-node.start {
    text-align: center;
}

.diagram-node h2 {
    margin: 0 0 0.4rem;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
}

.diagram-checklist {
    list-style: none;
    margin: 1.1rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.diagram-checklist li {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.diagram-checklist strong {
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.diagram-branch {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    position: relative;
    padding-top: 2.5rem;
}

.diagram-branch::before {
    content: '';
    position: absolute;
    top: 1rem;
    left: 5%;
    right: 5%;
    height: 2px;
    background: rgba(147, 112, 219, 0.6);
}

.diagram-branch::after {
    content: '';
    position: absolute;
    top: -2.3rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 2.6rem;
    background: rgba(147, 112, 219, 0.8);
}

.branch-node {
    border-radius: 18px;
    padding: 1.4rem;
    border: 1px solid rgba(147, 112, 219, 0.35);
    background: rgba(8, 6, 18, 0.95);
    text-align: center;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 22px rgba(0, 0, 0, 0.85);
}

.branch-node::before {
    content: '';
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1.5rem;
    background: rgba(147, 112, 219, 0.8);
}

.branch-node.success {
    border-color: rgba(65, 217, 167, 0.6);
}

.branch-node.caution {
    border-color: rgba(255, 204, 0, 0.6);
}

.branch-node.danger {
    border-color: rgba(239, 68, 68, 0.7);
}

/* Flow Tree Styles - Interactive Collapsible Tree */
.tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tree-controls {
    display: flex;
    gap: 0.75rem;
}

.expand-all-btn,
.reset-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(147, 112, 219, 0.4);
    background: rgba(147, 112, 219, 0.1);
    color: rgba(147, 112, 219, 1);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.expand-all-btn:hover,
.reset-btn:hover {
    background: rgba(147, 112, 219, 0.2);
    border-color: rgba(147, 112, 219, 0.6);
    transform: translateY(-1px);
}

.reset-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: rgba(239, 68, 68, 1);
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.6);
}

.flow-tree {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flow-node {
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    border: 2px solid rgba(147, 112, 219, 0.4);
    background: rgba(8, 6, 18, 0.95);
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.flow-node.flow-start {
    text-align: center;
    border-color: rgba(147, 112, 219, 0.6);
    background: rgba(15, 10, 25, 0.95);
    margin-bottom: 2rem;
}

.flow-node.flow-start::after {
    content: '';
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 2rem;
    background: linear-gradient(to bottom, rgba(147, 112, 219, 0.8), rgba(147, 112, 219, 0.4));
}

.flow-node.success {
    border-color: rgba(65, 217, 167, 0.7);
    background: rgba(8, 20, 16, 0.95);
}

.flow-node.caution {
    border-color: rgba(255, 204, 0, 0.7);
    background: rgba(20, 18, 8, 0.95);
}

.flow-node.danger {
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(20, 8, 8, 0.95);
}

.node-content {
    position: relative;
}

.flow-branches {
    display: flex;
    gap: 1.5rem;
    position: relative;
}

.flow-branches::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(147, 112, 219, 0.4) 10%,
        rgba(147, 112, 219, 0.4) 90%,
        transparent 100%);
}

.flow-path {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.flow-path::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1.5rem;
    background: linear-gradient(to bottom, rgba(147, 112, 219, 0.4), rgba(147, 112, 219, 0.6));
}

.flow-path > .flow-node {
    margin-top: 1.5rem;
}

.flow-sub-branches {
    margin-top: 1.5rem;
    margin-left: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid rgba(147, 112, 219, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.flow-sub-branches::before {
    content: '';
    position: absolute;
    top: -1.5rem;
    left: 0;
    width: 1.5rem;
    height: calc(50% + 1.5rem);
    border-left: 2px solid rgba(147, 112, 219, 0.3);
    border-bottom: 2px solid rgba(147, 112, 219, 0.3);
    border-bottom-left-radius: 8px;
}

.flow-sub-branches .flow-path {
    position: relative;
}

.flow-sub-branches .flow-path::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -1.5rem;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 2px;
    background: rgba(147, 112, 219, 0.3);
}

.flow-sub-branches .flow-path > .flow-node {
    margin-top: 0;
}

/* Nested sub-branches */
.flow-sub-branches .flow-sub-branches {
    margin-left: 1rem;
    padding-left: 1rem;
}

/* Decision Points */
.decision-point {
    padding: 1rem;
    background: rgba(15, 10, 25, 0.6);
    border: 1px solid rgba(147, 112, 219, 0.3);
    border-radius: 12px;
    transition: all 0.4s ease;
}

.decision-point.hidden {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

.decision-point.visible {
    display: block;
    opacity: 1;
    animation: slideDown 0.4s ease;
}

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

.decision-prompt {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(147, 112, 219, 1);
    text-align: center;
}

.decision-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.decision-btn {
    flex: 1;
    min-width: 140px;
    max-width: 250px;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    border: 2px solid rgba(147, 112, 219, 0.4);
    background: rgba(8, 6, 18, 0.95);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
}

.decision-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.decision-btn.success {
    border-color: rgba(65, 217, 167, 0.6);
    background: rgba(8, 20, 16, 0.95);
}

.decision-btn.success:hover {
    border-color: rgba(65, 217, 167, 0.9);
    background: rgba(10, 25, 20, 1);
    box-shadow: 0 8px 25px rgba(65, 217, 167, 0.3);
}

.decision-btn.caution {
    border-color: rgba(255, 204, 0, 0.6);
    background: rgba(20, 18, 8, 0.95);
}

.decision-btn.caution:hover {
    border-color: rgba(255, 204, 0, 0.9);
    background: rgba(25, 22, 10, 1);
    box-shadow: 0 8px 25px rgba(255, 204, 0, 0.3);
}

.decision-btn.danger {
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(20, 8, 8, 0.95);
}

.decision-btn.danger:hover {
    border-color: rgba(239, 68, 68, 0.9);
    background: rgba(25, 10, 10, 1);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.decision-btn.selected {
    border-width: 3px;
    transform: scale(1.05);
}

.decision-btn.disabled {
    opacity: 0.35;
    cursor: pointer;
    filter: grayscale(0.8);
}

.decision-btn.disabled:hover {
    opacity: 0.5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-label {
    font-size: 1rem;
    font-weight: 700;
}

.btn-detail {
    font-size: 0.85rem;
    opacity: 0.8;
    font-weight: 400;
}

/* Terminal Messages */
.terminal-message {
    padding: 0.5rem;
    transition: all 0.4s ease;
}

.terminal-message.hidden {
    display: none;
    opacity: 0;
}

.terminal-message.visible {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.outcome-card {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 2px solid;
    text-align: center;
}

.outcome-card.success {
    background: linear-gradient(135deg, rgba(8, 25, 20, 0.95), rgba(10, 30, 24, 0.95));
    border-color: rgba(65, 217, 167, 0.7);
    box-shadow: 0 12px 30px rgba(65, 217, 167, 0.2);
}

.outcome-card.caution {
    background: linear-gradient(135deg, rgba(25, 22, 10, 0.95), rgba(30, 27, 12, 0.95));
    border-color: rgba(255, 204, 0, 0.7);
    box-shadow: 0 12px 30px rgba(255, 204, 0, 0.2);
}

.outcome-card.danger {
    background: linear-gradient(135deg, rgba(25, 10, 10, 0.95), rgba(30, 12, 12, 0.95));
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 12px 30px rgba(239, 68, 68, 0.2);
}

.outcome-card h4 {
    margin: 0 0 0.75rem 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.outcome-card p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.5;
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

.lane-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.lane {
    border-radius: 20px;
    padding: 1.6rem 1.4rem 1.8rem;
    background: rgba(10, 8, 16, 0.92);
    border: 1px solid rgba(147, 112, 219, 0.3);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.85);
    position: relative;
}

.lane.success {
    border-color: rgba(65, 217, 167, 0.6);
    box-shadow: 0 14px 38px rgba(65, 217, 167, 0.14), 0 12px 32px rgba(0, 0, 0, 0.85);
}

.lane.caution {
    border-color: rgba(255, 204, 0, 0.6);
}

.lane.danger {
    border-color: rgba(239, 68, 68, 0.7);
}

.lane-title {
    text-transform: uppercase;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    margin-bottom: 1.2rem;
}

.lane-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: lane-step;
}

.lane-steps li {
    position: relative;
    padding-left: 2.4rem;
    margin-bottom: 1.4rem;
}

.lane-steps li:last-child {
    margin-bottom: 0;
}

.lane-steps li::before {
    counter-increment: lane-step;
    content: counter(lane-step);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    border: 2px solid rgba(147, 112, 219, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.lane-steps li::after {
    content: '';
    position: absolute;
    left: 0.8rem;
    top: 2rem;
    width: 2px;
    height: calc(100% - 2rem);
    background: rgba(147, 112, 219, 0.4);
}

.lane-steps li:last-child::after {
    display: none;
}

.lane.success .lane-steps li::before,
.lane.success .lane-steps li::after {
    border-color: rgba(65, 217, 167, 0.8);
    background: none;
}

.lane.success .lane-steps li::before {
    color: rgba(65, 217, 167, 0.95);
    border-color: rgba(65, 217, 167, 0.8);
}

.lane.success .lane-steps li::after {
    background: rgba(65, 217, 167, 0.4);
}

.lane.caution .lane-steps li::before {
    color: rgba(255, 204, 0, 0.9);
    border-color: rgba(255, 204, 0, 0.8);
}

.lane.caution .lane-steps li::after {
    background: rgba(255, 204, 0, 0.45);
}

.lane.danger .lane-steps li::before {
    color: rgba(239, 68, 68, 0.95);
    border-color: rgba(239, 68, 68, 0.75);
}

.lane.danger .lane-steps li::after {
    background: rgba(239, 68, 68, 0.4);
}

.step-title {
    font-weight: 700;
    letter-spacing: 0.03em;
    margin-bottom: 0.3rem;
}

.step-note {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.45;
    font-size: 0.95rem;
}

.diagram-legend {
    justify-content: center;
}

.diagram-legend .legend-item {
    margin-top: 0.4rem;
}
.legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.legend-chip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.legend-chip.success {
    background: #2ea087;
}

.legend-chip.caution {
    background: #c49800;
}

.legend-chip.danger {
    background: #bc3030;
}


@media (max-width: 640px) {
    .diagram-node {
        text-align: left;
    }

    .diagram-checklist {
        gap: 0.4rem;
    }

    .diagram-branch::before {
        left: 0;
        right: 0;
    }

    /* Flow tree responsive styles */
    .flow-branches {
        flex-direction: column;
        gap: 1.5rem;
    }

    .flow-branches::before {
        display: none;
    }

    .flow-path::before {
        left: 0;
        transform: none;
        width: 2px;
        height: 1rem;
    }

    .flow-sub-branches {
        margin-left: 1rem;
        padding-left: 1rem;
    }

    .flow-node {
        font-size: 0.9rem;
    }

    .flow-node .node-title {
        font-size: 0.95rem;
    }

    .flow-node .node-note {
        font-size: 0.85rem;
    }

    .tree-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tree-controls {
        width: 100%;
        flex-direction: column;
    }

    .expand-all-btn,
    .reset-btn {
        width: 100%;
    }

    .decision-options {
        flex-direction: column;
    }

    .decision-btn {
        max-width: none;
        min-width: 0;
    }

    .outcome-card {
        padding: 1.25rem 1.5rem;
    }

    .outcome-card h4 {
        font-size: 1.2rem;
    }

    .outcome-card p {
        font-size: 0.9rem;
    }
}

/* Advent Teams Page Styles */
/* ========================================
   ADVENT TEAMS - COMPLETE REWRITE
   ======================================== */

.advent-teams-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 2rem;
}

.advent-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 0 1rem;
    position: relative;
}

.advent-header .back-button {
    position: absolute;
    left: 0;
}

.boss-filter-container {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.boss-filter-dropdown {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c5a3ff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

.boss-filter-dropdown:hover {
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 15px rgba(197, 163, 255, 0.3);
}

.boss-filter-dropdown:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 20px rgba(197, 163, 255, 0.4);
}

.boss-filter-dropdown option {
    background: rgba(15, 10, 22, 0.98);
    color: var(--text-primary);
    padding: 0.5rem;
}

.advent-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--accent-amber);
    margin-bottom: 0;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    filter: drop-shadow(0 2px 8px rgba(255, 204, 0, 0.3));
}

.advent-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

#advent-teams-view .page-content {
    padding-top: 1rem;
}

.advent-bosses-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 50vh;
}

.advent-boss-section {
    background: linear-gradient(145deg, rgba(18, 12, 28, 0.95), rgba(15, 10, 22, 0.98));
    backdrop-filter: blur(30px);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.95),
        inset 0 1px 0 rgba(197, 163, 255, 0.15),
        inset 0 0 30px rgba(147, 112, 219, 0.08);
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

.advent-boss-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-amber);
}

.advent-boss-header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 1rem 0.5rem;
    border-right: 2px solid rgba(255, 204, 0, 0.4);
    flex-shrink: 0;
}

.advent-boss-header h2 {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-amber);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    filter: drop-shadow(0 2px 8px rgba(255, 204, 0, 0.3));
    margin: 0;
    writing-mode: vertical-lr;
    text-orientation: upright;
}

.advent-teams-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    flex: 1;
}

.advent-team-card {
    background: rgba(15, 10, 22, 0.95);
    border: 2px solid rgba(147, 112, 219, 0.35);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.85),
        inset 0 1px 0 rgba(197, 163, 255, 0.1),
        inset 0 0 20px rgba(147, 112, 219, 0.06);
}

.advent-team-card--empty {
    min-height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
}

.advent-team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--team-color, var(--accent-obsidian));
}

.advent-team-header {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(147, 112, 219, 0.3);
}

.advent-team-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

.advent-formation-label {
    display: none;
}

/* Heroes Container - Shows heroes in columns */
.advent-heroes-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 45px 0.5rem 30px;
}

/* Individual Hero Column */
.advent-hero-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid rgba(147, 112, 219, 0.4);
    border-radius: 10px;
    min-width: 95px;
    max-width: 110px;
    cursor: pointer;
    /* Optimized: Only transition specific properties for better performance */
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    will-change: transform;
}

.advent-hero-column:hover {
    border-color: var(--accent-amber);
    /* Removed box-shadow transition - too expensive. Using static glow instead */
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.8),
        0 0 25px rgba(255, 204, 0, 0.3),
        0 0 15px rgba(255, 204, 0, 0.2);
}

/* Back row positioning - higher up */
.advent-hero-column.back {
    transform: translateY(-40px);
}

.advent-hero-column.back:hover {
    transform: translateY(-40px);
}

/* Front row positioning - lower down */
.advent-hero-column.front {
    transform: translateY(40px);
}

.advent-hero-column.front:hover {
    transform: translateY(40px);
}

.advent-hero-portrait {
    width: 65px;
    height: 65px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(147, 112, 219, 0.5);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    transition: all 0.3s ease;
}

.advent-hero-column:hover .advent-hero-portrait {
    border-color: var(--accent-amber);
    box-shadow: 0 4px 16px rgba(255, 204, 0, 0.4);
}

.advent-hero-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hide hero columns with N/A names */
.advent-hero-column.hero-na-placeholder {
    display: none;
}

.advent-hero-name {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.2;
    text-align: center;
    width: 100%;
}

/* Skills Container */
.advent-skills-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.advent-skill-slot {
    background: rgba(20, 15, 30, 0.9);
    border: 1px solid #7ab88a;
    border-radius: 6px;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #7ab88a;
    text-align: center;
    transition: all 0.2s ease;
    min-height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.advent-skill-slot.empty {
    border-style: solid;
    border-color: #cc8585;
    color: #cc8585;
    opacity: 1;
    background: rgba(10, 8, 16, 0.5);
}

/* Bottom Section - Pet and Notes */
.advent-bottom-section {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Pet Slot */
.advent-pet-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(10, 8, 16, 0.6);
    border-radius: 8px;
    border: 2px solid rgba(147, 112, 219, 0.3);
    min-width: 100px;
    flex-shrink: 0;
}

.advent-pet-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(15, 10, 22, 0.8);
    border: 2px solid rgba(147, 112, 219, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.advent-pet-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.advent-pet-icon.placeholder .pet-placeholder-box {
    width: 40px;
    height: 40px;
    border: 2px dashed rgba(147, 112, 219, 0.4);
    border-radius: 6px;
    background: rgba(10, 8, 16, 0.5);
}

.advent-pet-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

/* Special Notes */
.advent-notes-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(10, 8, 16, 0.6);
    border-radius: 8px;
    border: 2px solid rgba(147, 112, 219, 0.3);
}

.advent-notes-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-obsidian);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.advent-notes-content {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #ffffff;
    font-weight: bold;
}

.advent-notes-content.empty {
    color: var(--text-tertiary);
    font-style: italic;
    font-weight: normal;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .advent-title {
        font-size: 2.4rem;
    }

    .advent-boss-section {
        flex-direction: column;
        gap: 1rem;
    }

    .advent-boss-header {
        min-width: auto;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 2px solid rgba(255, 204, 0, 0.4);
    }

    .advent-boss-header h2 {
        font-size: 1.7rem;
        writing-mode: horizontal-tb;
        text-orientation: initial;
    }

    .advent-heroes-container {
        gap: 0.4rem;
    }

    .advent-teams-container {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .view.active {
        animation: none !important;
    }
}

@media (max-width: 640px) {
    .advent-teams-content {
        padding: 0 1rem 2rem;
    }

    .advent-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem 0 1.5rem;
    }

    .advent-header .back-button {
        position: static;
        align-self: flex-start;
    }

    .boss-filter-dropdown {
        position: static;
        align-self: stretch;
        text-align: center;
    }

    .advent-title {
        font-size: 1.8rem;
        text-align: center;
        order: -1;
    }

    .advent-boss-section {
        padding: 1rem;
    }

    .advent-boss-header {
        padding: 0.5rem 0.75rem;
    }

    .advent-boss-header h2 {
        font-size: 1.5rem;
    }

    .advent-bosses-container {
        gap: 1rem;
    }

    .advent-team-card {
        padding: 1rem;
    }

    .advent-hero-column {
        min-width: 58px;
        max-width: 65px;
        padding: 0.5rem;
        gap: 0.3rem;
    }

    .advent-hero-column.back {
        transform: translateY(-30px);
    }

    .advent-hero-column.back:hover {
        transform: translateY(-30px);
    }

    .advent-hero-column.front {
        transform: translateY(30px);
    }

    .advent-hero-column.front:hover {
        transform: translateY(30px);
    }

    .advent-hero-portrait {
        width: 52px;
        height: 52px;
    }

    .advent-hero-name {
        font-size: 0.65rem;
        line-height: 1.1;
    }

    .advent-skill-slot {
        font-size: 0.7rem;
        padding: 0.25rem 0.3rem;
        min-height: 20px;
    }

    .advent-heroes-container {
        gap: 0.25rem;
        padding: 45px 0.25rem;
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: center;
    }

    .advent-teams-container {
        grid-template-columns: 1fr;
    }

    .advent-bottom-section {
        flex-direction: column;
        gap: 0.75rem;
    }

    .advent-pet-container {
        padding: 0.5rem;
        min-width: auto;
    }

    .advent-pet-icon {
        width: 50px;
        height: 50px;
    }

    .advent-pet-label {
        font-size: 0.65rem;
    }

    .advent-notes-container {
        padding: 0.5rem;
    }

    .advent-notes-title {
        font-size: 0.65rem;
    }

    .advent-notes-content {
        font-size: 0.75rem;
    }
}

/* ============================================
   TEAM BUILDER STYLES
   ============================================ */

.team-builder-content *,
.team-builder-content *::before,
.team-builder-content *::after {
    box-sizing: border-box;
}

.team-builder-content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem;
    min-width: 750px;
}

.team-builder-page {
    overflow-x: auto;
}

.team-builder-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.team-builder-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-amber);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    filter: drop-shadow(0 3px 15px rgba(121, 82, 179, 0.4)) drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

.team-builder-main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    align-items: start;
    width: 100%;
    min-width: 1100px;
    min-height: 80vh;
    padding: 2rem;
}

/* Hero Pool Sidebar */
.team-builder-sidebar {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-card);
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-obsidian);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-pool-search {
    margin-bottom: 1rem;
}

.team-builder-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.team-builder-search-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.team-builder-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.team-builder-type-filter {
    width: 100%;
}

.team-builder-type-filter .type-button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.team-builder-type-filter .type-filter-button {
    flex: 1;
    min-width: 40px;
    padding: 0.5rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-builder-type-filter .type-filter-button:hover {
    border-color: var(--accent-obsidian);
    transform: translateY(-2px);
}

.team-builder-type-filter .type-filter-button.active {
    border-color: var(--accent-obsidian);
    background: rgba(197, 163, 255, 0.2);
    box-shadow: 0 0 10px rgba(197, 163, 255, 0.3);
}

.team-builder-type-filter .type-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.team-builder-type-filter .type-icon-all {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.team-builder-effect-filter {
    width: 100%;
    position: relative;
    z-index: 1000;
}

.team-builder-effect-filter .custom-select-wrapper {
    position: relative;
}

.team-builder-effect-filter .effect-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.team-builder-effect-filter .effect-search-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.team-builder-effect-filter .effect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--bg-card-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.95);
}

.team-builder-effect-filter .effect-dropdown.show {
    display: block;
}

.team-builder-effect-filter .effect-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.team-builder-effect-filter .effect-option:hover {
    background: rgba(197, 163, 255, 0.2);
}

.team-builder-effect-filter .effect-option.selected {
    background: rgba(197, 163, 255, 0.3);
    color: var(--accent-obsidian);
    font-weight: 700;
}

.team-builder-effect-filter .clear-effect-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.team-builder-effect-filter .clear-effect-btn:hover {
    color: var(--text-primary);
    transform: translateY(-50%) scale(1.2);
}

.hero-pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.hero-pool-card {
    position: relative;
    cursor: grab;
    transition: all 0.2s ease;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(10, 8, 16, 0.6);
    border: 2px solid var(--card-border-soft);
}

/* Type-based border colors for hero pool cards */
.hero-pool-card[data-hero-type="attack"] {
    border-color: rgba(255, 80, 80, 0.65);
}

.hero-pool-card[data-hero-type="magic"] {
    border-color: rgba(90, 150, 255, 0.65);
}

.hero-pool-card[data-hero-type="defense"],
.hero-pool-card[data-hero-type="defence"] {
    border-color: rgba(220, 150, 80, 0.65);
}

.hero-pool-card[data-hero-type="support"] {
    border-color: rgba(255, 210, 80, 0.65);
}

.hero-pool-card[data-hero-type="universal"] {
    border-color: rgba(170, 120, 255, 0.65);
}

.hero-pool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 112, 219, 0.3);
}

.hero-pool-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.hero-pool-card.selected {
    border-color: var(--accent-amber);
    background: rgba(255, 204, 0, 0.15);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.5), 0 4px 12px rgba(147, 112, 219, 0.4);
    transform: translateY(-2px) scale(1.05);
    z-index: 10;
}

.hero-pool-card.selected:hover {
    border-color: var(--accent-amber);
    box-shadow: 0 0 25px rgba(255, 204, 0, 0.6), 0 4px 12px rgba(147, 112, 219, 0.4);
}

.hero-pool-image-container {
    position: relative;
    width: 100%;
    padding-top: 100%;
    overflow: hidden;
}

.hero-pool-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-pool-name {
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    background: rgba(10, 8, 16, 0.8);
    line-height: 1.2;
}

.type-icon-badge-small {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.type-icon-badge-small img {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.rarity-badge-small {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 800;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Teams Section */
.team-builder-teams-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.team-builder-controls {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.team-builder-subject-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.subject-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.team-builder-subject-input {
    width: 100%;
    max-width: 500px;
    padding: 0.5rem 0.75rem;
    background: rgba(10, 8, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.team-builder-subject-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.import-export-section {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.share-section {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-section .btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-export-all {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.15)) !important;
    border-color: #3b82f6 !important;
}

.btn-export-all:hover {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.25)) !important;
    border-color: #60a5fa !important;
}

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

.btn-export-all .spinner {
    animation: spin 1s linear infinite;
}

.clear-all-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.export-section,
.import-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.import-string-display {
    display: flex;
    gap: 0.5rem;
}

.import-string-textarea {
    flex: 1;
    padding: 0.75rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 80px;
}

.import-string-input {
    flex: 1;
    padding: 0.75rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.import-string-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.2), rgba(121, 82, 179, 0.15));
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.btn-primary:hover,
.btn-secondary:hover {
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.3), rgba(121, 82, 179, 0.25));
    border-color: var(--accent-obsidian);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 112, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(145deg, rgba(10, 8, 16, 0.8), rgba(15, 10, 22, 0.8));
    border-color: var(--border-color);
}

#clear-all-teams-btn {
    border-color: var(--accent-red);
}

#clear-all-teams-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
}

.import-section {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.import-section .import-string-input {
    flex: 1;
}

/* Teams Container */
.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, 750px);
    gap: 0.6rem;
    width: 100%;
    min-width: auto;
    justify-content: start;
}

.team-wrapper {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: visible;
    min-width: 750px;
    max-width: 750px;
    width: 750px;
}

.team-header {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    justify-content: space-between;
}

.team-header-left {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 1;
    min-width: 0;
    max-width: 45%;
}

.team-header-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    margin: 0 0.3rem;
}

.team-header-right {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.team-name-input {
    flex: 0 1 auto;
    max-width: 120px;
    min-width: 80px;
    padding: 0.3rem 0.5rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-sizing: border-box;
    flex-shrink: 1;
}

.team-formation-select {
    padding: 0.35rem 0.6rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
    max-width: 150px;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 1;
}

.team-formation-select:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.team-formation-select:hover {
    border-color: var(--accent-obsidian);
}

.team-name-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 3px rgba(197, 163, 255, 0.2);
}

.btn-clear-team {
    padding: 0.3rem 0.6rem;
    background: rgba(100, 100, 100, 0.2);
    border: 2px solid var(--accent-red);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.btn-clear-team:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
    transform: translateY(-1px);
}

.btn-reset-skills {
    padding: 0.3rem 0.6rem;
    background: rgba(100, 100, 150, 0.2);
    border: 2px solid var(--accent-obsidian);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.btn-reset-skills:hover {
    background: rgba(197, 163, 255, 0.2);
    border-color: var(--accent-obsidian);
    transform: translateY(-1px);
}

.btn-share-team-image {
    padding: 0.3rem 0.6rem;
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid #3b82f6;
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-share-team-image:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #60a5fa;
    transform: translateY(-1px);
}

.btn-share-team-image:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-share-team-image svg {
    flex-shrink: 0;
}

/* Notes button styling */
.btn-notes {
    padding: 0.3rem 0.6rem;
    background: rgba(234, 179, 8, 0.2);
    border: 2px solid #eab308;
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-notes:hover {
    background: rgba(234, 179, 8, 0.3);
    border-color: #facc15;
    transform: translateY(-1px);
}

/* Notes popup overlay */
.notes-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.notes-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid var(--accent-obsidian);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.notes-popup h3 {
    margin: 0 0 1rem 0;
    color: var(--accent-obsidian);
    font-size: 1.2rem;
    text-align: center;
}

.notes-textarea {
    width: 100%;
    min-height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(147, 112, 219, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.notes-textarea:focus {
    outline: none;
    border-color: var(--accent-obsidian);
}

.notes-textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.notes-popup-buttons {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.btn-save-notes,
.btn-cancel-notes {
    padding: 0.6rem 1.2rem;
    border: 2px solid;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save-notes {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: var(--text-primary);
}

.btn-save-notes:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: #60a5fa;
    transform: translateY(-1px);
}

.btn-cancel-notes {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
    color: var(--text-primary);
}

.btn-cancel-notes:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: #f87171;
    transform: translateY(-1px);
}

/* Image capture optimization */
.team-wrapper.capturing-image {
    width: 750px !important;
    min-width: 750px !important;
    max-width: 750px !important;
}

.team-wrapper.capturing-image select,
.team-wrapper.capturing-image input,
.team-wrapper.capturing-image button {
    pointer-events: none !important;
}

.team-wrapper.capturing-image select:focus,
.team-wrapper.capturing-image input:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Hide pseudo-element formation labels during capture (we add real DOM elements instead) */
.team-wrapper.capturing-image .team-slots::before,
.team-wrapper.capturing-image .team-slots::after {
    display: none !important;
}

.btn-remove-team {
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid var(--accent-red);
    border-radius: 6px;
    color: var(--accent-red);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.btn-remove-team:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.team-slots {
    display: grid;
    grid-template-columns: repeat(5, 130px);
    gap: 0.5rem;
    width: auto;
    margin: 0 auto;
    padding: 0;
    margin-top: 60px;
    min-width: auto;
    box-sizing: border-box;
    justify-self: center;
}

.team-slot {
    height: 273px;
    width: 130px;
    min-width: 130px;
    min-height: 273px;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(10, 8, 16, 0.4);
    transition: all 0.3s ease;
    position: relative;
    margin: 3px 0;
    overflow: visible;
}

.team-slot:has(.team-slot-hero) {
    border-style: solid;
    border-color: rgba(197, 163, 255, 0.3);
}

.team-slot.empty-slot {
    justify-content: center;
}

/* Front/Back row positioning */
.team-slot-front {
    transform: translateY(40px);
    background: rgba(100, 100, 255, 0.08);
}

.team-slot-back {
    transform: translateY(-40px);
    background: rgba(255, 100, 100, 0.08);
}

.team-slot.empty-slot {
    color: var(--text-tertiary);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}

.team-slot.drag-over {
    border-color: var(--accent-obsidian);
    background: rgba(197, 163, 255, 0.2);
    border-style: solid;
    border-width: 3px;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(197, 163, 255, 0.4);
}

/* Visual feedback when a hero is selected and hovering over slot */
body:has(.hero-pool-card.selected) .team-slot.empty-slot {
    cursor: pointer;
    transition: all 0.2s ease;
}

body:has(.hero-pool-card.selected) .team-slot.empty-slot:hover {
    border-color: var(--accent-amber);
    background: rgba(255, 204, 0, 0.1);
    border-style: dashed;
    border-width: 2px;
}

body:has(.hero-pool-card.selected[data-pet-name]) .team-pet-slot.empty-pet-slot {
    cursor: pointer;
    transition: all 0.2s ease;
}

body:has(.hero-pool-card.selected[data-pet-name]) .team-pet-slot.empty-pet-slot:hover {
    border-color: var(--accent-amber);
    background: rgba(255, 204, 0, 0.1);
}

.team-slot-hero {
    width: 100%;
    height: 100%;
    position: relative;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: visible;
}

.team-slot-hero.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.team-slot-image-container {
    position: relative;
    width: 120px;
    height: 118px;
    flex: 0 0 auto;
    overflow: hidden;
    background:
        var(--portrait-backdrop-soft),
        var(--portrait-backdrop-dark);
    border-radius: 8px 8px 0 0;
    border: 2px solid var(--card-border-soft);
    border-bottom: 1px solid var(--card-border-soft);
    isolation: isolate;
    margin: 0 auto;
    flex-shrink: 0;
}

/* Type-based border colors for team slot images */
.team-slot-hero[data-hero-type="attack"] .team-slot-image-container {
    border-color: rgba(255, 80, 80, 0.65);
}

.team-slot-hero[data-hero-type="magic"] .team-slot-image-container {
    border-color: rgba(90, 150, 255, 0.65);
}

.team-slot-hero[data-hero-type="defense"] .team-slot-image-container,
.team-slot-hero[data-hero-type="defence"] .team-slot-image-container {
    border-color: rgba(220, 150, 80, 0.65);
}

.team-slot-hero[data-hero-type="support"] .team-slot-image-container {
    border-color: rgba(255, 210, 80, 0.65);
}

.team-slot-hero[data-hero-type="universal"] .team-slot-image-container {
    border-color: rgba(170, 120, 255, 0.65);
}

.team-slot-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.98) contrast(1.08) saturate(1.02);
    transform: scale(1.1);
    transform-origin: center;
    z-index: 1;
}

.team-slot-hero-name {
    margin-top: 0.1rem;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.1;
    flex-shrink: 0;
    min-width: 90px;
}

.tier-stars-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.1rem;
    margin-top: 0.1rem;
    flex-wrap: nowrap;
    width: 100%;
    flex-shrink: 0;
    padding: 0 0.15rem 0 16px;
    position: relative;
}

.tier-stars-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
}

.tier-star {
    background: transparent;
    border: none;
    color: var(--accent-gold);
    font-size: 0.6rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: all 0.2s ease;
    filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.5));
    flex-shrink: 0;
    min-width: 0.6rem;
}

.tier-star:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}

.tier-star.active {
    color: var(--accent-gold);
    filter: drop-shadow(0 0 3px rgba(59, 130, 246, 1)) drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
    text-shadow: 0 0 4px rgba(59, 130, 246, 0.9);
    outline: 1px solid rgba(59, 130, 246, 0.8);
    outline-offset: 2px;
    border-radius: 2px;
}

.tier-clear-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--text-tertiary);
    border-radius: 3px;
    color: var(--text-tertiary);
    font-size: 0.65rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.tier-clear-btn:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.25);
    transform: translateY(-50%) scale(1.15);
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.8));
}

.team-slot-gear-container {
    width: 100%;
    margin-top: 0.3rem;
    flex-shrink: 0;
}

.team-slot-gear-select {
    width: 100%;
    padding: 0.3rem 0.5rem;
    background: rgba(10, 8, 16, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-slot-gear-select:hover {
    border-color: var(--accent-obsidian);
}

.team-slot-gear-select:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 2px rgba(197, 163, 255, 0.2);
}

/* Hero selector dropdown */
.hero-selector-container {
    width: 100%;
    margin-top: 0.3rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.hero-selector-container:has(.hero-selector-dropdown.show) {
    z-index: 10001;
}

.hero-selector-input {
    width: 100%;
    padding: 0.3rem 0.4rem;
    background: rgba(10, 8, 16, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    position: relative;
    z-index: 0;
}

.hero-selector-container:has(.hero-selector-dropdown.show) .hero-selector-input {
    z-index: -1;
}

/* Prevent iOS zoom on input focus - must be at least 16px */
@media (max-width: 768px) {
    .hero-selector-input {
        font-size: 16px;
    }
    
    .team-slot:has(.team-slot-hero) .hero-selector-input {
        font-size: 16px;
    }
    
    .team-name-input {
        font-size: 16px;
    }
    
    .team-formation-select {
        font-size: 16px;
    }
    
    .team-pet-select {
        font-size: 16px;
    }
    
    .team-builder-effect-filter .effect-search-input {
        font-size: 16px;
    }
}

.hero-selector-input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.hero-selector-input:hover {
    border-color: var(--accent-obsidian);
    background: rgba(10, 8, 16, 1);
}

.hero-selector-input:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 2px rgba(197, 163, 255, 0.3);
    background: rgba(10, 8, 16, 1);
}

/* Custom dropdown */
.hero-selector-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(15, 10, 22, 1) !important;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.95);
    display: none;
    z-index: 10000;
    isolation: isolate;
}

.hero-selector-dropdown.show {
    display: block;
}

.hero-selector-dropdown::-webkit-scrollbar {
    width: 8px;
}

.hero-selector-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.hero-selector-dropdown::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.hero-selector-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent-obsidian);
}

.hero-selector-option {
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hero-selector-option:last-child {
    border-bottom: none;
}

.hero-selector-option:hover {
    background: rgba(197, 163, 255, 0.2);
    color: var(--accent-obsidian);
}

.hero-selector-option.empty {
    color: var(--text-tertiary);
    font-style: italic;
    cursor: default;
}

.hero-selector-option.empty:hover {
    background: transparent;
    color: var(--text-tertiary);
}

/* When slot has a hero, hide the dropdown and make selector smaller */
.team-slot:has(.team-slot-hero) .hero-selector-container {
    margin-top: 0.2rem;
}

.team-slot:has(.team-slot-hero) .hero-selector-input {
    padding: 0.25rem 0.4rem;
    font-size: 0.65rem;
    opacity: 0.7;
    cursor: pointer;
}

.team-slot:has(.team-slot-hero) .hero-selector-input:hover,
.team-slot:has(.team-slot-hero) .hero-selector-input:focus {
    opacity: 1;
}

/* Dropdown visibility is controlled by JavaScript, not CSS */

/* Empty slot styling */
.team-slot.empty-slot .hero-selector-container {
    margin-top: 0;
}

.team-slot.empty-slot .hero-selector-input {
    border-color: var(--accent-obsidian);
    background: rgba(197, 163, 255, 0.1);
}

.skill-order-container {
    width: 100px;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 0;
    overflow: visible;
}

.skill-boxes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 45px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.skill-box {
    width: 45px;
    height: 26px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: rgba(10, 8, 16, 0.8);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    flex-shrink: 0;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    flex-shrink: 0;
}

.skill-box:hover {
    border-color: var(--accent-obsidian);
    background: rgba(197, 163, 255, 0.1);
}

.skill-box.skill-selected {
    font-weight: 700;
    border-width: 2px;
}

.skill-reset-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--text-tertiary);
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.skill-reset-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.team-builder-mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.mode-toggle-btn {
    padding: 0.5rem 1rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-toggle-btn:hover {
    border-color: var(--accent-obsidian);
}

.mode-toggle-btn.active {
    background: rgba(197, 163, 255, 0.2);
    border-color: var(--accent-obsidian);
    color: var(--accent-obsidian);
}

.team-bottom-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    width: 100%;
    gap: 1rem;
}

.team-reset-skills-container {
    display: flex;
    align-items: center;
    flex: 1;
    margin-top: 0.75rem;
}

.team-notes-container {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin-top: 0.75rem;
}

.team-share-image-container {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.team-pet-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.team-pet-select {
    width: 100%;
    padding: 0.3rem 0.4rem;
    background: rgba(10, 8, 16, 0.8);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    order: 2;
}

.team-pet-select:hover {
    border-color: var(--accent-obsidian);
}

.team-pet-select:focus {
    outline: none;
    border-color: var(--accent-obsidian);
    box-shadow: 0 0 0 2px rgba(197, 163, 255, 0.2);
}

.team-bottom-spacer {
    flex: 1;
}

/* Hide pet grid slot on desktop */
.team-pet-grid-slot {
    display: none;
}

.team-pet-slot {
    width: 120px;
    height: 120px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 8, 16, 0.4);
    position: relative;
    margin: 0 auto;
    transition: all 0.3s ease;
    order: 1;
    padding: 0.3rem;
    gap: 0.3rem;
}

.team-pet-slot.empty-pet-slot {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-align: center;
    padding: 0.5rem;
    border-style: dashed;
}

.team-pet-slot.drag-over {
    border-color: var(--accent-obsidian);
    background: rgba(197, 163, 255, 0.1);
}

.team-pet-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    gap: 0.3rem;
}

.team-pet-image-container {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.team-pet-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-pet-name {
    font-size: 0.65rem;
    color: var(--text-primary);
    margin-top: 0.2rem;
    text-align: center;
    line-height: 1.1;
}

.remove-pet-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-red);
    border: 2px solid var(--bg-primary);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.remove-pet-btn:hover {
    transform: scale(1.1);
    background: #dc2626;
}

.remove-hero-btn {
    position: absolute;
    top: -18px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: rgba(239, 68, 68, 0.9);
    border: 2px solid var(--accent-red);
    border-radius: 50%;
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 10;
}

.remove-hero-btn:hover {
    transform: scale(1.2);
    background: var(--accent-red);
}

.team-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-add-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.2), rgba(121, 82, 179, 0.15));
    border: 2px solid var(--accent-primary);
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 1rem;
}

.btn-add-team:hover {
    background: linear-gradient(145deg, rgba(147, 112, 219, 0.3), rgba(121, 82, 179, 0.25));
    border-color: var(--accent-obsidian);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(147, 112, 219, 0.4);
}

.btn-export-all-teams {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.15));
    border: 2px solid #3b82f6;
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 1rem;
}

.btn-export-all-teams:hover {
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.25));
    border-color: #60a5fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-export-all-teams:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-export-all-teams .spinner {
    animation: spin 1s linear infinite;
}

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

/* Responsive Design for Team Builder */
@media (max-width: 1400px) {
    .team-builder-main {
        grid-template-columns: 320px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 1200px) {
    .team-builder-content {
        min-width: 1000px;
        padding: 1rem;
    }

    .team-builder-main {
        grid-template-columns: 280px 1fr;
        gap: 0.75rem;
        min-width: 1000px;
    }

    .teams-container {
        min-width: 650px;
    }

    .team-slots {
        min-width: 650px;
    }
}

@media (max-width: 1100px) {
    .team-builder-content {
        min-width: 950px;
    }

    .teams-container {
        grid-template-columns: 1fr;
        min-width: 650px;
    }

    .team-slots {
        min-width: 650px;
    }
}

@media (max-width: 1024px) {
    .team-builder-main {
        grid-template-columns: 260px 1fr;
        gap: 1rem;
    }
}

@media (max-width: 968px) {
    .team-builder-content {
        min-width: 750px;
    }

    .team-builder-main {
        grid-template-columns: 1fr;
        gap: 1rem;
        min-width: 750px;
    }

    .team-builder-sidebar {
        display: none;
    }

    .teams-container {
        grid-template-columns: 1fr;
        min-width: auto;
    }

    .team-slots {
        grid-template-columns: repeat(5, 130px);
        gap: 0.5rem;
        width: auto;
        min-width: auto;
    }

    .team-slot {
        min-width: 130px;
        width: 130px;
    }

    /* Disable formation transforms on mobile to prevent warping */
    .team-slot-front {
        transform: none;
    }

    .team-slot-back {
        transform: none;
    }

    .team-builder-content {
        padding: 1rem;
    }

    .team-builder-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 800px) {
    .teams-container {
        min-width: auto;
    }

    .team-slots {
        grid-template-columns: repeat(5, 130px);
        gap: 0.4rem;
        width: auto;
        min-width: auto;
    }

    .team-slot {
        height: auto;
        min-height: 200px;
        min-width: 130px;
        width: 130px;
    }

    .team-slot-image-container {
        max-height: 120px;
    }

    .skill-box {
        height: 28px;
        font-size: 0.8rem;
        min-width: 45px;
        width: 45px;
    }
}

@media (max-width: 640px) {
    .team-builder-content {
        min-width: 320px;
        overflow-x: hidden;
    }

    .team-builder-main {
        min-width: 0;
    }

    .teams-container {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    /* Mobile formation: Back row (LEFT) | Front row (RIGHT) */
    .team-slots {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: auto;
        gap: 0.4rem;
        margin-top: 30px;
        min-width: 0;
        align-items: start;
        position: relative;
    }

    /* Hide desktop pet, show mobile pet in grid */
    .team-bottom-container .team-pet-container {
        display: none;
    }

    .team-pet-grid-slot {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 110px;
        padding: 0.25rem;
        border: 2px dashed rgba(255, 215, 0, 0.3);
        border-radius: 8px;
        background: rgba(255, 215, 0, 0.05);
    }

    /* Position pet at bottom based on formation type */
    /* Basic (2F, 3B): More back heroes, pet on bottom left */
    .team-slots[data-formation="basic"] .team-pet-grid-slot {
        grid-column: 1;
        grid-row: 4;
    }

    /* Balanced (3F, 2B): More front heroes, pet on bottom right */
    .team-slots[data-formation="balanced"] .team-pet-grid-slot {
        grid-column: 2;
        grid-row: 4;
    }

    /* Attack (1F, 4B): More back heroes, pet on bottom right (since left column is full) */
    .team-slots[data-formation="attack"] .team-pet-grid-slot {
        grid-column: 2;
        grid-row: 4;
    }

    /* Protective (4F, 1B): More front heroes, pet on bottom left (since right column is full) */
    .team-slots[data-formation="protective"] .team-pet-grid-slot {
        grid-column: 1;
        grid-row: 4;
    }

    .team-pet-grid-slot .team-pet-container {
        width: 100%;
        flex: none;
        gap: 0.3rem;
    }

    .team-pet-grid-slot .team-pet-select {
        font-size: 0.6rem;
        padding: 0.2rem 0.3rem;
        min-width: 70px;
    }

    .team-pet-grid-slot .team-pet-slot {
        width: 65px;
        height: 65px;
        border: 2px dashed var(--border-color);
    }

    .team-pet-grid-slot .team-pet-image-container {
        width: 45px;
        height: 45px;
    }

    .team-pet-grid-slot .remove-pet-btn {
        width: 16px;
        height: 16px;
        font-size: 12px;
        top: -5px;
        right: -5px;
    }

    .team-pet-grid-slot .team-pet-slot.empty-pet-slot {
        font-size: 0.6rem;
        padding: 0.3rem;
    }

    /* Mobile: Revert team container and slot sizing to original flexible layout */
    .teams-container {
        grid-template-columns: 1fr;
    }

    .team-wrapper {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .team-slots {
        margin: 0 auto;
        justify-self: auto;
    }

    /* Mobile: Show dropdown even when pet is selected and revert pet styling */
    .team-bottom-container .team-pet-slot {
        width: 100px;
        height: 100px;
        border: 2px dashed var(--border-color);
    }

    .team-bottom-container .team-pet-image-container {
        width: 70px;
        height: 70px;
    }

    .team-bottom-container .team-pet-container {
        flex-direction: row;
        gap: 0.5rem;
    }

    .team-bottom-container .team-pet-select {
        display: block;
        width: auto;
    }

    /* Add column labels */
    .team-slots::before {
        content: 'BACK';
        position: absolute;
        top: -22px;
        left: 0;
        right: 50%;
        text-align: center;
        font-size: 0.65rem;
        font-weight: 700;
        color: rgba(255, 100, 100, 0.8);
        letter-spacing: 0.05em;
    }

    .team-slots::after {
        content: 'FRONT';
        position: absolute;
        top: -22px;
        left: 50%;
        right: 0;
        text-align: center;
        font-size: 0.65rem;
        font-weight: 700;
        color: rgba(100, 100, 255, 0.8);
        letter-spacing: 0.05em;
    }

    /* Position back row heroes on LEFT column */
    .team-slot-back {
        grid-column: 1;
        transform: none !important;
        background: rgba(255, 100, 100, 0.15);
        border-color: rgba(255, 100, 100, 0.3);
    }

    /* Position front row heroes on RIGHT column */
    .team-slot-front {
        grid-column: 2;
        transform: none !important;
        background: rgba(100, 100, 255, 0.15);
        border-color: rgba(100, 100, 255, 0.3);
    }

    /* Explicit positioning for Basic formation: slots 2,4 front (right), slots 1,3,5 back (left) */
    .team-slots[data-formation="basic"] .team-slot:nth-child(1) {
        grid-row: 1;
    }
    .team-slots[data-formation="basic"] .team-slot:nth-child(2) {
        grid-row: 1;
    }
    .team-slots[data-formation="basic"] .team-slot:nth-child(3) {
        grid-row: 2;
    }
    .team-slots[data-formation="basic"] .team-slot:nth-child(4) {
        grid-row: 2;
    }
    .team-slots[data-formation="basic"] .team-slot:nth-child(5) {
        grid-row: 3;
    }

    /* Explicit positioning for Balanced formation: slots 1,3,5 front (right), slots 2,4 back (left) */
    .team-slots[data-formation="balanced"] .team-slot:nth-child(1) {
        grid-row: 1;
    }
    .team-slots[data-formation="balanced"] .team-slot:nth-child(2) {
        grid-row: 1;
    }
    .team-slots[data-formation="balanced"] .team-slot:nth-child(3) {
        grid-row: 2;
    }
    .team-slots[data-formation="balanced"] .team-slot:nth-child(4) {
        grid-row: 2;
    }
    .team-slots[data-formation="balanced"] .team-slot:nth-child(5) {
        grid-row: 3;
    }

    /* Explicit positioning for Attack formation: slot 3 front (right), slots 1,2,4,5 back (left) */
    /* Left column (back): slots 1,2,4,5 - distribute across rows 1,2,3,4 */
    /* Right column (front): slot 3 - row 2 */
    .team-slots[data-formation="attack"] .team-slot:nth-child(1) {
        grid-row: 1;
    }
    .team-slots[data-formation="attack"] .team-slot:nth-child(2) {
        grid-row: 2;
    }
    .team-slots[data-formation="attack"] .team-slot:nth-child(3) {
        grid-row: 2;
    }
    .team-slots[data-formation="attack"] .team-slot:nth-child(4) {
        grid-row: 3;
    }
    .team-slots[data-formation="attack"] .team-slot:nth-child(5) {
        grid-row: 4;
    }

    /* Explicit positioning for Protective formation: slots 1,2,4,5 front (right), slot 3 back (left) */
    /* Left column (back): slot 3 - row 2 */
    /* Right column (front): slots 1,2,4,5 - distribute across rows 1,2,3,4 */
    .team-slots[data-formation="protective"] .team-slot:nth-child(1) {
        grid-row: 1;
    }
    .team-slots[data-formation="protective"] .team-slot:nth-child(2) {
        grid-row: 2;
    }
    .team-slots[data-formation="protective"] .team-slot:nth-child(3) {
        grid-row: 2;
    }
    .team-slots[data-formation="protective"] .team-slot:nth-child(4) {
        grid-row: 3;
    }
    .team-slots[data-formation="protective"] .team-slot:nth-child(5) {
        grid-row: 4;
    }

    .team-slot {
        height: auto;
        min-height: 140px;
        max-height: 180px;
        width: 100%;
        padding: 0.25rem;
        position: relative;
    }

    .team-slot.empty-slot {
        font-size: 0.7rem;
        min-height: 110px;
    }

    .team-slot-hero {
        font-size: 0.75rem;
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
    }

    /* Create horizontal layout for image + skills on mobile */
    .team-slot-hero > .team-slot-image-container,
    .team-slot-hero > .skill-order-container {
        display: inline-block;
    }

    .team-slot-hero {
        position: relative;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
    }

    /* Reorder elements on mobile: gear top, skills left, image+name+stars right column */
    .team-slot-gear-container {
        order: 0;
        margin-top: 0;
        width: 100%;
    }

    .team-slot-image-container {
        order: 1;
        height: 80px;
        max-height: 80px;
        flex-shrink: 0;
        width: 60%;
        margin-right: 0.3rem;
        margin-left: auto;
        margin-bottom: 0;
    }

    .team-slot-hero-name {
        order: 2;
        font-size: 0.6rem;
        margin-top: 0;
        width: 60%;
        margin-right: 0.3rem;
        margin-left: auto;
        text-align: center;
    }

    .tier-stars-container {
        order: 3;
        margin-top: 0;
        gap: 0.05rem;
        padding: 0 0.1rem 0 11px;
        flex-wrap: nowrap;
        width: 60%;
        margin-right: 0.3rem;
        margin-left: auto;
        display: flex;
        justify-content: center;
    }

    .skill-order-container {
        order: 0;
        width: calc(54% - 0.3rem);
        margin-top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 80px;
        flex-shrink: 0;
        position: absolute;
        left: 0.25rem;
        top: calc(0.25rem + 1.5rem + 0.6rem);
        z-index: 1;
    }

    .team-slot-gear-select {
        font-size: 0.6rem;
        padding: 0.2rem 0.25rem;
        margin-top: 0;
    }

    .tier-stars-group {
        gap: 0.05rem;
    }

    .tier-star {
        font-size: 0.65rem;
        min-width: 0.65rem;
    }

    .tier-clear-btn {
        width: 10px;
        height: 10px;
        font-size: 0.5rem;
        left: 0;
        border-width: 1px;
    }

    .skill-box {
        height: 22px;
        font-size: 0.65rem;
        min-width: 30px;
        width: 30px;
    }

    .skill-boxes {
        gap: 0.2rem;
        width: 30px;
    }

    .remove-hero-btn {
        width: 16px;
        height: 16px;
        font-size: 0.75rem;
        top: -10px;
    }

    .team-slot-image {
        object-fit: cover;
    }

    .hero-pool-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .import-section {
        flex-direction: column;
    }

    .team-builder-content {
        padding: 0.75rem;
    }

    .team-wrapper {
        padding: 0.6rem;
    }

    .team-bottom-container {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
        align-items: center;
    }

    .team-reset-skills-container,
    .team-notes-container,
    .team-share-image-container {
        width: auto;
        justify-content: center;
    }

    .btn-reset-skills,
    .btn-notes,
    .btn-share-team-image {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
        height: auto;
    }

    .team-pet-container {
        width: 100%;
    }

    .team-bottom-spacer {
        display: none;
    }

    /* Uniform button sizing for mobile */
    .import-export-section {
        flex-direction: column;
        gap: 0.75rem;
    }

    .share-section {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .share-section .btn-primary {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
        font-size: 0.75rem;
    }

    .clear-all-section {
        justify-content: stretch;
    }

    .clear-all-section .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
        font-size: 0.75rem;
    }

    /* Fix team header alignment - force proper layout on mobile */
    .team-header {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
    }

    .team-header-left {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 0.4rem !important;
        align-items: stretch !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    .team-header-center {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.4rem !important;
        align-self: flex-end !important;
    }

    .team-header-right {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        align-self: flex-end !important;
    }

    .team-name-input {
        width: 100% !important;
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
        height: 32px !important;
        box-sizing: border-box !important;
    }

    .team-formation-select {
        width: 100% !important;
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
        height: 32px !important;
        box-sizing: border-box !important;
        order: initial !important;
    }

    .btn-clear-team {
        height: 32px !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 0.7rem !important;
        white-space: nowrap !important;
        box-sizing: border-box !important;
    }

    .btn-remove-team {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
    }

    /* Fix formation labels positioning - move them higher */
    .team-slots::before,
    .team-slots::after {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.3rem !important;
        top: -25px !important;
    }

    .team-slots {
        margin-top: 30px !important;
    }
}

/* Navigation Responsive Styles */

/* Mobile responsive for navigation */
/* Mobile hamburger menu */
.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--accent-amber);
    color: var(--accent-amber);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    justify-self: end;
    grid-column: 3;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 204, 0, 0.1);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}

@media (max-width: 900px) {
    .nav-container {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        overflow-x: visible;
        overflow-y: visible;
    }

    .nav-brand {
        margin-right: auto;
        flex-shrink: 0;
        justify-self: unset;
    }

    .nav-title {
        font-size: 1.1rem;
        padding: 0;
        text-align: left;
    }

    .mobile-menu-toggle {
        display: block;
        justify-self: unset;
        grid-column: unset;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card-dark);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        border-top: 2px solid var(--accent-amber);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
        z-index: 999;
        min-width: auto;
        flex-shrink: 1;
        justify-self: unset;
        grid-column: unset;
        margin-left: 0;
    }

    .nav-links.show {
        display: flex;
    }

    /* Reorder mobile menu: Hero Database, Advent Teams, Guild War Teams, Wish List, Team Builder, Speed Gearing Guide */
    .nav-link-main {
        order: 1;
    }

    #nav-advent-link {
        order: 2;
    }

    a[href="guild-war-teams.html"] {
        order: 3;
    }

    a[href="wish-list.html"] {
        order: 4;
    }

    #nav-teams-link {
        order: 5;
    }

    a[href="speed-gearing.html"] {
        order: 6;
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 1rem;
        border-radius: 8px;
    }

    .nav-link svg {
        margin-right: 0.75rem;
    }

    .nav-link span {
        display: inline;
    }

    .page-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .nav-title {
        font-size: 1rem;
    }

    .mobile-menu-toggle {
        font-size: 1.25rem;
        padding: 0.4rem 0.6rem;
    }

    .wip-badge-small {
        display: none;
    }
}
