:root {
  --onyx: #0d0c0b;
  --ink: #171512;
  --ivory: #f5f1e8;
  --paper: #ece5d6;
  --stone: #9a9183;
  --champ: #c6a869;
  --champ-2: #e6d3a3;
  --line: rgba(230, 211, 163, 0.22);
  --glass: rgba(16, 14, 12, 0.58);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Inter', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--onyx); color: var(--ivory); font-family: var(--sans); font-weight: 300; -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hidden { display: none !important; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; }
#cam { position: fixed; width: 1px; height: 1px; opacity: 0; left: -9px; top: -9px; pointer-events: none; }

/* ---------- frame / mat over the canvas ---------- */
.mat { position: fixed; inset: 0; pointer-events: none; z-index: 2; transition: all .6s ease; }
.mat.gallery { box-shadow: inset 0 0 0 calc(18px + var(--safe-t) * 0) #f3eee3, inset 0 0 0 19px #d9d1c0, inset 0 0 0 22px #f3eee3, inset 0 0 0 23px #2b2722, inset 0 0 40px 23px rgba(0,0,0,.35); }
.mat.gilded { box-shadow: inset 0 0 0 4px #7a5b25, inset 0 0 0 10px #c6a869, inset 0 0 0 12px #f2dfa8, inset 0 0 0 16px #9c7633, inset 0 0 0 17px #3a2a12, inset 0 0 50px 17px rgba(0,0,0,.45); }
.mat.none { box-shadow: inset 0 0 80px rgba(0,0,0,.35); }
.mat.jharokha { background: none; }
.mat.home { box-shadow: inset 0 0 0 0 transparent; background: linear-gradient(180deg, rgba(13,12,11,.55) 0%, rgba(13,12,11,0) 26%, rgba(13,12,11,0) 46%, rgba(13,12,11,.92) 82%, rgba(13,12,11,.98) 100%); }

/* ---------- top bar ---------- */
body.light-chrome .wordmark span, body.light-chrome .nav-link { color: #2b2722; }
body.light-chrome .icon-btn { color: #7a5b25; border-color: rgba(43,39,34,.25); }
.topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(16px + var(--safe-t)) 22px 12px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.wordmark { display: flex; align-items: baseline; gap: 10px; }
.wordmark span { font-family: var(--sans); font-weight: 500; letter-spacing: .42em; font-size: 13px; color: var(--ivory); }
.wordmark i { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--champ); letter-spacing: .02em; }
.topbar nav { display: flex; gap: 14px; align-items: center; }
.nav-link { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--paper); opacity: .85; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); font-size: 18px; line-height: 1; color: var(--champ-2); }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; opacity: 0; pointer-events: none; transition: opacity .6s ease; display: flex; }
.screen.show { opacity: 1; pointer-events: auto; }
.screen.passthrough { pointer-events: none; }
.screen.passthrough.show .viewer-bar { pointer-events: auto; }
.sheetlike { background: rgba(13, 12, 11, 0.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.scroll { width: 100%; max-width: 560px; margin: 0 auto; padding: calc(84px + var(--safe-t)) 28px calc(48px + var(--safe-b)); overflow-y: auto; touch-action: pan-y; }
.scroll.center { display: flex; flex-direction: column; align-items: center; text-align: center; }

.home-copy { margin-top: auto; padding: 0 28px calc(46px + var(--safe-b)); max-width: 560px; }
.eyebrow { font-size: 11px; letter-spacing: .32em; text-transform: uppercase; color: var(--champ); font-weight: 500; margin-bottom: 14px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.02; letter-spacing: -.01em; }
h1 { font-size: clamp(44px, 12.5vw, 72px); margin-bottom: 18px; }
h2 { font-size: clamp(36px, 10vw, 54px); margin-bottom: 16px; }
h3 { font-size: 30px; margin-bottom: 10px; }
h1 em, h2 em { font-style: italic; color: var(--champ-2); }
.lede { font-size: 15.5px; line-height: 1.62; color: rgba(245, 241, 232, .78); max-width: 440px; }
.fine { font-size: 12px; line-height: 1.6; color: var(--stone); margin-top: 18px; letter-spacing: .01em; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; align-items: center; }
.scroll.center .actions { justify-content: center; }

.btn { padding: 15px 26px; border-radius: 999px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; transition: transform .15s, background .3s, color .3s; }
.btn.primary { background: linear-gradient(180deg, #ecdcae, #c6a869); color: #1a140a; box-shadow: 0 10px 30px rgba(198, 168, 105, .22); }
.btn.ghost { border: 1px solid var(--line); color: var(--paper); }
.btn.small { padding: 11px 18px; font-size: 11.5px; }
.btn:active { transform: scale(.97); }

.hint-move { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.hint-move span { display: inline-block; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(13,12,11,.3); backdrop-filter: blur(6px);
  font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--paper); animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 0%,100% { opacity: .35; transform: translateX(-6px); } 50% { opacity: 1; transform: translateX(6px); } }

/* ---------- guide ---------- */
.principles { list-style: none; margin: 30px 0 10px; display: flex; flex-direction: column; gap: 22px; }
.principles li { display: grid; grid-template-columns: 64px 1fr; gap: 18px; align-items: start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.principles svg { width: 64px; height: 40px; fill: var(--champ); stroke: var(--champ); }
.principles h4 { font-family: var(--serif); font-size: 24px; font-weight: 500; margin-bottom: 4px; }
.principles p, .dos p { font-size: 14px; line-height: 1.6; color: rgba(245,241,232,.72); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.dos h5 { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; color: var(--champ); font-weight: 500; margin-bottom: 8px; }

/* ---------- assess ---------- */
.thumb-wrap { position: relative; width: 62vw; max-width: 280px; aspect-ratio: 3 / 4; border-radius: 4px; overflow: hidden; margin-bottom: 28px;
  box-shadow: 0 0 0 10px #f3eee3, 0 0 0 11px #d6cdb9, 0 30px 60px rgba(0,0,0,.5); }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanline { position: absolute; left: 0; right: 0; height: 30%; background: linear-gradient(180deg, transparent, rgba(230,211,163,.35), transparent); top: -30%; animation: scan 2.4s ease-in-out infinite; }
.done .scanline { display: none; }
@keyframes scan { to { top: 100%; } }
.progress { width: 220px; height: 2px; background: rgba(255,255,255,.12); margin: 18px auto 0; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--champ); transition: width .3s; }
.report { width: 100%; }
.score { font-family: var(--serif); font-size: 76px; line-height: 1; color: var(--champ-2); margin-bottom: 6px; }
.score small { font-size: 22px; color: var(--stone); margin-left: 6px; }
.metrics { list-style: none; margin: 26px 0 8px; text-align: left; display: flex; flex-direction: column; gap: 13px; }
.metrics li { display: grid; grid-template-columns: 112px 1fr 34px; gap: 12px; align-items: center; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--paper); }
.metrics .bar { height: 2px; background: rgba(255,255,255,.12); position: relative; }
.metrics .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--champ); transition: width 1.2s cubic-bezier(.2,.9,.2,1); width: 0; }
.metrics li.low .bar i { background: #b5645a; }
.metrics b { font-weight: 500; text-align: right; color: var(--stone); }
.advice { text-align: left; margin-top: 18px; font-size: 14px; line-height: 1.6; color: rgba(245,241,232,.78); }
.advice p { padding-left: 16px; position: relative; margin-bottom: 8px; }
.advice p::before { content: ''; position: absolute; left: 0; top: 10px; width: 6px; height: 1px; background: var(--champ); }

/* ---------- viewer ---------- */
.viewer-bar { position: absolute; left: 14px; right: 14px; bottom: calc(16px + var(--safe-b)); padding: 16px 16px 14px; border-radius: 22px;
  background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px;
  transition: opacity .4s, transform .4s; }
.viewer-bar.tucked { opacity: 0; transform: translateY(20px); pointer-events: none; }
.slider { display: flex; align-items: center; gap: 14px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--paper); }
.slider input { flex: 1; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 24px; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: rgba(230,211,163,.35); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--champ-2); margin-top: -8px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--paper); }
.chips button.on { background: rgba(230,211,163,.16); border-color: var(--champ); color: var(--champ-2); }
.row { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- collection ---------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.grid button { aspect-ratio: 3/4; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 6px #f3eee3, 0 14px 30px rgba(0,0,0,.45); margin: 6px; background: #222 center/cover; position: relative; }
.grid button span { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: left; }

/* ---------- settings / calibration ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--paper); }
.field.toggle { flex-direction: row; justify-content: space-between; align-items: center; }
.field input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--champ); }
#calib { background: rgba(13,12,11,.92); align-items: center; justify-content: center; }
.calib { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; font-size: 14px; line-height: 1.6; color: var(--paper); }
.calib-box { border: 1.5px solid var(--champ); border-radius: 12px; box-shadow: 0 0 30px rgba(198,168,105,.35); }
#calibSlider { width: 80vw; max-width: 360px; }

/* ---------- film ---------- */
.film { position: fixed; inset: 0; z-index: 50; background: rgba(13,12,11,.94); display: flex; align-items: center; justify-content: center; }
.film-inner { text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.film video { max-height: 58vh; max-width: 86vw; border-radius: 4px; box-shadow: 0 0 0 8px #f3eee3, 0 30px 60px rgba(0,0,0,.5); background: #000; }

/* ---------- status / toast ---------- */
.status { position: fixed; z-index: 31; left: 22px; bottom: calc(14px + var(--safe-b)); display: flex; gap: 8px; align-items: center; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--stone); }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--stone); }
.status.face i { background: #8fd8a8; }
.status.tilt i { background: var(--champ); }
.toast { position: fixed; z-index: 60; left: 50%; top: calc(70px + var(--safe-t)); transform: translateX(-50%) translateY(-6px); padding: 11px 20px; border-radius: 999px;
  background: rgba(23,21,18,.92); border: 1px solid var(--line); font-size: 12.5px; letter-spacing: .04em; color: var(--paper); opacity: 0; transition: all .35s; pointer-events: none; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
