:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5d6576;
    --border: #d8dce3;
    --accent: #1f5fbf;
    --accent-hover: #184c99;
    --error-bg: #fdecec;
    --error-text: #8a1f1f;
    --ok-bg: #e8f5ec;
    --ok-text: #1d5e33;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1b2029;
        --text: #e6e9ef;
        --muted: #9aa3b2;
        --border: #313847;
        --accent: #6aa1ff;
        --accent-hover: #8ab6ff;
        --error-bg: #3a1d1f;
        --error-text: #ffb4b4;
        --ok-bg: #1b3326;
        --ok-text: #a6e3b8;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 "Segoe UI", "Noto Sans Armenian", "Noto Sans", system-ui, sans-serif;
}

.site-header {
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 16px 16px;
}

.brand { font-weight: 700; font-size: 20px; color: var(--text); text-decoration: none; }
.brand span { font-weight: 400; color: var(--muted); }

.signout { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
    width: calc(100% - 32px);
    max-width: 408px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
}

h1 { font-size: 22px; margin: 0 0 8px; }
p { margin: 0 0 16px; }
.lead { color: var(--muted); }

.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.hint { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

input[type=email], input[type=password], input[type=text] {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

input:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

.button {
    width: 100%;
    padding: 11px 16px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.button:hover { background: var(--accent-hover); }

.link-button {
    padding: 0;
    font: inherit;
    color: var(--accent);
    background: none;
    border: 0;
    cursor: pointer;
}

a { color: var(--accent); }

.links { margin-top: 20px; font-size: 14px; display: grid; gap: 6px; }

.field-error { display: block; color: var(--error-text); font-size: 13px; margin-top: 4px; }

.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); }
.validation-summary-valid { display: none; }

.site-footer { margin: 24px 0; font-size: 13px; color: var(--muted); }

.button-link { display: block; text-align: center; text-decoration: none; }
.button-danger { background: #b42318; }
.button-danger:hover { background: #8f1c13; }
a.danger { color: #b42318; }

@media (prefers-color-scheme: dark) {
    a.danger { color: #ff8a80; }
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    background: var(--border);
    color: var(--text);
}
.badge-on { background: var(--ok-bg); color: var(--ok-text); }

.actions { display: grid; gap: 8px; margin: 16px 0; font-size: 15px; }

.setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    margin: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.setting .badge { margin-left: 8px; }

.steps { padding-left: 20px; }
.steps li { margin-bottom: 14px; }

/* Black on white in both themes: scanners expect it. */
.qr {
    width: 200px;
    max-width: 100%;
    margin: 10px 0;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
}
.qr svg { display: block; width: 100%; height: auto; }

.key {
    display: block;
    margin-top: 6px;
    padding: 8px 10px;
    font: 15px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 0.04em;
    word-break: break-all;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}

h2 { font-size: 17px; margin: 24px 0 8px; }

.banner-warning {
    width: calc(100% - 32px);
    max-width: 408px;
    margin-bottom: 12px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--error-text);
    background: var(--error-bg);
    border-radius: 10px;
}

.events { margin: 0 0 16px; padding: 0; list-style: none; }
.events li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.events .hint { display: block; }
.event-new { font-weight: 600; }

.challenge, textarea.response {
    width: 100%;
    margin: 8px 0 0;
    padding: 10px;
    font: 13px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 16px;
    margin: 0 0 20px;
    padding: 14px;
    list-style: none;
    font: 15px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
