/* Styles specific to Vowel Teams game */

@keyframes float-lightly {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Definition modal styles */
.definition-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.definition-modal .modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
}

.definition-modal .close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
}

/* Make tile info buttons show keyboard focus and be visible */
.vowel-teams-game .vowel-team-box .info-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.vowel-teams-game .vowel-team-box .info-button {
    background: transparent;
    border: none;
    padding: 0;
}

.vowel-teams-game .vowel-team-box .info-button img {
    display: block;
}

@keyframes background-flash {

    0%,
    100% {
        background: linear-gradient(45deg, #2c3e50, #000000);
        box-shadow: none;
    }

    50% {
        background: #00d9ff;
        box-shadow: 0 0 20px #00d9ff;
    }
}

/* Vowel Teams game background */
.vowel-teams-game .game-area {
    background-image: url('../assets/images/vowel-teams/vowel-teams-background.png');
}

/* Layout for new game-area sub-containers */
.vowel-teams-game .game-area {
    display: flex;
    flex-direction: column;
}

.vowel-teams-game .progress-bar-container {
    flex: 0 0 50px;
    height: 50px;
}

.vowel-teams-game .spacing-div {
    flex: 0 0 80px;
    height: 80px;
}

.vowel-teams-game .game-elements-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Bring containers above game-area background and add border */
.vowel-teams-game .progress-bar-container,
.vowel-teams-game #vt-progressBarContainer,
.vowel-teams-game .game-elements-container {
    position: relative;
    z-index: 10;
}

/* Ensure all game-area descendants are above background */
.vowel-teams-game .game-area * {
    position: relative;
    z-index: 10;
}

/* Layout inside game-elements-container: two stacked panels */
.vowel-teams-game .game-elements-container {
    display: flex;
    flex-direction: column;
    /* removed gap between child panels */
    height: 100%;
}

/* Keyboard layout */
.vowel-teams-game .keyboard-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    align-items: center;
    justify-content: center;
}

.vowel-teams-game .keyboard-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex: 0 0 auto;
}

.vowel-teams-game .keyboard-key {
    flex: 0 0 auto;
    /* Shrink based on smaller of viewport width or height, keep square via aspect-ratio */
    width: clamp(50px, min(8vw, 6vh), 60px);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 1.4rem;
    color: #fff;
    /* white text */
    background: linear-gradient(145deg, #2c3e50, #34495e);
    /* use hover gradient as default */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.2), -4px -4px 6px rgba(0, 0, 0, 0.2);
    /* dark shadows */
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.vowel-teams-game .keyboard-key:hover {
    background: linear-gradient(145deg, #1e2933, #2c3e50);
    /* darker hover gradient */
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4), -2px -2px 6px rgba(0, 0, 0, 0.4);
    /* darker hover shadows */
}

.vowel-teams-game .keyboard-key:active {
    background: linear-gradient(145deg, #34495e, #2c3e50);
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.6), inset -2px -2px 6px rgba(0, 0, 0, 0.6);
    /* dark inset on active */
    transform: scale(0.92);
}



.vowel-teams-game .game-elements-container .element-container {
    box-sizing: border-box;

}

.vowel-teams-game .text-audio-display-container {
    /* fixed size panel, override inherited flex */
    flex: 0 0 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.vowel-teams-game .keyboard-container,
.vowel-teams-game #vt-keyboardContainer {
    flex: 1 1 auto;
    min-height: 0;
    z-index: 5;
}

.game-area {
    /* Generic game area style if needed, specific background handled above */
    position: relative;
    flex-grow: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}



/* Resize category boxes for vowel teams */
/* Category boxes stretch to fill grid cells */
.vowel-teams-game .vowel-team-box {
    width: 100%;
    height: 100%;
    white-space: normal;
    /* flexible padding and wrapping */
    padding: clamp(5px, 1vw, 10px);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    line-height: 1.2;
    /* allow breaking long lines */
    word-break: break-word;
    hyphens: auto;
    /* use Arial font for vowel team labels */
    font-family: Arial, sans-serif;
    aspect-ratio: auto !important;
}

/* Slightly reduce box width on larger screens to respect grid gaps */
@media (min-width: 601px) {
    .vowel-teams-game .vowel-team-box {
        width: 95%;
        margin: 0 auto;
    }
}

/* Responsive grid for vowel teams selection */
.vowel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(80px, auto);
    gap: 10px;
    width: 100%;
}

/* Mobile override: smaller row height for selection grid */
@media (max-width: 600px) {
    .vowel-grid {
        grid-auto-rows: 60px;
    }
}

/* Mobile font-size adjustment */
@media (max-width: 600px) {
    .vowel-teams-game .vowel-team-box {
        font-size: clamp(0.7rem, 2vw, 1.1rem);
    }
}


/* Vowel Teams specific styles */
.vowel-teams-game .text-audio-display-container .speaker-icon {
    width: 60px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2c3e50;
    color: #fff;
    border-radius: 8px;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.vowel-teams-game .text-audio-display-container .text-display,
.vowel-teams-game .text-audio-display-container #vt-textDisplay {
    flex: 0.6;
    justify-content: center;
    height: 50px;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    background: rgba(255, 255, 255, 0.7);
    /* 70% opaque */
    font-size: 1.2rem;
    color: #000;
    /* changed to black */
    min-width: 100px;
    max-width: 250px;
    text-transform: uppercase;
}

