/* 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;
}

/* Word list grid inside the vocab selection modal */
#select-words-modal .words-list {
    margin-top: 5px;
}

/* Modal control buttons (Select All / Clear / Done) */
#select-words-modal button#select-all,
#select-words-modal button#clear-all,
#select-words-modal button#done {
    background: #3b82f6;
    /* blue */
    color: #ffffff;
    /* white text */
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#select-words-modal button#select-all:hover,
#select-words-modal button#clear-all:hover,
#select-words-modal button#done:hover {
    background: #2563eb;
}

#select-words-modal button#select-all:focus-visible,
#select-words-modal button#clear-all:focus-visible,
#select-words-modal button#done:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
    box-shadow: none;
}

/* Close button in the select-words modal: red background */
#select-words-modal .close-button {
    background: #ef4444;
    /* red */
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

#select-words-modal .close-button:hover {
    background: #dc2626;
}

#select-words-modal .close-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
    box-shadow: none;
}

/* Word card keyboard focus */
.word-card {
    position: relative;
    outline: none;
}

.word-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

@keyframes background-flash {

    0%,
    100% {
        background: linear-gradient(45deg, #2c3e50, #000000);
        box-shadow: none;
    }

    50% {
        background: #00d9ff;
        box-shadow: 0 0 20px #00d9ff;
    }
}


/* Game area background */
.game-area {
    background-image: url('../assets/images/save-the-boy/save-the-boy-bg.png');
}

/* Layout for game-area sub-containers */

/* Bring containers above game-area background and add border */
.progress-bar-container {
    position: relative;
    z-index: 10;
}

/* Ensure game elements layout */

/* Vertical layout for main game elements */
.game-elements-container {
    display: flex;
    flex-direction: column;
    height: 95%;
}

/* Ensure progress bar has minimum height */
.progress-bar-container {
    /* fixed height for progress bar */
    height: 30px;
    min-height: 30px;
    position: relative;
    overflow: visible;
    /* allow rabbit/turtle to show off-screen */
}

/* Place the main game elements above other background layers but below UI chrome */
.game-elements-container {
    z-index: 5;
    position: relative;
}

.game-elements-container .image-display {
    /* Make image display vertically flexible */
    flex: 1 1 auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(145deg, #00000063, #00000063);
}

/* Make drop zone height fit content, not fixed percentage */

.game-elements-container .text-display {
    flex: 0 0 auto;
    height: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.game-elements-container .control-and-answer-btns {
    flex: 0 0 20%;
    height: 20%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

@media (max-width: 600px) {
    .game-elements-container .control-and-answer-btns {
        height: 25%;
    }
}

.image-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* Text display styling */
.text-display {
    background: rgba(255, 255, 255, 80%);
    padding: 4px;
    box-sizing: border-box;
    min-height: 60px;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.text-display .drop-placeholder {
    color: rgba(0, 0, 0, 0.5);
    font-style: italic;
}

/* Ensure these styles apply even if  wrapper is missing */
.game-elements-container .text-display .drop-placeholder,
.text-display .drop-placeholder {
    color: rgba(0, 0, 0, 0.6);
    font-style: italic;
}

.text-display .text-line {
    font-size: clamp(1.2rem, 2.8vw, 2rem);
    font-weight: 700;
    color: #0f172a;
    text-align: center;
}

.control-and-answer-btns {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto;
}

.control-and-answer-btns[data-layout="phase-a"]>* {
    flex: 0 1 auto;
}

/* Save the Boy specific layout */
.save-the-boy-game .game-elements-container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.save-the-boy-game .left-pane {
    flex: 1 1 70%;
    display: flex;
    flex-direction: column;
}

/* Ensure explicit ordering inside left pane so current word stays under image */
.save-the-boy-game .left-pane>.word-group-display {
    order: 1;
    margin-bottom: 5px;
    margin-top: 4px;
    min-width: 50%;
    max-width: fit-content;
    align-self: center;
    background: lightgreen;
    font-family: Arial, Helvetica, sans-serif;
}

.save-the-boy-game .left-pane>.image-display {
    order: 2;
}

.save-the-boy-game .left-pane>#currentWord {
    order: 3;
    margin-top: 5px;
}

.save-the-boy-game .right-pane {
    flex: 0 0 30%;
    max-width: 25%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.save-the-boy-game .keyboard-grid {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    /* tightened gap for smaller keys */
    align-items: center;
    justify-content: center;
}

.save-the-boy-game .keyboard-key {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 0;
    /* reset padding so aspect-ratio makes a perfect square */
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(2, 6, 23, 0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    /* ensures the key is a perfect square */
    /* Default: 3 letters per row on larger screens */
    flex: 0 0 calc((100% - 8px) / 3);
    max-width: 160px;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    /* readable font size */
}

/* Desktop-specific: cap key size to 50px on screens larger than mobile */
@media (min-width: 721px) {
    .save-the-boy-game .keyboard-key {
        max-width: 45px;
    }
}

.save-the-boy-game .keyboard-key.vowel {
    color: #fff;
    background: #337ac6;
}

/* Vowel hover: slightly darker background (no transition/animation) */
.save-the-boy-game .keyboard-key.vowel:hover {
    background: #2b66a8 !important;
    /* darker than #337ac6 */
    transition: none !important;
}

/* Vowel active (click): inner shadow to emulate pressed state, no scale */
.save-the-boy-game .keyboard-key.vowel:active {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35) !important;
    transform: none !important;
}

.save-the-boy-game .keyboard-key.keyboard-key-active {
    transform: none;
    /* do not scale */
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.06);
    /* subtle inner shadow to emulate press */
}

/* Hint button visuals (reuse timer-display styling) */
.save-the-boy-game .hint-button.hidden {
    display: none !important;
}

/* Boy smile image styling: fill container height, keep aspect ratio, centered */
.save-the-boy-game .image-display .boy-smile-img {
    display: block;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Remove border and use same font/weight as timer display; keep background */
.save-the-boy-game .hint-button {
    border: none;
    outline: none;
    box-shadow: none;
    font-family: inherit;
    /* match timer */
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    /* Disable transitions/animations for this button specifically */
    transition: none !important;
}

.save-the-boy-game .hint-button:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.12);
}

/* Hover: slightly darker background (no transition) */
.save-the-boy-game .hint-button:hover {
    background-color: #2b7fbf !important;
    /* darker than #3498db */
}

/* Active (click): inner shadow to emulate pressed state, no transition */
.save-the-boy-game .hint-button:active {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45) !important;
}

/* Default key hover and active states (no animation, no scale) */
@media (hover: hover) {
    .save-the-boy-game .keyboard-key:hover {
        background: #d4d4d4 !important;
        /* slightly darker than white */
        transition: none !important;
    }
}

.save-the-boy-game .keyboard-key:active {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.25) !important;
    transform: none !important;
}

/* Specific wrong key hover/active to match red color */
.save-the-boy-game .keyboard-key.keyboard-key-wrong:hover {
    background: #dc2626 !important;
    /* darker red */
}

.save-the-boy-game .keyboard-key.keyboard-key-wrong:active {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45) !important;
}

