:root {
    --bg-color: #f4f4f9;
    --surface-color: #ffffff;
    --primary-color: #3b82f6;
    --text-color: #333333;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-color); 
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    /* Row layout: sidebar (fixed) + #app side by side */
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

/* Top Bar & Theme Selector */
.top-bar {
    position: fixed;
    top: 0;
    left: 60px; /* Shift to right of sidebar */
    right: 0;
    height: 60px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--primary-color);
    z-index: 998; /* Below sidebar (999) */
}

.theme-selector {
    pointer-events: auto; 
    position: relative;
}

.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.theme-dropdown select {
    width: 100%;
    padding: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
}

.color-pickers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--text-color);
}

.color-pickers .picker-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--surface-color);
    border-right: 1px solid var(--primary-color);
    transition: width 0.3s ease;
    width: 60px;
    z-index: 999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar:hover, .sidebar.expanded {
    width: 280px;
    box-shadow: 4px 0 15px rgba(0,0,0,0.1);
}

.hamburger {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.nav-content {
    padding: 10px 0;
    width: 280px; 
}

.game-item {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
    font-weight: bold;
}

.game-item:hover {
    background-color: var(--primary-color);
    color: var(--bg-color); 
}

.game-options {
    background-color: rgba(0,0,0,0.05);
    padding-left: 20px;
}

.game-options div {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.95em;
    border-left: 3px solid transparent;
}

.game-options div:hover {
    background-color: rgba(0,0,0,0.05);
    border-left-color: var(--primary-color);
}

/* Main Content Area */
.main-content {
    margin-left: 60px; 
    padding: 80px 2rem 2rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Keep hidden so the flex chain properly constrains child panels.
       Pages that need scrolling (landing, dashboard) use overflow-y: auto on themselves. */
    overflow: hidden;
}

.card { 
    background: var(--surface-color); 
    padding: 2rem; 
    border-radius: 8px; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); 
    margin-bottom: 20px; 
    border: 1px solid rgba(0,0,0,0.05);
}

.btn {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}


/* ============================
   Custom Dropdown Component
============================ */
.custom-dropdown {
    position: relative;
    width: 100%;
    cursor: pointer;
    user-select: none;
}

.dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    min-height: 38px;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    word-break: break-word;
}

.dropdown-selected:hover, .dropdown-selected.open {
    border-color: var(--text-color);
}

.dropdown-arrow {
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.dropdown-arrow.open {
    transform: rotate(180deg);
}

.custom-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1010;
    display: flex;
    flex-direction: column;
}

.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid var(--primary-color);
}

.dropdown-search input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--text-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
}

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

.dropdown-options-container {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-empty {
    padding: 15px;
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    font-style: italic;
}

.dropdown-option {
    padding: 10px 12px;
    transition: background-color 0.1s ease;
}

.dropdown-option:hover {
    background: rgba(0,0,0,0.05);
}

.dropdown-option.active {
    background: var(--primary-color);
    color: var(--bg-color);
    font-weight: bold;
}

/* Sidebar Search */
.sidebar-search {
    padding: 0 15px 10px 15px;
    border-bottom: 1px solid var(--primary-color);
    margin-bottom: 5px;
}

.sidebar-search input {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--text-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
}

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

/* ============================
   Complex Logic Filter
============================ */
.complex-filter {
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg-color);
    margin-top: 10px;
}

.complex-filter-node {
    margin-bottom: 10px;
}

.filter-group {
    border: 1px dashed var(--text-color);
    border-radius: 6px;
    padding: 10px;
    background: rgba(0,0,0,0.02);
}

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

.group-children {
    padding-left: 20px;
    border-left: 2px solid var(--primary-color);
}

.empty-group {
    font-size: 0.9em;
    font-style: italic;
    opacity: 0.6;
}

.filter-rule {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    background: var(--surface-color);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.logic-dropdown { width: 120px; }
.rule-field { width: 160px; }
.rule-operator { width: 140px; }
.rule-value { flex: 1; display: flex; }

.filter-input {
    width: 100%;
    padding: 0 10px;
    height: 38px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
}

.btn {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 0 16px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.btn-sm {
    padding: 0 12px;
    height: 38px;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}
.btn-outline:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

.btn-danger {
    background: transparent;
    border: 1px solid #dc2626;
    color: #dc2626;
}
.btn-danger:hover {
    background: #dc2626;
    color: white;
}

/* ============================
   Landing Page
============================ */
.landing-page {
    max-width: 1200px;
    flex: 1;
    overflow-y: auto;
    margin: 0 auto;
    padding: 20px;
}

.hero-section {
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 40px;
}

.hero-section h1 {
    font-size: 3em;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.hero-section p {
    font-size: 1.2em;
    color: var(--text-color);
    opacity: 0.8;
}

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

.game-card {
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.game-cover {
    height: 140px;
    width: 100%;
}

.game-card-content {
    padding: 20px;
    flex: 1;
}

.game-card-content h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.game-card-content p {
    font-size: 0.95em;
    opacity: 0.8;
    line-height: 1.4;
}

.game-card.add-game {
    border-style: dashed;
    background: transparent;
    opacity: 0.7;
}

.game-card.add-game:hover {
    opacity: 1;
}

/* ============================
   Game Dashboard
============================ */
.game-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    overflow-y: auto;
    width: 100%;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--primary-color);
}

.dashboard-header .back-btn {
    margin-top: 5px;
}

.dashboard-header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: var(--primary-color);
}

.dashboard-header p {
    font-size: 1.1em;
    color: var(--text-color);
    opacity: 0.8;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.card-icon {
    margin-bottom: 15px;
    color: var(--primary-color);
    background: rgba(0,0,0,0.05);
    padding: 20px;
    border-radius: 50%;
}

.dashboard-card h3 {
    margin-bottom: 10px;
    font-size: 1.3em;
}

.dashboard-card p {
    font-size: 0.95em;
    opacity: 0.8;
}

/* ============================
   Deck Builder Page
============================ */
.deck-builder-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    /* Allow the page to scroll if filter/sort trays push panels below the viewport,
       rather than squishing the panels to nothing */
    overflow-y: auto;
}

.deck-subheader {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 20px 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--primary-color);
    /* Never compress: the content panels below absorb any remaining space */
    flex-shrink: 0;
}

