.psc-wrap {
    background: var(--psc-bg);
    color: var(--psc-text);
    border-radius: 24px;
    padding: 24px;
    min-height: 78vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 18px 50px rgba(0,0,0,.25);
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.psc-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    border-radius: 0;
    padding: 24px;
}

.psc-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-height: 80px;
}

.psc-logo {
    max-height: 72px;
    max-width: 320px;
    width: auto;
    object-fit: contain;
}

.psc-control-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.psc-fullscreen-btn,
.psc-sound-btn {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    color: var(--psc-text);
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.psc-sound-btn.psc-sound-enabled {
    background: rgba(34,197,94,.22);
    border-color: rgba(34,197,94,.55);
}

.psc-main-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 28px;
}

.psc-timer-box {
    background: var(--psc-timer-bg);
    border-radius: 34px;
    padding: 34px 26px;
    text-align: center;
    width: min(100%, 980px);
    margin: 0 auto;
}

.psc-countdown {
    font-size: clamp(120px, 24vw, 340px);
    line-height: .9;
    font-weight: 900;
    letter-spacing: 3px;
}

.psc-status {
    margin-top: 14px;
    font-size: clamp(18px, 2vw, 26px);
    opacity: .9;
}

.psc-buttons {
    width: min(100%, 1100px);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.psc-btn {
    border: none;
    color: #fff;
    border-radius: 999px;
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 800;
    padding: 30px 18px;
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
    box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), 0 10px 24px rgba(0,0,0,.22);
}

.psc-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.psc-btn:active {
    transform: translateY(1px);
}

.psc-btn-green { background: var(--psc-green); }
.psc-btn-yellow { background: var(--psc-yellow); color: #111827; }
.psc-btn-red { background: var(--psc-red); }

 .psc-adrotate-area {
    width: min(100%, 1100px);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255,255,255,.05);
}

.psc-adrotate-slot {
    width: 100%;
    text-align: center;
}

.psc-adrotate-slot img,
.psc-adrotate-slot iframe {
    max-width: 100%;
}

.psc-adrotate-slot img {
    height: auto;
    display: inline-block;
}

.psc-adrotate-mobile {
    display: none;
}

@media (max-width: 900px) {
    .psc-wrap {
        min-height: auto;
        padding: 18px;
    }

    .psc-topbar {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .psc-buttons {
        grid-template-columns: 1fr;
    }

    .psc-btn {
        padding: 24px 14px;
    }

    .psc-adrotate-area {
        min-height: 80px;
    }

    .psc-adrotate-desktop {
        display: none;
    }

    .psc-adrotate-mobile {
        display: block;
    }
}


.psc-wrap.psc-pseudo-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-width: none;
    z-index: 999999;
    border-radius: 0;
    margin: 0;
    padding: 16px;
}

body.psc-no-scroll {
    overflow: hidden;
}

@media (max-width: 900px) {
    .psc-control-stack {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        flex: 0 0 auto;
        width: 100%;
    }

    .psc-fullscreen-btn,
    .psc-sound-btn {
        position: static;
        display: block;
        width: auto;
        min-width: 132px;
        z-index: 1;
        padding: 10px 14px;
        font-size: 13px;
        line-height: 1.1;
        white-space: nowrap;
    }

    .psc-wrap {
        padding-top: 18px;
        min-height: 100dvh;
        border-radius: 0;
    }

    .psc-wrap:fullscreen {
        padding-top: 18px;
    }

    .psc-wrap.psc-pseudo-fullscreen {
        padding-top: calc(18px + env(safe-area-inset-top, 0px));
    }

    .psc-topbar {
        min-height: 48px;
        align-items: flex-start;
        flex-direction: column;
    }

    .psc-logo {
        max-height: 48px;
        max-width: 220px;
    }

    .psc-main-center {
        gap: 18px;
    }

    .psc-timer-box {
        width: 100%;
        padding: 22px 14px;
        border-radius: 22px;
    }

    .psc-countdown {
        font-size: clamp(96px, 28vw, 180px);
    }
}

.psc-countdown {
    color: var(--psc-text);
    transition: color .25s ease;
}

.psc-countdown.psc-warning {
    color: #ffcc00;
}

.psc-countdown.psc-critical {
    color: #ff3333;
}


/* Mobile landscape / short-screen fullscreen layout */
@media (orientation: landscape) and (max-height: 520px) {
    .psc-wrap,
    .psc-wrap:fullscreen,
    .psc-wrap.psc-pseudo-fullscreen {
        min-height: 100dvh;
        height: 100dvh;
        max-height: 100dvh;
        padding: calc(8px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(10px + env(safe-area-inset-left, 0px));
        gap: 6px;
        border-radius: 0;
        overflow: hidden;
        justify-content: space-between;
    }

    .psc-topbar {
        min-height: 62px;
        height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
        flex: 0 0 auto;
    }

    .psc-logo {
        max-height: 30px;
        max-width: 140px;
    }

    .psc-control-stack {
        gap: 3px;
        align-items: flex-start;
        width: auto;
    }

    .psc-fullscreen-btn,
    .psc-sound-btn {
        min-width: 110px;
        padding: 5px 9px;
        font-size: 10px;
        line-height: 1;
        white-space: nowrap;
    }

    .psc-main-center {
        flex: 1 1 auto;
        min-height: 0;
        justify-content: center;
        gap: 7px;
    }

    .psc-timer-box {
        width: min(100%, 560px);
        padding: 7px 12px;
        border-radius: 16px;
    }

    .psc-countdown {
        font-size: clamp(58px, 26vh, 120px);
        line-height: .86;
        letter-spacing: 1px;
    }

    .psc-status {
        margin-top: 4px;
        font-size: clamp(11px, 3vh, 16px);
        line-height: 1.1;
    }

    .psc-buttons {
        width: min(100%, 760px);
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .psc-btn {
        padding: 9px 8px;
        font-size: clamp(15px, 5vh, 24px);
        line-height: 1;
        box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 5px 14px rgba(0,0,0,.2);
    }

    .psc-adrotate-area {
        min-height: 34px;
        max-height: 46px;
        width: min(100%, 760px);
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .psc-adrotate-slot img,
    .psc-adrotate-slot iframe {
        max-height: 46px;
        width: auto;
        max-width: 100%;
    }
}

@media (orientation: landscape) and (max-height: 380px) {
    .psc-adrotate-area {
        min-height: 26px;
        max-height: 34px;
    }

    .psc-adrotate-slot img,
    .psc-adrotate-slot iframe {
        max-height: 34px;
    }

    .psc-logo {
        max-height: 24px;
    }

    .psc-topbar {
        height: auto;
        min-height: 54px;
    }

    .psc-countdown {
        font-size: clamp(48px, 24vh, 92px);
    }

    .psc-btn {
        padding: 7px 8px;
    }
}
