/* ============================================
   Ratio — styles
   Light/Dark theme via CSS custom properties.
   Mobile-first. Clean, precise, measured.
   ============================================ */

/* ---------- Theme tokens ---------- */
:root {
  color-scheme: light dark;
  --c-bg: #f6f7f9;
  --c-bg-elevated: #ffffff;
  --c-surface: #ffffff;
  --c-surface-2: #eef0f4;
  --c-border: #e1e4ea;
  --c-text: #111827;
  --c-text-muted: #5d6b83;
  --c-primary: #2d3a8c;
  --c-primary-contrast: #ffffff;
  --c-primary-hover: #1e2870;
  --c-accent: #3b5bdb;
  --c-good: #0f7a3f;
  --c-good-bg: #e7f6ed;
  --c-bad: #c33b3b;
  --c-bad-bg: #fdecec;
  --c-warn: #e06c00;
  --c-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --c-shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.10), 0 2px 4px rgba(0, 0, 0, 0.06);
  --c-overlay: rgba(0, 0, 0, 0.45);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --header-h: 56px;
  --footer-h: 48px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

[data-theme="dark"], :root[data-theme="dark"] {
  --c-bg: #0f1117;
  --c-bg-elevated: #1a1d25;
  --c-surface: #1a1d25;
  --c-surface-2: #252a36;
  --c-border: #313848;
  --c-text: #f1f3f7;
  --c-text-muted: #8e99b0;
  --c-primary: #6574e8;
  --c-primary-contrast: #0f1117;
  --c-primary-hover: #7d8ff0;
  --c-accent: #7c9cff;
  --c-good: #34d399;
  --c-good-bg: rgba(52, 211, 153, 0.16);
  --c-bad: #f87171;
  --c-bad-bg: rgba(248, 113, 113, 0.16);
  --c-warn: #fbbf24;
  --c-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --c-shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
  --c-overlay: rgba(0, 0, 0, 0.65);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0f1117;
    --c-bg-elevated: #1a1d25;
    --c-surface: #1a1d25;
    --c-surface-2: #252a36;
    --c-border: #313848;
    --c-text: #f1f3f7;
    --c-text-muted: #8e99b0;
    --c-primary: #6574e8;
    --c-primary-contrast: #0f1117;
    --c-primary-hover: #7d8ff0;
    --c-accent: #7c9cff;
    --c-good: #34d399;
    --c-good-bg: rgba(52, 211, 153, 0.16);
    --c-bad: #f87171;
    --c-bad-bg: rgba(248, 113, 113, 0.16);
    --c-warn: #fbbf24;
    --c-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --c-shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3);
    --c-overlay: rgba(0, 0, 0, 0.65);
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

input, select, textarea {
  font: inherit;
  color: var(--c-text);
}

select option {
  color: var(--c-text);
  background: var(--c-bg);
}

a {
  color: var(--c-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 600;
}

/* ---------- App header ---------- */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--c-primary);
  color: var(--c-primary-contrast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  z-index: 100;
  box-shadow: var(--c-shadow);
}

.app-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 18px;
  font-weight: 600;
}

.app-title__text {
  letter-spacing: 0.05em;
  font-weight: 700;
}

.app-title__logo {
  width: 28px;
  height: 32px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
}
.app-title__logo::before,
.app-title__logo::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.app-title__logo::before { background: var(--c-good); }
.app-title__logo::after { background: var(--c-bad); }

.app-nav {
  display: flex;
  gap: var(--space-1);
}

.nav-btn {
  color: var(--c-primary-contrast);
  opacity: 0.7;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}
.nav-btn:hover { opacity: 1; }
.nav-btn[aria-current="page"] {
  opacity: 1;
  background: rgba(255, 255, 255, 0.18);
}

@media (max-width: 480px) {
  .nav-btn { padding: 6px 8px; font-size: 13px; }
}

/* ---------- Main ---------- */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

.view { display: none; }
.view--active { display: block; }

.view-heading {
  font-size: 24px;
  margin-bottom: var(--space-2);
}
.view-subtitle {
  color: var(--c-text-muted);
  margin: 0 0 var(--space-5) 0;
}

