* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
}

button:not(.sorterLetter):not(.connectCenterLetter):not(.busVehicle),
.letterCard,
.letterImage,
.wordCard {
    touch-action: manipulation;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #87CEEB, #EAF8FF);
    color: #333;
    overflow: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.logo {
    text-align: center;
    margin-top: 60px;
}

.logo h1 {
    font-size: 56px;
    color: #ff6b6b;
}

.logo p {
    margin-top: 15px;
    font-size: 24px;
}

.mainButton,
.playButton {
    display: block;
    margin: 60px auto;
    width: 260px;
    height: 70px;
    border: none;
    border-radius: 20px;
    background: #ffb703;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: .2s;
}

.repeatRoundButton {
    display: block;
    margin: 14px auto 0;
    min-width: 180px;
    padding: 12px 20px;
    border: none;
    border-radius: 16px;
    background: #4dabf7;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}

.mainButton:hover,
.playButton:hover {
    transform: scale(1.05);
}

.installButton {
    display: block;
    margin: -38px auto 0;
    padding: 10px 18px;
    border: 2px solid rgba(255, 255, 255, .82);
    border-radius: 14px;
    background: rgba(255, 255, 255, .68);
    color: #4f5f8c;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(69, 101, 152, .14);
}

.installButton:hover {
    background: rgba(255, 255, 255, .86);
}

.installButton.hidden {
    display: none;
}

.header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.settingsButton {
    margin-left: auto;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .75);
    color: #4f5f8c;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 6px 12px rgba(69, 101, 152, .16);
}

.backButton {
    width: 55px;
    height: 55px;
    border: none;
    border-radius: 50%;
    background: #4dabf7;
    color: white;
    font-size: 26px;
    cursor: pointer;
}

.overallProgress {
    width: min(760px, 100%);
    margin: 0 auto clamp(10px, 1.5vh, 14px);
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, .78);
    border-radius: 16px;
    background: rgba(255, 255, 255, .58);
    box-shadow: 0 5px 12px rgba(69, 101, 152, .12);
}

.overallProgressText {
    margin-bottom: 6px;
    color: #4f5f8c;
    text-align: center;
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 700;
}

.overallProgressTrack {
    height: 12px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, .84);
    border-radius: 999px;
    background: #e2e9fb;
}

.overallProgressFill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #51cf66, #4dabf7, #9775fa);
    transition: width 300ms ease;
}

.demoNotice {
    margin: -4px auto 8px;
    color: #4f5f8c;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.demoNotice.hidden {
    display: none;
}

.lettersGrid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: min(720px, 100%);
    margin: 0 auto;
    gap: clamp(12px, 2vw, 18px);
    align-items: center;
}

.letterCardWrapper {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(72px, 12vw, 92px);
    aspect-ratio: 1;
}

.letterProgressRing {
    position: absolute;
    inset: -7px;
    z-index: 2;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .88),
        0 5px 12px rgba(23, 92, 41, .22),
        inset 0 1px 3px rgba(255, 255, 255, .85);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 0);
    pointer-events: none;
}

.letterProgressSegment {
    --segment-start: 0deg;
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background:
        conic-gradient(
            from var(--segment-start),
            rgba(214, 220, 227, .78) 0deg 66deg,
            transparent 66deg 72deg
        );
}

.letterProgressSegment.is-complete {
    background:
        conic-gradient(
            from var(--segment-start),
            #1f9d4a 0deg 66deg,
            transparent 66deg 72deg
        );
}

.letterCard {
    position: relative;
    z-index: 1;
    display: grid;
    width: clamp(72px, 12vw, 92px);
    height: clamp(72px, 12vw, 92px);
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .82);
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff, #f3f7ff);
    color: #4f5f8c;
    font-size: clamp(34px, 6vw, 44px);
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 7px 16px rgba(69, 101, 152, .16);
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.letterCard:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, #ffffff, #e7f2ff);
    box-shadow: 0 10px 18px rgba(69, 101, 152, .22);
}

.letterCard:active {
    transform: scale(.96);
    box-shadow: 0 4px 10px rgba(69, 101, 152, .16);
}

.letterCard.is-completed {
    color: white;
    background: linear-gradient(135deg, #6db7ff, #7b82ed);
    box-shadow: 0 0 0 5px rgba(255, 255, 255, .6), 0 12px 25px rgba(83, 112, 223, .3);
    transform: scale(.96);
}

.letterCard.is-locked {
    color: rgba(79, 95, 140, .72);
    cursor: not-allowed;
    background: linear-gradient(145deg, rgba(255, 255, 255, .82), rgba(222, 229, 241, .9));
    box-shadow: 0 5px 12px rgba(69, 101, 152, .11);
}

.letterCard.is-locked:hover,
.letterCard.is-locked:active {
    transform: none;
    background: linear-gradient(145deg, rgba(255, 255, 255, .82), rgba(222, 229, 241, .9));
    box-shadow: 0 5px 12px rgba(69, 101, 152, .11);
}

.letterLock {
    position: absolute;
    right: -2px;
    bottom: -2px;
    z-index: 4;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: #6d7c9f;
    font-size: 11px;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 3px 7px rgba(46, 74, 122, .2);
}

#lettersScreen {
    position: relative;
    max-height: 100svh;
    overflow-y: auto;
    padding: clamp(14px, 3vw, 30px);
    background: linear-gradient(180deg, #87CEEB, #EAF8FF);
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 141, 247, .65) transparent;
}

