* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 15%,
            #18345c 0%,
            #102544 35%,
            #0a172b 72%,
            #080f1d 100%
        );

    color: #f4f6fa;

    font-family:
        Arial,
        Helvetica,
        sans-serif;
}

body {
    overscroll-behavior: none;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

button:disabled {
    cursor: default;
}

.app {
    width: 100%;
    height: 100%;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}


/* =========================================================
   LOGIN
   ========================================================= */

#loginScreen {
    position: relative;

    flex-direction: column;
    justify-content: center;
    align-items: center;

    padding:
        calc(25px + env(safe-area-inset-top))
        25px
        calc(25px + env(safe-area-inset-bottom));

    background:
        radial-gradient(
            circle at 50% 35%,
            rgba(86, 27, 48, .55) 0%,
            rgba(24, 52, 92, .4) 30%,
            transparent 65%
        ),
        linear-gradient(
            145deg,
            #081426 0%,
            #102746 52%,
            #240f1e 100%
        );
}

.login-content {
    width: 100%;
    max-width: 380px;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.emblem {
    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(160, 38, 66, .7);
    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(42, 76, 119, .9),
            rgba(13, 28, 50, .95)
        );

    box-shadow:
        0 0 35px rgba(124, 28, 55, .35),
        inset 0 0 25px rgba(255, 255, 255, .04);
}

.login-emblem {
    width: 105px;
    height: 105px;

    margin-bottom: 25px;
}

.emblem img {
    width: 72%;
    height: 72%;

    object-fit: contain;

    border-radius: 50%;
}

.login-title {
    font-size: 31px;
    font-weight: 800;

    letter-spacing: 7px;

    text-align: center;

    text-shadow:
        0 2px 12px rgba(0, 0, 0, .5);
}

.login-subtitle {
    margin-top: 9px;

    color: #a9b4c7;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 2.4px;

    text-align: center;
}

.login-line {
    width: 100%;
    height: 1px;

    margin: 28px 0 25px;

    background:
        linear-gradient(
            90deg,
            transparent,
            #76253f,
            #b33a59,
            #76253f,
            transparent
        );
}

.login-box {
    width: 100%;
}

.input-label {
    margin:
        13px 0 7px;

    color: #9da9bc;

    font-size: 9px;
    font-weight: 700;

    letter-spacing: 1.7px;
}

.login-box input {
    display: block;

    width: 100%;
    height: 52px;

    padding: 0 16px;

    border: 1px solid #304463;
    border-radius: 7px;

    outline: none;

    background:
        rgba(5, 15, 29, .72);

    color: #fff;

    font-size: 16px;

    transition:
        border-color .15s,
        box-shadow .15s;
}

.login-box input::placeholder {
    color: #53647c;
}

.login-box input:focus {
    border-color: #a43150;

    box-shadow:
        0 0 0 1px rgba(164, 49, 80, .25),
        0 0 18px rgba(164, 49, 80, .15);
}

.main-button {
    width: 100%;
    height: 54px;

    margin-top: 24px;

    border: 1px solid #a83252;
    border-radius: 7px;

    background:
        linear-gradient(
            135deg,
            #7d2340,
            #a93253
        );

    color: #fff;

    font-size: 13px;
    font-weight: 800;

    letter-spacing: 2.5px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, .25);

    transition:
        transform .08s,
        filter .15s;
}

.main-button:active {
    transform: scale(.98);
}

.main-button:hover {
    filter: brightness(1.12);
}

.error {
    min-height: 20px;

    margin-top: 13px;

    text-align: center;

    color: #e05b78;

    font-size: 12px;
}


/* =========================================================
   PHONE SCREEN
   ========================================================= */

#phoneScreen {
    position: relative;

    flex-direction: column;

    background:
        radial-gradient(
            circle at 50% 30%,
            rgba(27, 62, 104, .42),
            transparent 55%
        ),
        linear-gradient(
            150deg,
            #081426,
            #102746 55%,
            #1d0e1a
        );
}


