/* --- 0. Base & Layout --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

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

html {
    background-color: transparent; /* Allow iframe transparency to work */
}

body {
    background-color: #0f1419; /* Apply dark color ONLY to body */
    color: #FFFFFF;
    font-family: 'Roboto', 'Amazon Ember', sans-serif;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- 1. Ambient Mode (Logo & Title) --- */
@keyframes pulse-glow {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 149, 0, 0.4),
                    0 0 40px rgba(255, 149, 0, 0.2),
                    0 0 60px rgba(255, 149, 0, 0.1);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(255, 149, 0, 0.6),
                    0 0 60px rgba(255, 149, 0, 0.3),
                    0 0 90px rgba(255, 149, 0, 0.15);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 149, 0, 0.4),
                    0 0 40px rgba(255, 149, 0, 0.2),
                    0 0 60px rgba(255, 149, 0, 0.1);
    }
}

/* New animation that preserves vertical centering */
@keyframes pulse-glow-centered {
    0% {
        /* Keep translateY(-50%) so it stays centered */
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 15px rgba(255, 149, 0, 0.4),
                    0 0 30px rgba(255, 149, 0, 0.2),
                    0 0 45px rgba(255, 149, 0, 0.1);
    }
    50% {
        transform: translateY(-50%) scale(1.1); /* Scale up slightly while centered */
        box-shadow: 0 0 25px rgba(255, 149, 0, 0.6),
                    0 0 50px rgba(255, 149, 0, 0.3),
                    0 0 75px rgba(255, 149, 0, 0.15);
    }
    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 15px rgba(255, 149, 0, 0.4),
                    0 0 30px rgba(255, 149, 0, 0.2),
                    0 0 45px rgba(255, 149, 0, 0.1);
    }
}

@keyframes pulse-glow-simple {
    0% {
        box-shadow: 0 0 4px rgba(255, 149, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 6px rgba(255, 149, 0, 0.6);
    }
    100% {
        box-shadow: 0 0 4px rgba(255, 149, 0, 0.4);
    }
}

/* New Static Pulse (for HUD/Button) */
@keyframes pulse-glow-static {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 149, 0, 0.3);
        border-color: #FF9500;
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(255, 149, 0, 0.6);
        border-color: #ffb340;
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 149, 0, 0.3);
        border-color: #FF9500;
    }
}

#ambient-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

body.has-response #ambient-container {
    opacity: 0;
    pointer-events: none;
}

.ambient-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 8px;
    border-radius: 50%;
    background-color: #0f1419;
    border: 2px solid #FF9500;
    box-shadow: 0 0 20px rgba(255, 149, 0, 0.4),
                0 0 40px rgba(255, 149, 0, 0.2),
                0 0 60px rgba(255, 149, 0, 0.1);
    animation: pulse-glow 2.5s infinite ease-in-out;
}

.ambient-title {
    font-size: 3rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 2px;
    text-align: center;
}

/* --- 2. Output Panel System --- */
#output-container {
    position: fixed;
    top: 40px;
    bottom: 130px;
    width: 75%;
    left: 12.5%;
    display: flex;
    flex-direction: column-reverse;
    justify-content: center;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    z-index: 5;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#output-container::-webkit-scrollbar {
    display: none;
}

body.has-response #output-container {
    opacity: 1;
    pointer-events: all;
}

/* --- 3. Media Panels --- */
#media-panel-wrapper {
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
    flex: 0;
    min-height: 0;
    transition: flex 0.4s ease-in-out, gap 0.4s ease-in-out;
}

#media-panel-wrapper.visible {
    flex: 1;
}

#media-panel-wrapper:has(#media-panel-1.visible):has(#media-panel-2.visible) {
    gap: 12px;
}

