body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background: #152c2d;
    font-family: sans-serif;
    overflow: hidden;
    user-select: none;
}

.phone {
    perspective: 1200px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(0deg);
}

:root {
    --thickness: 16px; /* phone depth */
    --cam-thickness: 4px;
}

/* === Top segment (flip lid) === */
.top-wrapper {
    width: 220px;
    height: 320px;
    transform-style: preserve-3d;
    transform-origin: bottom center;
    transition: transform 0.3s ease-out;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    transform: rotateX(-180deg); /* start closed */
}

/* front & back faces */
.top-wrapper .front,
.top-wrapper .back {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    /* backface-visibility: hidden; */
}

.top-wrapper .front {
    display: flex;
    justify-content: flex-end;
}
.front {
    background: linear-gradient(145deg, #a14b6f, #912f5a);
    border-radius: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.3); */
    /* transform: translateZ(calc(var(--thickness) / 2)); */
}
.top-bezel {
    width: 100%;
    height: 32px;
    display: flex;
    position: absolute;
    top: 0;
    background: #7c3253;
    align-items: center;
    justify-content: center;
}
.front .via-logo {
    font-size: 8px;
    font-family: 'Unbounded', sans-serif;
    font-weight: 800;
    color: #5b253c;
}
.front .speaker-grill {
    background: radial-gradient(circle, #55223b 25%, transparent 25%) 13px 7px / 6px 6px;
    width: 80px;
    /* background-color: #1f191b38; */
    height: 100%;
    /* position: relative; */
    overflow: hidden;
}
.front .speaker-grill.left {
    left: 0;
    border-radius: 0 16px 16px 0;
    position: absolute;
}
.front .speaker-grill.center {
    width: 24px;
    height: 24px;
    border-radius: 30px;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(#c8608220, #c8608200, #c86082 106%) 12px;
    top: 4px;
    box-shadoow: inset 0 0 2px #fcd9ff80;
}
.front .speaker-grill.right {
    right: 0;
    border-radius: 16px 0 0 16px;
    position: absolute;
}
.front .screen {
    width: 192px;
    height: 256px;
    background: #0b0b0b;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 32px;
    font-weight: 500;
    font-family: "Dosis", sans-serif;
}
.screen-bed {
    width: 210px;
    height: 272px;
    border-radius: 8px;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 32px;
    font-weight: 500;
    font-family: "Dosis", sans-serif;
    margin-bottom: 8px;
    contain: content;
}
.screen-filter {
    width: 192px;
    height: 256px;
    border-radius: 4px;
    background: #ffbf6603;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 8px;
}
.screen-glass {
    width: 210px;
    height: 272px;
    border-radius: 8px;
    background: repeating-linear-gradient(45deg, #ffffff06, transparent 170px);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 32px;
    font-weight: 500;
    font-family: "Dosis", sans-serif;
    position: absolute;
    top: 0;
}
.back {
    background: linear-gradient(145deg, #8d3e60, #752a4b);
    border-radius: 0;
    transform: rotateX(180deg) translateZ(var(--thickness));
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    /* box-shadow: inset 0 2px 6px rgba(0,0,0,0.2); */
}
.back .via-logo {
    position: absolute;
    bottom: 48px;
    font-family: 'Unbounded', sans-serif;
    font-weight: 900;
    font-size: 24px;
    color: #5b253c;
    letter-spacing: 3px;
    margin-right: -3px;
}

.back .screen-bed {
    width: 192px;
    height: 160px;
    top: 30px;
    position: absolute;
    border-radius: 0 0 8px 8px;
}
.back .screen {
    width: 128px;
    height: 128px;
    background: #0b0b0b;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 32px;
    font-weight: 500;
    font-family: "Dosis", sans-serif;
}
.back .screen-filter {
    width: 128px;
    height: 128px;
    border-radius: 4px;
    background: #ffbf6603;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 16px;
}
.back .screen-glass {
    width: 192px;
    height: 160px;
    border-radius: 0 0 8px 8px;
    background: repeating-linear-gradient(45deg, #ffffff06, transparent 170px);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-size: 32px;
    font-weight: 500;
    font-family: "Dosis", sans-serif;
    position: absolute;
    top: 0;
}

/* Side walls for top */
.top-wrapper .side {
    position: absolute;
    background: #5b253c;
}
.top-wrapper .side.left {
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--thickness);
    transform: rotateY(-90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / -2));
}
.top-wrapper .side.right {
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--thickness);
    transform: rotateY(90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / 2));
}
.top-wrapper .side.top {
    left: 0;
    right: 0;
    top: 0;
    height: var(--thickness);
    transform: rotateX(90deg) translateZ(calc(var(--thickness) / 2))
    translateY(calc(var(--thickness) / -2));
}
.top-wrapper .side.bottom {
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--thickness);
    transform: rotateX(-90deg) translateZ(calc(var(--thickness) / 2))
    translateY(calc(var(--thickness) / 2));
}

