@media (max-width: 900px) {
    html,
    body,
    .app {
        min-height: 100%;
    }

    .page {
        min-height: 100svh;
    }

    .desktop-stage {
        display: contents;
    }

    .desktop-header {
        display: none;
    }

    #home-page,
    #quiz-page,
    #nickname-page,
    #result-page {
        height: auto;
        min-height: 100svh;
        max-height: none;
        overflow-x: hidden;
    }

    @media (orientation: portrait) {
        #home-page .hero,
        #quiz-page .quiz-container,
        #nickname-page .nickname-container,
        #result-page .result-container {
            min-height: 100svh;
        }
    }

    @media (orientation: landscape) {
        #home-page,
        #quiz-page,
        #nickname-page,
        #result-page {
            overflow-y: auto;
        }
    }
}

@media (max-width: 900px) {
    html[data-fbti-entry="web"] #home-page .powered-by,
    html[data-fbti-entry="web"] #quiz-page .powered-by,
    html[data-fbti-entry="web"] #nickname-page .powered-by,
    html[data-fbti-entry="web"] #result-page .result-powered-by {
        position: fixed;
        right: 0;
        bottom: max(12px, env(safe-area-inset-bottom));
        left: 0;
        z-index: 10020;
        box-sizing: border-box;
        margin: 0;
        padding: 0 24px;
        width: 100%;
        font-size: clamp(15px, 4vw, 22px);
        line-height: 1.12;
        text-align: center;
        pointer-events: none;
    }

    html[data-fbti-entry="web"] #home-page .hero,
    html[data-fbti-entry="web"] #quiz-page .quiz-container,
    html[data-fbti-entry="web"] #nickname-page .nickname-container,
    html[data-fbti-entry="web"] #result-page .result-container {
        padding-bottom: max(54px, calc(env(safe-area-inset-bottom) + 44px));
    }

    html[data-fbti-entry="web"] #quiz-page .quiz-container {
        padding-top: clamp(74px, 12.4svh, 152px);
    }

    html[data-fbti-entry="web"] #quiz-page .progress-bar {
        margin-bottom: clamp(16px, 3.4svh, 44px);
    }

    html[data-fbti-entry="web"] #quiz-page .question-text {
        margin-bottom: clamp(12px, 2svh, 26px);
    }

    html[data-fbti-entry="web"] #quiz-page .options-container {
        gap: clamp(7px, 1.25svh, 16px);
    }

    html[data-fbti-entry="web"] #quiz-page .option-btn {
        padding: clamp(7px, 1.25svh, 16px) clamp(12px, 3.4vw, 28px);
        border-radius: clamp(11px, 3vw, 18px);
        line-height: 1.31;
    }

    html[data-fbti-entry="web"] #quiz-page .quiz-actions {
        margin-top: clamp(10px, 2svh, 28px);
    }

    html[data-fbti-entry="web"] #result-page .result-container {
        align-items: center;
        display: flex;
        flex-direction: column;
        min-height: 100svh;
        padding: clamp(28px, 5svh, 42px) 30px;
    }

    html[data-fbti-entry="web"] #result-page {
        min-height: 100svh;
        overflow-y: auto;
    }

    html[data-fbti-entry="web"] #poster-display {
        width: min(100%, 600px);
        max-width: 600px;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: visible;
        padding-bottom: 20px;
    }

    html[data-fbti-entry="web"] #poster-display::before {
        content: attr(data-result-title);
        margin: 0;
        padding-bottom: 18px;
        font-size: 22px;
        line-height: 1.35;
    }

    html[data-fbti-entry="web"] #poster-display .poster-visual {
        order: 1;
        box-sizing: border-box;
        height: 286px;
        margin: 0;
        padding-bottom: 18px;
    }

    html[data-fbti-entry="web"] #poster-display .poster-type-icon {
        width: 100%;
        height: 100%;
    }

    html[data-fbti-entry="web"] #poster-display .poster-type-icon img {
        width: min(78vw, 306px);
        height: 100%;
        max-height: 100%;
        object-fit: contain;
        object-position: center bottom;
    }

    html[data-fbti-entry="web"] #poster-display .poster-header {
        order: 2;
        display: grid;
        grid-template-rows: 34px auto;
        align-content: start;
        align-items: start;
        gap: 14px 18px;
        min-height: 0;
        height: auto;
        padding-top: 24px;
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    html[data-fbti-entry="web"] #poster-display .poster-type-name,
    html[data-fbti-entry="web"] #poster-display .poster-header::after {
        font-size: 32px;
        font-weight: 900;
    }

    html[data-fbti-entry="web"] #poster-display .poster-header::after {
        font-family: var(--fbti-font-heavy);
        font-weight: 900 !important;
    }

    html[data-fbti-entry="web"] #poster-display .poster-subtitle {
        grid-row: 2;
        margin-top: 0;
        padding: 10px 0 11px;
        font-size: 17px;
        line-height: 1.36;
    }

    html[data-fbti-entry="web"] #poster-display .poster-description {
        order: 3;
        margin: 0;
        padding: 14px 0 20px;
        background: transparent;
        border-radius: 0;
        text-align: left;
    }

    html[data-fbti-entry="web"] #poster-display .poster-extra {
        order: 5;
        display: block !important;
        width: 100%;
        margin: 0;
        text-align: left;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card {
        position: relative;
        box-sizing: border-box;
        width: 100%;
        min-height: 0;
        margin: 0 auto;
        padding: 0;
        overflow: visible;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card::before,
    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card::after {
        content: none !important;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card h3 {
        display: block;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
        color: #7c5ce7;
        font-family: var(--fbti-font-heavy);
        font-size: 24px;
        font-weight: 900 !important;
        font-synthesis: none;
        line-height: 1.08;
        transform: none;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-top {
        box-sizing: border-box;
        aspect-ratio: 650 / 174;
        padding: 28px 28px 0;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-top.png?v=20260530-card-fix-v3') top center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-middle {
        box-sizing: border-box;
        margin: 0;
        padding: 24px 28px 27px;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-middle.png?v=20260530-card-fix-v3') top center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-bottom {
        aspect-ratio: 650 / 240;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-bottom.png?v=20260530-card-fix-v3') bottom center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-display .poster-description p,
    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card p {
        font-family: var(--fbti-font-regular);
        font-weight: 400 !important;
        font-synthesis: none;
    }

    html[data-fbti-entry="web"] #poster-display .poster-description p {
        margin: 0;
        font-size: 15px;
        line-height: 1.62;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card p {
        position: static;
        z-index: auto;
        margin: 0;
        color: #211b49;
        font-size: 15px;
        line-height: 1.72;
        white-space: pre-line;
    }

    html[data-fbti-entry="web"] #result-page .page-actions {
        width: min(100%, 600px);
        max-width: 600px;
        gap: 10px;
        margin-top: clamp(8px, 1.5svh, 16px);
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        z-index: auto;
        pointer-events: none;
    }

    html[data-fbti-entry="web"] #result-page .save-hint-area {
        width: min(100%, 600px);
        max-width: 600px;
        margin: 0.5rem 0;
    }

    html[data-fbti-entry="web"] #result-page .page-actions .btn-primary,
    html[data-fbti-entry="web"] #result-page .page-actions .btn-secondary {
        font-family: var(--fbti-font-regular);
        font-weight: 400 !important;
        font-synthesis: none;
        height: 44px;
        min-height: 44px;
        padding: 0 18px;
        font-size: 17px;
    }

    html[data-fbti-entry="web"] #result-page .page-actions .btn-primary {
        position: relative;
        z-index: 1;
        pointer-events: none;
        cursor: default;
    }

    html[data-fbti-entry="web"] #result-page .page-actions .btn-secondary {
        position: relative;
        z-index: 10002;
        pointer-events: auto;
    }

    html[data-fbti-entry="web"] #result-page .page-actions .btn-secondary:first-child {
        font-size: 0;
    }

    html[data-fbti-entry="web"] #result-page .page-actions .btn-secondary:first-child::after {
        content: '返回';
        font-family: var(--fbti-font-regular);
        font-weight: 400 !important;
        font-synthesis: none;
        font-size: 17px;
    }

    html[data-fbti-entry="web"] #poster-export::before {
        content: none !important;
        display: none !important;
        height: 0 !important;
        padding: 0 !important;
    }

    html[data-fbti-entry="web"] #poster-export .poster-header {
        margin-top: 62px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-greeting,
    html[data-fbti-entry="web"] #poster-export .poster-type-name,
    html[data-fbti-entry="web"] #poster-export .poster-type-name::after,
    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card h3,
    html[data-fbti-entry="web"] #poster-export .poster-slogan,
    html[data-fbti-entry="web"] #poster-export .poster-brand {
        font-family: var(--fbti-font-heavy);
        font-weight: 900 !important;
    }

    html[data-fbti-entry="web"] #poster-export .poster-subtitle {
        font-family: var(--fbti-font-regular);
        font-weight: 400 !important;
        font-synthesis: none;
    }

    html[data-fbti-entry="web"] #poster-export .poster-description p,
    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card p {
        font-family: var(--fbti-font-regular);
        font-weight: 400 !important;
        font-synthesis: none;
    }

    html[data-fbti-entry="web"] #poster-export .poster-greeting::after {
        margin-top: 20px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-visual {
        height: 430px;
        margin-top: 28px;
        padding-bottom: 18px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-type-icon {
        height: 430px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-type-icon img {
        width: auto;
        height: 400px;
        max-height: 400px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-result-summary {
        display: grid;
        grid-template-rows: 58px auto;
        align-content: start;
        gap: 20px;
        height: auto;
        margin-top: 34px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-type-name,
    html[data-fbti-entry="web"] #poster-export .poster-subtitle {
        margin: 0;
    }

    html[data-fbti-entry="web"] #poster-export .poster-description {
        box-sizing: border-box;
        height: auto;
        margin-top: 28px;
        margin-bottom: 28px;
        overflow: visible;
    }

    html[data-fbti-entry="web"] #poster-export .poster-extra {
        width: 660px;
        margin-top: 0;
        margin-bottom: 30px;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card {
        width: 660px;
        min-height: 0;
        padding: 0;
        overflow: visible;
        background: transparent;
        box-shadow: none;
        box-sizing: border-box;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card::before,
    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card::after {
        content: none !important;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card h3 {
        display: block;
        margin: 0;
        padding: 0;
        background: transparent;
        box-shadow: none;
        line-height: 1.08;
        transform: none;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-top {
        box-sizing: border-box;
        aspect-ratio: 650 / 174;
        padding: 56px 55px 0;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-top.png?v=20260530-card-fix-v3') top center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-middle {
        box-sizing: border-box;
        margin: 0;
        padding: 48px 55px 54px;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-middle.png?v=20260530-card-fix-v3') top center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-bottom {
        aspect-ratio: 650 / 240;
        background: url('https://fbti.lenovo.cdn.tybdapp.top/assets/ui/interpretation-card-bottom.png?v=20260530-card-fix-v3') bottom center / 100% 100% no-repeat;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card p {
        position: static;
        z-index: auto;
    }

    html[data-fbti-entry="web"] #poster-export .poster-interpretation-card p::after {
        content: none;
        display: none;
    }

    html[data-fbti-entry="web"] #poster-export .poster-footer {
        padding: 78px 0 70px;
    }
}

@media (max-width: 900px) {
    html[data-fbti-entry="web"].fbti-text-zoom-locked,
    html[data-fbti-entry="web"].fbti-text-zoom-locked *,
    html[data-fbti-entry="web"].fbti-text-zoom-locked *::before,
    html[data-fbti-entry="web"].fbti-text-zoom-locked *::after {
        -webkit-text-size-adjust: 100% !important;
        text-size-adjust: 100% !important;
    }

    html[data-fbti-entry="web"].fbti-text-zoom-locked,
    html[data-fbti-entry="web"].fbti-text-zoom-locked body,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .app,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .page,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .hero,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .quiz-container,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .nickname-container,
    html[data-fbti-entry="web"].fbti-text-zoom-locked .result-container {
        font-size: 16px !important;
    }
}

@media (max-width: 900px) {
    html[data-fbti-entry="web"] #nickname-page .nickname-container {
        align-items: center;
    }

    html[data-fbti-entry="web"] #nickname-page .nickname-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: min(100%, 560px);
        max-width: 560px;
        margin-right: auto;
        margin-left: auto;
    }

    html[data-fbti-entry="web"] #nickname-page .nickname-title {
        width: 100%;
        text-align: center;
    }

    html[data-fbti-entry="web"] #nickname-page .nickname-input-wrapper,
    html[data-fbti-entry="web"] #nickname-page .nickname-card .btn-primary {
        width: min(100%, 560px);
        max-width: 560px;
        margin-right: auto;
        margin-left: auto;
    }

    html[data-fbti-entry="web"] #nickname-page .nickname-input {
        width: 100%;
        text-align: center;
    }
}