/* ---------- Compare view ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-3);
  align-items: stretch;
  margin-bottom: var(--space-4);
}

.vs-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  color: var(--c-primary);
  padding: 0 var(--space-2);
  user-select: none;
}

@media (max-width: 540px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .vs-badge {
    padding: var(--space-1) 0;
  }
}

/* Product slot card */
.product-slot {
  background: var(--c-surface);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  min-height: 180px;
  display: flex;
  align-items: stretch;
  transition: border-color var(--transition-base), background var(--transition-base);
  overflow: hidden;
}
.product-slot:hover { border-color: var(--c-primary); }
.product-slot[data-filled="true"] {
  border-style: solid;
  border-color: var(--c-border);
  box-shadow: var(--c-shadow);
}

.product-slot__inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: var(--space-4);
  width: 100%;
  text-align: center;
  gap: var(--space-2);
}

.product-slot__inner--empty {
  cursor: pointer;
  color: var(--c-text-muted);
}
.product-slot__inner--empty:hover { color: var(--c-primary); }

.product-slot__icon {
  font-size: 36px;
  font-weight: 300;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.product-slot__inner--empty:hover .product-slot__icon {
  background: var(--c-good-bg);
  color: var(--c-primary);
}
.product-slot__hint {
  font-weight: 500;
}

.product-slot__name {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.product-slot__meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 14px;
  color: var(--c-text-muted);
}
.product-slot__size { font-weight: 500; }
.product-slot__price { font-weight: 600; color: var(--c-text); }
.product-slot__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}

/* Compare actions */
.compare-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

/* Result area */
.result-area {
  margin-top: var(--space-4);
}

.result-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--c-shadow);
}
.result-card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-2);
}
.result-card__title {
  font-size: 18px;
  color: var(--c-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.result-card__format {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text);
  background: var(--c-surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* Bars */
.bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
}

.bar__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
}
.bar__name {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar__unit-price {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.bar__track {
  height: 18px;
  background: var(--c-surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}
.bar__fill {
  height: 100%;
  width: 0;
  background: var(--c-bad);
  border-radius: var(--radius-pill);
  transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bar[data-side="winner"] .bar__fill { background: var(--c-good); }
.bar[data-side="loser"] .bar__fill { background: var(--c-bad); }

.bar__meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--c-text-muted);
}
.bar__total { font-weight: 500; }

.bar__winner-badge {
  display: inline-block;
  background: var(--c-good-bg);
  color: var(--c-good);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  align-self: flex-start;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.savings-badge {
  margin-top: var(--space-4);
  background: var(--c-good);
  color: #ffffff;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--c-shadow);
}

.result-actions {
  margin-top: var(--space-4);
  display: flex;
  justify-content: center;
}

/* Install banner */
.install-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  box-shadow: var(--c-shadow);
  position: relative;
  animation: pop 200ms ease;
}
.install-banner[hidden] { display: none; }
.install-banner__dismiss {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 18px;
  line-height: 1;
  color: var(--c-text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}
.install-banner__dismiss:hover { background: var(--c-surface-2); }
.install-banner__body {
  flex: 1;
  min-width: 0;
  padding-left: var(--space-5);
}
.install-banner__title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}
.install-banner__subtitle {
  font-size: 13px;
  color: var(--c-text-muted);
  line-height: 1.35;
}
.install-banner__btn {
  flex-shrink: 0;
}

/* Ad slot */
.ad-slot {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--c-surface-2);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-md);
  text-align: center;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}
.ad-slot__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--c-text-muted);
}
.ad-slot__placeholder {
  font-size: 13px;
  color: var(--c-text-muted);
  font-style: italic;
}

/* ---------- History view ---------- */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.history-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  box-shadow: var(--c-shadow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.history-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--c-shadow-elevated);
}
.history-item__main {
  flex: 1;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.history-item__top {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.history-item__vs {
  color: var(--c-primary);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}
.history-item__bottom {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--c-text-muted);
  gap: var(--space-2);
  flex-wrap: wrap;
}
.history-item__savings {
  color: var(--c-good);
  font-weight: 500;
}
.history-item__delete {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: 22px;
  border-left: 1px solid var(--c-border);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.history-item__delete:hover {
  background: var(--c-bad-bg);
  color: var(--c-bad);
}
.history-empty {
  text-align: center;
  color: var(--c-text-muted);
  padding: var(--space-6) 0;
}

/* ---------- Settings view ---------- */
.settings-group {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  overflow: hidden;
}
.settings-group__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-3) var(--space-4);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  gap: var(--space-3);
  border-bottom: 1px solid var(--c-border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 500;
}
.settings-row__control {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
select.settings-row__control,
.settings-row__control select,
.settings-row__control input[type="number"] {
  padding: 6px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  color: var(--c-text);
  min-width: 120px;
}
select.settings-row__control {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 12px;
}
.settings-hint {
  font-size: 13px;
  color: var(--c-text-muted);
  margin: 0;
  padding: var(--space-3) var(--space-4) var(--space-3);
  line-height: 1.45;
}
.settings-footer {
  text-align: center;
  color: var(--c-text-muted);
  padding: var(--space-4) 0;
}

/* ---------- Footer ---------- */
.app-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-h);
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.donate-pill {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--c-surface-2);
  color: var(--c-text);
  transition: background var(--transition-fast);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.donate-pill:hover { background: var(--c-border); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  background: var(--c-surface-2);
  color: var(--c-text);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
  min-height: 40px;
  white-space: nowrap;
}
.btn:hover { background: var(--c-border); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--c-primary);
  color: var(--c-primary-contrast);
}
.btn--primary:hover { background: var(--c-primary-hover); }

