:root {
  --pink: #ff2e93;
  --pink-dark: #d81b78;
  --pink-soft: #ffe1f0;
  --yellow: #ffd93b;
  --yellow-soft: #fff4c2;
  --blue: #1e8bff;
  --ink: #161616;
  --muted: #5d5560;
  --bg: #fff8ee;
  --card: #ffffff;
  --line: #f1e3ea;
  --green: #0f9d58;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(255, 46, 147, .14);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Nunito, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Hero */
.hero { max-width: 820px; width: 100%; margin: 0 auto; padding: 16px 16px 0; }
.banner {
  width: 100%; height: 225px; object-fit: cover; object-position: 50% 48%;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-mobile { display: none; align-items: center; gap: 12px; justify-content: center; }
.hero-mobile img { border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow); background: var(--blue); }
.wordmark { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 44px; margin: 0; letter-spacing: -.5px; }
.wordmark span { color: var(--pink); }

main { max-width: 820px; width: 100%; margin: 0 auto; padding: 0 16px; flex: 1; }

/* Buscador */
.search-card {
  position: relative;
  margin: -34px 24px 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 28px 20px;
  box-shadow: var(--shadow);
  border: 3px solid var(--ink);
}
.tagline { font-family: Nunito, system-ui, sans-serif; font-size: 30px; font-weight: 900; margin: 0 0 4px; }
.sub { margin: 0 0 18px; color: var(--muted); }
form { display: flex; gap: 10px; }
.input-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--line); border-radius: 16px; padding: 6px 8px 6px 14px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within, .input-wrap.drag { border-color: var(--pink); box-shadow: 0 0 0 4px var(--pink-soft); }
#q { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 17px; padding: 10px 0; background: transparent; }
.photo-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--pink); background: var(--pink-soft); cursor: pointer; flex-shrink: 0;
}
.photo-btn:hover { background: var(--yellow-soft); color: var(--ink); }
.go {
  font-family: Nunito, system-ui, sans-serif; font-size: 19px; font-weight: 800;
  padding: 0 26px; border: 3px solid var(--ink); border-radius: 16px; cursor: pointer;
  color: #fff; background: var(--pink); box-shadow: 4px 4px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.go:hover { background: var(--pink-dark); }
.go:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.go:disabled { opacity: .6; cursor: wait; }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; }

.preview { position: relative; flex-shrink: 0; }
.preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }
.preview-x {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: var(--ink); color: #fff; font-size: 15px; line-height: 1; cursor: pointer;
}

/* Cargando */
.loading { text-align: center; padding: 40px 0 10px; }
.detective { margin: 0 auto 10px; border-radius: 50%; background: var(--blue); animation: bob 1.2s ease-in-out infinite; }
#loading-text { font-family: Nunito, system-ui, sans-serif; font-size: 20px; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

.error {
  margin-top: 22px; padding: 16px 18px; border-radius: 16px;
  background: var(--yellow-soft); border: 2px solid var(--yellow); font-weight: 700;
}

