/* --- Configuración Global y Fuentes --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
    --accent-terracotta: #C04E38;
    --selection-border: #E2E8F0;
    --selection-text: #2D3748;
    --selection-subtext: #A0AEC0;
}

html, body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    background-color: #1a202c; /* Fondo oscuro */
    color: #333;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.hero-game-main {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.hidden {
    display: none !important;
}

/* --- Contenedores Principales --- */
#app-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#game-container {
    flex: 0 0 clamp(260px, 48vh, 420px);
    background-color: #87CEEB; /* Color cielo */
    position: relative;
    overflow: hidden;
    min-height: clamp(260px, 48vh, 420px);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#minigame-container {
    flex: 1; /* Ocupa 1/4 de la altura */
    background-color: #f4f5f7;
    border-top: 4px solid #4a5568;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.2);
    padding: 1rem clamp(0.75rem, 4vw, 1.75rem) 1.25rem;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    text-align: center;
    box-sizing: border-box;
}

.interaction-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    gap: clamp(1rem, 2vw, 1.5rem);
    box-sizing: border-box;
}

.game-controls-area {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1.5rem);
    align-items: stretch;
    min-width: 0;
    text-align: left;
}

.avatar-container {
    flex: 0 0 auto;
    width: 180px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.avatar-bubble {
    background: #ffffff;
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    font-family: 'Montserrat', 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: #1b263b;
    text-align: center;
    max-width: 220px;
    width: 100%;
    position: relative;
    line-height: 1.4;
}

.avatar-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
}

.avatar-container img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

@media (max-width: 1024px) {
    .avatar-container {
        width: 160px;
    }
}

@media (max-width: 768px) {
    .interaction-wrapper {
        flex-direction: column-reverse;
        align-items: center;
    }

    .game-controls-area {
        margin-right: 0;
        width: 100%;
        align-items: stretch;
        order: 2;
    }

    .avatar-container {
        align-self: center;
        order: 1;
    }
}

@media (max-width: 540px) {
    .avatar-container {
        width: 140px;
    }

    .avatar-bubble {
        max-width: 190px;
    }
}

.minigame-mode {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
}

/* --- Overlays (Selección y Game Over) --- */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.pause-button {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 110;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #f8fafc;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.pause-button:hover,
.pause-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.75);
    outline: none;
}

.pause-button:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.8);
    outline-offset: 3px;
}

.pause-button[aria-pressed="true"] {
    background: rgba(26, 86, 219, 0.85);
}

#pause-overlay {
    z-index: 115;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1.25rem;
    text-align: center;
}

.pause-overlay__content {
    background: #0b172a;
    border-radius: 1rem;
    padding: clamp(1.25rem, 4vw, 2rem);
    max-width: min(480px, 92vw);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.pause-overlay__content h2 {
    margin: 0;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    color: #e2e8f0;
}

.pause-overlay__message {
    margin: 0;
    color: #cbd5e1;
    font-size: 1rem;
    line-height: 1.6;
}

.btn-resume {
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
    color: #f0fdf4;
    width: auto;
    min-width: 180px;
    box-shadow: 0 10px 24px rgba(5, 150, 105, 0.35);
}

.btn-resume:hover {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

#selection-overlay {
    position: absolute;
    inset: clamp(0.5rem, 2vh, 1.25rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    align-items: center;
    justify-content: center;
    overflow: visible;
    z-index: 120;
}

@media (max-width: 768px) {
    #selection-overlay {
        inset: clamp(0.5rem, 1.25vh, 1rem);
        padding: clamp(0.75rem, 4vw, 1.25rem);
    }
}

/* --- Pantalla de Selección --- */
.selection-box {
    background-color: #ffffff;
    color: #333;
    padding: clamp(1.5rem, 2vw, 2rem);
    border-radius: 20px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    width: min(92vw, 960px);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-height: min(76vh, 900px);
    overflow-y: auto;
}

.selection-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
}

.selection-panel {
    background-color: #f9fafb;
    border-radius: 0.75rem;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    padding: 1.5rem;
    flex: 1 1 240px;
    max-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.selection-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    text-align: center;
}

.selection-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.selection-panel .btn {
    background-color: #ffffff;
    border: 1px solid var(--selection-border);
    color: var(--selection-text);
    box-shadow: 0 4px 0 var(--selection-border);
    transition: all 0.2s ease;
}

