:root {
  /* Tema de los videos de AIAcciones: fondo casi negro, cuadrícula sutil y azul de acento */
  --ground: #1b1b1a;
  --surface: #232322;
  --ink: #ffffff;
  --muted: #a3a3a0;
  --line: #353533;
  --copper: #3b86e6;
  --copper-soft: rgba(59, 134, 230, .12);
  --pacific: #6aa8f0;
  --up: #4cc38a;
  --down: #f06b6b;
  --tape: #141413;
  --tape-ink: #d8d8d5;
  --bar: #3a3a38;
  --f-display: "Poppins", "Segoe UI", system-ui, sans-serif;
  --f-body: "Poppins", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink);
  background-color: var(--ground);
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  font: 400 16px/1.65 var(--f-body);
}
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--pacific); text-underline-offset: 3px; }
a:hover { color: var(--copper); }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
main.wrap { padding-block: 32px 64px; display: grid; gap: 44px; }
main.wrap > *, .stock-head > *, .two > * { min-width: 0; }

/* ---------- cabecera */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: rgba(27,27,26,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 20px/1 var(--f-display); letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand b { color: var(--copper); font-weight: 700; }
.brand .cl { color: var(--muted); font-weight: 500; margin-left: 6px; }
.logo-bars { display: block; flex: none; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { padding: 8px 8px; text-decoration: none; color: var(--muted); font: 500 14px/1 var(--f-body); white-space: nowrap; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--copper); }
.xbtn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); font: 600 14px/1 var(--f-body); }
.xbtn:hover { border-color: var(--ink); color: var(--ink); }

.tape { background: var(--tape); color: var(--tape-ink); overflow: hidden; font: 400 13px/1 var(--f-mono); }
.tape-in { display: flex; width: max-content; animation: tape 60s linear infinite; }
.tape-in > * { padding: 8px 18px; white-space: nowrap; color: inherit; text-decoration: none; border-right: 1px solid rgba(255,255,255,.08); }
.tape b { font-weight: 500; letter-spacing: .04em; margin-right: 4px; }
.tape .up { color: #6fd49a; } .tape .down { color: #ff8f86; }
.tape:hover .tape-in { animation-play-state: paused; }
@keyframes tape { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-in { animation: none; } .tape { overflow-x: auto; } }

/* ---------- tipografía */
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 700;  letter-spacing: -.01em; }
.h-sec { font-size: 15px; font-weight: 700;  text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.h-sec a { color: inherit; text-decoration: none; } .h-sec a:hover { color: var(--copper); }
.eyebrow { margin: 0 0 10px; font: 500 12px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--copper); }
.lede { font-size: 19px; color: var(--muted); max-width: 62ch; margin: 14px 0 0; }
.small, .note { font-size: 14px; color: var(--muted); }
.note { font-family: var(--f-mono); font-size: 12px; margin: 10px 0 0; letter-spacing: .02em; }
.up { color: var(--up); } .down { color: var(--down); }
.sel { font-family: var(--f-mono); font-size: .92em; user-select: all; }

/* ---------- portada */
.hero { position: relative; padding-block: 32px 16px; }
.hero > :not(.trend) { position: relative; max-width: 820px; }
.hero h1 { font-size: clamp(34px, 5.6vw, 60px); }
.hero h1 b { color: var(--copper); font-weight: 700; }
.trend { position: absolute; left: -20px; right: -20px; bottom: -30px; width: calc(100% + 40px); height: 70%; pointer-events: none; overflow: visible; }
.trend path { fill: none; stroke: var(--copper); stroke-width: 2.5; filter: drop-shadow(0 0 6px rgba(59,134,230,.8)); opacity: .4; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; background: var(--copper); color: #fff; border: 1px solid var(--copper); border-radius: 3px; font: 600 16px/1 var(--f-body); text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); }

.stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.stock-card { display: grid; gap: 4px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--ink); }
.stock-card:hover { border-color: var(--copper); color: var(--ink); box-shadow: 0 0 0 1px var(--copper), 0 0 24px rgba(59,134,230,.18); }
.stock-card .tk { font: 700 24px/1 var(--f-display);  color: var(--copper); }
.stock-card .nm { font-weight: 600; }
.stock-card .sc { font-size: 14px; color: var(--muted); }
.stock-card .row { display: flex; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font: 400 13px/1 var(--f-mono); color: var(--muted); }
.stock-card .row b { color: var(--ink); font-weight: 500; }
.stock-card .row > :last-child { margin-left: auto; }