.media-panel {
    width: 100%;
    background: linear-gradient(145deg, #1a1f2e 0%, #232f3e 100%);
    border: 1px solid rgba(255, 107, 0, 0.2);
    border-radius: 12px;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease-in-out, flex 0.4s ease-in-out;
}

.media-panel:not(.visible) {
    flex: 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    max-height: 0;
    opacity: 0;
}

.media-panel.visible {
    opacity: 1;
    max-height: 70vh;
    padding: 20px;
    flex: 1;
}

.media-panel img,
.media-panel video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

/* Fullscreen Button */
.fullscreen-button {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 36px;
    height: 36px;
    background: rgba(26, 31, 46, 0.8);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 8px;
    pointer-events: none;
}

.media-panel.visible .fullscreen-button {
    opacity: 0.7;
    pointer-events: all;
}

.fullscreen-button:hover {
    opacity: 1;
    transform: scale(1.08);
}

.fullscreen-button::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background:
        linear-gradient(to right, #FF9500 0%, #FF9500 100%) 0 0 / 8px 2px no-repeat,
        linear-gradient(to bottom, #FF9500 0%, #FF9500 100%) 0 0 / 2px 8px no-repeat,
        linear-gradient(to right, #FF9500 0%, #FF9500 100%) 100% 0 / 8px 2px no-repeat,
        linear-gradient(to bottom, #FF9500 0%, #FF9500 100%) 100% 0 / 2px 8px no-repeat,
        linear-gradient(to right, #FF9500 0%, #FF9500 100%) 0 100% / 8px 2px no-repeat,
        linear-gradient(to bottom, #FF9500 0%, #FF9500 100%) 0 100% / 2px 8px no-repeat,
        linear-gradient(to right, #FF9500 0%, #FF9500 100%) 100% 100% / 8px 2px no-repeat,
        linear-gradient(to bottom, #FF9500 0%, #FF9500 100%) 100% 100% / 2px 8px no-repeat;
}

/* Fullscreen Mode */
body.is-fullscreen .media-panel:not(.fullscreen-active) {
    display: none;
}

body.is-fullscreen #text-panel {
    display: none;
}

body.is-fullscreen .media-panel.fullscreen-active {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 20px;
    margin: 0;
    z-index: 2000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #1a1f2e;
    box-sizing: border-box;
    opacity: 1;
    flex: 1 !important;
}

body.is-fullscreen .media-panel.fullscreen-active img,
body.is-fullscreen .media-panel.fullscreen-active video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

body.is-fullscreen .media-panel.fullscreen-active .fullscreen-button {
    opacity: 0.9;
    z-index: 2002;
}

body.is-fullscreen .fullscreen-button::before {
    background:
        linear-gradient(to bottom, transparent 45%, #FF9500 45%, #FF9500 55%, transparent 55%) 50% 50% / 100% 2px no-repeat,
        linear-gradient(to right, transparent 45%, #FF9500 45%, #FF9500 55%, transparent 55%) 50% 50% / 2px 100% no-repeat;
    transform: rotate(45deg);
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    position: absolute;
    content: '';
}

body.is-fullscreen #input-bar-container {
    z-index: 2001;
}

/* --- 4. Text Panel --- */
#text-panel {
    width: 100%;
    padding: 24px;
    background: linear-gradient(145deg, #1a1f2e 0%, #232f3e 100%);
    border: 1px solid rgba(255, 107, 0, 0.2);
    border-radius: 12px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #FFFFFF;
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out, padding 0.4s ease-in-out;
}

#text-panel.visible {
    opacity: 1;
    max-height: 40vh;
    overflow-y: auto;
    padding: 24px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#text-panel.visible::-webkit-scrollbar {
    display: none;
}

#text-panel:not(.visible) {
    padding-top: 0;
    padding-bottom: 0;
}

/* Error State: Horizontal Layout */
#text-panel.is-error {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
}

/* 2. Adjust Text Padding so it doesn't overlap the logo */
#text-panel-content {
    white-space: normal;
    /* 24px (left gap) + 42px (logo) + 12px (spacing) = 78px */
    padding-left: 78px;
    padding-right: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Error State: Remove padding, let flexbox handle spacing */
#text-panel.is-error #text-panel-content {
    padding-left: 0;
    padding-right: 0;
    flex: 1;
    color: #ff9a9a;
}

/* 1. Resize the Main Logo */
.text-panel-logo {
    position: absolute;
    top: 50%;
    left: 24px;
    /* This initial transform sets the center */
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid #FF9500;
    background-color: #0f1419;
    z-index: 10;
    /* FIX: Use the new "Centered" animation */
    animation: pulse-glow-centered 2.5s infinite ease-in-out;
}

/* Error State: Logo in flex layout */
#text-panel.is-error .text-panel-logo {
    position: static;
    transform: none;
    flex-shrink: 0;
    /* FIX: Use the standard 'pulse-glow' (scaling only) */
    /* Do NOT use 'pulse-glow-centered' here, or it will jump up */
    animation: pulse-glow 2.5s infinite ease-in-out;
}

/* Hide border when animation runs */
.text-panel-logo.speaking {
    border-color: transparent;
    animation: none;
    box-shadow: none;
    transform: translateY(-50%);
}

.text-panel-logo img {
    opacity: 0.6;
}

#retry-button {
    background-color: #FF9500;
    color: #1a1f2e;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Error State: Button in flex layout */
#text-panel.is-error #retry-button {
    margin-top: 0;
}

#retry-button:hover {
    background-color: #ffab40;
}

#retry-button.hidden {
    display: none;
}

