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

:root {
    --ink: #000000;
    --bg: #ffffff;
    --muted: #a0a0a0;
    --rule: #e8e8e8;
    --mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    padding: 56px 24px 80px;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
}

.wrap {
    max-width: 560px;
    margin: 0 auto;
}

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 56px;
}

.logo {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ts {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
}

/* ── Main status ── */
.status-block {
    margin-bottom: 48px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #27ae60;
}

.dot.offline {
    background: #e03030;
}

.dot.partial {
    background: #e08c00;
}

.dot.whitelist {
    background: #6c5ce7;
}

.dot.checking {
    background: #e08c00;
    animation: blink 1.1s ease-in-out infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.2;
    }
}

.status-label {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
}

.status-sub {
    font-size: 12px;
    color: var(--muted);
    padding-left: 24px;
}

/* ── Meta grid ── */
.meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--rule);
    border-left: 1px solid var(--rule);
    margin-bottom: 48px;
}

.meta-cell {
    padding: 18px 16px;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.meta-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 8px;
}

.meta-val {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
}

.meta-val.empty {
    color: var(--muted);
}

/* ── Services ── */
.section-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 12px;
}

.service-row {
    display: grid;
    grid-template-columns: 130px 1fr 64px 12px;
    align-items: center;
    gap: 16px;
    padding: 13px 0;
    border-bottom: 1px solid var(--rule);
}

.service-row:first-child {
    border-top: 1px solid var(--rule);
}

.svc-name {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.svc-host {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
}

.svc-ping {
    font-family: var(--mono);
    font-size: 12px;
    text-align: right;
    color: var(--ink);
}

.svc-ping.empty {
    color: var(--muted);
}

.svc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink);
    justify-self: end;
}

.svc-dot.offline {
    background: #e03030;
}

/* ── Progress bar ── */
.progress-track {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--rule);
    z-index: 50;
}

.progress-fill {
    height: 100%;
    background: var(--ink);
    width: 0%;
}

/* ── Skeleton pulse ── */
.skeleton {
    display: inline-block;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 2px;
    color: transparent;
    user-select: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

@media (max-width: 480px) {
    .meta {
        grid-template-columns: repeat(2, 1fr);
    }

    .service-row {
        grid-template-columns: 1fr 1fr 52px 12px;
    }

    .svc-name {
        font-size: 13px;
    }
}

.nav-link {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.04em;
}

.nav-link:hover {
    color: var(--ink);
}

/* ── Install PWA button ── */
.install-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    margin-right: 10px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 6px;
    cursor: pointer;
    transition: opacity .15s;
}

.install-btn:hover {
    opacity: 0.8;
}

/* ── Share button ── */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: none;
    border: 1px solid var(--rule);
    border-radius: 6px;
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.share-btn:hover {
    color: var(--ink);
    border-color: var(--muted);
}

.share-btn.copied {
    color: #27ae60;
    border-color: #27ae60;
}

/* ── Shared snapshot banner ── */
.shared-banner {
    margin-bottom: 24px;
    padding: 12px 16px;
    background: #fef9e7;
    border: 1px solid #f0e0a0;
    border-radius: 6px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.shared-banner-link {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap;
}

.shared-banner-link:hover {
    text-decoration: underline;
}

/* ── Ping chart ── */
.chart-wrap {
    margin-bottom: 48px;
}

#pingChart {
    width: 100%;
    height: 140px;
    display: block;
}

.chart-legend {
    display: flex;
    gap: 18px;
    margin-top: 10px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ink);
}

.chart-legend-dot.offline {
    background: #e03030;
}

/* ── Settings panel ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header .section-lbl {
    margin-bottom: 0;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid var(--rule);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.settings-toggle:hover,
.settings-toggle.active {
    color: var(--ink);
    border-color: var(--muted);
}

.settings-panel {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: #fafafa;
}

.settings-hint {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
}

.settings-row+.settings-row {
    border-top: 1px solid var(--rule);
}

.settings-row input[type="checkbox"] {
    accent-color: var(--ink);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-row label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    flex: 1;
    min-width: 0;
}

.settings-row .settings-host {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
}
