:root {
    --primary-bg: #0a0e27;
    --card-bg: rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
    --accent-blue: #00c6ff;
    --accent-purple: #9d00ff;
    --gradient-text: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);

    /* Motion tokens */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
    --dur-press: 160ms;
    --dur-fast: 200ms;
    --dur-enter: 250ms;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at center, #243b7a, #050a1f);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* Pagina Crea: più larga per chat e domande affiancate */
.create-container {
    max-width: 1400px;
}

.app-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 60px;
}

.app-header-main {
    text-align: center;
    width: 100%;
}

.app-logo {
    height: 112px;
    width: auto;
    position: absolute;
    top: 50px;
    left: 50px;
}

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .app-header-main {
        text-align: center;
    }

    .app-logo {
        height: 80px;
    }
}

/* Header */
header {
    margin-bottom: 60px;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.title-melody {
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 242, 254, 0.5));
}

.title-experience {
    background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%); /* Much brighter pink/purple */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-left: 15px;
    filter: drop-shadow(0 0 15px rgba(245, 87, 108, 0.5));
}

.text-gradient-blue-purple {
    background: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 198, 255, 0.3)) drop-shadow(0 0 15px rgba(157, 0, 255, 0.3));
}

.subtitle {
    font-size: 1.3rem;
    color: #e6e9f0;
    font-weight: 300;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Cards Container */
.cards-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 40px;
    width: 350px;
    transition: transform var(--dur-fast) var(--ease-out), box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 20;
}

/* Hover only on real pointers: on touch a tap would leave the hover state stuck */
@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-10px);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.6); /* Purple/Violet Glow */
        /* More transparent background on hover */
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
        border-color: rgba(139, 92, 246, 0.5); /* Matching border color */
        backdrop-filter: blur(8px); /* Slightly less blur to enhance transparency feel */
        -webkit-backdrop-filter: blur(8px);
    }
}

.card-icon {
    font-size: 3.5rem;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.card h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: 700;
    letter-spacing: 1px;
}

.card p {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

/* Footer */
footer {
    margin-top: 60px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    position: relative;
    z-index: 10;
    padding-bottom: 20px;
}

/* Background Animation */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: #00c6ff;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: #9d00ff;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 300px;
    height: 300px;
    background: #ff0055;
    opacity: 0.2;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Wizard Specific Styles */
.wizard-container {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 0; /* Removing padding to allow full-width layout */
    width: 100%;
    max-width: 1000px; /* Wider container */
    min-height: 600px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex; /* Use flexbox for layout */
    overflow: hidden;
}

/* Left Panel - Chat/Context */
.wizard-left-panel {
    width: 35%;
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.wizard-title-small {
    font-size: 1.2rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    animation: fadeIn var(--dur-enter) var(--ease-out);
}

.chat-bubble.system {
    border-left: 3px solid #00c6ff;
}

.chat-bubble.user {
    background: rgba(157, 0, 255, 0.1);
    border-right: 3px solid #9d00ff;
    text-align: right;
    align-self: flex-end; /* Note: flex-direction is column */
    margin-left: auto;
}

/* Right Panel - Options/Interaction */
.wizard-right-panel {
    width: 65%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.wizard-question-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: white;
    text-shadow: 0 0 15px rgba(0, 198, 255, 0.5);
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.question-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: -10px;
}

.question-timer {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    min-width: 56px;
    text-align: center;
}

.question-timer-warning {
    color: #ff4d4f;
    border-color: rgba(255, 77, 79, 0.9);
    animation: questionTimerBlink 1s step-start infinite;
}

@keyframes questionTimerBlink {
    50% {
        opacity: 0.3;
    }
}

.options-scroll-area {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 4px;
    padding-top: 4px;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.options-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.options-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.options-scroll-area::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.options-grid-dynamic {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    justify-content: center;
    max-width: 640px;
    margin: 0 auto;
}

.option-card-dynamic {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    /* Touch target: at least 48px tall for a finger on the kiosk */
    min-height: 48px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
    text-align: center;
    position: relative;
    overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
    .option-card-dynamic:hover {
        background: rgba(0, 198, 255, 0.12);
        border-color: #00c6ff;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
}

/* Buttons reusing the option style (Riprova, invia via mail) stay inline and centred */
button.option-card-dynamic {
    display: inline-flex;
    font: inherit;
}

/* Options enter staggered on every question change (delay set inline by JS).
   fill-mode "backwards" only: after the entrance the element's own transform rules apply again (press feedback). */
.options-grid-dynamic > .option-card-dynamic {
    animation: fadeIn var(--dur-enter) var(--ease-out) backwards;
}

.wizard-question-header {
    animation: fadeIn var(--dur-enter) var(--ease-out) backwards;
}

.option-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: white;
    margin-bottom: 2px;
}

.option-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}



@keyframes eqProgress {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

@keyframes eqProgressInactive {
    0%, 100% { transform: scaleY(0.2); }
    50% { transform: scaleY(0.5); }
}

.question-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
    color: white;
    text-shadow: 0 0 15px rgba(0, 198, 255, 0.5);
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-press) var(--ease-out);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
}

@media (hover: hover) and (pointer: fine) {
    .option-btn:hover {
        background: rgba(0, 198, 255, 0.2);
        border-color: #00c6ff;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(0, 198, 255, 0.2);
    }
}

.option-btn i {
    font-size: 1.2rem;
    color: #00c6ff;
}

/* Loader Animation */
.loader {
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid #00c6ff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spinner shown while the AI writes the song (main.js renderCurrentQuestion) */
.loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-top-color: #00c6ff;
    border-right-color: #9d00ff;
    animation: spin 0.9s linear infinite;
}

/* Formatted Song Lyrics Styles */
.song-container {
    text-align: left;
    max-width: 100%;
    margin: 0 auto;
    font-family: 'Poppins', sans-serif;
}

.song-header {
    border-bottom: 2px solid rgba(0, 198, 255, 0.3);
    padding-bottom: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.song-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 198, 255, 0.6);
    background: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.song-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.meta-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-label {
    color: #00c6ff;
    font-weight: bold;
    margin-right: 5px;
}

.song-body {
    padding: 10px;
}

.song-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border-left: 3px solid rgba(157, 0, 255, 0.5);
    transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .song-section:hover {
        background: rgba(255, 255, 255, 0.06);
        transform: translateX(5px);
    }
}