@media (min-width: 600px) and (max-width: 900px) and (min-height: 600px) {
    html[data-fbti-entry="web"] #result-page .result-container {
        padding-right: clamp(24px, 5vw, 44px);
        padding-left: clamp(24px, 5vw, 44px);
    }

    html[data-fbti-entry="web"] #poster-display .poster-visual {
        height: 300px;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-card {
        width: calc(100% + 60px);
        max-width: 660px;
        margin-left: -30px;
        margin-right: -30px;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-top {
        display: block;
        height: 88px;
        aspect-ratio: auto;
        padding: 28px 58px 0;
        background-size: 100% 88px;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-middle {
        padding-right: 58px;
        padding-left: 58px;
        background-size: 100% 8px;
        background-repeat: repeat-y;
    }

    html[data-fbti-entry="web"] #poster-display .poster-interpretation-bottom {
        height: auto;
        aspect-ratio: 660 / 240;
        background-size: 100% 100%;
    }
}

@media (max-width: 900px) {
    html[data-fbti-entry="web"] #nickname-page {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    html[data-fbti-entry="web"] #nickname-page .nickname-container {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        min-height: 100svh;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    html[data-fbti-entry="web"] #nickname-page .powered-by {
        position: static;
        right: auto;
        bottom: auto;
        left: auto;
        z-index: auto;
        flex: 0 0 auto;
        width: auto;
        margin: clamp(22px, 4.5svh, 44px) 0 0;
        padding: 0;
        font-size: clamp(15px, 4vw, 22px);
        line-height: 1.15;
    }
}

@media (max-width: 900px) and (max-height: 680px) {
    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-container {
        min-height: auto;
        padding-top: max(18px, env(safe-area-inset-top));
        padding-bottom: max(18px, env(safe-area-inset-bottom));
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-card {
        margin-top: 0;
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-title {
        margin-bottom: clamp(18px, 5svh, 34px);
        font-size: clamp(20px, 5vw, 28px);
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-input-wrapper {
        margin-bottom: clamp(10px, 2.5svh, 18px);
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-input {
        height: clamp(50px, 10svh, 62px);
        font-size: clamp(20px, 5.5vw, 30px);
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .nickname-card .btn-primary {
        height: clamp(54px, 10.5svh, 66px);
        min-height: clamp(54px, 10.5svh, 66px);
        font-size: clamp(24px, 6.2vw, 34px);
    }

    html[data-fbti-entry="web"] #nickname-page:focus-within .powered-by {
        margin-top: clamp(12px, 3svh, 20px);
        font-size: clamp(14px, 3.8vw, 20px);
    }
}