/* Resultados */
.results { margin-top: 26px; scroll-margin-top: 12px; }
.results-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 12px; }
.sort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 700; color: var(--muted); }
.sort button {
  font: inherit; font-weight: 800; cursor: pointer; padding: 6px 12px; border-radius: 999px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink);
}
.sort button:hover { background: var(--yellow-soft); }
.sort button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.eyebrow { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
#query-label { margin: 2px 0 0; font-family: Nunito, system-ui, sans-serif; font-size: 24px; font-weight: 800; }
.share {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-weight: 800; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--yellow); color: var(--ink); white-space: nowrap;
  box-shadow: 3px 3px 0 var(--ink);
  transition: background .15s, color .15s, transform .12s, box-shadow .12s;
}
.share svg { transition: transform .2s; }
.share:hover { background: var(--pink); color: #fff; transform: translate(-1px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.share:hover svg { transform: translateY(-2px); }
.share:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.share.done { background: var(--green); color: #fff; }
.origin {
  padding: 12px 16px; border-radius: 14px; background: #fff; border: 2px dashed var(--line);
  margin-bottom: 12px; font-size: 15px;
}
.origin strong { color: var(--green); }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.item {
  display: flex; justify-content: space-between; gap: 16px;
  background: var(--card); border-radius: 18px; padding: 16px 18px; border: 2px solid var(--line);
}
.item.best { border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--pink); background: linear-gradient(135deg, #fff 60%, var(--pink-soft)); }
.item-main { min-width: 0; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--yellow); }
.badge.pink { background: var(--pink); color: #fff; }
.store { margin: 6px 0 2px; font-family: Nunito, system-ui, sans-serif; font-size: 20px; font-weight: 800; }
.title { margin: 0; color: var(--muted); font-size: 14px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: var(--green); }
.item-price { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.old { margin: 0; font-size: 14px; color: var(--muted); text-decoration: line-through; }
.price { margin: 0; font-family: Nunito, system-ui, sans-serif; font-size: 26px; font-weight: 900; letter-spacing: -.3px; }
.coupon { margin: 0; font-size: 13px; font-weight: 800; color: var(--pink-dark); max-width: 220px; }
.buy {
  margin-top: 8px; text-decoration: none; font-weight: 800; font-size: 14px;
  padding: 8px 14px; border-radius: 12px; background: var(--ink); color: #fff;
}
.buy:hover { background: var(--pink); }
.cupones {
  margin-top: 8px; text-decoration: none; font-weight: 800; font-size: 14px;
  padding: 6px 12px; border-radius: 12px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink);
}
.cupones:hover { background: var(--pink); color: #fff; }
.cupones[hidden] { display: none; }
.disclaimer { font-size: 12px; color: var(--muted); margin: 14px 0 0; }

/* Tweets de @ofertologa */
.page { width: 100%; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 820px) minmax(0, 1fr); align-items: start; }
.col { min-width: 0; grid-column: 2; }
.feed {
  grid-column: 3; justify-self: end; width: calc(100% - 24px); max-width: 360px;
  position: sticky; top: 16px; margin: 16px 16px 0 8px;
  background: var(--card); border-radius: var(--radius); border: 3px solid var(--ink);
  box-shadow: var(--shadow); overflow: hidden;
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
}
.feed-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 14px 18px; background: var(--yellow); border-bottom: 3px solid var(--ink); }
.feed-head h2 { margin: 0; font-size: 18px; font-weight: 900; }
.feed-head { position: relative; align-items: center; }
.follow summary {
  list-style: none; cursor: pointer; font-weight: 800; font-size: 14px; padding: 6px 14px; border-radius: 999px;
  background: var(--pink); color: #fff; border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.follow summary::-webkit-details-marker { display: none; }
.follow summary:hover { background: var(--pink-dark); }
.follow[open] summary { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.follow-menu {
  position: absolute; right: 14px; top: calc(100% - 4px); z-index: 5; display: flex; flex-direction: column; min-width: 190px;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); overflow: hidden;
}
.feed-head .follow-menu a { padding: 10px 14px; color: var(--ink); font-size: 15px; }
.feed-head .follow-menu a + a { border-top: 2px dashed var(--line); }
.feed-head .follow-menu a:hover { background: var(--pink-soft); text-decoration: none; }
.feed-head a { font-weight: 800; font-size: 14px; color: var(--pink-dark); text-decoration: none; }
.feed-head a:hover { text-decoration: underline; }
.feed-body { overflow-y: auto; padding: 4px 8px; min-height: 200px; }
.tweets { list-style: none; margin: 0; padding: 0; }
.tweet { padding: 14px 10px; border-bottom: 2px dashed var(--line); }
.tweet:last-child { border-bottom: 0; }
.tweet p { margin: 0 0 8px; white-space: pre-line; overflow-wrap: anywhere; font-size: 15px; }
.tweet p a { color: var(--pink-dark); font-weight: 700; text-decoration: none; }
.tweet p a:hover { text-decoration: underline; }
.tweet img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; border: 2px solid var(--line); margin-bottom: 8px; }
.tweet-meta { font-size: 13px; color: var(--muted); text-decoration: none; font-weight: 700; }
.tweet-meta:hover { color: var(--pink); }
.feed-fallback { text-align: center; padding: 24px 16px; }
.feed-fallback img { margin: 0 auto 10px; border-radius: 50%; background: var(--blue); }
.feed-fallback p { margin: 0 0 14px; color: var(--muted); }
.feed-fallback .go { display: inline-block; text-decoration: none; padding: 10px 22px; font-size: 16px; }

@media (max-width: 1340px) {
  .page { display: block; }
  .feed { position: static; width: auto; max-width: 788px; margin: 32px auto 0; max-height: 620px; }
}
@media (max-width: 820px) {
  .feed { margin: 32px 16px 0; }
}

footer { text-align: center; padding: 40px 16px 30px; color: var(--muted); font-size: 14px; }
footer p { margin: 4px 0; }
.social { display: flex; gap: 12px; justify-content: center; margin-top: 10px !important; }
.social a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: #fff; background: var(--ink); transition: background .15s, transform .15s;
}
.social a:hover { background: var(--pink); transform: translateY(-2px); }

@media (max-width: 640px) {
  .banner { display: none; }
  .hero { padding-top: 20px; }
  .hero-mobile { display: flex; }
  .search-card { margin: 16px 0 0; padding: 20px 16px 16px; }
  .tagline { font-size: 24px; }
  form { flex-direction: column; }
  .go { padding: 14px; }
  .item { flex-direction: column; gap: 8px; }
  .item-price { text-align: left; align-items: stretch; }
  .buy, .cupones { text-align: center; }
  .coupon { max-width: none; }
  .hint { display: none; }
  .sort { gap: 6px; font-size: 13px; }
  .sort span { display: none; }
  .sort button { padding: 5px 10px; }
}
