/* Glean — Offline Deal Hunter
   Plain CSS, no build step. Themes: ledger, vault, grove.
   System fonts only, so the desk works fully offline. */

:root,
[data-theme="ledger"] {
  --bg: #efe7d8;
  --bg-elev: #faf6ee;
  --bg-mute: #e6dcc8;
  --ink: #2a2318;
  --ink-soft: #6d6356;
  --line: #d6cbb6;
  --accent: #b55a2a;
  --accent-hover: #94471f;
  --accent-soft: #f4e4d8;
  --good: #3d5a45;
  --good-soft: #e4ede6;
  --warn: #9a6a1c;
  --warn-soft: #f3ead6;
  --again: #8c3a32;
  --shadow: 0 18px 50px rgba(42, 35, 24, 0.09);
  --grain: 0.07;
  --cheap: #3d5a45;
  --cheap-bg: #e4ede6;
  --paper: #faf6ee;
  --paper-2: #e6dcc8;
}

[data-theme="vault"] {
  --bg: #13110f;
  --bg-elev: #1d1a16;
  --bg-mute: #2a261f;
  --ink: #f3ece3;
  --ink-soft: #b0a79b;
  --line: #3a342b;
  --accent: #d4b07a;
  --accent-hover: #e2c396;
  --accent-soft: #2c261c;
  --good: #8fbf9a;
  --good-soft: #1e2a22;
  --warn: #e0b35c;
  --warn-soft: #2c261c;
  --again: #e08a72;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --grain: 0.1;
  --cheap: #8fbf9a;
  --cheap-bg: #1e2a22;
  --paper: #1d1a16;
  --paper-2: #2a261f;
}

