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

:root {
    --bg:       #1a1a1a;
    --surface:  #242424;
    --border:   #333;
    --text:     #e8e8e8;
    --muted:    #888;
    --accent:   #e07b39;
    --green:    #4caf7d;
    --yellow:   #f0c040;
    --red:      #e05555;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--border);
    color: var(--muted);
}

.status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.status-badge.printing  { background: #1a3a28; color: var(--green); }
.status-badge.printing .dot  { background: var(--green); animation: pulse 1.5s infinite; }
.status-badge.paused    { background: #3a3010; color: var(--yellow); }
.status-badge.paused .dot    { background: var(--yellow); }
.status-badge.error     { background: #3a1010; color: var(--red); }
.status-badge.error .dot     { background: var(--red); }
.status-badge.offline   { opacity: 0.5; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Layout ──────────────────────────────────────── */
main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

@media (max-width: 800px) {
    main { grid-template-columns: 1fr; }
}

/* ── Webcam ──────────────────────────────────────── */
.webcam-wrap {
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 16/9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webcam-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.webcam-offline {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ── Stats Panel ─────────────────────────────────── */
.stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.card-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

/* Temps */
.temp-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.temp-row:last-child { margin-bottom: 0; }

.temp-name {
    font-size: 0.85rem;
    color: var(--muted);
}

.temp-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.temp-value.warning { color: var(--yellow); }

.temp-target {
    font-size: 0.8rem;
    color: var(--muted);
    margin-left: 0.25rem;
}

/* Progress */
.filename {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.75rem;
}

.no-print {
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
}

.progress-bar-wrap {
    background: var(--border);
    border-radius: 4px;
    height: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 1s ease;
}

.progress-pct {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.time-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--muted);
}

.time-row span:last-child { text-align: right; }

/* Connection notice */
.reconnecting {
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted);
    padding: 0.5rem;
    animation: fade 1s ease infinite alternate;
}

@keyframes fade { from { opacity: 0.4; } to { opacity: 1; } }
