/* Rumming — sitio web oficial
   Paleta y efectos derivados del diseño de la app (Theme.swift / TileView.swift). */

:root {
  /* Tema activo (se sobreescribe con data-theme en <html>) */
  --top: #8c0f6b;
  --bottom: #52084d;
  --accent: #2648b8;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
  --faint: rgba(255, 255, 255, 0.42);
  --glass: rgba(255, 255, 255, 0.09);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --stroke: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --max: 1120px;
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", Inter, system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;
  --green: #33bf59;
  --blue: #476bE6;
  --orange: #d9801f;
  --gold: #f5b81e;
}

/* Temas de la app (mismos valores RGB que GameTheme.all) */
html[data-theme="magenta"]  { --top:#8c0f6b; --bottom:#52084d; --accent:#2648b8; }
html[data-theme="emerald"]  { --top:#0d6b5c; --bottom:#083d3d; --accent:#f2b81f; }
html[data-theme="ocean"]    { --top:#0f3d85; --bottom:#051a47; --accent:#33a8db; }
html[data-theme="sunset"]   { --top:#9e2e1a; --bottom:#571033; --accent:#fa8c26; }
html[data-theme="midnight"] { --top:#1f2147; --bottom:#0a0a1f; --accent:#7359d9; }
html[data-theme="aurora"]   { --top:#00737a; --bottom:#2e0d73; --accent:#40ffb3; }
html[data-theme="gold"]     { --top:#856110; --bottom:#1f1205; --accent:#ffdb59; }
html[data-theme="neon"]     { --top:#1a0547; --bottom:#05051f; --accent:#ff26d9; }
html[data-theme="galaxy"]   { --top:#120838; --bottom:#03030f; --accent:#8cbfff; }
html[data-theme="lava"]     { --top:#380805; --bottom:#0d0300; --accent:#ff801a; }

/* Idioma: se muestra sólo el bloque del idioma activo */
html[data-lang="es"] [data-l="en"] { display: none !important; }
html[data-lang="en"] [data-l="es"] { display: none !important; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bottom);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---------- Fondo animado (aurora + plasma, como ThemeBackground) ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(150deg, var(--top), var(--bottom) 70%);
  transition: background 0.8s ease;
}

.bg::before,
.bg::after {
  content: "";
  position: absolute;
  inset: -25%;
  background:
    radial-gradient(38% 38% at 20% 22%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%),
    radial-gradient(42% 42% at 82% 18%, color-mix(in srgb, var(--top) 85%, white 10%), transparent 72%),
    radial-gradient(46% 46% at 60% 88%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%);
  filter: blur(40px);
  opacity: 0.75;
  animation: drift 26s ease-in-out infinite alternate;
  transition: background 0.8s ease;
}

.bg::after {
  animation-duration: 38s;
  animation-direction: alternate-reverse;
  opacity: 0.45;
  transform: scale(1.2);
}

@keyframes drift {
  0%   { transform: translate3d(-4%, -3%, 0) scale(1); }
  50%  { transform: translate3d(5%, 4%, 0) scale(1.12); }
  100% { transform: translate3d(-3%, 6%, 0) scale(1.05); }
}

/* Grano sutil para que el degradado no haga banding */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

/* Brillo superior, como el RadialGradient del menú principal */
.topglow {
  position: fixed;
  top: 0; left: 50%;
  width: 900px; height: 460px;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 0%, rgba(255, 255, 255, 0.18), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ---------- Layout ---------- */

.wrap { width: min(100% - 40px, var(--max)); margin-inline: auto; }

section { padding: 84px 0; position: relative; }
section[id] { scroll-margin-top: 84px; }

h1, h2, h3 { line-height: 1.12; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); font-weight: 900; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 14px; color: var(--muted); }
a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.76rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 18px;
}

.lead { font-size: clamp(1.02rem, 2vw, 1.22rem); max-width: 60ch; color: rgba(255,255,255,0.78); }

.center { text-align: center; }
.center .lead { margin-inline: auto; }

/* ---------- Header ---------- */

header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  background: rgba(0, 0, 0, 0.16);
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, padding 0.3s ease;
  padding: 12px 0;
}
header.nav.scrolled {
  background: rgba(0, 0, 0, 0.42);
  border-bottom-color: var(--stroke);
  padding: 6px 0;
}
.nav-in { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: -0.01em; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 6px 18px rgba(0,0,0,0.4); }
.nav-links { display: flex; gap: 6px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav-links a {
  font-size: 0.9rem; font-weight: 600; color: var(--muted); text-decoration: none;
  padding: 8px 12px; border-radius: 999px; transition: color 0.2s, background 0.2s;
}
.nav-links a:hover { color: var(--ink); background: var(--glass); }

/* En pantallas pequeñas la barra se queda en una sola línea: sólo marca,
   soporte e idioma (los enlaces de sección quedan a un scroll de distancia). */
@media (max-width: 820px) {
  .nav-links { flex-wrap: nowrap; gap: 4px; }
  .nav-links a.sec { display: none; }
  .nav-links a { padding: 8px 10px; font-size: 0.85rem; }
}

.langswitch {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 999px;
}
.langswitch button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 0.78rem; font-weight: 800; padding: 5px 11px; border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.langswitch button[aria-pressed="true"] { background: var(--ink); color: #101014; }

/* ---------- Botones ---------- */

.btn {
  --btn: var(--green);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 28px; border-radius: 18px; border: 0; cursor: pointer;
  font: inherit; font-size: 1rem; font-weight: 800; color: #fff; text-decoration: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--btn) 88%, white 12%), var(--btn));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--btn) 42%, transparent),
              inset 0 1px 0 rgba(255,255,255,0.35);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s, filter 0.2s;
  position: relative; overflow: hidden;
}
.btn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.06); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 45%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.42), transparent);
  transform: skewX(-18deg); animation: sweep 4.5s ease-in-out infinite;
}
@keyframes sweep { 0%, 62% { left: -60%; } 82%, 100% { left: 130%; } }

.btn.ghost {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--stroke); box-shadow: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.btn.ghost::after { display: none; }
.btn.blue { --btn: var(--blue); }
.btn.orange { --btn: var(--orange); }

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.center .cta-row { justify-content: center; }

.note { font-size: 0.84rem; color: var(--faint); }

/* ---------- Hero ---------- */

.hero { padding: 74px 0 60px; }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 46px; align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-grid .cta-row, .hero-grid .eyebrow { justify-content: center; }
  .hero .lead { margin-inline: auto; }
}

.title-shine {
  background: linear-gradient(100deg, #fff 20%, color-mix(in srgb, var(--accent) 80%, white) 45%, #fff 70%);
  background-size: 240% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 7s linear infinite;
}
@keyframes shine { to { background-position: -240% 0; } }

/* Tiles 3D del hero (mismo trío que el logo de la app: 7 rojo, comodín, 9 azul) */
.tiles {
  display: flex; justify-content: center; align-items: center; gap: 0;
  perspective: 1000px; padding: 24px 0;
}
.tile {
  --tilt: 0deg;
  position: relative;
  width: clamp(84px, 15vw, 116px);
  aspect-ratio: 1 / 1.38;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #ededed);
  box-shadow: 0 18px 34px rgba(0,0,0,0.42), inset 0 -3px 0 rgba(0,0,0,0.07);
  display: grid; place-items: center;
  font-size: clamp(2.4rem, 5vw, 3.4rem); font-weight: 900; letter-spacing: -0.03em;
  transform: rotate(var(--tilt));
  transform-style: preserve-3d;
  animation: float 3.8s ease-in-out infinite alternate;
  will-change: transform;
}
.tile::before { /* brillo tipo "sheen" de TileView */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0) 52%);
  pointer-events: none;
}
.tile::after { /* reflejo diagonal que barre la ficha */
  content: ""; position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,0.75) 50%, transparent 62%);
  background-size: 260% 100%; background-position: 160% 0;
  animation: sheen 5.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 0%, 55% { background-position: 160% 0; } 90%, 100% { background-position: -60% 0; } }
@keyframes float { from { transform: rotate(var(--tilt)) translateY(6px); } to { transform: rotate(var(--tilt)) translateY(-8px); } }

.tile.red { color: #d2202a; --tilt: -9deg; margin-right: -16px; }
.tile.blue { color: #1250c8; --tilt: 9deg; margin-left: -16px; }
.tile.joker {
  color: #16171c; z-index: 2; transform: scale(1.08); --tilt: 0deg;
  animation-duration: 3.1s;
  box-shadow: 0 24px 46px rgba(0,0,0,0.5), 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
.tile.joker svg { width: 60%; height: 60%; }

/* Etiquetas en las esquinas, como las fichas reales */
.tile .corner {
  position: absolute;
  font-size: 0.27em; font-weight: 800; line-height: 1;
  color: inherit;
}
.tile .tl { top: 9%; left: 10%; }
.tile .br { bottom: 9%; right: 10%; }
.tile .joker-j { color: #8a3ecb; }

/* ---------- Tarjetas glass ---------- */

.grid { display: grid; gap: 18px; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid.c3, .grid.c2 { grid-template-columns: 1fr; } }

.card {
  position: relative;
  padding: 26px 24px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s, background 0.3s;
}
.card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
/* Foco de luz que sigue al cursor */
.card::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%),
              color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%);
  pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card p:last-child { margin-bottom: 0; }

.icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  margin-bottom: 14px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  color: var(--accent);
}
.icon svg { width: 24px; height: 24px; }

/* ---------- Selector de temas ---------- */

.themebar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 28px; }
.swatch {
  width: 42px; height: 42px; border-radius: 13px; cursor: pointer; padding: 0;
  border: 2px solid rgba(255,255,255,0.22);
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s;
  position: relative;
}
.swatch:hover { transform: translateY(-4px) scale(1.08); }
.swatch[aria-pressed="true"] { border-color: #fff; transform: translateY(-3px) scale(1.1); }
.swatch span {
  position: absolute; inset: auto 0 -22px; font-size: 0.66rem; font-weight: 700;
  color: var(--faint); opacity: 0; transition: opacity 0.2s;
}
.swatch:hover span { opacity: 1; }

/* ---------- Pasos ---------- */

.steps { counter-reset: s; display: grid; gap: 14px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step .num {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 900; background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: #fff;
}

/* ---------- Franja de estadísticas ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 780px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: center; padding: 22px 12px; border-radius: 18px; background: rgba(0,0,0,0.22); border: 1px solid var(--stroke); }
.stat b { display: block; font-size: 2rem; font-weight: 900; }
.stat span { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; }

/* ---------- FAQ ---------- */

details.faq {
  border-radius: 16px; background: var(--glass); border: 1px solid var(--stroke);
  padding: 4px 20px; margin-bottom: 12px; transition: background 0.25s;
}
details.faq[open] { background: var(--glass-strong); }
details.faq summary {
  cursor: pointer; font-weight: 700; padding: 16px 0; list-style: none;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+"; font-size: 1.4rem; font-weight: 700; color: var(--accent);
  transition: transform 0.25s;
}
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq p { padding-bottom: 12px; }

/* ---------- Páginas legales ---------- */

.doc { max-width: 78ch; margin-inline: auto; padding: 56px 0 40px; }
.doc h1 { font-size: clamp(2rem, 5vw, 2.9rem); margin-bottom: 8px; }
.doc h2 { font-size: 1.3rem; margin-top: 36px; }
.doc h3 { margin-top: 24px; }
.doc ul { color: var(--muted); padding-left: 20px; }
.doc li { margin-bottom: 8px; }
.doc .updated { color: var(--faint); font-size: 0.88rem; margin-bottom: 30px; }
.doc table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.92rem; }
.doc th, .doc td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--stroke); vertical-align: top; }
.doc th { color: var(--ink); font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.doc td { color: var(--muted); }
.doc .box {
  padding: 20px 22px; border-radius: 18px; background: var(--glass);
  border: 1px solid var(--stroke); margin: 24px 0;
}
.doc code { background: rgba(0,0,0,0.3); padding: 2px 7px; border-radius: 6px; font-size: 0.88em; }

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--stroke); padding: 40px 0 56px; margin-top: 40px;
  background: rgba(0, 0, 0, 0.24);
}
.foot { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.foot a { font-size: 0.9rem; color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot small { color: var(--faint); }

/* ---------- Revelado al hacer scroll ---------- */

.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Confeti ---------- */

.confetti {
  position: fixed; top: 0; left: 0; width: 9px; height: 14px; border-radius: 2px;
  pointer-events: none; z-index: 999;
}

/* ---------- Preferencias de movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg::before, .bg::after, .tile, .tile::after, .btn::after, .title-shine { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover, .btn:hover, .swatch:hover { transform: none; }
}
