:root {
    --color-bg: #171717;
    --color-surface: #262626;
    --color-border: #404040;
    --color-text: #e5e5e5;
    --color-text-muted: #a3a3a3;
    --color-accent: #f59e0b;
    --color-accent-hover: #fbbf24;
    --color-danger: #ef4444;
    --color-success: #22c55e;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #171717 radial-gradient(circle at center, #262626 0%, #171717 50%, #0a0a0a 100%);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.screen {
    display: none;
    width: 100%;
    max-width: 420px;
}

.hidden {
    display: none !important;
}

.screen.active {
    display: block;
}

.card {
    background: rgba(38, 38, 38, 0.95);
    border: 1px solid rgba(82, 82, 82, 0.3);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

h1 {
    font-size: 1.3rem;
    margin: 0 0 4px;
    color: #fff;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0 0 20px;
}

.video-box {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 1 / 1;
}

.video-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-box .frame {
    position: absolute;
    inset: 12%;
    border: 3px solid var(--color-accent);
    border-radius: 12px;
    pointer-events: none;
    opacity: 0.7;
}

.status-line {
    margin-top: 16px;
    font-size: 0.9rem;
    min-height: 1.3em;
}

.status-line.ok { color: var(--color-success); }
.status-line.err { color: var(--color-danger); }
.status-line.busy { color: var(--color-accent); }

button {
    font: inherit;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-weight: 600;
}

.btn-primary {
    background: var(--color-accent);
    color: #171717;
    width: 100%;
    margin-top: 16px;
}

.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    text-decoration: underline;
    font-weight: 400;
    padding: 8px;
    margin-top: 12px;
}

.link-help {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.82rem;
    text-decoration: underline;
    margin-top: 14px;
}

.link-help:hover { color: var(--color-accent); }

.device-list {
    text-align: left;
    margin-top: 20px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.device-item .name { font-weight: 600; color: #fff; }
.device-item .meta { color: var(--color-text-muted); font-size: 0.8rem; }

.field {
    text-align: left;
    margin-top: 14px;
}

.field label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: #fff;
    font: inherit;
}

.field input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.icon-lock {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    display: block;
}

.app-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    display: block;
    object-fit: contain;
}

.top-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.top-nav button {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px;
}

.top-nav button.active {
    color: #171717;
    background: var(--color-accent);
    border-color: var(--color-accent);
}
