/* ===========================
   VARIABILI CSS
   =========================== */
:root {
    /* Colori principali */
    --dark-bg: #0f0f23;
    --dark-secondary: #1a1a2e;
    --dark-card: #16213e;
    --accent-primary: #0f4c75;
    --accent-secondary: #3282b8;
    --text-light: #bbe1fa;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;

    /* Colori stato */
    --success: #2ecc71;
    --error: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;

    /* Colori timer */
    --timer-safe: #2ecc71;
    --timer-warning: #f39c12;
    --timer-danger: #e74c3c;

    /* Colori stanze */
    --room-1: #4A90E2;
    --room-2: #50C878;
    --room-3: #E74C3C;
    --room-4: #9B59B6;
    --room-5: #F39C12;

    /* Ombre */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(50, 130, 184, 0.5);

    /* Animazioni */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===========================
   RESET E BASE
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-secondary) 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===========================
   HEADER GIOCO
   =========================== */
.game-header {
    display: none; /* Nascosto inizialmente */
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--dark-card);
    border-bottom: 2px solid var(--accent-primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.game-header.active {
    display: flex;
}

.header-left,
.header-right {
    flex: 1;
}

.header-right {
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    align-items: center;
}

.header-center {
    flex: 2;
    text-align: center;
}

.game-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-white);
    text-shadow: 0 0 10px rgba(50, 130, 184, 0.5);
}

/* Timer Container */
.timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid var(--timer-safe);
    transition: all var(--transition-normal);
}

.timer-container.warning {
    border-color: var(--timer-warning);
    animation: pulseWarning 1s ease-in-out infinite;
}

.timer-container.danger {
    border-color: var(--timer-danger);
    animation: pulseDanger 0.5s ease-in-out infinite;
}

.timer-container.expired {
    border-color: var(--text-gray);
    opacity: 0.6;
}

.timer-icon {
    font-size: 2rem;
}

.timer-display {
    display: flex;
    flex-direction: column;
}

.timer-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
}

.timer-container.warning .timer-value {
    color: var(--timer-warning);
}

.timer-container.danger .timer-value {
    color: var(--timer-danger);
}

/* Score Container */
.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid var(--warning);
    min-width: 100px;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--warning);
}

/* Progress Container */
.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid var(--accent-secondary);
    min-width: 100px;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

/* ===========================
   ALERT TIMER SCADUTO
   =========================== */
.timer-alert {
    display: none;
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    animation: slideDown 0.5s ease-out;
}

.timer-alert.active {
    display: block;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--error);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-text {
    flex: 1;
    font-weight: 500;
}

.alert-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.alert-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===========================
   BARRA PROGRESSO STANZE
   =========================== */
.rooms-progress-bar {
    display: none; /* Nascosta inizialmente */
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--dark-secondary);
    position: relative;
}

.rooms-progress-bar.active {
    display: flex;
}

.rooms-progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 40px;
    right: 40px;
    height: 3px;
    background: var(--dark-card);
    transform: translateY(-50%);
    z-index: 0;
}

.room-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.step-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--dark-card);
    border: 3px solid var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: all var(--transition-normal);
}

.room-step.completed .step-circle {
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.6);
}

.room-step.active .step-circle {
    background: var(--accent-secondary);
    border-color: var(--accent-secondary);
    box-shadow: 0 0 20px rgba(50, 130, 184, 0.8);
    animation: pulse 2s ease-in-out infinite;
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    text-align: center;
    font-weight: 500;
}

.room-step.active .step-label {
    color: var(--accent-secondary);
    font-weight: 600;
}

.room-step.completed .step-label {
    color: var(--success);
}

/* ===========================
   SCHERMATA INTRODUTTIVA
   =========================== */
.intro-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.intro-screen.hidden {
    display: none;
}

.intro-content {
    max-width: 800px;
    background: var(--dark-card);
    padding: 50px 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--accent-primary);
    animation: fadeInUp 0.8s ease-out;
}

.intro-header {
    text-align: center;
    margin-bottom: 40px;
}

.intro-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(50, 130, 184, 0.6);
}

.intro-subtitle {
    font-size: 1.3rem;
    color: var(--accent-secondary);
    font-weight: 500;
}

.intro-description {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.intro-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-secondary);
}

.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    color: var(--text-white);
    margin-bottom: 12px;
}

.section-text {
    color: var(--text-light);
    line-height: 1.6;
}

.rules-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rules-list li {
    padding-left: 25px;
    position: relative;
    color: var(--text-light);
    line-height: 1.5;
}

.rules-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-secondary);
    font-weight: bold;
}