.selection-panel .btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    background-color: #f8fafc;
    color: var(--selection-subtext);
    border-color: var(--selection-border);
    box-shadow: none;
}

.selection-panel .btn:not(:disabled):hover {
    background-color: var(--accent-terracotta);
    border-color: var(--accent-terracotta);
    color: #ffffff;
    box-shadow: 0 4px 0 #9b3b2a;
}

.selection-panel .btn:not(:disabled):hover .btn-subtext,
.selection-panel .btn.btn-selected .btn-subtext {
    color: #ffffff;
}

.btn-title {
    display: block;
}

.btn-subtext {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--selection-subtext);
    margin-top: 0.15rem;
}

.btn-grammar {
    text-align: center;
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

@media (max-width: 768px) {
    .selection-box {
        max-width: 95%;
        padding: 1.5rem;
    }

    .selection-panel {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .selection-title {
        font-size: 1.35rem;
    }
}

/* --- Botones --- */
.btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-tense, .btn-type, .btn-difficulty, .btn-mode {
    background-color: #e5e7eb; /* gray-200 */
    color: #1f2937; /* gray-800 */
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #d1d5db;
    color: #6b7280;
    box-shadow: none;
}

.btn-tense:hover, .btn-type:hover, .btn-difficulty:hover, .btn-mode:hover {
    background-color: #3b82f6; /* blue-500 */
    color: white;
}

/* Estado seleccionado para botones de tense/type */
.selection-panel .btn.btn-selected {
    background-color: var(--accent-terracotta) !important;
    border-color: var(--accent-terracotta) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #9b3b2a;
    transform: none;
}

.btn-start {
    background-color: #16a34a; /* green-600 */
    color: white;
    margin-top: 1.5rem;
}

.btn-start:hover {
    background-color: #15803d; /* green-700 */
}

.btn-start:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #9ca3af; /* gray-400 */
}

.selection-error-message {
    text-align: center;
    color: #dc2626; /* red-600 */
    font-weight: 600;
    margin-top: 1rem;
    height: 1.25rem; /* 20px */
}

.mode-restriction-message {
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: #1f2937;
    text-align: center;
    min-height: 1.25rem;
}

/* --- Mini-Juego --- */
.minigame-title {
    font-size: 1.5rem; /* 24px */
    font-weight: 700;
    color: #1f2937;
}

.write-mode-layout {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    min-width: 0;
}

.write-mode-layout .write-mode-instructions,
.write-mode-layout #write-mode-container {
    flex: 1 1 320px;
}

.write-mode-instructions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 360px;
    margin-top: 0.25rem;
    width: 100%;
    text-align: left;
    flex: 0 0 auto;
}

.instructions-button {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d8cf8, #3358f4);
    color: #ffffff;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.instructions-button:hover,
.instructions-button:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(51, 88, 244, 0.35);
    outline: none;
}

.instructions-button:focus-visible {
    outline: 3px solid rgba(51, 88, 244, 0.6);
    outline-offset: 3px;
}

#write-mode-container {
    width: 100%;
    max-width: 720px;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
}

@media (max-width: 768px) {
    .write-mode-layout {
        flex-direction: column;
        align-items: center;
        gap: 1.25rem;
    }

    .write-mode-layout .write-mode-instructions,
    .write-mode-layout #write-mode-container {
        max-width: 100%;
        flex: 1 1 100%;
    }
}

@media (min-width: 769px) {
    .write-mode-layout {
        align-items: flex-start;
    }
}

.write-mode-instructions p {
    margin: 0;
    font-size: 0.95rem;
    color: #374151;
}

.write-mode-info-card {
    width: 100%;
    max-width: 580px;
}

.write-mode-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.write-mode-challenge {
    width: 100%;
}

.write-tense-display {
    display: none;
}

.write-tense-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1f2937;
}

.write-tense-label-text {
    font-family: 'Inter', sans-serif;
}

.write-tense-pill {
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    background-color: #0f172a;
    color: #f8fafc;
    font-weight: 700;
    text-transform: capitalize;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
    min-width: 220px;
    text-align: center;
}

.key-instructions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.75rem;
}

.key-equation {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: #1f2937;
}

.keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.35rem;
    border: 1px solid #cbd5f5;
    background: linear-gradient(145deg, #ffffff 0%, #e2e8f0 100%);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
    font-family: 'Inter', sans-serif;
}