.section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #9d00ff;
    margin-bottom: 15px;
    font-weight: 700;
    display: inline-block;
    padding: 3px 8px;
    border: 1px solid rgba(157, 0, 255, 0.3);
    border-radius: 4px;
}

.section-content {
    line-height: 1.8;
}

.lyrics-line {
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: 1.05rem;
}

.chords-line {
    color: #00c6ff;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    opacity: 0.9;
}

.song-actions {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.action-btn {
    display: inline-block;
    padding: 15px 30px;
    text-decoration: none;
    color: white;
    border-radius: 30px;
    font-weight: 600;
    transition: transform var(--dur-press) var(--ease-out), box-shadow var(--dur-fast) ease, background var(--dur-fast) ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(90deg, #00c6ff 0%, #0072ff 100%);
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(0, 198, 255, 0.6);
    }

    .btn-secondary:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: translateY(-3px);
    }
}

.meta-instruction {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    margin-bottom: 5px;
    padding-left: 10px;
    border-left: 2px solid rgba(255, 255, 255, 0.2);
}

.meta-instruction.chords {
    color: #00c6ff;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-style: normal;
    border-left-color: #00c6ff;
    background: rgba(0, 198, 255, 0.05);
    padding: 5px 10px;
    border-radius: 0 4px 4px 0;
    margin-top: 10px;
}

/* Email Flow Styles */
.email-form-step {
    animation: fadeIn var(--dur-enter) var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-message {
    text-align: center;
    padding: 20px;
    animation: fadeIn var(--dur-enter) var(--ease-out);
}

.music-player-card {
    margin: 25px auto 10px auto;
    max-width: 520px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: row;
    position: relative;
    z-index: 20;
}

.music-player-cover {
    width: 40%;
    min-width: 160px;
    background-size: cover;
    background-position: center;
}

.music-player-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    flex: 1;
}

.music-player-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.music-player-subtitle {
    font-size: 0.85rem;
    opacity: 0.8;
}

.music-player-audio {
    width: 100%;
    position: relative;
    z-index: 21;
    pointer-events: auto;
}

.music-score-animation {
    margin: 30px auto 0 auto;
    max-width: 520px;
    height: 140px;
    position: relative;
    overflow: hidden;
}

.music-score-staff {
    position: absolute;
    inset: 0 10px 0 10px;
}

.music-score-staff-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), rgba(0,198,255,0.5), rgba(255,255,255,0.1));
}

.music-score-staff-line:nth-child(1) { top: 20%; }
.music-score-staff-line:nth-child(2) { top: 35%; }
.music-score-staff-line:nth-child(3) { top: 50%; }
.music-score-staff-line:nth-child(4) { top: 65%; }
.music-score-staff-line:nth-child(5) { top: 80%; }

