* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Lexend Deca', sans-serif;
}

body {
    font-family: 'Lexend Deca', sans-serif;
    background: #0D1B2A;
    color: #2EF2FF;
    min-height: 100vh;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    margin: 0;
    overflow: hidden; /* Sin scroll vertical ni horizontal */
}

.container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding: 10px;
    box-sizing: border-box;
}

h1 {
    font-size: clamp(1.2em, 3vh, 2em);
    color: #2EF2FF;
    text-shadow: 0 0 10px rgba(46, 242, 255, 0.5), 0 0 20px rgba(46, 242, 255, 0.3);
    margin: 0;
    padding: 8px 0;
    font-weight: 400;
    letter-spacing: 1px;
    flex-shrink: 0;
    line-height: 1.2;
    min-height: 30px;
}

.hud {
    display: flex;
    gap: clamp(6px, 1.5vw, 20px);
    justify-content: center;
    align-items: center;
    padding: clamp(6px, 1vh, 12px) clamp(10px, 2vw, 20px);
    background: rgba(22, 38, 55, 0.9);
    border: 2px solid #2EF2FF;
    border-radius: 6px;
    box-shadow: 0 0 15px rgba(46, 242, 255, 0.3), 0 3px 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    flex-shrink: 0;
    margin: 10px 0;
    min-height: 50px;
    box-sizing: border-box;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.hud-label {
    font-size: clamp(0.6em, 1.5vw, 0.75em);
    color: #6B8CAE;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.hud-value {
    font-size: clamp(1em, 3vw, 1.4em);
    color: #2EF2FF;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(46, 242, 255, 0.6);
}

.hud-value.score-value {
    color: #2EF2FF;
}

.hud-value.level-value {
    color: #6B8CAE;
}

#missionBarContainer {
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    min-height: 45px;
    margin: 0 0 10px 0;
    box-sizing: border-box;
}

.mission-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(6px, 1vh, 10px) clamp(8px, 2vw, 16px);
    background: rgba(22, 38, 55, 0.9);
    border: 2px solid #2EF2FF;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 0 10px rgba(46, 242, 255, 0.2);
}

.mission-bar.mission-completed {
    background: rgba(46, 242, 255, 0.15);
    border-color: #2EF2FF;
    box-shadow: 0 0 20px rgba(46, 242, 255, 0.6);
}

.mission-bar.mission-failed {
    background: rgba(255, 0, 110, 0.15);
    border-color: #FF006E;
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.5);
}

.mission-text {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.mission-label {
    font-size: clamp(0.7em, 2vw, 0.85em);
    color: #6B8CAE;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    white-space: nowrap;
}

.mission-content {
    font-size: clamp(0.85em, 2.5vw, 1em);
    color: #2EF2FF;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mission-progress {
    display: flex;
    align-items: center;
    gap: clamp(6px, 2vw, 12px);
    font-size: clamp(0.75em, 2vw, 0.9em);
    flex-shrink: 0;
}

.progress-label {
    color: #6B8CAE;
    font-size: clamp(0.7em, 2vw, 0.85em);
}

.progress-value {
    color: #2EF2FF;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
    text-shadow: 0 0 6px rgba(46, 242, 255, 0.5);
}

.mission-reward {
    color: #FFD60A;
    font-weight: bold;
    font-size: clamp(1em, 3vw, 1.1em);
    opacity: 0;
    transition: opacity 0.3s ease;
    min-width: 50px;
    text-shadow: 0 0 8px rgba(255, 214, 10, 0.7);
}

.mission-reward.show {
    opacity: 1;
}

#gameCanvas {
    border: 3px solid #2EF2FF;
    box-shadow: 0 0 20px rgba(46, 242, 255, 0.4), inset 0 0 0 2px rgba(46, 242, 255, 0.2);
    background: #162637;
    display: block;
    border-radius: 0;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    margin: 10px auto;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 1;
    min-width: 0;
    min-height: 0;
}

.controls-info {
    padding: clamp(4px, 0.8vh, 8px) clamp(8px, 2vw, 16px);
    background: rgba(22, 38, 55, 0.8);
    border: 1px solid #2EF2FF;
    border-radius: 4px;
    font-size: clamp(0.6em, 1.5vw, 0.75em);
    color: #6B8CAE;
    margin-top: clamp(4px, 0.8vh, 8px);
    width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(46, 242, 255, 0.2);
    display: none; /* Ocultar en móvil para ahorrar espacio */
}

@media (min-width: 768px) {
    .controls-info {
        display: block;
    }
}

.controls-info p {
    margin: 0;
}

.controls-info strong {
    font-family: 'Lexend Deca', sans-serif;
}

span, p, div, h1, h2, h3, h4, h5, h6, a, button, input, textarea, select, label {
    font-family: 'Lexend Deca', sans-serif;
}

/* Pantalla de inicio */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0D1B2A;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 60px;
    z-index: 1000;
    padding: 20px;
}

.start-title {
    font-size: clamp(2.5em, 8vw, 4.5em);
    color: #2EF2FF;
    text-shadow: 0 0 20px rgba(46, 242, 255, 0.8), 0 0 40px rgba(46, 242, 255, 0.5);
    margin: 0;
    font-weight: 700;
    letter-spacing: 3px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        text-shadow: 0 0 20px rgba(46, 242, 255, 0.8), 0 0 40px rgba(46, 242, 255, 0.5);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 30px rgba(46, 242, 255, 1), 0 0 60px rgba(46, 242, 255, 0.7);
        transform: scale(1.02);
    }
}

