/* Grafito — estilos compartidos (shell, layout, componentes) */

/* Paleta MenteActiva: slate + cian (lógica) / verde (palabras) / púrpura
   (agilidad), naranja = CTA, verde = acierto, rojo = error. */
:root {
  --bg: #F8F9FA; --surface: #FFFFFF; --surface2: #F1F5F9; --line: #E2E8F0;
  --ink: #0F172A; --ink2: #475569; --ink3: #94A3B8;
  --primary: #0EA5E9; --accent: #0EA5E9; --on-accent: #FFFFFF; --sel-bg: #E0F2FE;
  --hi: #F59E0B; --hi-soft: #FEF3C7; --on-hi: #0F172A; --on-hi-soft: #0F172A;
  --ok-bg: #D1FAE5; --ok-line: #10B981; --ok-ink: #059669; --err-bg: #FEE2E2; --err-ink: #DC2626;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0B0F17; --surface: #121826; --surface2: #1E293B; --line: #334155;
  --ink: #F8F9FA; --ink2: #94A3B8; --ink3: #64748B;
  --primary: #38BDF8; --accent: #38BDF8; --on-accent: #FFFFFF; --sel-bg: #0C4A6E;
  --hi: #F59E0B; --hi-soft: #422006; --on-hi: #0F172A; --on-hi-soft: #FBBF24;
  --ok-bg: #064E3B; --ok-line: #10B981; --ok-ink: #6EE7B7;
  --err-bg: #7F1D1D; --err-ink: #FCA5A5;
  color-scheme: dark;
}

/* Acento por juego según categoría (mismo en claro y oscuro):
   lógica = cian, palabras = verde, agilidad = púrpura. */
body[data-accent="sudoku"], body[data-accent="minas"]                          { --accent: #0EA5E9; }
body[data-accent="cruci"], body[data-accent="sopa"], body[data-accent="ahorcado"] { --accent: #10B981; }
body[data-accent="memoria"], body[data-accent="desliza"], body[data-accent="tres"] { --accent: #8B5CF6; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  min-height: 100vh; display: flex; flex-direction: column;
  color: var(--ink); font-family: 'Plus Jakarta Sans', Helvetica, sans-serif;
  font-size: 16px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
button { font-family: inherit; }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; display: block; }
.mono { font-family: 'Plus Jakarta Sans', sans-serif; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1320px; margin: 0 auto; width: 100%; padding: 0 clamp(12px, 3vw, 24px); }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { padding-top: 12px; padding-bottom: 12px; display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 0 0 auto; }
.brand-mark { position: relative; width: 34px; height: 34px; border-radius: 11px; background: #0F172A; flex: 0 0 auto; overflow: hidden; }
.brand-mark span { position: absolute; inset: 0; }
.brand-mark .tri { background: #F59E0B; clip-path: polygon(23% 14%, 77% 14%, 50% 88%); }
.brand-mark .tri2 { background: #F8F9FA; clip-path: polygon(42% 62%, 58% 62%, 50% 88%); }
.brand-name { display: flex; align-items: baseline; gap: 5px; }
.brand-name b { font-size: 21px; font-weight: 700; letter-spacing: -0.03em; }
.brand-dot { width: 5px; height: 5px; border-radius: 999px; background: var(--hi); }

.main-nav { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; flex: 1 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--accent) var(--line); padding: 2px 0 4px; -webkit-overflow-scrolling: touch; }
.main-nav::-webkit-scrollbar { height: 6px; }
.main-nav::-webkit-scrollbar-track { background: var(--line); border-radius: 999px; }
.main-nav::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; }
.nav-btn { padding: 8px 14px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; white-space: nowrap; }
.nav-btn:hover, .nav-btn:focus-visible { background: var(--hi); border-color: var(--hi); color: var(--on-hi); }
.nav-btn.active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }

.header-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; }
.tool-btn { padding: 8px 10px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 12px; }
.tool-btn:hover { border-color: var(--accent); color: var(--accent); }
.tool-btn.on { background: var(--surface2); }

/* layout */
.page-main { flex: 1 1 auto; width: 100%; padding: clamp(8px, 2vw, 16px) 0; }
.layout { display: flex; gap: clamp(16px, 3vw, 24px); align-items: flex-start; flex-wrap: wrap; }
.content { flex: 1 1 660px; min-width: 0; width: 100%; }
.sidebar { flex: 1 1 300px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; align-self: stretch; }

/* ad placeholders / slots */
.ad-slot { border-radius: 12px; overflow: hidden; }
.ad-slot ins { display: block; }
.ad-slot.ad-728 { min-height: 90px; }
.ad-slot.ad-300x250 { min-height: 250px; }
.ad-slot.ad-300x600 { min-height: 600px; }
.ad-placeholder { height: 100%; min-height: inherit; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; background: var(--surface2); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; color: var(--ink3); letter-spacing: 0.08em; text-align: center; padding: 8px; }

/* cards / panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(16px, 3vw, 24px); }
.panel-game { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(12px, 3vw, 20px); }

.eyebrow { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; letter-spacing: 0.12em; color: var(--primary); }

/* buttons */
.btn { padding: 8px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(0.92); color: var(--on-accent); }
.btn-hi { border-color: #F59E0B; background: #F59E0B; color: #0F172A; font-weight: 600; }
.btn-hi:hover { filter: brightness(1.08); color: #0F172A; }
.btn-ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); background: var(--surface2); color: var(--accent); }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 12px; }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.chip:hover { border-color: var(--hi); }

