body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.scanner-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: 350px;
    aspect-ratio: 2.25 / 3.2;
    background-color: #000;
    border-radius: 20px;
    overflow: hidden;
    margin: 0 auto;
}

video {
    width: 100%;
    height: 100%;
    /* transform: scaleX(-1); */
    object-fit: contain; /* Ensure no hidden cropping */
    /* background-color: #000;
    transform: none; */
}

#scanner-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* This is critical for centering */
    /* width: 225px;
    height: 320px; */
    width: 220px;
    height: 310px;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 0 5000px rgba(0, 0, 0, 0.7);

    /* border: 4px solid #00ff00; */
}

.scan-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00ff00;
}

.top-left { top: 0; left: 0; border-right: none; border-bottom: none; }
.top-right { top: 0; right: 0; border-left: none; border-bottom: none; }
.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; }
.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; }

/* .badge { font-size: 0.85rem; } */

/* Floating Badge */
.floating-badge {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: #00ff00;
    padding: 8px 20px;
    border-radius: 50px;
    font-family: monospace;
    font-weight: bold;
    z-index: 20;
    border: 1px solid #00ff00;
}

/* .x-small { font-size: 0.75rem; } */

/* Collection Specific Styles */
.x-small {
    font-size: 0.65rem;
    letter-spacing: 0.05rem;
}

.card-img-top {
    aspect-ratio: 0.7; /* Standard TCG Ratio */
    object-fit: cover;
}

#collectionGrid .card {
    transition: transform 0.2s ease-in-out;
}

#collectionGrid .card:active {
    transform: scale(0.95); /* Tactile feel on mobile tap */
}

/* Ensure images don't look muddy on high-res mobile screens */
img {
    image-rendering: -webkit-optimize-contrast;
}

/* Enhanced Quantity Badges */
.badge.bg-success {
    background-color: #198754 !important; /* Green for playsets */
    border: 1px solid #ffffff44;
}

.badge.bg-primary {
    background-color: #0d6efd !important; /* Blue for incomplete sets */
    border: 1px solid #ffffff44;
}

.card-item {
    transition: all 0.2s ease;
}

/* Subtle dimming of cards you don't have yet if we ever add a wishlist */
.card-item:hover {
    transform: translateY(-5px);
}

/* Ensure all inputs and text are high-contrast */
input.form-control {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    border: 1px solid #444 !important;
}

input.form-control::placeholder {
    color: #888 !important;
}

/* Fix Card Text visibility */
.card-body h5, .card-body h6, .card-body p {
    color: #ffffff !important;
}

.text-muted {
    color: #b0b0b0 !important; /* Brighter than default muted for dark mode */
}

/* Scanner Brackets visibility */
.scan-corner {
    border-color: #00ff00 !important; /* Bright neon green */
    filter: drop-shadow(0 0 2px #000); /* Helps brackets pop against light cards */
}

/* Modal Refinements */
.modal-content {
    border-radius: 15px;
}

#qv-img {
    transition: transform 0.3s ease;
}

#qv-img:hover {
    transform: scale(1.02); /* Slight zoom effect on hover */
}

/* Make sure modal text is ultra-clear */
.modal-title {
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* --- High-Contrast Scanner Polish --- */

/* 1. The Manual Search Bar */
#manualSearch {
    background-color: #000000 !important; /* Pure black for deep contrast */
    color: #ffffff !important;
    border: 2px solid #0d6efd !important; /* Bright Bootstrap Blue */
    font-weight: 600;
}

#manualSearch::placeholder {
    color: #aaaaaa !important; /* Brighter placeholder for visibility */
}

/* 2. The Sensitivity Slider */
#sensitivity-range {
    height: 10px;
    background: #333;
    border-radius: 5px;
    outline: none;
}

/* Make the Slider Knob (Thumb) very visible */
#sensitivity-range::-webkit-slider-thumb {
    appearance: none;
    width: 25px;
    height: 25px;
    background: #0d6efd; /* Match search border */
    border: 3px solid #ffffff; /* White ring for contrast */
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.5);
}

/* 3. The Sensitivity Label */
#range-val {
    background: #0d6efd;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
}

/* 4. Fix Results Card Text */
#card-result {
    border: 1px solid #0d6efd !important;
    background-color: #1a1a1a !important;
}

#res-name {
    color: #ffffff !important;
    text-shadow: 1px 1px 2px #000;
}

/* Flash Button Glow */
.btn-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.6);
}

/* Standard Portrait */
.card-img-top {
    aspect-ratio: 0.7; 
    object-fit: cover;
    background-color: #000;
}

/* New Landscape Class */
.card-landscape {
    aspect-ratio: 1.43 !important; /* Inverted ratio for sideways cards */
    object-fit: cover;
}

.deck-header-img {
    width: 100%;             /* Fill the width of the column */
    aspect-ratio: 1.4;       /* Force Standard Landscape Card Ratio */
    object-fit: contain;     /* Ensure the whole card is visible, no squishing */
    background-color: #121212; /* Dark background for any letterboxing */
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}