/* === Hinge === */
.hinge {
    position: relative;
    height: 16px;
    width: 220px;
    transform-style: preserve-3d;
    margin: 0 auto;
}

.hinge .front,
.hinge .back,
.hinge .side {
    position: absolute;
    background: #5b253c;
    /* backface-visibility: hidden; */
}

.hinge .front,
.hinge .back {
    width: 100%;
    height: 16px;
}
/*
.hinge .front {
    transform: translateZ(calc(var(--thickness) / 2));
}
*/
.hinge .back {
    transform: rotateX(180deg) translateZ(calc(var(--thickness)));
}

.hinge .side {
    width: var(--thickness);
    height: 16px;
}

.hinge .side.left {
    left: 0;
    transform: rotateY(-90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / -2));
}

.hinge .side.right {
    right: 0;
    transform: rotateY(90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / 2));
}

.hinge .side.top {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--thickness);
    transform: rotateX(90deg) translateZ(4px)
    translateY(calc(var(--thickness) / -2));
}

/* === Bottom segment === */
.segment.bottom {
    position: relative;
    width: 220px;
    height: 304px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, #a14b6f, #912f5a);
    border-radius: 0;
    /* box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 -2px 6px rgba(0,0,0,0.2); */
    transform-style: preserve-3d;
}

/* front & back for bottom */
.segment.bottom .front,
.segment.bottom .back {
    position: absolute;
    width: 100%;
    height: 100%;
    /* backface-visibility: hidden; */
}
.segment.bottom .front {
    /* transform: translateZ(calc(var(--thickness) / 2)); */
    border-radius: 0;
}
.segment.bottom .back {
    background: #752a4b;
    border-radius: 0;
}

/* side walls for bottom */
.segment.bottom .side {
    position: absolute;
    background: #5b253c;
}
.segment.bottom .side.left {
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--thickness);
    transform: rotateY(-90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / -2));
}
.segment.bottom .side.right {
    top: 0;
    bottom: 0;
    right: 0;
    width: var(--thickness);
    transform: rotateY(90deg) translateZ(calc(var(--thickness) / 2))
    translateX(calc(var(--thickness) / 2));
}
.segment.bottom .side.top {
    left: 0;
    right: 0;
    top: 0;
    height: var(--thickness);
    transform: rotateX(90deg) translateZ(calc(var(--thickness) / 2))
    translateY(calc(var(--thickness) / -2));
}
.segment.bottom .side.bottom {
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--thickness);
    transform: rotateX(-90deg) translateZ(calc(var(--thickness) / 2))
    translateY(calc(var(--thickness) / 2));
}

.keypad-bed {
    background: linear-gradient(180deg, #5c253d40, #5c253d80);
    border-radius: 8px;
    width: 210px;
    padding: 0 0 10px 0;
    top: 6px;
    position: absolute;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
    box-shadow: inset 0 -112px 31px -17px #7b2e50cc, inset 0 0 2px #fcd9ff80, inset 0 -13px 20px 6px #fcd9ff03;
}

/* === Control row & D-pad === */
.control-row {
    width: 192px;
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    margin-top: 8px;
}
.col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}
.col span {
    /* margin: 6px 0; */
    font-size: 12px;
    padding: 4px 0;
    font-weight: bold;
    color: white;
}
.col .dot {
    font-size: 18px;
}
.col .call {
    color: #7cfc00;
}
.col .end {
    color: #ff6b6b;
}
.dpad {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(#702f4f40, #702f4f40, #702f4f 100%) 48px;
    margin: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 2px #fcd9ff80, inset 0 -13px 22px 6px #fcd9ff20;
}
.dpad button {
    position: absolute;
    background: transparent;
    height: 26px;
    width: 26px;
    border-radius: 26px;
    border: none;
    color: white;
    font-family: "Dosis", sans-serif;
    font-size: 8px;
    font-weight: 600;
    cursor: pointer;
}
.dpad .up {
    top: 0.5px;
}
.dpad .down {
    bottom: 0.5px;
}
.dpad .left {
    left: 0.5px;
}
.dpad .right {
    right: 0.5px;
}
.dpad .ok {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    padding: 0 0 2px 0;
    background: #a14b6f80;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    text-align: center;
    align-items: center;
    font-family: "Dosis", sans-serif;
    font-size: 18px;
    color: #fff;
    line-height: 1px;
    font-weight: bold;
    box-shadow: inset 0 0 2px 0 #fcd9ff80, 0 2px 15px rgb(0 0 0 / 0%), inset 0 -16px 4px -4px #fcd9ff10;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); */
}

.minikey {
    /* background: #ffffff10; */
    width: 48px;
    height: 20px;
    text-align: center;
    align-content: center;
    border-radius: 32px;
    font-family: "Dosis", sans-serif;
    font-weight: 600;
    /* box-shadow: inset 0 0 2px #fcd9ff80; */
}

/* === Keypad === */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
    /* width: 100%; */
}
.key {
    /* background: #702f4f; */
    border-radius: 8px;
    height: 32px;
    width: 46px;
    padding: 0 0 0 10px;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    color: white;
    font-family: "Dosis", sans-serif;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    /* box-shadow: inset 0 0 2px #fcd9ff80; */
}
.key small {
    font-size: 10px;
    margin-top: 2px;
}
.key:active {
    background: #a14b6f;
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.centerkey {
    padding: 0 0 0 16px;
    width: 40px;
}

.rightkey {
    display: flex;
    flex-direction: row-reverse;
    padding: 0 10px 0 0;
}

#oneKey {
    padding: 0 0 0 12px;
    width: 44px;
    gap: 6px;
}