.btn--ghost {
  background: transparent;
  border-color: var(--c-border);
}
.btn--ghost:hover { background: var(--c-surface-2); }

.btn--danger {
  background: var(--c-bad);
  color: #fff;
}
.btn--danger:hover { background: var(--c-bad); filter: brightness(0.9); }

.btn--small {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 32px;
}

.btn--block { width: 100%; margin: 0 var(--space-4); }
.settings-group .btn--block { margin: 0; }
.settings-group .btn--block + .settings-hint { padding-top: var(--space-2); }

/* Make the data actions stack nicely */
.settings-group .btn--block + .btn--block { margin-top: var(--space-2); }

/* ---------- Dialogs ---------- */
.dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  inset: 0;
  color: var(--c-text);
}
.dialog::backdrop {
  background: var(--c-overlay);
  backdrop-filter: blur(2px);
}
.dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog__inner {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: min(420px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--c-shadow-elevated);
}

.dialog__title {
  font-size: 20px;
  margin-bottom: var(--space-2);
}
.dialog__sub {
  color: var(--c-text-muted);
  margin: 0 0 var(--space-4) 0;
}

.dialog__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  margin-top: var(--space-4);
}
.dialog__actions--stacked {
  flex-direction: column;
}
.dialog__actions--stacked .btn { width: 100%; }

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
}
.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
}
.field__input {
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-bg);
  color: var(--c-text);
  width: 100%;
  transition: border-color var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}
.field__input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-good-bg);
}
.field-row {
  display: flex;
  gap: var(--space-2);
}
.field--flex { flex: 2; }
.field--small { flex: 1; }

/* Scanner */
.dialog--scanner .dialog__inner { width: min(560px, calc(100% - 16px)); }
.scanner-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: var(--space-3) 0;
  touch-action: none;
  cursor: pointer;
}
#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.focus-reticle {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 2px solid #ff5252;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.focus-reticle.is-visible {
  opacity: 1;
  animation: focus-pulse 1s ease-in-out 2;
}
@keyframes focus-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(0.85); }
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scanner-overlay::before,
.scanner-overlay::after {
  content: "";
  position: absolute;
  width: 60%;
  height: 30%;
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}
.scanner-overlay::before { top: 0; left: 50%; transform: translateX(-50%); border-bottom: none; }
.scanner-overlay::after { bottom: 0; left: 50%; transform: translateX(-50%); border-top: none; }
.scanner-overlay__line {
  position: absolute;
  left: 22%;
  right: 22%;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff5252, transparent);
  animation: scan 1.5s ease-in-out infinite;
}
@keyframes scan {
  0%, 100% { transform: translateY(-30px); opacity: 0.6; }
  50% { transform: translateY(30px); opacity: 1; }
}
.scanner-status {
  position: absolute;
  bottom: 12px;
  left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 6px 12px;
  margin: 0 auto;
  width: fit-content;
  border-radius: var(--radius-pill);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + 16px);
  transform: translateX(-50%);
  background: var(--c-text);
  color: var(--c-bg);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  box-shadow: var(--c-shadow-elevated);
  z-index: 1000;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast[hidden] { display: none; }

/* ---------- Accessibility & focus ---------- */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* ---------- Animations ---------- */
@keyframes pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.view--active { animation: pop 200ms ease; }

/* ---------- Print-friendly (history export) ---------- */
@media print {
  .app-header, .app-footer, .nav-btn, .compare-actions, .result-actions, .ad-slot {
    display: none !important;
  }
}