.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); border-top: 1px solid var(--line); }
.sec-link { display: grid; gap: 4px; padding: 18px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.sec-t { font: 700 20px/1.2 var(--f-display);  }
.sec-d { color: var(--muted); font-size: 15px; }
.sec-link:hover .sec-t { color: var(--copper); }

/* ---------- tablas */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
.data caption { caption-side: bottom; text-align: left; padding: 10px 14px; font: 400 12px/1.4 var(--f-mono); color: var(--muted); border-top: 1px solid var(--line); }
.data th, .data td { padding: 10px 14px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.data tbody tr:last-child > * { border-bottom: 0; }
.data thead th { font: 600 12px/1.2 var(--f-body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--ground); }
.data th[scope="row"], .data th:first-child { text-align: left; font-weight: 600; }
.data td { font-family: var(--f-mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.data .txt { text-align: left; font-family: var(--f-body); font-size: 15px; white-space: normal; min-width: 150px; }
.data thead .txt { font-size: 12px; }
.data td.neg { color: var(--down); }
.data tr.derived > * { color: var(--muted); font-style: italic; }
.data td.win { color: var(--up); font-weight: 500; background: color-mix(in srgb, var(--up) 9%, transparent); }
.data tbody tr:hover > * { background: color-mix(in srgb, var(--copper) 5%, transparent); }
.kpi-line { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.kpi-line b { color: var(--ink); font-family: var(--f-mono); font-weight: 500; }

/* ---------- ficha */
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: -28px; }
.stock-head { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: end; }
.quote { display: grid; gap: 6px; padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--copper); min-width: 220px; }
.quote .tk { font: 500 13px/1 var(--f-mono); letter-spacing: .1em; color: var(--muted); }
.quote .px { font: 700 38px/1 var(--f-display);  font-variant-numeric: tabular-nums; }
.quote .up, .quote .down { font: 500 14px/1 var(--f-mono); }
.quote .note { margin: 4px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.tile { display: grid; gap: 6px; padding: 16px; background: var(--surface); }
.tile .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .val { font: 500 24px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: start; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks li { padding-left: 26px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 0; top: .55em; width: 12px; height: 12px; border: 2px solid var(--copper); border-radius: 50%; }
.aside-box { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; display: grid; gap: 12px; justify-items: start; }
.aside-box p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.chips a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font: 500 13px/1.2 var(--f-mono); text-decoration: none; background: var(--surface); }
.chips a:hover { border-color: var(--copper); }
.aside-box .chips { display: inline-flex; margin: 6px 0 0; }

.defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px 32px; margin: 0; }
.defs dt { font: 700 18px/1.2 var(--f-display);  }
.defs dd { margin: 4px 0 0; color: var(--muted); }

/* ---------- comparadores */
.cmp > p { max-width: 70ch; margin: 0 0 16px; }
.cmp-t th:not(:first-child), .cmp-t td { width: 30%; }

/* ---------- rankings */
.rank-ui { display: grid; gap: 16px; margin-top: -20px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
#rank thead th:nth-child(2) { text-align: left; }
.presets button { padding: 9px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 3px; font: 600 14px/1 var(--f-body); cursor: pointer; }
.presets button:hover, .presets button[aria-pressed="true"] { border-color: var(--copper); color: var(--copper); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px 24px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.filters label { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 14px; font-weight: 600; }
.filters input, .filters select { grid-column: 1 / -1; width: 100%; }
.filters input[type="range"] { accent-color: var(--copper); }
.filters .out { font: 500 14px/1 var(--f-mono); color: var(--copper); }
select, input, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 9px 10px; }
.filters input[type="range"] { padding: 0; border: 0; }
.count { margin: 0; font-size: 14px; color: var(--muted); }
#rank td.empty { text-align: center; font-family: var(--f-body); color: var(--muted); padding: 28px; }

/* ---------- educación */
.lessons { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.lesson { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; scroll-margin-top: 120px; }
.lesson h2 { font-size: 22px; font-weight: 700;  }
.lesson p { margin: 12px 0 0; }
.lede-sm { color: var(--muted); }
.formula { font: 500 14px/1.5 var(--f-mono); padding: 12px 14px; background: var(--copper-soft); border-left: 3px solid var(--copper); }
.warn { font-size: 15px; color: var(--muted); }
.warn b { color: var(--ink); }

/* ---------- contacto */
.contact { display: grid; gap: 16px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.contact label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.contact textarea { resize: vertical; }
.contact .btn { justify-self: start; }
.contact .btn[disabled] { opacity: .6; cursor: progress; }
.hp { position: absolute; left: -9999px; }
.form-msg { margin: 0; padding: 12px 14px; border-radius: 3px; font-size: 15px; }
.form-msg.ok { background: color-mix(in srgb, var(--up) 12%, transparent); }
.form-msg.err { background: color-mix(in srgb, var(--down) 12%, transparent); }
.copy { padding: 4px 10px; font: 600 13px/1.2 var(--f-body); border: 1px solid var(--line); background: var(--ground); color: var(--ink); border-radius: 3px; cursor: pointer; }

/* ---------- pie */
.site-foot { background: var(--tape); border-top: 1px solid var(--line); padding-block: 32px; font-size: 15px; color: var(--muted); }
.foot-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 32px; }
.foot-grid p { margin: 0 0 8px; }
.brand-sm { font: 700 17px/1 var(--f-display); color: var(--ink); }
.disclaimer { padding: 14px 16px; border: 1px dashed var(--line); border-radius: 4px; font-size: 14px; }

/* ---------- privacidad y cookies */
.prose { max-width: 70ch; }
.prose h2 { font-size: 20px; font-weight: 600; margin: 28px 0 8px; }
.prose p { margin: 0 0 12px; }
.consent { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 20; max-width: 720px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 12px 40px rgba(0,0,0,.5); font-size: 14px; }
.consent p { margin: 0; flex: 1 1 320px; color: var(--muted); }
.consent-btns { display: flex; gap: 10px; }
.consent .btn { padding: 10px 16px; font-size: 14px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--pacific); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .two, .foot-grid, .stock-head { grid-template-columns: 1fr; }
  .nav { order: 3; flex-basis: 100%; }
  .bar { gap: 10px 16px; }
  .xbtn { margin-left: auto; }
}
@media (max-width: 460px) {
  .wrap, .bar { padding-inline: 16px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .xbtn span { display: none; }
  .lessons, .defs, .sec-grid { grid-template-columns: 1fr; }
}
