:root {
  --navy: #0B4A8B;
  --navy-d: #083A6E;
  --navy-l: #E7EEF7;
  --navy-t: #0B3A6E;
  --bg: #F4F6F9;
  --border: #DDE2E9;
  --muted: #5B6576;
  --ok: #1B7A3E;
  --ok-bg: #F1F9F3;
  --ok-b: #8BCB9E;
  --warn: #D97706;
  --warn-t: #8A3F06;
  --warn-bg: #FDF0E3;
  --danger: #B42318;
  --danger-t: #9B1C14;
  --danger-bg: #FBF3F2;
  --cam: #2A2E35;
  --cam-panel: rgba(8, 34, 64, 0.88);
  --cover: #2F80ED;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #000; color: var(--navy-t);
  font-family: Roboto, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

#app { position: fixed; inset: 0; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.page { background: var(--bg); z-index: 2; }

/* ---------- Kamera ---------- */
.camera { background: var(--cam); color: #fff; z-index: 1; }
.cam-view { position: relative; flex: 1; overflow: hidden; background: #000; }
#preview, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#preview { object-fit: contain; }
#overlay { pointer-events: none; }

.cam-top {
  position: absolute; left: 12px; right: 12px; top: calc(var(--sat) + 12px);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.info-panel {
  pointer-events: auto; background: var(--cam-panel); border-radius: 16px;
  padding: 10px 10px 10px 6px; display: flex; gap: 8px; align-items: center;
}
.info-text { flex: 1; min-width: 0; }
.info-title { font-weight: 700; font-size: 16px; }
.info-hint { font-size: 13px; opacity: .85; margin-top: 2px; line-height: 1.3; }
#minimap { width: 96px; height: 64px; border-radius: 8px; background: rgba(0,0,0,.35); flex: none; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 0; background: transparent; color: inherit;
  display: grid; place-items: center; border-radius: 12px;
}
.icon-btn svg { width: 24px; height: 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--cam-panel); color: #fff; font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
}
.chip.rec i { width: 8px; height: 8px; border-radius: 50%; background: #E5484D; animation: blink 1s infinite; }
.chip.warn { background: var(--warn-bg); color: var(--warn-t); }
@keyframes blink { 50% { opacity: .2; } }

.cam-bar {
  background: var(--cam); height: calc(124px + var(--sab)); padding: 0 16px var(--sab);
  display: grid; grid-template-columns: 1fr 88px 1fr; align-items: center;
}
.shutter {
  width: 88px; height: 88px; border-radius: 50%; border: 5px solid #fff; background: transparent;
  display: grid; place-items: center; padding: 0;
}
.shutter-inner {
  width: 66px; height: 66px; border-radius: 50%; background: #E5484D;
  transition: width .18s, height .18s, border-radius .18s;
}
.shutter:disabled { opacity: .4; }
.is-recording .shutter-inner { width: 32px; height: 32px; border-radius: 8px; }
.bar-left, .bar-right { display: flex; justify-content: space-evenly; width: 100%; }
.bar-left .bar-side, .bar-right .bar-side { min-width: 60px; }
.bar-side span { text-align: center; line-height: 1.2; max-width: 76px; }
/* Yansıma denemesi: kayıt yok, yalnız kapak / yansıma etiketi ve kilitli dolap çerçevesi */
.glare-test .shutter { visibility: hidden; }
.glare-test #chip-clips, .glare-test #chip-time, .glare-test #chip-rec, .glare-test #chip-speed, .glare-test #chip-det,
.glare-test #speedo, .glare-test #minimap, .glare-test #guide, .glare-test #coach, .glare-test #dbg,
.glare-test #doorsteps, .glare-test #doorflash, .glare-test #doorask { display: none !important; }
.bar-side[aria-pressed="true"] svg { background: #0B4A8B; box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.bar-side {
  justify-self: center; background: none; border: 0; color: #fff; min-width: 72px; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 13px;
}
.bar-side svg { width: 26px; height: 26px; }
.bar-side:disabled { opacity: .35; }

.cam-error {
  position: absolute; inset: 0; background: var(--cam); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; padding: 32px; text-align: center;
}
.cam-error svg { width: 48px; height: 48px; opacity: .7; }
.cam-error-title { font-size: 18px; font-weight: 700; }
.cam-error-text { font-size: 14px; opacity: .8; max-width: 320px; line-height: 1.4; margin-bottom: 8px; }
.cam-error .btn { max-width: 280px; }

/* ---------- Ortak sayfa ---------- */
.header {
  background: var(--navy); color: #fff; border-radius: 0 0 24px 24px;
  padding: calc(var(--sat) + 10px) 16px 16px 6px; display: flex; gap: 6px; align-items: center; flex: none;
}
.h-title { font-size: 18px; font-weight: 700; }
.h-sub { font-size: 13px; opacity: .85; margin-top: 2px; }
.actions {
  padding: 12px 16px calc(var(--sab) + 16px); display: flex; flex-direction: column; gap: 10px; flex: none;
}
.btn {
  height: 54px; width: 100%; border-radius: 999px; font-size: 16px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-d); }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-danger-fill { background: var(--danger); color: #fff; }
.btn:disabled { background: #D5DAE1; color: #7A8494; border-color: transparent; }

/* ---------- Perspektif ---------- */
.stage { position: relative; flex: 1; margin: 12px 16px 0; border-radius: 16px; background: var(--cam); overflow: hidden; touch-action: none; }
#pano { position: absolute; }
.quad { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.quad polygon { fill: rgba(47, 128, 237, .18); stroke: #fff; stroke-width: 2; }
.handle {
  position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; touch-action: none;
  display: grid; place-items: center; will-change: transform;
}
.handle i {
  width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--cover);
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.loupe {
  position: absolute; width: 112px; height: 112px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.45); pointer-events: none; background: #000;
}
.persp-info { margin: 8px 16px 0; font-size: 13px; color: var(--muted); min-height: 18px; }
.persp-info.error { color: var(--danger-t); }
.persp-info.warn { color: var(--warn-t); background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; }

/* ---------- Sonuç ---------- */
.content { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  padding: 5px 10px; border-radius: 999px; background: var(--navy-l); color: var(--navy-t);
}
.badge svg { width: 14px; height: 14px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-b); }
.badge.err { background: var(--danger-bg); color: var(--danger-t); }
.result-img { cursor: zoom-in; width: 100%; height: auto; border-radius: 10px; background: var(--bg); display: block; -webkit-touch-callout: default; -webkit-user-select: auto; user-select: auto; }
.save-hint { font-size: 12px; color: var(--muted); }
.btn svg { width: 20px; height: 20px; }
.result-video { width: 100%; border-radius: 10px; background: #000; max-height: 50vh; }
.progress { height: 8px; border-radius: 99px; background: var(--navy-l); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--navy); transition: width .2s; }
.merge-error { font-size: 13px; color: var(--danger-t); }

/* ---------- Katmanlar ---------- */
.busy {
  position: absolute; inset: 0; z-index: 10; background: var(--cam-panel); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy-text { font-size: 15px; font-weight: 500; }

.sheet-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.sheet {
  width: 100%; background: #fff; border-radius: 24px 24px 0 0; padding: 8px 16px calc(var(--sab) + 16px);
  display: flex; flex-direction: column; gap: 10px; animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border); align-self: center; margin-bottom: 6px; }
.sheet-title { font-size: 18px; font-weight: 700; color: var(--navy-t); }
.sheet-text { font-size: 14px; color: var(--muted); line-height: 1.4; }
.warn-box { background: var(--warn-bg); color: var(--warn-t); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.4; margin-bottom: 4px; }

.toast {
  position: absolute; left: 50%; bottom: calc(var(--sab) + 140px); transform: translateX(-50%); z-index: 30;
  background: var(--navy-t); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}

/* ---------- Analiz ---------- */
.badge.good { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-b); }
.badge.medium { background: var(--warn-bg); color: var(--warn-t); }
.badge.poor { background: var(--danger-bg); color: var(--danger-t); }
.score-row { display: flex; align-items: center; gap: 14px; }
.score {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  font-size: 28px; font-weight: 700; border: 6px solid var(--navy-l); color: var(--navy-t); flex: none;
}
.score.good { border-color: var(--ok-b); color: var(--ok); }
.score.medium { border-color: #F3C38A; color: var(--warn-t); }
.score.poor { border-color: #E9A39C; color: var(--danger-t); }
.score-text { font-size: 15px; font-weight: 500; line-height: 1.4; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.metric-label { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 18px; font-weight: 700; color: var(--navy-t); margin-top: 2px; }
.metric-hint { font-size: 11px; color: var(--muted); }
.sub-title { font-size: 14px; font-weight: 700; color: var(--navy-t); margin-top: 4px; }
.tips { margin: 0; padding-left: 18px; font-size: 13px; color: var(--navy-t); line-height: 1.45; display: flex; flex-direction: column; gap: 4px; }
.cam-error .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }

/* ---------- Dolap algılama ---------- */
.chip.det { background: #34C759; color: #fff; }
.chip.det svg { width: 14px; height: 14px; }
.quad.auto polygon { stroke: #34C759; fill: rgba(52, 199, 89, .16); stroke-width: 3; }
.stage-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2; height: 36px; padding: 0 12px;
  border-radius: 999px; border: 0; background: rgba(8, 34, 64, .88); color: #fff;
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.stage-btn svg { width: 16px; height: 16px; }

/* ---------- Yenilikler ---------- */
.chip-btn { border: 0; pointer-events: auto; cursor: pointer; background: rgba(255,255,255,.18); }
.whatsnew {
  position: absolute; left: 0; right: 0; top: 0; z-index: 25;
  padding: calc(var(--sat) + 10px) 12px 0; pointer-events: none;
}
.wn-card {
  pointer-events: auto; background: #fff; color: var(--navy-t); border-radius: 20px;
  border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(8, 34, 64, .35);
  padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - var(--sat) - 40px); animation: down .22s ease-out;
}
@keyframes down { from { transform: translateY(-24px); opacity: 0; } }
.wn-head { display: flex; align-items: center; gap: 10px; }
.wn-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--navy-l); color: var(--navy); display: grid; place-items: center; flex: none; }
.wn-icon svg { width: 22px; height: 22px; }
.wn-titles { flex: 1; min-width: 0; }
.wn-title { font-size: 17px; font-weight: 700; }
.wn-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.wn-close { color: var(--muted); margin-right: -8px; }
.wn-body { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.wn-version { display: flex; flex-direction: column; gap: 4px; }
.wn-version-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.wn-version-head .badge { padding: 2px 8px; font-size: 12px; }
.wn-version-head .muted { font-weight: 400; font-size: 12px; }
.wn-version ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.45; display: flex; flex-direction: column; gap: 3px; }
.wn-ok { height: 48px; }

/* Tam ekran fotoğraf (zoom.js) */
.zoom-ov { position: fixed; inset: 0; z-index: 1000; background: #05080c; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.zoom-ov img { position: absolute; left: 50%; top: 50%; transform-origin: center center; max-width: none; will-change: transform; -webkit-touch-callout: none; }
.zoom-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,.16); display: grid; place-items: center; }
.zoom-close svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.4; fill: none; stroke-linecap: round; }
.zoom-hint { position: absolute; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; color: rgba(255,255,255,.7); font-size: 13px; pointer-events: none; }

/* Kamera yakınlaştırma (camzoom.js) */
.zoom-chip { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; min-width: 52px; height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.45); color: #fff; font: 600 14px/1 Roboto, Inter, system-ui, sans-serif; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.zoom-chip.hidden { display: none; }
.info-title:empty { display: none; }

/* =====================================================================
   Görünüm katmanı 2.0 — daha canlı bileşenler (renk, derinlik, geri bildirim)
   Yapı aynı; yalnızca görünüm. Geri almak için bu bloğu silmek yeterli.
   ===================================================================== */
:root {
  --navy-2: #1366C2;           /* başlık / buton degradesinin parlak ucu */
  --accent: #2F80ED;           /* mavi katmanla aynı vurgu */
  --rec: #FF3B4E;
  --glass: rgba(10, 28, 52, 0.62);
  --glass-b: rgba(255, 255, 255, 0.14);
  --shadow-1: 0 1px 2px rgba(11, 58, 110, .06), 0 4px 14px rgba(11, 58, 110, .08);
  --shadow-2: 0 6px 20px rgba(11, 74, 139, .28);
}

/* --- Kamera: cam paneller --- */
.info-panel, .chip {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-b);
}
.info-panel { border-radius: 18px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.info-title { letter-spacing: .1px; }
#minimap { background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 1px rgba(47, 128, 237, .25); }
.chip { font-variant-numeric: tabular-nums; }
.chip-btn { background: rgba(255, 255, 255, .16); }
.chip.rec { background: rgba(255, 59, 78, .92); border-color: rgba(255, 255, 255, .3); font-weight: 700; letter-spacing: .4px; }
.chip.rec i { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
.chip.warn { background: #FFB020; color: #3A2400; border-color: transparent; font-weight: 700; animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(2px); } }
.chip.det { background: #22C55E; border-color: rgba(255, 255, 255, .35); font-weight: 700; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ping 1.6s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 100% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); } }
/* kapak durumu: kapalı (lacivert), açık (turuncu), yakın çekimde soluk */
.chip.door svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.chip.door.closed { background: #0B4A8B; border-color: rgba(255, 255, 255, .3); font-weight: 700; }
.chip.door.open { background: #F2994A; color: #2B1600; border-color: transparent; font-weight: 700; }
.chip.door.paused { opacity: .55; }

/* --- Kamera alt çubuk --- */
.cam-bar { background: linear-gradient(180deg, #1C2230 0%, #10141C 100%); border-top: 1px solid rgba(255, 255, 255, .06); }
.bar-side { border-radius: 16px; transition: background-color .15s, transform .1s; font-weight: 500; }
.bar-side svg { width: 24px; height: 24px; padding: 8px; box-sizing: content-box; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.bar-side:not(:disabled):active { transform: scale(.94); }
.bar-side:not(:disabled):active svg { background: rgba(255, 255, 255, .22); }
#btn-finish:not(:disabled) svg { background: #22C55E; color: #fff; box-shadow: 0 4px 14px rgba(34, 197, 94, .45); }
#btn-finish:not(:disabled) { color: #fff; font-weight: 700; }
.shutter { border-width: 4px; box-shadow: 0 0 0 6px rgba(255, 255, 255, .08); transition: transform .12s; }
.shutter:not(:disabled):active { transform: scale(.94); }
.shutter-inner { background: radial-gradient(circle at 35% 30%, #FF6B78, var(--rec) 60%, #D91E33); }
.is-recording .shutter { animation: recpulse 1.6s ease-out infinite; }
@keyframes recpulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 78, .55); } 100% { box-shadow: 0 0 0 16px rgba(255, 59, 78, 0); } }
.zoom-chip { background: var(--glass); border-color: var(--glass-b); font-variant-numeric: tabular-nums; }

/* --- Sayfalar --- */
.page { background: radial-gradient(120% 60% at 50% 0%, #EAF1FB 0%, var(--bg) 60%); }
.header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  box-shadow: 0 8px 24px rgba(11, 74, 139, .25); position: relative; overflow: hidden;
}
.header::after { /* hafif ışık parlaması */
  content: ""; position: absolute; right: -40px; top: -60px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 70%); pointer-events: none;
}
.header .icon-btn { background: rgba(255, 255, 255, .12); width: 40px; height: 40px; margin: 0 6px 0 4px; }
.header .icon-btn:active { background: rgba(255, 255, 255, .22); }
.h-title { font-size: 19px; letter-spacing: .1px; }

.btn { font-weight: 600; transition: transform .1s, box-shadow .15s, background-color .15s; }
.btn:not(:disabled):active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); box-shadow: var(--shadow-2); }
.btn-primary:active { background: var(--navy-d); box-shadow: none; }
.btn-secondary { background: #fff; box-shadow: var(--shadow-1); }
.btn-danger { background: #fff; border-color: rgba(180, 35, 24, .45); }
.btn:disabled { box-shadow: none; }

.card { border-radius: 18px; border-color: rgba(221, 226, 233, .8); box-shadow: var(--shadow-1); padding: 14px; }
.badge { font-weight: 600; }
.badge.ok, .badge.good { background: #E8F7EE; border-color: #A9DDBB; }
.result-img { border-radius: 12px; box-shadow: 0 2px 10px rgba(11, 58, 110, .12); }
.zoom-tip { display: flex; align-items: center; gap: 6px; color: var(--navy); font-weight: 500; }
.zoom-tip::before { content: ""; width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4M11 8.5v5M8.5 11h5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4 4M11 8.5v5M8.5 11h5'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Kalite puanı: halka dolulukla birlikte (--p: 0..100, app.js verir) */
.score {
  --p: 0; --c: var(--navy); border: 0; position: relative; width: 78px; height: 78px; font-size: 26px;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #E3EAF3 0);
}
.score::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.score::after { content: attr(data-v); position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: inherit; }
.score.good { --c: #22A559; color: var(--ok); }
.score.medium { --c: #F59E0B; color: var(--warn-t); }
.score.poor { --c: #E5484D; color: var(--danger-t); }
.metric { background: #fff; border-color: #E3E8EF; border-radius: 14px; position: relative; overflow: hidden; }
.metric::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); opacity: .7; }
.metric-value { font-variant-numeric: tabular-nums; }
.progress { height: 10px; }
.progress div { background: linear-gradient(90deg, var(--accent), var(--navy-2)); }

/* Perspektif */
.stage { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 6px 18px rgba(0, 0, 0, .18); }
.handle i { width: 24px; height: 24px; border-width: 5px; box-shadow: 0 0 0 4px rgba(47, 128, 237, .25), 0 2px 6px rgba(0, 0, 0, .45); transition: transform .12s; }
.handle:active i { transform: scale(1.25); }
.quad polygon { stroke-width: 2.5; }
.stage-btn { background: var(--glass); border: 1px solid var(--glass-b); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.persp-info { font-weight: 500; }

/* Meşgul ekranı, sayfa altı, bildirim */
.busy { background: radial-gradient(80% 60% at 50% 45%, rgba(19, 102, 194, .55), rgba(8, 24, 46, .92)); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.spinner { width: 56px; height: 56px; border: 0; background: conic-gradient(from 0deg, transparent 0 25%, #fff 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px)); }
.busy-text { font-weight: 600; font-variant-numeric: tabular-nums; }
.toast { box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-weight: 500; }
.sheet { box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); }
.wn-icon { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .chip.det, .chip.warn, .is-recording .shutter, .spinner { animation: none !important; }
  .spinner { background: none; border: 4px solid rgba(255, 255, 255, .25); border-top-color: #fff; -webkit-mask: none; mask: none; }
}

/* ---------- Yapay zeka: kapaklar, yönlendirme, hız ---------- */
.speedo { gap: 8px; }
.speedo-label { font-size: 12px; opacity: .85; }
.speedo-track { width: 64px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); overflow: hidden; display: block; }
.speedo-track i { display: block; height: 100%; width: 0; border-radius: 3px; background: #22C55E; transition: width .15s, background-color .15s; }
.speedo[data-level="mid"] .speedo-track i { background: #FFB020; }
.speedo[data-level="hi"] .speedo-track i { background: #FF3B4E; }

.guide {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-b); color: #fff; font-size: 14px; font-weight: 600;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 6px 20px rgba(0, 0, 0, .3); pointer-events: none;
}
.guide #guide-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide:not(:has(.guide-arrow:not(.hidden))) { padding-left: 14px; }
.guide-arrow { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; flex: none; transition: transform .25s ease-out; }
.guide-arrow svg { width: 18px; height: 18px; stroke-width: 2.6; }
.guide[data-level="ok"] { background: rgba(34, 197, 94, .92); border-color: transparent; }
.guide[data-level="hi"] { background: rgba(255, 59, 78, .92); border-color: transparent; }

.badge.warn { background: var(--warn-bg); color: var(--warn-t); }
.doors-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.doors-grid:empty { display: none; }
.door-thumb { position: relative; border: 0; padding: 0; border-radius: 12px; overflow: hidden; background: var(--cam); aspect-ratio: 3 / 5; box-shadow: var(--shadow-1); }
.door-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.door-no { position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: #22C55E; color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.door-src { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 5px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); text-align: left; }
@media (prefers-reduced-motion: reduce) { .guide-arrow { transition: none; } }

/* ---------- Dolap kilidi ---------- */
.chip-btn-like { pointer-events: auto; cursor: pointer; }
.chip.det.pending { background: rgba(10, 28, 52, .7); animation: none; box-shadow: none; }
.chip.det.pending svg { animation: blink 1s infinite; }
.shutter.waiting { opacity: 1; border-color: rgba(255, 255, 255, .35); box-shadow: none; }
.shutter.waiting .shutter-inner { background: #5A6170; }

/* --- Başlangıç animasyonu (Lottie) --- */
.coach {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); z-index: 3; width: 168px; padding: 8px 8px 10px;
  border-radius: 20px; background: rgba(255, 255, 255, .9); color: var(--navy-t); text-align: center; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); animation: up .3s ease-out;
}
.coach-anim { width: 152px; height: 132px; }
.coach-text { font-size: 13px; font-weight: 700; margin-top: 2px; }

/* --- Kapak sayısı sorusu --- */
.doorask {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4; max-width: 420px; margin: 0 auto;
  padding: 14px; border-radius: 20px; background: rgba(255, 255, 255, .97); color: var(--navy-t);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35); animation: up .25s ease-out; display: flex; flex-direction: column; gap: 12px;
}
.doorask-head { display: flex; gap: 10px; align-items: center; }
.doorask-ic { width: 34px; height: 34px; border-radius: 50%; background: #22C55E; color: #fff; display: grid; place-items: center; flex: none; }
.doorask-ic svg { width: 20px; height: 20px; stroke-width: 3; }
.doorask-title { font-size: 16px; font-weight: 800; }
.doorask-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.doorask-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg-btn {
  border: 2px solid var(--border); background: #fff; color: var(--navy-t); border-radius: 14px; padding: 8px 4px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 15px; transition: transform .1s, border-color .15s;
}
.seg-btn svg { width: 34px; height: 40px; stroke-width: 1.6; }
.seg-btn[aria-checked="true"] { border-color: #22C55E; background: #F1F9F3; color: var(--ok); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.seg-btn:active { transform: scale(.95); }
.doorask-ok { min-height: 48px; font-weight: 700; }

/* --- Kapak adımları --- */
.doorsteps {
  position: absolute; left: 50%; bottom: 108px; transform: translateX(-50%); z-index: 3; display: flex; gap: 6px; padding: 6px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-b); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.doorsteps .st {
  min-width: 30px; height: 30px; padding: 0 10px; border-radius: 15px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  color: rgba(255, 255, 255, .75); background: rgba(255, 255, 255, .12); white-space: nowrap;
}
.doorsteps .st.cur { background: #22C55E; color: #fff; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ping 1.6s ease-out infinite; }
.doorsteps .st.done { background: var(--accent); color: #fff; }
.doorsteps button.st { border: 0; font-family: inherit; cursor: pointer; }
.doorsteps button.st:active { transform: scale(.94); }
.doorsteps .st.next { background: #fff; color: var(--navy-t); }
.doorsteps .st.edit { background: transparent; color: rgba(255, 255, 255, .8); font-weight: 600; text-decoration: underline; }
.doorflash {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 5; min-width: 220px; max-width: calc(100% - 48px);
  padding: 18px 20px 16px; border-radius: 22px; background: rgba(255, 255, 255, .97); color: var(--navy-t); text-align: center;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .4); animation: pop .28s ease-out; pointer-events: none;
}
.doorflash-ic { width: 52px; height: 52px; border-radius: 50%; background: #22C55E; color: #fff; display: grid; place-items: center; margin: 0 auto 8px; }
.doorflash-ic svg { width: 30px; height: 30px; stroke-width: 3; }
.doorflash-title { font-size: 18px; font-weight: 800; }
.doorflash-sub { font-size: 14px; color: var(--muted); margin-top: 4px; font-weight: 600; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .coach, .doorask, .doorflash { animation: none; } .doorsteps .st.cur { animation: none; } }

.dbg { position: absolute; left: 8px; top: calc(var(--sat) + 150px); z-index: 4; margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(0, 0, 0, .7); color: #9EF5B5; font: 11px/1.45 ui-monospace, Menlo, monospace; pointer-events: none; white-space: pre; }


/* --- Fener testi (yansıma denemesi): ortada büyük düğme, nerede yapılacağı seçimi, sonuç kartı --- */
.shutter, .torch-shutter { grid-column: 2; grid-row: 1; }
.torch-shutter { display: none; position: relative; width: 88px; height: 88px; border-radius: 50%; border: 5px solid #fff; background: transparent; padding: 0; place-items: center; transition: transform .12s; }
.glare-test:not(.test-video) .torch-shutter { display: grid; }
.glare-test .shutter { display: none; }
.torch-shutter:active { transform: scale(.94); }
.torch-inner { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #FFE08A, #FFC53D 55%, #F5A524); color: #3A2400; box-shadow: 0 0 22px rgba(255, 197, 61, .45); }
.torch-inner svg { width: 30px; height: 30px; stroke-width: 2; }
.torch-inner b { display: none; font-size: 17px; font-weight: 800; }
.torch-cap { position: absolute; top: 100%; margin-top: 4px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .85); }
.torch-shutter.is-busy { border-color: rgba(255, 255, 255, .25); }
.torch-shutter.is-busy::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 5px solid transparent; border-top-color: #FFC53D; border-right-color: #FFC53D; animation: spin .9s linear infinite; }
.torch-shutter.is-busy .torch-inner svg { display: none; }
.torch-shutter.is-busy .torch-inner b { display: block; }
.torch-shutter:disabled { opacity: .45; }

.torch-seg { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-b); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.torch-seg button { display: flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; padding: 8px 12px; background: transparent; color: rgba(255, 255, 255, .78); font-size: 13px; font-weight: 600; white-space: nowrap; }
.torch-seg button svg { width: 16px; height: 16px; }
.torch-seg button[aria-checked="true"] { background: #fff; color: var(--navy-t); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }

.torch-card { position: absolute; left: 16px; right: 16px; bottom: 70px; z-index: 4; max-width: 420px; margin: 0 auto; display: flex; gap: 12px; align-items: center; padding: 12px 12px 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, .97); color: var(--navy-t); box-shadow: 0 12px 34px rgba(0, 0, 0, .35); animation: up .22s ease-out; }
.tc-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; background: #98A2B3; }
.tc-ic svg { width: 22px; height: 22px; stroke-width: 2.6; }
.torch-card[data-level="ok"] .tc-ic { background: #22C55E; }
.torch-card[data-level="warn"] .tc-ic { background: #F5A524; }
.torch-card[data-level="busy"] .tc-ic { background: #FFC53D; color: #3A2400; }
.tc-body { flex: 1; min-width: 0; }
.tc-title { font-size: 15.5px; font-weight: 800; }
.tc-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tc-close { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #F1F3F6; color: var(--muted); display: grid; place-items: center; flex: none; }
.tc-close svg { width: 16px; height: 16px; }
.glare-test #zoom-chip { display: none !important; }
@media (prefers-reduced-motion: reduce) { .torch-shutter.is-busy::after { animation: none; } .torch-card { animation: none; } }
.glare-test #btn-reset, .glare-test #btn-finish { visibility: hidden; }
.torch-seg.is-busy { opacity: .5; pointer-events: none; }
.tc-report { border: 1.5px solid var(--navy); color: var(--navy); background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 700; flex: none; }

/* --- Video / Fotoğraf seçimi ve fotoğraf modu --- */
.mode-seg { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-b); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.mode-seg button { border: 0; background: transparent; color: rgba(255, 255, 255, .8); font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; padding: 7px 14px; border-radius: 999px; }
.mode-seg button[aria-checked="true"] { color: #1C2230; background: #FFC53D; }
/* Yakınlık seçimi (0,5 · 1× · 2): iPhone kamerasındaki gibi yuvarlak düğmeler, kendi satırında, ortada.
   Video/Fotoğraf seçimi görünürken onun üstünde; ipucu, kapak adımları ve animasyon kartı bir satır yukarı kayar. */
.zoom-chip.zoom-pill { display: flex; align-items: center; gap: 10px; min-width: 0; height: 40px; padding: 0; border: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.zoom-chip.zoom-pill.hidden { display: none; }
.zoom-pill button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(12, 18, 28, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; font: 700 12px/1 Roboto, Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; cursor: pointer; transition: width .15s ease-out, height .15s ease-out, opacity .15s; }
.zoom-pill button.on { width: 40px; height: 40px; font-size: 13px; color: #FFC53D; background: rgba(12, 18, 28, .72); box-shadow: 0 0 0 1px rgba(255, 197, 61, .35); }
.zoom-pill.lens-locked button[data-switch] { opacity: .35; }
@media (prefers-reduced-motion: reduce) { .zoom-pill button { transition: none; } }
.camera:has(#mode-seg:not(.hidden)) #zoom-chip { bottom: 62px; }
.camera:has(#mode-seg:not(.hidden)):has(#zoom-chip:not(.hidden)) #guide { bottom: 112px; }
.camera:has(#mode-seg:not(.hidden)):has(#zoom-chip:not(.hidden)) #doorsteps { bottom: 160px; }
.camera:has(#mode-seg:not(.hidden)):has(#zoom-chip:not(.hidden)) #coach { bottom: 164px; }
.camera:has(#mode-seg:not(.hidden)) #guide { bottom: 64px; }
.photo-mode .shutter-inner { background: #fff; }
.photo-mode #guide, .photo-mode #minimap, .photo-mode #doorask, .photo-mode #doorsteps, .photo-mode #speedo, .photo-mode #chip-clips, .photo-mode #chip-time { display: none !important; }
.shutter.is-busy { position: relative; }
.shutter.is-busy::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 5px solid transparent; border-top-color: #FFC53D; border-right-color: #FFC53D; animation: spin .9s linear infinite; }
.badge.warn { background: var(--warn-bg); color: var(--warn-t); }
@media (prefers-reduced-motion: reduce) { .shutter.is-busy::after { animation: none; } }

/* --- "Kapağı aç" (fotoğrafta camda yansıma bulununca) --- */
.opendoor { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; background: rgba(6, 14, 26, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s ease-out; }
.od-card { width: 100%; max-width: 360px; background: #fff; color: var(--navy-t); border-radius: 24px; padding: 18px 18px 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .4); display: flex; flex-direction: column; gap: 10px; text-align: center; animation: up .25s ease-out; }
.od-anim { width: 100%; aspect-ratio: 300 / 260; max-height: 240px; border-radius: 16px; background: #F1F5FA; }
.od-title { font-size: 20px; font-weight: 800; margin-top: 4px; }
.od-text { font-size: 14px; color: var(--muted); line-height: 1.4; margin-bottom: 4px; }
.od-card .btn { min-height: 48px; }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .opendoor, .od-card { animation: none; } }

/* --- Beyazlık testi (yansıma denemesi) --- */
.torch-inner .ic-white { display: none; }
.method-white .torch-inner .ic-torch { display: none; }
.method-white .torch-inner .ic-white { display: block; }
.method-white .torch-inner { background: radial-gradient(circle at 35% 30%, #E6F4FF, #9CD3FF 55%, #4DA8F0); color: #0B2A4A; box-shadow: 0 0 22px rgba(77, 168, 240, .45); }
.glare-test.method-white .torch-shutter { display: grid; }
.white-box { position: absolute; right: 12px; top: calc(var(--sat) + 150px); z-index: 3; width: 124px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .25); }
.white-box canvas { display: block; width: 100%; height: auto; border-radius: 8px; background: #000; }
.white-cap { font-size: 10.5px; line-height: 1.3; color: #fff; padding: 4px 2px 2px; text-align: center; }
.white-cap b { color: #FF6B78; }
.white-cap i { color: #8EC5FF; font-style: normal; }

/* ---- Planogram (sonuç ekranı) ---- */
.pg { display: flex; flex-direction: column; gap: 10px; }
.pg-badge { background: var(--navy-l); color: var(--navy); }
.pg-sample { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--warn-t); background: var(--warn-bg); border: 1px solid #F3D3AE; border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.pg-stage { background: linear-gradient(180deg, #F7F9FC, #EEF2F7); border: 1px solid #E3E8EF; border-radius: 14px; padding: 12px 10px; display: flex; justify-content: center; }
.pg-svg { width: 100%; max-width: 380px; height: auto; display: block; stroke: none; stroke-width: 0; }
.pg-svg text { stroke: none; font-family: inherit; }
.pg-canopy { fill: #fff; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.pg-shelfno { fill: var(--navy); font-size: 10px; font-weight: 700; }
.pg-rail { font-size: 7.5px; font-weight: 700; }
.pg-emptytx { fill: #B42318; font-size: 8.5px; font-weight: 700; }
.pg-item { cursor: pointer; transition: opacity .15s; outline: none; }
.pg-item.dim { opacity: .28; }
.pg-item:focus-visible > rect:first-child { stroke: var(--navy); stroke-width: 1.5; fill-opacity: 0; }
.pg-tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.pg-tab { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pg-tab.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(11, 58, 110, .16); }
.pg-detail { min-height: 38px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; line-height: 1.35; }
.pg-detail.on { color: var(--navy-t); background: #fff; }
.pg-detail i, .pg-chip i { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.pg-detail b { font-weight: 700; }
.pg-metrics { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pg-metrics .metric { padding: 8px 6px 8px 10px; }
.pg-metrics .metric-label { font-size: 11px; white-space: nowrap; }
.pg-metrics .metric-hint { white-space: nowrap; }
.pg-share { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: #fff; }
.pg-share span { min-width: 3px; }
.pg-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--navy-t); background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 4px 9px; }
.pg-chip b { font-variant-numeric: tabular-nums; font-weight: 700; }
@media (max-width: 359px) { .pg-metrics { grid-template-columns: 1fr 1fr; } }
