/* Quizzy Game Styles */
html {
    background-color: #1a2a6c;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #4b3f72, #8a508f);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    min-height: 100vh;
    color: #fff;
    line-height: 1.6;
    padding: 1rem;
    text-align: center;
    animation: pageFadeIn 0.6s ease-out forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.container {
    max-width: 100%;
    width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    margin-top: 2rem;
}

.app-container {
    max-width: 100%;
    width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    min-height: 80vh;
    margin-top: 2rem;
}

.screen-content {
    padding: 2rem;
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
}

/* Add consistent center alignment for common elements */
p,
h2,
h3,
div,
label,
.form-group,
.category-instruction {
    text-align: center;
    margin-bottom: 15px;
}

#game-title {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    margin: 0 0 30px 0;
    background: linear-gradient(90deg, #8a508f, #4b3f72, #4b3f72, #8a508f);
    background-size: 300% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shine 3s linear infinite;
}

.setup-game-title {
    margin-bottom: 1.5rem;
}

@keyframes shine {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 300% center;
    }
}

h2 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.btn,
.primary-button,
.secondary-button {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin: 15px 10px;
}

.primary-btn,
.primary-button {
    background: linear-gradient(45deg, #6a4c93, #8a508f);
    color: #fff;
    box-shadow: 0 4px 15px rgba(106, 76, 147, 0.4);
}

.primary-btn:hover,
.primary-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(106, 76, 147, 0.6);
}

.primary-btn:active,
.primary-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(106, 76, 147, 0.4);
}

.secondary-btn,
.secondary-button {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover,
.secondary-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2);
}

.secondary-btn:active,
.secondary-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none;
}

