/* collisione.css - Stili specifici per Quiz Pezzi in Collisione */

/* Previeni overflow */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    overflow-y: auto;
}

.screen {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height per mobile */
    overflow-x: hidden;
    overflow-y: auto;
}

.container {
    max-width: 100%;
    overflow-x: hidden;
    padding: 10px;
}

#quiz-screen .container {
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Contenitore domanda */
.collision-question-container {
    text-align: center;
    padding: 30px 15px;
    background: var(--bg-secondary);
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.collision-question-container h2 {
    font-size: 2em;
    font-weight: 900;
    letter-spacing: 1px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.instruction-text {
    font-size: 1em;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Display dei pezzi */
.pieces-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 30px 0 20px 0;
    flex-wrap: wrap;
}

.piece-info {
    background: #f8f8f8;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    min-width: 120px;
    border: 2px solid #e0e0e0;
}

.piece-info:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.piece-icon {
    display: block;
    font-size: 3.5em;
    margin-bottom: 10px;
    filter: drop-shadow(1px 1px 0px white) drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    color: #1a1a1a;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.3);
}

.piece-position {
    font-size: 2em;
    font-weight: 900;
    color: #2563eb;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* Input display */
.input-display {
    margin: 20px 0;
    font-size: 3.5em;
    font-weight: 900;
    color: var(--primary-color);
    letter-spacing: 12px;
    text-transform: uppercase;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tastierino */
.keyboard-container {
    max-width: 500px;
    width: 90%;
    margin: 0 auto 20px auto;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key {
    width: 50px;
    height: 50px;
    padding: 0;
    font-size: 1.3em;
    font-weight: bold;
    border: 3px solid #333;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.key:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.key:active:not(:disabled) {
    transform: translateY(0);
}

.key:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.key.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Feedback */
.feedback-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    z-index: 1000;
    display: none;
    min-width: 400px;
}

.feedback-content {
    text-align: center;
    color: white;
}

.feedback-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.feedback-message {
    font-size: 1.5em;
    margin-bottom: 20px;
}

.feedback-details {
    font-size: 1.1em;
    line-height: 1.8;
}

/* Review items */
.review-item {
    display: grid;
    grid-template-columns: 40px 1fr 150px 40px;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.review-item.correct {
    border-left: 4px solid var(--success-color);
}

.review-item.wrong {
    border-left: 4px solid var(--danger-color);
}

.review-pieces {
    font-weight: 500;
    font-size: 1.1em;
}

.review-answer {
    text-align: center;
}

.review-answer s {
    color: var(--danger-color);
    opacity: 0.7;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .collision-question-container {
        padding: 20px 10px;
    }
    
    .pieces-display {
        gap: 20px;
        margin: 20px 0;
    }
    
    .piece-info {
        padding: 15px 20px;
    }
    
    .piece-icon {
        font-size: 3em;
        margin-bottom: 10px;
    }
    
    .piece-position {
        font-size: 1.8em;
    }
    
    .keyboard-container {
        max-width: 450px;
    }
    
    .key {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 600px) {
    .collision-question-container h2 {
        font-size: min(1.8em, 6vw);
    }
    
    .instruction-text {
        font-size: min(0.95em, 4vw);
    }
    
    .pieces-display {
        gap: 20px;
    }
    
    .piece-info {
        padding: 15px 20px;
    }
    
    .piece-icon {
        font-size: 2.5em;
    }
    
    .piece-info {
        background: #ffffff;
    }
    
    .piece-position {
        font-size: 1.8em;
        letter-spacing: 2px;
    }
    
    .input-display {
        font-size: 3em;
        letter-spacing: 10px;
        min-height: 70px;
    }
    
    .keyboard-container {
        padding: 15px;
        width: 95%;
    }
    
    .key {
        width: 40px;
        height: 40px;
        font-size: 1.1em;
        border-width: 2px;
        border-radius: 6px;
    }
    
    .keyboard-row {
        gap: 5px;
        margin-bottom: 8px;
    }
    
    .feedback-overlay {
        padding: 30px 20px;
        min-width: 300px;
        width: 90%;
    }
    
    .review-item {
        grid-template-columns: 30px 1fr;
        gap: 10px;
    }
    
    .review-answer,
    .review-result {
        display: none;
    }
    
    .review-pieces {
        font-size: 0.95em;
    }
}

/* Schermi molto piccoli */
@media (max-width: 380px) {
    .pieces-display {
        flex-direction: column;
        gap: 10px;
        margin: 20px 0 15px 0;
    }
    
    .piece-info {
        padding: 10px 20px;
        display: flex;
        align-items: center;
        gap: 15px;
        width: 100%;
        max-width: 250px;
        flex-direction: row;
        background: #ffffff;
        border: 2px solid #e0e0e0;
    }
    
    .piece-icon {
        font-size: 2em;
        margin-bottom: 0;
        color: #000000;
    }
    
    .piece-position {
        font-size: 1.5em;
    }
    
    .input-display {
        font-size: 2.5em;
        letter-spacing: 8px;
        min-height: 60px;
        margin: 20px 0;
    }
    
    .keyboard-container {
        padding: 12px;
    }
    
    .key {
        width: 35px;
        height: 35px;
        font-size: 1em;
    }
    
    .keyboard-row {
        gap: 4px;
    }
}

/* Quiz header fix */
.quiz-header {
    margin-bottom: 15px;
}

/* Quiz stats fix */
.quiz-stats {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 30px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .piece-info {
        background-color: #f0f0f0;
        border-color: #d0d0d0;
        color: #1a1a1a;
    }
    
    .piece-icon {
        color: #1a1a1a;
    }
    
    .piece-position {
        color: #1e40af;
    }
    
    .key {
        background-color: #2d2d2d;
        color: #ecf0f1;
        border-color: #555;
    }
    
    .key.selected {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }
    
    .review-item {
        background-color: #2a2a2a;
    }
}

/* Fix per Safari/iOS - forza colori leggibili */
@supports (-webkit-touch-callout: none) {
    .piece-info {
        background-color: #ffffff !important;
        -webkit-appearance: none;
    }
    
    .piece-icon {
        color: #000000 !important;
        -webkit-text-fill-color: #000000;
    }
    
    .piece-position {
        color: #2563eb !important;
        -webkit-text-fill-color: #2563eb;
    }
}