:root {
  --paper: #f2f0e8;
  --paper-deep: #e4e0d4;
  --ink: #151613;
  --muted: #6f7068;
  --line: rgba(21, 22, 19, .2);
  --acid: #d9ff43;
  --orange: #ff5c35;
  --white: #fffef8;
  --radius: 2px;
  --display: "Bodoni 72", "Didot", "Noto Serif SC", "Songti SC", serif;
  --body: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 7%, rgba(217,255,67,.42), transparent 18rem),
    linear-gradient(120deg, var(--paper), #f7f4eb 52%, var(--paper-deep));
  font-family: var(--body);
  min-height: 100vh;
}
button, select, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.grain {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .18;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.23'/%3E%3C/svg%3E");
}

.site-header, main, footer { width: min(1500px, calc(100% - 56px)); margin-inline: auto; }
.site-header {
  height: 86px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--ink); position: relative; z-index: 3;
}
.wordmark { color: var(--ink); text-decoration: none; font-weight: 900; font-size: 19px; letter-spacing: -.05em; }
.wordmark i { color: var(--orange); font-style: normal; padding: 0 5px; }
.header-meta { display: flex; align-items: center; gap: 10px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #53c734; box-shadow: 0 0 0 4px rgba(83,199,52,.12); }
.edition { border-left: 1px solid var(--line); padding-left: 12px; color: var(--muted); }

.intro { display: grid; grid-template-columns: 1.35fr .65fr; align-items: end; gap: 60px; padding: 84px 0 62px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .18em; margin: 0 0 18px; }
h1, h2 { font-family: var(--display); font-weight: 500; letter-spacing: -.05em; margin: 0; }
h1 { font-size: clamp(54px, 7.1vw, 112px); line-height: .86; }
h1 em { color: var(--orange); font-weight: 500; }
.intro-copy { margin: 0; max-width: 430px; font-size: 16px; line-height: 1.8; border-top: 1px solid var(--ink); padding-top: 20px; }

.search-shell { display: grid; grid-template-columns: minmax(320px,.72fr) minmax(420px,1.28fr); min-height: 610px; border: 1px solid var(--ink); background: rgba(255,254,248,.58); }
.query-panel { padding: 28px; border-right: 1px solid var(--ink); }
.query-panel form { height: 100%; display: flex; flex-direction: column; }
.drop-zone { flex: 1; min-height: 340px; border: 1px dashed var(--ink); position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; transition: background .2s, transform .2s; text-align: center; }
.drop-zone:hover, .drop-zone.dragging { background: var(--acid); transform: translate(-3px,-3px); box-shadow: 7px 7px 0 var(--ink); }
.drop-number { position: absolute; top: 18px; left: 18px; font-family: var(--display); font-size: 27px; }
.drop-icon { width: 62px; margin-bottom: 22px; }
.drop-icon svg { width: 100%; stroke: currentColor; stroke-width: 1.5; }
.drop-zone strong { font-family: var(--display); font-size: 28px; font-weight: 500; max-width: 90%; overflow-wrap: anywhere; }
.drop-zone > span { color: var(--muted); font-size: 12px; margin-top: 12px; }
.query-controls { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.query-controls label { display: grid; gap: 7px; }
.query-controls label > span { font-size: 10px; font-weight: 800; letter-spacing: .12em; }
select { height: 46px; border: 1px solid var(--ink); border-radius: 0; background: transparent; padding: 0 12px; }
.search-button { grid-column: 1 / -1; margin-top: 8px; height: 58px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 22px; font-weight: 800; cursor: pointer; }
.search-button svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .2s; }
.search-button:hover:not(:disabled) { background: var(--orange); }
.search-button:hover svg { transform: translateX(4px); }
.search-button:disabled { opacity: .35; cursor: not-allowed; }
.search-button.is-loading span::after { content: "···"; animation: blink 1s infinite; }

.preview-panel { min-width: 0; padding: 28px; display: flex; flex-direction: column; background: var(--ink); color: var(--white); }
.panel-label { font-size: 10px; letter-spacing: .16em; display: flex; gap: 10px; }
.panel-label span { color: var(--acid); }
.empty-preview, .image-stage { flex: 1; min-height: 490px; margin-top: 20px; }
.empty-preview { border: 1px solid rgba(255,255,255,.24); display: grid; place-items: center; position: relative; text-align: center; color: rgba(255,255,255,.48); line-height: 1.8; }
.scan-corners::before, .scan-corners::after { content:""; position:absolute; width: 64px; height: 64px; }
.scan-corners::before { top: 24px; left: 24px; border-top: 2px solid var(--acid); border-left: 2px solid var(--acid); }
.scan-corners::after { bottom: 24px; right: 24px; border-bottom: 2px solid var(--acid); border-right: 2px solid var(--acid); }
.image-stage { display: grid; place-items: center; overflow: hidden; }
.image-frame { display: inline-block; max-width: 100%; max-height: 530px; position: relative; line-height: 0; }
.image-frame > img { display: block; max-width: 100%; max-height: 530px; object-fit: contain; }
.subject-overlay { position: absolute; inset: 0; }
.subject-box { position: absolute; padding: 0; background: rgba(217,255,67,.04); border: 1.5px solid var(--acid); cursor: pointer; transition: background .18s, box-shadow .18s; }
.subject-box span { position: absolute; top: -1px; left: -1px; background: var(--acid); color: var(--ink); font-size: 11px; font-weight: 900; line-height: 25px; width: 29px; text-align: center; }
.subject-box:hover, .subject-box.active { background: rgba(217,255,67,.2); box-shadow: inset 0 0 0 1px var(--acid), 0 0 24px rgba(217,255,67,.18); }
.stage-footer { padding-top: 18px; display: flex; justify-content: space-between; font-size: 11px; color: rgba(255,255,255,.55); }
.stage-footer button { background: transparent; border: 0; color: var(--acid); cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }

.status-panel { margin: 18px 0; border: 1px solid var(--ink); background: var(--white); }
.status-track { height: 7px; background: var(--paper-deep); overflow: hidden; }
.status-track span { display: block; height: 100%; width: 10%; background: var(--orange); transition: width .25s; }
.status-copy { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; }
.status-copy strong { font-family: var(--display); font-size: 20px; }
.status-copy span { color: var(--muted); font-size: 12px; }

.results-section { padding: 100px 0 80px; scroll-margin-top: 20px; }
.results-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; }
h2 { font-size: clamp(42px, 5vw, 76px); line-height: .95; }
.timing-strip { display: flex; border: 1px solid var(--ink); background: var(--white); }
.timing-strip span { display: grid; gap: 4px; padding: 11px 14px; font-family: monospace; font-size: 11px; border-left: 1px solid var(--line); }
.timing-strip span:first-child { border: 0; }
.timing-strip b { font-family: var(--body); font-size: 8px; letter-spacing: .12em; }
.active-subject-head { display: flex; align-items: end; justify-content: space-between; margin-top: 45px; padding: 32px 0 26px; border-top: 1px solid var(--ink); }
.active-subject-head > div { display: flex; align-items: center; gap: 20px; }
.active-index { font-family: var(--display); font-size: 68px; line-height: .8; color: var(--orange); }
.active-subject-head p { margin: 0 0 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.active-subject-head h3 { margin: 0; font-family: var(--display); font-size: 30px; font-weight: 500; }
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.product-card { min-width: 0; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: rgba(255,254,248,.5); animation: card-in .45s both; animation-delay: var(--delay); }
.product-image { aspect-ratio: 4/5; position: relative; background: var(--paper-deep); overflow: hidden; border-bottom: 1px solid var(--ink); }
.product-image img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; opacity: 0; transition: opacity .25s, transform .5s; }
.product-image.loaded img { opacity: 1; }
.product-card:hover img { transform: scale(1.035); }
.image-fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: rgba(21,22,19,.35); }
.image-fallback span { font-family: var(--display); font-size: 72px; }
.image-fallback small { font-size: 8px; letter-spacing: .16em; }
.rank, .score { position: absolute; z-index: 3; top: 10px; padding: 5px 7px; font-size: 10px; font-weight: 900; }
.rank { left: 10px; background: var(--ink); color: var(--white); }
.score { right: 10px; background: var(--acid); }
.product-info { padding: 18px 16px 20px; min-height: 134px; }
.product-info p { margin: 0 0 7px; color: var(--orange); text-transform: uppercase; font-size: 9px; letter-spacing: .12em; font-weight: 800; }
.product-info h4 { font-family: var(--display); font-size: 21px; font-weight: 500; line-height: 1.12; margin: 0; min-height: 47px; }
.product-info div { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; color: var(--muted); font-size: 9px; }
.empty-results { padding: 80px 20px; border: 1px solid var(--ink); text-align: center; color: var(--muted); }