.music-score-notes {
    position: absolute;
    inset: 0 10px 0 10px;
    pointer-events: none;
    /* Lets noteDrift travel the track width with cqw units instead of animating `right` */
    container-type: inline-size;
}

.music-score-note {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, #00e0ff);
    box-shadow: 0 0 12px rgba(0, 224, 255, 0.8);
    position: absolute;
    right: -40px;
    animation-name: noteDrift;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.music-score-note::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 28px;
    background: #fff;
    right: -6px;
    top: -20px;
    border-radius: 3px;
}

.music-score-note:nth-child(odd) {
    filter: hue-rotate(15deg);
}

.music-score-note:nth-child(even) {
    filter: hue-rotate(-15deg);
}

/* Travels the full track (100cqw + 100px) with transform only: no layout per frame.
   X is interpolated linearly at each keyframe to match the previous `right` animation. */
@keyframes noteDrift {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translate(calc(-0.5 * (100cqw + 100px)), -10px);
    }
    80% {
        transform: translate(calc(-0.8 * (100cqw + 100px)), 6px);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-100cqw - 100px), 0);
        opacity: 0;
    }
}

.wizard-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.wizard-input:focus {
    outline: none;
    border-color: #00c6ff !important;
    background: rgba(0, 0, 0, 0.5) !important;
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.3);
}

/* Layout Split Styles - RESTORED AND FIXED */
.create-page-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 30px;
    height: calc(100vh - 250px); /* Fixed height to allow scrolling */
    min-height: 500px;
    align-items: center;
}

.create-page-layout.player-mode {
    height: auto;
    min-height: 0;
}

.left-chat-panel {
    width: 100%;
    max-width: 1000px;
    height: 300px;
    background: rgba(0, 0, 0, 0.4); /* Darker background for contrast */
    border-radius: 20px;
    border: 1px solid rgba(0, 198, 255, 0.3); /* Subtle blue border */
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 198, 255, 0.1), inset 0 0 20px rgba(0, 0, 0, 0.5); /* Outer glow + inner shadow */
    backdrop-filter: blur(10px);
}

.create-page-layout.player-mode .left-chat-panel {
    display: none;
}

.right-wizard-panel {
    width: 100%;
    max-width: 1000px;
    height: 320px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.create-page-layout.player-mode .right-wizard-panel {
    height: auto;
    max-width: 1000px;
}

.right-wizard-panel.right-wizard-panel-expanded {
    height: 460px;
}

#wizard-container {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 30px;
    padding: 20px;
    flex-grow: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent container expansion */
}

.create-page-layout.player-mode #wizard-container {
    overflow: visible;
}

.ai-lyrics-generator {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Chat Bubbles Side */
.chat-bubble-side {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    max-width: 85%;
    animation: fadeIn var(--dur-enter) var(--ease-out);
}

.chat-bubble-side.bot {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-bottom-left-radius: 2px;
    color: rgba(255, 255, 255, 0.95);
    align-self: flex-start;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.chat-bubble-side.user {
    background: linear-gradient(135deg, rgba(0, 198, 255, 0.3), rgba(0, 114, 255, 0.3));
    border: 1px solid rgba(0, 198, 255, 0.5);
    border-bottom-right-radius: 2px;
    color: white;
    align-self: flex-end;
    text-align: right;
    margin-left: auto;
    box-shadow: 0 0 15px rgba(0, 198, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Equalizer Container */
.equalizer-progress-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25vh; /* Takes up bottom 25% of screen */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px; /* Slightly wider gap */
    padding: 0 10px;
    z-index: 5;
    pointer-events: none;
}

.eq-progress-bar {
    flex: 1;
    max-width: 12px; /* Slightly wider bars */
    min-width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px 4px 0 0;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    transform-origin: bottom;
    animation: eqProgressInactive calc(var(--eq-duration, 0.8s) * 2) ease-in-out infinite;
    opacity: 0.2;
}

.eq-progress-bar.active {
    background: linear-gradient(to top, rgba(76, 29, 149, 0.4), rgba(139, 92, 246, 0.6)); /* Softer purple gradient */
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
    /* Animation handled by JS for intro */
    /* animation: eqProgress var(--eq-duration, 0.8s) ease-in-out infinite; */
    opacity: 0.6;
    filter: none; /* Removed blur for sharper look */
}

/* Fallback/Wizard animation if needed, or specific class for JS control */
/* Driven every frame by requestAnimationFrame: no transition (it would restart on each frame and lag) */
.eq-progress-bar.active.js-animated {
    animation: none;
    transition: none;
    will-change: transform;
}

@keyframes eqProgress {
    0%, 100% { transform: scaleY(0.15); }
    50% { transform: scaleY(0.7); } /* Go higher */
}

/* We need to adjust the right panel to make space for the equalizer */
.wizard-right-panel {
    padding-bottom: 20px;
}

/* Scrollbar for chat */
.ai-lyrics-generator::-webkit-scrollbar {
    width: 4px;
}
.ai-lyrics-generator::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}
.ai-lyrics-generator::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.timeout-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.timeout-modal-overlay.is-visible {
    display: flex;
    animation: overlayIn var(--dur-fast) ease-out;
}

.timeout-modal-overlay.is-visible .timeout-modal {
    animation: modalIn var(--dur-enter) var(--ease-out);
}

.timeout-modal {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    padding: 30px 40px;
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.timeout-modal-title {
    font-size: 1.6rem;
    margin-bottom: 15px;
}

.timeout-modal-text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 25px;
}

.timeout-modal-button {
    min-height: 48px;
    transition: transform var(--dur-press) var(--ease-out);
    padding: 10px 24px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    background: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
}

.hidden {
    display: none !important;
}

.privacy-modal-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at top, rgba(36, 59, 122, 0.9), rgba(5, 10, 31, 0.96));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120;
    padding: 20px;
}