/* --- 5. Input Bar --- */
#input-bar-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 66.66%;
    max-width: 800px;
    z-index: 1000;
}

.input-wrapper {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: #0F1419;
    border: 1px solid #333;
    border-radius: 28px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

#messageInput {
    flex-grow: 1;
    background-color: #2a3440;
    border: 1px solid #555;
    border-radius: 20px;
    padding: 14px 20px;
    color: #FFF;
    font-size: 1.2rem;
    margin-right: 8px;
    outline: none;
    transition: border-color 0.2s;
}

#messageInput:focus {
    border-color: #FF9500;
}

@keyframes pulse-border {
    0%, 100% {
        border-color: #FF9500;
        box-shadow: 0 0 0 0 rgba(255, 149, 0, 0.4);
    }
    50% {
        border-color: #FFB84D;
        box-shadow: 0 0 0 4px rgba(255, 149, 0, 0.2);
    }
}

#messageInput.listening {
    border-color: #FF9500;
    animation: pulse-border 2s ease-in-out infinite;
}

#messageInput.listening::placeholder {
    color: rgba(255, 149, 0, 0.7);
    opacity: 1;
}

.voice-toggle-button {
    flex-shrink: 0;
    padding: 2px;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.voice-toggle-button:hover {
    opacity: 1;
}

.voice-toggle-icon {
    display: block;
    width: 40px;
    height: 20px;
    background: #666;
    border-radius: 10px;
    position: relative;
    transition: background-color 0.3s ease;
}

.voice-toggle-icon::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
}

/* Explicit inactive state (not active) */
.voice-toggle-button:not(.active) .voice-toggle-icon {
    background: #666 !important;
}

.voice-toggle-button:not(.active) .voice-toggle-icon::before {
    transform: translateX(0) !important;
}

/* Active state */
.voice-toggle-button.active .voice-toggle-icon {
    background: #FF9500;
}

.voice-toggle-button.active .voice-toggle-icon::before {
    transform: translateX(20px);
}

/* Recording state for voice button */
.voice-toggle-button.recording .voice-toggle-icon {
    background: #ff6b00;
    animation: pulse-recording 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.3);
}

@keyframes pulse-recording {
    0% { box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 0, 0.1); }
    100% { box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.3); }
}

/* Input Divider */
.input-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Icon Button (Audio Output Toggle) */
.icon-button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: none !important;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease;
}

.icon-button:hover {
    background: none !important;
    color: #fff;
}

.icon-button:focus {
    outline: none;
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

/* Muted State (default - grey, no waves) */
.icon-button.muted-state {
    color: #666;
}

.icon-button.muted-state:hover {
    color: #fff;
}

.icon-button.muted-state .sound-waves {
    display: none;
}

/* Active State (orange, with waves) */
.icon-button.active {
    color: #FF9500;
}

.icon-button.active .sound-waves {
    display: block;
}

/* --- 6. Safety Gate Overlay --- */
#safety-gate-overlay {
    position: fixed;
    bottom: 200px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

#start-safety-btn {
    background-color: #FF9500;
    color: #000;
    font-weight: bold;
    padding: 15px 30px;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.4);
    animation: pulse-glow-static 2s infinite;
    transition: transform 0.2s;
}

#start-safety-btn:hover {
    transform: scale(1.05);
}

/* ============================================ */
/* --- 7. CURTAIN MODE & HUD (Restored) --- */
/* ============================================ */

/* Uniform Fade Overlay */
#storyline-fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0f1419;
    opacity: 0;
    pointer-events: none;
    z-index: 1500;
    /* No transition - instant switch */
}

#storyline-fade-overlay.fading-out {
    opacity: 1;
}

/* 1. The Container State */
body {
    /* No transition - instant switch */
}

body.storyline-mode {
    background-color: transparent !important; /* This now reveals the transparent html tag */
    pointer-events: none !important; /* CRITICAL: Allows clicks to pass through empty areas */
}

/* Force elements inside the curtain to be clickable */
body.storyline-mode #hud-response-panel,
body.storyline-mode #input-bar-container,
body.storyline-mode #training-trigger-btn {
    pointer-events: auto !important;
}

/* 2. Hide Standard Panels in Training Mode */
body.storyline-mode #ambient-container,
body.storyline-mode #output-container,
body.storyline-mode .ambient-logo {
    opacity: 0 !important;
    display: none !important;
    pointer-events: none;
}

