/* =============================================================
   Rentapuestas — gestor de bankroll / calculadora de yield
   Dark, premium, mobile-first. Single file.
   ============================================================= */

/* 1. Tokens
   ============================================================= */
:root {
  /* Verde oscuro "tirando a claro" + amarillo (estilo casa de apuestas) */
  --bg:        #06241b;
  --bg-elev:   #0a3025;
  --bg-card:   #0d3729;
  --bg-card-2: #124a37;
  --border:    #1e5744;
  --border-soft: rgba(255,255,255,.07);

  --text:      #eaf3ee;
  --text-dim:  #a6c2b6;
  --text-mute: #7ba090;

  --accent:    #19c274;   /* verde acción / positivo */
  --accent-ink:#03160d;
  --accent-2:  #ffd21e;   /* amarillo acento */
  --accent-2-ink: #24320a;
  --gold:      #ffd21e;   /* alias de --accent-2 (chips) */
  --danger:    #ff5b57;   /* rojo pérdidas */
  --danger-ink:#1a0509;

  --radius:    16px;
  --radius-sm: 10px;
  --shadow:    0 18px 44px -20px rgba(0,0,0,.6);
  --ring:      0 0 0 3px rgba(255,210,30,.34);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --wrap: 1120px;
}

/* 2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1000px 560px at 86% -10%, rgba(25,194,116,.18), transparent 60%),
    radial-gradient(720px 460px at 0% 2%, rgba(255,210,30,.08), transparent 55%),
    linear-gradient(180deg, #0c3c2d 0%, var(--bg) 46%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
input, select, button { font: inherit; }

::selection { background: var(--accent-2); color: var(--accent-2-ink); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }

/* 3. Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(6,32,24,.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 60%, var(--accent) 100%);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: .8rem; position: relative; }
.brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em;
  color: var(--text);
}
.brand svg { color: var(--accent); }
.brand strong { color: var(--accent-2); font-weight: 800; }
.brand--sm { font-size: 1.05rem; }
.header-nav { display: none; gap: 1.4rem; font-size: .93rem; color: var(--text-dim); font-weight: 500; }
.header-nav a:hover { color: var(--text); }

/* 4. Hero + panel
   ============================================================= */
.hero { padding-block: 2.4rem 1rem; }
.hero-head { max-width: 720px; margin-bottom: 1.6rem; }
h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); font-weight: 800; }
.hero-sub { margin-top: .8rem; color: var(--text-dim); font-size: clamp(1rem, 2.4vw, 1.12rem); }
.hero-sub strong { color: var(--text); font-weight: 600; }