/* Hint key hover/active to match hint color */
.save-the-boy-game .keyboard-key.keyboard-key-hint:hover {
    background: #2b6bd6 !important;
}

.save-the-boy-game .keyboard-key.keyboard-key-hint:active {
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35) !important;
}



@keyframes key-wrong {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Make wrong key visually obvious: red background and white text during flash */
.save-the-boy-game .keyboard-key.keyboard-key-wrong {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}

/* Keyboard selected/disabled state */
.save-the-boy-game .keyboard-key {
    transition: opacity 0.18s ease, transform 0.12s ease;
}

.save-the-boy-game .keyboard-key:disabled,
.save-the-boy-game .keyboard-key.keyboard-key-selected {
    opacity: 0;
    /* fully transparent */
    cursor: default;
    pointer-events: none;
    /* make unclickable */
}

/* Letter slots (blanks) */
.save-the-boy-game .letter-slots {
    display: flex;
    gap: 10px;
    /* gap between words */
    justify-content: center;
    flex-wrap: wrap;
}

/* Group of letter slots representing a whole word (prevents breaking between letters) */
.save-the-boy-game .word-group {
    display: inline-flex;
    gap: 6px;
    flex-wrap: nowrap;
    /* do not wrap inside a word */
    white-space: nowrap;
    align-items: center;
    font-size: clamp(1rem, 2.2vw, 1.6rem);
    /* allow word to resize responsively */
    min-width: 0;
}

.save-the-boy-game .letter-slot {
    min-width: 15px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid rgba(0, 0, 0, 0.39);
    font-weight: 700;
    font-size: inherit;
    /* inherit from word-group so words can resize */
    /* Make revealed letters readable (dark on light background) */
    color: #0f172a;
    /* Enforce font properties so other display modes can't override them */
    font-family: inherit !important;
    line-height: 1 !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Ensure slot appearance is identical before/after reveal */
.save-the-boy-game .letter-slot,
.save-the-boy-game .letter-slot.slot-correct {
    font-family: inherit !important;
    font-weight: 700 !important;
    font-size: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Preserve base color for correct slots; incorrect slots keep their red/bg */
.save-the-boy-game .letter-slot.slot-correct {
    color: #0f172a !important;
}

.save-the-boy-game .letter-sep {
    padding: 0 6px;
    opacity: 0.75;
}

.save-the-boy-game .slot-correct {
    /* keep for compatibility; prefer wrapper-based styling */
    background: transparent !important;
    color: inherit !important;
    border-radius: 6px;
}

.save-the-boy-game .slot-incorrect {
    /* keep for compatibility; prefer wrapper-based styling */
    background: #ef4444;
    color: #fff;
    border-radius: 6px;
}

/* Wrapper-based styles so we can mark the whole slot group correct/incorrect
   without changing per-slot font properties. This avoids computed-style
   differences when classes are toggled. */
.save-the-boy-game .letter-slots.slots-marked-correct .letter-slot {
    /* visual treat: subtle highlighted outline while preserving font */
    background: linear-gradient(0deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0)) !important;
}

.save-the-boy-game .letter-slots.slots-marked-incorrect .letter-slot {
    background: #ef4444 !important;
    color: #fff !important;
}

/* Separated so each can be customized independently in future edits */
.save-the-boy-game .word-group-display {
    background: #fff;
    padding: 5px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 3px 8px rgba(2, 6, 23, 0.06);
    min-height: 26px;
    /* Presentation moved to CSS: ensure topic text is always black */
    color: #000 !important;
    font-size: 0.95rem;
    font-weight: 700;
}

.save-the-boy-game #currentWord {
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 3px 8px rgba(2, 6, 23, 0.06);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Controlled visibility via the 'hidden' class to avoid inline styles */
.save-the-boy-game #currentWord.hidden {
    display: none !important;
}

.save-the-boy-game #currentWord.keep-visible-text .text-line,
.save-the-boy-game #currentWord.keep-visible-text .letter-slot {
    color: #0f172a !important;
}