#lettersScreen .header {
    position: sticky;
    top: 0;
    z-index: 12;
    padding-bottom: 10px;
    background: linear-gradient(180deg, rgba(135, 206, 235, .96), rgba(135, 206, 235, .88));
    backdrop-filter: blur(3px);
}

.progressBlock {
    width: min(760px, 100%);
    margin: 0 auto clamp(16px, 3vw, 24px);
}

.progressLabel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: #4f5f8c;
    font-size: 14px;
    font-weight: 700;
}

.progressBar {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(91, 141, 247, .16);
    box-shadow: inset 0 2px 6px rgba(69, 101, 152, .12);
}

.progressBarFill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6db7ff, #7b82ed);
    transition: width 200ms ease;
}

.settingsOverlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(46, 74, 122, .35);
    z-index: 20;
}

.settingsOverlay.hidden {
    display: none;
}

.fullVersionOverlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(46, 74, 122, .42);
}

.fullVersionOverlay.hidden {
    display: none;
}

.fullVersionModal {
    position: relative;
    width: min(400px, 100%);
    padding: 24px 20px 20px;
    border: 2px solid rgba(255, 255, 255, .82);
    border-radius: 24px;
    background: white;
    text-align: center;
    box-shadow: 0 18px 42px rgba(31, 53, 92, .28);
}

.fullVersionModal h3 {
    margin: 0 28px 10px;
    color: #385b7a;
    font-size: 24px;
}

.fullVersionModal p {
    margin: 0 0 18px;
    color: #5e7197;
    font-size: 16px;
    line-height: 1.45;
}

.fullVersionCloseButton {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #edf3ff;
    color: #4f5f8c;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.fullVersionConfirmButton {
    min-width: 140px;
    border: none;
    border-radius: 14px;
    padding: 11px 18px;
    background: #4dabf7;
    color: white;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.settingsModal {
    width: min(420px, 100%);
    border-radius: 24px;
    padding: 20px;
    background: white;
    box-shadow: 0 18px 40px rgba(31, 53, 92, .24);
}

.settingsModal h3 {
    margin-bottom: 8px;
    color: #385b7a;
    font-size: 22px;
}

.settingsDescription {
    margin-bottom: 16px;
    color: #5e7197;
    font-size: 14px;
}

.settingsActionButton,
.secondaryButton,
.dangerButton,
.closeSettingsButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.settingsActionButton,
.closeSettingsButton {
    width: 100%;
    margin-top: 8px;
    background: #4dabf7;
    color: white;
}

.soundToggleButton {
    margin-bottom: 8px;
}

.resetConfirmBlock {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(91, 141, 247, .18);
}

.resetConfirmBlock p {
    margin-bottom: 14px;
    color: #4f5f8c;
    font-size: 14px;
    line-height: 1.4;
}

.resetConfirmBlock.hidden {
    display: none;
}

.settingsActions {
    display: flex;
    gap: 10px;
}

.secondaryButton {
    flex: 1;
    background: #e9efff;
    color: #4f5f8c;
}

.dangerButton {
    flex: 1;
    background: #ff6b6b;
    color: white;
}

#lettersScreen.active {
    animation: lettersScreenReveal 280ms ease-out both;
}

#lettersScreen .header {
    width: min(760px, 100%);
    margin: 0 auto clamp(18px, 3vw, 28px);
}

#lettersScreen .header h2 {
    color: #385b7a;
    font-size: clamp(24px, 5vw, 34px);
}

@media (min-width: 721px) and (min-height: 680px) {
    #lettersScreen {
        overflow-y: hidden;
        padding: clamp(10px, 1.6vw, 20px);
    }

    #lettersScreen .header {
        margin-bottom: clamp(8px, 1.5vh, 14px);
    }

    .overallProgress {
        display: flex;
        align-items: center;
        gap: 12px;
        width: min(640px, 100%);
    }

    .overallProgressText {
        flex: 0 0 auto;
        margin: 0;
        text-align: left;
        white-space: nowrap;
        font-size: clamp(15px, 1.6vw, 18px);
    }

    .overallProgressTrack {
        flex: 1;
    }

    .lettersGrid {
        width: min(520px, 100%);
        gap: clamp(10px, 1.4vh, 12px) clamp(10px, 1.2vw, 12px);
        justify-items: center;
    }

    .letterCardWrapper,
    .letterCard {
        width: clamp(62px, min(9.2vh, 7vw), 78px);
        height: auto;
    }

    .letterCard {
        height: clamp(62px, min(9.2vh, 7vw), 78px);
        font-size: clamp(31px, 4.2vw, 40px);
    }

    .letterProgressRing {
        inset: -5px;
        -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 0);
        mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 0);
    }
}