.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .7rem;
  padding: .9rem;
  background: linear-gradient(180deg, var(--bg-card-2), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat {
  display: flex; flex-direction: column; gap: .18rem;
  padding: .85rem .9rem;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.stat--hero {
  grid-column: 1 / -1;
  background:
    radial-gradient(120% 150% at 100% 0%, rgba(255,210,30,.14), transparent 55%),
    radial-gradient(120% 140% at 0% 100%, rgba(25,194,116,.16), transparent 60%),
    rgba(255,255,255,.03);
  border-color: rgba(255,210,30,.34);
}
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mute); font-weight: 600; }
.stat-value { font-family: var(--display); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.stat--hero .stat-value { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.stat-foot { font-size: .78rem; color: var(--text-mute); }
.stat-value.is-pos { color: var(--accent); }
.stat-value.is-neg { color: var(--danger); }

.linklike {
  color: var(--accent-2); font-weight: 600; padding: 0;
  border-bottom: 1px dashed rgba(255,210,30,.5);
}
.linklike:hover { color: #ffe066; }

/* 5. Chart
   ============================================================= */
.chart-card {
  margin-top: 1rem;
  padding: 1rem 1rem .6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chart-card figcaption {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-family: var(--display); font-weight: 600; font-size: .98rem; color: var(--text);
  margin-bottom: .4rem;
}
.chart-legend { font-family: var(--sans); font-size: .8rem; color: var(--text-mute); font-weight: 500; }
.chart-holder { position: relative; width: 100%; aspect-ratio: 16 / 6; min-height: 180px; max-height: 340px; }
.chart-holder.is-empty { aspect-ratio: auto; height: 140px; min-height: 140px; }
#evoChart { width: 100%; height: 100%; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 1.5rem; color: var(--text-mute); font-size: .92rem;
}

/* 6. Form
   ============================================================= */
.bet-form {
  margin-top: 1rem;
  padding: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-title { font-size: 1.15rem; font-weight: 700; margin-bottom: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--text-dim); }
.field input, .field select, .mini-field select {
  width: 100%;
  padding: .62rem .7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.field input:focus, .field select:focus, .mini-field select:focus {
  border-color: var(--accent-2); box-shadow: var(--ring); outline: none;
}
.field input::placeholder { color: var(--text-mute); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }

.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1rem; }
.form-hint { font-size: .8rem; color: var(--text-mute); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.15rem;
  border-radius: var(--radius-sm);
  font-weight: 600; letter-spacing: -0.01em;
  transition: transform .14s var(--ease-out), background .16s var(--ease-out), border-color .16s var(--ease-out);
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px rgba(25,194,116,.6); }
.btn--primary:hover { background: #24d581; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn--ghost:hover { color: var(--text); border-color: var(--accent-2); }
.btn--tiny { padding: .45rem .75rem; font-size: .85rem; background: var(--bg-elev); border-color: var(--border); color: var(--text-dim); }
.btn--tiny:hover { color: var(--text); border-color: var(--accent-2); }
.btn--danger-ghost { color: var(--danger); border-color: rgba(255,91,87,.35); }
.btn--danger-ghost:hover { background: rgba(255,91,87,.1); }

.privacy-badge {
  margin-top: 1rem; font-size: .85rem; color: var(--text-dim);
  padding: .7rem .9rem; background: rgba(25,194,116,.07);
  border: 1px solid rgba(25,194,116,.2); border-radius: var(--radius-sm);
}
.privacy-badge a { color: var(--accent-2); border-bottom: 1px dashed rgba(255,210,30,.5); }

/* 7. Ad slots (placeholders)
   ============================================================= */
.ad-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.015) 0 10px, transparent 10px 20px);
  color: var(--text-mute);
}
.ad-slot span { font-weight: 700; letter-spacing: .18em; font-size: .82rem; color: var(--text-dim); }
.ad-slot small { font-size: .7rem; opacity: .7; }
.ad-slot--leaderboard { margin-top: 1.6rem; min-height: 100px; }
.ad-slot--incontent { margin-block: 1.6rem; min-height: 250px; }
.ad-slot--inrow { min-height: 90px; margin: .3rem 0; }
.ad-slot--popup { min-height: 250px; width: 300px; max-width: 100%; margin-inline: auto; }
.ad-slot--toast { min-height: 80px; width: 160px; }

/* 8. History
   ============================================================= */
.history { padding-block: 2rem 1rem; }
.history-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }
.history-head h2 { font-size: 1.4rem; }
.history-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.mini-field select { padding: .45rem .6rem; font-size: .85rem; }

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.bet-table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.bet-table th, .bet-table td { padding: .7rem .8rem; text-align: left; border-bottom: 1px solid var(--border-soft); }
.bet-table th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-mute); font-weight: 700; background: rgba(255,255,255,.02); }
.bet-table td.num, .bet-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bet-table tbody tr:last-child td { border-bottom: 0; }
.bet-table tr:hover td { background: rgba(255,255,255,.02); }
.bet-table .act { width: 1%; white-space: nowrap; }

.chip {
  display: inline-block; padding: .18rem .55rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .02em;
}
.chip--pendiente { background: rgba(255,210,30,.16); color: var(--accent-2); }
.chip--ganada { background: rgba(25,194,116,.18); color: var(--accent); }
.chip--perdida { background: rgba(255,91,87,.16); color: var(--danger); }
.chip--nula { background: rgba(255,255,255,.08); color: var(--text-dim); }