.pulse-btn {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.glow-btn {
    animation: glow 2s infinite;
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(106, 76, 147, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(106, 76, 147, 0.8);
    }

    100% {
        box-shadow: 0 0 5px rgba(106, 76, 147, 0.5);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Welcome Screen */
.welcome-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.game-rules {
    margin: 0 auto 30px auto;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    max-width: 800px;
}

.game-rules p {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.rules-list {
    margin: 20px auto;
    width: 90%;
    max-width: 600px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rule-item {
    margin: 8px 0;
    padding: 6px 0;
    text-align: center;
    font-size: 1.1rem;
    color: #fff;
    width: 100%;
    max-width: 450px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.rule-item:last-child {
    border-bottom: none;
}

/* Setup Screen */
.form-group {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    text-align: center;
    font-size: 1.2rem;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.25);
}

#continue-to-players {
    display: block;
    margin: 20px auto;
}

.mode-description {
    font-size: 1rem;
    color: #ccc;
    margin-top: 1rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#player-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Category Selection Screen */
.category-instruction {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin: 2rem auto;
    max-width: 800px;
    padding: 15px;
}

.category-card {
    background: linear-gradient(135deg, rgba(74, 63, 114, 0.8), rgba(138, 80, 143, 0.8));
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.15rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
    backdrop-filter: blur(3px);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, rgba(94, 83, 134, 0.85), rgba(158, 100, 163, 0.85));
    border-color: rgba(255, 255, 255, 0.2);
}

.category-card.selected {
    border-color: #ffcc00;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.6);
    background: linear-gradient(135deg, rgba(104, 93, 144, 0.9), rgba(168, 110, 173, 0.9));
    transform: translateY(-3px) scale(1.03);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #8a508f, #4b3f72);
    opacity: 0.8;
}

.selected-categories-container {
    margin: 30px auto;
    background-color: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    width: 100%;
    max-width: 800px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.selected-list {
    list-style: none;
    margin: 15px auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    width: 100%;
    max-width: 700px;
}

.selected-list li {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    font-size: 1.1rem;
}

/* Game Round Screen */
.player-info {
    text-align: center;
    margin: 0 auto 30px auto;
    padding: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
}

.player-info h2 {
    margin-bottom: 10px;
}

.score-display {
    font-size: 1.4rem;
    font-weight: 600;
    color: #8a508f;
}

.difficulty-section {
    margin-bottom: 40px;
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.difficulty-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 2rem auto;
    max-width: 900px;
    padding: 10px;
}

.difficulty-btn {
    background: linear-gradient(135deg, rgba(74, 63, 114, 0.8), rgba(138, 80, 143, 0.8));
    border: none;
    border-radius: 12px;
    padding: 18px 25px;
    color: white;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 165px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
}

.difficulty-btn[data-difficulty="bambino"]::before {
    background-color: #4CAF50;
}

.difficulty-btn[data-difficulty="facile"]::before {
    background-color: #8BC34A;
}

.difficulty-btn[data-difficulty="medio"]::before {
    background-color: #FFC107;
}

.difficulty-btn[data-difficulty="esperto"]::before {
    background-color: #FF9800;
}

.difficulty-btn[data-difficulty="laureato"]::before {
    background-color: #F44336;
}

.difficulty-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, rgba(94, 83, 134, 0.85), rgba(158, 100, 163, 0.85));
    border-color: rgba(255, 255, 255, 0.2);
}

.difficulty-btn:hover::before {
    height: 8px;
}

.points {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 5px;
    display: block;
    font-weight: 400;
}

.category-section {
    margin: 40px auto;
    width: 100%;
    max-width: 900px;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
}

.player-category-btn {
    background: linear-gradient(135deg, rgba(74, 63, 114, 0.8), rgba(138, 80, 143, 0.8));
    border: none;
    border-radius: 12px;
    padding: 18px 30px;
    margin: 12px;
    color: white;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.player-category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #8a508f, #4b3f72);
    border-radius: 10px 10px 0 0;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.player-category-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, rgba(94, 83, 134, 0.85), rgba(158, 100, 163, 0.85));
    border-color: rgba(255, 255, 255, 0.2);
}

.player-category-btn:hover::before {
    height: 8px;
}

/* Question Screen */
.question-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin: 0 auto 30px auto;
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.category-info,
.difficulty-info,
.timer-container {
    flex: 1;
    text-align: center;
    margin: 10px;
    font-size: 1.1rem;
}

.timer-container {
    font-size: 1.4rem;
    font-weight: 600;
    color: #8a508f;
}

.question-container {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 8px;
    margin: 0 auto 30px auto;
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.question-text {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.answer-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 30px auto;
    width: 100%;
    max-width: 900px;
}

.answer-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.answer-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    margin-right: 15px;
    font-weight: 600;
    text-align: center;
    font-size: 1.2rem;
}

.answer-text {
    flex-grow: 1;
    text-align: left;
    font-size: 1.1rem;
}

/* Result Screen */
.result-message {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 auto 30px auto;
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
}

.result-message.correct {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.result-message.incorrect {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.correct-answer-container {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 8px;
    margin: 0 auto 30px auto;
    width: 100%;
    max-width: 800px;
}

.correct-answer {
    font-weight: 600;
    color: #2ecc71;
    font-size: 1.3rem;
    margin-top: 10px;
}

.points-earned {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 30px;
}

/* Game Over Screen */
.winner-announcement {
    text-align: center;
    margin: 0 auto 30px auto;
    padding: 25px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    font-size: 1.3rem;
}

.final-scores {
    background-color: rgba(0, 0, 0, 0.2);
    padding: 25px;
    border-radius: 8px;
    margin: 0 auto 30px auto;
    text-align: center;
    width: 100%;
    max-width: 800px;
}

.scores-list {
    list-style: none;
    display: block;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
}

.scores-list li {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 1.2rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .app-container,
    .container {
        padding: 1rem;
        margin-top: 2rem;
        width: 95%;
        min-height: 90vh;
    }

    .screen-content {
        padding: 1rem;
    }

    h1 {
        font-size: 2.2rem;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 1.6rem;
        margin-bottom: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }

    p,
    .rule-item {
        font-size: 1rem;
    }

    .btn,
    .primary-button,
    .secondary-button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
        margin: 10px 5px;
    }

    .game-rules {
        padding: 15px;
    }

    .form-group {
        margin-bottom: 1.5rem;
    }

    #player-inputs {
        gap: 1rem;
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .category-card {
        padding: 15px 10px;
        font-size: 1rem;
    }

    .selected-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .selected-list li {
        font-size: 1rem;
        padding: 8px;
    }

    .difficulty-buttons {
        gap: 10px;
    }

    .difficulty-btn {
        min-width: 120px;
        padding: 15px 20px;
        font-size: 1.1rem;
    }

    .category-buttons {
        gap: 8px;
    }

    .player-category-btn {
        min-width: 120px;
        padding: 12px;
        font-size: 1rem;
    }

    .answer-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .answer-btn {
        padding: 12px;
        font-size: 1rem;
    }

    .answer-letter {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

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

    .question-info {
        flex-direction: column;
        padding: 12px;
    }

    .category-info,
    .difficulty-info,
    .timer-container {
        margin: 5px 0;
    }

    .question-container {
        padding: 15px;
    }

    .result-message {
        font-size: 1.4rem;
        padding: 15px;
    }

    .correct-answer {
        font-size: 1.1rem;
    }

    .correct-answer-container {
        padding: 15px;
    }

    .winner-announcement {
        padding: 15px;
        font-size: 1.1rem;
    }

    .final-scores {
        padding: 15px;
    }

    .scores-list li {
        padding: 10px;
        font-size: 1.1rem;
    }
}

.trophy-icon {
    margin-left: 8px;
    vertical-align: middle;
    display: inline-block;
    position: relative;
    top: -1px;
    stroke: #ffd700;
    filter: drop-shadow(0 0 1px rgba(255, 215, 0, 0.8));
    animation: trophy-pulse 2s infinite ease-in-out;
}

@keyframes trophy-pulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.85;
    }
}

.error-message {
    color: #ff3939;
    background-color: rgba(255, 57, 57, 0.1);
    border: 1px solid rgba(255, 57, 57, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin: 15px auto;
    font-weight: 600;
    max-width: 90%;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.assigned-element {
    background-color: rgba(138, 80, 143, 0.2);
    border: 2px solid rgba(138, 80, 143, 0.4);
    border-radius: 8px;
    padding: 12px 20px;
    margin: 15px auto;
    max-width: 600px;
    animation: fadeIn 0.5s ease;
}

.assigned-element h3 {
    margin: 0;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .assigned-element h3 {
        font-size: 1.1rem;
    }
}

.correct-answer-btn {
    background-color: rgba(46, 204, 113, 0.8) !important;
    border: 2px solid #2ecc71 !important;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.6) !important;
    transform: translateY(-2px);
    transition: all 0.3s ease !important;
}

.incorrect-answer-btn {
    background-color: rgba(231, 76, 60, 0.8) !important;
    border: 2px solid #e74c3c !important;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.6) !important;
    transform: translateY(-2px);
    transition: all 0.3s ease !important;
}

.answer-btn {
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, border 0.3s ease;
}