#namePlateContainer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Keeps both lines centered on the scroll */
    overflow: hidden;
    /* Essential so we don't see the text "poke out" while shrinking */
    padding: 10px 15px;
    min-height: 95px;
}

#charDisplayName {
    display: block;
    white-space: nowrap;
    line-height: 1.2;
    text-align: center;
    width: fit-content;
}

#charDisplaySuffix {
    display: block;
    white-space: nowrap;
    line-height: 1.2;
    text-align: center;
    width: fit-content;
    margin-top: 4px;
    opacity: 0.9;
}

.menu-popover {
    opacity: 0;
    transform: translateY(10px); /* Start slightly offset */
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block !important; /* We override 'display: none' to allow transitions */
}

.menu-popover.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#volumePercent {
    transition: transform 0.1s ease-out;
    display: inline-block;
    min-width: 35px;
    text-align: center;
}

/* Optional: Make it pop slightly when changing */
#volumeSlider:active + #volumePercent {
    transform: scale(1.1);
}

.item-flavour {
    font-family: 'Georgia', serif; /* A serif font feels more "book-like" and old-world */
    font-style: italic;
    color: #94a3b8; /* A soft blue-grey */
    line-height: 1.4;
    position: relative;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

/* Optional: Adds a small decorative quote mark or line to the side */
.item-flavour::before {
    content: "“";
    position: absolute;
    left: 0;
    top: -5px;
    font-size: 1.5rem;
    opacity: 0.3;
}

#reader {
    position: relative; /* Crucial for the absolute child to work */
}

/* Idle Scanning Line */
.scan-laser {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(34, 197, 94, 0.5); /* Faint Green */
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
    z-index: 998; /* Just below the success flash */
    pointer-events: none;
    display: none; /* Hidden until scanner starts */
    animation: scanningLoop 2.5s ease-in-out infinite;
}

@keyframes scanningLoop {
    0% { top: 0%; opacity: 0.2; }
    50% { top: 100%; opacity: 0.8; }
    100% { top: 0%; opacity: 0.2; }
}



/* Hide the idle laser when success animation triggers */
.scan-success ~ .scan-laser {
    display: none;
}

/* The container */
.scan-feedback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* The horizontal lines with Neon Glow and Flicker */
.scan-feedback::before,
.scan-feedback::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px; 
    background-color: #4ade80;
    box-shadow: 
        0 0 5px #fff,
        0 0 10px #22c55e,
        0 0 20px #16a34a,
        0 0 40px #14532d;
    opacity: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.8);
}

/* Top line starting position */
.scan-feedback::before { top: 0; }

/* Bottom line starting position */
.scan-feedback::after { bottom: 0; }

/* The Animation Trigger */
.scan-success::before {
    /* Reduced from 1.2s to 0.95s */
    animation: 
        descendAndShrink 0.95s cubic-bezier(0.19, 1, 0.22, 1) forwards,
        flicker 0.1s infinite;
}

.scan-success::after {
    /* Reduced from 1.2s to 0.95s */
    animation: 
        ascendAndShrink 0.95s cubic-bezier(0.19, 1, 0.22, 1) forwards,
        flicker 0.1s infinite;
}

/* Refined Movement Keyframes for smoothness */
@keyframes descendAndShrink {
    0% { top: 0; opacity: 0; width: 100%; left: 0; transform: scaleX(1); }
    15% { opacity: 1; }
    50% { top: 50%; opacity: 1; width: 100%; left: 0; transform: scaleX(1); }
    100% { top: 50%; opacity: 0; width: 0%; left: 50%; transform: scaleX(0); }
}

@keyframes ascendAndShrink {
    0% { bottom: 0; opacity: 0; width: 100%; left: 0; transform: scaleX(1); }
    15% { opacity: 1; }
    50% { bottom: 50%; opacity: 1; width: 100%; left: 0; transform: scaleX(1); }
    100% { bottom: 50%; opacity: 0; width: 0%; left: 50%; transform: scaleX(0); }
}

/* Flicker Keyframes - Randomizing brightness */
@keyframes flicker {
    0% { opacity: 0.9; filter: brightness(1); }
    25% { opacity: 0.8; filter: brightness(1.2); }
    50% { opacity: 1; filter: brightness(0.9); }
    75% { opacity: 0.7; filter: brightness(1.1); }
    100% { opacity: 0.9; filter: brightness(1); }
}

/* This makes the camera box 'invisible' to mouse clicks */
#reader,
#reader * {
    pointer-events: none !important;
}

/* This makes sure the buttons are ALWAYS on top and clickable */
#scannerSection button {
    position: relative !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
    /* Forces them to be clickable */
}

/* Ensures the laser doesn't block clicks either */
#scanLaser {
    pointer-events: none !important;
}