.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; width: min(420px, calc(100% - 44px)); padding: 18px 46px 18px 18px; background: var(--orange); color: white; box-shadow: 8px 8px 0 var(--ink); }
.toast strong, .toast span { display: block; }
.toast span { margin-top: 5px; font-size: 12px; line-height: 1.5; }
.toast button { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; color: white; font-size: 24px; cursor: pointer; }
footer { border-top: 1px solid var(--ink); padding: 26px 0 42px; display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .12em; }

@keyframes card-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: .25; } }

@media (max-width: 1050px) {
  .intro { grid-template-columns: 1fr; }
  .intro-copy { justify-self: end; }
  .search-shell { grid-template-columns: 1fr; }
  .query-panel { border-right: 0; border-bottom: 1px solid var(--ink); }
  .product-grid { grid-template-columns: repeat(3,1fr); }
  .results-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 720px) {
  .site-header, main, footer { width: min(100% - 28px, 1500px); }
  .site-header { height: 70px; }
  .edition { display: none; }
  .intro { padding: 52px 0 40px; gap: 28px; }
  h1 { font-size: clamp(48px, 15vw, 74px); }
  .intro-copy { font-size: 14px; }
  .search-shell { border-inline: 0; margin-inline: -14px; }
  .query-panel, .preview-panel { padding: 20px 14px; }
  .drop-zone { min-height: 290px; }
  .empty-preview, .image-stage { min-height: 390px; }
  .image-frame, .image-frame > img { max-height: 430px; }
  .status-copy { align-items: start; flex-direction: column; gap: 5px; }
  .results-section { padding-top: 68px; }
  .timing-strip { width: 100%; overflow-x: auto; }
  .active-subject-head { align-items: start; flex-direction: column; gap: 18px; }
  .product-grid { grid-template-columns: repeat(2,1fr); }
  .product-info { padding: 13px 11px 15px; min-height: 124px; }
  .product-info h4 { font-size: 18px; }
}
@media (max-width: 430px) {
  .header-meta #serviceState { display: none; }
  .query-controls { grid-template-columns: 1fr; }
  .search-button { grid-column: 1; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .active-index { font-size: 54px; }
  footer { flex-direction: column; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