.save-the-boy-game .image-display {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* ensure absolutely positioned images center correctly */
}

/* Hide the actual image by default; reveal only when the container has .image-visible */
.save-the-boy-game .image-display .topic-image {
    display: none;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.save-the-boy-game .image-display.image-visible .topic-image {
    display: block;
    opacity: 1;
}

/* When a word is completed, bring topic image above smile and other elements */
.save-the-boy-game .image-display .topic-image.topic-image-front {
    z-index: 20;
    position: relative;
}

/* Background layers (room/explosive) via absolutely positioned stacked images */
.save-the-boy-game .image-display .background-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    display: none;
}

.save-the-boy-game .image-display .background-layer.visible {
    opacity: 1;
    display: block;
}

/* Explosion overlay: cover the full image display area */
.save-the-boy-game .image-display .explosion-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.save-the-boy-game .image-display .explosion-overlay.visible {
    opacity: 1;
}

/* Make flex children shrink correctly and allow keyboard to scroll on mobile */
.game-area,
.game-elements-container,
.save-the-boy-game .left-pane,
.save-the-boy-game .right-pane {
    min-height: 0;
}

/* Topic images should be centered and positioned above the background; front class elevates it above smile */
.save-the-boy-game .image-display .topic-image {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: auto;
    z-index: 10;
    display: none;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.save-the-boy-game .image-display.image-visible .topic-image {
    display: block;
    opacity: 1;
}

.save-the-boy-game .image-display .topic-image.topic-image-front {
    z-index: 40;
    /* above the smile image */
}

/* Boy emotion images (stacked via opacity) */
.save-the-boy-game .image-display .boy-smile-img {
    display: block;
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    margin: 0 auto;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    filter: drop-shadow(5px 50px 3px rgba(0, 0, 0, 0.13));
    /* lower z-index so topic images can overlay it reliably */
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}

.save-the-boy-game .image-display .boy-smile-img.visible {
    opacity: 1;
}

.save-the-boy-game .game-elements-container {
    min-height: 0;
    overflow: hidden;
}

.save-the-boy-game .image-display {
    max-height: 45vh;
    overflow: hidden;
}

@media (max-width: 720px) {
    .save-the-boy-game .game-elements-container {
        flex-direction: column;
    }

    .save-the-boy-game .image-display {
        max-height: 40vh;
    }

    .save-the-boy-game .right-pane {
        max-width: none;
        width: 95%;
        order: 4;
        flex: 0 0 auto;
        align-self: center;
    }

    /* Mobile: ensure keyboard block is sized to its contents and centered */
    .save-the-boy-game .keyboard-grid {
        width: auto;
        margin: 0 auto;
    }

    /* Mobile: remove padding around current word display to give more space */
    .save-the-boy-game #currentWord {
        padding: 0;
        border-radius: 0;
    }

    /* Mobile: allow smaller letter slots */
    .save-the-boy-game .letter-slot {
        min-width: 10px;
    }

    /* Mobile: layout should be 3 rows for all letters (26 letters -> 9 columns) */
    .save-the-boy-game .keyboard-key {
        flex: 0 0 calc((100% - 32px) / 9);
        max-width: 44px;
    }

    .save-the-boy-game .keyboard-container {
        max-height: 30vh;
        overflow-y: auto;
        padding: 8px;
    }
}