/* hero (home) */
.hero { border-radius: 22px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: clamp(22px, 5vw, 44px); overflow: hidden; box-shadow: 0 18px 44px -30px rgba(15, 23, 42, 0.25); }
.hero-grid { container-type: inline-size; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 268px), 1fr)); gap: clamp(20px, 4vw, 44px); align-items: center; }
.hero-kicker { font-family: 'Plus Jakarta Sans', sans-serif; font-size: clamp(10px, 2.4cqw, 12px); letter-spacing: 0.14em; color: var(--primary); margin-bottom: 16px; }
.hero h1 { font-size: clamp(27px, 7.2cqw, 46px); line-height: 1.04; letter-spacing: -0.03em; text-wrap: balance; margin-bottom: 16px; }
.hero h1 .grad { background: linear-gradient(135deg, #0EA5E9, #3B82F6); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #0EA5E9; }
.hero p { font-size: clamp(14px, 2.9cqw, 17px); line-height: 1.55; color: var(--ink2); text-wrap: pretty; margin-bottom: 26px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-band { min-width: 0; container-type: inline-size; display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-top: 12px; }
.stat-band > div { background: var(--surface2); padding: 16px 14px; }
.stat-band .n { font-family: 'Plus Jakarta Sans', sans-serif; font-variant-numeric: tabular-nums; font-size: clamp(17px, 6.6cqw, 26px); font-weight: 700; color: var(--primary); letter-spacing: -0.02em; }
.stat-band .label { font-size: 11px; letter-spacing: 0.05em; color: var(--ink3); margin-top: 6px; text-wrap: pretty; }

/* home: game grid */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(226px, 100%), 1fr)); gap: 14px; }
.game-card { text-align: left; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0; overflow: hidden; display: flex; flex-direction: column; font-family: inherit; color: var(--ink); }
.game-card:hover { border-color: var(--hi); transform: translateY(-3px); box-shadow: 0 14px 28px -16px var(--hi); text-decoration: none; }
.game-card .band { height: 108px; background-size: cover; background-position: center; }
.game-card .body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.game-card .title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.game-card .desc { font-size: 13px; line-height: 1.5; color: var(--ink2); flex: 1; text-wrap: pretty; }
.game-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; letter-spacing: 0.07em; }
.game-card .foot .play { color: var(--accent); }
.game-card .foot .best { color: var(--ink3); }
.game-card .foot .best.has-record { color: var(--ok-ink); }

/* records panel */
.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(228px, 100%), 1fr)); gap: 10px; }
.records-grid.all { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); }
.record-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; }
.record-row .dot { width: 8px; height: 8px; border-radius: 999px; flex: 0 0 auto; }
.record-row .txt { min-width: 0; flex: 1; }
.record-row .txt .label { font-size: 13px; color: var(--ink); }
.record-row .txt .sub { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; color: var(--ink3); margin-top: 3px; }
.record-row b { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; color: var(--primary); }
.record-row.no-record b { color: var(--ink3); font-weight: 500; }