.intro-warning {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid var(--warning);
    padding: 15px;
    border-radius: 12px;
    color: var(--warning);
    font-weight: 500;
    text-align: center;
}

.btn-start {
    margin-top: 30px;
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 16px;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-start::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-start:hover::before {
    width: 400px;
    height: 400px;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(50, 130, 184, 0.4);
}

.btn-start-icon {
    font-size: 1.5rem;
}

.btn-start-text {
    position: relative;
    z-index: 1;
}

/* ===========================
   CONTAINER GIOCO
   =========================== */
.game-container {
    display: none; /* Nascosto inizialmente */
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.game-container.active {
    display: block;
}

/* ===========================
   SEZIONE STANZA
   =========================== */
.room-section {
    margin-bottom: 30px;
    animation: fadeInUp 0.6s ease-out;
}

.room-card {
    background: var(--dark-card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--accent-primary);
    transition: all var(--transition-normal);
}

.room-card.room-1 {
    border-color: var(--room-1);
    box-shadow: 0 8px 32px rgba(74, 144, 226, 0.3);
}

.room-card.room-2 {
    border-color: var(--room-2);
    box-shadow: 0 8px 32px rgba(80, 200, 120, 0.3);
}

.room-card.room-3 {
    border-color: var(--room-3);
    box-shadow: 0 8px 32px rgba(231, 76, 60, 0.3);
}

.room-card.room-4 {
    border-color: var(--room-4);
    box-shadow: 0 8px 32px rgba(155, 89, 182, 0.3);
}

.room-card.room-5 {
    border-color: var(--room-5);
    box-shadow: 0 8px 32px rgba(243, 156, 18, 0.3);
}

.room-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.room-icon {
    font-size: 4rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.room-info {
    flex: 1;
}

.room-name {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    color: var(--text-white);
    margin-bottom: 8px;
}

.room-description {
    color: var(--text-light);
    line-height: 1.5;
}

.room-progress {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-gray);
}

.progress-numbers {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: var(--text-white);
    font-size: 1rem;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: var(--dark-bg);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease-out;
}

/* ===========================
   SEZIONE DOMANDA
   =========================== */
.question-section {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.question-card {
    background: var(--dark-card);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--accent-primary);
}

.question-number {
    display: inline-block;
    background: var(--accent-primary);
    color: var(--text-white);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.question-text {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: var(--text-white);
    line-height: 1.5;
    margin-bottom: 30px;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.answer-btn:hover {
    border-color: var(--accent-secondary);
    background: rgba(50, 130, 184, 0.1);
    transform: translateX(5px);
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.answer-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: correctPulse 0.5s ease-out;
}

.answer-btn.wrong {
    background: var(--error);
    border-color: var(--error);
    color: white;
    animation: shake 0.5s ease-out;
}

/* ===========================
   MODAL FEEDBACK
   =========================== */
.feedback-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.feedback-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.feedback-content {
    background: var(--dark-card);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--accent-primary);
    animation: slideUp 0.4s ease-out;
}

.feedback-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.feedback-icon {
    font-size: 4rem;
}

.feedback-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    color: var(--text-white);
    text-align: center;
}

.feedback-body {
    text-align: center;
    margin-bottom: 25px;
}

.feedback-explanation {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.feedback-time {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 1.1rem;
}

.feedback-time.bonus {
    background: rgba(46, 204, 113, 0.2);
    color: var(--success);
    border: 2px solid var(--success);
}

.feedback-time.penalty {
    background: rgba(231, 76, 60, 0.2);
    color: var(--error);
    border: 2px solid var(--error);
}

.btn-continue {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    padding: 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-white);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(50, 130, 184, 0.4);
}

/* ===========================
   MODAL PORTA
   =========================== */
.door-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.door-modal.active {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

.door-content {
    max-width: 700px;
    width: 90%;
    text-align: center;
    position: relative;
}

.door-animation {
    position: relative;
    width: 400px;
    height: 500px;
    margin: 0 auto 40px;
    perspective: 1500px;
}

.door-left,
.door-right {
    position: absolute;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 3px solid #7f8c8d;
    transform-origin: left;
    transition: transform 1.5s ease-out;
}

.door-right {
    right: 0;
    transform-origin: right;
}

.door-modal.active .door-left {
    animation: openDoorLeft 1.5s ease-out forwards;
}

.door-modal.active .door-right {
    animation: openDoorRight 1.5s ease-out forwards;
}

.door-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(243, 156, 18, 0.8), transparent);
    opacity: 0;
    animation: doorLight 2s ease-out 0.5s forwards;
}

.door-info {
    background: var(--dark-card);
    padding: 30px;
    border-radius: 20px;
    border: 2px solid var(--warning);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.6s ease-out 0.8s both;
}

.door-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.2rem;
    color: var(--text-white);
    margin-bottom: 15px;
}

