:root {
  --bg: #faf8f6;
  --surface: #ffffff;
  --surface-2: #f3efeb;
  --line: #e7e1db;
  --text: #1c1917;
  --muted: #6b635c;
  --accent: #ea580c;
  --accent-2: #e11d48;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --warn: #b45309;
  --info: #1d4ed8;
  --shadow: 0 1px 2px rgb(28 25 23 / .06), 0 8px 24px rgb(28 25 23 / .06);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0d14; --surface: #18151f; --surface-2: #221e2b; --line: #2e2939;
    --text: #f4f1f7; --muted: #a59eb3; --accent: #fb923c; --accent-2: #fb7185; --accent-ink: #1a0f08;
    --ok: #4ade80; --warn: #fbbf24; --info: #93c5fd;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0d14; --surface: #18151f; --surface-2: #221e2b; --line: #2e2939;
  --text: #f4f1f7; --muted: #a59eb3; --accent: #fb923c; --accent-2: #fb7185; --accent-ink: #1a0f08;
  --ok: #4ade80; --warn: #fbbf24; --info: #93c5fd;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px rgb(0 0 0 / .35);
  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.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 18px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 800; background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; }
.search svg { width: 18px; fill: var(--muted); flex: none; }
.search input { border: 0; background: none; color: var(--text); font: inherit; padding: 9px 0; width: 100%; outline: none; }
.search:focus-within { border-color: var(--accent); }
.topnav { display: flex; align-items: center; gap: 16px; margin-left: auto; white-space: nowrap; }
.topnav a { color: var(--text); font-weight: 500; font-size: 15px; }
.lang {
  appearance: none; -webkit-appearance: none; font: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 8px center / 18px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 30px 6px 12px; cursor: pointer;
}
.btn-mini { background: var(--text); color: var(--bg) !important; padding: 7px 14px; border-radius: 999px; }
.btn-mini:hover { text-decoration: none; opacity: .9; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; min-height: 70vh; outline: none; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* portada */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 44px 40px;
  background: radial-gradient(120% 140% at 100% 0%, #7c3aed 0%, transparent 55%), linear-gradient(120deg, #f97316, #e11d48);
  color: #fff; display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center;
}
.hero h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.08; margin: 0 0 14px; letter-spacing: -.02em; font-weight: 800; }
.hero p { margin: 0 0 22px; font-size: 17px; opacity: .95; max-width: 52ch; }
.hero .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .pill { background: rgb(255 255 255 / .16); border: 1px solid rgb(255 255 255 / .25); padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; }
.hero-icons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; transform: rotate(-6deg); }
.hero-icons img { width: 100%; aspect-ratio: 1; border-radius: 24%; box-shadow: 0 10px 30px rgb(0 0 0 / .25); background: #fff; object-fit: cover; }

/* chips de categorías */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 24px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 16px; border-radius: 999px; font-weight: 500; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 14px; }
.section-title h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }

/* rejilla de apps */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); text-decoration: none; }
.card .cover { aspect-ratio: 2 / 1; background: var(--surface-2); overflow: hidden; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-fallback { width: 100%; height: 100%; display: grid; place-items: center; }
.cover-fallback img { width: 34% !important; height: auto !important; aspect-ratio: 1; border-radius: 24%; box-shadow: 0 8px 22px rgb(0 0 0 / .25); }
.card .body { display: flex; gap: 12px; padding: 14px; align-items: flex-start; }
.icon { width: 56px; height: 56px; border-radius: 24%; flex: none; object-fit: cover; background: var(--surface-2); }
.card h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.card p { margin: 4px 0 8px; color: var(--muted); font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tag.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.tag.info { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* ficha de app */
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.detail-head { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.detail-head .icon { width: 112px; height: 112px; box-shadow: var(--shadow); }
.detail-head h1 { margin: 0 0 4px; font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -.02em; line-height: 1.1; }
.detail-head .tagline { margin: 0 0 10px; color: var(--muted); font-size: 17px; }
.meta { display: flex; flex-wrap: wrap; gap: 0; margin: 22px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.meta div { flex: 1 1 120px; padding: 12px 16px; border-right: 1px solid var(--line); }
.meta div:last-child { border-right: 0; }
.meta b { display: block; font-size: 16px; }
.meta span { font-size: 13px; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 15px; line-height: 1.2;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn small { font-weight: 500; color: var(--muted); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; border: 0; }
.btn.primary small { color: rgb(255 255 255 / .85); }
.btn.primary:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; max-width: 360px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }

.note { margin: 16px 0; padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); font-size: 15px; }

.shots { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 12px; scroll-snap-type: x mandatory; }
.shots img { height: 420px; width: auto; border-radius: 14px; border: 1px solid var(--line); scroll-snap-align: start; cursor: zoom-in; background: var(--surface-2); }
.shots.desktop img { height: 260px; }

.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; margin-top: 10px; }
.cols h2 { font-size: 20px; margin: 26px 0 10px; }
.desc p { margin: 0 0 12px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.features li { display: flex; gap: 10px; align-items: flex-start; }
.features li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 9px; border-radius: 50%; background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
.files { display: grid; gap: 8px; }
.file { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; }
.file:hover { border-color: var(--accent); text-decoration: none; }
.file span { color: var(--muted); white-space: nowrap; }

/* acerca */
.about { max-width: 760px; }
.about h1 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.02em; margin: 0 0 12px; }
.about h2 { font-size: 20px; margin: 30px 0 10px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
.store-card { display: flex; gap: 18px; align-items: center; padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); flex-wrap: wrap; }
.store-card img { width: 72px; height: 72px; }

/* visor */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .88); display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 12px; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgb(255 255 255 / .12); color: #fff; width: 48px; height: 48px; border-radius: 50%; font-size: 30px; line-height: 1; }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 500; max-width: calc(100vw - 32px); }

/* navegación con control remoto (Google TV) y teclado */
a:focus-visible, button:focus-visible, input:focus-visible, .shots img:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px;
}
.card:focus-visible { transform: scale(1.03); border-color: var(--accent); }

.foot { border-top: 1px solid var(--line); padding: 24px 16px 40px; text-align: center; font-size: 14px; }
.foot p { margin: 4px 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 32px 22px; }
  .hero-icons { display: none; }
  .cols { grid-template-columns: 1fr; gap: 0; }
  .topnav a:not(.btn-mini) { display: none; }
  .lang { padding: 6px 26px 6px 10px; }
}
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .detail-head { grid-template-columns: 1fr; gap: 14px; }
  .detail-head .icon { width: 88px; height: 88px; }
  .shots img { height: 340px; }
  .shots.desktop img { height: 180px; }
  .grid { grid-template-columns: 1fr; }
  .meta div { flex-basis: 50%; border-bottom: 1px solid var(--line); }
  .btn { flex: 1 1 100%; justify-content: center; }
}
