/* Shared opening and gameplay skin. Keep the existing scene and device layouts. */
#TEgame { container-type: inline-size; background-color: #86c5e1 !important; }
.stairs-desktop #fullScreenContainer { position: relative; }

/* Native fullscreen styles apply before the fullscreenchange event reaches JS. */
#fullScreenContainer:fullscreen { background: #eaf8ff; }
#fullScreenContainer:-webkit-full-screen { background: #eaf8ff; }
#fullScreenContainer::backdrop { background: #eaf8ff; }
#fullScreenContainer::-webkit-backdrop { background: #eaf8ff; }
#stairsDisplayTransition:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 4500;
    display: grid;
    place-items: center;
    background: radial-gradient(ellipse at top, #fff, #d9f2fc);
    pointer-events: none;
}
#stairsDisplayTransition > span {
    width: 44px;
    height: 44px;
    border: 5px solid #bce5f3;
    border-top-color: #168eb8;
    border-radius: 50%;
    box-shadow: 0 0 0 14px #ffffffb3;
    animation: stairsDisplaySpin 0.8s linear infinite;
}
#stairsDisplayTransition[data-initial-loading] { pointer-events: auto; }
@keyframes stairsDisplaySpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    #stairsDisplayTransition > span { animation: none; }
}

#TEgame #UIContainer .stairsOpeningMenu {
    background: linear-gradient(145deg, #f5fdff 0%, #e2f4fc 100%);
    color: #174963;
}

.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu {
    inset: 35% 22% 3%;
    width: auto;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65em;
    padding: 1em 1.2em;
    border: 2px solid #a4deee;
    border-radius: 1.2em;
    box-shadow: 0 8px 24px #16394c55, inset 0 1px #fff;
    font-size: 1.85cqw;
}