/* 3. HUD Panel (Top Left) */
#hud-response-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 320px;
    max-height: 60vh;
    background: rgba(15, 20, 25, 0.95);
    border: 1px solid #FF9500;
    border-radius: 12px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

body.storyline-mode #hud-response-panel.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    height: 60px;
    border-bottom: 1px solid rgba(255, 149, 0, 0.2);
}

/* --- HUD Logo --- */
.mini-logo {
    width: 32px;  /* Match HTML width */
    height: 32px; /* Match HTML height */
    border-radius: 50%;
    /* RESTORE STATIC BORDER (Script clears canvas when idle) */
    border: 2px solid #FF9500;
    background-color: transparent;
    /* Optional: Simple pulse when idle, if desired */
    animation: pulse-glow-static 2.5s infinite ease-in-out;
    display: block;
    margin: 0; /* Reset margins */
}

/* Hide CSS border when JS is drawing the animation */
.mini-logo.speaking {
    border-color: transparent;
    animation: none;
}

/* Force pulse to stop when speaking class is added */
.mini-logo.speaking {
    animation: none !important;
    border: 1px solid rgba(255, 149, 0, 0.3) !important;
    background-color: #0f1419;
}

#hud-content-area {
    padding: 16px;
    color: #eee;
    overflow-y: auto;
}

#hud-close-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
}

/* 4. Trigger Button (Bottom Left) */
#training-trigger-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    z-index: 2005;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.trigger-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0f1419;
    border: 2px solid #FF9500;
    animation: pulse-glow-static 2.5s infinite ease-in-out;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

body.storyline-mode #training-trigger-btn {
    display: flex;
}

/* 5. Input Bar Position in Training */
body.storyline-mode #input-bar-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 320px;
    transform: none;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.storyline-mode .input-wrapper {
    width: 100%;
    max-width: 100%;
    background-color: rgba(15, 20, 25, 0.9);
    backdrop-filter: blur(10px);
}

/* Expanded State (Input visible, Button hidden) */
body.storyline-mode.input-expanded #training-trigger-btn {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

body.storyline-mode.input-expanded #input-bar-container {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}




/* --- Language Selector --- */
#lang-selector {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 3000;
}

#lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(30, 32, 40, 0.85);
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: 8px;
    padding: 6px 12px;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

#lang-btn:hover {
    border-color: rgba(255, 149, 0, 0.6);
    background: rgba(40, 42, 52, 0.9);
}

#lang-flag {
    font-size: 16px;
    line-height: 1;
}

#lang-code {
    letter-spacing: 0.5px;
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(24, 26, 32, 0.95);
    border: 1px solid rgba(255, 149, 0, 0.25);
    border-radius: 10px;
    padding: 4px;
    min-width: 160px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.lang-dropdown.hidden {
    display: none;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #c0c0c0;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.lang-option:hover {
    background: rgba(255, 149, 0, 0.12);
    color: #fff;
}

.lang-option.active {
    background: rgba(255, 149, 0, 0.18);
    color: #ff9500;
    font-weight: 500;
}

.lang-opt-flag {
    font-size: 16px;
    line-height: 1;
}



/* ── Feedback UI (Inline Thumbs + Lightbox) ──────────────────────────── */

.feedback-thumbs-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(30, 30, 50, 0.95);
    border: 1px solid rgba(232, 135, 30, 0.4);
    border-radius: 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
}