.vowel-teams-game .text-audio-display-container #vowel-type-select,
.vowel-teams-game .text-audio-display-container #vt-vowel-type-select {
    width: 120px;
    height: 60px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: #2c3e50;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.vowel-teams-game .text-audio-display-container select#vowel-type-select:hover,
.vowel-teams-game .text-audio-display-container select#vt-vowel-type-select:hover {
    background: #3a4e60;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: none;
    /* disable zoom */
    transition: all 0.2s ease;
    cursor: pointer;
}

.vowel-teams-game .text-audio-display-container select#vowel-type-select:active,
.vowel-teams-game .text-audio-display-container select#vt-vowel-type-select:active {
    background: #2a3b4c;
    /* darker press background */
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.4), inset -2px -2px 6px rgba(255, 255, 255, 0.1);
    transition: all 0.1s ease;
    cursor: pointer;
}

.vowel-teams-game .text-audio-display-container #vt-vowel-type-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    border: 0;
    clip: rect(0, 0, 0, 0);
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-container {
    position: relative;
    display: none;
    font-family: inherit;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-container.custom-vowel-feedback {
    box-shadow: 0 0 0 2px var(--vt-feedback-color, transparent);
    border-radius: 14px;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-container.custom-vowel-feedback .custom-vowel-type-trigger {
    background: var(--vt-feedback-color, #2c3e50);
    color: #0b1f1f;
    border-color: var(--vt-feedback-color, transparent);
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-trigger {
    width: fit-content;
    max-width: 150px;
    height: 50px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: #2c3e50;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-trigger::after {
    content: '▾';
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    margin-left: 10px;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-container.open .custom-vowel-type-trigger::after {
    transform: rotate(180deg);
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-trigger:hover {
    background: #3a4e60;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-trigger:focus-visible {
    outline: 2px solid #f1c40f;
    outline-offset: 2px;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #152033;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    z-index: 20;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-container.open .custom-vowel-type-list {
    display: flex;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-option {
    width: 100%;
    text-align: left;
    border-radius: 999px;
    padding: 6px 12px;
    border: 1px solid transparent;
    background: #2c3e50;
    color: #fff;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-option:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.3);
}

.vowel-teams-game .text-audio-display-container .custom-vowel-type-option.selected {
    background: #1abc9c;
    color: #0b1f1f;
    border-color: #0a8a6a;
}

/* Hover effect for speaker icon */
.vowel-teams-game .text-audio-display-container .speaker-icon:hover {
    background: #3a4e60;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: none;
    /* disable zoom */
    transition: all 0.2s ease;
    cursor: pointer;
}

.vowel-teams-game .text-audio-display-container .speaker-icon:active {
    background: #2a3b4c;
    /* darker press background */
    box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.4), inset -2px -2px 6px rgba(255, 255, 255, 0.1);
    transition: all 0.1s ease;
    cursor: pointer;
}

/* Responsive adjustments for small screens */
@media (max-width: 600px),
(max-height: 500px) {

    /* Ensure speaker, text display, vowel-type select and container are 50px high on small screens */
    .vowel-teams-game .text-audio-display-container {
        height: 50px;
        flex: 0 0 50px;
        gap: 5px;
    }

    .vowel-teams-game .text-audio-display-container .speaker-icon,
    .vowel-teams-game .text-audio-display-container .text-display,
    .vowel-teams-game .text-audio-display-container #vowel-type-select {
        height: 45px !important;
        line-height: 50px;
    }

    .vowel-teams-game .text-audio-display-container .custom-vowel-type-trigger .custom-vowel-type-option {
        width: fit-content;
        max-width: 120px;
        height: 50px;
        font-size: 0.75rem;
    }

    .vowel-teams-game .text-audio-display-container .text-display,
    .vowel-teams-game .text-audio-display-container #vt-textDisplay {
        flex: 0.8 !important;
    }

    /* Slightly reduce text size on smaller screens for the text display to fit */
    /* Make rule more specific and use !important to override earlier desktop rule when the media query matches */
    .vowel-teams-game .text-audio-display-container .text-display,
    .vowel-teams-game .text-audio-display-container #vt-textDisplay {
        font-size: 1rem !important;
        height: 50px;
    }

}

/* Cute colorful street style for progress bar */
.vowel-teams-game .progress-bar-container {
    background: #333;
    /* darker asphalt street */
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vowel-teams-game .progress-bar-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(to right,
            #fff,
            #fff 20px,
            rgba(255, 255, 255, 0) 20px,
            rgba(255, 255, 255, 0) 40px);
    transform: translateY(-50%);
}

/* Progress bar vehicle and finish line styling */
.vowel-teams-game .progress-bar-container .progress-car,
.vowel-teams-game .progress-bar-container .progress-finish {
    width: auto;
}

/* Specific heights for car and finish line */
.vowel-teams-game .progress-bar-container .progress-car {
    height: 40px;
    /* start further off-screen (use pixels so transforms animate smoothly)
       CAR_OFFSET_X is -60 by default in JS; match that here for consistency */
    transform: translateX(-60px);
    /* Smooth sliding transition when position updates */
    transition: transform 520ms cubic-bezier(.2, .8, .2, 1);
    will-change: transform;
}

.vowel-teams-game .progress-bar-container .progress-finish {
    height: 60px;
}

/* Inline warning styling for vowel type selection */
.category-warning {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 4px;
    text-align: center;
    animation: fadeInOut 2s ease;
}

.warning-border {
    border: 2px solid #e74c3c !important;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}