[data-theme="grove"] {
  --bg: #e6eee6;
  --bg-elev: #f5f8f4;
  --bg-mute: #d5e0d5;
  --ink: #1c241c;
  --ink-soft: #516056;
  --line: #c5d2c6;
  --accent: #2f6b4f;
  --accent-hover: #24553e;
  --accent-soft: #dcece3;
  --good: #2f6b4f;
  --good-soft: #dcece3;
  --warn: #8a5a1c;
  --warn-soft: #f3ead6;
  --again: #8c3a32;
  --shadow: 0 18px 50px rgba(28, 36, 28, 0.08);
  --grain: 0.05;
  --cheap: #2f6b4f;
  --cheap-bg: #dcece3;
  --paper: #f5f8f4;
  --paper-2: #d5e0d5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  letter-spacing: -0.011em;
  position: relative;
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--bg-elev);
  padding: 0.5rem 1rem;
  z-index: 20;
}
.skip:focus { left: 0.75rem; top: 0.75rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top, #app, .foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.5rem 0.45rem;
  max-width: 1280px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.brand img { border-radius: 7px; display: block; }

.hello { flex: 1; min-width: 0; }
.hello .text-btn { display: inline; margin-left: 0.15rem; font-size: 0.78rem; }
.hello .text-btn[hidden],
#clear-demo[hidden] { display: none !important; }
.greet {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.date { color: var(--ink-soft); font-size: 0.82rem; }

.nav {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-mute);
  border-radius: 999px;
  padding: 0.18rem;
  border: 1px solid var(--line);
}
.nav-btn {
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}
.nav-btn.is-active {
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}
.nav-btn:hover { color: var(--ink); }

.top-actions { display: flex; align-items: center; gap: 0.7rem; }
.theme-switch { display: flex; gap: 0.35rem; }

.swatch {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--line);
  cursor: pointer; padding: 0;
  background: #efe7d8;
}
.swatch[data-theme-btn="vault"] { background: #13110f; }
.swatch[data-theme-btn="grove"] { background: #e6eee6; }
.swatch.is-active { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon-btn, .text-btn, .btn-ghost, .btn-primary, .btn-danger, .nav-btn {
  font: inherit; cursor: pointer;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.icon-btn:hover, .btn-ghost:hover, .text-btn:hover { background: var(--bg-mute); }

.alert-btn .badge {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
[data-theme="vault"] .alert-btn .badge { color: #1a140c; }
.badge[hidden] { display: none !important; }

.text-btn {
  background: none; border: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.2rem 0.1rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 1.25rem;
  font-weight: 650;
  min-width: 5.5rem;
}
[data-theme="vault"] .btn-primary { color: #1a140c; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--accent); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}
.btn-danger:hover { background: var(--accent-soft); }

a.btn-primary { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

#app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.2rem 1.5rem 0.85rem;
}

.hero {
  padding: 1.4rem 1.35rem 1.2rem;
  margin-bottom: 0.85rem;
}
.hero h1 {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
  letter-spacing: -0.03em;
  font-weight: 600;
  line-height: 1.15;
  text-transform: none;
  color: var(--ink);
}
.hero-lead {
  color: var(--ink-soft);
  max-width: 42rem;
  margin: 0.55rem 0 1.05rem;
}
.hunt-form {
  display: flex;
  gap: 0.5rem;
  max-width: 54rem;
  flex-wrap: wrap;
}
.hunt-form input[type="search"] {
  flex: 1;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.7rem 1.05rem;
  font-size: 1rem;
}
.hero-hint { color: var(--ink-soft); font-size: 0.82rem; margin: 0.7rem 0 0.3rem; max-width: 46rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin: 0 0 0.85rem;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.7rem 0.9rem 0.75rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.stat-value {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 650;
  margin-top: 0.15rem;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1.15rem 1rem;
  min-width: 0;
  margin-bottom: 0.85rem;
}

.card-kicker, .card h2, .study-progress, .stat-label, .offer-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 650;
  font-family: "Segoe UI", system-ui, sans-serif;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}
.card-head h2 { margin: 0; color: var(--ink-soft); }
.card-head .muted { margin: 0; }

.subhead {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 650;
  margin: 1rem 0 0.5rem;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
}
.store-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 0.95rem;
  color: inherit;
  text-decoration: none;
  min-height: 6.2rem;
}
.store-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.store-name {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.store-domain { color: var(--ink-soft); font-size: 0.78rem; word-break: break-all; }
.store-sort { color: var(--accent); font-size: 0.75rem; font-weight: 650; margin-top: auto; }

.offer-list { list-style: none; display: flex; flex-direction: column; gap: 0.55rem; }
.offer {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(5.5rem, 0.55fr)) auto;
  gap: 0.6rem 0.8rem;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
}
.offer.is-cheap {
  border-color: var(--cheap);
  background: var(--cheap-bg);
}
.offer-title { font-weight: 650; line-height: 1.3; }
.offer-source { color: var(--ink-soft); font-size: 0.82rem; }
.offer-num { font-variant-numeric: tabular-nums; }
.offer-num small { display: block; color: var(--ink-soft); font-size: 0.72rem; }
.pill {
  display: inline-block;
  background: var(--cheap);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-left: 0.35rem;
}
[data-theme="vault"] .pill { color: #1a140c; }
.offer-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: flex-end; }
.sample-note, .nudge {
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  margin-bottom: 0.7rem;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.item-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.9rem 0.95rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  font: inherit;
  width: 100%;
}
.item-card:hover { border-color: var(--accent); }
.item-card.is-hit { box-shadow: inset 3px 0 0 var(--cheap); }
.item-name {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.item-meta { color: var(--ink-soft); font-size: 0.84rem; }
.item-price {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.browse-tools {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.browse-tools input[type="search"],
.browse-tools select,
.field select,
.field input,
.field textarea,
.hunt-form input {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
}
.browse-tools input[type="search"] { flex: 1; min-width: 8rem; }

.study-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.2rem 0 0.85rem;
  flex-wrap: wrap;
}
.study-meta { flex: 1; min-width: 0; }
.study-deck {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.head-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.price-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.price-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 650;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.price-table td { padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.price-table tr.is-cheap td { background: var(--cheap-bg); }
.chart {
  width: 100%;
  height: 88px;
  margin: 0.4rem 0 0.8rem;
}
.chart path { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .dots { fill: var(--accent); }

.list-row, .watch-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child, .watch-row:last-child { border-bottom: 0; }
.group-head {
  font-weight: 650;
  margin: 0.85rem 0 0.3rem;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
}

.foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.4rem 1.5rem 1.6rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.built-by { margin-top: 0.35rem; }
.built-btn { font-size: 0.82rem; color: var(--ink-soft); }
.lite-credit { margin-top: 0.35rem; max-width: 42rem; }
.lite-credit a { color: var(--accent); }
.disclaimer { margin-top: 0.55rem; max-width: 46rem; font-size: 0.75rem; }

.about-lead {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.7rem;
}
.about-maker {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.7rem;
}

.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 1rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 16, 12, 0.42);
}
.modal-card {
  position: relative; z-index: 1;
  width: min(520px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.05rem 1.15rem 1.15rem;
}
.modal-wide { width: min(680px, 100%); }

.field, .session-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.field input, .field textarea, .field select {
  width: 100%;
  resize: vertical;
}
.field-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 7rem; }
.field-row .field.grow { flex: 2; min-width: 12rem; }
.check {
  display: flex; align-items: center; gap: 0.45rem;
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
  color: var(--ink);
}
.tight { margin-top: -0.45rem; margin-bottom: 0.8rem; }

.field input:focus, .field textarea:focus, .field select:focus,
.browse-tools input:focus, .browse-tools select:focus,
.hunt-form input:focus,
.icon-btn:focus-visible, .btn-primary:focus-visible, .btn-ghost:focus-visible,
.text-btn:focus-visible, .swatch:focus-visible, .nav-btn:focus-visible,
.store-card:focus-visible, .item-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.settings-actions, .backup-actions {
  display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.3rem;
}
.backup { margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px dashed var(--line); }
.muted { color: var(--ink-soft); font-size: 0.84rem; margin-bottom: 0.7rem; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; position: relative; }
.file-btn input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.form-msg { min-height: 1.2em; margin-top: 0.6rem; font-size: 0.82rem; color: var(--good); }
.form-msg.is-error { color: var(--accent); }

.store-settings { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.store-row {
  display: grid;
  grid-template-columns: auto 7rem 1fr;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.4rem 0.55rem;
}
.store-row select { font: inherit; color: var(--ink); background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px; padding: 0.25rem 0.4rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: var(--bg-elev);
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  z-index: 60;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  max-width: min(90vw, 32rem);
  text-align: center;
}
.toast[hidden] { display: none; }

.empty-hint { color: var(--ink-soft); padding: 0.6rem 0 0.2rem; }
.tiny-btn {
  font: inherit; cursor: pointer;
  background: none; border: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0 0.2rem;
}
.hit-flag { color: var(--cheap); font-weight: 650; font-size: 0.8rem; }

.noscript {
  position: relative; z-index: 2;
  margin: 1rem auto; max-width: 40rem;
  padding: 1rem;
  background: var(--accent-soft);
  border-radius: 12px;
}

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  #app, .top, .foot { padding-left: 1rem; padding-right: 1rem; }
  .offer { grid-template-columns: 1fr 1fr; }
  .offer-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 0.6rem; }
  .hello { order: 3; flex-basis: 100%; }
  .nav { order: 4; flex-basis: 100%; justify-content: space-between; }
  .greet { font-size: 1.15rem; }
  .hunt-form { flex-direction: column; }
  .hunt-form .btn-primary { width: 100%; }
  .hunt-market { max-width: none; width: 100%; flex: 1 1 auto; }
  .store-row { grid-template-columns: 1fr; }
  .price-table { display: block; overflow-x: auto; }
  .list-row, .watch-row { grid-template-columns: auto 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  /* Keep ELARA's gentle sway (transform-only, ~4deg / 1.4s). A blanket
     animation:none !important here previously froze the corner figure on
     desktops with OS "reduce motion" / Windows animation effects off. */
  *:not(.elara-sway):not(.elara-bounce):not(.elara-frame),
  *:not(.elara-sway):not(.elara-bounce)::before,
  *:not(.elara-sway):not(.elara-bounce)::after {
    transition: none !important;
    animation: none !important;
  }
  .elara-frame {
    transition: none;
  }
}

.install-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.35rem;
}
.install-hint { margin-top: 0.35rem; }
.affiliate-disclosure,
.store-link-note,
.privacy-note {
  margin-top: 0.85rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 42rem;
}
.privacy-note { margin: 0.35rem 0 0; }
.store-link-note { margin-top: 0.75rem; }

#install-ios[hidden], #install-btn[hidden], #affiliate-disclosure[hidden] { display: none !important; }


/* ---------- Ease of use + value ranking + ELARA (website, not app chrome) ---------- */
.hunt-form { align-items: stretch; }
.hunt-field { position: relative; flex: 1 1 16rem; min-width: 0; z-index: 8; }
.hunt-field input[type="search"] { width: 100%; }
.hunt-market {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  min-height: 44px;
  min-width: 10.5rem;
  max-width: 16rem;
  flex: 0 1 14rem;
}
.hunt-market:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.market-empty {
  margin: 0.4rem 0 0.8rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.market-empty p { margin: 0 0 0.5rem; }
.hunt-form .btn-primary,
.nav-btn, .btn-primary, .btn-ghost, .text-btn, .icon-btn {
  min-height: 44px;
}
.icon-btn { min-width: 44px; }
.suggest {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 4px);
  z-index: 80;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(42, 35, 24, 0.18);
  max-height: 16rem;
  overflow: auto;
  isolation: isolate;
  opacity: 1;
}
.suggest[hidden] { display: none; }
.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
}
.suggest-item:hover,
.suggest-item.is-active { background: var(--bg-mute); }
.suggest-item small { color: var(--ink-soft); }
.recent-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0.75rem 0 0.2rem;
}
.recent-label { color: var(--ink-soft); font-size: 0.82rem; }
.recent-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: inherit;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}
.chip:hover { border-color: var(--ink-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; margin-top: 0.6rem; }
.advanced { margin-top: 0.8rem; }
.advanced summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.88rem;
  padding: 0.35rem 0;
}
.advanced .btn-ghost { margin-top: 0.5rem; }

.empty-hunt {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.4rem;
  margin-top: 1rem;
}
.empty-hunt[hidden] { display: none !important; }
.empty-hunt .elara-portrait {
  width: 140px;
  height: auto;
  border-radius: 18px;
  object-fit: cover;
  object-position: top center;
  flex-shrink: 0;
  background: #e8d5c0;
  box-shadow: 0 8px 20px rgba(30,24,16,0.08);
}
.empty-hunt h2 { margin: 0 0 0.35rem; font-size: 1.25rem; }

.offer-list { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; padding: 0; margin: 0; }
.offer {
  display: grid;
  grid-template-columns: 96px minmax(0, 1.4fr) auto auto auto;
  gap: 0.7rem 1rem;
  align-items: start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
}
.offer-thumb {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  align-self: start;
}
.offer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  display: block;
}
.offer-thumb.is-empty::after {
  content: "";
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 6px;
  background: #ececec;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.offer-body { min-width: 0; }
.offer.is-best { border-color: #c9a227; box-shadow: 0 0 0 1px rgba(201,162,39,0.35); }
.offer.is-cheap {
  border-color: var(--cheap);
  background: var(--cheap-bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cheap) 50%, transparent), 0 10px 24px rgba(47, 109, 79, 0.14);
}
.offer.is-warn { border-color: #c4843a; }
.offer-head { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.25rem 0 0.15rem; }
.offer-title { font-weight: 650; line-height: 1.3; }
.offer-source { color: var(--ink-soft); font-size: 0.82rem; }
.offer-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.7rem; margin-top: 0.3rem; font-size: 0.8rem; color: var(--ink-soft); }
.offer-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-width: 5.5rem;
}
.offer-score strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.offer-score small { color: var(--ink-soft); font-size: 0.72rem; }
.score-bar {
  width: 5.2rem;
  height: 6px;
  border-radius: 99px;
  background: rgba(0,0,0,0.08);
  overflow: hidden;
}
.score-bar > span { display: block; height: 100%; background: #2f7d4a; border-radius: inherit; }
.offer.is-warn .score-bar > span { background: #c4843a; }
.badge, .pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--paper-2, rgba(0,0,0,0.05));
}
.badge-value { background: #f3e2a4; color: #5a4208; }
.badge-trusted { background: #d7eadc; color: #1d4d32; }
.badge-official { background: #d9e4f5; color: #1d3557; }
.badge-cheap { background: var(--cheap); color: #fff; }
[data-theme="vault"] .badge-cheap { color: #1a140c; }
.badge-warn { background: #f6d9b8; color: #6a3a0c; }
.offer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-start;
  grid-column: 2 / -1;
}
.buy-at {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.15rem;
  font-size: 1rem;
  font-weight: 700;
  flex: 1 1 12rem;
  text-decoration: none;
}
.offer-actions .btn-ghost { min-height: 40px; }

.why-btn {
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.2rem 0;
  min-height: 32px;
}
.why-tip {
  margin: 0.35rem 0 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--bg-mute);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.why-tip[hidden] { display: none; }
.fetch-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1.1rem;
  margin: 0.4rem 0 0.8rem;
}
.fetch-toolbar label { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; }
.fetch-toolbar select, .fetch-toolbar input[type="range"] { font: inherit; }
#rating-val { min-width: 2.6rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.sample-note { margin: 0 0 0.7rem; }

.onboard {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.onboard[hidden] { display: none !important; }
.onboard-backdrop { position: absolute; inset: 0; background: rgba(20,16,12,0.58); }
.onboard-card {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1.25rem;
  width: min(680px, 100%);
  background: #f6f1e8;
  color: #1f1a14;
  border-radius: 20px;
  padding: 1.4rem 1.5rem 1.25rem;
  box-shadow: 0 24px 50px rgba(20,16,12,0.28);
  align-items: center;
}
.onboard-elara, .elara-portrait {
  border-radius: 16px;
  object-fit: cover;
  object-position: top center;
  background: #e8d5c0;
}
.onboard-elara { width: 180px; height: auto; flex-shrink: 0; }
.onboard-copy { min-width: 0; flex: 1; }
.onboard-step { margin: 0 0 0.2rem; color: var(--ink-soft); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
.onboard-copy h2 { margin: 0 0 0.45rem; font-size: 1.35rem; }
.onboard-fields { display: grid; gap: 0.55rem; margin: 0.9rem 0; }
.onboard-fields[hidden] { display: none !important; }
.onboard-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; justify-content: flex-end; margin-top: 1rem; }
.onboard-actions .text-btn { margin-right: auto; }

.elara-helper {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  pointer-events: none;
}
.elara-helper > * { pointer-events: auto; }
.elara-helper[hidden] { display: none; }
.elara-bubble {
  display: flex;
  gap: 0.7rem;
  align-items: flex-end;
  max-width: min(380px, calc(100vw - 2rem));
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.7rem 0.8rem 0.65rem;
  box-shadow: 0 12px 30px rgba(20,16,12,0.18);
  opacity: 1;
}
.elara-bubble[hidden] { display: none; }
.elara-bubble .elara-portrait { width: 88px; height: auto; border-radius: 12px; }
.elara-name { margin: 0; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-soft); }
.elara-tip { margin: 0.2rem 0 0.4rem; font-size: 0.92rem; line-height: 1.4; }
.elara-bubble-actions { display: flex; gap: 0.5rem; }
.elara-fab {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 16px;
}
.elara-fab img {
  width: auto;
  height: 180px;
  max-width: 120px;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#view-hunt { padding-bottom: 14rem; padding-right: 9rem; }
.elara-fab[hidden] { display: none; }

.elara-now {
  margin: 0;
  max-width: min(230px, calc(100vw - 4.5rem));
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.3;
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.3rem 0.5rem 0.35rem;
  box-shadow: 0 6px 14px rgba(20,16,12,0.1);
  opacity: 1;
}
.elara-now[hidden] { display: none !important; }
.elara-now-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
.elara-now-link:hover { text-decoration: underline; }
.elara-listen-more {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
}

.elara-dock {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
}
.elara-music {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(20,16,12,0.12);
  padding: 0;
}
.elara-music.is-on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
[data-theme="vault"] .elara-music.is-on { color: #1a140c; }
.elara-music .speaker-off { display: none; }
.elara-music:not(.is-on) .speaker-wave { display: none; }
.elara-music:not(.is-on) .speaker-off { display: block; }

.elara-helper,
.elara-bubble,
.elara-dock,
.elara-fab {
  overflow: visible;
}
.elara-sway,
.elara-bounce {
  display: block;
  overflow: visible;
  transform-origin: 50% 100%;
  will-change: transform;
}
/* Sway and bounce live on separate wrappers so the transforms compose
   instead of overriding each other. Animation is tied to the visible
   helper, not to .is-sway/.is-dancing, so desktop still moves even if
   JS classes are missing or the OS asks for reduced motion. */
.elara-helper:not([hidden]) .elara-sway {
  animation: elara-body-sway 1.4s ease-in-out infinite;
}
.elara-helper:not([hidden]) .elara-bounce {
  animation: elara-body-bounce 1.4s ease-in-out infinite;
}
@keyframes elara-body-sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
@keyframes elara-body-bounce {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -3px, 0); }
}

.elara-stage {
  position: relative;
  width: 120px;
  height: 180px;
  display: grid;
  place-items: end center;
}
.elara-frame {
  grid-area: 1 / 1;
  width: auto;
  height: 180px;
  max-width: 120px;
  object-fit: contain;
  object-position: bottom center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transition: opacity 0.55s ease-in-out;
  pointer-events: none;
}
.elara-frame.is-front {
  opacity: 1;
}

.about-guide {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 650;
  margin: 0.8rem 0;
}
.about-guide img {
  width: 52px;
  height: auto;
  border-radius: 10px;
  background: #e8d5c0;
}

@media (max-width: 720px) {
  .onboard-card { flex-direction: column; align-items: stretch; text-align: left; }
  .onboard-elara { width: 120px; }
  .empty-hunt { flex-direction: column; align-items: flex-start; }
  .empty-hunt .elara-portrait { width: 120px; }
  .offer { grid-template-columns: 72px minmax(0, 1fr) 1fr; }
  .offer-body { grid-column: 2 / -1; }
  .offer-thumb { width: 72px; height: 72px; }
  .offer-actions { grid-column: 2 / -1; padding-right: 0; }
  #view-hunt { padding-bottom: 10.5rem; padding-right: 5.75rem; }
  .elara-helper { right: 0.4rem; bottom: 0.4rem; }
  .elara-bubble { max-width: min(320px, calc(100vw - 1rem)); padding: 0.5rem 0.6rem; }
  .elara-bubble .elara-portrait { width: 64px; }
  .elara-fab img, .elara-frame { width: auto; height: 120px; max-width: 80px; }
  .elara-stage { width: 80px; height: 120px; }
  .elara-music { width: 28px; height: 28px; }
  .elara-tip { font-size: 0.84rem; }
  .buy-at { width: 100%; flex-basis: 100%; }
}


@media (prefers-reduced-motion: reduce) {
  .onboard, .elara-bubble, .suggest { transition: none; }
  .elara-frame { transition: none; }
}


.recent-row[hidden],
.suggest[hidden],
.empty-hunt[hidden],
.elara-helper[hidden],
.elara-bubble[hidden],
.elara-fab[hidden],
.elara-dock[hidden],
.elara-now[hidden],
.why-tip[hidden],
#share-hunt[hidden],
#share-results[hidden] { display: none !important; }

.onboard-card {
  background: #f6f1e8;
  color: #1f1a14;
  isolation: isolate;
  opacity: 1;
}


/* ---------- Shared live prices, own-key wizard, calm notices ---------- */
.calm-banner {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem 1.05rem;
  margin: 0 0 0.9rem;
  color: var(--ink);
}
.calm-banner img {
  width: 72px;
  height: auto;
  border-radius: 12px;
  background: #e8d5c0;
  flex: 0 0 auto;
}
.calm-banner h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.calm-banner p { margin: 0 0 0.65rem; color: var(--ink); }
.calm-banner p:last-child { margin-bottom: 0; }
.calm-banner.is-ok { background: var(--good-soft); }
.sample-note, .live-note {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.wizard-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 0.4rem 0 0.7rem;
}
.key-wizard {
  margin: 0.2rem 0 1rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
}
.wizard-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.wizard-elara {
  width: 110px;
  height: auto;
  border-radius: 14px;
  background: #e8d5c0;
  flex: 0 0 auto;
}
.wizard-steps { min-width: 0; flex: 1; }
.wizard-step { margin-bottom: 1.05rem; }
.wizard-step:last-child { margin-bottom: 0; }
.wizard-step h4 {
  font-size: 1.02rem;
  margin: 0 0 0.3rem;
  font-weight: 650;
}
.wizard-step .btn-ghost,
.wizard-step .btn-primary { margin-top: 0.35rem; }
.wizard-status {
  margin-top: 0.65rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.wizard-status.is-ok { color: var(--good); }
.wizard-status.is-fail { color: var(--again); }
.serp-advanced {
  margin-top: 0.4rem;
  padding: 0.35rem 0 0;
}
.serp-advanced summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.serp-advanced .field { margin-top: 0.45rem; }
.key-wizard[hidden],
#wizard-hide[hidden],
#wizard-status[hidden],
#key-wizard[hidden] { display: none !important; }
@media (max-width: 640px) {
  .wizard-layout { flex-direction: column; align-items: center; text-align: left; }
  .wizard-elara { width: 96px; }
  .calm-banner { flex-direction: column; align-items: flex-start; }
}


/* ---------- Creator social links (optional, hidden when unset) ---------- */
.social-follow {
  margin: 0.85rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
}
.social-follow[hidden] { display: none !important; }
.social-follow-label {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink-soft);
  margin-right: 0.15rem;
}
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.social-link:hover, .social-link:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-hover);
  outline: none;
}
.social-link svg { width: 1.05rem; height: 1.05rem; display: block; }
.modal-card .social-follow { margin-top: 1rem; }
