/* Creavit Studio · Phone Camera. Same palette as the macOS recorder:
   black chrome, neutral surfaces, system blue for actions, red for live. */
:root{
  color-scheme:dark;
  --bg:#000;--surface:#111113;--surface-2:#1c1c1f;--line:#ffffff1a;
  --text:#f5f5f7;--muted:#a1a1aa;--faint:#8e8e93;
  --accent:#0a84ff;--accent-press:#0071e3;--red:#ff3b30;--amber:#ffb340;--green:#30d158;
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  background:var(--bg);color:var(--text);
  -webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg)}
body{overscroll-behavior:none}
[hidden]{display:none!important}
button{font:inherit;color:inherit;cursor:pointer;touch-action:manipulation}
button:disabled{cursor:default}
svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
b{font-weight:600}
small{display:block}

.screen{min-height:100dvh;padding:calc(env(safe-area-inset-top) + 20px) 24px calc(env(safe-area-inset-bottom) + 24px)}

/* Buttons */
.primary{width:100%;height:54px;border:0;border-radius:16px;background:var(--accent);color:#fff;font-size:17px;font-weight:650}
.primary:active{background:var(--accent-press)}
.primary:disabled{opacity:.45}
.round{width:44px;height:44px;border:0;border-radius:22px;background:#0000008c;display:grid;place-items:center;padding:0;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
.round svg{width:20px;height:20px}
.actions{display:flex;flex-direction:column;gap:10px}
.actions small{text-align:center;font-size:12px;line-height:1.45;color:var(--faint)}

/* 1 · Onboarding */
.onboarding{display:flex;flex-direction:column;gap:22px}
.brand{display:flex;align-items:center;gap:10px;font-size:15px;font-weight:650;letter-spacing:-.2px}
.logo{width:30px;height:30px;flex:none}
.hero{height:150px;border-radius:22px;background:var(--surface);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;gap:18px}
.hero-phone{width:54px;height:96px;border:2px solid var(--text);border-radius:12px;display:flex;justify-content:center;padding-top:8px}
.hero-phone span{width:10px;height:10px;border-radius:5px;background:var(--red)}
.hero-dots{display:flex;gap:6px}
.hero-dots i{width:6px;height:6px;border-radius:3px;background:#3a3a3f}
.hero-dots i:nth-child(2){background:#5a5a60}
.hero-dots i:nth-child(3){background:var(--accent)}
.hero-mac{display:flex;flex-direction:column;align-items:center}
.hero-screen{width:104px;height:66px;border:2px solid var(--text);border-radius:8px 8px 2px 2px;display:grid;place-items:center}
.hero-screen span{width:22px;height:38px;border-radius:4px;background:var(--accent)}
.hero-base{width:128px;height:6px;border-radius:0 0 6px 6px;background:var(--text)}
.intro h1{margin:0 0 10px;font-size:30px;line-height:1.12;letter-spacing:-.8px;font-weight:700}
.intro p{margin:0;font-size:15px;line-height:1.5;color:var(--muted)}
.tips{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:14px;flex-grow:1}
.tips li{display:flex;gap:14px;align-items:flex-start}
.tips b{display:block;font-size:15px;margin-bottom:2px}
.tips small{font-size:13px;line-height:1.4;color:var(--faint)}
.tip-icon{width:36px;height:36px;flex:none;border-radius:10px;background:var(--surface-2);display:grid;place-items:center;color:#cfe6ff}
.tip-icon svg{width:18px;height:18px}

/* 2 · Camera */
.camera{padding:0;height:100dvh;display:grid;grid-template-rows:minmax(0,1fr) auto;background:var(--bg);overflow:hidden}
.viewfinder-area{position:relative;min-height:0;display:flex;align-items:center;justify-content:center;background:var(--bg)}
.viewfinder{position:relative;height:100%;max-width:100%;aspect-ratio:9/16;background:var(--surface);overflow:hidden}
.viewfinder video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#000}
.placeholder{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:0 28px;text-align:center}
.placeholder b{font-size:16px}
.placeholder small{max-width:250px;font-size:13px;line-height:1.45;color:var(--faint)}
.placeholder-icon{width:64px;height:64px;border-radius:32px;background:var(--surface-2);display:grid;place-items:center;color:#cfe6ff}
.placeholder-icon svg{width:28px;height:28px;stroke-width:1.8}
.topbar{position:absolute;left:16px;right:16px;top:calc(env(safe-area-inset-top) + 12px);display:flex;align-items:center;justify-content:space-between;gap:8px}
.topbar.static{position:static}
.topbar-end{display:flex;align-items:center;gap:8px;min-width:0}
.pill,.chip,.toast{display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:17px;background:#0000008c;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);font-size:13px;font-weight:600;white-space:nowrap}
.chip{padding:0 12px;font-size:12px;color:#d8d8e0;font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis}
.dot{width:8px;height:8px;border-radius:4px;background:var(--faint);flex:none}
body[data-state=connecting] .dot,body[data-state=reconnecting] .dot{background:var(--amber);animation:pulse 1s ease-in-out infinite}
body[data-state=connected] .dot{background:var(--red)}
.pill.error{background:#3a1416}
.pill.error .dot{background:#ff6b61;animation:none}
.pill.error span:last-child{color:#ffb4ae}
.toast{position:absolute;left:50%;bottom:16px;transform:translateX(-50%);height:36px;font-size:12px;max-width:calc(100% - 32px)}
.toast svg{width:16px;height:16px;flex:none}
.toast span{overflow:hidden;text-overflow:ellipsis}
@keyframes pulse{50%{opacity:.35}}

.controls{display:flex;flex-direction:column;align-items:center;gap:16px;padding:16px 24px calc(env(safe-area-inset-bottom) + 18px);background:var(--bg)}
.segmented{display:flex;padding:3px;border-radius:19px;background:var(--surface-2)}
.segmented button{height:32px;min-width:72px;padding:0 18px;border:0;border-radius:16px;background:transparent;color:var(--muted);font-size:13px;font-weight:600}
.segmented button[aria-pressed=true]{background:var(--text);color:#000}
.segmented button:disabled{opacity:.5}
.shutter-row{width:100%;max-width:342px;display:flex;align-items:center;justify-content:space-between}
.side{width:64px;display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--faint)}
.side b{font-size:13px;font-weight:700;letter-spacing:.3px;color:var(--text)}
.side small{font-size:11px}
.side svg{width:18px;height:18px}
#network[data-quality=strong]{color:var(--green)}
#network[data-quality=fair]{color:var(--amber)}
#network[data-quality=weak]{color:#ff6b61}
#network small{color:var(--faint)}
.caption{margin:0;min-height:16px;font-size:12px;line-height:1.35;color:var(--faint);text-align:center}

/* iPhone-style record button: white ring, red disc; a red square while live. */
.shutter{position:relative;width:78px;height:78px;padding:0;border:4px solid var(--text);border-radius:50%;background:transparent;display:grid;place-items:center}
.shutter-core{width:62px;height:62px;border-radius:31px;background:var(--red);transition:width .25s ease,height .25s ease,border-radius .25s ease,transform .1s ease}
.shutter:active .shutter-core{transform:scale(.92)}
.shutter:disabled{opacity:.45}
body[data-state=connected] .shutter-core,body[data-state=reconnecting] .shutter-core{width:30px;height:30px;border-radius:8px}
body[data-state=connecting] .shutter::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:4px solid transparent;border-top-color:var(--accent);animation:spin .9s linear infinite}
body[data-state=connecting] .shutter-core{transform:scale(.86)}
@keyframes spin{to{transform:rotate(360deg)}}

/* 4 · Problem */
.problem{display:flex;flex-direction:column;gap:24px}
.problem-body{display:flex;flex-direction:column;gap:10px;padding-top:28px;flex-grow:1}
.problem-icon{width:56px;height:56px;border-radius:16px;background:#3a1416;display:grid;place-items:center;color:#ff8a80}
.problem-icon svg{width:26px;height:26px}
.problem h1{margin:6px 0 0;font-size:28px;line-height:1.15;letter-spacing:-.7px}
.problem p{margin:0;font-size:15px;line-height:1.5;color:var(--muted)}
.checklist{list-style:none;counter-reset:step;margin:14px 0 0;padding:0;border-radius:18px;background:var(--surface);border:1px solid var(--line)}
.checklist li{counter-increment:step;display:flex;gap:12px;align-items:center;padding:16px;font-size:14px;line-height:1.4}
.checklist li+li{border-top:1px solid var(--line)}
.checklist li::before{content:counter(step);width:24px;height:24px;flex:none;border-radius:12px;background:var(--surface-2);display:grid;place-items:center;font-size:12px;font-weight:700;color:#cfe6ff}
body:not([data-problem=network]) .icon-network,body[data-problem=network] .icon-camera{display:none}
body[data-problem=camera] .problem-icon,body[data-problem=generic] .problem-icon{background:var(--surface-2);color:#cfe6ff}

@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