.control-and-answer-btns[data-layout="phase-b"] {
    align-items: center;
}

.control-and-answer-btns[data-layout="phase-b"]>.answer-button {
    flex: 1 1 calc(33.333% - 18px);
    max-width: calc(33.333% - 18px);
    min-width: 88px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Quiz mode: allow buttons to be their natural width, only wrap when necessary */
.control-and-answer-btns[data-layout="phase-b"][data-mode="quiz"]>.answer-button {
    flex: 0 1 auto;
    max-width: none;
}

.next-button,
.answer-button {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: clamp(6px, 1.2vw, 10px) clamp(10px, 3vw, 18px);
    font-size: clamp(0.82rem, 2.4vw, 1rem);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.2);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    min-height: 32px;
}

.next-button:hover,
.answer-button:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    box-shadow: 0 8px 16px rgba(30, 64, 175, 0.28);
}

.next-button:active,
.answer-button:active {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.25);
}

.answer-button.correct {
    background: linear-gradient(135deg, #16a34a, #15803d);
    box-shadow: 0 6px 12px rgba(22, 163, 74, 0.3);
}

.answer-button.incorrect {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 6px 12px rgba(220, 38, 38, 0.3);
}

.answer-button:disabled {
    cursor: default;
    opacity: 0.85;
}

.speaker-button {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: clamp(6px, 1.2vw, 10px) clamp(9px, 2.4vw, 14px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(217, 119, 6, 0.18);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    min-height: 32px;
}

.speaker-button svg {
    display: block;
}

.speaker-button:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 8px 16px rgba(180, 83, 9, 0.28);
}

.speaker-button:active {
    background: linear-gradient(135deg, #b45309, #92400e);
    box-shadow: 0 4px 10px rgba(146, 64, 14, 0.24);
}

/* Scale the emoji icon visually without changing button layout (transform doesn't affect layout) */
.speaker-button .speaker-emoji {
    display: inline-block;
    font-size: 18px;
    /* base size before scaling */
    line-height: 1;
    transform: scale(1.2);
    transform-origin: center;
    vertical-align: middle;
}

/* Tile and keyboard styles are defined in each game's CSS file */

.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;
}



/* Responsive grid for topic tiles */


.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(80px, auto);
    gap: 10px;
    width: 100%;
    /* limit vertical growth so page chrome (start button / ads) remain visible */
    max-height: 300px;
    overflow: auto;
    overflow-x: hidden;
    padding: 5px;
}


