#objects {
    height: clamp(20dvh, 70vw, 40dvh);
}

.word-layout,
.word-visual,
.word-puzzle {
    display: contents;
}

.reading-layout {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(20px, 4dvh, 42px);
    width: min(94vw, 720px);
    padding-top: clamp(30px, 6dvh, 72px);
    box-sizing: border-box;
}

.reading-word-area {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto !important;
    min-height: clamp(104px, 17dvh, 180px);
    margin: 0 !important;
}

.reading-word-area .word {
    margin: 0;
    line-height: 0.95;
}

.reading-answers {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(86vw, 640px);
    height: auto;
    gap: clamp(10px, 2.2vw, 18px);
}

.word-actions {
    display: flex;
    justify-content: center;
    width: min(92vw, 420px);
    margin-top: 8px;
    height: auto;
}

.object {
    width: clamp(128px, 24vh, 512px);
    height: clamp(128px, 24vh, 512px);

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;
    border: 2px solid var(--surface-border);
    background: var(--surface);
    box-shadow: var(--shadow-soft);

    transition: transform 0.2s, box-shadow 0.2s;
}

.object span {
    font-size: 70%;
}

#objects span {
    font-size: clamp(1rem, 20dvh, 8rem);
    animation: bounce 0.6s ease;
    color: var(--text-main);
    font-weight: bold;
}

.answers .object {
    width: clamp(100px, 35dvw, 200px);
    height: clamp(100px, 35dvw, 200px);
}

.reading-answers .object {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-width: none;
}

.answers span {
    font-size: clamp(2rem, 10dvw, 8rem);
    animation: bounce 0.6s ease;
    height: fit-content;
}

.object img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    animation: bounce 0.6s ease;
}

#syllables{
    display:flex;
    flex-direction: column;
    justify-content:center;
    align-items:center;
    gap:8px;
    min-height:12dvh;
    width: min(98%, 920px);
}

.syllable-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding: 2px;
}

.placeholder{
    height: 10dvh;
    width: 20%;
}

#dropzone{
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content:center;
    gap:8px;
    margin-top: 6px;
    min-height:10dvh;
    width: min(98%, 920px);
}

#syllables.sentence-mode,
#dropzone.sentence-mode {
    gap: 10px;
    min-height: 9dvh;
}

#syllables.sentence-mode .syllable-row,
#dropzone.sentence-mode .slot-row {
    flex-wrap: wrap;
    overflow-x: visible;
}

#syllables.sentence-mode .syllable,
#dropzone.sentence-mode .slot {
    flex: 0 1 clamp(104px, 20vw, 180px);
    max-width: 210px;
    height: clamp(50px, 8dvh, 76px);
}

#syllables.sentence-mode .syllable {
    font-size: clamp(20px, 4vw, 34px);
}

.slot-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding: 2px;
}

.slot{
    box-sizing: border-box;
    flex: 0 0 clamp(58px, 14vw, 128px);
    max-width: 140px;
    height: clamp(52px, 9dvh, 92px);
    border:3px dashed var(--sun);
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:rgba(255, 255, 255, 0.62);
    color: var(--text-main);
}

.slot .syllable{
    position:static !important;
    transform:none !important;
    width: 99%;
    height: 99%;
}

.word {
    font-size: clamp(3rem, 15vw, 8rem);
    margin: 0.5em 0;
    color: var(--text-main);
    font-weight: bold;
}

.images img{
    width:150px;
    margin:20px;
    cursor:pointer;
}

.object:hover,
.object:active{
    transform: scale(1.15);
    box-shadow: var(--shadow-lift);
}

.word-actions button{
    width: min(100%, 340px);
    height: auto;
    min-height: clamp(62px, 9dvh, 86px);
    padding: 0.45em 0.9em;
    box-sizing: border-box;
    white-space: nowrap;
    font-size: clamp(1.55rem, 6vw, 2.5rem);
}

.syllable {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sun);
    font-size: clamp(16px, 3vw, 36px);
    border-radius: 8px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    flex: 1 1 clamp(58px, 14vw, 128px);
    max-width: 140px;
    height: clamp(50px, 8dvh, 88px);
    color: var(--text-main);
    font-weight: bold;
}

/* прыжок при hover / touch */
.syllable:hover {
    transform: translateY(-10%) scale(1.05) rotateZ(5deg);
    box-shadow: var(--shadow-lift);
    background: #ffef8a;
}

/* правильное место — легкое свечение */
.syllable.correct {
    animation: glow 1s ease-in-out infinite alternate;
}

.syllable:hover,
.syllable:active{
    cursor:grabbing;
}

