:root {
  --blue: #007aff;
  --label: #1c1c1e;
  --secondary: rgba(60, 60, 67, .6);
  --background: #f2f2f7;
  --card: #fff;
  --separator: rgba(60, 60, 67, .18);
  --glass: rgba(250, 250, 252, .72);
  --gutter: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--background); color: var(--label); font: 17px/1.35 var(--font); -webkit-font-smoothing: antialiased; }
#camerafeed { position: fixed; inset: 0; width: 100%; height: 100%; display: none; }
body:not([data-screen="welcome"]) #camerafeed { display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

.glass { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px); box-shadow: 0 8px 28px rgba(0, 0, 0, .14), inset 0 0 0 .5px rgba(255, 255, 255, .5); }
.primary { width: 100%; min-height: 52px; padding: 0 20px; border-radius: 14px; color: #fff; background: var(--blue); font-weight: 600; transition: transform .12s, opacity .12s; }
.primary:active { transform: scale(.98); opacity: .85; }
.primary:disabled { opacity: .45; }
.plain { width: 100%; min-height: 48px; color: var(--blue); font-weight: 500; }

/* Welcome */
.screen { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 56px) 20px calc(env(safe-area-inset-bottom) + 20px); }
body:not([data-screen="welcome"]) #welcome { display: none; }
.eyebrow { margin: 0 0 4px; color: var(--blue); font-size: 15px; font-weight: 600; }
h1 { margin: 0; font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.4px; }
.lead { margin: 10px 0 24px; color: var(--secondary); }
.group { margin: 0; padding: 0; list-style: none; border-radius: 12px; overflow: hidden; background: var(--card); }
.group li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px; border-bottom: .5px solid var(--separator); font-size: 16px; }
.group li:last-child { border-bottom: 0; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff3b30; }
.dot.blue { background: var(--blue); }
.dot.green { background: #34c759; }
.actions { display: grid; gap: 4px; margin-top: auto; padding-top: 20px; }
.actions.row { grid-template-columns: 1fr 1fr; gap: 10px; align-items: center; }

/* Lesson overlay */
#hud { position: fixed; inset: 0; z-index: 30; display: none; flex-direction: column; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) calc(env(safe-area-inset-bottom) + 14px); pointer-events: none; }
body:not([data-screen="welcome"]) #hud { display: flex; }
#hud button { pointer-events: auto; }
.grow { flex: 1; }
#topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 6px 0 16px; border-radius: 22px; font-size: 15px; font-weight: 600; }
#progress { display: flex; gap: 4px; padding: 0 4px; }
#progress span { flex: 1; height: 4px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .55); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12); }
#progress i { display: block; width: 0; height: 100%; background: var(--blue); }
#subtitle { display: none; margin: 0; padding: 12px 16px; border-radius: 16px; font-size: 17px; font-weight: 500; text-align: center; }
#subtitle.active { display: block; }
#status { display: none; margin: 0; padding: 10px 16px; border-radius: 16px; font-size: 15px; text-align: center; }
#status.active { display: block; }
#prompt:empty { display: none; }
#controls { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; border-radius: 30px; }
.icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--label); }
.icon.large { width: 52px; height: 52px; color: #fff; background: var(--blue); }
.icon:active { opacity: .55; }
.icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Sheets */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 560px; margin: 0 auto; padding: 24px 20px calc(env(safe-area-inset-bottom) + 20px); border-radius: 22px 22px 0 0; background: var(--card); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); transform: translateY(110%); transition: transform .34s cubic-bezier(.32, .72, 0, 1); }
.sheet h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.sheet p { margin: 0 0 18px; color: var(--secondary); }
body[data-screen="finish"] #finish, #report:not([hidden]) { transform: none; }
#log { max-height: 46vh; margin: 8px 0; padding: 10px; overflow: auto; border-radius: 10px; background: var(--background); font: 12px/1.45 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