/* =========================================================
   HEADER
   ========================================================= */

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    flex-shrink: 0;

    padding:
        calc(12px + env(safe-area-inset-top))
        17px
        11px;

    border-bottom: 1px solid #64213a;

    background:
        linear-gradient(
            180deg,
            rgba(7, 17, 32, .92),
            rgba(11, 27, 48, .76)
        );
}

.header-left {
    min-width: 0;
}

.main-title {
    font-size: 20px;
    font-weight: 900;

    letter-spacing: 4px;

    color: #f5f7fb;
}

.registration-number {
    margin-top: 5px;

    color: #b8c3d4;

    font-size: 12px;
    font-weight: 700;

    letter-spacing: 2px;
}

.user-name {
    margin-top: 3px;

    max-width: 180px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #71839d;

    font-size: 10px;

    letter-spacing: 1px;
}

.header-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    padding-top: 2px;
}

.status {
    font-size: 10px;
    font-weight: 800;

    letter-spacing: 1px;

    white-space: nowrap;
}

.status-online {
    color: #67d59a;
}

.status-offline {
    color: #c05770;
}

.status-detail {
    margin-top: 4px;

    color: #71839d;

    font-size: 8px;

    letter-spacing: .8px;

    white-space: nowrap;
}


/* =========================================================
   PHONE MAIN
   ========================================================= */

.phone {
    position: relative;

    flex: 1;
    min-height: 0;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;

    padding:
        8px
        12px
        calc(5px + env(safe-area-inset-bottom));
}


/* =========================================================
   NUMBER
   ========================================================= */

.number-area {
    width: 100%;

    min-height: 63px;

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

    flex-shrink: 0;
}

.number-display {
    width: 100%;
    height: 38px;

    overflow: hidden;

    text-align: center;

    color: #f6f8fb;

    font-size: 29px;
    font-weight: 500;

    line-height: 38px;

    letter-spacing: 4px;

    white-space: nowrap;
}

.call-status {
    height: 14px;

    color: #8292a9;

    font-size: 8px;
    font-weight: 800;

    letter-spacing: 1.7px;
}

.call-duration {
    height: 15px;

    color: #c34a68;

    font-family: monospace;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 1px;
}


/* =========================================================
   KEYPAD
   ========================================================= */

.keypad {
    width: 100%;
    max-width: 355px;

    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    gap: 7px;

    margin-top: 4px;
}

.keypad button {
    aspect-ratio: 1.18;

    min-height: 42px;

    border: 1px solid #304967;
    border-radius: 6px;

    background:
        linear-gradient(
            145deg,
            rgba(25, 52, 83, .95),
            rgba(13, 31, 53, .95)
        );

    color: #f4f6fa;

    font-size: 20px;
    font-weight: 500;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.04),
        0 3px 8px rgba(0,0,0,.18);

    transition:
        transform .06s,
        background .08s,
        border-color .08s;
}

.keypad button:active {
    transform: scale(.95);

    border-color: #a53655;

    background:
        linear-gradient(
            145deg,
            #64213a,
            #391827
        );
}

.keypad-special {
    color: #c15b75 !important;

    border-color: #64233d !important;
}


/* =========================================================
   CALL CONTROLS
   ========================================================= */

.call-controls {
    width: 100%;
    max-width: 355px;

    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 8px;

    margin-top: 9px;
}

.call-button,
.hangup-button {
    height: 43px;

    border-radius: 6px;

    font-size: 10px;
    font-weight: 900;

    letter-spacing: 1.8px;

    transition:
        transform .07s,
        filter .12s,
        opacity .15s;
}

.call-button {
    border: 1px solid #3c8d69;

    background:
        linear-gradient(
            135deg,
            #245e49,
            #307a5b
        );

    color: #f4fff9;
}

.hangup-button {
    border: 1px solid #8f304b;

    background:
        linear-gradient(
            135deg,
            #591d35,
            #76233f
        );

    color: #fff;
}

.call-button:active,
.hangup-button:active {
    transform: scale(.97);
}

.call-button:disabled,
.hangup-button:disabled {
    opacity: .32;
}


/* =========================================================
   FUNCTION ROW
   ========================================================= */

.function-row {
    width: 100%;
    max-width: 355px;

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 6px;

    margin-top: 8px;
}