@keyframes glow {
    0% { box-shadow: 0 0 8px #ffd700, 0 0 12px #ffea00; }
    100% { box-shadow: 0 0 14px #fffa00, 0 0 20px #fff700; }
}

/* неправильное — трясется */
.syllable.wrong {
    animation: shake 0.3s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5%); }
    50% { transform: translateX(5%); }
    75% { transform: translateX(-5%); }
    100% { transform: translateX(0); }
}

@media (hover: none) {
    .syllable:hover,
    span:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (max-width: 430px) and (orientation: portrait) {
    .reading-layout {
        width: min(94vw, 390px);
        gap: clamp(14px, 3dvh, 28px);
        padding-top: clamp(20px, 4dvh, 38px);
    }

    .reading-answers {
        width: min(86vw, 340px);
        gap: clamp(8px, 3vw, 12px);
    }

    .reading-word-area {
        min-height: clamp(82px, 14dvh, 130px);
    }

    .reading-word-area .word {
        font-size: clamp(3.6rem, 16vw, 5.8rem);
    }

    #objects {
        height: clamp(132px, 28dvh, 210px);
        margin: 0.5em 0;
    }

    .object {
        width: clamp(132px, 48vw, 200px);
        height: clamp(132px, 48vw, 200px);
    }

    #syllables,
    #dropzone {
        width: min(100%, 390px);
        gap: 5px;
    }

    .syllable-row,
    .slot-row {
        justify-content: center;
        gap: 5px;
        width: 100%;
    }

    .syllable,
    .slot {
        flex-basis: clamp(40px, 12vw, 64px);
        max-width: 72px;
        height: clamp(42px, 7dvh, 56px);
    }

    .syllable {
        font-size: clamp(16px, 5vw, 22px);
    }

    #syllables.sentence-mode .syllable,
    #dropzone.sentence-mode .slot {
        flex-basis: clamp(92px, 40vw, 150px);
        max-width: 160px;
        height: clamp(46px, 7dvh, 58px);
    }

    #syllables.sentence-mode .syllable {
        font-size: clamp(18px, 6vw, 24px);
    }

    .word-actions {
        height: auto;
        margin: 0.6em 0;
        display: flex;
        width: min(92vw, 340px);
    }

    .word-actions button {
        height: auto;
        width: 100%;
        min-height: 54px;
        padding: 0.45em 0.9em;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .reading-layout {
        display: grid;
        grid-template-columns: minmax(180px, 0.55fr) minmax(360px, 1.45fr);
        align-items: center;
        width: min(92vw, 980px);
        gap: clamp(16px, 4vw, 42px);
        padding-top: 0;
    }

    .reading-word-area {
        min-height: 0;
    }

    .reading-answers {
        width: min(58vw, 520px);
    }

    .word-layout {
        display: grid;
        grid-template-columns: minmax(180px, 0.7fr) minmax(360px, 1.3fr);
        grid-template-areas:
            "visual puzzle"
            "actions puzzle";
        align-items: center;
        gap: clamp(16px, 4vw, 42px);
        width: min(92vw, 980px);
        flex: 1;
    }

    .word-visual,
    .word-puzzle,
    .word-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .word-visual {
        grid-area: visual;
        gap: 10px;
    }

    .word-puzzle {
        grid-area: puzzle;
        gap: 10px;
    }

    .word-actions {
        grid-area: actions;
        margin: 0;
        width: 100%;
    }

    #objects {
        height: auto;
        margin: 0;
    }

    .object {
        width: clamp(112px, 30dvh, 160px);
        height: clamp(112px, 30dvh, 160px);
    }

    #syllables {
        min-height: 13dvh;
        gap: 10px;
        width: 100%;
    }

    .syllable-row {
        gap: 10px;
    }

    #dropzone {
        min-height: 13dvh;
        gap: 10px;
        width: 100%;
    }

    .slot-row {
        gap: 10px;
    }

    .slot {
        flex: 0 0 clamp(54px, 7vw, 88px);
        max-width: 96px;
        height: clamp(44px, 11dvh, 58px);
    }

    .syllable {
        flex: 0 0 clamp(54px, 7vw, 88px);
        max-width: 96px;
        height: clamp(44px, 11dvh, 58px);
        font-size: clamp(20px, 6dvh, 30px);
    }

    #syllables.sentence-mode .syllable,
    #dropzone.sentence-mode .slot {
        flex-basis: clamp(96px, 14vw, 140px);
        max-width: 150px;
        height: clamp(42px, 12dvh, 58px);
    }

    #syllables.sentence-mode .syllable {
        font-size: clamp(18px, 6dvh, 28px);
    }

    .word-actions button {
        height: auto;
        margin-top: 0;
    }
}