#TEgame #UIContainer .stairsOpeningMenu h1 {
    color: #174963;
    text-shadow: none;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu h1 {
    margin: 0 0 0.15em !important;
    font: 800 1.35em/1.15 "Assistant", Arial, sans-serif !important;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu .levels {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    flex: 1;
    min-height: 0;
    gap: 0.5em;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}
#TEgame #UIContainer .stairsOpeningMenu .levels li { margin: 0; min-height: 0; }
#TEgame #UIContainer .stairsOpeningMenu .levels label.roww {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.6em;
    height: 100%;
    margin: 0;
    border: 2px solid #bddeea;
    border-radius: 0.8em;
    background: #ffffff;
    box-shadow: 0 3px 0 #c6e3ed;
    box-sizing: border-box;
    transition: border-color 150ms, background 150ms, box-shadow 150ms;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu .levels label.roww {
    padding: 0.35em 0.7em;
    flex-direction: row;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu .levels.rtl label.roww { flex-direction: row-reverse; }
#TEgame #UIContainer .stairsOpeningMenu .levels label.roww:has(:checked) {
    background: linear-gradient(110deg, #fff9de, #ffedaa);
    border-color: #e4b73e;
    box-shadow: 0 3px 0 #d4a632, inset 0 1px #fffdf0;
}
#TEgame #UIContainer .stairsOpeningMenu .levels .text {
    display: flex;
    align-items: center;
    gap: 0.65em;
    flex: 1;
    color: #174963;
    letter-spacing: 0;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu .levels .text {
    font: 800 1.15em/1.15 "Assistant", Arial, sans-serif;
}
#TEgame #UIContainer .stairsOpeningMenu .levels.rtl .text { direction: rtl; }
.stairsLevelSteps {
    display: inline-flex;
    align-items: end;
    justify-content: center;
    gap: 3px;
    flex: 0 0 1.9em;
    height: 1.7em;
    padding: 0.25em;
    border-radius: 0.4em;
    background: #edf7fc;
    direction: ltr;
}
.stairsLevelSteps i { width: 0.32em; background: #c9dfe9; border-radius: 2px 2px 0 0; }
.stairsLevelSteps i:nth-child(1) { height: 40%; background: #2699c1; }
.stairsLevelSteps i:nth-child(2) { height: 70%; }
.stairsLevelSteps i:nth-child(3) { height: 100%; }
.stairsLevelSteps[data-steps="2"] i:nth-child(2),
.stairsLevelSteps[data-steps="3"] i { background: #2699c1; }
#TEgame #UIContainer .stairsOpeningMenu .levels .mark {
    order: 2;
    flex: 0 0 1.25em;
    width: 1.25em;
    height: 1.25em;
    border: 2px solid #b6d3e0;
    background: #f1f8fb;
    box-shadow: none;
    padding: 0;
}
#TEgame #UIContainer .stairsOpeningMenu .mark::before,
#TEgame #UIContainer .stairsOpeningMenu .mark::after { display: none; }
#TEgame #UIContainer .stairsOpeningMenu .radio:checked + .text + .mark {
    border-color: #257a97;
    background: #257a97;
    box-shadow: inset 0 0 0 3px #fff4c5;
}
#TEgame #UIContainer .stairsOpeningMenu #startButton {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    flex-shrink: 0;
    border: 1px solid #08769b;
    border-radius: 0.65em;
    background: linear-gradient(#2ba8cf, #1383ad);
    box-shadow: 0 4px 0 #0d597c, inset 0 1px 0 #83d8ed;
    color: #fff;
    text-shadow: 0 1px 2px #07516c;
    letter-spacing: 0;
    cursor: pointer;
    touch-action: manipulation;
}
.stairs-desktop #TEgame #UIContainer .stairsOpeningMenu #startButton {
    width: 100%;
    min-height: 0;
    margin: 0.15em 0 0.1em;
    padding: 0.35em;
    font: 800 1.5em/1.15 "Assistant", Arial, sans-serif;
}
.stairsPlayIcon {
    display: grid;
    place-items: center;
    width: 1.5em;
    height: 1.5em;
    border-radius: 50%;
    background: #ffffff24;
    font-size: 0.65em;
}
#TEgame #UIContainer .stairsOpeningMenu #startButton:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #0d597c;
}
#TEgame #UIContainer .stairsOpeningMenu :is(#startButton, .roww):focus-visible,
#TEgame #UIContainer .stairsOpeningMenu .roww:has(:focus-visible) {
    outline: 3px solid #176b93;
    outline-offset: 3px;
}
@media (hover: hover) {
    #TEgame #UIContainer .stairsOpeningMenu .roww:hover { border-color: #4fa9c9; }
    #TEgame #UIContainer .stairsOpeningMenu #startButton:hover { background: linear-gradient(#38b7db, #188fb9); }
}

