:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #eef4ff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --container: 1180px;
  --header-h: 72px;
  --footer-h: 54px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #e0edff 0, transparent 32rem), var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--primary); }
img, canvas { max-width: 100%; }
button, input { font: inherit; }
.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }
.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  padding: 10px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 10px;
  z-index: 999;
}
.skip-link:focus { left: 12px; }

/* Home sin scroll: experiencia por pantallas */
.home-shell {
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
}
.site-header {
  z-index: 50;
  backdrop-filter: blur(20px);
  background: rgba(247, 249, 252, 0.86);
  border-bottom: 1px solid rgba(219, 228, 240, 0.8);
}
.home-header { height: var(--header-h); }
.nav {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -0.03em; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.28);
}
.screen-nav { display: inline-flex; gap: 8px; align-items: center; }
.screen-nav-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.78);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 850;
  cursor: pointer;
}
.screen-nav-button.is-active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.app-main {
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.screens-track {
  height: 100%;
  width: 100%;
  display: flex;
  transition: transform .72s cubic-bezier(.2,.82,.2,1);
  will-change: transform;
}
.screen {
  min-width: 100%;
  height: 100%;
  overflow: hidden;
  display: grid;
  align-items: center;
}
.screen-inner {
  height: min(100%, 780px);
  padding-block: clamp(14px, 2vh, 28px);
}
.info-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
}
.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-areas:
    "heading side"
    "form side";
  gap: clamp(14px, 2vw, 22px);
  align-items: stretch;
}
.wheel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 350px);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "intro result"
    "wheel result";
  gap: clamp(14px, 2vw, 22px);
  align-items: stretch;
}
.wheel-intro { grid-area: intro; }
.wheel-panel { grid-area: wheel; }
.result-panel { grid-area: result; }
.compact-heading { grid-area: heading; margin: 0; }
.config-panel { grid-area: form; min-height: 0; }
.config-side-card { grid-area: side; }

