:root{
  --bg:#f3f7fc;
  --surface:rgba(255,255,255,.84);
  --surface-strong:#ffffff;
  --surface-soft:#f7faff;
  --surface-alt:#eef4fb;
  --text:#162338;
  --muted:#627189;
  --line:rgba(190,205,226,.72);
  --line-strong:#c9d5e7;
  --primary:#1d6fe8;
  --primary-dark:#0f172a;
  --accent:#57bde9;
  --shadow:0 20px 60px rgba(19,33,56,.08);
  --shadow-soft:0 12px 28px rgba(19,33,56,.06);
  --radius-xl:30px;
  --radius-lg:24px;
  --radius-md:18px;
  --radius-sm:14px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 520px at -10% 0%, rgba(29,111,232,.10), transparent 60%),
    radial-gradient(760px 420px at 110% 8%, rgba(87,189,233,.12), transparent 55%),
    linear-gradient(180deg, #fbfdff 0%, #eff5fc 100%);
}

.skip-link{
  position:absolute;
  left:-999px;
  top:10px;
  background:#fff;
  color:#000;
  padding:10px 14px;
  z-index:1000;
  border-radius:10px;
}
.skip-link:focus{left:10px}

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

:focus-visible{
  outline:3px solid rgba(29,111,232,.22);
  outline-offset:3px;
}

.app-shell{
  width:min(1420px, calc(100vw - 40px));
  margin:22px auto;
}

.panel{
  background:var(--surface);
  border:1px solid rgba(255,255,255,.75);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow);
  backdrop-filter:blur(18px);
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:16px 18px;
  background:rgba(255,255,255,.76);
  border:1px solid rgba(255,255,255,.88);
  box-shadow:var(--shadow-soft);
  border-radius:26px;
  backdrop-filter:blur(18px);
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.brand-mark{
  width:52px;
  height:52px;
  border-radius:18px;
  background:linear-gradient(135deg, #1d6fe8, #6f86ff);
  display:grid;
  place-items:center;
  box-shadow:0 12px 24px rgba(29,111,232,.24);
}

.brand-mark span{
  width:20px;
  height:20px;
  border-radius:999px;
  background:#fff;
  box-shadow:0 0 0 8px rgba(255,255,255,.18);
}

.brand-name{
  font-size:20px;
  font-weight:900;
  letter-spacing:-.03em;
}

.brand-sub{
  margin-top:2px;
  font-size:13px;
  color:var(--muted);
}

.topbar-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.pill{
  padding:11px 14px;
  border-radius:999px;
  background:#eef4ff;
  color:#1846b2;
  font-size:13px;
  font-weight:800;
  border:1px solid #d9e4ff;
}

.main-shell{
  margin-top:18px;
  display:grid;
  gap:18px;
}

/* HERO */
.hero-premium{
  padding:28px;
  overflow:hidden;
}

.hero-grid{
  display:grid;
  grid-template-columns:minmax(0, 1.4fr) minmax(320px, .9fr);
  gap:22px;
  align-items:stretch;
}

.hero-main{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.16em;
  color:#70819a;
  margin-bottom:2px;
}

.hero-title{
  margin:0;
  font-size:64px;
  line-height:1.01;
  letter-spacing:-.07em;
  max-width:560px;
}

.hero-text{
  margin:0;
  color:var(--muted);
  line-height:1.75;
  font-size:16px;
  max-width:680px;
}

.hero-search-bar{
  margin-top:2px;
  padding:10px;
  background:rgba(247,250,255,.94);
  border:1px solid var(--line);
  border-radius:26px;
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:12px;
  align-items:center;
}

.hero-input{
  width:100%;
  border:none;
  outline:none;
  background:transparent;
  padding:16px 18px;
  font-size:20px;
  color:var(--text);
}

.hero-input::placeholder{
  color:#8a96ab;
}

.hero-controls-inline{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.field-inline{
  display:grid;
  gap:8px;
}

.sort-inline{
  min-width:210px;
}

.hero-inline-section{
  display:grid;
  gap:12px;
}

.inline-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.inline-title{
  margin:0;
  font-size:18px;
  font-weight:900;
  letter-spacing:-.02em;
}

.inline-sub{
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
  text-align:right;
}

.category-row,
.recent-searches-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
}

.category-chip,
.recent-search-chip{
  border:none;
  cursor:pointer;
  padding:14px 18px;
  border-radius:999px;
  background:rgba(255,255,255,.84);
  border:1px solid var(--line);
  display:inline-flex;
  align-items:center;
  gap:10px;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.category-chip:hover,
.recent-search-chip:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-soft);
  border-color:#bfd0ee;
  background:#fff;
}

