:root {
  --brand: #1f2a37;      /* header / dark */
  --accent: #c8102e;     /* Show Me button + selections */
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }

.top { background: var(--brand); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 12px 12px 16px; display: flex; align-items: center; gap: 12px; }
.top-brand { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-brand img { height: 40px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.menu-btn { background: rgba(255,255,255,.12); border: 0; color: #fff; font-size: 22px; width: 48px; height: 48px; border-radius: 12px; }
.brand { font-weight: 800; letter-spacing: .08em; }
.sub { opacity: .75; font-size: 14px; }

main { max-width: 720px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.card h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.fine { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 12px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 8px; font-size: 13px; }

.photo-drop { display: grid; place-items: center; min-height: 160px; border: 2px dashed #cbd5e1; border-radius: var(--radius); overflow: hidden; position: relative; background: #f8fafc; }
.photo-drop img { width: 100%; display: block; }
.photo-cta { font-size: 18px; font-weight: 600; padding: 20px; text-align: center; }
.photo-drop.has-photo { border-style: solid; border-color: var(--line); }
.photo-drop.has-photo .photo-cta { position: absolute; bottom: 8px; right: 8px; font-size: 14px; padding: 8px 12px; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; }

.step-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 14px 0 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 16px; min-height: 44px; white-space: nowrap; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.chip.on { border-color: var(--accent); background: var(--accent); color: #fff; }
.chip .dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); }
.line-note { color: var(--muted); font-size: 13px; margin-top: 6px; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.sw { border: 2px solid transparent; border-radius: 12px; background: none; padding: 0; text-align: center; font-size: 13px; line-height: 1.2; }
.sw .chipimg { aspect-ratio: 1; border-radius: 10px; background-size: cover; background-position: center; border: 1px solid rgba(0,0,0,.12); position: relative; }
.sw .chipimg.flat::after { content: "approx."; position: absolute; right: 4px; bottom: 4px; font-size: 9px; color: #fff; background: rgba(0,0,0,.35); padding: 1px 4px; border-radius: 4px; }
.sw span { display: block; padding: 6px 2px 4px; }
.sw small { display: block; color: #b45309; font-size: 11px; }
.sw.on { border-color: var(--accent); }
.sw.on .chipimg { outline: 3px solid #fff; outline-offset: -5px; }

.action-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 12px; align-items: center; z-index: 5; }
.summary { flex: 1; font-size: 13px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.go { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 14px 26px; font-size: 18px; font-weight: 700; min-height: 54px; }
.go:disabled { opacity: .4; }

.screen { position: fixed; inset: 0; background: #0b0f14; color: #fff; overflow-y: auto; z-index: 10; padding: env(safe-area-inset-top) 0 calc(20px + env(safe-area-inset-bottom)); }
.screen-top { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.back { background: rgba(255,255,255,.12); border: 0; border-radius: 999px; padding: 10px 16px; min-height: 44px; }
.result-label { font-size: 13px; opacity: .85; flex: 1; }
.compare { position: relative; max-width: 960px; margin: 0 auto; user-select: none; touch-action: pan-y; }
.compare img { display: block; width: 100%; height: auto; }
.compare .before { position: absolute; inset: 0; height: 100%; object-fit: cover; clip-path: inset(0 50% 0 0); }
.divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.5); pointer-events: none; }
.divider::after { content: "‹ ›"; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #fff; color: #111; border-radius: 999px; padding: 6px 10px; font-weight: 700; font-size: 14px; }
.tag { position: absolute; top: 10px; background: rgba(0,0,0,.55); padding: 4px 10px; border-radius: 999px; font-size: 12px; pointer-events: none; }
.tag-l { left: 10px; } .tag-r { right: 10px; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: ew-resize; }
.result-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 12px; max-width: 960px; margin: 0 auto; }
.result-actions button { background: rgba(255,255,255,.12); border: 0; border-radius: 12px; padding: 14px 8px; font-weight: 600; min-height: 52px; }
.result-actions #shareBtn { background: var(--accent); }
.history { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px; max-width: 960px; margin: 0 auto; }
.history button { flex: none; width: 110px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 0; color: #fff; font-size: 11px; text-align: left; }
.history button.on { border-color: var(--accent); }
.history img { width: 100%; border-radius: 8px; display: block; }
.history span { display: block; padding: 4px; opacity: .8; }
.screen .fine { color: #9ca3af; }

.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.92); color: #fff; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; }
.overlay[hidden], .screen[hidden], .toast[hidden], .sheet-backdrop[hidden], .install-banner[hidden] { display: none; }
.spinner { width: 54px; height: 54px; border: 5px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay .hint { color: #cbd5e1; }
.pin { background: var(--brand); }
.login-logo { max-height: 72px; max-width: 200px; object-fit: contain; background: #fff; border-radius: 12px; padding: 6px; margin-bottom: 8px; }
.login-field { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 10px; }
.login-field[hidden] { display: none; }
.login-field span { font-size: 14px; opacity: .8; }
.login-field input { font-size: 24px; text-align: center; width: 240px; padding: 12px; border-radius: 12px; border: 0; }
#pinInput { letter-spacing: .3em; }
.pin .go { margin-top: 14px; min-width: 240px; }
.error { color: #fca5a5; min-height: 1.4em; }

.toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 30; max-width: 90vw; text-align: center; box-shadow: 0 4px 16px rgba(0,0,0,.3); }

/* Install banner */
.install-banner { display: flex; gap: 12px; align-items: center; background: #fef3c7; color: #78350f; padding: 12px 16px; font-size: 14px; }
.install-banner p { margin: 4px 0 0; }
.install-banner button { flex: none; border: 0; background: #78350f; color: #fff; border-radius: 10px; padding: 10px 14px; font-weight: 600; }

/* Menu sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 15; display: flex; align-items: flex-end; }
.sheet { background: #fff; width: 100%; border-radius: 18px 18px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.sheet button { border: 0; background: var(--bg); border-radius: 12px; padding: 16px; font-size: 17px; font-weight: 600; text-align: left; }
.sheet button.muted { background: none; text-align: center; color: var(--muted); }

/* Teammate screen */
.screen.light { background: var(--bg); color: var(--text); }
.screen.light .back { background: #fff; border: 1px solid var(--line); }
.teammate { max-width: 480px; margin: 0 auto; padding: 0 20px 20px; text-align: center; }
.teammate h2 { margin: 4px 0 6px; }
.qr { display: inline-block; background: #fff; padding: 14px; border-radius: 16px; margin: 10px 0; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.qr img, .qr canvas { display: block; }
.steps { text-align: left; padding-left: 22px; line-height: 1.5; }
.steps li { margin-bottom: 10px; }
.hint.link { word-break: break-all; }

/* Options (compare up to 3 combos) */
.options-card { padding: 12px 16px; }
.options-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 14px; min-height: 44px; font-weight: 600; }
.opt.on { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt .tick { color: #16a34a; }
.opt.add { border-style: dashed; color: var(--muted); }
.opt.remove { border: 0; background: none; color: var(--muted); text-decoration: underline; font-weight: 500; padding: 10px 6px; }
.options-card .hint { margin-top: 8px; }