.eyebrow { text-transform: uppercase; letter-spacing: .14em; color: var(--primary); font-weight: 900; font-size: .72rem; margin: 0 0 8px; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -0.04em; }
h1 { font-size: clamp(2.4rem, 7vw, 5.2rem); margin: 0; max-width: 820px; }
h2 { font-size: clamp(1.45rem, 3vw, 2.4rem); margin: 0 0 10px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p { margin-top: 0; }
.hero-text { font-size: clamp(1rem, 1.7vw, 1.22rem); color: var(--muted); max-width: 710px; margin: 18px 0 24px; }
.compact-copy { min-width: 0; }
.compact-heading p, .wheel-intro p, .config-side-card p { color: var(--muted); margin-bottom: 0; }
.hero-actions, .toolbar, .wheel-controls, .result-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button {
  border: 0;
  border-radius: 999px;
  padding: 11px 17px;
  cursor: pointer;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .62; cursor: not-allowed; transform: none; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 14px 34px rgba(37, 99, 235, .28); }
.button.primary:hover { background: var(--primary-dark); color: #fff; }
.button.secondary { background: var(--secondary); color: #fff; }
.button.ghost { background: #e8eef8; color: var(--secondary); }
.button.large { padding: 13px 22px; font-size: 1rem; }
.hero-card, .panel, .info-card, .sticky-card, .legal-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card { padding: clamp(16px, 3vw, 28px); display: grid; place-items: center; gap: 16px; text-align: left; color: var(--muted); font-weight: 700; }
.info-card-main { grid-template-columns: minmax(180px, .82fr) 1fr; align-items: center; }
.mini-wheel {
  width: min(300px, 34vmin);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(#2563eb 0 60deg, #7c3aed 60deg 120deg, #06b6d4 120deg 180deg, #f59e0b 180deg 240deg, #10b981 240deg 300deg, #ef4444 300deg 360deg);
  border: 12px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08), 0 24px 50px rgba(15, 23, 42, .15);
  animation: slowSpin 18s linear infinite;
}
@keyframes slowSpin { to { transform: rotate(360deg); } }
.compact-info-grid { display: grid; gap: 12px; }
.compact-info-grid article {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.compact-info-grid h2 { font-size: 1.04rem; margin-bottom: 5px; }
.compact-info-grid p { margin: 0; font-size: .94rem; }
.ad-slot {
  margin: 18px 0 0;
  min-height: 78px;
  border: 1.5px dashed #b7c5da;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(255,255,255,.75), rgba(232,238,248,.7));
  color: #94a3b8;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .75rem;
}
.ad-slot-inline { max-width: 640px; }
.compact-ad { min-height: 76px; width: 100%; }
.panel { padding: clamp(16px, 2.4vw, 24px); }
.form-row { display: grid; gap: 8px; margin-bottom: 14px; }
label { font-weight: 900; }
input[type="number"], input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 11px 12px;
  outline: none;
  color: var(--text);
  transition: border .18s ease, box-shadow .18s ease;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
small { color: var(--muted); }
.inline-control { display: grid; grid-template-columns: minmax(100px, 190px) auto; gap: 10px; align-items: center; }
.segments-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0;
  max-height: clamp(210px, 42vh, 380px);
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
}
.segment-field { display: grid; gap: 4px; }
.segment-field span { color: var(--muted); font-size: .78rem; font-weight: 900; }
.segment-field input { padding: 9px 10px; border-radius: 12px; font-size: .94rem; }
.message { min-height: 24px; color: var(--muted); font-weight: 800; margin-top: 10px; font-size: .94rem; }
.message.error { color: var(--danger); }
.message.success { color: var(--success); }
.config-side-card { display: flex; flex-direction: column; gap: 16px; }
.config-side-card .button { margin-top: auto; width: 100%; }
.wheel-panel { display: grid; justify-items: center; align-items: center; overflow: hidden; }
.wheel-area { position: relative; width: min(100%, 56vmin, 530px); aspect-ratio: 1; display: grid; place-items: center; }
#wheelCanvas {
  width: 100%;
  height: auto;
  border-radius: 50%;
  filter: drop-shadow(0 24px 34px rgba(15, 23, 42, .18));
  transform: rotate(0deg);
  will-change: transform;
}
.pointer {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 20px solid transparent;
  border-bottom: 20px solid transparent;
  border-right: 34px solid #111827;
  z-index: 5;
  filter: drop-shadow(0 6px 10px rgba(15,23,42,.25));
}
.result-panel { display: flex; flex-direction: column; gap: 15px; min-height: 0; }
.wheel-controls { flex-direction: column; align-items: stretch; }
.wheel-controls .button { width: 100%; }
.sound-toggle { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 900; justify-content: center; }
.result-box {
  width: 100%;
  border: 1px solid #c7d2fe;
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border-radius: 18px;
  padding: 17px;
  display: grid;
  gap: 5px;
  text-align: center;
}
.result-label { color: var(--primary); font-weight: 900; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; }
.result-box strong { font-size: clamp(1.1rem, 2vw, 1.7rem); }
.result-box.pop { animation: popResult .55s ease; }
@keyframes popResult { 0% { transform: scale(.96); } 55% { transform: scale(1.025); } 100% { transform: scale(1); } }
.result-actions .button { flex: 1; }
.home-footer {
  height: var(--footer-h);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.9);
  display: flex;
  align-items: center;
}
.compact-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
}
.compact-footer p { color: var(--muted); margin: 0; font-size: .92rem; }
.footer-grid nav { display: flex; flex-wrap: wrap; gap: 13px; color: var(--muted); font-weight: 800; font-size: .92rem; }

/* Páginas legales y contacto: se mantienen con scroll normal */
body:not(.home-shell) .site-header {
  position: sticky;
  top: 0;
}
body:not(.home-shell) .nav { min-height: var(--header-h); }
.nav-links { display: flex; align-items: center; gap: 18px; color: var(--muted); font-weight: 700; font-size: 0.95rem; }
.legal-main { padding: 54px 0; }
.legal-card { padding: clamp(20px, 4vw, 42px); box-shadow: none; }
.legal-card h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 18px; }
.legal-card h2 { font-size: 1.45rem; margin-top: 30px; }
.legal-card a { color: var(--primary); font-weight: 800; }
.legal-card p, .legal-card li { color: var(--muted); }
.editable-note { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 14px; padding: 14px; font-weight: 750; }
.contact-box { display: grid; gap: 12px; }
body:not(.home-shell) .site-footer { padding: 34px 0; border-top: 1px solid var(--line); background: #fff; }
body:not(.home-shell) .footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 22px; align-items: center; }
body:not(.home-shell) .footer-grid p { color: var(--muted); margin: 6px 0 0; }