.category-icon{
  font-size:18px;
}

.category-name{
  font-size:14px;
  font-weight:800;
}

.recent-search-chip{
  font-size:14px;
  font-weight:800;
  color:#1a2740;
}

.recent-empty{
  color:var(--muted);
  font-size:14px;
}

/* HERO SIDE INSIGHT */
.hero-side{
  min-width:0;
}

.hero-insight-card{
  position:relative;
  height:100%;
  min-height:100%;
  padding:22px;
  border-radius:28px;
  color:#fff;
  background:
    radial-gradient(240px 180px at 100% 0%, rgba(104,150,255,.28), transparent 60%),
    radial-gradient(220px 180px at 0% 100%, rgba(87,189,233,.18), transparent 60%),
    linear-gradient(145deg, #07152d 0%, #10274a 55%, #163561 100%);
  box-shadow:0 24px 50px rgba(11,25,52,.20);
  display:flex;
  flex-direction:column;
  gap:18px;
  overflow:hidden;
}

.hero-insight-card::after{
  content:"";
  position:absolute;
  inset:auto -60px -60px auto;
  width:180px;
  height:180px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  filter:blur(10px);
}

.insight-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}

.insight-label{
  font-size:12px;
  opacity:.74;
  text-transform:uppercase;
  letter-spacing:.14em;
}

.insight-title{
  margin-top:8px;
  font-size:28px;
  font-weight:900;
  line-height:1.18;
  letter-spacing:-.04em;
}

