* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    background: black;
    color: white;
    font-family: 'Potta One', sans-serif;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#clock {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 4vw;
}

#time {
    text-align: center;
    line-height: 1;
    white-space: nowrap;
}

#date {
    text-align: center;
    line-height: 1.5;
    opacity: 0.8;
}

/* 通信状態ランプ */
#status {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    opacity: 0.6;
    pointer-events: none;
    z-index: 10;
    transition:
        background-color 0.3s ease,
        box-shadow 0.3s ease,
        opacity 0.3s ease;
}

/* 接続処理中 */
#status[data-state="connecting"] {
    background: #ffb020;
    box-shadow: 0 0 4px rgba(255, 176, 32, 0.35);
    animation: lamp-pulse 2s ease-in-out infinite;
}

/* 接続済み（WebSocket） */
#status[data-state="online"] {
    background: #3ad46a;
    box-shadow: 0 0 4px rgba(58, 212, 106, 0.4);
}

/* HTTPフォールバックで同期中 */
#status[data-state="fallback"] {
    background: #ffb020;
    box-shadow: 0 0 4px rgba(255, 176, 32, 0.35);
}

/* 未接続（ローカル時刻で表示） */
#status[data-state="offline"] {
    background: #ff4d4d;
    box-shadow: 0 0 4px rgba(255, 77, 77, 0.35);
    animation: lamp-pulse 2.4s ease-in-out infinite;
}

@keyframes lamp-pulse {
    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.2;
    }
}

@media (prefers-reduced-motion: reduce) {
    #status {
        animation: none !important;
    }
}