.key-symbol {
    font-weight: 700;
    color: #4b5563;
}

#minigame-prompt {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem; /* 20px */
}

#minigame-prompt span {
    padding: 0.25rem 0.5rem;
}
/* Colores para verbos, tiempos y pronombres */
#verb { font-weight: 700; color: #2563eb; }
#tense { font-weight: 700; color: #9333ea; }
#pronoun { font-weight: 700; color: #15803d; }


.answer-group {
    display: flex;
    gap: 0.5rem;
    width: min(100%, 620px);
    align-items: stretch;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: center;
}

#write-mode-container {
    gap: 0.75rem;
}

#answer-input {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db; /* gray-300 */
    border-radius: 0.5rem;
    font-size: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    flex: 1 1 0;
    min-width: 160px;
    width: auto;
    max-width: 100%;
}
#answer-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.btn-submit {
    background-color: #16a34a; /* green-600 */
    color: white;
    width: auto;
    flex-shrink: 0;
}
.btn-submit:hover {
    background-color: #15803d; /* green-700 */
}

.write-restart-wrapper {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    margin-top: auto;
}

.write-restart-wrapper .quick-restart-button {
    margin-top: 15px;
}


.choice-layout {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.85rem, 2vw, 1.25rem);
    width: 100%;
    max-width: 100%;
    margin: 0;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
}

#choice-mode-container .choice-layout {
    margin-top: clamp(-2.5rem, -4vh, -1.25rem);
}

.choice-grid-panel,
.choice-info-panel,
.choice-side-panel {
    flex: 1 1 320px;
    min-width: 240px;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
}

.choice-grid-panel {
    flex: 0 0 auto;
    max-width: 520px;
    width: 100%;
}

.choice-grid-panel { order: 2; }
.choice-info-panel {
    order: 1;
    justify-content: flex-start;
}
.choice-side-panel { order: 3; }

@media (max-width: 1024px) {
    .choice-layout {
        justify-content: flex-start;
    }

    #choice-mode-container .choice-layout {
        margin-top: clamp(-2rem, -4vh, -1rem);
    }

    .choice-info-panel { order: 1; }
    .choice-grid-panel { order: 2; }
    .choice-side-panel { order: 3; }
}

.choice-grid {
    display: grid;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    width: 100%;
    max-width: none;
    align-items: stretch;
}

.choice-grid--compact {
    gap: clamp(0.6rem, 1.25vw, 0.75rem);
}

.choice-cell {
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: clamp(1.25rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.25rem);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4rem;
    font-size: clamp(1.05rem, 3vw, 1.35rem);
    font-weight: 700;
    color: #1f2937;
    cursor: pointer;
    text-transform: lowercase;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.choice-grid--compact .choice-cell {
    padding: clamp(0.9rem, 2.25vw, 1.25rem) clamp(0.6rem, 1.75vw, 1rem);
    font-size: clamp(0.95rem, 2.4vw, 1.15rem);
    min-height: 3.25rem;
}

.choice-cell:hover,
.choice-cell:focus {
    outline: none;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    background-color: #1e3a8a;
    color: #ffffff;
}

.choice-info-card {
    background-color: #000000;
    color: #ffffff;
    border-radius: 16px;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    text-align: center;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35);
    max-width: 100%;
}

.choice-info-card h3 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.15rem, 2.5vw, 1.6rem);
    line-height: 1.25;
    font-weight: 900;
    text-transform: uppercase;
}

.choice-info-card p {
    margin: 0;
    font-size: clamp(0.9rem, 1.8vw, 0.95rem);
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.lang-es,
.lang-en {
    font-size: 1em;
    display: inline-block;
}

.lang-es {
    color: #ffffff;
}

.lang-en {
    color: #d1d5db;
}

.choice-side-panel {
    flex-direction: column;
    gap: 1.25rem;
    text-align: center;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding-top: clamp(0.25rem, 1.2vw, 1.25rem);
    flex: 1 1 auto;
}

#choice-mode-container .choice-side-panel {
    margin-top: clamp(-1.25rem, -2.5vh, -0.5rem);
}

.challenge-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(1rem, 4vw, 2.5rem);
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.5rem;
}

.challenge-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.challenge-text {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    text-transform: lowercase;
    margin-bottom: 0.35rem;
    color: #111827;
}

