@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

body {
    margin: 0;
    padding: 0;
    background-color: #050510;
    color: white;
    font-family: 'Orbitron', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    user-select: none;
}

#game-container {
    position: relative;
    width: min(900px, calc(100vw - 16px));
    height: 500px;
    max-height: 100vh;
    aspect-ratio: 9 / 5;
    box-sizing: border-box;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2);
    border: 2px solid #333;
    background: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
    border-radius: 10px;
    overflow: hidden;
    transition: width 0.3s, height 0.3s, box-shadow 0.5s;
}

#game-container.fever { animation: fever-pulse 0.45s infinite alternate; }
@keyframes fever-pulse {
    from { box-shadow: 0 0 34px rgba(255, 238, 0, 0.28); }
    to { box-shadow: 0 0 70px rgba(255, 0, 230, 0.45); }
}

#game-container:fullscreen {
    border: none;
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: block;
}

/* Letterbox the canvas and every overlay into a centered 9:5 box so the
   game keeps its 900x500 geometry — entities, floor, and HUD stay aligned. */
#game-container:fullscreen > * {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    width: min(100vw, 180vh);
    height: min(100vh, 55.5556vw);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 5;
}

.hud-left { display: flex; flex-direction: column; gap: 6px; }
.hud-right { display: flex; gap: 15px; pointer-events: auto; }

.hud-text {
    font-size: 24px;
    text-shadow: 0 0 10px #00f3ff;
    color: #00f3ff;
    font-weight: bold;
    transition: color 0.5s, text-shadow 0.5s;
}

#lives-display {
    color: #ff0055;
    text-shadow: 0 0 10px #ff0055;
    letter-spacing: 5px;
    font-size: 30px;
}

#combo-display {
    color: #ffee00;
    text-shadow: 0 0 10px #ffee00;
    font-size: 18px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s;
}
#combo-display.active { opacity: 1; }

#level-display {
    color: #39FF14;
    text-shadow: 0 0 10px #39FF14;
    font-size: 16px;
    font-weight: bold;
}

#wpm-display {
    color: #FFAA33;
    text-shadow: 0 0 10px #FFAA33;
    font-size: 16px;
    font-weight: bold;
}

#accuracy-display {
    color: #39FF14;
    text-shadow: 0 0 10px #39FF14;
    font-size: 16px;
    font-weight: bold;
}
#accuracy-display.warn { color: #ffee00; text-shadow: 0 0 10px #ffee00; }
#accuracy-display.bad { color: #ff0055; text-shadow: 0 0 10px #ff0055; }

#boss-display {
    color: #ff00e6;
    text-shadow: 0 0 10px #ff00e6;
    font-size: 15px;
    font-weight: bold;
    opacity: 0.9;
}

#prompt-display {
    color: #ffee00;
    text-shadow: 0 0 10px #ffee00;
    font-size: 15px;
    font-weight: bold;
    min-height: 20px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.2s, transform 0.2s;
}
#prompt-display.active {
    opacity: 1;
    transform: translateX(0);
}

#shield-display {
    color: #00BFFF;
    text-shadow: 0 0 10px #00BFFF;
    font-size: 15px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}
#shield-display.active { opacity: 1; }

.icon-btn {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00f3ff;
    color: #00f3ff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    text-shadow: 0 0 10px #00f3ff;
    outline: none;
    box-shadow: inset 0 0 16px rgba(0, 243, 255, 0.12), 0 0 14px rgba(0, 243, 255, 0.18);
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.1); }
.icon-btn.muted { border-color: #555 !important; color: #555 !important; text-shadow: none !important; }
.icon-btn svg {
    width: 25px;
    height: 25px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 6px currentColor);
}

/* SCREENS */
#menu-screen, #game-over-screen, #leaderboard-screen, #pause-screen, #badges-screen, #progress-screen, #lessons-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.90);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    padding: 15px 0;
    box-sizing: border-box;
}

.badge-progress {
    color: #ffee00;
    font-size: 14px;
    margin-bottom: 10px;
}

