/* Zoom Cycle web kiosk. Brand tokens mirror iOS/kiosk BrandColor.swift. */
:root {
    --accent: #F04C23;
    --bg: #FAF9F0;
    --surface: #FFFFFF;
    --border: #E7E5DC;
    --ink: #131346;
    --ink-2: #55556E;
    --success: #16A34A;
    --danger: #EF4444;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0E0E22; --surface: #1A1A3A; --border: #2C2C4E; --ink: #FAF9F0; --ink-2: #B6B6CC;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] { --bg: #0E0E22; --surface: #1A1A3A; --border: #2C2C4E; --ink: #FAF9F0; --ink-2: #B6B6CC; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
    background: var(--bg); color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
    overscroll-behavior: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
#app { position: fixed; inset: 0; }

/* ---- Layers ---- */
.k-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.k-center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; max-width: 640px; }
.k-fade { animation: kFade .25s ease; }
@keyframes kFade { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }

/* Camera */
.k-cam { position: absolute; inset: 0; background: #000; }
.k-cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }   /* front camera: mirror like a mirror */
.k-cam::after { content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.25) 50%, rgba(0,0,0,.55)); }

/* ---- Landing ---- */
.k-logo { width: 96px; height: 96px; color: var(--accent); }
.k-title { font-size: 40px; font-weight: 800; margin: 0; letter-spacing: -.5px; }
.k-hint { font-size: 19px; color: var(--ink-2); margin: 0; max-width: 540px; line-height: 1.4; }
.k-cta { display: inline-flex; align-items: center; justify-content: center; gap: 16px;
    width: min(460px, 86vw); height: 104px; border: 0; border-radius: 26px;
    background: var(--accent); color: #fff; font-size: 36px; font-weight: 800;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 40%, transparent); }
.k-cta svg { width: 44px; height: 44px; }
.k-cta:active { transform: scale(.98); }
.k-secondary { height: 60px; padding: 0 28px; border-radius: 16px; background: transparent;
    border: 2px solid var(--accent); color: var(--accent); font-size: 21px; font-weight: 700; }

/* ---- Scan prompt (over camera) ---- */
.k-scan { color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.5); position: relative; z-index: 1; }
.k-scan svg { width: 128px; height: 128px; }
.k-scan .k-title { font-size: 44px; color: #fff; }
.k-scan .k-hint { color: rgba(255,255,255,.88); font-size: 21px; }
.k-countdown { font-size: 15px; color: rgba(255,255,255,.7); }

/* ---- Result cards ---- */
.k-card { position: relative; z-index: 1; width: min(620px, 92vw); padding: 44px 40px; border-radius: 28px;
    background: var(--surface); color: var(--ink); text-align: center;
    border: 2px solid color-mix(in srgb, var(--tint, var(--accent)) 40%, transparent);
    box-shadow: 0 12px 40px rgba(0,0,0,.28); display: flex; flex-direction: column; align-items: center; gap: 16px; }
.k-card .k-ico { width: 104px; height: 104px; color: var(--tint, var(--accent)); }
.k-card h2 { font-size: 38px; margin: 0; font-weight: 800; }
.k-card .k-name { font-size: 28px; font-weight: 600; color: var(--ink-2); }
.k-card .k-line { font-size: 21px; color: var(--ink-2); line-height: 1.4; }
.k-card .k-msg { font-size: 29px; font-weight: 700; line-height: 1.3; }
.k-tap-hint { font-size: 14px; color: var(--ink-2); opacity: .7; }

.k-spinner { width: 72px; height: 72px; border-radius: 50%; border: 6px solid rgba(255,255,255,.25); border-top-color: #fff;
    animation: kSpin .9s linear infinite; position: relative; z-index: 1; }
.k-spinner.on-light { border-color: var(--border); border-top-color: var(--accent); }
@keyframes kSpin { to { transform: rotate(360deg); } }

/* ---- Pick list ---- */
.k-pick { position: relative; z-index: 1; width: min(560px, 92vw); max-height: 88vh; overflow-y: auto; padding: 32px; border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    display: flex; flex-direction: column; gap: 16px; }
.k-pick h2 { margin: 0 0 4px; font-size: 32px; text-align: center; }
.k-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 20px 22px; border-radius: 16px;
    background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.k-opt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.k-opt-time { font-size: 27px; font-weight: 700; }
.k-opt-class { font-size: 18px; color: var(--ink-2); }
.k-opt-method { font-size: 16px; font-weight: 700; color: var(--accent); }
.k-opt-due { font-size: 15px; font-weight: 700; color: var(--danger); }
.k-opt.is-blocked { opacity: .55; }
.k-opt.is-blocked .k-opt-method { color: var(--ink-2); }
.k-opt svg { width: 26px; height: 26px; color: var(--ink-2); flex: 0 0 auto; }
.k-opt.is-blocked svg { color: var(--danger); }
.k-pick .k-secondary { align-self: center; margin-top: 6px; }

/* ---- Forms (enroll, sign-up) ---- */
.k-form-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); }
.k-form-head { padding: max(24px, env(safe-area-inset-top)) 32px 8px; }
.k-form-head h1 { margin: 0 0 6px; font-size: 32px; }
.k-form-head p { margin: 0; font-size: 18px; color: var(--ink-2); }
.k-form-head .k-held { margin-top: 8px; font-size: 16px; font-weight: 700; color: var(--accent); }
.k-form-body { flex: 1; overflow-y: auto; padding: 20px 32px; display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; }
.k-row2 { display: flex; gap: 14px; }
.k-row2 > * { flex: 1; min-width: 0; }
.k-field { display: flex; flex-direction: column; gap: 6px; }
.k-field span { font-size: 15px; font-weight: 700; color: var(--ink-2); }
.k-input { height: 58px; padding: 0 16px; font-size: 21px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--ink); outline: none; width: 100%; }
.k-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.k-form-foot { display: flex; gap: 14px; padding: 18px 32px max(18px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.k-btn { flex: 1; height: 64px; border-radius: 16px; font-size: 21px; font-weight: 800; border: 0; }
.k-btn-primary { background: var(--accent); color: #fff; }
.k-btn-primary:disabled { background: var(--border); color: #fff; }
.k-btn-ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); font-weight: 700; }
.k-error { color: var(--danger); font-size: 16px; font-weight: 600; min-height: 1.2em; text-align: center; }

.k-enroll { width: min(460px, 90vw); display: flex; flex-direction: column; gap: 18px; align-items: stretch; text-align: center; }
.k-enroll .k-input { text-transform: uppercase; letter-spacing: 3px; text-align: center; font-size: 26px; }
.k-enroll .k-btn { flex: none; }
.k-small { font-size: 14px; color: var(--ink-2); line-height: 1.5; }

/* Disclosure */
.k-disc p { font-size: 18px; line-height: 1.5; margin: 0; }
.k-disc ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.k-disc li { display: flex; gap: 12px; font-size: 17px; line-height: 1.45; color: var(--ink-2); }
.k-disc li::before { content: ''; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 9px; }
.k-disc h3 { margin: 6px 0 4px; font-size: 19px; }
.k-disc .k-sub { color: var(--ink-2); font-size: 17px; }

/* ---- Chrome: language, name, env, offline, sleep ---- */
.k-lang { position: absolute; z-index: 5; top: max(20px, env(safe-area-inset-top)); right: max(28px, env(safe-area-inset-right)); display: flex; gap: 14px; }
.k-flag { width: 52px; height: 52px; padding: 0; border-radius: 50%; overflow: hidden; border: 2px solid rgba(128,128,128,.6);
    opacity: .55; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.k-flag img { width: 100%; height: 100%; object-fit: cover; display: block; }
.k-flag.is-on { opacity: 1; border: 4px solid var(--accent); }
.k-footer { position: absolute; z-index: 4; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); text-align: center;
    font-size: 13px; font-weight: 500; color: color-mix(in srgb, var(--ink-2) 55%, transparent); pointer-events: auto; }
.k-footer.on-camera { color: rgba(255,255,255,.4); }
.k-env { position: absolute; z-index: 6; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); padding: 5px 10px; border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 85%, transparent); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.k-offline { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.k-offline svg, .k-paused svg { width: 84px; height: 84px; color: var(--ink-2); }
.k-paused h1, .k-offline h1 { font-size: 30px; margin: 0; line-height: 1.3; }
.k-paused p, .k-offline p { font-size: 18px; color: var(--ink-2); margin: 0; line-height: 1.4; }

.k-sleep { background: #000; color: #2c2c38; flex-direction: column; gap: 14px; }
.k-sleep .k-clock { font-size: 120px; font-weight: 200; letter-spacing: -2px; color: #3a3a4a; font-variant-numeric: tabular-nums; }
.k-sleep .k-sleep-hint { font-size: 20px; color: #34343f; text-align: center; line-height: 1.5; }
body.is-sleeping { background: #000; }

/* Diagnostics (5 taps on the kiosk name) */
.k-diag { position: absolute; z-index: 60; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 92vw);
    background: var(--surface); color: var(--ink); border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.k-diag h2 { margin: 0 0 12px; font-size: 20px; }
.k-diag dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0 0 14px; font-size: 15px; }
.k-diag dt { color: var(--ink-2); }
.k-diag dd { margin: 0; font-weight: 600; word-break: break-all; }
.k-diag .k-btn { height: 52px; font-size: 17px; }
.k-diag-acts { display: flex; gap: 10px; flex-wrap: wrap; }
