/* layout: one column, scanner on top, result card below; phone-first */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --fg: #1b2230;
  --muted: #68707e;
  --line: #d9d7cf;
  --ink: #1b2a41;        /* header, buttons */
  --ink-fg: #f6f4ee;
  --accent: #f2b705;     /* safety yellow — price */
  --accent-fg: #1b1a12;
  --ok: #2a7f4f;
  --warn: #b7471d;
  --font-body: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Rubik', 'Heebo', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181f; --surface: #1d232c; --fg: #ecebe6; --muted: #9aa2ad; --line: #2e3540;
    --ink: #0f1826; --ink-fg: #f6f4ee; --accent: #f5c33b; --accent-fg: #1b1a12; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14181f; --surface: #1d232c; --fg: #ecebe6; --muted: #9aa2ad; --line: #2e3540;
  --ink: #0f1826; --ink-fg: #f6f4ee; --accent: #f5c33b; --accent-fg: #1b1a12; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 16px; line-height: 1.45; display: flex; flex-direction: column; min-height: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.bar { background: var(--ink); color: var(--ink-fg); padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.78rem; opacity: 0.75; }
.btn-ghost { background: transparent; color: var(--ink-fg); border: 1px solid rgba(255,255,255,0.35); border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; }
.btn-ghost:focus-visible, .btn-main:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 14px; }

.scanner { background: #000; border-radius: 10px; overflow: hidden; position: relative; }
.reader { width: 100%; min-height: 240px; }
.reader video { width: 100% !important; display: block; }
.reader img { display: none; } /* הספרייה מציירת לוגו בעת הטעינה — לא רלוונטי */
.hint { margin: 0; padding: 8px 12px; font-size: 0.85rem; color: #d9d7cf; background: rgba(0,0,0,0.55); position: absolute; bottom: 0; inset-inline: 0; text-align: center; }

.mode-row { display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-btn { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.95rem; padding: 9px 8px; cursor: pointer; }
.seg-btn[aria-checked="true"] { background: var(--ink); color: var(--ink-fg); font-weight: 700; }
.seg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.btn-arm { border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font: inherit; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; padding: 14px; cursor: pointer; }
.btn-arm.armed { background: var(--surface); color: var(--fg); border: 2px dashed var(--accent); }
.btn-arm:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.manual { display: flex; gap: 8px; }
.manual input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font-variant-numeric: tabular-nums; }
.btn-main { background: var(--ink); color: var(--ink-fg); border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer; }

.result { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.result-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.part { font-variant-numeric: tabular-nums; direction: ltr; }
.name { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; line-height: 1.3; text-wrap: balance; }
.price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.price-main, .price-side { display: flex; flex-direction: column; }
.price-label { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.02em; }
.price { font-family: var(--font-display); font-weight: 800; font-size: 2.6rem; line-height: 1.1; background: var(--accent); color: var(--accent-fg); padding: 2px 12px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.price-small { font-size: 1.1rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.meta { margin: 0; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.meta code { font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; unicode-bidi: isolate; }

.status { border-radius: 10px; padding: 12px 14px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); }
.status.warn { border-color: var(--warn); color: var(--warn); }
.status.ok { border-color: var(--ok); color: var(--ok); }

.history h3 { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.history li { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.history li button { all: unset; cursor: pointer; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history li b { font-variant-numeric: tabular-nums; }

.foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 0.75rem; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .result { animation: pop 180ms ease-out; }
  @keyframes pop { from { transform: translateY(6px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