.door-message {
    color: var(--text-light);
    font-size: 1.2rem;
    margin-bottom: 25px;
}

.door-code-display {
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid var(--warning);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.code-label {
    font-size: 1.1rem;
    color: var(--text-light);
}

.code-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--warning);
    letter-spacing: 8px;
}

.door-next {
    color: var(--accent-secondary);
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-unlock {
    margin-top: 25px;
    background: linear-gradient(135deg, var(--warning), #e67e22);
    border: none;
    border-radius: 12px;
    padding: 18px 40px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-unlock:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(243, 156, 18, 0.4);
}

.btn-unlock-icon {
    font-size: 1.5rem;
}

/* ===========================
   SCHERMATA FINALE
   =========================== */
.final-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.final-screen.active {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

.final-content {
    background: var(--dark-card);
    border-radius: 24px;
    padding: 50px 40px;
    max-width: 900px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--accent-primary);
    animation: slideUp 0.6s ease-out;
}

.final-header {
    text-align: center;
    margin-bottom: 40px;
}

.final-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    color: var(--text-white);
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(50, 130, 184, 0.6);
}

.final-subtitle {
    font-size: 1.3rem;
    color: var(--accent-secondary);
}

.final-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-3px);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 5px;
}

.stat-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
}

.final-ranking {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), rgba(230, 126, 34, 0.1));
    border: 2px solid var(--warning);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
}

.ranking-badge {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.badge-icon {
    font-size: 4rem;
}

.badge-info {
    display: flex;
    flex-direction: column;
}

.badge-rank {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 5px;
}

.badge-description {
    color: var(--text-light);
    font-size: 1.1rem;
}

.ranking-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 25px;
    border-radius: 12px;
}

.score-label {
    font-size: 1.1rem;
    color: var(--text-light);
}

.score-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--warning);
}

.final-details {
    margin-bottom: 30px;
}

.details-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: var(--text-white);
    margin-bottom: 20px;
    text-align: center;
}

.rooms-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.room-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
}

.room-summary-name {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-light);
}

.room-summary-stats {
    font-family: 'Roboto Mono', monospace;
    color: var(--text-white);
    font-weight: 600;
}

.btn-restart {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 12px;
    padding: 18px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-restart:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(50, 130, 184, 0.4);
}

.btn-restart-icon {
    font-size: 1.5rem;
}

/* ===========================
   CANVAS CONFETTI
   =========================== */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ===========================
   ANIMAZIONI
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulseWarning {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
    }
}

@keyframes pulseDanger {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes openDoorLeft {
    to {
        transform: perspective(1500px) rotateY(-120deg);
    }
}

@keyframes openDoorRight {
    to {
        transform: perspective(1500px) rotateY(120deg);
    }
}

@keyframes doorLight {
    to {
        width: 300px;
        height: 300px;
        opacity: 1;
    }
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .header-left,
    .header-center,
    .header-right {
        width: 100%;
        flex: none;
    }

    .header-right {
        justify-content: center;
        gap: 30px;
    }

    .game-title {
        font-size: 1.5rem;
    }

    .timer-container {
        justify-content: center;
    }

    .score-container,
    .progress-container {
        align-items: center;
    }

    .rooms-progress-bar {
        padding: 15px 20px;
        overflow-x: auto;
    }

    .step-circle {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .step-label {
        font-size: 0.7rem;
    }

    .intro-content {
        padding: 30px 25px;
    }

    .intro-title {
        font-size: 2rem;
    }

    .intro-subtitle {
        font-size: 1.1rem;
    }

    .room-header {
        flex-direction: column;
        text-align: center;
    }

    .room-icon {
        font-size: 3rem;
        width: 70px;
        height: 70px;
    }

    .room-name {
        font-size: 1.5rem;
    }

    .question-card {
        padding: 25px;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .answers-grid {
        grid-template-columns: 1fr;
    }

    .door-animation {
        width: 300px;
        height: 400px;
    }

    .final-content {
        padding: 30px 20px;
    }

    .final-title {
        font-size: 2rem;
    }

    .final-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .timer-value {
        font-size: 1.2rem;
    }

    .intro-title {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .room-name {
        font-size: 1.3rem;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .door-title {
        font-size: 1.8rem;
    }

    .code-value {
        font-size: 1.5rem;
        letter-spacing: 4px;
    }
}