.feedback-thumbs-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.feedback-thumb {
    background: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-thumb:hover {
    transform: scale(1.15);
}

.feedback-thumb-up:hover {
    border-color: #6ee7a0;
    background: rgba(110, 231, 160, 0.1);
}

.feedback-thumb-down:hover {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

@keyframes feedbackSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Alias Prompt ──────────────────────────────────── */

.feedback-alias-prompt {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.feedback-alias-card {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
    width: 340px;
    text-align: center;
}

.feedback-alias-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.feedback-alias-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.feedback-alias-input {
    width: 100%;
    padding: 10px 14px;
    background: #111120;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.feedback-alias-input:focus {
    border-color: #e8871e;
}

.feedback-alias-btn {
    width: 100%;
    padding: 10px;
    background: #e8871e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.feedback-alias-btn:hover {
    background: #d07818;
}

/* ── Lightbox Overlay ──────────────────────────────── */

.feedback-lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
    pointer-events: none;
}

.feedback-lightbox-overlay.visible {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.feedback-lightbox-card {
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px 28px 32px;
    width: 380px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.05, 0.7, 0.1, 1);
}

.feedback-lightbox-overlay.visible .feedback-lightbox-card {
    transform: translateY(0);
    opacity: 1;
}

.feedback-lightbox-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.feedback-lightbox-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.feedback-lightbox-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.feedback-lightbox-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 14px;
}

/* ── Category Options ──────────────────────────────── */

.feedback-categories {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.feedback-category-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.feedback-category-option:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.feedback-category-option.selected {
    background: rgba(232, 135, 30, 0.1);
    border-color: #e8871e;
}

.feedback-category-option input[type="radio"] {
    accent-color: #e8871e;
    width: 16px;
    height: 16px;
    margin: 0;
}

.feedback-category-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* ── Detail Input ──────────────────────────────────── */

.feedback-detail-section {
    margin-bottom: 12px;
}

.feedback-detail-input {
    width: 100%;
    padding: 8px 12px;
    background: #111120;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    resize: vertical;
    min-height: 48px;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.feedback-detail-input:focus {
    border-color: #e8871e;
}

/* ── Submit Button ─────────────────────────────────── */

.feedback-submit-btn {
    width: 100%;
    padding: 12px;
    background: #e8871e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.feedback-submit-btn:hover:not(:disabled) {
    background: #d07818;
}

.feedback-submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Translation Correction Lightbox ─────────────────────── */
.translation-correction-card {
    max-width: 520px;
}

.translation-correction-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 12px;
    margin-bottom: 4px;
}

.translation-correction-readonly {
    background: #111120;
    border: 1px solid #1e1e30;
    border-radius: 6px;
    padding: 10px 12px;
    color: #aaa;
    font-size: 13px;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    word-wrap: break-word;
}

.translation-correction-textarea {
    width: 100%;
    background: #1a1a2a;
    border: 1px solid #2a2a3a;
    border-radius: 6px;
    padding: 10px 12px;
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    min-height: 100px;
    resize: vertical;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
}

.translation-correction-textarea:focus {
    border-color: #e8871e;
}

/* ── UAT Review Mode (integ-only, ?uat=1) ──────────────── */
/* The alias lightbox reuses the legacy .feedback-alias-* classes
   (defined above) so it inherits the branded "Welcome to ALEX" card.
   Only the Trainer-needed button needs its own styling here. */

/* "Trainer needed" — top-right, directly under the language selector.
   Matches the language pill exactly: same border, same blur, same font.
   No icon — plain text only. */
.uat-trainer-btn {
    position: fixed;
    top: 58px;            /* sits just under #lang-btn (top:16px, ~36px tall) */
    right: 16px;
    z-index: 2999;        /* one below lang-selector (3000) so dropdown stays on top */
    display: flex;
    align-items: center;
    background: rgba(30, 32, 40, 0.85);
    border: 1.5px solid rgba(255, 149, 0, 0.45);
    border-radius: 10px;
    padding: 10px 18px;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    white-space: nowrap;
}

.uat-trainer-btn:hover:not(:disabled) {
    border-color: rgba(255, 149, 0, 0.6);
    background: rgba(40, 42, 52, 0.9);
}

.uat-trainer-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.uat-trainer-btn.logged {
    border-color: rgba(34, 197, 94, 0.6);
    color: #22c55e;
}

.uat-trainer-label {
    letter-spacing: 0.3px;
}

/* "Was this helpful?" — same pill styling, directly below Trainer needed. */
.uat-helpful-btn {
    top: 110px;           /* trainer btn top:58px + ~44px height + 8px gap */
}

/* Thumbs row revealed by the helpful button — sits directly below it. */
.uat-thumbs-row {
    position: fixed;
    top: 162px;           /* helpful btn top:110px + ~44px height + 8px gap */
    right: 16px;
    z-index: 2999;
    display: flex;
    gap: 8px;
    background: rgba(30, 32, 40, 0.85);
    border: 1.5px solid rgba(255, 149, 0, 0.45);
    border-radius: 10px;
    padding: 6px 10px;
    backdrop-filter: blur(8px);
}

/* Record button inside the why-lightbox. Matches the branded card,
   turns red while recording. */
.uat-record-btn {
    display: block;
    width: 100%;
    margin: 10px 0 4px;
    padding: 10px 18px;
    background: rgba(30, 32, 40, 0.85);
    border: 1.5px solid rgba(255, 149, 0, 0.45);
    border-radius: 10px;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.uat-record-btn:hover:not(:disabled) {
    border-color: rgba(255, 149, 0, 0.6);
}

.uat-record-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.uat-record-btn.recording {
    border-color: rgba(239, 68, 68, 0.7);
    color: #ef4444;
    animation: uat-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes uat-rec-pulse {
    0%, 100% { background: rgba(30, 32, 40, 0.85); }
    50% { background: rgba(60, 30, 30, 0.9); }
}


