body {
    font-family: system-ui, sans-serif;
    margin: 1rem;
    background: #202124;
}

/* Dashboard layout */

.dashboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Cards */

.card-container {
    width: 85vw;
    max-width: 32rem;
}

.card {
    width: 100%;
    box-sizing: border-box;
    font-size: 1.6rem;
    line-height: 1.15;
    max-width: 32rem;
    margin: 0 auto 1rem auto;
    padding: 1.0rem 1.5rem;
    border-radius: 12px;}

.card.green { background: #f7fff7; }
.card.yellow { background: #fffdf2; }
.card.red { background: #fff7f9; }

.card h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3em;
    font-weight: bold;
}

.card p {
    margin: 0.2rem 0;
}

.cards-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Status LED */

.led {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border-radius: 50%;
}

.led.green { background: green; }
.led.yellow { background: goldenrod; }
.led.red { background: red; }

/* Drawer */

.drawer-handle {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    color: #aaa;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.telemetry-panel {
    position: relative;
    width: 95vw;
    max-width: 90vw;
    margin: -2.0rem auto 1rem auto;
    padding-top: 12px;

    max-height: 0;
    opacity: 0;
    overflow: hidden;

    transition:
        max-height 250ms ease-out,
        opacity 180ms linear,
        margin 250ms ease-out;
}

.telemetry-panel.open {
    max-height: 30rem;
    opacity: 1;
}

.telemetry-panel::before {
    content: "";

    position: absolute;
    top: 6px;
    left: var(--pointer-x, 50%);
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 3px;
    z-index: -1;
}

/* Telemetry */

pre.telemetry {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;

    font-family: ui-monospace, monospace;
    font-size: 1.0rem;
    line-height: 1.3;

    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 0.75rem;
    margin-top: 0.5rem;
    min-width: 0;
    border-radius: 12px;
}

/* Refresh spinner */

#refresh-indicator {
    position: fixed;
    top: -0.25rem;
    left: 50%;

    transform: translate(-50%, var(--pull-offset, -52px));

    opacity: 0;
    pointer-events: none;
    z-index: 1000;

    transition:
        transform 180ms ease-out,
        opacity 150ms ease;
}

#refresh-indicator.pulling {
    transition: opacity 150ms ease;
}

#refresh-indicator.visible {
    opacity: 1;
}

.spinner {
    width: 24px;
    height: 24px;

    border: 3px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;

    animation: spin .8s linear infinite;
}

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

/* Desktop layout */

@media (min-width: 800px) {
    .dashboard {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(23rem, 1fr));
        gap: 1rem;
        align-items: start;
    }

    .card {
        width: 100%;
    }

    .card-slot {
        width: fit-content;
    }

    .card-container {
        width: 24rem;
        max-width: 24rem;
        margin: 0;
    }

    .cards-row {
        flex-direction: row;
        align-items: flex-start;
    }

    .telemetry-panel::before {
        left: var(--pointer-x, 50%);
    }
    
    .telemetry-panel {
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
        margin: -2.0rem 0 1rem 0;
        padding-top: 12px;
    }

    pre.telemetry {
        font-size: 0.9rem;
    }
}