.underline-box {
    width: 120%;
    max-width: 260px;
    height: 10px;
    border-radius: 999px;
}

.verb-underline {
    background-color: #4A90E2;
}

.pronoun-underline {
    background-color: #F5A623;
}


.choice-side-panel .quick-restart-button {
    margin-top: 0.5rem;
}

.choice-mode-message {
    min-height: 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    width: 100%;
}

@media (max-width: 768px) {
    .choice-info-card {
        max-width: 100%;
    }
}

.quick-restart-button {
    margin: 1.25rem 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.9rem 1.75rem;
    border: none;
    border-radius: 1rem;
    background: linear-gradient(135deg, #34d399 0%, #059669 100%);
    color: #f0fdf4;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(5, 150, 105, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    width: min(100%, 320px);
}

.quick-restart-button span:last-child {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.9;
}

.quick-restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(5, 150, 105, 0.45);
    filter: brightness(1.05);
}

.quick-restart-button:focus {
    outline: 3px solid rgba(134, 239, 172, 0.9);
    outline-offset: 4px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(6px);
    padding: 1.5rem;
}

.modal-content {
    background-color: #0f172a;
    border-radius: 1.25rem;
    padding: 2rem;
    width: min(560px, 100%);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.45);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: #e2e8f0;
}

.modal-title {
    margin: 0;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-option {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    border: none;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(37, 99, 235, 0.35));
    color: #f8fafc;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.modal-option span:last-child {
    font-size: 0.95rem;
    opacity: 0.85;
}

.modal-option:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.45);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.45));
}

.modal-option:focus {
    outline: 3px solid rgba(96, 165, 250, 0.9);
    outline-offset: 4px;
}

.modal-option:last-child {
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.12), rgba(148, 163, 184, 0.3));
    color: #e2e8f0;
    box-shadow: 0 10px 24px rgba(148, 163, 184, 0.28);
}

.modal-option:last-child:hover {
    box-shadow: 0 16px 28px rgba(148, 163, 184, 0.35);
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.18), rgba(148, 163, 184, 0.38));
}

.instructions-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.instructions-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.instructions-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.instructions-modal__content {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    padding: 2rem;
    max-width: min(480px, 90vw);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    color: #1f1f1f;
    line-height: 1.6;
    z-index: 1;
}

.instructions-modal__content h3 {
    margin-top: 0;
    font-family: 'Oswald', sans-serif;
    font-size: 2rem;
    color: var(--secondary-color);
}

.instructions-modal__content ul {
    padding-left: 1.2rem;
    margin: 1rem 0;
}

.instructions-modal__content li {
    margin-bottom: 0.5rem;
}

.instructions-modal__note {
    font-weight: 600;
    color: #3358f4;
}

.instructions-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    cursor: pointer;
    color: #5a5a5a;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.instructions-modal__close:hover,
.instructions-modal__close:focus {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1f1f1f;
    outline: none;
}

.instructions-modal__close:focus-visible {
    outline: 3px solid rgba(51, 88, 244, 0.6);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    .instructions-modal__content {
        padding: 1.5rem 1.25rem 1.75rem;
    }

    .instructions-button {
        font-size: 0.85rem;
        padding: 0.45rem 0.8rem;
    }
}

/* Mensajes de feedback */
#minigame-message {
    height: 1.5rem; /* Altura fija para evitar saltos de layout */
    font-weight: 600;
    font-size: 1.125rem;
    transition: all 0.3s ease;
}
.text-success { color: #15803d; } /* green-700 */
.text-error { color: #b91c1c; } /* red-700 */


/* --- Pantalla de Game Over --- */
.game-over-title {
    font-size: 3.75rem; /* 60px */
    font-weight: 700;
    margin-bottom: 1rem;
}
.game-over-subtitle {
    font-size: 1.5rem; /* 24px */
    margin-bottom: 2rem;
}
.game-over-score {
    font-size: 1.25rem; /* 20px */
}

.btn-restart {
    background-color: #2563eb; /* blue-600 */
    color: white;
    width: auto;
    margin-top: 2rem;
    padding: 0.75rem 1.5rem;
}
.btn-restart span {
    display: block;
    line-height: 1.25;
    font-size: 1.125rem;
}
.btn-restart span:first-child {
    font-weight: 600;
}
.btn-restart:hover {
    background-color: #1d4ed8; /* blue-700 */
}
