  :root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --ink: #101828;
    --ink-soft: #4a5568;
    --line: #dde3ec;
    --accent: #2d3fe0;
    --accent-ink: #ffffff;
    --accent-soft: #e8ebff;
    --danger: #b42318;
    --check-a: #ffffff;
    --check-b: #e3e8f0;
    --radius: 14px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0e1320;
      --surface: #161d2e;
      --ink: #eef1f8;
      --ink-soft: #aab4c8;
      --line: #28324a;
      --accent: #7b88ff;
      --accent-ink: #0e1320;
      --accent-soft: #1d2540;
      --danger: #ff8a7a;
      --check-a: #1b2338;
      --check-b: #232c45;
    }
  }
  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: var(--font); font-size: 17px; line-height: 1.55;
  }
  a { color: var(--accent); }
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

  .wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

  /* Cabecera */
  header.top { padding: 18px 0; }
  .brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 21px; letter-spacing: -0.02em; }
  .brand-mark {
    width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
    background-image:
      linear-gradient(45deg, rgba(255,255,255,.95) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.95) 75%),
      linear-gradient(45deg, rgba(255,255,255,.95) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.95) 75%);
    background-size: 15px 15px; background-position: 0 0, 7.5px 7.5px;
  }

  /* Hero + herramienta */
  .hero { padding: 18px 0 40px; }
  h1 { font-size: clamp(30px, 6vw, 52px); line-height: 1.06; letter-spacing: -0.035em; margin: 0 0 14px; font-weight: 800; max-width: 17ch; }
  .lead { font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-soft); max-width: 56ch; margin: 0 0 26px; }

  .tool {
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
  }
  .drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 12px; min-height: 300px; padding: 28px 18px; cursor: pointer;
    border: 2px dashed var(--accent); border-radius: 14px;
    background-color: var(--check-a);
    background-image:
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%),
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%);
    background-size: 24px 24px; background-position: 0 0, 12px 12px;
    transition: border-color .15s, box-shadow .15s;
  }
  .drop.over { box-shadow: 0 0 0 5px var(--accent-soft); border-style: solid; }
  .drop-card { background: var(--surface); border-radius: 12px; padding: 18px 22px; max-width: 420px; }
  .drop-card strong { display: block; font-size: 20px; margin-bottom: 4px; }
  .drop-card span { color: var(--ink-soft); font-size: 15px; }
  .btn {
    appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
    background: var(--accent); color: var(--accent-ink); padding: 14px 24px; border-radius: 12px; font-size: 17px;
  }
  .btn:hover { filter: brightness(1.08); }
  .btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
  .btn.ghost:hover { border-color: var(--accent); filter: none; }
  .btn[disabled] { opacity: .55; cursor: not-allowed; }
  input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  .hint { margin: 12px 4px 2px; font-size: 14px; color: var(--ink-soft); text-align: center; }

  /* Estado de proceso */
  .status { display: none; min-height: 300px; align-items: center; justify-content: center; flex-direction: column; gap: 14px; text-align: center; padding: 24px; }
  .status.on { display: flex; }
  .spinner { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .bar { width: min(320px, 80%); height: 8px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
  .bar > i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .2s; }

  /* Resultado */
  .result { display: none; }
  .result.on { display: block; }
  .stage {
    border-radius: 12px; overflow: hidden; display: flex; justify-content: center; align-items: center;
    background-color: var(--check-a);
    background-image:
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%),
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%);
    background-size: 24px 24px; background-position: 0 0, 12px 12px;
    min-height: 240px; padding: 10px;
  }
  .stage canvas { max-width: 100%; max-height: 62vh; height: auto; width: auto; display: block; }
  .controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: space-between; margin-top: 14px; }
  .swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .swatches > span { font-size: 15px; color: var(--ink-soft); margin-right: 2px; }
  .sw {
    width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0;
    background-color: var(--check-a);
    background-image:
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%),
      linear-gradient(45deg, var(--check-b) 25%, transparent 25%, transparent 75%, var(--check-b) 75%);
    background-size: 12px 12px; background-position: 0 0, 6px 6px;
  }
  .sw.solid { background-image: none; }
  .sw[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .sw-custom { width: 34px; height: 34px; border: 2px solid var(--line); border-radius: 50%; padding: 0; background: none; cursor: pointer; overflow: hidden; }
  .actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .method-row { margin-top: 12px; font-size: 14px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
  .link { appearance: none; background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--accent); text-decoration: underline; cursor: pointer; }
  .error { display: none; margin: 12px 4px 0; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 15px; }
  .error.on { display: block; }

  /* Contenido */
  section.block { padding: 44px 0; border-top: 1px solid var(--line); }
  h2 { font-size: clamp(24px, 4vw, 34px); line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 16px; max-width: 24ch; }
  h3 { font-size: 19px; margin: 0 0 6px; letter-spacing: -0.01em; }
  p { margin: 0 0 14px; max-width: 68ch; }
  .muted { color: var(--ink-soft); }
  .steps { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 18px; padding: 0; list-style: none; counter-reset: paso; }
  .steps li { counter-increment: paso; padding-left: 52px; position: relative; }
  .steps li::before {
    content: counter(paso); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 10px;
    background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center;
  }
  .uses { display: grid; gap: 22px 32px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
  .uses div { border-left: 3px solid var(--accent); padding-left: 14px; }
  details { border-bottom: 1px solid var(--line); padding: 14px 0; max-width: 760px; }
  summary { cursor: pointer; font-weight: 700; font-size: 18px; }
  details p { margin: 10px 0 0; }
  footer { border-top: 1px solid var(--line); padding: 28px 0 44px; font-size: 15px; color: var(--ink-soft); }
  footer .row { display: flex; flex-wrap: wrap; gap: 10px 26px; justify-content: space-between; }
  footer a { color: var(--ink-soft); }
  .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  @media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 3s; }
    .bar > i, .drop { transition: none; }
  }

  /* Paginas por uso */
  .uses h3 a { color: inherit; text-decoration: none; }
  .uses h3 a:hover { text-decoration: underline; color: var(--accent); }
  .crumbs { font-size: 14px; color: var(--ink-soft); margin: 0 0 8px; }
  .crumbs a { color: var(--ink-soft); }
  ul.tips { padding-left: 20px; max-width: 68ch; margin: 0 0 14px; }
  ul.tips li { margin-bottom: 9px; }
  .related { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
  .related a { border: 1.5px solid var(--line); border-radius: 99px; padding: 8px 16px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
  .related a:hover { border-color: var(--accent); color: var(--accent); }
  footer .usos { margin-top: 14px; }
