/* ShelfClaim app: sign-in, marker page and the live sweep screen. Matches the landing palette. */
:root {
  --navy: #0b1b3a;
  --slate: #34445f;
  --muted: #5d6b84;
  --line: #e3e9f5;
  --blue: #1f6bff;
  --blue-hover: #0b4fd6;
  --blue-soft: #eaf1ff;
  --page: #f6f9ff;
  --green: #0f8a5f;
  --green-soft: #e6f6ef;
  --amber: #a15c00;
  --amber-soft: #fff3e0;
  --violet: #5b3fd1;
  --violet-soft: #f0ecff;
  --red: #e5484d;
  --font: Inter, "Inter var", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--slate); background: var(--page); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
h1 { color: var(--navy); letter-spacing: -0.02em; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy); font-size: 17px; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; }
.sub { color: var(--muted); margin: 6px 0 22px; }
.fine { font-size: 13px; color: var(--muted); }
.btn { appearance: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 20px; border-radius: 12px; transition: background-color 0.15s, transform 0.15s, opacity 0.15s; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 10px 24px -12px rgba(31, 107, 255, 0.65); }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-dark { background: rgba(11, 27, 58, 0.72); color: #fff; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* sign-in */
body.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #d9e7ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #ffe9d6 0%, transparent 55%), var(--page); }
.auth-card { width: 100%; max-width: 400px; background: rgba(255, 255, 255, 0.85); border: 1px solid #fff; border-radius: 20px; padding: 28px 24px; box-shadow: 0 1px 2px rgba(11, 27, 58, 0.04), 0 24px 48px -24px rgba(11, 27, 58, 0.25); backdrop-filter: blur(18px); }
.auth-card h1 { font-size: 26px; margin: 22px 0 0; }
form label { display: block; font-size: 14px; font-weight: 600; color: var(--navy); margin-bottom: 14px; }
form input { display: block; width: 100%; margin-top: 6px; height: 48px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px; font: inherit; font-size: 16px; color: var(--navy); background: #fff; }
form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin: 0 0 10px; }

/* ---------------- sweep screen ---------------- */
body.sweep { background: #060b16; color: #fff; overflow: hidden; height: 100dvh; overscroll-behavior: none; }
.stage { position: fixed; inset: 0; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #060b16; }
.shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(6, 11, 22, 0.55), transparent 22%, transparent 55%, rgba(6, 11, 22, 0.85)); }

.topbar { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; z-index: 5; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(11, 27, 58, 0.55); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa6bd; }
.dot.live { background: #ff4d4f; box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.6); animation: pulse 1.6s infinite; }
.dot.ok { background: #30d17b; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.55); } 70% { box-shadow: 0 0 0 8px rgba(255, 77, 79, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); } }
.pill .mk { width: 18px; height: 18px; }

.toast { position: absolute; top: calc(56px + var(--safe-t)); left: 50%; transform: translate(-50%, -6px); opacity: 0; transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); z-index: 6; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .pill { background: rgba(11, 27, 58, 0.8); }
.toast.warn .pill { background: rgba(161, 92, 0, 0.92); }
.toast.good .pill { background: rgba(15, 138, 95, 0.92); }

.caption { position: absolute; left: 14px; right: 14px; bottom: calc(196px + var(--safe-b)); z-index: 4; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; }
.bubble { max-width: 92%; padding: 9px 13px; border-radius: 16px; font-size: 15px; line-height: 1.35; background: rgba(11, 27, 58, 0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, 0.1); }
.bubble.user { align-self: flex-end; background: rgba(31, 107, 255, 0.78); }
.bubble .who { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; margin-bottom: 2px; }
.wave { display: inline-flex; gap: 2px; align-items: center; height: 12px; margin-left: 6px; vertical-align: middle; }
.wave i { width: 2px; height: 4px; border-radius: 2px; background: #8fb4ff; }
.speaking .wave i { animation: wv 0.9s infinite ease-in-out; }
.wave i:nth-child(2) { animation-delay: 0.12s; } .wave i:nth-child(3) { animation-delay: 0.24s; } .wave i:nth-child(4) { animation-delay: 0.36s; }
@keyframes wv { 0%, 100% { height: 3px; } 50% { height: 12px; } }

/* bottom sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; background: rgba(250, 252, 255, 0.97); color: var(--slate); border-radius: 22px 22px 0 0; padding: 8px 14px calc(12px + var(--safe-b)); box-shadow: 0 -18px 40px -20px rgba(0, 0, 0, 0.5); transition: max-height 0.35s var(--ease); max-height: 186px; overflow: hidden; }
.sheet.open { max-height: 78dvh; }
.grip { width: 40px; height: 5px; border-radius: 3px; background: #cfd7e6; margin: 2px auto 8px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 7px 8px; min-width: 0; }
.stat b { display: block; color: var(--navy); font-size: 18px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat span { font-size: 11px; color: var(--muted); }
.controls { display: flex; gap: 8px; margin-top: 10px; }
.controls .btn { height: 46px; flex: 1; }
.controls .btn.icon { flex: 0 0 46px; padding: 0; background: #fff; color: var(--navy); border: 1px solid var(--line); }
.controls .btn.icon.off { color: var(--red); }
.list { margin-top: 12px; overflow-y: auto; max-height: calc(78dvh - 170px); -webkit-overflow-scrolling: touch; }
.list h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 10px 2px 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); animation: rowin 0.35s var(--ease); }
@keyframes rowin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; color: var(--navy); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t span { font-size: 12px; color: var(--muted); }
.row .p { font-size: 13px; font-weight: 600; color: var(--navy); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }
.tag.blue { background: var(--blue-soft); color: #1f55c8; }

/* room mode */
.room { position: absolute; inset: 0; z-index: 3; display: none; pointer-events: none; }
.room.on { display: block; }
.cross { position: absolute; left: 50%; top: 44%; width: 64px; height: 64px; transform: translate(-50%, -50%); }
.cross::before, .cross::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.cross::before { left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); }
.cross::after { top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%); }
.level { position: absolute; left: 0; right: 0; top: 44%; height: 0; border-top: 1px dashed rgba(255, 255, 255, 0.45); }
.room-card { position: absolute; left: 12px; right: 12px; top: calc(56px + var(--safe-t)); pointer-events: auto; background: rgba(11, 27, 58, 0.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 16px; padding: 12px 14px; }
.room-card .step { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #8fb4ff; }
.room-card .what { font-size: 17px; font-weight: 600; margin-top: 2px; }
.room-card .angle { font-size: 13px; opacity: 0.75; margin-top: 2px; font-variant-numeric: tabular-nums; }
.room-card .btns { display: flex; gap: 8px; margin-top: 10px; }
.room-card .btns .btn { height: 44px; flex: 1; }
.room-card .btns .btn.small { flex: 0 0 auto; padding: 0 14px; background: rgba(255, 255, 255, 0.12); color: #fff; }
.room-dots { display: flex; gap: 4px; margin-top: 8px; }
.room-dots i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
.room-dots i.done { background: #30d17b; }
.room-dots i.cur { background: #8fb4ff; }

/* start and result overlays */
.overlay { position: absolute; inset: 0; z-index: 10; overflow-y: auto; background: radial-gradient(900px 500px at 10% -10%, #d9e7ff 0%, transparent 60%), radial-gradient(700px 420px at 110% 0%, #ffe9d6 0%, transparent 55%), var(--page); color: var(--slate); padding: calc(18px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.overlay[hidden] { display: none; }
.ov-inner { max-width: 520px; margin: 0 auto; }
.ov-top { display: flex; justify-content: space-between; align-items: center; }
.ov-top button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.overlay h1 { font-size: 30px; line-height: 1.1; margin: 26px 0 8px; }
.steps { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.steps .n { flex: 0 0 26px; height: 26px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.steps b { color: var(--navy); display: block; font-size: 15px; }
.steps span { font-size: 13.5px; color: var(--muted); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }
.field label { font-weight: 600; color: var(--navy); font-size: 15px; }
.field select { font: inherit; font-size: 15px; border: 0; background: transparent; color: var(--navy); text-align: right; }
.past { margin-top: 26px; }
.past h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 8px; }
.past a.item { display: flex; justify-content: space-between; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; color: var(--navy); font-size: 14px; }
.past a.item span { color: var(--muted); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.result-grid .stat b { font-size: 20px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--blue-soft); border-top-color: var(--blue); animation: spin 0.9s linear infinite; margin: 30px auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { text-align: center; }
.stack { display: grid; gap: 8px; }
.warnbox { background: var(--amber-soft); color: var(--amber); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 10px 0; }
@media (min-width: 900px) {
  .sheet { left: auto; right: 16px; bottom: 16px; width: 400px; border-radius: 20px; }
  .caption { right: 440px; bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