.state-select {
  padding: .28rem .4rem; font-size: .78rem; border-radius: 8px;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
}
.pos { color: var(--accent); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

.row-btn {
  padding: .3rem .45rem; border-radius: 8px; color: var(--text-mute);
  border: 1px solid transparent;
}
.row-btn:hover { color: var(--text); border-color: var(--border); }
.row-btn--del:hover { color: var(--danger); border-color: rgba(255,91,87,.35); }

.table-empty, .table-scroll .table-empty { padding: 1.6rem; text-align: center; color: var(--text-mute); font-size: .9rem; }

.bysport { margin-top: 1.6rem; }
.bysport h3 { font-size: 1.15rem; }
.bysport-hint { color: var(--text-dim); font-size: .88rem; margin: .3rem 0 .8rem; }
.bysport-table { min-width: 520px; }

/* 9. Content sections
   ============================================================= */
main > section { padding-block: 1.4rem; }
.band { margin-top: 1rem; }
main h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); margin-bottom: 1.1rem; position: relative; padding-bottom: .5rem; }
main h2::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 44px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.steps { list-style: none; display: grid; gap: 1rem; grid-template-columns: 1fr; counter-reset: step; }
.step {
  padding: 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.step-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: rgba(25,194,116,.14); color: var(--accent); margin-bottom: .7rem;
}
.step:nth-child(2) .step-icon { background: rgba(255,210,30,.15); color: var(--accent-2); }
.step-icon svg { width: 22px; height: 22px; }
.step h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.step p { color: var(--text-dim); font-size: .93rem; }

.ideas-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.idea { padding: 1.2rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.idea h3 { font-size: 1.03rem; margin-bottom: .35rem; color: var(--text); }
.idea h3::before { content: "▸ "; color: var(--accent-2); }
.idea p { color: var(--text-dim); font-size: .93rem; }

.prose { max-width: 760px; }
.prose h3 { font-size: 1.12rem; margin: 1.4rem 0 .5rem; color: var(--text); }
.prose p, .prose li { color: var(--text-dim); }
.prose ul { margin: .5rem 0 .5rem 1.1rem; }
.prose li { margin-bottom: .3rem; }
.prose strong { color: var(--text); }
.prose a { color: var(--accent-2); border-bottom: 1px dashed rgba(255,210,30,.5); }
.prose code { background: var(--bg-elev); padding: .1rem .35rem; border-radius: 6px; font-size: .88em; color: var(--accent-2); }
.responsible {
  margin-top: 1.4rem; padding: .9rem 1rem; font-size: .84rem;
  background: rgba(255,91,87,.07); border: 1px solid rgba(255,91,87,.22); border-radius: var(--radius-sm);
}
.responsible a { color: var(--danger); text-decoration: underline; }

.faq-list { display: grid; gap: .6rem; }
.faq details {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .3rem .2rem;
}
.faq summary {
  padding: .85rem 1rem; cursor: pointer; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent-2); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 1rem 1rem; color: var(--text-dim); font-size: .93rem; }

/* 10. Footer
   ============================================================= */
.site-footer { margin-top: 2rem; border-top: 1px solid var(--border-soft); background: var(--bg-elev); }
.footer-inner { display: grid; gap: 1.2rem; padding-block: 1.8rem; }
.footer-inner p { color: var(--text-mute); font-size: .86rem; margin-top: .4rem; max-width: 42ch; }
.footer-legal-note { font-size: .8rem !important; }
.footer-legal-note a, .footer-inner a { color: var(--text-dim); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .9rem; }
.footer-links a:hover { color: var(--text); }

/* 11. Ad popup + toast
   ============================================================= */
.ad-popup {
  position: fixed; inset: 0; margin: auto;
  width: min(92vw, 360px); height: max-content;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); color: var(--text);
  padding: 2.2rem 1.4rem 1.2rem;
  box-shadow: var(--shadow);
}
.ad-popup::backdrop { background: rgba(3,18,13,.82); }
.ad-popup-close {
  position: absolute; top: .5rem; right: .6rem; width: 32px; height: 32px;
  border-radius: 8px; font-size: 1.4rem; line-height: 1; color: var(--text-dim);
}
.ad-popup-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.ad-popup #adPopupContinue, .ad-popup .btn { margin-top: 1rem; width: 100%; }

.ad-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  padding: 1.4rem .7rem .7rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card); box-shadow: var(--shadow);
}
.ad-toast-close {
  position: absolute; top: .2rem; right: .3rem; width: 24px; height: 24px;
  border-radius: 6px; font-size: 1.1rem; line-height: 1; color: var(--text-mute);
}
.ad-toast-close:hover { color: var(--text); }

/* 12. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .header-nav { display: flex; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .ideas-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr auto; align-items: start; }
}
@media (min-width: 960px) {
  .hero { padding-block: 3.2rem 1rem; }
  .ideas-grid { grid-template-columns: repeat(3, 1fr); }
  .stat--hero { grid-column: span 2; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