@media (max-width: 720px) {
    .overallProgress {
        display: grid;
        gap: 6px;
    }

    .overallProgressText {
        margin: 0;
    }
}

#lettersScreen::-webkit-scrollbar {
    width: 10px;
}

#lettersScreen::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(91, 141, 247, .65);
    background-clip: padding-box;
}

@keyframes lettersScreenReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 380px) {
    .lettersGrid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
    }

    .letterCard {
        min-height: 70px;
        border-radius: 18px;
    }
}

.bigLetter {
    display: grid;
    place-items: center;
    width: clamp(118px, 16vw, 166px);
    height: clamp(118px, 16vw, 166px);
    margin: 10px auto 18px;
    border: 5px solid rgba(255, 255, 255, .8);
    border-radius: 38%;
    background: linear-gradient(145deg, #fff9fd, #f0eaff);
    box-shadow: 0 10px 22px rgba(111, 88, 167, .18);
    color: #f56f83;
    font-size: clamp(92px, 12vw, 132px);
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 3px 0 rgba(255, 255, 255, .8);
}

.letterImage {
    position: relative;
    width: min(760px, 94vw);
    height: clamp(220px, 44svh, 480px);
    margin: 0 auto 18px;
    border: 7px solid rgba(255, 255, 255, .88);
    border-radius: 30px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(229, 245, 255, .86));
    box-shadow: 0 18px 38px rgba(53, 103, 141, .22), 0 4px 10px rgba(89, 68, 143, .1);
}

.imageVisual,
.imagePlaceholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.imageVisual {
    opacity: 0;
    transform: scale(.985);
    transition: opacity 260ms ease, transform 260ms ease;
}

.imageVisual.is-visible {
    opacity: 1;
    transform: scale(1);
}

.imageVisual.is-leaving {
    opacity: 0;
    transform: scale(1.015);
    pointer-events: none;
}

.letterImage img {
    display: block;
    box-sizing: border-box;
    object-fit: contain;
    object-position: center;
    padding: 12px;
}

.imagePlaceholder {
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .75), transparent 32%),
        linear-gradient(135deg, #ffd7e4, #e3dcff 48%, #cceeff);
    color: #f56f83;
    font-size: clamp(130px, 28vw, 250px);
    font-weight: bold;
    text-shadow: 0 5px 0 rgba(255, 255, 255, .45), 0 12px 24px rgba(154, 109, 166, .24);
}

.imageLoadingIndicator {
    position: absolute;
    right: 22px;
    bottom: 22px;
    width: 42px;
    height: 42px;
    border: 4px solid rgba(255, 255, 255, .82);
    border-top-color: #6b8ff5;
    border-radius: 50%;
    background: rgba(255, 255, 255, .56);
    box-shadow: 0 5px 12px rgba(85, 80, 142, .14);
    animation: imageLoadingSpin .85s linear infinite;
    opacity: 1;
    transform: scale(1);
    transition: opacity 220ms ease, transform 220ms ease;
}

.imageLoadingIndicator.is-hidden {
    opacity: 0;
    transform: scale(.75);
}

@keyframes imageLoadingSpin {
    to {
        transform: rotate(360deg);
    }
}

.wordsBlock {
    margin: 0 auto;
    max-width: 620px;
}

.wordCard {
    margin: 0;
    padding: 14px 24px;
    border: 3px solid rgba(255, 255, 255, .78);
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff, #f7f0ff);
    color: #5a3c82;
    text-align: center;
    font-size: clamp(28px, 5vw, 38px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: .01em;
    text-shadow: 0 2px 0 white;
    box-shadow: 0 8px 18px rgba(86, 70, 133, .13);
}

.nextWordButton {
    display: block;
    width: min(360px, 100%);
    min-height: 56px;
    margin: 14px auto 0;
    padding: 12px 22px;
    border: 3px solid rgba(255, 255, 255, .88);
    border-radius: 20px;
    background: linear-gradient(135deg, #ff9f43, #ff7b54);
    color: white;
    font-size: clamp(20px, 3vw, 25px);
    font-weight: 800;
    line-height: 1.15;
    cursor: pointer;
    box-shadow: 0 9px 18px rgba(211, 103, 54, .25);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.nextWordButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(211, 103, 54, .32);
}

.nextWordButton:active {
    transform: translateY(1px);
}

.nextWordButton:focus-visible {
    outline: 4px solid rgba(255, 207, 51, .72);
    outline-offset: 3px;
}

#letterScreen {
    min-height: 100vh;
    max-height: 100svh;
    padding: clamp(12px, 2.5vw, 24px);
    overflow-y: auto;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 255, 255, .7), transparent 19%),
        radial-gradient(circle at 88% 22%, rgba(255, 233, 180, .48), transparent 23%);
}