/* Desktop results share the opening card's colors, borders and button treatment. */
.stairs-desktop #TEgame #UIContainer:has(.stairsEndCard)::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #17496326;
}
.stairs-desktop #TEgame #UIContainer:has(.stairsEndCard) > :is(#topBar, #bottomBar) { display: none; }
.stairs-desktop #TEgame #UIContainer .stairsEndCard {
    position: absolute;
    inset: 12% 12% 10%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.4em;
    padding: 1.35em;
    border: 2px solid #a4deee;
    border-radius: 1.2em;
    background: linear-gradient(145deg, #f5fdff, #e2f4fc);
    box-shadow: 0 8px 24px #16394c55, inset 0 1px #fff;
    color: #174963;
    font: 700 1.85cqw/1.25 "Assistant", Arial, sans-serif;
    box-sizing: border-box;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard :is(#gOverBox, .gameOverMenu) {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.7em;
    background: none;
    color: inherit;
    box-sizing: border-box;
    text-align: center;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #gOverBox {
    justify-content: center;
    padding-inline-end: 1.4em;
    border-inline-end: 1px solid #c1e2ef;
}
.stairs-desktop #TEgame #UIContainer .stairsEndEmblem {
    align-self: center;
    width: 4em;
    height: 4em;
    padding: 0.5em;
    border: 1px solid #edcf76;
    border-radius: 50%;
    background: linear-gradient(145deg, #fffbee, #ffecaa);
    box-shadow: 0 3px 0 #e5ca76;
    box-sizing: border-box;
}
.stairs-desktop #TEgame #UIContainer .stairsEndEmblem svg { display: block; width: 100%; height: 100%; }
.stairs-desktop #TEgame #UIContainer .stairsEndCard h1 {
    margin: 0 !important;
    color: #174963;
    font: 800 2em/1.08 "Assistant", Arial, sans-serif !important;
    text-shadow: none;
    overflow-wrap: anywhere;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard h2 {
    margin: 0;
    padding: 0.6em 0.4em;
    border: 1px solid #e6c05a;
    border-radius: 0.7em;
    background: linear-gradient(110deg, #fff9de, #ffedaa);
    color: #174963;
    font: 700 1.15em/1.4 "Assistant", Arial, sans-serif !important;
}
.stairs-desktop #TEgame #UIContainer .stairsEndScore {
    display: inline-block;
    padding-inline: 0.12em;
    font-size: 1.65em;
    line-height: 1;
    vertical-align: -0.05em;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #historyNameBox {
    margin: 0;
    padding: 0.7em;
    border: 1px solid #bedfea;
    border-radius: 0.8em;
    background: #fafdff;
    box-shadow: 0 3px 0 #d1e9f2;
    color: #174963;
    font-size: 0.95em;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #historyNameBox[hidden] { display: none; }
.stairs-desktop #TEgame #UIContainer .stairsEndCard #nameInput {
    width: 100%;
    height: 2.3em;
    margin: 0.5em 0 0;
    padding: 0.35em 0.55em;
    border: 2px solid #add6e6;
    border-radius: 0.5em;
    box-sizing: border-box;
    background: #fff;
    color: #174963;
    font: 700 1em/1.2 "Assistant", Arial, sans-serif;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard .menuTitle {
    order: 1;
    padding: 0;
    font-size: 1.3em;
    font-weight: 800;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard .menuHistoryContainer {
    order: 2;
    flex: 1;
    min-height: 0;
    padding: 0;
    font-size: 1em;
    overflow: auto;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.35em;
    color: #174963;
    table-layout: fixed;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard td {
    height: 2.3em;
    padding: 0.35em 0.55em;
    border-block: 1px solid #d0e8f2;
    background: #fff;
    white-space: normal;
    overflow-wrap: anywhere;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard td:first-child {
    width: 75%;
    text-align: start;
    border-inline-start: 1px solid #d0e8f2;
    border-start-start-radius: 0.5em;
    border-end-start-radius: 0.5em;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard td:last-child {
    width: 25%;
    font-weight: 800;
    color: #247899;
    border-inline-end: 1px solid #d0e8f2;
    border-start-end-radius: 0.5em;
    border-end-end-radius: 0.5em;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard tr:first-child td {
    background: #fff5d0;
    border-color: #edcf76;
}
/* Decorative empty slots preserve the score area after a reset, without text. */
#TEgame #UIContainer .gameOverMenu .menuHistoryContainer tr.stairsEmptyHistory td {
    height: clamp(24px, 4cqw, 36px);
    padding: 0;
    font-size: 0;
    line-height: 0;
    background: #ffffff70;
    border-block: 1px dashed #c5e0e9;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #replayButton {
    order: 3;
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6em;
    width: 100%;
    margin: 0 0 0.1em;
    padding: 0.4em 0.6em;
    border: 1px solid #08769b;
    border-radius: 0.65em;
    background: linear-gradient(#2ba8cf, #1383ad);
    box-shadow: 0 4px 0 #0d597c, inset 0 1px #83d8ed;
    color: #fff;
    text-shadow: 0 1px 2px #07516c;
    letter-spacing: 0;
    font: 800 1.35em/1.15 "Assistant", Arial, sans-serif;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #resetHistory {
    order: 4;
    align-self: center;
    margin: 0;
    padding: 0.3em 0.5em;
    border: 0;
    border-radius: 0.4em;
    background: none;
    color: #397792;
    font: 600 0.8em/1.2 "Assistant", Arial, sans-serif;
    cursor: pointer;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard :is(button, input):focus-visible {
    outline: 3px solid #dfa827;
    outline-offset: 3px;
}
.stairs-desktop #TEgame #UIContainer .stairsEndCard #replayButton:active { transform: translateY(2px); box-shadow: 0 2px 0 #0d597c; }
@media (hover: hover) {
    .stairs-desktop #TEgame #UIContainer .stairsEndCard #replayButton:hover { background: linear-gradient(#38b7db, #188fb9); }
    .stairs-desktop #TEgame #UIContainer .stairsEndCard #resetHistory:hover { background: #d6edf7; color: #174963; }
}

/* Actual controls are children of the bars, so they resize as a single layout. */
#TEgame #UIContainer.stairs-play-ui { --hud-height: clamp(44px, 6cqw, 68px); }
#TEgame #UIContainer.stairs-play-ui :is(#topBar, #stairsGameControls) {
    position: absolute !important;
    left: 0 !important;
    width: 100% !important;
    height: var(--hud-height) !important;
    display: flex;
    align-items: center;
    gap: clamp(5px, 1cqw, 12px);
    padding: 7px 12px;
    box-sizing: border-box;
    background: linear-gradient(180deg, #326780, #204a64) !important;
    border: 0;
    color: #fff;
    direction: ltr;
    z-index: 180 !important;
    font: 700 clamp(12px, 1.8cqw, 20px)/1.15 "Assistant", Arial, sans-serif;
}
#TEgame #UIContainer.stairs-play-ui #topBar {
    top: 0 !important;
    border-bottom: 2px solid #75cce5;
    box-shadow: 0 3px 9px #16394c40;
}
#TEgame #UIContainer.stairs-play-ui #stairsGameControls {
    top: auto !important;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(70px, 1.25fr) minmax(0, 3fr) minmax(50px, 1fr) auto;
    grid-template-areas: "hints question answer repeat";
    grid-template-rows: minmax(0, 1fr);
    border-top: 2px solid #75cce5;
    box-shadow: 0 -3px 9px #16394c40;
}
#TEgame #UIContainer.stairs-play-ui #topBar div {
    position: static !important;
    inset: auto !important;
    transform: none !important;
}
#TEgame #UIContainer.stairs-play-ui .stairsHudTitle { margin-right: auto; color: #d7f4ff; }
#TEgame #UIContainer.stairs-play-ui .stairsHudTitle b { font-weight: 700; }
#TEgame #UIContainer.stairs-play-ui #topBar .stairsActions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    width: auto;
    height: 100%;
    margin-left: auto;
    color: #fff;
    font-size: inherit !important;
}
#TEgame #UIContainer.stairs-play-ui #topBar .stairsActions > div {
    display: flex;
    align-items: center;
    width: auto;
    height: auto;
}
#TEgame #UIContainer.stairs-play-ui #topBar :is(#startPause, #muteButton, #stairsFullscreenButton, #exitButton) {
    position: static !important;
    transform: none !important;
    width: 36px !important;
    height: 36px !important;
    min-height: 0 !important;
    border: 1px solid #95d5ed66;
    border-radius: 9px;
    box-sizing: border-box;
    background-color: #ffffff12;
    background-size: 23px 23px !important;
    background-position: center !important;
    background-repeat: no-repeat;
    color: #fff;
    touch-action: manipulation;
}
#TEgame #UIContainer.stairs-play-ui #topBar #exitButton {
    width: auto !important;
    min-width: 48px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: none;
    font: 700 14px/1 "Assistant", Arial, sans-serif !important;
    text-shadow: none;
}
#TEgame #UIContainer.stairs-play-ui :is(.stairsHudPanel, #scoreContainer) {
    position: static !important;
    inset: auto !important;
    float: none;
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    min-width: 0;
    margin: 0;
    align-self: stretch;
    border: 2px solid #8dd5eb;
    border-radius: 10px;
    background: #f9fdff;
    box-shadow: 0 2px 0 #123a50;
    opacity: 1 !important;
    box-sizing: border-box;
    font-size: inherit !important;
}
#TEgame #UIContainer.stairs-play-ui #topBar :is(.livesPanel, #scoreContainer) {
    flex: 0 1 180px;
    width: auto !important;
}
#TEgame #UIContainer.stairs-play-ui :is(.stairsHudPanel, #scoreContainer) .smallPanelI,
#TEgame #UIContainer.stairs-play-ui :is(.stairsHudPanel, #scoreContainer) .smallPanelI > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0;
    padding: 0 3px !important;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-sizing: border-box;
}
#TEgame #UIContainer.stairs-play-ui #scoreSpan {
    width: auto !important;
    min-width: 1.7em;
    min-height: 0 !important;
    margin: 0;
    padding: 2px 5px;
    border: 0;
    border-radius: 5px;
    color: #155674;
    background: #e0f3fc;
    font: 800 1.1em/1.1 "Assistant", Arial, sans-serif !important;
}
#TEgame #UIContainer.stairs-play-ui #livesContainer img { height: clamp(18px, 2.8cqw, 30px) !important; padding: 0; }
#TEgame #UIContainer.stairs-play-ui .hintPanel { grid-area: hints; }
#TEgame #UIContainer.stairs-play-ui .questionPanel { grid-area: question; }
#TEgame #UIContainer.stairs-play-ui .answerPanel { grid-area: answer; }
#TEgame #UIContainer.stairs-play-ui :is(#questionContainer, #typingContainer) {
    font: 800 clamp(20px, 3.2cqw, 36px)/1.1 "Assistant", Arial, sans-serif !important;
    white-space: nowrap;
}
#TEgame #UIContainer.stairs-play-ui #hint .hintLight { width: clamp(18px, 2.5cqw, 28px) !important; height: clamp(22px, 3cqw, 34px) !important; }
#TEgame #UIContainer.stairs-play-ui #repeatBtn {
    position: static !important;
    inset: auto !important;
    grid-area: repeat;
    width: clamp(32px, 4.5cqw, 48px) !important;
    height: clamp(32px, 4.5cqw, 48px) !important;
    padding: 3px;
    border: 1px solid #a6def080;
    border-radius: 50%;
    background: #ffffff18;
}
#TEgame #UIContainer.stairs-play-ui button:focus-visible {
    outline: 3px solid #ffdb63;
    outline-offset: 2px;
}
#TEgame #UIContainer.stairs-play-ui #repeatBtn img { display: block; }
#TEgame #UIContainer.stairs-play-ui #levelContainer { top: var(--hud-height) !important; }