.insight-price-wrap{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.insight-price{
  font-size:46px;
  line-height:1;
  font-weight:900;
  letter-spacing:-.06em;
  color:#fff;
}

.insight-note{
  color:rgba(255,255,255,.72);
  font-size:13px;
  line-height:1.5;
}

.insight-metrics{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.insight-metric{
  padding:14px 14px;
  border-radius:18px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  display:flex;
  flex-direction:column;
  gap:6px;
}

.insight-metric-label{
  font-size:11px;
  opacity:.7;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.insight-metric-value{
  font-size:14px;
  font-weight:800;
  line-height:1.5;
  color:#fff;
  word-break:break-word;
}

.insight-bottom{
  margin-top:auto;
  display:grid;
  gap:10px;
}

.insight-bottom-label{
  font-size:12px;
  opacity:.76;
  text-transform:uppercase;
  letter-spacing:.14em;
}

/* SUPPORTED STRIP */
.supported-strip{
  padding:18px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

.supported-strip-label{
  font-size:14px;
  font-weight:900;
  color:#20314c;
  letter-spacing:-.01em;
}

.supported-strip-row{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-end;
}

.store-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 16px;
  border-radius:999px;
  background:#eef4ff;
  color:#1846b2;
  border:1px solid #d9e4ff;
  font-size:13px;
  font-weight:800;
}

/* RESULTS */
.results-panel{
  display:grid;
  gap:18px;
}

.market-strip{
  display:grid;
  grid-template-columns:minmax(240px, 1fr) minmax(260px, auto) minmax(220px, auto);
  gap:18px;
  align-items:center;
  padding:20px 24px;
  border-radius:28px;
  background:
    radial-gradient(240px 180px at 100% 0%, rgba(104,150,255,.18), transparent 60%),
    linear-gradient(135deg, #08162f 0%, #153461 100%);
  color:#fff;
  box-shadow:0 18px 40px rgba(15,23,42,.16);
}

.market-strip-left{
  min-width:0;
}

.market-strip-label{
  font-size:12px;
  opacity:.74;
  text-transform:uppercase;
  letter-spacing:.14em;
}

.market-strip-title{
  margin-top:6px;
  font-size:26px;
  font-weight:900;
  line-height:1.2;
  letter-spacing:-.03em;
}

.market-strip-center{
  display:flex;
  align-items:center;
  gap:22px;
  flex-wrap:wrap;
  justify-content:center;
}

.market-metric{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.market-metric-label{
  font-size:11px;
  opacity:.72;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.market-metric-value{
  font-size:15px;
  font-weight:800;
  color:#fff;
}

.market-strip-right{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:10px;
}

.market-source{
  padding:10px 14px;
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.16);
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  text-transform:capitalize;
}

.market-strip-mini{
  max-width:280px;
  font-size:13px;
  line-height:1.6;
  color:rgba(255,255,255,.84);
  text-align:right;
}

.market-top3{
  margin:0;
  padding-left:18px;
  max-width:320px;
  font-size:13px;
  line-height:1.6;
  color:rgba(255,255,255,.88);
}

.feed-panel{
  padding:24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.82) 0%, rgba(249,252,255,.88) 100%);
}

.feed-panel-wide{
  width:100%;
}

.feed-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}

.results-title{
  margin:0;
  font-size:40px;
  line-height:1.04;
  letter-spacing:-.04em;
}

.results-text{
  margin:10px 0 0;
  color:var(--muted);
  max-width:720px;
  line-height:1.7;
  font-size:15px;
}

.section-sub{
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}

.results-grid{
  display:grid;
  gap:18px;
  align-items:stretch;
}

.marketplace-grid{
  grid-template-columns:repeat(4, minmax(0, 1fr));
}

.result-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:16px;
  border-radius:24px;
  border:1px solid rgba(198,212,232,.82);
  background:rgba(255,255,255,.90);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  min-height:100%;
  height:100%;
  overflow:hidden;
  cursor:pointer;
  backdrop-filter:blur(10px);
}

.result-card:hover{
  transform:translateY(-3px);
  box-shadow:0 18px 35px rgba(19,33,56,.08);
  border-color:#bdd1ec;
  background:#fff;
}

.result-card-featured{
  border-color:#bfd0ee;
  box-shadow:0 14px 34px rgba(29,111,232,.10);
}

.result-card-top{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  align-items:center;
  gap:10px;
}

.result-top-left{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.result-rank{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:38px;
  height:34px;
  padding:0 10px;
  border-radius:12px;
  background:#edf3ff;
  border:1px solid #d7e4ff;
  color:#1846b2;
  font-size:12px;
  font-weight:900;
  flex-shrink:0;
}

.result-store{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  padding:8px 12px;
  border-radius:999px;
  background:#eef4ff;
  color:#1f49c6;
  font-size:12px;
  font-weight:800;
  line-height:1.25;
  overflow:hidden;
  text-overflow:ellipsis;
}

.result-badge,
.result-deal-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:84px;
  height:34px;
  padding:0 12px;
  border-radius:12px;
  color:#fff;
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
  white-space:nowrap;
  flex-shrink:0;
}

.result-badge{
  background:#57bde9;
}

.result-deal-badge{
  background:linear-gradient(135deg, #1d6fe8 0%, #436dff 100%);
}

.result-card-body{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:100%;
}

.result-image{
  width:100%;
  aspect-ratio:1 / 1;
  border-radius:20px;
  background:#f8fbff;
  border:1px solid var(--line);
  display:grid;
  place-items:center;
  overflow:hidden;
}

.result-image img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.result-image-fallback{
  font-size:34px;
}

.result-content{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.result-price-row{
  display:flex;
  align-items:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.result-price{
  font-size:34px;
  line-height:1;
  font-weight:900;
  letter-spacing:-.05em;
  color:#111d34;
}

.result-compare{
  font-size:13px;
  color:#90a0b6;
  text-decoration:line-through;
  font-weight:700;
}

.result-title{
  margin:0;
  font-size:16px;
  line-height:1.45;
  font-weight:800;
  letter-spacing:-.02em;
  color:#1a2740;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:46px;
}

.result-meta{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.result-size{
  display:inline-flex;
  align-items:center;
  align-self:flex-start;
  padding:6px 10px;
  border-radius:999px;
  background:#f1f5fb;
  border:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
  font-weight:700;
}

.result-sub{
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:38px;
}

.empty-state{
  border:1px dashed var(--line-strong);
  border-radius:24px;
  padding:34px 20px;
  text-align:center;
  background:rgba(255,255,255,.72);
}

.empty-state-icon{
  font-size:30px;
}

.empty-state-title{
  margin-top:10px;
  font-size:20px;
  font-weight:900;
  letter-spacing:-.03em;
}

.empty-state-text{
  margin-top:8px;
  color:var(--muted);
  line-height:1.6;
  font-size:14px;
}

.footer{
  text-align:center;
  color:var(--muted);
  font-size:13px;
  padding:8px 6px 2px;
}

/* CONTROLS */
.btn{
  border:none;
  cursor:pointer;
  border-radius:14px;
  padding:12px 16px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-size:14px;
  font-weight:800;
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.btn:hover{
  transform:translateY(-1px);
}

.btn-dark{
  background:#0f172a;
  color:#fff;
  box-shadow:0 14px 28px rgba(15,23,42,.16);
}

.btn-soft{
  background:#edf2fa;
  color:#18243b;
}

.btn-outline{
  background:#fff;
  color:#18243b;
  border:1px solid var(--line);
}

.search-btn{
  min-width:110px;
}

.control{
  width:100%;
  height:48px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--text);
  padding:0 14px;
  font:inherit;
  outline:none;
}

.control:focus{
  border-color:#b8c9ea;
  box-shadow:0 0 0 4px rgba(29,111,232,.08);
}

/* DIALOG */
.dialog{
  border:none;
  padding:0;
  background:transparent;
}

.dialog::backdrop{
  background:rgba(15,23,42,.35);
  backdrop-filter:blur(4px);
}

.dialog-card{
  width:min(560px, calc(100vw - 24px));
  border:none;
  padding:0;
  margin:0;
  background:#fff;
  border-radius:28px;
  box-shadow:var(--shadow);
}

.dialog-head{
  padding:22px 22px 0;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
}

.dialog-title{
  font-size:22px;
  font-weight:900;
  letter-spacing:-.03em;
}

.dialog-sub{
  margin-top:6px;
  color:var(--muted);
  font-size:14px;
}

.dialog-body{
  padding:20px 22px 0;
  display:grid;
  grid-template-columns:1fr;
  gap:16px;
}

.field{
  display:grid;
  gap:8px;
}

.label{
  font-size:13px;
  color:var(--muted);
  font-weight:700;
}

.dialog-actions{
  padding:22px;
  display:flex;
  justify-content:flex-end;
}

/* LOADING */
.loading-panel{
  display:none;
  align-items:center;
  gap:12px;
  padding:16px 18px;
  margin-bottom:16px;
  border-radius:18px;
  background:#f6f9ff;
  border:1px solid #dce7fb;
}

.loading-panel.active{
  display:flex;
}

.spinner{
  width:22px;
  height:22px;
  border-radius:999px;
  border:3px solid #d7e3fb;
  border-top-color:var(--primary);
  animation:spin .8s linear infinite;
}

.loading-text{
  font-size:14px;
  font-weight:700;
  color:var(--muted);
}

.btn[disabled],
.control[disabled]{
  opacity:.65;
  cursor:not-allowed;
  transform:none;
}

.btn[disabled]:hover{
  transform:none;
}

@keyframes spin{
  from{transform:rotate(0deg)}
  to{transform:rotate(360deg)}
}

@media (prefers-reduced-motion: reduce){
  .spinner{
    animation:none;
  }
}

/* RESPONSIVE */
@media (max-width: 1280px){
  .marketplace-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }

  .hero-title{
    font-size:56px;
  }
}

@media (max-width: 1120px){
  .hero-grid{
    grid-template-columns:1fr;
  }

  .hero-insight-card{
    min-height:unset;
  }

  .hero-search-bar{
    grid-template-columns:1fr;
  }

  .hero-controls-inline{
    justify-content:flex-start;
  }

  .market-strip{
    grid-template-columns:1fr;
  }

  .market-strip-center{
    justify-content:flex-start;
  }

  .market-strip-right{
    align-items:flex-start;
  }

  .market-strip-mini{
    text-align:left;
  }
}

@media (max-width: 900px){
  .marketplace-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .topbar{
    flex-direction:column;
    align-items:flex-start;
  }

  .inline-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .inline-sub{
    text-align:left;
  }
}

@media (max-width: 640px){
  .app-shell{
    width:min(100vw - 18px, 100%);
    margin:10px auto;
  }

  .hero-premium{
    padding:20px;
  }

  .hero-title{
    font-size:40px;
  }

  .results-title{
    font-size:30px;
  }

  .marketplace-grid{
    grid-template-columns:1fr;
  }

  .insight-metrics{
    grid-template-columns:1fr;
  }

  .feed-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .supported-strip{
    align-items:flex-start;
  }

  .supported-strip-row{
    justify-content:flex-start;
  }
}