.letterScreenLayout {
    display: grid;
    grid-template-columns: minmax(0, 760px) minmax(210px, 260px);
    align-items: start;
    justify-content: center;
    gap: clamp(18px, 3vw, 34px);
    width: min(1060px, 100%);
    margin: 0 auto;
}

.letterContent {
    min-width: 0;
}

.letterContent .letterImage {
    width: 100%;
}

.gameChoicePanel {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border: 4px solid rgba(255, 255, 255, .72);
    border-radius: 26px;
    background: rgba(255, 255, 255, .5);
    box-shadow: 0 14px 28px rgba(69, 101, 152, .16);
}

.gameChoiceButton {
    width: 100%;
    min-height: 66px;
    padding: 12px 14px;
    border: 3px solid rgba(255, 255, 255, .86);
    border-radius: 18px;
    background: linear-gradient(135deg, #6bbcff, #5b8df7);
    color: white;
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 800;
    line-height: 1.15;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(60, 121, 208, .22);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.gameChoiceButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 11px 20px rgba(60, 121, 208, .3);
}

.gameChoiceButton.is-active {
    border-color: #ffcf33;
    background: linear-gradient(135deg, #9b7bea, #7b82ed);
    box-shadow: 0 0 0 4px rgba(255, 207, 51, .24), 0 11px 22px rgba(91, 92, 190, .28);
    transform: scale(1.025);
}

#letterScreen .header {
    width: min(760px, 100%);
    margin: 0 auto 4px;
    gap: 14px;
}

#letterScreen .header h2 {
    flex: 1;
    color: #385b7a;
    font-size: clamp(20px, 4vw, 28px);
    text-align: center;
}

#letterScreen .backButton,
#letterScreen .playButton {
    width: min(200px, 43vw);
    height: 58px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #6bbcff, #5b8df7);
    color: white;
    box-shadow: 0 8px 16px rgba(60, 121, 208, .25);
    font-size: clamp(19px, 4vw, 23px);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

#letterScreen .playButton {
    display: block;
    margin: 16px auto 0;
}

#letterScreen .connectGameButton {
    margin-top: 10px;
    background: linear-gradient(135deg, #9b7bea, #7b82ed);
}

#letterScreen .backButton:hover,
#letterScreen .playButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 11px 20px rgba(60, 121, 208, .3);
}

#letterScreen .backButton:active,
#letterScreen .playButton:active {
    transform: translateY(1px);
}

@media (min-width: 901px) and (max-height: 800px) {
    .bigLetter {
        width: 132px;
        height: 132px;
        margin-top: 4px;
        margin-bottom: 12px;
        font-size: 104px;
    }

    .letterImage {
        height: min(39svh, 300px);
        margin-bottom: 12px;
    }

    .wordCard {
        padding-block: 10px;
    }

    .nextWordButton {
        margin-top: 10px;
    }
}

@media (max-width: 520px) {
    #letterScreen .header {
        gap: 8px;
    }

    #letterScreen .backButton,
    #letterScreen .playButton {
        width: min(156px, 43vw);
        height: 52px;
        border-radius: 16px;
    }

    .bigLetter {
        margin-bottom: 14px;
    }

    .letterImage {
        height: clamp(190px, 35svh, 300px);
        border-width: 5px;
        border-radius: 24px;
    }

    .wordCard {
        padding: 12px 18px;
    }

    .nextWordButton {
        min-height: 52px;
        margin-top: 10px;
        border-radius: 18px;
    }
}

@media (max-width: 520px) and (max-height: 620px) {
    .bigLetter {
        width: 100px;
        height: 100px;
        margin-top: 4px;
        margin-bottom: 10px;
        font-size: 78px;
    }

    .letterImage {
        height: 190px;
    }

    #letterScreen .playButton {
        margin-top: 10px;
    }
}

.gameTitle {
    text-align: center;
    font-size: clamp(24px, 3.5vw, 32px);
    margin: 6px 0 12px;
    color: #385b7a;
    font-weight: 700;
}

#gameScreen {
    max-height: 100svh;
    overflow-y: auto;
}

.gameScreenTitle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0;
    text-align: center;
    color: #385b7a;
    font-size: clamp(22px, 4vw, 32px);
}

.target-letter {
    display: inline-flex;
    align-items: center;
    margin: 0 .12em;
    color: #f04f6c;
    font-size: 1.14em;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .92), 0 5px 12px rgba(247, 80, 107, .24);
}

