/* Keep the original single-column ending, only wider and viewport-safe. */

#endScreen {
    place-items: center !important;
    padding: clamp(0.55rem, 1.8dvh, 1rem) clamp(0.65rem, 1.6vw, 1.25rem) !important;
    overflow: hidden !important;
}

#endInner {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.2rem, 0.65dvh, 0.42rem) !important;
    width: min(1180px, calc(100vw - 2rem)) !important;
    max-width: 1180px !important;
    height: auto !important;
    min-height: 0;
    max-height: calc(100dvh - 2rem) !important;
    margin: auto;
    padding: clamp(0.85rem, 2.2dvh, 1.4rem) clamp(1rem, 3vw, 2.6rem) !important;
    overflow: hidden !important;
}

#endScreen h2 {
    margin: 0 0 clamp(0.25rem, 0.8dvh, 0.55rem) !important;
    font-size: clamp(1.55rem, 3.2vw, 2.75rem) !important;
    line-height: 1.05;
}

#endScreen #endInner > .typing-line {
    width: 100%;
    max-width: none;
    min-height: 1.3em;
    margin: 0 !important;
    padding: 0;
    color: #f3f1fa;
    background: none;
    border: 0;
    font-size: clamp(0.72rem, 1.08vw, 0.92rem) !important;
    line-height: 1.3 !important;
    text-align: center;
}

#endScreen #endInner > .hint {
    width: 100%;
    max-width: none;
    margin: clamp(0.2rem, 0.7dvh, 0.45rem) 0 0 !important;
    font-size: clamp(0.64rem, 0.95vw, 0.76rem) !important;
    line-height: 1.2;
}

#endInner > .btnRow {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: clamp(0.55rem, 1.2vw, 0.9rem) !important;
    width: 100%;
    margin: clamp(0.25rem, 0.75dvh, 0.5rem) 0 0 !important;
    padding: 0.35rem 0 0.55rem;
}

#endInner > .btnRow .btn {
    min-height: 40px;
    padding: 0.52rem 1rem;
    font-size: clamp(0.68rem, 1.2vw, 0.88rem);
}

@media (min-width: 1200px) {
    #endInner {
        width: min(1240px, calc(100vw - 3rem)) !important;
        max-width: 1240px !important;
    }
}

@media (max-width: 767px) {
    #endScreen {
        padding: 0.35rem !important;
    }

    #endInner {
        width: calc(100vw - 0.7rem) !important;
        max-height: calc(100dvh - 0.7rem) !important;
        padding: clamp(0.55rem, 1.6dvh, 0.85rem) !important;
        border-radius: 19px !important;
        gap: clamp(0.12rem, 0.45dvh, 0.28rem) !important;
    }

    #endScreen h2 {
        margin-bottom: 0.2rem !important;
        font-size: clamp(1.2rem, 5.8vw, 1.7rem) !important;
    }

    #endScreen #endInner > .typing-line {
        min-height: 1.2em;
        font-size: clamp(0.6rem, 2.55vw, 0.74rem) !important;
        line-height: 1.2 !important;
    }

    #endScreen #endInner > .hint {
        margin-top: 0.15rem !important;
        font-size: clamp(0.56rem, 2.2vw, 0.66rem) !important;
    }

    #endInner > .btnRow {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.42rem !important;
        margin-top: 0.2rem !important;
        padding: 0.25rem 0 0.45rem;
    }

    #endInner > .btnRow .btn {
        width: 100%;
        min-width: 0 !important;
        min-height: 36px;
        padding: 0.38rem 0.28rem;
        font-size: clamp(0.56rem, 2.45vw, 0.68rem);
        line-height: 1.15;
    }
}

@media (max-height: 620px) {
    #endInner {
        gap: 0.1rem !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    #endScreen h2 {
        margin-bottom: 0.12rem !important;
        font-size: clamp(1.1rem, 4.4dvh, 1.55rem) !important;
    }

    #endScreen #endInner > .typing-line {
        min-height: 1.12em;
        font-size: clamp(0.56rem, 1.75dvh, 0.68rem) !important;
        line-height: 1.12 !important;
    }

    #endScreen #endInner > .hint {
        display: none;
    }

    #endInner > .btnRow {
        margin-top: 0.12rem !important;
        padding-top: 0.12rem;
        padding-bottom: 0.3rem;
    }

    #endInner > .btnRow .btn {
        min-height: 32px;
        padding-top: 0.28rem;
        padding-bottom: 0.28rem;
    }
}

@media (max-width: 390px) and (max-height: 700px) {
    #signature {
        display: none;
    }

    #endScreen #endInner > .typing-line {
        font-size: 0.57rem !important;
    }
}
