:root {
    --bg-base: #0f1015;
    --bg-surface: #1a1b23;
    --text-primary: #f8f8f2;
    --text-secondary: #aaaaaa;
    --accent-primary: #ff79c6;
    --accent-warning: #ffb86c;
    
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    
    --transition-speed: 0.3s;

    --theme-accent: var(--accent-primary);
    --theme-text: var(--text-primary);
}

body { font-family: 'Outfit', sans-serif; overflow-x: hidden; }

.hidden { display: none !important; }
.hidden-on-dashboard { display: none !important; } 

.pokemon-buylist-wrapper {
    width: 100%; height: 100%; max-width: 100vw; margin: 0; padding: 20px; box-sizing: border-box;
    display: flex; flex-direction: column; 
}

.pokemon-buylist-wrapper::before {
    content: ""; position: fixed; top: -10vh; left: -10vw; width: 120vw; height: 120vh;
    background: radial-gradient(800px circle at 50% 50%, rgba(255, 121, 198, 0.12), rgba(189, 147, 249, 0.05) 40%, transparent 70%);
    z-index: -1; pointer-events: none; animation: orbBreathe 18s ease-in-out infinite alternate;
}
@keyframes orbBreathe {
    0% { transform: scale(1) translate(0px, 0px); opacity: 0.5; }
    50% { transform: scale(1.4) translate(40px, -50px); opacity: 1; }
    100% { transform: scale(1.1) translate(-60px, 40px); opacity: 0.5; }
}

/* --- TOOLBAR ALIGNMENT --- */
.search-toolbar { 
    display: flex; flex-direction: column; align-items: center; gap: 15px !important; flex-wrap: wrap !important; justify-content: center !important;
    width: 100%; max-width: 950px; box-sizing: border-box; 
    z-index: 100; flex-shrink: 0; margin: 0 auto 20px auto;
    background: rgba(30, 30, 35, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 15px 20px !important; 
}

.buylist-selector { 
    display: flex; 
    flex-direction: row; 
    flex-wrap: nowrap; 
    justify-content: space-between; 
    align-items: center;
    gap: 10px; 
    width: 100%; 
    max-width: 100%;
    margin: 0 !important; 
}

.buylist-selector-inner {
    display: flex; 
    flex-direction: row; 
    align-items: center; 
    justify-content: flex-start; 
    padding: 0; 
    gap: 4px; 
    width: 100%; 
    overflow-x: auto; 
    -ms-overflow-style: none; 
    scrollbar-width: none;
}

.buylist-selector-inner::-webkit-scrollbar { 
    display: none; 
}

/* 3-Column Control Panel */
.control-panel {
    display: flex; flex-direction: row; justify-content: center !important; align-items: center;
    width: 100%; gap: 15px !important; flex-wrap: wrap !important; box-sizing: border-box; margin-top: 5px;
}
.control-left, .control-right {
    display: flex; align-items: center; gap: 10px;
}
.control-center {
    display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; max-width: 450px;
}
.search-sort-row {
    display: flex; flex-direction: row; gap: 10px; width: 100%; justify-content: center;
}

.search-container { position: relative; width: 100%; margin: 0; flex: 1; min-width: 220px !important; }
#search-input {
    width: 100%;
    height: 42px !important; 
    padding: 0 35px 0 15px !important; 
    border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0, 0, 0, 0.5); 
    color: white; 
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box !important; 
    font-size: 16px !important; /* CRITICAL: Stops iOS Zoom */
}
#search-input:focus { border-color: rgba(255, 121, 198, 0.5); background: rgba(0,0,0,0.6); box-shadow: 0 0 15px rgba(255, 121, 198, 0.1); }
.search-icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: 0.5; font-size: 0.85em; }

.toolbar-group {
    display: flex; align-items: center; gap: 4px; background: rgba(0, 0, 0, 0.4); padding: 4px; 
    border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.05); margin: 0;
}
.toolbar-divider { width: 1px; height: 16px; background: rgba(255, 255, 255, 0.1); margin: 0 4px; }
.filter-toggles { display: flex; flex-direction: row; gap: 5px; margin: 0; padding: 0; border: none; background: transparent; }