.gameScreenTitleLetter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ff4d4d;
    font-size: clamp(40px, 7vw, 64px);
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .92), 0 8px 18px rgba(247, 80, 107, .3);
}

.targetLetter {
    color: #ff4d4d;
    font-size: 48px;
    font-weight: bold;
}

.findObjectCards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(8px, 1.7vw, 14px);
    width: min(720px, 100%);
    margin: 0 auto;
    align-content: start;
}

.findObjectCards.hidden,
.connectLineBoard.hidden,
.sorterBoard.hidden,
.busBoard.hidden {
    display: none;
}

.connectLineBoard {
    position: relative;
    display: grid;
    grid-template-columns: minmax(76px, 1fr) clamp(72px, 12vw, 120px) minmax(76px, 1fr);
    gap: clamp(20px, 5vw, 54px);
    align-items: center;
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 4px clamp(4px, 2vw, 16px);
    touch-action: none;
}

.connectColumn {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-rows: repeat(4, minmax(76px, 1fr));
    gap: clamp(8px, 1.5vh, 14px);
}

.connectLeftImages {
    grid-column: 1;
}

.connectRightImages {
    grid-column: 3;
}

.connectCenterLetter {
    position: relative;
    z-index: 3;
    grid-column: 2;
    grid-row: 1;
    display: grid;
    place-items: center;
    width: clamp(72px, 12vw, 120px);
    aspect-ratio: 1;
    border: 5px solid rgba(255, 255, 255, .9);
    border-radius: 38%;
    background: linear-gradient(145deg, #fff9fd, #f0eaff);
    color: #f56f83;
    font-size: clamp(58px, 10vw, 92px);
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 12px 24px rgba(111, 88, 167, .22);
    cursor: grab;
    touch-action: none;
    transition: transform 180ms ease, border-color 180ms ease;
}

.connectLines {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.connectLine {
    stroke: #7b82ed;
    stroke-width: 8;
    stroke-linecap: round;
    filter: drop-shadow(0 3px 3px rgba(69, 101, 152, .22));
}

.connectLine.is-drawing {
    stroke: #ffb703;
    stroke-dasharray: 12 8;
}

.connectLine.is-wrong {
    animation: connectLineDisappear 280ms ease-out forwards;
}

.connectLetterCard,
.connectImageCard {
    min-height: 76px;
    border: 3px solid rgba(255, 255, 255, .88);
    border-radius: 22px;
    background: linear-gradient(145deg, #ffffff, #eef7ff);
    box-shadow: 0 8px 18px rgba(69, 101, 152, .16);
    cursor: pointer;
    touch-action: none;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.connectLetterCard {
    color: #f56f83;
    font-size: clamp(38px, 7vw, 58px);
    font-weight: 900;
}

.connectImageCard {
    padding: 6px;
}

.connectImageCard img {
    display: block;
    width: 100%;
    height: clamp(64px, 12vh, 104px);
    object-fit: contain;
    pointer-events: none;
}

.connectCenterLetter.is-connecting {
    transform: scale(1.06);
    border-color: #ffb703;
    cursor: grabbing;
}

.connectImageCard.is-matched {
    border-color: #51cf66;
    box-shadow: 0 0 0 4px rgba(81, 207, 102, .2), 0 8px 18px rgba(47, 179, 95, .18);
}

@keyframes connectLineDisappear {
    to {
        opacity: 0;
        stroke: #ff6b6b;
        stroke-dashoffset: 24;
    }
}

.sorterBoard {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 3vw, 30px);
    border: 5px solid rgba(255, 255, 255, .78);
    border-radius: 30px;
    background: linear-gradient(145deg, rgba(255, 255, 255, .8), rgba(226, 241, 255, .76));
    box-shadow: 0 16px 32px rgba(69, 101, 152, .16);
    touch-action: none;
}

.sorterShadows {
    display: grid;
    gap: clamp(14px, 2.5vh, 24px);
}

.sorterShadowRow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(8px, 1.6vw, 14px);
}

.sorterShadow {
    display: grid;
    place-items: center;
    min-height: clamp(84px, 13vw, 116px);
    border: 3px dashed rgba(96, 113, 145, .42);
    border-radius: 22px;
    background: rgba(218, 226, 239, .58);
    color: #aeb8ca;
    font-size: clamp(52px, 8vw, 82px);
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    text-shadow: 0 4px 0 rgba(255, 255, 255, .68);
    transition: transform 180ms ease, color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.sorterShadow.is-matched {
    border-style: solid;
    border-color: #51cf66;
    background: linear-gradient(145deg, #f1fff4, #d6f7dd);
    color: #f56f83;
    animation: sorterMatch 420ms ease-out;
}

.sorterShadow.is-wrong {
    animation: objectCardShake 180ms ease-in-out 3;
}

.sorterDragZone {
    display: grid;
    place-items: center;
    min-height: clamp(150px, 20vh, 184px);
    border-radius: 26px;
    background: rgba(255, 255, 255, .45);
}

.sorterLetter {
    display: grid;
    place-items: center;
    width: clamp(132px, 18vw, 170px);
    aspect-ratio: 1;
    border: 5px solid rgba(255, 255, 255, .92);
    border-radius: 38%;
    background: linear-gradient(145deg, #fff9fd, #f0eaff);
    color: #f56f83;
    font-size: clamp(96px, 13vw, 132px);
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 14px 28px rgba(111, 88, 167, .24);
    cursor: grab;
    touch-action: none;
    transition: transform 220ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.sorterLetter.is-dragging {
    z-index: 8;
    cursor: grabbing;
    box-shadow: 0 20px 36px rgba(111, 88, 167, .32);
    transition: none;
}

.sorterLetter.is-complete {
    opacity: 0;
    pointer-events: none;
}

@keyframes sorterMatch {
    0% { transform: scale(.84); }
    55% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.busBoard {
    position: relative;
    width: min(820px, 100%);
    aspect-ratio: 1000 / 520;
    min-height: 320px;
    margin: 0 auto;
    overflow: hidden;
    border: 6px solid rgba(255, 255, 255, .84);
    border-radius: 32px;
    background:
        radial-gradient(circle at 18% 20%, rgba(255, 255, 255, .72), transparent 22%),
        linear-gradient(180deg, #bfe8ff 0 46%, #a8e49a 46% 100%);
    box-shadow: 0 18px 38px rgba(53, 103, 141, .2);
    touch-action: none;
}

.busRoadSvg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.busRoadPath,
.busRoadDashes,
.busRoadHitArea {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.busRoadPath {
    stroke: #66717d;
    stroke-width: 62;
    filter: drop-shadow(0 7px 5px rgba(52, 67, 81, .22));
}

.busRoadDashes {
    stroke: rgba(255, 255, 255, .9);
    stroke-width: 8;
    stroke-dasharray: 28 24;
}

.busRoadHitArea {
    stroke: transparent;
    stroke-width: 118;
    pointer-events: none;
}

.busDestinations {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.busVehicle,
.busStartMarker,
.busDestination {
    position: absolute;
    transform: translate(-50%, -50%);
}

.busVehicle {
    z-index: 6;
    display: grid;
    place-items: center;
    width: clamp(64px, 10vw, 86px);
    aspect-ratio: 1;
    border: 4px solid white;
    border-radius: 24px;
    background: linear-gradient(145deg, #ffe56a, #ffb703);
    box-shadow: 0 10px 20px rgba(89, 68, 32, .28);
    font-size: clamp(38px, 6vw, 56px);
    cursor: grab;
    touch-action: none;
    transition: left 80ms linear, top 80ms linear, transform 180ms ease, box-shadow 180ms ease;
}

.busVehicle.is-driving {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 14px 24px rgba(89, 68, 32, .34);
}

.busVehicle.needs-more-road {
    animation: busNudge 520ms ease;
}

.busVehicle.is-arrived {
    animation: busArrive 520ms ease-out;
}

.busVehicle.is-returning {
    transition: left 300ms ease, top 300ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.busStartMarker {
    z-index: 3;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .9);
    color: #4f5f8c;
    font-size: clamp(12px, 2vw, 16px);
    font-weight: 800;
    pointer-events: none;
}

.busDestination {
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: clamp(102px, 16vw, 138px);
    padding: 7px;
    border: 4px solid white;
    border-radius: 20px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 22px rgba(69, 101, 152, .24);
    color: #4f5f8c;
    font-size: clamp(13px, 2.2vw, 18px);
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
    pointer-events: none;
    transition: border-color 180ms ease, transform 180ms ease;
}

.busDestination img {
    width: 100%;
    height: clamp(68px, 11vw, 94px);
    object-fit: contain;
}

.busDestinationLabel {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.busDestination.is-reached {
    border-color: #51cf66;
    transform: translate(-50%, -50%) scale(1.06);
}

.busDestination.is-wrong {
    border-color: #ff6b6b;
    animation: objectCardShake 180ms ease-in-out 3;
}

@keyframes busNudge {
    0%, 100% { transform: translate(-50%, -50%); }
    35% { transform: translate(-58%, -50%) rotate(-4deg); }
    70% { transform: translate(-42%, -50%) rotate(4deg); }
}

@keyframes busArrive {
    0% { transform: translate(-50%, -50%) scale(.9); }
    55% { transform: translate(-50%, -50%) scale(1.18) rotate(5deg); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.findObjectCard {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: clamp(150px, 22svh, 210px);
    padding: clamp(10px, 1.5vw, 14px);
    border: 3px solid rgba(255, 255, 255, .88);
    border-radius: 22px;
    background: linear-gradient(145deg, #ffffff, #eef7ff);
    color: #4f5f8c;
    box-shadow: 0 12px 24px rgba(69, 101, 152, .16);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.findObjectCard:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 14px 26px rgba(69, 101, 152, .2);
}

.findObjectCard img {
    width: clamp(78px, 14vw, 118px);
    height: clamp(78px, 14vw, 118px);
    object-fit: contain;
    border-radius: 16px;
    pointer-events: none;
}

.findObjectCard .cardLabel {
    text-align: center;
    font-size: clamp(16px, 2.8vw, 22px);
    font-weight: 800;
    line-height: 1.15;
}

.findObjectCard.specialWordCard,
.connectImageCard.specialWordCard {
    background: linear-gradient(145deg, #ffffff, #f7f0ff);
    color: #4f5f8c;
}

.findObjectCard.specialWordCard {
    min-height: clamp(130px, 20svh, 190px);
}

.findObjectCard.specialWordCard .cardLabel,
.connectWordLabel {
    font-size: clamp(22px, 4vw, 34px);
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.connectWordLabel {
    display: block;
    text-align: center;
}

/* Only the text-only Ъ/Ь/Ы cards in Find Words and Connect Words. */
.findObjectCard.specialTextFitCard .specialTextFitLabel {
    width: 100%;
    max-width: 100%;
    font-size: clamp(16px, 3vw, 25px);
    line-height: 1.08;
    text-align: center;
    overflow-wrap: anywhere;
}

.connectImageCard.specialTextFitCard .specialTextFitLabel {
    width: 100%;
    max-width: 100%;
    font-size: clamp(15px, 2.4vw, 20px);
    line-height: 1.08;
    text-align: center;
    overflow-wrap: anywhere;
}

.findObjectCard.specialTextFitCard .specialTextSingleLine {
    font-size: clamp(15px, 2.6vw, 22px);
}

.specialTextFitCard .specialTextSingleLine {
    white-space: nowrap;
    overflow-wrap: normal;
}

.specialWordHighlight {
    color: #f04f6c;
    font-size: 1.12em;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .9);
}

.findObjectCard.is-correct {
    background: linear-gradient(145deg, #f1fff4, #d6f7dd);
    border-color: #2fb35f;
    box-shadow: 0 0 0 4px rgba(47, 179, 95, .22), 0 14px 28px rgba(47, 179, 95, .24);
    animation: objectCardCelebrate 280ms ease-out;
}

.findObjectCard.is-wrong {
    animation: objectCardShake 180ms ease-in-out 3;
}

.findObjectCard.is-disabled {
    cursor: default;
}

.findObjectCard.is-hidden {
    visibility: hidden;
}

.toLettersButton {
    display: block;
    width: min(320px, 84vw);
    margin: 16px auto 0;
    padding: 16px 22px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #6bbcff, #5b8df7);
    color: white;
    font-size: clamp(24px, 4vw, 28px);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(60, 121, 208, .24);
}

.toLettersButton.hidden,
.balloons.hidden,
.repeatRoundButton.hidden {
    display: none;
}

#confetti {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 20;
}

.findObjectCelebration {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 30;
    width: min(92vw, 720px);
    padding: 20px 24px;
    border-radius: 24px;
    text-align: center;
    font-size: clamp(48px, 11vw, 96px);
    font-weight: 900;
    line-height: 1.05;
    background: linear-gradient(90deg, #ff6b6b, #ffb703, #51cf66, #4dabf7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-stroke: 2px white;
    text-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
}

.findObjectCelebration.hidden {
    display: none;
}

.confettiPiece {
    position: absolute;
    top: -10%;
    width: 10px;
    height: 16px;
    border-radius: 2px;
    opacity: 0;
}

@keyframes objectCardShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

@keyframes objectCardCelebrate {
    0% { transform: scale(1); }
    45% { transform: scale(1.08); }
    100% { transform: scale(1.02); }
}

@keyframes confettiFall {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 120px, 0) rotate(360deg) scale(0.85);
        opacity: 0;
    }
}

@keyframes findObjectCelebrationReveal {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.55);
    }
    18% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.12);
    }
    42% {
        transform: translate(-50%, -50%) scale(0.98);
    }
    68% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.04);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

.balloons {
    position: relative;
    width: 100%;
    height: 65vh;
    overflow: hidden;
}

.balloon {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 42px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,.2);
    transition: transform .2s;
}

.balloon:hover {
    transform: scale(1.08);
}

@media (max-width: 720px) {
    .findObjectCard {
        min-height: 220px;
    }
}

@media (max-width: 900px) {
    .letterScreenLayout {
        grid-template-columns: minmax(0, 760px);
    }

    .gameChoicePanel {
        position: static;
        width: min(760px, 100%);
        margin: 0 auto 20px;
    }
}

@media (max-width: 520px) {
    .findObjectCard {
        min-height: 190px;
        padding: 12px;
    }

    .findObjectCard img {
        width: 112px;
        height: 112px;
    }

    .connectLineBoard {
        grid-template-columns: minmax(68px, 1fr) clamp(62px, 18vw, 82px) minmax(68px, 1fr);
        gap: clamp(8px, 3vw, 18px);
    }

    .connectColumn {
        grid-template-rows: repeat(4, minmax(68px, 1fr));
        gap: 7px;
    }

    .connectLetterCard,
    .connectImageCard {
        min-height: 68px;
        border-radius: 18px;
    }

    .connectImageCard img {
        height: clamp(56px, 10vh, 82px);
    }

    .connectLine {
        stroke-width: 6;
    }

    .connectCenterLetter {
        width: clamp(62px, 18vw, 82px);
        border-width: 4px;
        font-size: clamp(48px, 15vw, 66px);
    }

    .gameChoicePanel {
        padding: 12px;
        border-radius: 22px;
    }

    .gameChoiceButton {
        min-height: 58px;
    }
}

@media (max-width: 900px) {
    .gameChoicePanel {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .sorterBoard {
        gap: 20px;
        padding: 14px;
    }

    .sorterShadows {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .sorterShadowRow {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }

    .sorterShadow {
        min-height: clamp(68px, 18vw, 84px);
        border-radius: 18px;
        font-size: clamp(42px, 11vw, 58px);
    }

    .sorterDragZone {
        min-height: 126px;
    }

    .sorterLetter {
        width: clamp(118px, 34vw, 136px);
        font-size: clamp(84px, 22vw, 106px);
    }

    .busBoard {
        min-height: 300px;
    }

    .busDestination {
        width: clamp(76px, 22vw, 96px);
        padding: 4px;
        border-width: 3px;
        border-radius: 16px;
        font-size: 11px;
    }

    .busDestination img {
        height: clamp(44px, 12vw, 58px);
    }

    .gameChoicePanel {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 320px) and (max-width: 430px) {
    #lettersScreen {
        --letter-cell-size: clamp(58px, min(17vw, 10.5vh), 66px);
        height: 100svh;
        min-height: 100svh;
        padding: 5px 1px;
        overflow-x: hidden;
        overflow-y: hidden;
    }

    #lettersScreen .header {
        position: static;
        min-height: 44px;
        margin-bottom: 4px;
        padding-bottom: 0;
        gap: 8px;
        background: transparent;
        backdrop-filter: none;
    }

    #lettersScreen .header h2 {
        font-size: clamp(20px, 6vw, 24px);
    }

    #lettersScreen .backButton,
    #lettersScreen .settingsButton {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
    }

    #lettersScreen .overallProgress {
        gap: 4px;
        margin-bottom: 5px;
        padding: 4px 8px;
        border-radius: 12px;
    }

    #lettersScreen .overallProgressText {
        font-size: 14px;
    }

    #lettersScreen .overallProgressTrack {
        height: 8px;
        border-width: 2px;
    }

    #lettersScreen .demoNotice {
        margin: -2px auto 3px;
        font-size: 11px;
        line-height: 1;
    }

    #lettersScreen .lettersGrid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: min(100%, 374px);
        gap: clamp(2px, .8vw, 4px);
        justify-items: center;
    }

    #lettersScreen .letterCardWrapper,
    #lettersScreen .letterCard {
        width: var(--letter-cell-size);
        height: var(--letter-cell-size);
        min-height: 0;
        border-radius: 50%;
    }

    #lettersScreen .letterCard {
        font-size: clamp(31px, 9vw, 38px);
    }

    #lettersScreen .letterProgressRing {
        inset: -1px;
        -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
        mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 0);
    }

    #lettersScreen .letterLock {
        right: 0;
        bottom: 0;
        width: 18px;
        height: 18px;
        border-width: 1px;
        font-size: 9px;
    }

    #lettersScreen .letterCardWrapper:nth-last-child(3) {
        grid-column: 2;
    }

    .sorterDragZone {
        min-height: clamp(94px, 27vw, 112px);
    }

    .sorterLetter {
        width: clamp(76px, 22vw, 92px);
        font-size: clamp(56px, 16vw, 70px);
    }

    .balloon {
        width: clamp(58px, 18vw, 76px);
        height: clamp(58px, 18vw, 76px);
        font-size: clamp(31px, 10vw, 40px);
    }

    .balloons {
        height: min(65vh, 580px);
    }

    #letterScreen .gameChoicePanel {
        gap: 8px;
        margin-bottom: 12px;
        padding: 9px;
    }
}

@media (min-width: 521px) {
    .busDestinations {
        inset: 14px 14px 14px auto;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 12px;
        width: 118px;
    }

    .busDestination {
        position: relative;
        top: auto !important;
        left: auto !important;
        width: 118px;
        padding: 6px;
        transform: none;
    }

    .busDestination img {
        height: 70px;
    }

    .busDestination.is-reached {
        transform: scale(1.04);
    }
}
