:root { color-scheme: dark; font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text",system-ui,sans-serif; background:#05070a; color:#f5f7fa; }
* { box-sizing:border-box; }
html,body { margin:0; min-height:100%; background:#05070a; }
body { min-height:100dvh; }
button,.button,input { font:inherit; }
button,.button { border:1px solid #3a4350; color:#f5f7fa; background:#141a22; border-radius:12px; padding:12px 16px; text-decoration:none; text-align:center; }
button:disabled { opacity:.45; }
button.primary,.button.primary { background:#f4f6f8; color:#05070a; border-color:#f4f6f8; font-weight:700; }
.topbar { position:fixed; z-index:20; top:0; left:0; right:0; height:calc(54px + env(safe-area-inset-top)); padding:calc(8px + env(safe-area-inset-top)) 14px 8px; display:flex; align-items:center; justify-content:space-between; background:rgba(5,7,10,.82); backdrop-filter:blur(16px); border-bottom:1px solid #232a33; }
.badge { display:inline-block; margin-left:8px; padding:2px 7px; border-radius:999px; font-size:11px; background:#252c36; }
.icon-btn { width:38px; height:38px; padding:0; }
main { padding:calc(70px + env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom)); }
.view.hidden { display:none !important; }
.card { max-width:720px; margin:0 auto 14px; border:1px solid #252c36; background:#0e131a; border-radius:18px; padding:18px; }
.card.subtle { background:#0a0e13; }
h1 { margin:.1em 0 .5em; font-size:26px; }
p { color:#b7c0cb; line-height:1.45; }
label { display:grid; gap:7px; margin:16px 0; color:#cbd2da; }
input { width:100%; padding:13px 14px; border-radius:11px; border:1px solid #394351; background:#080b0f; color:#fff; }
.actions { display:grid; gap:10px; }
.error { color:#ff8b8b; }
pre { white-space:pre-wrap; word-break:break-word; font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; background:#070a0e; border:1px solid #232a33; border-radius:12px; padding:12px; max-height:45vh; overflow:auto; }
.progress { height:6px; overflow:hidden; border-radius:999px; background:#252c36; }
.progress.big { height:10px; margin:18px 0; }
.progress i { display:block; width:0%; height:100%; background:#f4f6f8; transition:width .2s linear; }
.capture-view { position:fixed; inset:0; z-index:30; background:#000; display:block; }
#cameraPreview { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
#guideCanvas { position:absolute; inset:0; width:100%; height:100%; }
.capture-hud { position:absolute; z-index:3; left:12px; right:12px; top:calc(12px + env(safe-area-inset-top)); padding:10px 12px; background:rgba(0,0,0,.58); border-radius:14px; backdrop-filter:blur(10px); }
.hud-row { display:flex; justify-content:space-between; font-size:13px; margin-bottom:6px; }
#targetText { font-size:13px; margin-bottom:8px; }
.capture-controls { position:absolute; z-index:3; left:0; right:0; bottom:0; padding:18px 14px calc(18px + env(safe-area-inset-bottom)); display:grid; grid-template-columns:1fr 84px 1fr; align-items:center; gap:14px; background:linear-gradient(transparent,rgba(0,0,0,.8)); }
.shutter { width:78px; height:78px; border-radius:50%; border:5px solid white; background:rgba(255,255,255,.18); padding:0; justify-self:center; box-shadow:inset 0 0 0 4px #0006; }
.shutter:active { transform:scale(.94); }
@media (min-width:700px) { .actions { grid-template-columns:repeat(3,1fr); } }
code { font: .92em ui-monospace,SFMono-Regular,Menlo,monospace; color:#eef2f6; }
.hint { font-size:13px; color:#8f9aa7; }
.system-info { display:grid; gap:8px; margin:16px 0; }
.system-info div { display:flex; gap:14px; justify-content:space-between; border-bottom:1px solid #252c36; padding:8px 0; }
.system-info dt { color:#8f9aa7; }
.system-info dd { margin:0; text-align:right; }
input[type="file"] { padding:10px; }

.hidden { display:none !important; }
.update-notice { border-color:#806b2f; background:#211b0c; color:#ffe6a3; font-size:14px; line-height:1.4; }
#systemWorker { max-width:58%; overflow-wrap:anywhere; font-size:12px; }

/* 0.3.4 capture guidance */
#captureHint { font-size:12px; color:#d8dee6; margin:2px 0 8px; min-height:1.2em; }
#captureFlash { position:absolute; inset:0; z-index:4; pointer-events:none; background:white; opacity:0; }
#captureFlash.flash { animation:capture-flash .24s ease-out; }
@keyframes capture-flash { 0%{opacity:.72} 100%{opacity:0} }
.capture-calibration { position:absolute; z-index:6; inset:0; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.56); backdrop-filter:blur(6px); }
.capture-calibration>div { width:min(92vw,420px); padding:20px; border:1px solid rgba(255,255,255,.22); border-radius:20px; background:rgba(10,14,19,.94); box-shadow:0 14px 60px rgba(0,0,0,.45); }
.capture-calibration strong { display:block; font-size:21px; margin-bottom:8px; }
.capture-calibration p { margin:0 0 16px; color:#d2d8df; }
.capture-calibration button { width:100%; }
.capture-hud { pointer-events:none; }
.capture-controls button { pointer-events:auto; }

/* 0.3.4 tolerant capture guidance */
.direction-guide { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; margin:2px 0 8px; }
.direction-pill { display:block; min-width:0; padding:7px 8px; border:1px solid rgba(255,255,255,.16); border-radius:10px; background:rgba(255,255,255,.07); color:#eef2f6; font-size:12px; font-variant-numeric:tabular-nums; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.direction-pill.good { color:#aaf3c5; border-color:rgba(102,232,154,.5); background:rgba(67,164,103,.16); }
.direction-pill.warn { color:#ffe29a; border-color:rgba(255,205,55,.42); background:rgba(180,136,23,.15); }
.direction-pill.bad { color:#ffb5b5; border-color:rgba(255,125,125,.42); background:rgba(170,55,55,.15); }
@media (max-width:390px) { .direction-pill { font-size:11px; padding:6px 5px; } }

/* 0.4.0 app-style navigation and result preview */
.topbar-title { min-width:0; display:flex; align-items:center; gap:6px; }
.topbar-title strong { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:42vw; }
.wake-btn { padding:8px 10px; border-radius:999px; font-size:12px; white-space:nowrap; }
main { padding-bottom:calc(92px + env(safe-area-inset-bottom)); }
.app-nav { position:fixed; z-index:25; left:0; right:0; bottom:0; height:calc(68px + env(safe-area-inset-bottom)); padding:6px 8px calc(6px + env(safe-area-inset-bottom)); display:grid; grid-template-columns:repeat(3,1fr); gap:4px; background:rgba(5,7,10,.92); backdrop-filter:blur(18px); border-top:1px solid #252c36; }
.app-nav button { border:0; background:transparent; color:#8f9aa7; border-radius:12px; padding:4px 2px; display:grid; place-items:center; gap:1px; }
.app-nav button span { font-size:22px; line-height:1; }
.app-nav button small { font-size:10px; }
.app-nav button.active { color:#fff; background:#171d25; }
.app-nav button:disabled { opacity:.28; }
body.capture-mode .topbar, body.capture-mode .app-nav { display:none !important; }
body.capture-mode main { padding:0; }
body.auth-mode .app-nav { display:none !important; }
.hero-card { padding-top:22px; padding-bottom:22px; }
.result-card { max-width:860px; }
.result-preview { overflow:hidden; border-radius:14px; border:1px solid #252c36; background:#020304; aspect-ratio:2/1; margin:16px 0; }
.result-preview img { width:100%; height:100%; object-fit:contain; display:block; background:#020304; }
.result-actions { grid-template-columns:1fr; }
h2 { margin:.15em 0 .55em; font-size:20px; }
@media (min-width:700px) {
  .result-actions { grid-template-columns:1fr 1fr; }
  .home-actions { grid-template-columns:1fr 1fr; }
}

/* 0.4.4 server storage management */
.server-storage-actions { grid-template-columns:1fr; margin-bottom:12px; }
.server-project-list { display:grid; gap:8px; }
.server-project-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:center; padding:11px 12px; border:1px solid #252c36; border-radius:12px; background:#090d12; }
.server-project-row strong { display:block; font-size:13px; }
.server-project-row small { display:block; margin-top:3px; color:#8f9aa7; line-height:1.35; }
.server-project-row button { padding:8px 10px; font-size:12px; }
.server-project-row.current { border-color:#5b6674; background:#111821; }
@media (min-width:700px) { .server-storage-actions { grid-template-columns:1fr 1fr; } }

/* 0.4.4: quiet processing UX */
.loading-overlay{position:fixed;inset:0;z-index:90;background:rgba(5,7,10,.94);backdrop-filter:blur(18px);display:grid;place-items:center;padding:22px}.loading-card{width:min(520px,100%);text-align:center}.loading-card .spinner{margin:0 auto 18px;width:42px;height:42px;border:4px solid #303945;border-top-color:#fff;border-radius:50%;animation:ps-spin .8s linear infinite}.loading-card h2{margin:.2rem 0 .45rem}.loading-card p{color:#aab4bf;min-height:2.5em}.loading-card .progress{margin:16px 0}.loading-tech{text-align:left;margin-top:16px}.loading-tech pre{max-height:32vh;overflow:auto}.tech-details{margin-top:12px;border:1px solid #252d37;border-radius:12px;padding:9px 11px}.tech-details summary{cursor:pointer;color:#aeb8c3;font-size:.92rem}.tech-details pre{margin:.7rem 0 0;white-space:pre-wrap;overflow:auto;max-height:300px}.hidden{display:none!important}@keyframes ps-spin{to{transform:rotate(360deg)}}

/* 0.4.4 local project archive / trash */
.compact-head{margin-bottom:10px}.compact-head h2{margin-bottom:.2rem}.compact-head p{margin:0}
.local-project-list{display:grid;gap:9px}.local-project-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px;border:1px solid #252c36;border-radius:13px;background:#090d12}.local-project-row strong{display:block;font-size:14px}.local-project-row small{display:block;margin-top:4px;color:#8f9aa7;line-height:1.35;overflow-wrap:anywhere}.local-project-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}.local-project-actions button{padding:8px 10px;font-size:12px}.local-project-actions .danger{border-color:#653d42;color:#ffb1b1;background:#241115}.trash-expiry{color:#d1aa68!important}.local-trash-card>summary{cursor:pointer;display:flex;gap:8px;align-items:center;list-style:none}.local-trash-card>summary::-webkit-details-marker{display:none}.local-trash-card>summary:after{content:'›';margin-left:auto;transform:rotate(90deg);transition:transform .15s}.local-trash-card[open]>summary:after{transform:rotate(-90deg)}.local-trash-card .local-project-list{margin-top:12px}.badge{display:inline-flex;align-items:center;justify-content:center;min-width:24px;height:22px;padding:0 7px;border-radius:999px;background:#1d2530;color:#dfe5ec;font-size:11px}
@media(max-width:560px){.local-project-row{grid-template-columns:1fr}.local-project-actions{justify-content:flex-start}}
.compact-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