/* Desktop uses the same fullscreen controller, with its original board ratio. */
.stairs-desktop #stairsFullscreenControl { display: flex; align-items: center; }
.stairs-desktop #stairsFullscreenButton { padding: 6px; }
.stairs-desktop #stairsFullscreenButton svg { display: block; width: 100%; height: 100%; }
.stairs-desktop #stairsFullscreenButton .stairs-fullscreen-collapse,
.stairs-desktop #stairsFullscreenButton[aria-pressed="true"] .stairs-fullscreen-expand { display: none; }
.stairs-desktop #stairsFullscreenButton[aria-pressed="true"] .stairs-fullscreen-collapse { display: block; }
.stairs-desktop.stairs-fullscreen-active #fullScreenContainer {
    width: 100vw !important;
    height: 100dvh !important;
    min-height: 0 !important;
    background: #173b50;
    overflow: hidden;
}
.stairs-desktop.stairs-fullscreen-active #gameArea { height: 100%; align-items: center; }
.stairs-desktop.stairs-fullscreen-active #TEgame {
    width: min(100vw, calc(100dvh * 1124 / 710));
    margin: 0 auto;
}
.stairs-desktop.stairs-fullscreen-active #fullScreenContainer > svg { position: absolute; }
.stairs-desktop #fullScreenContainer > #stairsFullscreenControl {
    position: absolute; top: 10px; right: 10px; z-index: 3000;
}
.stairs-desktop #fullScreenContainer > #stairsFullscreenControl button {
    width: 40px; height: 40px; color: #fff; background: #24536c;
    border: 1px solid #9adcec; border-radius: 9px;
}
.stairs-desktop #stairsFullscreenStatus:not([hidden]) {
    position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
    max-width: calc(100% - 24px); padding: 10px 16px; z-index: 5000;
    background: #173b50; color: #fff; border-radius: 8px; text-align: center;
}