.level-selector {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.level-select-button {
    width: 100%;
    padding: 18px 30px;
    background: rgba(22, 38, 55, 0.9);
    border: 3px solid #2EF2FF;
    border-radius: 12px;
    color: #2EF2FF;
    font-size: clamp(1.1em, 4vw, 1.4em);
    font-weight: 600;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(46, 242, 255, 0.3);
    text-shadow: 0 0 8px rgba(46, 242, 255, 0.5);
}

.level-select-button:hover {
    background: rgba(46, 242, 255, 0.1);
    box-shadow: 0 0 25px rgba(46, 242, 255, 0.5);
    transform: translateY(-2px);
}

.level-select-button:active {
    transform: translateY(0);
}

.button-text {
    flex: 1;
    text-align: left;
}

.button-arrow {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.level-selector.expanded .button-arrow {
    transform: rotate(180deg);
}

.level-options {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: rgba(22, 38, 55, 0.95);
    border: 2px solid #2EF2FF;
    border-radius: 12px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(46, 242, 255, 0.3);
    pointer-events: none;
}

.level-selector.expanded .level-options {
    max-height: 400px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.level-option {
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(46, 242, 255, 0.2);
    color: #2EF2FF;
    font-size: clamp(1em, 3.5vw, 1.2em);
    font-weight: 500;
    font-family: 'Lexend Deca', sans-serif;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.level-option:last-child {
    border-bottom: none;
}

.level-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: rgba(46, 242, 255, 0.1);
    transition: width 0.3s ease;
    z-index: -1;
}

.level-option:hover {
    background: rgba(46, 242, 255, 0.15);
    color: #3A86FF;
    text-shadow: 0 0 10px rgba(58, 134, 255, 0.6);
    padding-left: 30px;
}

.level-option:hover::before {
    width: 100%;
}

.level-option:active {
    background: rgba(46, 242, 255, 0.25);
}

.game-container {
    width: 100%;
    height: 100%;
}

/* Assistant Panel */
#assistantPanelContainer {
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    padding: 0 clamp(5px, 1vw, 10px);
    flex-shrink: 0;
    min-height: 100px;
    box-sizing: border-box;
}

.assistant-panel {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 16px);
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vw, 16px);
    background: rgba(22, 38, 55, 0.9);
    border: 2px solid #2EF2FF;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(46, 242, 255, 0.3);
    min-height: 100px;
    width: 100%;
    box-sizing: border-box;
}

.assistant-snake {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    animation: snakeWiggle 3s ease-in-out infinite;
}

.assistant-snake.paused {
    animation: none;
}

.assistant-snake.blink {
    animation: snakeBlink 0.3s ease-in-out;
}

@keyframes snakeWiggle {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-3px) rotate(-2deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(3px) rotate(2deg);
    }
}

@keyframes snakeBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.snake-head {
    width: clamp(18px, 3vw, 24px);
    height: clamp(18px, 3vw, 24px);
    background: #3A86FF;
    border: 2px solid #2EF2FF;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(58, 134, 255, 0.6);
    flex-shrink: 0;
}

.snake-body-segment {
    width: clamp(14px, 2.5vw, 18px);
    height: clamp(14px, 2.5vw, 18px);
    background: #2EF2FF;
    border: 1px solid #1E90FF;
    border-radius: 3px;
    flex-shrink: 0;
}

.assistant-dialog {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dialog-text {
    color: #2EF2FF;
    font-size: clamp(0.75em, 2vw, 1em);
    font-weight: 400;
    line-height: 1.4;
    min-height: clamp(2em, 4vh, 2.5em);
    text-shadow: 0 0 8px rgba(46, 242, 255, 0.5);
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.quiz-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.quiz-button {
    flex: 1;
    padding: clamp(8px, 1.5vh, 10px) clamp(12px, 2vw, 16px);
    background: rgba(46, 242, 255, 0.1);
    border: 2px solid #2EF2FF;
    border-radius: 6px;
    color: #2EF2FF;
    font-size: clamp(0.75em, 2vw, 0.9em);
    font-weight: 600;
    font-family: 'Lexend Deca', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 8px rgba(46, 242, 255, 0.5);
    box-shadow: 0 0 8px rgba(46, 242, 255, 0.2);
    white-space: nowrap;
}

.quiz-button:hover {
    background: rgba(46, 242, 255, 0.2);
    box-shadow: 0 0 15px rgba(46, 242, 255, 0.4);
    transform: translateY(-2px);
}

.quiz-button:active {
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(46, 242, 255, 0.3);
}

.quiz-button.quiz-true:hover {
    border-color: #4F9D69;
    color: #4F9D69;
    text-shadow: 0 0 8px rgba(79, 157, 105, 0.6);
}

.quiz-button.quiz-false:hover {
    border-color: #D96C4F;
    color: #D96C4F;
    text-shadow: 0 0 8px rgba(217, 108, 79, 0.6);
}

@media (max-width: 768px) {
    .assistant-panel {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .assistant-snake {
        align-self: center;
    }
    
    .quiz-buttons {
        width: 100%;
    }
}