@media (max-width: 980px) {
  :root { --header-h: 66px; --footer-h: 52px; }
  .info-layout { grid-template-columns: 1fr; align-content: center; }
  .info-card-main { grid-template-columns: 170px 1fr; }
  .config-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "heading" "form" "side";
  }
  .config-side-card { flex-direction: row; align-items: center; }
  .config-side-card .button { margin-top: 0; max-width: 220px; }
  .config-side-card .compact-ad { display: none; }
  .wheel-layout {
    grid-template-columns: 1fr 280px;
  }
  .segments-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 34vh; }
}

@media (max-width: 760px) {
  :root { --header-h: 62px; --footer-h: 48px; }
  .container { width: min(100% - 22px, var(--container)); }
  .brand span:last-child { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .screen-nav { gap: 5px; }
  .screen-nav-button { padding: 7px 9px; font-size: .78rem; }
  .screen-inner { padding-block: 10px; }
  .info-layout { gap: 12px; }
  h1 { font-size: clamp(2rem, 11vw, 3.4rem); }
  h2 { font-size: clamp(1.25rem, 6vw, 1.8rem); }
  .hero-text { margin: 12px 0 15px; font-size: .98rem; }
  .hero-actions .button, .toolbar .button, .result-actions .button { flex: 1; min-width: calc(50% - 6px); }
  .ad-slot-inline { display: none; }
  .info-card-main { grid-template-columns: 1fr; padding: 13px; }
  .mini-wheel { width: min(150px, 30vmin); border-width: 8px; }
  .compact-info-grid { grid-template-columns: 1fr; gap: 8px; }
  .compact-info-grid article { padding: 10px; }
  .compact-info-grid article:nth-child(3) { display: none; }
  .compact-info-grid h2 { font-size: .96rem; }
  .compact-info-grid p { font-size: .84rem; }
  .config-layout { gap: 8px; }
  .compact-heading p { display: none; }
  .panel { padding: 12px; border-radius: 16px; }
  .inline-control { grid-template-columns: 95px 1fr; }
  input[type="number"], input[type="text"] { padding: 9px 10px; }
  small { display: none; }
  .segments-grid { grid-template-columns: 1fr; max-height: 35vh; gap: 7px; margin: 8px 0; }
  .segment-field { grid-template-columns: 78px 1fr; align-items: center; }
  .segment-field span { font-size: .74rem; }
  .compact-toolbar { gap: 6px; }
  .compact-toolbar .button { min-height: 38px; padding: 8px 10px; font-size: .82rem; }
  .message { font-size: .82rem; min-height: 18px; margin-top: 6px; }
  .config-side-card { gap: 10px; }
  .config-side-card h2, .config-side-card p { display: none; }
  .config-side-card .button { max-width: none; }
  .wheel-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "intro" "wheel" "result";
    gap: 8px;
  }
  .wheel-intro p { display: none; }
  .wheel-area { width: min(100%, 46vh, 84vw); }
  .pointer { right: -7px; border-top-width: 14px; border-bottom-width: 14px; border-right-width: 25px; }
  .result-panel { gap: 8px; }
  .wheel-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .wheel-controls .button { min-height: 40px; padding: 9px 10px; font-size: .86rem; }
  .sound-toggle { grid-column: span 2; font-size: .82rem; }
  .result-box { padding: 10px; }
  .result-box strong { font-size: 1rem; }
  .result-actions { gap: 7px; }
  .result-actions .button { min-height: 38px; padding: 8px 10px; font-size: .84rem; }
  .result-panel .compact-ad { display: none; }
  .compact-footer { grid-template-columns: 1fr; gap: 2px; text-align: center; }
  .compact-footer p { display: none; }
  .footer-grid nav { justify-content: center; gap: 10px; font-size: .78rem; }
  .nav-links { display: none; }
  body:not(.home-shell) .footer-grid { grid-template-columns: 1fr; }
}

@media (max-height: 680px) {
  .hero-text { margin: 10px 0 14px; }
  .ad-slot-inline, .compact-ad { min-height: 58px; }
  .compact-info-grid article { padding: 10px; }
  .segments-grid { max-height: 30vh; }
  .wheel-area { width: min(100%, 48vmin, 430px); }
  .result-box { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .screens-track { transition: none !important; }
}