/* Game visual assets and progress bar styles */

.progress-bar-container,
#progressBarContainer {
    background: transparent;
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    height: 20px;
    min-height: 20px;
}

.progress-bar-container::before,
#progressBarContainer::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%);
}

/* New progress road: two colors meet in the middle. The left side percent
   is set via the --left CSS variable by JS (e.g. --left: 60%). */
.progress-bar-container .progress-road,
#progressBarContainer .progress-road {
    width: 100%;
    height: 125%;
    overflow: hidden;
    position: relative;
    background: linear-gradient(to right, #3b82f6 0%, #3b82f6 var(--left, 50%), #ef4444 var(--left, 50%), #ef4444 100%);
}

/* Progress pusher image styling */
.progress-bar-container .progress-road .progress-pusher,
#progressBarContainer .progress-road .progress-pusher {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    height: 30px;
    width: auto;
    z-index: 10;
    pointer-events: none;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
    transition: left 0.3s ease-out;
}

/* Decorative end buttons */
.progress-bar-container .progress-road .progress-left-btn,
#progressBarContainer .progress-road .progress-left-btn {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(-50%, -50%);
    height: 30px;
    width: auto;
    z-index: 9;
    pointer-events: none;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

/* Pressed visual for end buttons */
.progress-bar-container .progress-road .progress-left-btn.pressed,
#progressBarContainer .progress-road .progress-left-btn.pressed {
    /* move down slightly and scale to look pressed */
    transform: translate(-50%, -40%) scale(0.98);
    opacity: 0.95;
}

/* Vehicle-specific rules are kept in each game's CSS; this file defines vocab visuals */

/* Inline warning styling for category 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;
    }
}

/* Styles for topic tiles */
.topics-box {
    background-color: #ccc;
    color: #555;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: clamp(1em, 3vw, 1.8em);
    font-weight: 600;
    font-family: 'CustomMain', Arial, sans-serif;
    text-transform: uppercase;
    transition: background-color 0.2s ease, transform 0.1s ease;
    user-select: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

/* Info button styling to mirror parts-of-speech selection */
.topics-box .info-button {
    position: absolute;
    top: -8px;
    right: -8px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
}

.selection-screen * {
    /* Alias placeholder rules to preserve specificity for selection screen */
    grid-auto-rows: 60px;
}

.topics-box.selected {
    background: linear-gradient(90deg, #3498db, #2980b9);
    color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.topics-box:hover:not(.selected) {
    background-color: #bbb;
    transform: scale(1.03);
}

/* Ensure grid cells size similarly to original selection boxes */
.topics-box,
.topics-box {
    width: 100%;
    height: 100%;
    white-space: normal;
    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;
    word-break: break-word;
    hyphens: auto;
    font-family: Arial, sans-serif;
    aspect-ratio: auto !important;
}

/* Ensure topic tiles use capitalization regardless of global rules */
.topics-box {
    text-transform: capitalize !important;
}

@media (min-width: 601px) {
    .topics-box {
        width: 95%;
        margin: 0 auto;
    }
}