* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #172033;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(22, 163, 74, .12), transparent 28%),
        #eef4fb;
}

.grid {
    width: min(1500px, 95%);
    margin: 0 auto 40px;
    padding-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
    gap: 28px 22px;
    align-items: start;
}

.device-card {
    padding: 18px 14px 24px;
    border-radius: 28px;
    background: rgba(255,255,255,.82);
    border: 1px solid #dbe5f0;
    box-shadow: 0 18px 48px rgba(15,23,42,.09);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.device-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.device-number {
    min-width: 48px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.device-header strong {
    flex: 1;
    min-width: 180px;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
}

.device-header a {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    background: #16a34a;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.device-header a:hover {
    background: #15803d;
}

.phone-device {
    position: relative;
    width: 395px;
    height: 820px;
    border-radius: 50px;
    padding: 10px;
    background:
        linear-gradient(145deg, #111827, #020617 55%, #0f172a);
    box-shadow:
        0 28px 60px rgba(2,6,23,.32),
        inset 0 0 0 1px rgba(255,255,255,.08);
}

.phone-device::before {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 48px;
    border: 1px solid rgba(255,255,255,.08);
    pointer-events: none;
}

.phone-glass {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 42px;
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.side-button {
    position: absolute;
    left: -3px;
    width: 4px;
    border-radius: 3px 0 0 3px;
    background: linear-gradient(to bottom, #475569, #111827);
}

.side-button-1 {
    top: 150px;
    height: 46px;
}

.side-button-2 {
    top: 215px;
    height: 66px;
}

.side-button-3 {
    top: 298px;
    height: 66px;
}

.dynamic-island {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 32px;
    border-radius: 999px;
    background: #000;
    z-index: 5;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.phone-status {
    position: absolute;
    top: 18px;
    left: 16px;
    right: 16px;
    z-index: 4;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}

.phone-browser {
    position: absolute;
    top: 56px;
    left: 12px;
    right: 12px;
    height: 42px;
    z-index: 4;
    border-radius: 14px;
    background: rgba(255,255,255,.96);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #cbd5e1;
    flex: 0 0 auto;
}

.address {
    flex: 1;
    min-width: 0;
    margin-left: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.phone-screen {
    position: absolute;
    top: 104px;
    left: 0;
    right: 0;
    bottom: 24px;
    background: #fff;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    contain: layout paint style;
    isolation: isolate;
    transform: translateZ(0);
}

.phone-screen::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.phone-loader,
.phone-error {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 28px;
    color: #475569;
    background: #fff;
}

.phone-loader span {
    width: 42px;
    height: 42px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.phone-loader p,
.phone-error p {
    margin: 14px 0 0;
    font-size: 14px;
    line-height: 1.5;
}

.phone-error button {
    margin-top: 16px;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    background: #2563eb;
    font-weight: 800;
    cursor: pointer;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.home-line {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,.88);
    z-index: 4;
}

@media (max-width: 520px) {
    .grid {
        width: 100%;
        padding: 0 10px;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .device-card {
        padding: 14px 8px 20px;
    }

    .phone-device {
        width: min(100%, 395px);
        height: 760px;
    }
}