.deck-subheader-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deck-subheader-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-placeholder {
    display: flex;
    gap: 15px;
    align-items: center;
}

.deck-subheader-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.deck-count {
    font-weight: bold;
    color: var(--primary-color);
}

.deck-builder-content {
    display: flex;
    gap: 20px;
    /* Grow to fill all vertical space not used by the subheader */
    flex: 1;
    min-height: 0;
    /* Guarantee a usable height so panels are never squished by the subheader trays */
    min-height: 750px;
    /* Match the subheader horizontal padding so panels sit flush with it */
    padding: 0 20px 20px;
}

/* Left Panel */
.card-collection-panel {
    flex: 2;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    min-height: 700px;
}

.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.db-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;

    background: var(--bg-color);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}

.db-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.db-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    margin-bottom: 8px;
    opacity: 0.8;
}

.db-card-rarity.SSR { color: #fbbf24; font-weight: bold; }
.db-card-rarity.SR { color: #a78bfa; font-weight: bold; }
.db-card-rarity.R { color: #60a5fa; font-weight: bold; }

.db-card-name {
    font-weight: bold;
    font-size: 0.9em;
    margin-bottom: 5px;
    line-height: 1.2;
}

.db-card-chars {
    font-size: 0.75em;
    opacity: 0.7;
}

.db-card-props {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.db-card-prop {
    font-size: 0.72em;
    opacity: 0.75;
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
    padding: 1px 5px;
    white-space: nowrap;
}

.db-card-art-container {
    width: 100%;
    aspect-ratio: 400/560;
    margin: 10px 0;
    position: relative;
    background: rgba(0,0,0,0.02);
    border: 1px dashed var(--primary-color);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.db-card-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.db-card-submit-art {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
}

.db-card-submit-art:hover {
    background: var(--primary-color);
    color: #ffffff;
}

/* Right Panel (Active Deck) */
.active-deck-panel {
    flex: 1;
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    min-width: 300px;
    min-height: 700px;
}

/* Small Deck (Slots) */
.deck-slots-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.deck-slot {
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border-radius: 6px;
}

.deck-slot .db-card {
    margin: 0;
    width: 100%;
    height: 100%;
    box-shadow: none;
}

.deck-slot .db-card:hover {
    transform: none;
    box-shadow: none;
}

.slot-empty {
    width: 100%;
    height: 100%;
    aspect-ratio: 3/4;
    border: 2px dashed var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--primary-color);
    opacity: 0.5;
    border-radius: 6px;
}

/* Large Deck (List) */
.deck-list-layout h4 {
    margin-top: 15px;
    margin-bottom: 5px;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 3px;
}

.deck-list-card {
    display: flex;
    align-items: center;
    padding: 5px;
    background: var(--bg-color);
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--primary-color);
}

.deck-list-card:hover {
    background: var(--primary-color);
    color: var(--bg-color);
}

.deck-list-art {
    width: 30px;
    height: 42px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 2px;
    background: var(--text-color);
}

.deck-list-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.deck-list-name {
    font-size: 0.9em;
    font-weight: 500;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#app {
    flex: 1;
    width: 100%;
    height: 100%;
    /* Must be overflow:hidden to lock the height chain.
       Without this, #app expands to wrap all child content (21000px of cards)
       and the entire constrained-scroll architecture collapses. */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================
   Theme-Aware Scrollbars
   Uses CSS variables so scrollbar colors shift with the active theme
============================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
    opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
    opacity: 1;
    filter: brightness(1.2);
}

/* Firefox scrollbar (limited styling support) */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-color);
}

/* ============================
   Deck Builder - Phase 1 additions
============================ */

/* Row of filter controls in the subheader */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    min-width: 180px;
}

/* Active state on the Filters toggle button */
.btn.active {
    background: var(--primary-color);
    color: var(--bg-color);
}