/* control bar (game pages) */
.control-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; margin-bottom: 10px; font-family: 'Plus Jakarta Sans', sans-serif; font-variant-numeric: tabular-nums; }
.control-bar .timer { display: flex; gap: 10px; align-items: center; }
.control-bar .timer-txt { display: flex; gap: 8px; align-items: baseline; }
.control-bar .timer-txt span { color: var(--ink3); letter-spacing: 0.1em; font-size: 11px; }
.control-bar .timer-txt b { font-size: 14px; }
.control-bar .hint-note { font-size: 11px; letter-spacing: 0.06em; color: var(--ink3); }
.control-bar .sep { width: 1px; height: 22px; background: var(--line); }
.control-bar .record { display: flex; gap: 8px; align-items: baseline; }
.control-bar .record span { color: var(--ink3); letter-spacing: 0.1em; font-size: 11px; }
.control-bar .record b { font-size: 14px; color: var(--primary); }
.control-bar .win-note { font-size: 12px; letter-spacing: 0.08em; color: var(--accent); }
.control-bar .right-group { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; }

.game-title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.game-title-row .icon { width: 44px; height: 44px; border-radius: 12px; background-size: cover; background-position: center; flex: 0 0 auto; }
.game-title-row h1 { font-size: clamp(21px, 5.4vw, 30px); letter-spacing: -0.02em; }
.game-title-row .hint-btn { margin-left: auto; }
.game-help { font-size: 14px; color: var(--ink2); margin-bottom: 12px; }
.status-line { margin-top: 14px; font-size: 13px; color: var(--ink2); min-height: 18px; }
.status-line.win { color: var(--ok-ink); font-weight: 600; }
.status-line.bad { color: var(--err-ink); }

/* internal links / related games */
.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* chips de dificultad renderizados como enlaces (navegan a la página del nivel) */
a.chip, a.chip:hover { text-decoration: none; }

/* FAQ (content depth + FAQPage schema) */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq-item { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.faq-item > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; font-size: 15px; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: "+"; font-size: 20px; line-height: 1; color: var(--ink3); font-weight: 400; flex: 0 0 auto; }
.faq-item[open] > summary::after { content: "–"; }
.faq-a { padding: 0 16px 14px; }
.faq-a p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--ink2); }

/* footer */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { padding: clamp(16px, 3vw, 24px) clamp(12px, 3vw, 24px); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand .brand-mark { width: 24px; height: 24px; border-radius: 8px; }
.footer-tech { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; letter-spacing: 0.06em; }
.footer-links { display: flex; gap: 14px; flex-wrap: wrap; }

/* consent banner */
.consent-banner { position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: var(--surface); border-top: 1px solid var(--line); padding: 14px clamp(12px, 3vw, 24px); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; box-shadow: 0 -12px 30px -20px rgba(0,0,0,0.4); }
.consent-banner p { font-size: 13px; color: var(--ink2); flex: 1 1 260px; margin: 0; }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* simple content pages (privacidad/terminos/404) */
.doc { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.doc h1 { font-size: clamp(24px, 5vw, 34px); letter-spacing: -0.02em; }
.doc h2 { font-size: 19px; margin-top: 12px; }
.doc p, .doc li { font-size: 15px; line-height: 1.65; color: var(--ink2); }
.doc ul { padding-left: 20px; }

/* contact form */
.contact-form { display: flex; flex-direction: column; gap: 20px; margin-top: 24px; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 4vw, 32px); box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.55); }
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.form-field input, .form-field textarea { font-family: inherit; font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--ink3); opacity: 1; }
.form-field input:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.form-field textarea { min-height: 150px; resize: vertical; }
.form-hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.form-actions .btn { padding: 12px 26px; min-height: 48px; font-size: 15px; }
.form-status { font-size: 14px; line-height: 1.45; min-height: 20px; flex: 1 1 180px; }
.form-status.ok { color: var(--ok-ink); font-weight: 500; }
.form-status.err { color: var(--err-ink); }
.form-note { font-size: 13px; color: var(--ink3); margin: 0; }

@media (max-width: 720px) {
  .sidebar { display: none; }
  /* Header: marca + herramientas arriba, nav como tira deslizable debajo */
  .site-header .wrap { flex-wrap: wrap; gap: 10px; }
  .brand { order: 1; }
  .header-tools { order: 2; margin-left: auto; }
  .main-nav { order: 3; flex-basis: 100%; width: 100%; }
}
