:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --mist: #f3f3f1;
  --line: #dcdcd8;
  --muted: #6b6b66;
  --red: #d7141a;
  --head: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --gutter: 16px;
  --tray-h: 76px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--body);
  padding-bottom: calc(var(--tray-h) + env(safe-area-inset-bottom));
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ── ticker + bar (matches the eglaf.my header) ─────────────────────── */
.ticker { background: var(--ink); color: #fff; overflow: hidden; height: 26px; border-bottom: 1px solid #222; }
.ticker-track {
  display: flex; width: max-content; height: 100%; align-items: center;
  font: 700 10px/1 var(--head); letter-spacing: .14em; text-transform: uppercase;
  animation: ticker 40s linear infinite;
}
.ticker-track span { padding: 0 18px; white-space: nowrap; }
.ticker-track span::before { content: '●'; color: var(--red); margin-right: 18px; font-size: 7px; vertical-align: 2px; }
@keyframes ticker { to { transform: translateX(-50%); } }

.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 var(--gutter);
  background: var(--ink); color: #fff;
}
.bar-logo img { height: 20px; width: auto; }
.bar-title {
  font: 800 11px/1 var(--head); letter-spacing: .18em; text-transform: uppercase;
  padding-left: 12px; border-left: 1px solid #3a3a3a; color: #cfcfcf;
}
.bar-shop {
  margin-left: auto; font: 700 11px/1 var(--head); letter-spacing: .16em; text-transform: uppercase;
  text-decoration: none; border: 1px solid #fff; padding: 9px 14px;
}
.bar-shop:hover { background: #fff; color: var(--ink); }
.bar-close { display: none; }

main { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

/* ── hero ───────────────────────────────────────────────────────────── */
.hero { padding: 36px 0 20px; }
.eyebrow { margin: 0 0 8px; font: 700 11px/1 var(--head); letter-spacing: .2em; text-transform: uppercase; color: var(--red); }
.hero h1 {
  margin: 0; font: 900 clamp(44px, 11vw, 96px)/.9 var(--head);
  letter-spacing: -.02em; text-transform: uppercase;
}
.lede { margin: 14px 0 0; max-width: 34em; color: var(--muted); font-size: 16px; }

.notice { margin: 16px 0 0; padding: 12px 14px; max-width: 34em; border-left: 3px solid var(--red); background: var(--mist); font-size: 14px; }

/* ── steps ──────────────────────────────────────────────────────────── */
.step { padding: 24px 0 8px; border-top: 1px solid var(--ink); margin-top: 16px; }
.step h2, .privacy h2 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 16px;
  font: 800 20px/1.1 var(--head); text-transform: uppercase; letter-spacing: .02em;
}
.step-no { font: 700 12px/1 var(--head); color: var(--red); letter-spacing: .1em; }
.hint { margin: -8px 0 16px; color: var(--muted); }

.drop {
  position: relative; display: grid; place-items: center;
  min-height: 220px; max-width: 420px; cursor: pointer;
  background: var(--mist); border: 1.5px dashed #9a9a94; overflow: hidden;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--ink); }
.drop:focus-within, .drop.is-focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.drop-empty { display: grid; justify-items: center; gap: 6px; padding: 24px; text-align: center; }
.drop-empty strong { font: 800 15px/1.2 var(--head); text-transform: uppercase; letter-spacing: .04em; }
.drop-empty span { color: var(--muted); font-size: 13px; }
.drop.has-photo { border-style: solid; border-color: var(--ink); min-height: 0; background: #000; }
.drop.has-photo .drop-empty { display: none; }
.drop-preview { width: 100%; max-height: 520px; object-fit: contain; }
.drop-status {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px;
  background: rgba(10, 10, 10, .82); color: #fff;
  font: 700 11px/1.3 var(--head); letter-spacing: .1em; text-transform: uppercase;
}
.drop-status.is-error { background: var(--red); }

.tips { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.tips li::before { content: '—'; margin-right: 6px; color: var(--ink); }

.consent { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0 8px; max-width: 560px; font-size: 13px; color: #3b3b37; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
.consent.is-nudged { animation: nudge .45s; }
.consent.is-nudged span { color: var(--red); }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ── catalogue ──────────────────────────────────────────────────────── */
.filters { display: grid; gap: 12px; margin-bottom: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 9px 14px; border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  font: 700 11px/1 var(--head); letter-spacing: .12em; text-transform: uppercase;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.search {
  width: 100%; max-width: 420px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 0; background: var(--paper);
  -webkit-appearance: none; appearance: none;
}
.search:focus { outline: 2px solid var(--ink); outline-offset: -1px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
.grid-note { grid-column: 1 / -1; color: var(--muted); padding: 24px 0; }
.card {
  position: relative; display: grid; gap: 8px; align-content: start; padding: 0; text-align: left;
  background: none; border: 0; cursor: pointer;
}
.card-img { position: relative; aspect-ratio: 1; background: var(--mist); outline: 1.5px solid transparent; outline-offset: -1.5px; transition: outline-color .12s; }
.card-img img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.card:hover .card-img { outline-color: #9a9a94; }
.card[aria-pressed='true'] .card-img { outline: 2.5px solid var(--ink); outline-offset: -2.5px; }
.card-check {
  position: absolute; top: 8px; right: 8px; display: grid; place-items: center;
  width: 26px; height: 26px; border: 1.5px solid var(--ink); background: var(--paper);
  font: 900 13px/1 var(--head);
}
.card[aria-pressed='true'] .card-check { background: var(--ink); color: #fff; }
.card-check::after { content: '+'; }
.card[aria-pressed='true'] .card-check::after { content: '✓'; }
.card-title { font: 700 13px/1.3 var(--head); text-transform: uppercase; letter-spacing: .02em; }
.card-price { font-size: 13px; color: var(--muted); }
.card-price s { margin-left: 6px; }
.card:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.privacy { margin: 40px 0 24px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 640px; color: var(--muted); font-size: 13px; }
.privacy h2 { font-size: 13px; color: var(--ink); margin-bottom: 8px; }

/* ── tray ───────────────────────────────────────────────────────────── */
.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--tray-h); padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--ink);
}
.tray-picks { display: flex; gap: 6px; min-width: 0; flex: 1; }
.tray-pick { position: relative; width: 48px; height: 48px; flex: none; background: var(--mist); }
.tray-pick img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.tray-pick button {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 13px; line-height: 20px; cursor: pointer;
}
.tray-empty { align-self: center; color: var(--muted); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 1.5px solid var(--ink); background: var(--paper);
  font: 800 13px/1 var(--head); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #262626; }
.btn:disabled { cursor: not-allowed; background: var(--mist); border-color: var(--line); color: #9a9a94; }
.btn-ghost { border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.tray .btn { flex: none; }

/* ── result ─────────────────────────────────────────────────────────── */
.result { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--paper); overflow-y: auto; }
.result-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 var(--gutter); background: var(--ink); color: #fff;
}
.result-bar h2 { margin: 0; font: 800 14px/1 var(--head); letter-spacing: .16em; text-transform: uppercase; }
.icon-btn { width: 40px; height: 40px; border: 0; background: none; color: inherit; font-size: 28px; line-height: 1; cursor: pointer; }
.result-body { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px var(--gutter) 40px; display: grid; gap: 18px; }

.stage { position: relative; background: #000; overflow: hidden; user-select: none; touch-action: pan-y; }
.stage img { width: 100%; height: auto; }
.stage-after-wrap { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos, 100%)) 0 0); }
.stage-after { width: 100%; height: 100%; object-fit: cover; }
.stage-handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 100%); width: 2px; margin-left: -1px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none;
}
.stage-handle span {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.stage-handle span::before { content: '‹ ›'; position: absolute; inset: 0; display: grid; place-items: center; font: 800 14px/1 var(--head); letter-spacing: .1em; }
.stage-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.stage-tag {
  position: absolute; top: 10px; padding: 6px 8px; background: rgba(10, 10, 10, .75); color: #fff;
  font: 700 10px/1 var(--head); letter-spacing: .14em; text-transform: uppercase; pointer-events: none;
}
.stage-tag-after { left: 10px; }
.stage-tag-before { right: 10px; }
.stage.is-full .stage-handle, .stage.is-full .stage-tag-before { opacity: 0; }
.stage-handle, .stage-tag-before { transition: opacity .2s; }
.compare-hint { margin: -10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.stage:not(.is-done) .stage-after-wrap,
.stage:not(.is-done) .stage-handle,
.stage:not(.is-done) .stage-range,
.stage:not(.is-done) .stage-tag { display: none; }

.stage-loading { position: absolute; inset: 0; display: grid; align-content: end; padding: 18px; background: rgba(10, 10, 10, .45); color: #fff; }
.stage.is-done .stage-loading, .stage.is-failed .stage-loading { display: none; }
.stage:not(.is-done) .stage-before { filter: grayscale(.5) brightness(.85); }
.scan {
  position: absolute; left: 0; right: 0; height: 30%; top: -30%;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .28) 85%, #fff 100%);
  animation: scan 2.4s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes scan { to { top: 100%; } }
.loading-line { margin: 0; font: 800 16px/1.2 var(--head); text-transform: uppercase; letter-spacing: .04em; position: relative; }
.loading-time { margin: 6px 0 0; font-size: 12px; color: #d8d8d8; position: relative; font-variant-numeric: tabular-nums; }

.result-error { padding: 16px; border: 1.5px solid var(--red); display: grid; gap: 12px; }
.result-error p { margin: 0; }
.result-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.result-actions:has(#share-btn:not([hidden])) { grid-template-columns: 1fr 1fr; }

.shop-look h3 { margin: 0 0 10px; font: 800 13px/1 var(--head); letter-spacing: .16em; text-transform: uppercase; }
.shop-look ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); text-decoration: none; }
.shop-item:hover { border-color: var(--ink); }
.shop-item img { width: 56px; height: 56px; object-fit: cover; background: var(--mist); mix-blend-mode: multiply; flex: none; }
.shop-item-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.shop-item-title { font: 700 13px/1.25 var(--head); text-transform: uppercase; }
.shop-item-price { font-size: 13px; color: var(--muted); }
.shop-item-cta { font: 800 11px/1 var(--head); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.disclaimer { margin: 0; font-size: 12px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tray-h) + 14px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translateX(-50%); max-width: calc(100% - 32px); padding: 12px 16px;
  background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}

/* ── embed (overlay on eglaf.my) ─────────────────────────────────────── */
.embed .ticker, .embed .bar-shop, .embed .privacy h2 + p + p { display: none; }
.embed .bar-close { display: block; margin-left: auto; width: 40px; height: 40px; border: 0; background: none; color: #fff; font-size: 28px; cursor: pointer; }
.embed .hero { padding-top: 20px; }
.embed .hero h1 { font-size: clamp(36px, 9vw, 64px); }

@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 16px; }
  .filters { grid-template-columns: 1fr auto; align-items: center; }
  .chips { margin: 0; padding: 0; flex-wrap: wrap; }
  .search { width: 260px; }
  .tray { justify-content: flex-end; }
  .tray-picks { flex: 0 1 auto; margin-right: auto; max-width: 1120px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #step-photo { display: grid; grid-template-columns: 420px 1fr; column-gap: 32px; align-items: start; }
  #step-photo h2 { grid-column: 1 / -1; }
  #step-photo .drop { grid-row: 2 / span 3; }
  #step-photo .tips { flex-direction: column; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track, .scan { animation: none; }
}
