/* WICoffee (Worth it Coffee) — mobile first, aspecto de app */
:root {
  --bg: #f7f3ee;
  --surface: #ffffff;
  --surface-2: #f0e9e1;
  --text: #2b1d16;
  --muted: #7b6a60;
  --line: #e6ddd3;
  --brand: #3b2418;
  --accent: #b5541c;
  --accent-ink: #ffffff;
  --star: #e2a10b;
  --good: #1f7a4d;
  --good-bg: #e3f3ea;
  --warn-bg: #fdecdc;
  --radius: 16px;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15100d; --surface: #201915; --surface-2: #2b221d; --text: #f3ebe4; --muted: #a8988d;
    --line: #382d27; --brand: #f3ebe4; --accent: #e8793a; --star: #f5b82e; --good: #5fd39a;
    --good-bg: #173326; --warn-bg: #3a2416; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15100d; --surface: #201915; --surface-2: #2b221d; --text: #f3ebe4; --muted: #a8988d;
  --line: #382d27; --brand: #f3ebe4; --accent: #e8793a; --star: #f5b82e; --good: #5fd39a;
  --good-bg: #173326; --warn-bg: #3a2416; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .25rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- estructura ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; height: 56px; display: flex; align-items: center; gap: .5rem;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; text-decoration: none; color: var(--brand); }
.back { font-size: 2rem; line-height: 1; text-decoration: none; padding: 0 .5rem 0 0; }
.topbar-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { max-width: 720px; margin: 0 auto; padding: 12px 16px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .72rem; text-decoration: none; color: var(--muted);
}
.tabbar a.on { color: var(--accent); font-weight: 700; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; line-height: 18px; text-align: center;
}
.badge[hidden] { display: none; }

/* ---- inicio ---- */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 1.9rem; }
.search input, .filters input[type=search] {
  width: 100%; height: 48px; padding: 0 16px 0 44px; border-radius: 24px; border: 1px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b6a60' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") no-repeat 14px center / 20px;
  color: var(--text); font-size: 1rem;
}
.quick { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.pill {
  flex: none; padding: 8px 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; font-size: .9rem; white-space: nowrap;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-head a { color: var(--accent); text-decoration: none; font-size: .9rem; font-weight: 600; }
.carousel {
  display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 12px; overflow-x: auto;
  scroll-snap-type: x mandatory; padding-bottom: 6px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none;
}
@media (min-width: 560px) { .carousel { grid-auto-columns: 30%; } }

/* ---- tarjetas ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.card.pad { padding: 16px; margin-bottom: 16px; }
.card.pad h2 { margin-top: 0; }
.tile { scroll-snap-align: start; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.tile-img, .thumb, .detail-img, .compare-img {
  background: var(--surface-2); border-radius: 12px; overflow: hidden; display: grid; place-items: center; font-size: 2rem;
}
.tile-img { aspect-ratio: 1; margin-bottom: 4px; }
.tile-img img, .thumb img, .compare-img img { width: 100%; height: 100%; object-fit: cover; }
.eyebrow { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-decoration: none; }
.title { font-weight: 700; line-height: 1.25; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; padding: 10px; }
.thumb { width: 88px; height: 88px; flex: none; }
.row-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.meta { font-size: .92rem; }
.perkg { color: var(--muted); margin-left: .35rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .75rem; padding: 2px 9px; border-radius: 10px; background: var(--surface-2); white-space: nowrap; }
.big-chips .chip { font-size: .95rem; padding: 6px 12px; border-radius: 14px; text-transform: capitalize; }
.tag-inf { font-size: .65rem; padding: 1px 6px; border-radius: 6px; background: #f1defa; color: #6b2b8a; text-transform: uppercase; letter-spacing: .04em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag-inf { background: #3a2147; color: #e2b8f5; } }
.brand-tile { padding: 12px; display: flex; flex-direction: column; gap: 4px; scroll-snap-align: start; }
.brand-initial {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
  background: var(--brand); color: var(--bg);
}
.thumb.brand-initial { width: 64px; height: 64px; border-radius: 50%; }
.brand-initial.big { width: 72px; height: 72px; font-size: 2rem; flex: none; }
.brand-header { display: flex; gap: 14px; align-items: center; }

/* ---- nota del público (protagonista) ---- */
.score { display: inline-flex; align-items: baseline; gap: 4px; font-size: .9rem; }
.score-num { font-weight: 800; font-size: 1.05rem; }
.score-star { color: var(--star); }
.score-count { color: var(--muted); font-size: .8rem; margin-left: 2px; }
.score-empty { color: var(--muted); font-size: .82rem; font-style: italic; }
.score-big .score-num { font-size: 2.6rem; line-height: 1; }
.score-big .score-star { font-size: 1.8rem; }
.score-big .score-count { font-size: .95rem; }
.score-big.score-empty { font-size: 1.05rem; }
.score-panel {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 16px; margin: 8px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.score-panel > .muted { flex-basis: 100%; order: 3; }

/* ---- ficha ---- */
.detail-img { aspect-ratio: 4 / 3; margin: 0 -16px 12px; border-radius: 0; max-height: 360px; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; background: var(--surface-2); }
@media (min-width: 560px) { .detail-img { margin: 0 0 12px; border-radius: var(--radius); } }
.price-panel { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.big { font-size: 1.5rem; font-weight: 800; }
.perkg-big { font-weight: 700; color: var(--accent); font-size: 1.1rem; }
.formats { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; scrollbar-width: none; }
.format { flex: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: .9rem; }
.format.off { opacity: .5; text-decoration: line-through; }
.actions { display: flex; gap: 8px; margin: 14px 0; align-items: stretch; }
.grow { flex: 1; min-width: 0; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.facts div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.facts dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.facts .sca dd { font-weight: 400; color: var(--muted); }
.desc { color: var(--muted); }
.chart { width: 100%; height: 80px; color: var(--accent); }
.chart-legend { display: flex; justify-content: space-between; }
.social { display: grid; gap: 12px; }
.social-item { overflow: hidden; }
.video { aspect-ratio: 16 / 9; } .video iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; }
.links { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.links p { margin: 2px 0 0; }

/* ---- botones y formularios ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 22px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text); }
.btn-on { background: var(--good-bg); color: var(--good); border-color: var(--good); }
.btn[disabled] { opacity: .6; }
.more { width: 100%; margin-top: 4px; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; font-size: .85rem; cursor: pointer; padding: 4px 0; }
.compare-form { display: contents; }
.inline { display: inline; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
select { appearance: none; padding-right: 28px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b6a60' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px; }
.filters { position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 4px 0 10px; display: flex; flex-direction: column; gap: 8px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filter-row select { width: auto; flex: none; border-radius: 20px; padding: 8px 30px 8px 14px; font-size: .9rem; }
.rate-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rate-title { font-weight: 700; }
.stars-input { border: 0; padding: 0; margin: 0; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; }
.stars-input input { position: absolute; opacity: 0; width: 1px; }
.stars-input label { font-size: 2.4rem; line-height: 1; color: var(--line); cursor: pointer; transition: transform .1s; }
.stars-input label:active { transform: scale(1.2); }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label { color: var(--star); }
.stars-input input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }
.review { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review p { margin: 4px 0 0; }
.stars { color: var(--star); letter-spacing: 1px; }
.ok { background: var(--good-bg); color: var(--good); padding: 10px 14px; border-radius: 12px; }
.warn { background: var(--warn-bg); padding: 10px 14px; border-radius: 12px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---- comparador ---- */
.compare { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 0 10px; }
.compare-col { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.compare-col .title { text-decoration: none; font-size: .95rem; }
.compare-img { aspect-ratio: 1; }
.compare-label { grid-column: 1 / -1; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 0 4px; border-top: 1px solid var(--line); font-weight: 600; }
.compare-cell { font-size: .92rem; padding: 4px 6px; border-radius: 8px; overflow-wrap: anywhere; }
.compare-cell .score { flex-wrap: wrap; }
.compare-cell.win { background: var(--good-bg); }

/* ---- admin ---- */
.admin-form { display: flex; flex-direction: column; gap: 10px; }
.admin-form label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.log { background: var(--surface-2); padding: 10px; border-radius: 10px; font-size: .8rem; white-space: pre-wrap; }
.table { width: 100%; border-collapse: collapse; } .table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ---- precio protagonista ---- */
.perkg-hero { font-weight: 800; font-size: 1.25rem; color: var(--accent); line-height: 1.1; white-space: nowrap; }
.perkg-hero small { font-size: .7em; font-weight: 700; }
.perkg-hero.xl { font-size: 2.6rem; }
.row { align-items: flex-start; }
.row-body { flex: 1; }
.row-price { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 2px; flex: none; max-width: 38%; }
.save { color: var(--good); font-weight: 600; }
.tile .perkg-hero { margin-top: 2px; }
.price-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.price-main { display: flex; flex-direction: column; gap: 2px; }
.vs { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.vs.good { background: var(--good-bg); color: var(--good); font-weight: 600; }
.vs.pricey { background: var(--warn-bg); }
.format.best { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.score-link { text-decoration: none; display: inline-block; margin: 2px 0 4px; }
.rate-box { padding: 0; margin-top: 12px; }
.rate-box summary { padding: 14px 16px; font-weight: 700; cursor: pointer; list-style: none; }
.rate-box summary::after { content: "＋"; float: right; color: var(--accent); }
.rate-box[open] summary::after { content: "－"; }
.rate-box .rate-form { padding-top: 0; }
.bands { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.band { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.band-label { font-weight: 700; }
.brand-bars { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.brand-bar { display: grid; grid-template-columns: 7.5rem 1fr 3.6rem; align-items: center; gap: 10px; text-decoration: none; font-size: .9rem; }
.brand-bar-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-bar-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.brand-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.brand-bar-value { text-align: right; font-weight: 700; }

/* ---- veredicto "¿merece la pena?" ---- */
.brand-light { font-weight: 500; }
.verdict { border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; border: 1px solid var(--line); background: var(--surface); }
.verdict-head { display: flex; align-items: center; gap: 12px; }
.verdict-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; font-weight: 800; flex: none; }
.verdict-q { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.verdict-label { font-size: 1.35rem; font-weight: 800; line-height: 1.2; }
.verdict-si { border-color: var(--good); background: var(--good-bg); }
.verdict-si .verdict-icon { background: var(--good); color: var(--good-bg); }
.verdict-si .verdict-label { color: var(--good); }
.verdict-justo .verdict-icon { background: var(--surface-2); color: var(--text); }
.verdict-no { background: var(--warn-bg); }
.verdict-no .verdict-icon { background: var(--accent); color: var(--accent-ink); }
.reasons { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.reasons li { padding-left: 1.5rem; position: relative; }
.reasons li::before { position: absolute; left: 0; font-weight: 800; }
.reasons .r1::before { content: "+"; color: var(--good); }
.reasons .r-1::before { content: "−"; color: var(--accent); }
.reasons .r0::before { content: "·"; color: var(--muted); }
.vbadge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; white-space: nowrap; margin-top: 2px; }
.vbadge-si { background: var(--good-bg); color: var(--good); }
.vbadge-justo { background: var(--surface-2); color: var(--muted); }
.vbadge-no { background: var(--warn-bg); color: var(--accent); }
.tile .vbadge { align-self: flex-start; }
.chip-sca { background: transparent; border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.sca-help { font-size: .8rem; }

/* ---- cómo funciona ---- */
.how-link { display: inline-block; margin-top: 10px; font-size: .88rem; font-weight: 600; color: var(--accent); }
.how p { margin: .4rem 0 .8rem; }
.how-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.how-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 12px 4px; }
.how-table td { padding: 6px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.how-table td:last-child { text-align: right; font-weight: 800; white-space: nowrap; width: 3.5rem; }
.pos { color: var(--good); font-weight: 700; }
.neg { color: var(--accent); font-weight: 700; }
.how-levels { display: flex; flex-direction: column; gap: 8px; }
.how-levels .verdict { margin: 0; }
.how-list { padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.2rem; }
.brand-tag { font-size: .8rem; font-weight: 700; color: var(--accent); background: var(--warn-bg); padding: 2px 8px; border-radius: 10px; letter-spacing: .02em; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.legal h2 { margin-top: 1.4rem; } .legal p, .legal li { color: var(--text); } .todo { background: var(--warn-bg); padding: 0 4px; border-radius: 4px; }
