/* ===== BASE ===== */
html, body {
    margin: 0;
    padding: 0;
    background: #0f0f0f;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after {
    box-sizing: border-box;
}

h1:focus {
    outline: none;
}

.app-root {
    min-height: 100dvh;
}

/* ===== LOADING ===== */
.loading-progress {
    position: absolute;
    display: block;
    width: 6rem;
    height: 6rem;
    inset: 30vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #333;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #22c55e;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    color: #888;
    inset: calc(30vh + 2.5rem) 0 auto 0;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ===== ERROR UI ===== */
#blazor-error-ui {
    background: #1a1a1a;
    border-top: 2px solid #ef4444;
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.8rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #ef4444;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: 0.5rem;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 1.5rem 2rem;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
}

.brand h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    margin: 0.25rem 0 0 0;
}

.tagline {
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: 1.5rem 0 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.settings-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 1rem;
    padding: 1.25rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

.setting-select {
    background: #252525;
    border: 1px solid #333;
    border-radius: 0.5rem;
    color: #fff;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    width: 100%;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.setting-select:focus {
    outline: none;
    border-color: #22c55e;
}

.setting-select option {
    background: #252525;
    color: #fff;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 1rem;
}

.setting-toggle input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #22c55e;
    cursor: pointer;
}

.setting-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    padding-left: 2rem;
}

.btn-start {
    margin-top: 2rem;
    width: 100%;
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border: none;
    border-radius: 0.75rem;
    background: #22c55e;
    color: #000;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-start:hover {
    background: #16a34a;
}

.btn-start:active {
    background: #15803d;
    transform: scale(0.98);
}

.info-note {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.6;
}

.info-note strong {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== ACTIVE DISPLAY ===== */
.active-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* Camera / WB */
.wb-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
}

.camera-preview {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4/3;
    border-radius: 0.75rem;
    background: #111;
    object-fit: cover;
}

.wb-reading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.wb-reading.wb-loading {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.wb-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.wb-kelvin {
    font-variant-numeric: tabular-nums;
}

.wb-separator {
    color: rgba(255, 255, 255, 0.3);
}

.wb-label-text {
    color: rgba(255, 255, 255, 0.6);
}

.wb-error {
    color: #ef4444;
    font-size: 0.875rem;
}

.wb-accuracy-note {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
}

/* Timecode */
.timecode-section {
    text-align: center;
}

.timecode {
    font-family: 'Cascadia Mono', 'JetBrains Mono', 'Fira Code', 'SF Mono', 'Consolas', 'Courier New', monospace;
    font-size: clamp(2.5rem, 13vw, 7rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #ffffff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    user-select: none;
}

.fps-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.5rem;
    font-variant-numeric: tabular-nums;
}

.btn-stop {
    margin-top: 1rem;
    padding: 0.875rem 3rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border: 2px solid #ef4444;
    border-radius: 0.75rem;
    background: transparent;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-stop:hover {
    background: #ef4444;
    color: #fff;
}

.btn-stop:active {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
    transform: scale(0.98);
}
