/* app.css — component styles, transcribed 1:1 from the FX design's inline
   styles (hangtag-fx.jsx / fx.jsx). Pixel values are the spec — do not
   "clean up" or round. Web layout is the default; `.is-mobile` on the app
   root switches to the HangTagMobileScreen variant (≤768px viewports). */

/* ---- app root ---- */
.ht-app {
  width: 100%;
  min-height: 100vh;
  background: var(--ht-cream);
  font-family: Nunito, sans-serif;
  display: flex;
  flex-direction: column;
  position: relative;
}
.ht-app.is-mobile {
  /* design's 56px slot held the mock iOS status bar; real browsers own that
     chrome, so only safe-area remains */
  padding-top: env(safe-area-inset-top, 0px);
}

/* ---- header ---- */
.hdr { display: flex; align-items: center; gap: 11px; padding: 20px 36px; position: relative; z-index: 1; }
.is-mobile .hdr { padding: 8px 20px 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--ht-accent); display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.is-mobile .brand-logo { width: 28px; height: 28px; }
.brand-name { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 19px; color: var(--ht-ink); }
.is-mobile .brand-name { font-size: 16px; }
.hdr-right { margin-left: auto; font-size: 12px; font-weight: 800; color: #b06a3c; letter-spacing: 0.08em; }
.is-mobile .hdr-right { font-size: 10.5px; }

/* ---- web main layout ---- */
.main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 0 40px 22px; min-height: 0; position: relative; z-index: 1; }
.row { display: flex; align-items: center; justify-content: center; gap: 24px; width: 100%; }
.col-capture { width: 392px; flex-shrink: 0; }
.col-tag { width: 300px; display: flex; align-items: center; justify-content: center; }
.headline { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 34px; color: #352a20; margin: 0 0 6px; line-height: 1.05; }
.sub { font-size: 14.5px; color: #7a6f60; margin: 0 0 18px; }

/* ---- mobile main layout ---- */
.m-main { flex: 1; padding: 4px 20px 28px; display: flex; flex-direction: column; position: relative; z-index: 1; }
.is-mobile .headline { font-size: 27px; margin: 6px 0 4px; line-height: 1.06; }
.is-mobile .sub { font-size: 14px; margin: 0 0 16px; }
.m-proc { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.m-result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 18px; }
.m-legend-wrap { margin-top: auto; padding-top: 22px; }
.tips-wrap { margin-top: 20px; }
.is-mobile .tips-wrap { margin-top: 22px; }

/* ---- capture zone (idle / dragging) ---- */
.cz { height: 208px; border-radius: 20px; border: 2.5px dashed #dcc4a4; background: #fffdf6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; transition: all 0.16s ease; padding: 0 20px; text-align: center; }
.is-mobile .cz { height: 230px; }
.cz.is-drag { border-color: var(--ht-accent); background: var(--ht-accent-soft); }
.cz-icon { width: 56px; height: 56px; border-radius: 50%; background: #fff; border: 1px solid #efe0c9; display: inline-flex; align-items: center; justify-content: center; color: var(--ht-accent); box-shadow: 0 5px 14px rgba(120, 80, 40, 0.12); }
.cz-label { font-family: Fredoka, sans-serif; font-size: 16px; color: #5b5040; }
.cz-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-cam { display: inline-flex; align-items: center; gap: 7px; background: var(--ht-accent); color: #fff; border: none; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 14px; font-family: Nunito, sans-serif; cursor: pointer; box-shadow: var(--ht-soft-shadow); }
.btn-upload { display: inline-flex; align-items: center; gap: 7px; background: #fff; color: #7a4a2c; border: 1.5px solid #e7cdb4; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 14px; font-family: Nunito, sans-serif; cursor: pointer; }
.cz-err { font-size: 12px; color: #b06a3c; }

/* ---- live camera ---- */
.cam { position: relative; height: 208px; border-radius: 20px; overflow: hidden; background: #1a140f; }
.is-mobile .cam { height: 320px; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 22px; }
.cam-cancel { position: absolute; left: 14px; background: rgba(0, 0, 0, 0.45); color: #fff; border: none; border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 13px; font-family: Nunito, sans-serif; cursor: pointer; }
.cam-frame { position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 20px; pointer-events: none; }
.cam-corner { position: absolute; width: 22px; height: 22px; border: 2.5px solid rgba(255, 255, 255, 0.85); border-radius: 3px; }
.cam-corner.nw { top: 16px; left: 16px; border-right: none; border-bottom: none; }
.cam-corner.ne { top: 16px; right: 16px; border-left: none; border-bottom: none; }
.cam-corner.sw { bottom: 70px; left: 16px; border-right: none; border-top: none; }
.cam-corner.se { bottom: 70px; right: 16px; border-left: none; border-top: none; }
.shutter { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, 0.25); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.shutter span { width: 46px; height: 46px; border-radius: 50%; background: #fff; }

/* ---- capture tips ---- */
.tips-title { font-size: 11.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #b59b7c; margin-bottom: 10px; }
.tips { display: flex; flex-direction: column; gap: 9px; }
.tip { display: flex; align-items: center; gap: 11px; }
.tip-icon { width: 28px; height: 28px; border-radius: 9px; background: var(--ht-accent-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--ht-accent); flex-shrink: 0; }
.tip-text { font-size: 13.5px; color: #6b5f4d; font-weight: 600; }

/* ---- grade legend ---- */
.legend { width: 100%; max-width: 860px; }
.legend.compact { max-width: none; }
.legend-title { font-size: 11.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #b59b7c; margin-bottom: 11px; text-align: center; }
.legend.compact .legend-title { font-size: 10.5px; margin-bottom: 9px; text-align: left; }
.legend-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.legend.compact .legend-grid { display: flex; flex-direction: column; gap: 8px; }
.legend-card { display: flex; align-items: center; gap: 11px; background: #fffdf6; border: 1px solid #efe0c9; border-radius: 14px; padding: 13px 15px; box-shadow: 0 2px 6px rgba(120, 80, 40, 0.05); }
.legend.compact .legend-card { padding: 10px 13px; }
.legend-icon { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.legend-text { min-width: 0; }
.legend-label { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 16px; line-height: 1.1; }
.legend.compact .legend-label { font-size: 15px; }
.legend-note { font-size: 12.5px; color: #857a6a; font-weight: 600; line-height: 1.25; }
.legend.compact .legend-note { font-size: 12px; }

/* ---- flow arrow ---- */
.flow { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 74px; flex-shrink: 0; }
.flow path { transition: stroke 0.3s ease; }
.flow-label { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; transition: color 0.3s ease; }

/* ---- tag stage: empty placeholder ---- */
.tag-empty { width: 240px; height: 320px; border-radius: 18px; border: 2px dashed #d8c6a8; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #bcae93; transform: rotate(3deg); padding: 0 24px; text-align: center; }
.tag-empty-title { font-family: Fredoka, sans-serif; font-size: 16px; margin-top: 12px; color: #a8997f; }
.tag-empty-sub { font-size: 12.5px; color: #bcae93; margin-top: 6px; line-height: 1.45; }

/* ---- tag stage: processing card (web) ---- */
/* width matches the result tag (300) so the card doesn't jump on print */
.tag-proc { width: 300px; background: var(--ht-tagpaper); border-radius: 20px; padding: 22px 20px; box-shadow: 0 14px 36px rgba(120, 80, 40, 0.16); border: 1px solid #efe2cb; transform: rotate(-2deg); }

/* ---- processing view ---- */
.pv { width: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.pv.center { align-items: center; }
/* photo height raised 150→190 (user request): keeps the scan readable
   without overwhelming the 268px card */
.pv-photo { width: 100%; height: 190px; border-radius: 14px; overflow: hidden; margin-bottom: 16px; position: relative; background: #f1e7d6; }
.pv.center .pv-photo { width: 200px; height: 200px; border-radius: 20px; box-shadow: 0 14px 30px rgba(120, 80, 40, 0.16); }
.pv-body { width: 100%; max-width: 100%; }
.pv.center .pv-body { width: 280px; }
.pv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pv-label { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #b59b7c; white-space: nowrap; }
.pv-pct { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-weight: 700; color: var(--ht-accent); }
.pv-bar { height: 6px; border-radius: 999px; background: #f1e7d6; overflow: hidden; margin-bottom: 14px; }
.pv-fill { height: 100%; background: var(--ht-accent); border-radius: 999px; transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.steps { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.step { display: flex; align-items: center; gap: 11px; opacity: 0.4; transition: opacity 0.25s ease; }
.step.is-done, .step.is-active { opacity: 1; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: #f1e7d6; color: var(--ht-accent); transition: background 0.25s ease; }
.step.is-done .step-dot { background: #e3f5ec; color: #1b8f6b; }
.step.is-active .step-dot { background: var(--ht-accent-soft); }
.step-pending-dot { width: 6px; height: 6px; border-radius: 50%; background: #c9b89a; }
.step-label { font-size: 13px; font-weight: 600; color: #a89878; }
.step.is-active .step-label { color: var(--ht-ink); }
.step.is-done .step-label { font-weight: 700; color: #4a4438; }
.spinner { animation: tg-spin 0.9s linear infinite; }

/* ---- swing tag (result) ---- */
.tagstage-rel { position: relative; }
/* tag widened 268→300 and photo grown to full card width (user request):
   the captured toy must be human-readable at a glance, web + mobile alike */
.tag { position: relative; width: 300px; background: var(--ht-tagpaper); border-radius: 20px; padding: 26px 22px 20px; box-shadow: 0 18px 44px rgba(120, 80, 40, 0.22); border: 1px solid #efe2cb; }
.tag-string { position: absolute; top: -30px; left: 50%; width: 2px; height: 34px; background: #cbb994; transform: translateX(-50%); }
.tag-hole { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%; border: 3px solid #cbb994; background: var(--ht-cream); z-index: 2; }
.tag-spacer { height: 16px; }
.tag-body { text-align: center; }
.tag-photo { width: 100%; height: 210px; border-radius: 16px; overflow: hidden; margin: 4px auto 14px; display: flex; align-items: center; justify-content: center; position: relative; }
.tag-photo img { width: 100%; height: 100%; object-fit: cover; }
.tag-det { font-size: 11.5px; font-weight: 800; letter-spacing: 0.12em; color: #9a8f7e; text-transform: uppercase; }
.tag-grade { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 40px; line-height: 1; margin: 2px 0 2px; }
.tag-price { font-size: 13px; font-weight: 700; }
.conf { margin: 12px 0 2px; }
.conf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.conf-label { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #9a8f7e; }
.conf-num { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.conf-num .pctsign { font-size: 11px; opacity: 0.7; }
.conf-track { position: relative; height: 9px; border-radius: 999px; background: #efe2cb; overflow: hidden; }
.conf-fill { position: absolute; inset: 0; border-radius: 999px; }
.conf-notch { position: absolute; top: 1.5px; bottom: 1.5px; width: 1.5px; background: rgba(255, 255, 255, 0.6); }
.tag-checks { border-top: 1.5px dashed #e2d6bf; margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.tag-check { display: flex; align-items: center; gap: 8px; }
.tag-check-icon { display: inline-flex; flex-shrink: 0; }
.tag-check-label { font-size: 12.5px; font-weight: 700; color: #4a4438; white-space: nowrap; }
/* model's own words about what it saw (e.g. the defect description) —
   informative for the associate, kept soft so the tag stays scannable */
.tag-check-detail { font-size: 11px; font-style: italic; color: #9a8f7e; line-height: 1.3; margin-top: 1px; }
.tag-check-text { min-width: 0; text-align: left; }
.tag-riddle { font-size: 12px; color: #857a6a; font-style: italic; margin: 12px 0 0; line-height: 1.4; }
.tag-creepy { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: #7d5a8c; background: #f3edf8; border-radius: 999px; padding: 4px 11px; }
.tag-again { margin-top: 14px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: #f1e7d4; color: #6b5f4d; border: none; border-radius: 999px; padding: 10px; font-weight: 800; font-size: 13px; font-family: Nunito, sans-serif; cursor: pointer; }

/* ---- toy wallpaper ---- */
.wp { position: absolute; inset: 0; overflow: hidden; pointer-events: none; -webkit-mask-image: radial-gradient(ellipse 62% 56% at 50% 47%, transparent 40%, #000 80%); mask-image: radial-gradient(ellipse 62% 56% at 50% 47%, transparent 40%, #000 80%); }
.wp-item { position: absolute; }
.wp-drift { display: block; }
.wp-gesture { display: block; transform-origin: 50% 88%; }

/* ---- scan photo / confetti canvases ---- */
.scan-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scan-fallback { position: absolute; inset: 0; }
.scan-fallback img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.94); }
.scan-beam { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, #ffd9a8, transparent); box-shadow: 0 0 14px 3px rgba(255, 180, 90, 0.7); animation: tg-scanbeam 1.3s ease-in-out infinite; }
.confetti-canvas { position: absolute; top: -70px; left: -70px; width: calc(100% + 140px); height: calc(100% + 140px); pointer-events: none; z-index: 3; }

/* ---- inference error state (no design ref; styled to match aesthetic) ---- */
.tag-error { width: 268px; background: var(--ht-tagpaper); border-radius: 20px; padding: 22px 20px; box-shadow: 0 14px 36px rgba(120, 80, 40, 0.16); border: 1px solid #efe2cb; text-align: center; }
.tag-error-title { font-family: Fredoka, sans-serif; font-size: 17px; color: #5b5040; margin-bottom: 6px; }
.tag-error-sub { font-size: 12.5px; color: #857a6a; line-height: 1.45; }