/* Owned Only toggle */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}

/* Deck count warning when deck is full */
.deck-count-full {
    color: #f87171;
}

/* Sliding Complex Filter tray */
.filter-tray {
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px;
    margin: 8px 20px 12px;
}

.filter-tray-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--primary-color);
    font-size: 0.9em;
    opacity: 0.8;
}

.filter-result-count {
    font-weight: bold;
}

/* Vue transition for the filter tray slide */
.filter-tray-enter-active,
.filter-tray-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.filter-tray-enter-from,
.filter-tray-leave-to {
    opacity: 0;
    transform: translateY(-6px);
}

/* Highlight cards that are already in the deck */
.db-card-in-deck {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Type group count badge in large deck list */
.group-count {
    opacity: 0.6;
    font-weight: normal;
    font-size: 0.9em;
}

/* ============================
   MultiSort Component
============================ */
.multi-sort {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.multi-sort-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.multi-sort-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-priority-label {
    min-width: 55px;
    font-size: 0.85em;
    opacity: 0.7;
    text-align: right;
    flex-shrink: 0;
}

.sort-dir-btn {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-icon {
    padding: 0 8px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.multi-sort-footer {
    display: flex;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--primary-color);
}

.multi-sort-empty {
    font-size: 0.85em;
    opacity: 0.6;
    font-style: italic;
    padding: 4px 0;
}

/* Raw JSON Path inputs in filter rules and sort rows */

.rule-raw-path, .sort-raw-path {
    flex: 1 1 250px;
    min-width: 250px;
}

/* Deck Generator Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.generator-modal {
    background: var(--surface-color);
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 90vw;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}
.generator-modal h2 {
    padding: 20px;
    margin: 0;
    border-bottom: 1px solid #ccc;
}
.generator-scroll {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.generator-section {
    margin-bottom: 30px;
}
.generator-section h3 {
    margin: 0 0 5px 0;
    color: var(--text-color);
}
.help-text {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 15px;
}
.generator-rule-block {
    background: var(--bg-color);
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
}
.rule-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: var(--text-color);
}
.rule-weight {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.api-error {
    color: #ef4444;
    padding: 10px 20px;
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid #ef4444;
}
.modal-footer {
    padding: 20px;
    border-top: 1px solid #ccc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.rule-value { flex: 1; min-width: 150px; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    min-width: 250px;
    max-width: 400px;
    padding: 12px 16px;
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}
.toast-message {
    white-space: pre-wrap;
    font-size: 0.9em;
}
.toast-error { border-left-color: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-success { border-left-color: #10b981; }
.toast-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    margin-left: 15px;
    display: flex;
}
.toast-close:hover { opacity: 1; }

.toast-anim-enter-active,
.toast-anim-leave-active {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast-anim-enter-from,
.toast-anim-leave-to {
    opacity: 0;
    transform: translateX(20px);
}

/* Generic Modal */
.user-auth-modal {
    background: var(--surface-color);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    width: 90vw;
}

/* ===== Browse Decks Page ===== */

/* Left-panel deck list items */
.browse-deck-card {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.08));
    cursor: pointer;
    transition: background 0.15s ease;
    user-select: none;
}

.browse-deck-card:hover {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.06);
}

.browse-deck-card--selected {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.12);
    border-left: 3px solid var(--primary-color);
}

.browse-deck-name {
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browse-deck-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78em;
    opacity: 0.6;
    margin-bottom: 2px;
}

.browse-deck-count {
    font-size: 0.78em;
    opacity: 0.5;
}

.deck-list-panel {
    flex: 1;
    overflow-y: auto;
}

/* ===== Generic Modal Overlay ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-box {
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    padding: 28px 30px;
    width: 90vw;
    max-width: 520px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.modal-fade-enter-active,
.modal-fade-leave-active {
    transition: opacity 0.2s ease;
}
.modal-fade-enter-from,
.modal-fade-leave-to {
    opacity: 0;
}

/* Subheader right-side controls row used by BrowseDecks and similar pages */
.subheader-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

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

.total-count {
    font-size: 0.82em;
    opacity: 0.55;
}

/* ===== Toggle Switch ===== */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.9em;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--primary-color);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(16px);
}

.toggle-label {
    opacity: 0.85;
}

/* ===== Sync Database Drop Zone ===== */
.sync-drop-zone {
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    user-select: none;
}

.sync-drop-zone:hover,
.sync-drop-zone--over {
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.06);
    border-color: var(--primary-color);
}

.sync-drop-zone--loaded {
    border-color: #10b981;
    background: rgba(16,185,129,0.05);
}

.mod-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mod-item {
    background: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mod-item img {
    width: 100%;
    aspect-ratio: 400/560;
    object-fit: cover;
    border-radius: 4px;
}

.mod-item-details {
    font-size: 0.9em;
}

.mod-item-actions {
    display: flex;
    gap: 10px;
}

.mod-item-actions button {
    flex: 1;
}

.add-game-btn { color: var(--primary-color); }
.add-game-btn:hover { color: var(--bg-color) !important; }