@media (orientation: portrait) {
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui { --hud-height: 52px; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui :is(#topBar, #stairsGameControls) {
        left: calc(50% - 50vw) !important;
        width: 100vw !important;
        padding: 6px max(6px, env(safe-area-inset-right)) 6px max(6px, env(safe-area-inset-left));
        gap: 5px;
        font-size: 12px;
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #stairsGameControls {
        top: 100% !important;
        bottom: auto;
        grid-template-columns: minmax(65px, 1.2fr) minmax(0, 2.1fr) minmax(44px, 0.8fr) 32px;
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui .stairsHudTitle { display: none; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #topBar :is(.livesPanel, #scoreContainer) { flex: 1 1 0; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #topBar .stairsActions { gap: 3px; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #topBar :is(#startPause, #muteButton, #stairsFullscreenButton) {
        width: 29px !important; height: 34px !important; background-size: 21px 21px !important;
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #topBar #exitButton { min-width: 35px; padding: 4px; font-size: 12px !important; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #livesContainer { gap: 2px !important; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #livesContainer img { height: clamp(14px, 4.2vw, 20px) !important; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui :is(#questionContainer, #typingContainer) { font-size: clamp(18px, 5.5vw, 26px) !important; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #hint .hintLight { width: 17px !important; height: 24px !important; }
    .stairs-mobile.stairs-playing #TEgame { margin-bottom: 56px; }
}
@media (orientation: landscape) {
    /* Exit returns to the opening screen and restores the site's menu. */
    .stairs-mobile.stairs-playing :is(.m4k-mobile-header, #navHeader) { display: none !important; }
    .stairs-mobile.stairs-playing #gameArea {
        --stairs-keypad-width: min(34vw, 320px);
        --stairs-landscape-topbar-height: clamp(46px, 13dvh, 58px);
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui { --hud-height: var(--stairs-landscape-topbar-height); }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui :is(#topBar, #stairsGameControls) {
        left: calc(-1 * var(--stairs-edge)) !important;
        width: var(--stairs-viewport-width, 100vw) !important;
        padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
        font-size: clamp(12px, 2vw, 17px);
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #stairsGameControls {
        top: calc(var(--stairs-viewport-height, 100dvh) - var(--stairs-landscape-hud-height) - env(safe-area-inset-bottom)) !important;
        bottom: auto;
        height: calc(var(--stairs-landscape-hud-height) + env(safe-area-inset-bottom)) !important;
        padding-bottom: max(7px, env(safe-area-inset-bottom));
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui :is(#questionContainer, #typingContainer) {
        font-size: clamp(26px, 7.2dvh, 32px) !important;
        line-height: 1 !important;
        color: #124a62;
    }
    .stairs-mobile.stairs-playing #stairsKeypad {
        top: calc(var(--stairs-landscape-topbar-height) + 8px + env(safe-area-inset-top)) !important;
        height: calc(var(--stairs-viewport-height, 100dvh) - var(--stairs-landscape-topbar-height) - var(--stairs-landscape-hud-height) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        grid-template-rows: repeat(4, minmax(0, 1fr));
        padding: 0 !important;
        margin: 0 !important;
    }
    .stairs-mobile.stairs-playing #stairsKeypad .stairsKey {
        font-size: clamp(22px, 6dvh, 34px);
    }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui #topBar :is(.livesPanel, #scoreContainer) { flex-basis: 130px; }
    .stairs-mobile #TEgame #UIContainer.stairs-play-ui .stairsHudTitle { font-size: 0.95em; }
}
@media (prefers-reduced-motion: reduce) {
    #TEgame #UIContainer .stairsOpeningMenu * { transition: none; }
}

@media (orientation: portrait) and (max-height: 650px) {
    .stairs-mobile #UIContainer:has(.stairsOpeningMenu) .stairsOpeningScene {
        min-height: clamp(90px, calc(100svh - 380px), 185px);
    }
    .stairs-mobile #TEgame #UIContainer .stairsOpeningMenu .levels .text { font-size: 18px; }
    .stairs-mobile #TEgame #UIContainer .stairsOpeningMenu .stairsLevelSteps { height: 1.5em; }
    .stairs-mobile #TEgame #UIContainer .stairsOpeningMenu .levels label.roww {
        min-height: 44px;
        padding-block: 5px;
    }
    .stairs-mobile #TEgame #UIContainer .stairsOpeningMenu #startButton { min-height: 48px; font-size: 25px; }
}
