/* =============================================================
   Navaja Suiza — hoja de estilos única
   Concepto: banco de trabajo. Fondo acero claro, una sola hoja de
   color (rojo cachas) y números en tipografía de regla/calibre.
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #eef2f3;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --line: #d3dce0;
  --ink: #15222a;
  --muted: #56676f;
  --accent: #c2352b;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e7;
  --ok: #1f7a4d;
  --warn: #9a6200;

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 32px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e161b;
    --surface: #152129;
    --surface-2: #1a2830;
    --line: #2a3a43;
    --ink: #e7eef1;
    --muted: #97a8b0;
    --accent: #ff6a5c;
    --accent-ink: #1a0c0a;
    --accent-soft: #3a1f1d;
    --ok: #5fd39a;
    --warn: #f2b53a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e161b;
  --surface: #152129;
  --surface-2: #1a2830;
  --line: #2a3a43;
  --ink: #e7eef1;
  --muted: #97a8b0;
  --accent: #ff6a5c;
  --accent-ink: #1a0c0a;
  --accent-soft: #3a1f1d;
  --ok: #5fd39a;
  --warn: #f2b53a;
  color-scheme: dark;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.1; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* =============================================================
   3. Utilities
   ============================================================= */
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 99;
  padding: .6rem 1rem; background: var(--ink); color: var(--bg);
  border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 1rem; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: var(--gutter); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* =============================================================
   4. Header & footer
   ============================================================= */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 40px; height: 40px; flex: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: .01em; text-transform: uppercase; line-height: 1; }
.brand-name span { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 6px; list-style: none; padding: 0; }
.nav a { display: block; padding: 6px 10px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .95rem; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.site-footer { margin-top: 64px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .92rem; }
.site-footer .wrap { display: grid; gap: 16px; padding-block: 28px 36px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }

/* =============================================================
   5. Page heading & tool shell
   ============================================================= */
main { display: block; }
.page-head { padding-block: 28px 8px; display: grid; gap: 8px; }
.crumbs { font-size: .88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.page-head h1 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: .005em; line-height: .98;
}
.lede { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }

.tool-card {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(16px, 3vw, 28px);
  box-shadow: 0 1px 0 var(--line), 0 18px 40px -28px rgba(10, 30, 40, .35);
}
.tool-grid { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .tool-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; } }

.badge-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.badge-row span { display: inline-flex; align-items: center; gap: 6px; }
.badge-row svg { width: 16px; height: 16px; }

/* Forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-weight: 700; font-size: .95rem; }
.field .hint { color: var(--muted); font-size: .85rem; }
.row-2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
input[type="number"], input[type="date"], input[type="text"], select, textarea {
  width: 100%; min-width: 0; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: var(--mono); }
.money input { padding-left: 26px; font-family: var(--mono); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .92rem; background: var(--surface-2); }
.choice input { accent-color: var(--accent); }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; text-decoration: none;
  transition: transform .15s var(--ease-out), filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }

/* Results */
.result { display: grid; gap: 14px; min-width: 0; }
.total {
  display: grid; gap: 2px; padding: 18px; border-radius: 12px;
  background: var(--ink); color: var(--bg);
}
.total .lbl { font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.total .val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 600; line-height: 1.1; overflow-wrap: anywhere; }
.total .sub { font-size: .9rem; opacity: .85; }
.breakdown { width: 100%; border-collapse: collapse; font-size: .95rem; }
.breakdown th, .breakdown td { padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.breakdown td:last-child, .breakdown th:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.breakdown .why { display: block; color: var(--muted); font-size: .82rem; }
.breakdown tr.zero { color: var(--muted); }
.note { font-size: .88rem; color: var(--muted); padding: 10px 12px; border-left: 3px solid var(--warn); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.error-msg { color: var(--accent); font-weight: 700; }

/* =============================================================
   6. Content sections (below the tool)
   ============================================================= */
.ad-slot {
  margin-block: 28px; min-height: 100px; border: 1px dashed var(--line); border-radius: 10px;
  display: grid; place-items: center; color: var(--muted); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase;
}
.ad-slot:empty::before { content: "Publicidad"; }
.ad-slot.has-ad { border: 0; min-height: 0; }
.content { display: grid; gap: 22px; max-width: 72ch; }
.content h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.7rem; letter-spacing: .01em; }
.content h3 { font-size: 1.1rem; }
.content p, .content li { color: var(--ink); }
.content ul, .content ol { padding-left: 1.2rem; display: grid; gap: 6px; }
.steps { list-style: none; padding: 0 !important; counter-reset: paso; display: grid; gap: 12px !important; }
.steps li { counter-increment: paso; display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.steps li::before { content: counter(paso); font-family: var(--mono); font-weight: 600; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.faq { display: grid; gap: 8px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin-top: 8px; color: var(--muted); }
.formula { font-family: var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: .9rem; white-space: pre; }

/* Cards (home, sections, "más herramientas") */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.card {
  display: grid; gap: 8px; align-content: start; padding: 18px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s, transform .2s var(--ease-out);
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .kind { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.card h3 { font-size: 1.15rem; }
.card p { color: var(--muted); font-size: .93rem; }
.section-block { display: grid; gap: 14px; margin-top: 36px; }
.section-block > header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.section-block h2 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.8rem; }
.section-block h2 a { text-decoration: none; }
.section-block .bajada { color: var(--muted); }

.home-hero { padding-block: 36px 8px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: center; }
@media (min-width: 720px) { .home-hero { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.home-hero h1 { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(3rem, 10vw, 6rem); line-height: .9; }
.home-hero h1 span { color: var(--accent); }
.home-hero .lede { font-size: 1.15rem; }
.home-hero .knife { max-width: 340px; justify-self: center; width: 100%; }

.legal { max-width: 72ch; display: grid; gap: 14px; }
.legal h2 { font-size: 1.25rem; margin-top: 10px; }
.legal ul { padding-left: 1.2rem; display: grid; gap: 6px; }
.copy-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.copy-box code { font-family: var(--mono); font-size: 1.05rem; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; user-select: all; overflow-wrap: anywhere; }

/* =============================================================
   7. Ruleta
   ============================================================= */
.wheel-box { position: relative; width: min(100%, 420px); margin-inline: auto; aspect-ratio: 1; max-width: 100%; }
.wheel-box canvas { width: 100%; height: 100%; }
.wheel-pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid var(--ink); filter: drop-shadow(0 2px 0 var(--surface)); }
.wheel-result { text-align: center; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: clamp(1.6rem, 5vw, 2.4rem); min-height: 1.3em; line-height: 1.2; overflow-wrap: anywhere; }

/* =============================================================
   8. Caballeros al Vuelo (se mantiene su propio mundo pixel)
   ============================================================= */
.cav { --cv-bg:#1c2031; --cv-panel:#272c42; --cv-panel-2:#323853; --cv-ink:#f4ecd9; --cv-muted:#a7abc0; --cv-gold:#f2b53a; --cv-gold-d:#a8741b; --cv-line:#41486a;
  background: var(--cv-bg); color: var(--cv-ink); border-radius: var(--radius); padding: clamp(10px, 2vw, 18px); display: grid; gap: 14px; font-family: "Pixelify Sans", var(--sans); font-size: 17px; }
.cav .frame { position: relative; border: 4px solid #0e101a; box-shadow: 0 0 0 4px var(--cv-line); background: #5aa9f0; }
.cav #game { display: block; width: 100%; aspect-ratio: 16/9; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; cursor: crosshair; }
.cav .banner { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); font-family: "Press Start 2P", var(--mono); font-size: clamp(9px, 1.6vw, 14px); background: #0e101acc; color: var(--cv-ink); padding: 10px 14px; border: 3px solid var(--cv-gold); opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.cav .banner.show { opacity: 1; }
.cav .overlay { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; background: #0e101ab8; padding: 16px; }
.cav .overlay h2 { font-family: "Press Start 2P", var(--mono); font-size: clamp(13px, 2.6vw, 22px); color: var(--cv-gold); text-shadow: 3px 3px 0 #000; }
.cav .overlay p { max-width: 40ch; }
.cav .pbtn { font-family: "Press Start 2P", var(--mono); font-size: 11px; background: var(--cv-gold); color: #241a08; border: 0; padding: 12px 16px; cursor: pointer; box-shadow: inset -3px -3px 0 var(--cv-gold-d), 3px 3px 0 #000; }
.cav .pbtn:active { transform: translate(2px, 2px); }
.cav .pbtn.ghost { background: var(--cv-panel-2); color: var(--cv-ink); box-shadow: inset -3px -3px 0 #1b1f30, 3px 3px 0 #000; font-size: 9px; padding: 10px 12px; }
.cav .hud { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: stretch; }
.cav .roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cav .knight { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; text-align: left; background: var(--cv-panel); border: 3px solid var(--cv-line); padding: 8px 10px; min-width: 0; cursor: pointer; color: var(--cv-ink); font-family: inherit; }
.cav .knight img { grid-row: span 3; width: 52px; height: 52px; image-rendering: pixelated; }
.cav .knight .nm { font-family: "Press Start 2P", var(--mono); font-size: 10px; line-height: 1.3; }
.cav .knight .wp { font-size: 14px; color: var(--cv-muted); }
.cav .knight .row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.cav .bars { display: flex; gap: 2px; } .cav .bars i { width: 7px; height: 9px; background: #454c6e; } .cav .bars i.on { background: #e8543f; }
.cav .count { font-family: "Press Start 2P", var(--mono); font-size: 11px; }
.cav .knight[aria-pressed="true"] { border-color: var(--cv-gold); background: var(--cv-panel-2); }
.cav .knight:disabled { opacity: .4; cursor: not-allowed; }
.cav .side { display: grid; gap: 10px; align-content: start; }
.cav .stats { display: grid; grid-template-columns: repeat(3, auto); gap: 4px 16px; background: var(--cv-panel); border: 3px solid var(--cv-line); padding: 8px 12px; }
.cav .stats div { display: grid; }
.cav .stats .lbl { font-size: 13px; color: var(--cv-muted); letter-spacing: .06em; text-transform: uppercase; }
.cav .stats b { font-family: "Press Start 2P", var(--mono); font-size: 12px; font-weight: 400; }
.cav .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cav button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 719px) {
  .cav .hud { grid-template-columns: minmax(0, 1fr); }
  .cav .knight { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .cav .knight img { grid-row: auto; width: 40px; height: 40px; }
  .cav .knight .row { flex-direction: column; }
}
.noscript-msg { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }

/* =============================================================
   9. Reduced motion (solo lo intrusivo)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