.filter-btn, .toggle-btn, .generate-btn {
    padding: 6px 14px; border-radius: 8px; border: none; background: transparent;
    color: #aaa; cursor: pointer; font-weight: 500; font-size: 0.85em; 
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); white-space: nowrap; flex-shrink: 0;
}
.filter-btn:hover:not(.active), .toggle-btn:hover:not(.active) { color: #fff; background: rgba(255, 255, 255, 0.05); }
.filter-btn.active, .toggle-btn.active { background: rgba(255, 255, 255, 0.1); color: #ffffff; font-weight: 600; box-shadow: 0 4px 15px rgba(255, 121, 198, 0.2); }

.generate-btn { background: transparent; border: 1px solid transparent !important; color: #aaa !important; padding: 6px 12px; display: flex; align-items: center; gap: 6px; }
#sort-select { height: 100%; box-sizing: border-box; }
#btn-admin:hover { border-color: var(--theme-accent) !important; color: var(--theme-accent) !important; background: rgba(255, 121, 198, 0.05); box-shadow: 0 0 15px rgba(255, 121, 198, 0.2); }
#btn-wishlist:hover { border-color: #f1c40f !important; color: #f1c40f !important; background: rgba(241, 196, 15, 0.05); box-shadow: 0 0 15px rgba(241, 196, 15, 0.2); }
#btn-scan { display: none; }
#btn-scan:hover { border-color: #8be9fd !important; color: #8be9fd !important; background: rgba(139, 233, 253, 0.05); }

/* --- NAVIGATION DROPDOWN --- */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-container::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 10px;
}
.dropdown-toggle {
    background: transparent; border: 1px solid transparent; color: #aaa;
    padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 500;
    font-size: 0.85em; transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.dropdown-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.dropdown-content {
    display: none; position: absolute; top: 100%; right: 0; z-index: 100;
    background: rgba(30, 30, 35, 0.95); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    min-width: 140px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 5px 0; margin-top: 5px; flex-direction: column;
}
.dropdown-container:hover .dropdown-content {
    display: flex;
}
.dropdown-item {
    background: transparent; border: none; color: #aaa; padding: 10px 15px;
    text-align: left; cursor: pointer; font-weight: 500; font-size: 0.85em;
    transition: background 0.2s, color 0.2s; width: 100%; box-sizing: border-box;
}
.dropdown-item:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.glass-toggle {
    background: rgba(0, 0, 0, 0.5) !important; 
    color: white !important; 
    border: 1px solid rgba(255,255,255,0.1) !important;
    padding: 0 15px !important; 
    border-radius: 8px !important; 
    transition: border-color 0.3s, box-shadow 0.3s;
    height: 42px !important; 
    display: flex !important;
    align-items: center !important;
    font-size: 15px !important; 
    box-sizing: border-box !important;
}
.glass-toggle:hover {
    border-color: rgba(255, 121, 198, 0.5) !important; background: rgba(0,0,0,0.6) !important; box-shadow: 0 0 15px rgba(255, 121, 198, 0.1);
}

/* --- BINDER ARCHITECTURE --- */

.binder-container {
    width: 100%; max-width: 950px; margin: 0 auto; 
    padding: 20px; box-sizing: border-box; min-height: 400px;
    background: rgba(0, 0, 0, 0.2); border-radius: 15px; border: 1px solid rgba(255,255,255,0.05); box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow-y: auto;
    overflow-x: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.binder-container::-webkit-scrollbar { display: none !important; }

#buylist-viewport { width: 100%; flex-grow: 1; }

.card-grid { display: grid; width: 100%; height: 100%; gap: 15px; justify-content: center; }
.binder-small { grid-template-columns: repeat(2, 1fr) !important; }
.binder-medium { grid-template-columns: repeat(3, 1fr) !important; }
.binder-large { grid-template-columns: repeat(4, 1fr) !important; }

/* BINDER FOOTER */
.binder-footer {
    display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 15px; 
    padding-top: 15px; margin-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.binder-footer.hidden { display: none !important; }

.binder-arrow {
    background: transparent; border: none; color: #aaa; 
    font-size: 1.4rem; cursor: pointer; padding: 0 5px;
    transition: all 0.2s ease; flex-shrink: 0; display: flex; align-items: center;
}
.binder-arrow:hover:not(:disabled) { transform: scale(1.2); color: #ff79c6; }
.binder-arrow:disabled { opacity: 0.2; cursor: not-allowed; transform: none; }

.binder-page-text { color: #bd93f9; font-weight: 800; font-size: 0.85em; white-space: nowrap; min-width: 80px; }
.binder-stat-text { color: #ff79c6; font-weight: 800; font-size: 0.85em; white-space: nowrap; min-width: 100px; text-align: right; }

.progress-container {
    flex-grow: 1; height: 10px; background-color: rgba(0,0,0,0.6); border-radius: 12px; overflow: hidden; margin: 0; position: relative; cursor: default; box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.progress-bar {
    height: 100%; width: 0%; background: linear-gradient(90deg, #bd93f9, #ff79c6); transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 0 15px rgba(255, 121, 198, 0.6); border-radius: 12px;
}

/* CARD STYLING */

.card-item {
    position: relative; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.05); border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex !important; flex-direction: column !important; justify-content: space-between;
    height: 100% !important; min-height: 0 !important; align-self: start; overflow: hidden; z-index: 1;
    opacity: 0; transform: translateY(30px); transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 0 !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box; 
}
.card-item.read-only { cursor: default !important; }
.card-item.in-view { opacity: 1; transform: translateY(0); }
.card-item:hover { transform: translateY(-6px); border-color: rgba(255, 121, 198, 0.4); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 121, 198, 0.15); z-index: 10; cursor: pointer; }
.card-item:active { transform: scale(0.98) translateY(-2px); }

.card-img {
    width: 100% !important; height: auto !important; max-height: 100% !important; aspect-ratio: 63 / 88 !important; object-fit: contain !important; flex: 1 1 auto !important; min-height: 0 !important;
    border-radius: 12px; overflow: hidden; filter: grayscale(100%); opacity: 0.4; transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); margin-bottom: 5px;
    background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.02) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite linear; color: transparent;
}
.card-img.loaded { background: transparent; animation: none; color: inherit; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.card-item::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255, 121, 198, 0.08), transparent 40%);
    z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.3s ease;
}
#buylist:hover .card-item::before { opacity: 1; }

.card-item.purchased { background: rgba(255, 121, 198, 0.1); border-color: var(--theme-accent); box-shadow: inset 0 0 20px rgba(255, 121, 198, 0.05); }
.purchased .card-img { filter: grayscale(0%); opacity: 1; }
.card-info { margin-top: 8px; line-height: 1.2; flex: 0 0 auto !important; }
.card-name { display: block; font-weight: bold; font-size: 0.9em; margin-bottom: 2px; }
.card-number { display: block; font-size: 0.7rem; color: rgba(255,255,255,0.4); margin-top: 2px; }
.edition-tag { color: #f1c40f; font-weight: bold; font-size: 0.7em; display: block; margin-top: 2px; }
.price-tag { color: #8be9fd; font-size: 0.75em; display: block; margin-top: 4px; font-family: monospace; }
.variant-text { color: #8be9fd; font-size: 0.7em; display: block; font-weight: bold; margin-top: 2px;}

.toast { position: fixed; bottom: 30px; right: 30px; background: #111; color: #f8f8f2; padding: 12px 24px; border-radius: 8px; border-left: 4px solid var(--theme-accent); box-shadow: 0 8px 16px rgba(0,0,0,0.6); z-index: 1000; opacity: 0; transform: translateY(20px); transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; font-weight: 500; font-size: 0.9em; }
.toast.show { opacity: 1; transform: translateY(0); }

.modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.modal:not(.hidden) { opacity: 1; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); }
.modal-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; transform: scale(0.9); transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.modal:not(.hidden) .modal-content { transform: scale(1); }
#modal-img { height: 60vh; min-height: 400px; max-height: 650px; width: auto; max-width: 90vw; object-fit: contain; border-radius: 15px; box-shadow: 0 20px 50px rgba(0,0,0,0.8); margin-bottom: 20px; }
.modal-details { text-align: center; color: white; background: rgba(0,0,0,0.6); padding: 15px 30px; border-radius: 30px; border: 1px solid rgba(255,255,255,0.1); }
.modal-details h2 { margin: 0 0 5px 0; font-size: 1.5em; color: var(--theme-accent); }
.modal-close { position: absolute; top: -40px; right: -40px; background: transparent; border: none; color: white; font-size: 2em; cursor: pointer; transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); }
.modal-close:hover { color: var(--theme-accent); transform: scale(1.1); }

#scanner-modal { z-index: 99999 !important; background: rgba(15, 15, 20, 0.98) !important; flex-direction: column; gap: 15px; padding: 20px; box-sizing: border-box; }
#camera-feed { width: 100%; max-width: 100vw; height: auto; border-radius: 12px; object-fit: contain; }
#btn-capture { border-color: #8be9fd; color: #8be9fd; animation: capturePulse 2s infinite ease-in-out; }
@keyframes capturePulse { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 233, 253, 0.4); } 50% { transform: scale(1.02); box-shadow: 0 0 15px rgba(139, 233, 253, 0.3); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(139, 233, 253, 0); } }

#global-tooltip { position: absolute; top: 0; left: 0; background: rgba(15, 15, 20, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 121, 198, 0.3); color: #f8f8f2; padding: 8px 12px; border-radius: 8px; font-size: 0.8em; font-weight: 600; pointer-events: none; z-index: 99999; opacity: 0; transform: scale(0.95); transition: opacity 0.15s ease, transform 0.15s ease; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); white-space: nowrap; }
#global-tooltip.visible { opacity: 1; transform: scale(1); }

/* NOTE: Removed the ::after rule here to permanently banish the 🏆 emoji */
.progress-container.mastered { box-shadow: 0 0 20px rgba(241, 196, 15, 0.5), inset 0 0 10px rgba(241, 196, 15, 0.3); border: 1px solid rgba(241, 196, 15, 0.8); }
.progress-container.mastered .progress-bar { background: linear-gradient(90deg, #f1c40f, #f39c12, #fffce0, #f1c40f); background-size: 200% auto; animation: goldShimmer 2.5s linear infinite; box-shadow: 0 0 15px rgba(241, 196, 15, 0.8); }
.list-btn.mastered { color: #f1c40f !important; border: 1px solid #f1c40f !important; background: rgba(241, 196, 15, 0.1) !important; text-shadow: 0 0 8px rgba(241, 196, 15, 0.5); box-shadow: 0 0 15px rgba(241, 196, 15, 0.3); }
@keyframes goldShimmer { 0% { background-position: 200% center; } 100% { background-position: 0% center; } }

/* DASHBOARD MODULE */
.dashboard-landing { display: flex; flex-direction: column; gap: 35px; width: 100%; text-align: center; color: white; margin-top: 10px; margin-bottom: 0px; }
.dashboard-landing.hidden { display: none; }
.dashboard-intro { display: none !important; margin: 0; padding: 0; height: 0; }
.dashboard-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; width: 100%; }
.metrics-box { background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 100%); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.05); border-radius: 18px; padding: 30px 15px; text-align: center; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.2); display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; box-sizing: border-box; }
.metrics-box:hover { transform: translateY(-6px); }
.missing-box:hover { border-color: #ff79c6; box-shadow: 0 10px 30px -10px rgba(255, 121, 198, 0.2); }
.metrics-box.gold:hover { border-color: #f1c40f; box-shadow: 0 10px 30px -10px rgba(241, 196, 15, 0.2); }
.metrics-box.cyber:hover { border-color: #8be9fd; box-shadow: 0 10px 30px -10px rgba(139, 233, 253, 0.2); }
.metrics-box .metric-icon { font-size: 2.8em; margin-bottom: 12px; opacity: 0.9; }
.metrics-box h3 { text-transform: uppercase; letter-spacing: 2px; font-size: 0.75em; color: #94a3b8; margin: 0 0 8px 0; font-weight: 700; }
.metrics-box .metric-value { font-size: 2.2em; font-weight: 900; color: white; margin: 0; line-height: 1; }
.metrics-box .metric-total { color: #64748b; font-size: 0.85em; margin-top: 5px; font-weight: 500; }

.chart-wrapper { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 20px; margin-top: 20px; gap: 40px; }

/* --- CHART CENTERING --- */
.canvas-container { 
    position: relative; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    width: 100%;
}

.chart-center-text { 
    position: absolute !important; 
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important; /* True physical center */
    display: flex !important; 
    flex-direction: column !important; 
    justify-content: center !important; 
    align-items: center !important; 
    pointer-events: none !important; 
    padding: 0 !important; 
    width: auto !important;
    height: auto !important;
}

.chart-center-text .pct { 
    margin: 0 !important; 
    padding: 0 !important; 
    text-align: center; 
}
#binder-stats-container { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 15px; }
.binder-stat-row { display: flex; align-items: center; gap: 15px; width: 100%; }
.binder-stat-name { flex: 0 0 120px; font-size: 0.9em; font-weight: 700; color: #e2e8f0; text-align: right; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.binder-stat-bar-wrapper { flex: 1; height: 10px; background: rgba(0, 0, 0, 0.6); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255,255,255,0.05); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
.binder-stat-bar { height: 100%; background: linear-gradient(90deg, #bd93f9, #ff79c6); border-radius: 5px; transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 0 10px rgba(255, 121, 198, 0.5); }
.binder-stat-text { flex: 0 0 130px; font-size: 0.85em; color: #94a3b8; text-align: left; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.binder-stat-text small { color: #ff79c6; font-weight: bold; margin-left: 4px; }

.skeleton-card { background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 10px; border-radius: var(--border-radius-md); border: 1px solid rgba(255, 255, 255, 0.05); display: flex; flex-direction: column; height: 100%; min-height: 310px; box-sizing: border-box; }
.skeleton-img { width: 100%; height: auto; aspect-ratio: 63 / 88; border-radius: var(--border-radius-md); overflow: hidden; margin-bottom: var(--spacing-sm); background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%); background-size: 200% 100%; animation: skeletonShimmer 1.5s infinite linear; }
.skeleton-text { height: 14px; border-radius: 4px; margin-top: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%); background-size: 200% 100%; animation: skeletonShimmer 1.5s infinite linear; }
.skeleton-text.title { width: 70%; height: 16px; }
.skeleton-text.subtitle { width: 40%; }
.skeleton-text.action { width: 90%; margin-top: auto; }
@keyframes skeletonShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

html, body, button, a, .card-item { -webkit-tap-highlight-color: transparent; }
.no-select, .search-toolbar, .metrics-box, .filter-btn, .toggle-btn, .nav-btn { -webkit-user-select: none; user-select: none; }
 
/* RESPONSIVE MEDIA QUERIES */

/* --- MOBILE & TABLET (< 768px) --- */
@media (max-width: 768px) {
    .dashboard-metrics-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .canvas-container { height: 280px; }
    .metrics-box { padding: 12px 5px; }
    .metrics-box .metric-icon { font-size: 1.4em; margin-bottom: 5px; }
    .metrics-box h3 { font-size: 0.55em; letter-spacing: 0.5px; margin-bottom: 4px; }
    .metrics-box .metric-value { font-size: 1.2em; }
    .metrics-box .metric-total { font-size: 0.6em; }
    .binder-stat-name { flex: 0 0 90px; font-size: 0.75em; }
    .binder-stat-text { flex: 0 0 110px; font-size: 0.75em; }
    .binder-stat-row { gap: 10px; }

    /* NUKE "COMPLETE" & Center mobile percentage */
    .chart-center-text .pct { font-size: 1.8rem !important; margin: 0 !important; padding: 0 !important; line-height: 1 !important; }
    .chart-center-text .lbl { display: none !important; }

    .search-tools-row, .bottom-toolbar-row { flex-wrap: wrap; justify-content: center; }
    .search-tools-row > div { flex: 1 1 100%; max-width: 100% !important; justify-content: center; }
    .bottom-toolbar-row > div { flex: 1 1 100%; max-width: 100% !important; justify-content: center; }
    .search-container { flex: 1 1 100%; margin-bottom: 5px; }
    .binder-footer { gap: 5px; }
    .binder-page-text, .binder-stat-text { font-size: 0.75em; min-width: auto; }
    /* Restore grid configurations for mobile */
    .binder-small { grid-template-columns: repeat(2, 1fr) !important; }
    .binder-medium { grid-template-columns: repeat(3, 1fr) !important; }
    .binder-large { grid-template-columns: repeat(4, 1fr) !important; }

    /* Let the artwork naturally dictate the height, removing the empty gaps */
    .card-item { height: auto !important; min-height: 0 !important; }
    .card-img { height: 100% !important; width: 100% !important; object-fit: cover !important; }
    .card-img { height: auto; }
    .card-item { min-height: auto; padding: 6px; }
    #buylist { gap: 6px; }
    .binder-arrow { font-size: 1.2rem; padding: 0; }

    /* Update Toolbar mobile styling */
    .control-panel { flex-direction: column; align-items: center; gap: 15px; }
    .control-left, .control-right { justify-content: center; width: 100%; }
    .control-center { max-width: 100%; width: 100%; }
    .search-sort-row { flex-wrap: wrap; }
}

/* --- DESKTOP WIDE & DASHBOARD SQUEEZE (> 850px) --- */
@media (min-width: 851px) {
    /* Container Expansions */
    .pokemon-buylist-wrapper { padding-left: 0 !important; padding-right: 0 !important; }
    .search-toolbar, .binder-container { max-width: 100% !important; }

    .dashboard-landing { gap: 10px !important; margin-top: 0 !important; }
    .dashboard-metrics-grid { gap: 10px !important; margin-bottom: 0 !important; }
    .metrics-box { padding: 15px 10px !important; }
    .metrics-box .metric-icon { font-size: 2em !important; margin-bottom: 5px !important; }
    .canvas-container { height: 180px !important; min-height: 180px !important; }
    .binder-stat-row { margin-bottom: 6px !important; }

    /* CENTER DESKTOP */
    .chart-center-text .pct {
        font-size: clamp(1.5rem, 2.5vw, 2.2rem) !important;
        line-height: 1 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .chart-center-text .lbl {
        display: none !important;
    }

    /* Flatten Control Panel */
    .search-toolbar, .control-panel {
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 15px !important;
    }
    .search-container, .control-left, .control-center, .control-right, .search-sort-row {
        width: auto !important;
        flex: 0 1 auto !important;
        flex-direction: row !important;
    }

    /* Card Proportions */
    .card-item {
        aspect-ratio: 63 / 88 !important;
        height: auto !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }

    /* Dynamic Vertical Scaling based on Grid Buttons */
    .binder-small .card-item { max-height: 30vh !important; }
    .binder-medium .card-item { max-height: 20vh !important; }
    .binder-large .card-item { max-height: 20vh !important; }

    /* --- SIDE-BY-SIDE CHART & STATS (DESKTOP) --- */
    
    .chart-wrapper { 
        display: grid !important; 
        grid-template-columns: 40% 60% !important; 
        align-items: center !important; 
        padding: 20px !important;
        gap: 30px !important;
        margin-top: 5px !important;
    }
    .canvas-container { 
        grid-column: 1 / 2 !important;
        margin: 0 auto !important;
    }
    .chart-wrapper > *:not(.canvas-container):not(#binder-stats-container) {
        grid-column: 1 / 2 !important;
        justify-self: center !important;
    }
    #binder-stats-container {
        grid-column: 2 / 3 !important;
        grid-row: 1 / -1 !important; 
        display: flex !important;
        flex-direction: column !important; 
        width: 100% !important;
        max-width: 550px !important;
        margin: 0 auto !important;
        gap: 15px !important; 
    }
    
    .binder-stat-row {
        margin-bottom: 0 !important; 
    }
    
    .binder-stat-bar-wrapper {
        height: 8px !important; 
    }

/* --- SHORT DESKTOP SCREENS (Hide Text) --- */
@media (min-width: 851px) and (max-height: 1100px) {
    .card-info, .pokemon-details, .card-text-wrapper {
        display: none !important;
    }
    .card-img {
        margin-bottom: 0 !important;
    }
}

/* ---  GLASS DROPDOWNS & CHART CENTERING --- */

.glass-content { min-width: 180px !important; padding: 10px !important; }
.glass-dropdown-section { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.glass-dropdown-section:last-child { margin-bottom: 0; }
.glass-dropdown-section span { font-size: 0.7em; color: #aaa; text-transform: uppercase; letter-spacing: 1px; }
.glass-select { width: 100%; background: rgba(0,0,0,0.4) !important; color: white !important; border: 1px solid rgba(255,255,255,0.05) !important; }
.chart-center-text { display: none !important; 
}

/* --- FORCE CHART CENTERING --- */
.chart-center-text { 
    position: absolute !important; 
    inset: 0 !important; 
    left: 0 !important;
    top: 0 !important;
    display: flex !important; 
    flex-direction: column !important; 
    justify-content: center !important; 
    align-items: center !important; 
    pointer-events: none !important; 
    transform: none !important; 
    padding-bottom: 35px !important; /* <--- THE MAGIC FIX: Pushes text up to match the donut hole */
}
.chart-center-text .pct { 
    margin: 0 !important; 
    padding: 0 !important; 
    text-align: center !important; 
}

/* --- ENHANCED DASHBOARD VIEW --- */
@media (min-width: 851px) {
    .canvas-container { 
        height: 350px !important; 
        min-height: 350px !important; 
        max-width: 450px !important;
    }

    .chart-wrapper { 
        grid-template-columns: 1fr 1fr !important; 
        gap: 50px !important;
        padding: 10px !important;
    }

    .chart-center-text .pct {
        font-size: 2.8rem !important;
        font-weight: 600 !important;
    }
}

@media (max-width: 768px) {
    .canvas-container { 
        height: 320px !important; 
    }
    .chart-center-text .pct { 
        font-size: 2.8rem !important; 
    }
}

/* --- PURE ART BINDER OVERRIDES --- */
.card-info {
    display: none !important;
}

.card-img {
    margin-bottom: 0 !important;
}

.card-item {
    padding: 6px !important; 
}

#buylist-viewport { perspective: 1200px; position: relative; }
.page-clone { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; transform-origin: left center; }
.turn-page-next { animation: swingLeft 0.45s cubic-bezier(0.4, 0.0, 0.2, 1) forwards; }
.turn-page-prev { transform-origin: right center; animation: swingRight 0.45s cubic-bezier(0.4, 0.0, 0.2, 1) forwards; }

@keyframes swingLeft { 
    0% { transform: rotateY(0deg) translateZ(0px); opacity: 1; filter: brightness(1); } 
    50% { transform: rotateY(-45deg) translateZ(100px); opacity: 0.9; filter: brightness(1.4); } 
    100% { transform: rotateY(-90deg) translateZ(0px); opacity: 0; filter: brightness(0.4); } 
}
@keyframes swingRight { 
    0% { transform: rotateY(0deg) translateZ(0px); opacity: 1; filter: brightness(1); } 
    50% { transform: rotateY(45deg) translateZ(100px); opacity: 0.9; filter: brightness(1.4); } 
    100% { transform: rotateY(90deg) translateZ(0px); opacity: 0; filter: brightness(0.4); } 
}