/* Entrance replays every time .hidden (display: none) is removed */
.privacy-modal-overlay:not(.hidden) {
    animation: overlayIn var(--dur-fast) ease-out;
}

.privacy-modal-overlay:not(.hidden) .privacy-modal {
    animation: modalIn var(--dur-enter) var(--ease-out);
}

/* Exit: closePrivacyWizard() adds .is-closing, then .hidden once the animation ends */
.privacy-modal-overlay.is-closing {
    animation: overlayOut 150ms ease-out forwards;
    pointer-events: none;
}

.privacy-modal-overlay.is-closing .privacy-modal {
    animation: modalOut 150ms ease-out forwards;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes overlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes modalOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.97); }
}

.privacy-modal {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75);
    padding: 22px 22px 18px 22px;
    color: #ffffff;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    max-height: 85vh;
    overflow-y: auto;
}

.privacy-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.privacy-modal-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.privacy-modal-close {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    min-width: 48px;
    min-height: 48px;
    padding: 4px 6px;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease, transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .privacy-modal-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
        transform: scale(1.05);
    }
}

.privacy-modal-subtitle {
    font-size: 0.9rem;
    color: rgba(230, 233, 240, 0.9);
    margin-bottom: 10px;
}

.privacy-step-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
}

.privacy-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.privacy-step-dot-active {
    background: linear-gradient(135deg, #00c6ff, #9d00ff);
    box-shadow: 0 0 10px rgba(0, 198, 255, 0.7);
}

.privacy-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.privacy-step {
    display: none;
    animation: fadeIn var(--dur-enter) var(--ease-out);
}

.privacy-step-active {
    display: block;
}

.privacy-step-title {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    color: #e6e9f0;
}

.privacy-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(5, 10, 31, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.privacy-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.privacy-checkbox-box {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid rgba(230, 233, 240, 0.8);
    background: rgba(3, 7, 30, 0.8);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.privacy-checkbox-label {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.privacy-checkbox input[type="checkbox"]:checked + .privacy-checkbox-box {
    border-color: transparent;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    box-shadow: 0 0 12px rgba(0, 198, 255, 0.7);
}

.privacy-checkbox input[type="checkbox"]:checked + .privacy-checkbox-box::after {
    content: "";
    position: absolute;
    inset: 3px 7px;
    border-right: 2px solid #0a0e27;
    border-bottom: 2px solid #0a0e27;
    transform: rotate(35deg);
}

.privacy-error-message {
    font-size: 0.8rem;
    color: #ff9aa2;
    margin-top: 4px;
    min-height: 16px;
}

.privacy-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.privacy-button-primary,
.privacy-button-secondary {
    border-radius: 999px;
    min-height: 48px;
    padding: 12px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: transform var(--dur-press) var(--ease-out), box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.privacy-button-primary {
    background: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 198, 255, 0.6);
}

.privacy-button-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(230, 233, 240, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

@media (hover: hover) and (pointer: fine) {
    .privacy-button-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 12px 32px rgba(0, 198, 255, 0.8);
    }

    .privacy-button-secondary:hover {
        background: rgba(255, 255, 255, 0.16);
        transform: translateY(-1px);
    }
}

.privacy-note {
    font-size: 0.8rem;
    color: rgba(230, 233, 240, 0.8);
    margin-top: 8px;
}

.privacy-modal-open {
    overflow: hidden;
}

.privacy-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
}

.privacy-field-label {
    font-size: 0.85rem;
    color: rgba(230, 233, 240, 0.9);
}

.wizard-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

/* ===== Press feedback (touch kiosk: the only feedback a finger gets) ===== */
.card:active,
.option-card-dynamic:active,
.option-btn:active,
.action-btn:active,
.privacy-button-primary:active,
.privacy-button-secondary:active,
.privacy-modal-close:active,
.timeout-modal-button:active,
.kiosk-idle-button:active {
    transform: scale(0.97);
}

/* ===== Song ready: rare, high-emotion moment ===== */
.song-ready > * {
    animation: songReadyIn 600ms var(--ease-out) backwards;
}

.song-ready > :nth-child(2) { animation-delay: 120ms; }
.song-ready > :nth-child(3) { animation-delay: 240ms; }
.song-ready > :nth-child(4) { animation-delay: 360ms; }

@keyframes songReadyIn {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.note-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 60;
}

.note-burst-item {
    position: absolute;
    bottom: -40px;
    font-size: var(--size, 32px);
    color: var(--color, #00c6ff);
    text-shadow: 0 0 12px currentColor;
    opacity: 0;
    animation: noteBurst var(--dur, 1.6s) var(--ease-out) var(--delay, 0s) forwards;
}

@keyframes noteBurst {
    0% { opacity: 0; transform: translate(0, 0) scale(0.6) rotate(0deg); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx, 0px), -85vh) scale(1.1) rotate(var(--rot, 0deg)); }
}

/* ===== Kiosk mode (html.kiosk is set by static/js/kiosk.js) ===== */
html.kiosk {
    /* No pinch-zoom / double-tap zoom, no pull-to-refresh or bounce */
    touch-action: pan-x pan-y;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
}

html.kiosk body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

html.kiosk input,
html.kiosk textarea,
html.kiosk [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

html.kiosk img,
html.kiosk a {
    -webkit-user-drag: none;
}

/* Idle warning before returning to the home screen */
.kiosk-idle-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(5, 10, 31, 0.85);
    animation: overlayIn var(--dur-fast) ease-out;
}

.kiosk-idle-panel {
    max-width: 520px;
    width: 100%;
    text-align: center;
    padding: 36px 28px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.75);
    color: #ffffff;
    animation: modalIn var(--dur-enter) var(--ease-out);
}

.kiosk-idle-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.kiosk-idle-text {
    font-size: 1.05rem;
    color: rgba(230, 233, 240, 0.9);
    margin-bottom: 24px;
}

.kiosk-idle-count {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 24px;
    font-variant-numeric: tabular-nums;
}

.kiosk-idle-button {
    min-height: 56px;
    padding: 14px 36px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, #00c6ff 0%, #9d00ff 100%);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform var(--dur-press) var(--ease-out);
}

/* ===== Reduced motion: entrances keep opacity, drop movement =====
   The equalizer and the song-ready celebration are intentionally NOT disabled here:
   on a totem this media query reflects the kiosk PC's OS settings, not the visitor. */
@media (prefers-reduced-motion: reduce) {
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes modalIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes songReadyIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* ===== Song player: the song as a vinyl record, spinning at 33⅓ rpm while it plays ===== */
.song-player {
    max-width: 640px;
    margin: 10px auto 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}

.song-vinyl {
    width: min(70vw, 420px);
    aspect-ratio: 1;
}

.song-vinyl-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    background:
        repeating-radial-gradient(circle at 50% 50%, #17110e 0 2px, #241b16 2px 4px);
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.6), inset 0 0 0 8px #110c0a;
    animation: spin 1.8s linear infinite;
    animation-play-state: paused;
}

.song-vinyl.is-playing .song-vinyl-disc {
    animation-play-state: running;
}

/* Fixed light reflection on top of the spinning grooves */
.song-vinyl-disc::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 20deg, transparent 0 8%, rgba(255, 255, 255, 0.10) 13%, transparent 20% 52%, rgba(255, 255, 255, 0.07) 60%, transparent 68%);
    pointer-events: none;
}

.song-vinyl-label {
    position: absolute;
    inset: 32%;
    border-radius: 50%;
    background: radial-gradient(circle, #ffc864 0%, #ff8f3a 100%);
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35);
}

/* Spindle hole */
.song-vinyl-label::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: #17110e;
}

.song-player-body {
    width: 100%;
    max-width: 520px;
}