/* PROGRESS SCREEN */
.progress-chart-title {
    color: #FFAA33;
    text-shadow: 0 0 8px #FFAA33;
    font-size: 13px;
    letter-spacing: 2px;
    margin: 14px 0 20px;
}

.progress-chart {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    height: 130px;
    width: min(640px, 90%);
    border-bottom: 2px solid rgba(0, 243, 255, 0.4);
    padding: 0 8px;
    box-sizing: border-box;
}

.progress-bar {
    width: 26px;
    background: linear-gradient(to top, #00586b, #00f3ff);
    border-radius: 3px 3px 0 0;
    position: relative;
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.35);
}

.progress-bar.daily {
    background: linear-gradient(to top, #5c0054, #ff00e6);
    box-shadow: 0 0 8px rgba(255, 0, 230, 0.35);
}

.progress-bar span {
    position: absolute;
    top: -17px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #fff;
    text-shadow: 0 0 6px rgba(0, 243, 255, 0.8);
}

.progress-trend {
    color: #ffee00;
    text-shadow: 0 0 8px rgba(255, 238, 0, 0.5);
    font-size: 14px;
    margin-top: 12px;
    max-width: 85%;
    text-align: center;
}

.personal-best {
    color: #00f3ff;
    font-size: 14px;
    margin: 6px 0 2px;
}

.personal-best.record {
    color: #ffee00;
    text-shadow: 0 0 12px #ffee00;
    animation: bestPulse 0.8s infinite alternate;
}

@keyframes bestPulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.badge-grid {
    width: min(820px, 92%);
    max-height: 300px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(10, minmax(54px, 1fr));
    gap: 8px;
    padding: 4px 10px 8px;
    box-sizing: border-box;
}

.badge-card {
    position: relative;
    min-width: 0;
    aspect-ratio: 1 / 1.12;
    border: 1px solid rgba(0, 243, 255, 0.36);
    background: rgba(0, 0, 0, 0.42);
    border-radius: 6px;
    box-shadow: inset 0 0 12px rgba(0, 243, 255, 0.08), 0 0 10px rgba(0, 243, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 3px;
    box-sizing: border-box;
}

.badge-card.locked {
    filter: grayscale(1);
    opacity: 0.38;
}

.badge-card.earned {
    border-color: #ffee00;
    box-shadow: 0 0 16px rgba(255, 238, 0, 0.28), inset 0 0 10px rgba(255, 238, 0, 0.1);
}

.badge-icon {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background-image: url('assets/badge-sheet.png');
    background-size: 500% 1000%;
    box-shadow: 0 0 10px rgba(255, 0, 230, 0.24);
}

.badge-name {
    max-width: 100%;
    color: #ddd;
    font-size: 8px;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
}

.badge-card.earned .badge-name {
    color: #ffee00;
    text-shadow: 0 0 6px #ffee00;
}

.badge-lock {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #aaa;
    font-size: 10px;
}

h1 {
    font-size: 44px;
    color: #fff;
    text-shadow: 0 0 20px #00f3ff, 4px 4px 0px #ff0055;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-style: italic;
    flex-shrink: 0;
}

p {
    font-size: 15px;
    color: #ddd;
    margin: 0 0 10px;
    max-width: 700px;
    text-align: center;
    line-height: 1.5;
    flex-shrink: 0;
}

.key-badge { background: #333; border: 1px solid #fff; border-radius: 4px; padding: 2px 8px; color: #fff; font-weight: bold; }

.keyboard-note {
    color: #ffee00;
    border: 1px solid rgba(255, 238, 0, 0.55);
    background: rgba(255, 238, 0, 0.08);
    box-shadow: 0 0 16px rgba(255, 238, 0, 0.12);
    border-radius: 5px;
    padding: 6px 12px;
    margin: 2px 0 7px;
    font-size: 12px;
    max-width: 680px;
}

.btn {
    background: rgba(0, 243, 255, 0.1);
    border: 2px solid #00f3ff;
    color: #00f3ff;
    padding: 15px 25px;
    font-size: 18px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin: 5px;
    border-radius: 5px;
    text-shadow: 0 0 8px #00f3ff;
}
.btn:hover { background: #fff; color: #000; transform: scale(1.05); box-shadow: 0 0 30px #fff; }
.btn-group { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; flex-shrink: 0; }
.lessons-grid { max-width: 580px; margin-top: 8px; }
.hidden { display: none !important; }

/* LEADERBOARD & INPUT STYLES */
input[type="text"] {
    background: transparent;
    border: 2px solid #ff0055;
    color: white;
    padding: 10px;
    font-size: 30px;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    width: 150px;
    margin-bottom: 20px;
    text-transform: uppercase;
    outline: none;
}

.leaderboard-container {
    display: flex;
    gap: 50px;
    width: 80%;
    justify-content: center;
    margin-top: 20px;
}

.lb-column {
    width: 45%;
    text-align: center;
}

.lb-title {
    color: #ffee00;
    font-size: 20px;
    border-bottom: 2px solid #ffee00;
    margin-bottom: 10px;
    padding-bottom: 5px;
}

.lb-list {
    list-style: none;
    padding: 0;
    font-size: 16px;
    color: #aaa;
    text-align: left;
}

.lb-list li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid #333;
}

.lb-list li.recent-score {
    color: #ffee00;
    text-shadow: 0 0 8px #ffee00;
}

.lb-rank { color: #ffee00; width: 30px; }
.lb-name { color: white; flex-grow: 1; text-align: center;}
.lb-score { color: #00f3ff; width: 60px; text-align: right;}

#feedback-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 6;
}

#burst-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 7;
}

.text-burst {
    position: absolute;
    transform: translate(-50%, -50%);
    color: #ffee00;
    font-size: 22px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 2px;
    text-shadow: 0 0 12px #ffee00, 3px 3px 0 #ff0055;
    animation: burst-float 0.85s ease-out forwards;
    white-space: nowrap;
}

@keyframes burst-float {
    from { opacity: 0; transform: translate(-50%, -35%) scale(0.75); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
    to { opacity: 0; transform: translate(-50%, -95%) scale(1); }
}

/* GAME OVER STATS */
.stats-grid {
    display: flex;
    gap: 30px;
    margin: 4px 0 12px;
    flex-wrap: wrap;
    justify-content: center;
}
.stat-box {
    text-align: center;
    min-width: 100px;
}
.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #00f3ff;
    text-shadow: 0 0 10px #00f3ff;
}
.stat-label {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}
.stat-box.highlight .stat-value { color: #ffee00; text-shadow: 0 0 10px #ffee00; }

#game-over-screen h1 { margin-bottom: 2px; }

.game-over-note {
    color: #ffee00;
    font-size: 14px;
    margin-bottom: 8px;
    min-height: 20px;
}

.missed-box {
    display: none;
    color: #ddd;
    font-size: 13px;
    margin: 0 0 10px;
}
.missed-box.active { display: block; }
.missed-letters {
    color: #ff0055;
    text-shadow: 0 0 8px #ff0055;
    font-weight: 900;
}

/* PER-KEY HEATMAP / COACHING (E2, E3, C3) */
.keymap-box { margin: 4px 0 8px; display: flex; flex-direction: column; align-items: center; }
.keymap-title {
    color: #FFAA33;
    text-shadow: 0 0 8px #FFAA33;
    font-size: 12px;
    letter-spacing: 2px;
    margin: 10px 0 6px;
}
.keymap-grid { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.keymap-row { display: flex; gap: 4px; justify-content: center; }
.keymap-cell {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid #444;
    border-radius: 4px;
    color: #39FF14;
    box-sizing: border-box;
}
.keymap-cell.untouched { color: #555; border-color: #2a2a2a; opacity: 0.45; }
.confusion-line { color: #ff8a00; font-size: 13px; margin: 8px 0 2px; min-height: 16px; text-align: center; }
.coach-line { color: #00f3ff; text-shadow: 0 0 8px rgba(0,243,255,0.5); font-size: 13px; margin: 4px 0; text-align: center; max-width: 92%; }

@media (max-width: 920px), (max-height: 520px) {
    .keymap-cell { width: 21px; height: 21px; font-size: 11px; }
}

/* SCHOOL SELECTOR */
.school-select {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 4px 0 8px;
    flex-shrink: 0;
}
.level-select {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 4px 0 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.school-btn {
    background: rgba(0, 243, 255, 0.05);
    border: 2px solid #555;
    color: #888;
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}
.school-btn:hover { border-color: #00f3ff; color: #00f3ff; }
.school-btn.selected {
    border-color: #ffee00;
    color: #ffee00;
    background: rgba(255, 238, 0, 0.1);
    text-shadow: 0 0 8px #ffee00;
}

/* CHARACTER SELECTOR */
.runner-select {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 2px 0 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.runner-btn {
    background: rgba(0, 243, 255, 0.05);
    border: 2px solid #555;
    color: #888;
    width: 58px;
    height: 38px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}
.runner-btn:hover { border-color: #00f3ff; color: #00f3ff; }
.runner-btn.selected {
    border-color: #ffee00;
    color: #ffee00;
    background: rgba(255, 238, 0, 0.1);
    box-shadow: 0 0 14px rgba(255, 238, 0, 0.18);
}

.runner-preview {
    width: 20px;
    height: 20px;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
}
.runner-preview.orb { border-radius: 50%; }
.runner-preview.gem { transform: rotate(45deg); }
.runner-preview.arrow {
    width: 0;
    height: 0;
    background: transparent;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-left: 22px solid currentColor;
    box-shadow: none;
    filter: drop-shadow(0 0 8px currentColor);
}
.runner-preview.hex {
    clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0 50%);
}

/* LEADERBOARD TABS */
.lb-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
}
.lb-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #555;
    color: #888;
    padding: 8px 16px;
    font-size: 13px;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}
.lb-tab:hover { border-color: #00f3ff; color: #00f3ff; }
.lb-tab.active {
    border-color: #ffee00;
    color: #ffee00;
    background: rgba(255, 238, 0, 0.1);
    text-shadow: 0 0 8px #ffee00;
}

.lb-school-tag {
    color: #888;
    font-size: 11px;
    margin-left: 4px;
}

.menu-legend {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 0 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #ddd;
    font-size: 13px;
}

.legend-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
}
.legend-drone { border: 2px solid #ff00e6; color: #fff; box-shadow: 0 0 10px #ff00e6; }
.legend-spike {
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 24px solid #ff0000;
    filter: drop-shadow(0 0 7px #ff0000);
}
.legend-boss {
    width: 38px;
    color: #ff00e6;
    border: 2px solid #ff00e6;
    box-shadow: 0 0 10px #ff00e6;
}

/* Compact the (now taller) main menu so runner + school + level + modes fit the
   500px play area without scrolling. */
#menu-screen h1 { margin-bottom: 4px; }
#menu-screen p { margin-bottom: 3px; line-height: 1.3; }
#menu-screen .keyboard-note { margin: 2px 0 5px; }
#menu-screen .menu-legend { margin-bottom: 5px; }
#menu-screen .runner-select,
#menu-screen .school-select,
#menu-screen .level-select { margin: 2px 0 5px; }
#menu-screen .btn { padding: 10px 15px; font-size: 15px; margin: 4px; }
#menu-screen #difficulty-btns { gap: 8px; }

#debug-panel {
    position: absolute;
    left: 12px;
    bottom: 10px;
    z-index: 8;
    pointer-events: none;
    display: none;
    color: #39FF14;
    font: 11px monospace;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid rgba(57, 255, 20, 0.5);
    padding: 6px 8px;
    border-radius: 4px;
    white-space: pre;
}
#debug-panel.active { display: block; }

#countdown-screen {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.18);
}

#countdown-text {
    color: #fff;
    font-size: 92px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 5px;
    text-shadow: 0 0 24px #00f3ff, 6px 6px 0 #ff0055;
    transform: scale(1);
    animation: countdown-pop 0.45s ease-out;
}

@keyframes countdown-pop {
    from { opacity: 0; transform: scale(0.65); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 920px), (max-height: 520px) {
    body {
        padding: 8px;
        box-sizing: border-box;
    }
    #game-container {
        width: min(calc(100vw - 16px), 900px);
        height: auto;
    }
    #ui-layer {
        padding: 14px;
    }
    h1 {
        font-size: 32px;
    }
    p {
        font-size: 12px;
        line-height: 1.35;
        max-width: 92%;
    }
    .keyboard-note {
        padding: 5px 10px;
        font-size: 11px;
        margin-bottom: 5px;
    }
    .runner-select {
        margin-bottom: 4px;
    }
    .menu-legend {
        gap: 8px;
        margin-bottom: 5px;
    }
    .legend-item {
        font-size: 11px;
    }
    .runner-btn {
        width: 50px;
        height: 34px;
    }
    .runner-preview {
        width: 18px;
        height: 18px;
    }
    .runner-preview.arrow {
        border-top-width: 10px;
        border-bottom-width: 10px;
        border-left-width: 20px;
    }
    .btn {
        padding: 11px 16px;
        font-size: 14px;
    }
    .school-btn {
        padding: 8px 14px;
    }
    .hud-text {
        font-size: 18px;
    }
    #lives-display {
        font-size: 22px;
    }
    .hud-right {
        gap: 8px;
    }
    .icon-btn {
        width: 42px;
        height: 42px;
    }
    #countdown-text {
        font-size: 64px;
    }
    .badge-grid {
        grid-template-columns: repeat(5, minmax(48px, 1fr));
        max-height: 250px;
        gap: 6px;
    }
    .badge-icon {
        width: 36px;
        height: 36px;
    }
    .badge-name {
        font-size: 7px;
    }
}

@media (min-width: 740px) and (max-width: 1400px) and (min-height: 540px) {
    body {
        padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
        box-sizing: border-box;
    }

    #game-container {
        width: min(calc(100vw - 16px), calc((100dvh - 16px) * 1.8));
        height: min(calc(100dvh - 16px), calc((100vw - 16px) / 1.8));
        max-width: none;
        max-height: none;
    }

    #ui-layer {
        padding: 16px;
    }

    h1 {
        font-size: 40px;
        margin-bottom: 5px;
    }

    p {
        font-size: 13px;
        line-height: 1.32;
    }

    .keyboard-note {
        font-size: 12px;
        padding: 6px 12px;
        margin-bottom: 6px;
    }

    .menu-legend {
        gap: 10px;
        margin-bottom: 7px;
    }

    .legend-item {
        font-size: 12px;
    }

    .btn {
        min-height: 46px;
        padding: 11px 17px;
        font-size: 14px;
        margin: 4px;
    }

    .school-btn {
        min-height: 44px;
        padding: 8px 18px;
    }

    .runner-btn {
        width: 56px;
        height: 40px;
    }

    .hud-text {
        font-size: 21px;
    }

    #lives-display {
        font-size: 26px;
    }

    #combo-display {
        font-size: 16px;
    }

    #boss-display,
    #level-display,
    #wpm-display,
    #accuracy-display,
    #shield-display,
    #prompt-display {
        font-size: 14px;
    }

    .hud-right {
        gap: 9px;
    }

    .icon-btn {
        width: 46px;
        height: 46px;
    }

    .leaderboard-container {
        width: 90%;
        gap: 28px;
    }

    .badge-grid {
        width: 92%;
        max-height: min(52dvh, 390px);
        grid-template-columns: repeat(10, minmax(50px, 1fr));
    }
}

@media (min-width: 740px) and (max-width: 1400px) and (orientation: portrait) {
    #game-container {
        width: calc(100vw - 16px);
        height: calc((100vw - 16px) / 1.8);
    }

    #menu-screen, #game-over-screen, #leaderboard-screen, #pause-screen, #badges-screen, #progress-screen, #lessons-screen {
        justify-content: flex-start;
        padding-top: 22px;
    }

    h1 {
        font-size: 36px;
    }

    .btn {
        min-width: 128px;
    }

    .badge-grid {
        grid-template-columns: repeat(8, minmax(50px, 1fr));
    }
}