.function-button {
    min-height: 48px;

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

    gap: 3px;

    border: 1px solid #2e4664;
    border-radius: 6px;

    background:
        rgba(10, 27, 47, .78);

    color: #8ea0b7;

    font-size: 7px;
    font-weight: 800;

    letter-spacing: .7px;

    transition:
        transform .07s,
        background .12s,
        border-color .12s,
        color .12s;
}

.function-button:active {
    transform: scale(.96);
}

.function-button.active {
    border-color: #a93454;

    background:
        rgba(100, 28, 53, .6);

    color: #f08aa1;
}

.function-icon {
    font-size: 16px;
    line-height: 17px;
}


/* =========================================================
   BOTTOM AREA / LOG
   ========================================================= */

.bottom-area {
    position: relative;

    width: 100%;
    max-width: 355px;

    flex: 1;
    min-height: 70px;

    margin-top: 7px;

    overflow: hidden;

    border-top: 1px solid #67233d;
    border-bottom: 1px solid #67233d;

    background:
        linear-gradient(
            180deg,
            rgba(7, 19, 35, .65),
            rgba(24, 10, 19, .72)
        );
}

.emblem-area {
    width: 100%;
    height: 100%;

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

.emblem-area img {
    width: 52px;
    height: 52px;

    object-fit: contain;

    opacity: .52;

    filter:
        drop-shadow(
            0 0 14px rgba(160, 39, 69, .35)
        );
}

.debug {
    position: absolute;

    inset: 0;

    display: none;

    padding: 7px;

    overflow-y: auto;

    background:
        rgba(4, 12, 23, .97);

    color: #8291a6;

    font-family: monospace;

    font-size: 8px;
    line-height: 1.35;

    z-index: 5;
}

.debug.active {
    display: block;
}


/* =========================================================
   ACCOUNT
   ========================================================= */

.account-row {
    width: 100%;
    max-width: 355px;

    display: flex;
    justify-content: center;

    padding-top: 6px;
}

.logout-button {
    height: 27px;

    padding: 0 20px;

    border: 1px solid #4d2635;
    border-radius: 5px;

    background: transparent;

    color: #7e6871;

    font-size: 8px;
    font-weight: 700;

    letter-spacing: 1.5px;

    transition:
        color .12s,
        border-color .12s,
        background .12s;
}

.logout-button:active {
    color: #ef7c98;

    border-color: #87314c;

    background: rgba(119, 29, 53, .2);
}


/* =========================================================
   INCOMING CALL
   ========================================================= */

#incomingCallOverlay {
    position: fixed;

    inset: 0;

    z-index: 999999;

    display: none;

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

    padding:
        calc(20px + env(safe-area-inset-top))
        20px
        calc(20px + env(safe-area-inset-bottom));

    background:
        rgba(4, 10, 20, .88);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

#incomingCallOverlay.visible {
    display: flex;
}


#incomingCallBox {
    width: min(
        380px,
        calc(100vw - 40px)
    );

    padding:
        30px
        25px
        25px;

    border:
        1px solid rgba(164, 49, 80, .75);

    border-radius: 12px;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(30, 61, 99, .55),
            transparent 55%
        ),
        linear-gradient(
            145deg,
            #0a182c,
            #101f37 55%,
            #240f1e
        );

    box-shadow:
        0 25px 80px rgba(0,0,0,.7),
        inset 0 1px 0 rgba(255,255,255,.05);

    text-align: center;

    color: #fff;
}


.incoming-emblem {
    width: 78px;
    height: 78px;

    margin:
        0 auto
        20px;

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

    border:
        1px solid rgba(164, 49, 80, .8);

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(42, 76, 119, .9),
            rgba(13, 28, 50, .95)
        );

    box-shadow:
        0 0 28px rgba(164,49,80,.25);

    animation:
        incomingPulse 1.5s infinite;
}


.incoming-emblem img {
    width: 62%;
    height: 62%;

    object-fit: contain;

    border-radius: 50%;
}


.incoming-title {
    color: #f5f7fb;

    font-size: 17px;
    font-weight: 900;

    letter-spacing: 3px;

    margin-bottom: 11px;
}