#starKey {
    height: 26px;
    padding: 6px 0 0 10px;
}

#zeroKey {
    gap: 7px;
}

.key .material-symbols-rounded {
    font-size: 12px;
    font-variation-settings:
    "FILL" 1,
    "wght" 800,
    "GRAD" 0,
    "opsz" 48;
}
#starKey .material-symbols-rounded {
    padding-bottom: 6px;
}
#poundKey .material-symbols-rounded {
    padding-top: 1px;
    font-size: 10px;
}

small {
    opacity: 0.5;
}

.microphone {
    width: 30px;
    height: 20px;
    display: flex;
    justify-content: space-around;
    position: absolute;
    bottom: -4px;
}
.microphone > div {
    width: 4px;
    height: 16px;
    background: #5b253c;
    border-radius: 20px 20px 0 0;
}

.chin {
    position: absolute;
    width: 220px;
    height: 30px;
    transform-style: preserve-3d;
    z-index: 1;
}

.chin > div {
    position: absolute;
    background: #5b253c;
    background: linear-gradient(145deg, #8b395b, #8a2b55);
}

.chin-front,
.chin-back {
    width: 100%;
    height: 30px;
}

.chin-front {
    transform: translateZ(calc(var(--thickness)));
}

.chin-back {
    transform: rotateY(180deg) translateZ(calc(var(--thickness)));
}

.chin-top,
.chin-bottom {
    width: 100%;
    height: calc(var(--thickness) * 2);
    background: linear-gradient(168deg, #8b395b, #8a2b55) !important;
}

.chin-top {
    transform: rotateX(90deg) translateZ(calc(var(--thickness)));
}

.chin-bottom {
    transform: rotateX(-90deg) translateZ(calc(30px - var(--thickness)));
}

.chin-left,
.chin-right {
    width: calc(var(--thickness) * 2);
    height: 30px;
}

.chin-left {
    transform: rotateY(-90deg) translateZ(calc(var(--thickness)));
}

.chin-right {
    right: 0;
    transform: rotateY(90deg) translateZ(calc(var(--thickness)));
}

/* === Camera Box === */
.camera-box {
    position: absolute;
    width: 192px;
    height: 30px;
    transform-style: preserve-3d;
    z-index: 1;
    transform: translateZ(2px);
    top: 0;
}

.camera-box > div {
    position: absolute;
    background: #5e283f;
}

/* Camera elements */
.camera-sensor {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #1f1925;
    border-radius: 50%;
    top: 50%;
    left: calc(50% - 28px);
    transform: translateY(-50%);
}

/* Camera lens and flash */
.camera-lens {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #1a1a2e;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.camera-lens::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #2a3a5a;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.5);
}

.camera-flash {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ed9f55;
    border-radius: 50%;
    top: 50%;
    left: calc(50% + 20px);
    transform: translateY(-50%);
}

.camera-box-front,
.camera-box-back {
    width: 100%;
    height: 30px;
}

.camera-box-front {
    transform: translateZ(calc(var(--cam-thickness) / 2));
}

.camera-box-back {
    transform: rotateY(180deg) translateZ(calc(var(--cam-thickness) / 2));
}

.camera-box-top,
.camera-box-bottom {
    width: 100%;
    height: var(--cam-thickness);
    background: #551f36 !important;
}

.camera-box-top {
    transform: rotateX(90deg) translateZ(calc(var(--cam-thickness) / 2));
}

.camera-box-bottom {
    transform: rotateX(-90deg) translateZ(calc(28px));
}

.camera-box-left,
.camera-box-right {
    width: var(--cam-thickness);
    height: 30px;
}

.camera-box-left {
    transform: rotateY(-90deg) translateZ(calc(var(--cam-thickness) / 2));
}

.camera-box-right {
    right: 0;
    transform: rotateY(90deg) translateZ(calc(var(--cam-thickness) / 2))
}