#incomingCaller {
    min-height: 25px;

    margin-bottom: 25px;

    color: #aebbd0;

    font-size: 17px;
    font-weight: 700;

    letter-spacing: 1.5px;

    word-break: break-word;
}


.incoming-line {
    width: 100%;
    height: 1px;

    margin:
        0 0
        22px;

    background:
        linear-gradient(
            90deg,
            transparent,
            #76253f,
            #b33a59,
            #76253f,
            transparent
        );
}


.incoming-buttons {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 9px;
}


.incoming-buttons button {
    height: 49px;

    border-radius: 6px;

    font-size: 9px;
    font-weight: 900;

    letter-spacing: 1.4px;

    transition:
        transform .07s,
        filter .12s,
        opacity .12s;
}


.incoming-buttons button:active {
    transform: scale(.96);
}


.incoming-buttons button:disabled {
    opacity: .4;
}


#incomingRejectButton {
    border:
        1px solid #762d45;

    background:
        linear-gradient(
            135deg,
            #381525,
            #541d32
        );

    color: #e4a0b0;
}


#incomingAcceptButton {
    border:
        1px solid #3c8d69;

    background:
        linear-gradient(
            135deg,
            #245e49,
            #307a5b
        );

    color: #f4fff9;
}


@keyframes incomingPulse {

    0% {
        box-shadow:
            0 0 0 0
            rgba(164,49,80,.35);
    }

    70% {
        box-shadow:
            0 0 0 16px
            rgba(164,49,80,0);
    }

    100% {
        box-shadow:
            0 0 0 0
            rgba(164,49,80,0);
    }

}


/* =========================================================
   DESKTOP
   ========================================================= */

@media (min-width: 700px) {

    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .app {
        width: 430px;
        height: 850px;
        max-height: 95vh;

        overflow: hidden;

        border: 1px solid #472238;
        border-radius: 24px;

        box-shadow:
            0 25px 80px rgba(0,0,0,.55);
    }

}


/* =========================================================
   SMALL HEIGHT
   ========================================================= */

@media (max-height: 700px) {

    .header {
        padding-top:
            calc(7px + env(safe-area-inset-top));

        padding-bottom: 7px;
    }

    .main-title {
        font-size: 17px;
    }

    .registration-number {
        margin-top: 3px;
    }

    .number-area {
        min-height: 51px;
    }

    .number-display {
        height: 31px;

        font-size: 25px;
        line-height: 31px;
    }

    .keypad {
        gap: 5px;
        margin-top: 2px;
    }

    .keypad button {
        min-height: 36px;
        font-size: 18px;
    }

    .call-controls {
        margin-top: 6px;
    }

    .call-button,
    .hangup-button {
        height: 37px;
    }

    .function-row {
        margin-top: 5px;
    }

    .function-button {
        min-height: 40px;
    }

    .bottom-area {
        min-height: 48px;
        margin-top: 5px;
    }

    .emblem-area img {
        width: 38px;
        height: 38px;
    }

    .account-row {
        padding-top: 3px;
    }

    #incomingCallBox {
        padding:
            22px
            20px
            20px;
    }

    .incoming-emblem {
        width: 62px;
        height: 62px;

        margin-bottom: 13px;
    }

    .incoming-title {
        font-size: 14px;
    }

    #incomingCaller {
        margin-bottom: 17px;
        font-size: 15px;
    }

}


/* =========================================================
   VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 380px) {

    .header {
        padding-left: 11px;
        padding-right: 11px;
    }

    .main-title {
        font-size: 17px;
        letter-spacing: 3px;
    }

    .status,
    .status-detail {
        font-size: 7px;
    }

    .phone {
        padding-left: 7px;
        padding-right: 7px;
    }

    .keypad,
    .call-controls,
    .function-row,
    .bottom-area,
    .account-row {
        max-width: 340px;
    }

    .keypad {
        gap: 5px;
    }

    .keypad button {
        font-size: 18px;
    }

    #incomingCallBox {
        width: calc(100vw - 28px);
        padding-left: 17px;
        padding-right: 17px;
    }

}
