:root {
      --bg: #101326;
      --surface: rgba(255, 255, 255, .075);
      --text: #f8fafc;
      --muted: #cbd5e1;
      --red: #ef4444;
      --blue: #3b82f6;
      --green: #22c55e;
      --yellow: #facc15;
      --purple: #a855f7;
      --accent: #38bdf8;
      --shadow: 0 28px 80px rgba(0, 0, 0, .38);
    }

    * { box-sizing: border-box; }

    html, body {
      width: 100%;
      min-height: 100%;
      margin: 0;
      overflow: hidden;
      background: var(--bg);
      color: var(--text);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    button { font: inherit; }

    body::before {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      background:
        radial-gradient(circle at 15% 20%, rgba(56, 189, 248, .14), transparent 30%),
        radial-gradient(circle at 86% 76%, rgba(168, 85, 247, .14), transparent 28%),
        linear-gradient(135deg, #0b1020, #17172c 58%, #101326);
    }

    .app {
      position: relative;
      width: 100vw;
      height: 100vh;
      isolation: isolate;
    }

    .hidden { display: none !important; }

    /* PRESENTACIÓN */
    #presentation {
      position: absolute;
      inset: 0;
    }

    .brand {
      position: fixed;
      top: 28px;
      left: 36px;
      z-index: 20;
      display: flex;
      align-items: center;
      gap: 12px;
      color: #e2e8f0;
      font-size: clamp(.85rem, 1.2vw, 1.1rem);
      font-weight: 800;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .brand-mark {
      width: 14px;
      height: 32px;
      border-radius: 99px;
      background: linear-gradient(var(--accent), var(--purple));
      box-shadow: 0 0 25px rgba(56, 189, 248, .48);
    }

    .slides { position: absolute; inset: 0; }

    .slide {
      --slide-color: var(--accent);
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: clamp(80px, 10vh, 130px) clamp(38px, 9vw, 150px);
      opacity: 0;
      visibility: hidden;
      transform: scale(1.025);
      transition: opacity .9s ease, transform 1.1s ease, visibility .9s;
    }

    .slide.active {
      opacity: 1;
      visibility: visible;
      transform: scale(1);
    }

    .slide::before {
      content: "";
      position: absolute;
      width: min(74vw, 980px);
      aspect-ratio: 1;
      border-radius: 50%;
      background: radial-gradient(circle, color-mix(in srgb, var(--slide-color) 24%, transparent), transparent 65%);
      filter: blur(10px);
      opacity: .72;
    }

    .slide-content {
      position: relative;
      width: min(1120px, 100%);
      text-align: center;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 24px;
      color: var(--slide-color);
      font-size: clamp(.85rem, 1.4vw, 1.15rem);
      font-weight: 900;
      letter-spacing: .16em;
      text-transform: uppercase;
    }

    .eyebrow::before, .eyebrow::after {
      content: "";
      width: 38px;
      height: 2px;
      background: currentColor;
    }

    h1, h2, p { margin-top: 0; }

    .hero-title {
      margin-bottom: 20px;
      font-size: clamp(3rem, 7.3vw, 7.4rem);
      line-height: .94;
      letter-spacing: -.055em;
      text-wrap: balance;
    }

    .slide-title {
      margin-bottom: 26px;
      font-size: clamp(2.35rem, 5.6vw, 5.7rem);
      line-height: .98;
      letter-spacing: -.045em;
      text-wrap: balance;
    }

    .slide-title span { color: var(--slide-color); }

    .slide-copy {
      max-width: 900px;
      margin: 0 auto 36px;
      color: var(--muted);
      font-size: clamp(1.15rem, 2.15vw, 2rem);
      line-height: 1.42;
      text-wrap: balance;
    }

    .primary-button, .spin-button, .home-button {
      border: 0;
      border-radius: 999px;
      padding: 20px 34px;
      background: linear-gradient(135deg, #38bdf8, #6366f1);
      color: white;
      box-shadow: 0 16px 44px rgba(56, 189, 248, .28), inset 0 1px 0 rgba(255,255,255,.28);
      cursor: pointer;
      font-size: clamp(1.1rem, 1.8vw, 1.55rem);
      font-weight: 900;
      transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    }

    .primary-button:hover, .spin-button:hover, .home-button:hover {
      transform: translateY(-3px) scale(1.02);
      box-shadow: 0 20px 52px rgba(56, 189, 248, .38);
      filter: brightness(1.08);
    }

    .primary-button:active, .spin-button:active, .home-button:active { transform: scale(.97); }

    .floating-game-button {
      position: fixed;
      right: 34px;
      bottom: 30px;
      z-index: 30;
      display: flex;
      align-items: center;
      gap: 10px;
      border: 1px solid rgba(255,255,255,.18);
      border-radius: 999px;
      padding: 14px 20px;
      background: rgba(15, 23, 42, .8);
      backdrop-filter: blur(16px);
      color: white;
      box-shadow: 0 15px 40px rgba(0,0,0,.26);
      cursor: pointer;
      font-weight: 800;
    }

    .floating-game-button .dot {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      background: var(--yellow);
      box-shadow: 0 0 15px var(--yellow);
      animation: pulse 1.7s infinite;
    }

    .progress-dots {
      position: fixed;
      left: 50%;
      bottom: 35px;
      z-index: 20;
      display: flex;
      gap: 10px;
      transform: translateX(-50%);
    }

    .progress-dot {
      width: 9px;
      height: 9px;
      border-radius: 99px;
      background: rgba(255,255,255,.24);
      transition: width .4s ease, background .4s ease;
    }

    .progress-dot.active { width: 34px; background: white; }

    /* RULETA */
    #game {
      position: absolute;
      inset: 0;
      display: grid;
      grid-template-columns: minmax(420px, 1.08fr) minmax(360px, .92fr);
      align-items: center;
      gap: clamp(30px, 5vw, 90px);
      padding: clamp(30px, 5vw, 80px);
      animation: fadeIn .65s ease both;
    }

    .game-copy { max-width: 650px; }

    .game-copy h2 {
      margin-bottom: 18px;
      font-size: clamp(2.8rem, 5.4vw, 5.8rem);
      line-height: .95;
      letter-spacing: -.05em;
    }

    .game-copy p {
      color: var(--muted);
      font-size: clamp(1.15rem, 2vw, 1.65rem);
      line-height: 1.45;
    }

    .wheel-column { display: grid; justify-items: center; gap: 28px; }

    .wheel-wrap {
      position: relative;
      width: min(61vh, 560px);
      aspect-ratio: 1;
      filter: drop-shadow(0 28px 44px rgba(0,0,0,.42));
    }

    .pointer {
      position: absolute;
      top: -17px;
      left: 50%;
      z-index: 5;
      width: 0;
      height: 0;
      border-left: 22px solid transparent;
      border-right: 22px solid transparent;
      border-top: 48px solid white;
      transform: translateX(-50%);
      filter: drop-shadow(0 6px 4px rgba(0,0,0,.35));
    }

    .wheel {
      position: absolute;
      inset: 0;
      border: 10px solid rgba(255,255,255,.92);
      border-radius: 50%;
      background: conic-gradient(
        var(--red) 0 72deg,
        var(--blue) 72deg 144deg,
        var(--green) 144deg 216deg,
        var(--yellow) 216deg 288deg,
        var(--purple) 288deg 360deg
      );
      box-shadow: inset 0 0 0 5px rgba(16, 19, 38, .35), 0 0 0 3px rgba(255,255,255,.12);
      transition: transform 4s cubic-bezier(.12, .72, .08, 1);
      will-change: transform;
    }

    .wheel::after {
      content: "";
      position: absolute;
      inset: 43%;
      border: 7px solid rgba(255,255,255,.9);
      border-radius: 50%;
      background: #111426;
      box-shadow: 0 8px 24px rgba(0,0,0,.4);
    }

    .wheel-label {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 42%;
      color: white;
      font-size: clamp(.8rem, 1.55vw, 1.25rem);
      font-weight: 950;
      text-align: right;
      text-shadow: 0 2px 8px rgba(0,0,0,.55);
      transform-origin: left center;
    }

    .spin-button[disabled] { opacity: .62; cursor: wait; transform: none; }
    .sound-toggle {
      position: fixed; top: 28px; right: 32px; z-index: 160;
      display: grid; place-items: center; width: 48px; height: 48px;
      border: 1px solid #c9dadd; border-radius: 50%; padding: 0;
      background: white; color: #254653; cursor: pointer; font-size: 1.25rem;
      box-shadow: 0 8px 20px rgba(22, 58, 70, .14);
    }

    .exit-game {
      position: fixed;
      top: 28px;
      right: 92px;
      z-index: 20;
      border: 1px solid rgba(255,255,255,.18);
      border-radius: 999px;
      padding: 12px 18px;
      background: rgba(255,255,255,.07);
      color: white;
      cursor: pointer;
      font-weight: 750;
    }

    /* MODALES */
    .modal {
      position: fixed;
      inset: 0;
      z-index: 100;
      display: grid;
      place-items: center;
      padding: 28px;
      background: rgba(5, 8, 20, .88);
      backdrop-filter: blur(18px);
      animation: fadeIn .45s ease both;
    }

    .modal-card {
      --category-color: var(--blue);
      position: relative;
      width: min(920px, 96vw);
      max-height: 92vh;
      overflow: auto;
      border: 1px solid color-mix(in srgb, var(--category-color) 48%, rgba(255,255,255,.14));
      border-radius: 34px;
      padding: clamp(28px, 5vw, 64px);
      background: linear-gradient(145deg, color-mix(in srgb, var(--category-color) 14%, #171a31), #101326 65%);
      box-shadow: var(--shadow), 0 0 80px color-mix(in srgb, var(--category-color) 17%, transparent);
      text-align: center;
    }

    .category-badge {
      display: inline-block;
      margin-bottom: 18px;
      border-radius: 99px;
      padding: 9px 16px;
      background: var(--category-color);
      color: white;
      font-weight: 900;
      letter-spacing: .08em;
      text-transform: uppercase;
    }

    .modal-card h2 {
      margin-bottom: 18px;
      font-size: clamp(2rem, 4.6vw, 4.5rem);
      line-height: 1.02;
      letter-spacing: -.04em;
      text-wrap: balance;
    }

    .answers {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-top: 32px;
    }

    .answer-button {
      min-height: 94px;
      border: 1px solid rgba(255,255,255,.14);
      border-radius: 18px;
      padding: 18px;
      background: rgba(255,255,255,.075);
      color: white;
      cursor: pointer;
      font-size: clamp(1rem, 1.5vw, 1.25rem);
      font-weight: 750;
      line-height: 1.3;
      transition: border-color .2s, transform .2s, background .2s;
    }

    .answer-button:hover {
      border-color: var(--category-color);
      background: color-mix(in srgb, var(--category-color) 18%, rgba(255,255,255,.07));
      transform: translateY(-3px);
    }

    .result-kicker {
      margin-bottom: 8px;
      color: var(--category-color);
      font-size: clamp(1rem, 2vw, 1.35rem);
      font-weight: 950;
      letter-spacing: .14em;
      text-transform: uppercase;
    }

    .result-message {
      margin-bottom: 24px;
      color: var(--muted);
      font-size: clamp(1rem, 1.6vw, 1.25rem);
    }

    .reward-layout {
      display: grid;
      grid-template-columns: minmax(230px, .75fr) minmax(280px, 1.25fr);
      align-items: center;
      gap: clamp(26px, 5vw, 58px);
      text-align: left;
    }

    .qr-box {
      display: grid;
      place-items: center;
      width: min(300px, 100%);
      aspect-ratio: 1;
      margin: auto;
      border: 13px solid white;
      border-radius: 20px;
      overflow: hidden;
      background: white;
      box-shadow: 0 18px 40px rgba(0,0,0,.35);
    }

    .qr-box img { width: 100%; height: 100%; object-fit: contain; }

    .qr-placeholder {
      display: grid;
      place-items: center;
      width: 100%;
      height: 100%;
      padding: 20px;
      background:
        linear-gradient(90deg, #111 10px, transparent 10px) 0 0 / 24px 24px,
        linear-gradient(#111 10px, transparent 10px) 0 0 / 24px 24px,
        linear-gradient(90deg, transparent 12px, #111 12px 20px, transparent 20px) 0 0 / 24px 24px,
        white;
      color: #111;
      font-size: 1rem;
      font-weight: 950;
      text-align: center;
      text-shadow: 0 0 8px white, 0 0 8px white, 0 0 8px white;
    }

    .reward-copy h2 { font-size: clamp(2.3rem, 4.8vw, 4.8rem); }
    .reward-copy .primary-button { margin-top: 10px; }
    .course-link {
      display: inline-flex; align-items: center; justify-content: center;
      margin: 10px 10px 0 0; padding: 14px 22px; border-radius: 999px;
      color: #075985; background: #e0f2fe; font-weight: 800; text-decoration: none;
      box-shadow: 0 10px 28px rgba(7, 89, 133, .14);
    }
    .action-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
    .secondary-button {
      border: 2px solid #007da5; border-radius: 999px; padding: 16px 24px;
      background: white; color: #006184; cursor: pointer; font-weight: 850;
      font-size: clamp(1rem, 1.45vw, 1.25rem);
    }
    .secondary-button:hover { background: #e9f6f8; transform: translateY(-2px); }

    /* ORIENTADOR DE CURSOS */
    #diagnostic {
      position: absolute; inset: 0; z-index: 60; display: grid; place-items: center;
      padding: clamp(70px, 8vh, 100px) clamp(24px, 6vw, 80px);
      background: linear-gradient(135deg, #f8fbfc, #e7f1f3);
    }
    .diagnostic-card {
      width: min(1080px, 100%); max-height: 88vh; overflow: auto;
      border: 1px solid #c9dadd; border-top: 6px solid #007da5;
      border-radius: 8px; padding: clamp(28px, 4.5vw, 58px);
      background: white; box-shadow: 0 28px 70px rgba(22, 58, 70, .18);
      color: #24343b; text-align: center;
    }
    .diagnostic-progress { color: #007da5; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
    .diagnostic-card h2 { margin: 14px auto 10px; max-width: 900px; font-size: clamp(2rem, 4.4vw, 4.2rem); line-height: 1.04; }
    .diagnostic-help { color: #52636b; font-size: clamp(1rem, 1.5vw, 1.25rem); }
    .diagnostic-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 28px; }
    .diagnostic-option {
      min-height: 82px; border: 1px solid #c9dadd; border-radius: 8px; padding: 16px 20px;
      background: #f8fbfc; color: #24343b; cursor: pointer; font-size: clamp(1rem, 1.45vw, 1.25rem);
      font-weight: 780; text-align: left; transition: .2s ease;
    }
    .diagnostic-option:hover { border-color: #007da5; background: #e9f6f8; transform: translateY(-2px); }
    .diagnostic-result { display: grid; grid-template-columns: minmax(220px,.7fr) minmax(320px,1.3fr); gap: 36px; align-items: center; text-align: left; }
    .recommendation-note { padding: 14px 18px; border-left: 4px solid var(--category-color); background: #f3f7f8; color: #42565f; }
    .alternative-course { margin: 18px 0; color: #42565f; font-weight: 700; }

    /* DASHBOARD ADMINISTRATIVO (5 clics en la marca o Ctrl + Shift + Y) */
    .analytics-overlay { position: fixed; inset: 0; z-index: 300; overflow: auto; padding: 28px; background: #eef4f5; color: #24343b; }
    .analytics-shell { width: min(1280px, 100%); margin: auto; }
    .analytics-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
    .analytics-header h2 { margin: 4px 0; font-size: clamp(2rem, 4vw, 3.8rem); }
    .analytics-actions { display: flex; flex-wrap: wrap; gap: 10px; }
    .analytics-actions button, .analytics-actions label { border: 1px solid #b9cdd2; border-radius: 6px; padding: 11px 15px; background: white; color: #254653; cursor: pointer; font-weight: 800; }
    .analytics-actions .danger { color: #a61b1b; border-color: #efb0b0; }
    .analytics-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
    .metric-card, .analytics-panel { border: 1px solid #cadadd; border-radius: 8px; background: white; box-shadow: 0 12px 30px rgba(25,65,78,.08); }
    .metric-card { padding: 20px; }
    .metric-card strong { display: block; font-size: clamp(2rem, 4vw, 3.4rem); color: #007da5; }
    .metric-card span { color: #52636b; font-weight: 700; }
    .analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
    .analytics-panel { padding: 22px; overflow: auto; }
    .analytics-panel.wide { grid-column: 1 / -1; }
    .analytics-panel h3 { margin: 0 0 18px; }
    .interpretation-lead { margin: 0 0 18px; font-size: 1.08rem; line-height: 1.55; color: #334e59; }
    .interpretation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .interpretation-item { padding: 16px; border: 1px solid #d7e4e7; border-radius: 8px; background: #f7fbfc; }
    .interpretation-item strong { display: block; margin-bottom: 7px; color: #006184; }
    .interpretation-item p { margin: 0; line-height: 1.45; }
    .interpretation-note { margin: 16px 0 0; padding: 12px 14px; border-left: 4px solid #f2c037; background: #fff9df; color: #5c511b; }
    .bar-row { display: grid; grid-template-columns: 150px 1fr 44px; gap: 12px; align-items: center; margin: 12px 0; }
    .bar-track { height: 16px; border-radius: 99px; overflow: hidden; background: #e5edef; }
    .bar-fill { height: 100%; min-width: 2px; border-radius: inherit; }
    .analytics-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
    .analytics-table th, .analytics-table td { padding: 10px; border-bottom: 1px solid #dce7e9; text-align: left; vertical-align: top; }
    .analytics-table th { color: #006184; }
    .analytics-empty { padding: 50px 20px; text-align: center; color: #64777f; }
    .admin-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
    .admin-tool-card { padding: 14px; border: 1px solid #d7e4e7; border-top: 4px solid var(--tool-color); border-radius: 8px; background: #f8fbfc; }
    .admin-tool-card img { display: block; width: 110px; max-width: 100%; margin: 10px auto; background: white; }
    .admin-tool-card strong { display: block; margin-bottom: 6px; }
    .admin-tool-card button, .admin-tool-card a { display: inline-block; margin: 3px; border: 1px solid #b9cdd2; border-radius: 5px; padding: 8px 10px; background: white; color: #006184; font-weight: 800; text-decoration: none; cursor: pointer; }
    @media (max-width: 900px) { .analytics-cards { grid-template-columns: 1fr 1fr; } .analytics-grid { grid-template-columns: 1fr; } .analytics-panel.wide { grid-column: auto; } .interpretation-grid { grid-template-columns: 1fr; } .admin-tools { grid-template-columns: 1fr 1fr; } }

    .idle-note {
      margin: 16px 0 0;
      color: #94a3b8;
      font-size: .92rem;
    }
    .game-guide { position: absolute; left: 50%; bottom: 22px; z-index: 12; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; padding: 10px 14px; border: 1px solid #c9dadd; border-radius: 8px; background: rgba(255,255,255,.94); color: #254653; box-shadow: 0 12px 28px rgba(22,58,70,.14); font-weight: 800; transition: opacity .35s ease, transform .35s ease; }
    .game-guide.hidden-guide { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
    .guide-step { white-space: nowrap; }
    .guide-arrow { color: #007da5; }
    .floating-game-button, .spin-button { animation: invitationPulse 8s ease-in-out infinite; }
    @keyframes invitationPulse { 0%,70%,100% { transform: translateY(0); } 76% { transform: translateY(-5px) scale(1.025); } 82% { transform: translateY(0); } 88% { transform: translateY(-3px) scale(1.012); } }
    .qr-timer { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 9px; color: #52636b; font-size: .82rem; }
    .qr-timer-track { height: 6px; overflow: hidden; border-radius: 99px; background: #dce7e9; }
    .qr-timer-fill { width: 100%; height: 100%; border-radius: inherit; background: var(--category-color, #007da5); transition: width 1s linear; }
    .qr-pause { width: 30px; height: 30px; padding: 0; border: 1px solid #b9cdd2; border-radius: 50%; background: white; color: #006184; cursor: pointer; font-size: .78rem; line-height: 1; }
    .test-mode-bar { position: fixed; top: 10px; left: 50%; z-index: 450; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 7px; background: #24343b; color: white; box-shadow: 0 10px 28px rgba(0,0,0,.22); font-weight: 850; }
    .test-mode-bar button { border: 1px solid rgba(255,255,255,.4); border-radius: 5px; padding: 6px 10px; background: white; color: #24343b; cursor: pointer; font-weight: 850; }
    .activity-menu-overlay { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; padding: 24px; background: rgba(22,43,51,.82); }
    .activity-menu-card { width: min(1040px, 96vw); max-height: calc(100vh - 32px); overflow: hidden; padding: clamp(24px,4vw,48px); border-top: 6px solid #007da5; border-radius: 10px; background: #f8fbfc; color: #24343b; box-shadow: 0 30px 80px rgba(0,0,0,.3); text-align: center; }
    .activity-menu-card h2 { margin: 4px 0 8px; font: 500 clamp(2.3rem,5vw,4.5rem)/1 Georgia,"Times New Roman",serif; }
    .activity-menu-card > p { margin: 0 auto 24px; color: #52636b; font-size: 1.08rem; }
    .activity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
    .activity-card { min-height: 230px; display: grid; align-content: center; gap: 10px; padding: 26px; border: 1px solid #c9dadd; border-top: 5px solid var(--activity-color); border-radius: 9px; background: white; color: #24343b; cursor: pointer; text-align: left; box-shadow: 0 15px 35px rgba(22,58,70,.09); transition: transform .2s ease, box-shadow .2s ease; }
    .activity-card:hover { transform: translateY(-4px); box-shadow: 0 20px 44px rgba(22,58,70,.15); }
    .activity-icon { font-size: 2.2rem; }
    .activity-card strong { font-size: clamp(1.5rem,2.4vw,2.25rem); color: #254653; }
    .activity-card span:last-child { color: #52636b; font-size: 1.02rem; line-height: 1.4; }
    .activity-close { margin-top: 18px; border: 1px solid #b9cdd2; border-radius: 5px; padding: 10px 16px; background: white; color: #254653; cursor: pointer; font-weight: 850; }
    .minigame-host { position: fixed; inset: 0; z-index: 85; background: #f4f7f8; }
    .minigame-host iframe { width: 100%; height: 100%; border: 0; background: #f4f7f8; }

    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes pulse { 50% { transform: scale(1.35); opacity: .65; } }

    @media (max-width: 900px) {
      #game { grid-template-columns: 1fr; text-align: center; gap: 18px; }
      .game-copy { display: none; }
      .wheel-wrap { width: min(58vh, 78vw); }
      .reward-layout { grid-template-columns: 1fr; text-align: center; }
      .qr-box { width: min(250px, 60vw); }
      .diagnostic-result { grid-template-columns: 1fr; text-align: center; }
      .activity-grid { grid-template-columns: 1fr; }
      .activity-card { min-height: 160px; }
    }

    @media (max-width: 640px) {
      .brand { top: 18px; left: 20px; }
      .floating-game-button { right: 18px; bottom: 20px; }
      .floating-diagnostic-button { left: 18px; bottom: 20px; }
      .progress-dots { display: none; }
      .slide { padding-inline: 24px; }
      .answers { grid-template-columns: 1fr; }
      .answer-button { min-height: 70px; }
      .diagnostic-options { grid-template-columns: 1fr; }
      .exit-game { top: 18px; right: 18px; }
    }

    /* TELÉFONOS Y TABLETS: controles táctiles, alto real y contenido sin recortes. */
    @media (max-width: 900px) {
      html, body, .app, #presentation, #game, #diagnostic { min-height: 100dvh; }
      button, a, .activity-card, .answer-button, .diagnostic-option { touch-action: manipulation; -webkit-tap-highlight-color: rgba(0,125,165,.15); }
      .activity-menu-overlay { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
      .activity-menu-card { width: 100%; max-height: calc(100dvh - 20px); padding: clamp(16px,4vw,28px); overflow: hidden; }
      .activity-menu-card h2 { font-size: clamp(2rem,8vw,3.4rem); }
      .activity-menu-card > p { margin-bottom: 14px; }
      .activity-grid { gap: 12px; }
      .activity-card { min-height: 132px; padding: 18px; gap: 6px; }
      .activity-card strong { font-size: clamp(1.35rem,5vw,1.9rem); }
      .activity-card span:last-child { font-size: .94rem; line-height: 1.28; }
      .activity-close { min-height: 46px; margin-top: 12px; }
      .modal, #diagnostic { padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
      .modal-card, .diagnostic-card { width: 100%; max-height: calc(100dvh - 16px); overflow: hidden; padding: clamp(16px,4vw,26px); }
      .answer-button, .diagnostic-option, .primary-button, .secondary-button, .course-link { min-height: 48px; }
    }

    @media (max-width: 640px) {
      .brand { max-width: 52vw; font-size: .72rem; }
      .slide { min-height: 100dvh; padding: 64px 14px 104px; }
      .slide-content { width: 100%; padding: clamp(22px,6vw,34px) 18px; }
      .hero-title, .slide-title { font-size: clamp(2.25rem,11vw,3.55rem); }
      .slide-copy { font-size: clamp(.98rem,4.4vw,1.15rem); line-height: 1.35; }
      .floating-game-button, .floating-diagnostic-button {
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(50% - 17px);
        min-height: 58px;
        margin: 0;
        padding: 9px 12px;
        border-radius: 8px;
        font-size: .84rem;
        line-height: 1.15;
        text-align: center;
        box-shadow: 0 10px 28px rgba(0,80,105,.2);
      }
      .floating-diagnostic-button { left: 12px; }
      .floating-game-button { right: 12px; }
      .floating-game-button .dot { display: none; }
      .activity-icon { font-size: 1.65rem; }
      .modal-card h2, .diagnostic-card h2 { font-size: clamp(1.75rem,8vw,2.65rem); }
      .answers, .diagnostic-options { gap: 8px; margin-top: 12px; }
      .answer-button, .diagnostic-option { min-height: 58px; padding: 10px 12px; font-size: .92rem; }
      .reward-layout, .diagnostic-result { gap: 12px; }
      .qr-box, .diagnostic-result .qr-box { width: min(142px,22dvh); }
      .result-message, .reward-copy .slide-copy, .recommendation-note { margin: 7px 0; font-size: .9rem; line-height: 1.25; }
      .action-row { gap: 7px; }
    }

    @media (max-width: 410px) {
      .slide { padding-bottom: 160px; }
      .floating-game-button, .floating-diagnostic-button {
        left: 12px;
        right: 12px;
        width: auto;
        min-height: 54px;
      }
      .floating-game-button { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 60px); }
      .floating-diagnostic-button { bottom: max(10px, env(safe-area-inset-bottom)); }
    }

    @media (max-height: 520px) and (orientation: landscape) {
      .activity-menu-card { padding: 12px 18px; }
      .activity-menu-card h2 { margin: 0; font-size: 1.8rem; }
      .activity-menu-card > p { margin: 4px 0 9px; font-size: .88rem; }
      .activity-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
      .activity-card { min-height: 116px; padding: 12px; }
      .activity-card strong { font-size: 1.25rem; }
      .activity-card span:last-child { font-size: .8rem; }
      .activity-close { min-height: 38px; margin-top: 8px; padding: 6px 12px; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
      .slide { transition-duration: .25s; }
      .wheel { transition-duration: 1.5s; }
    }

    /* IDENTIDAD INSTITUCIONAL: clara, sobria y cercana a la estética editorial de la Iglesia. */
    :root {
      --bg: #f4f7f8;
      --surface: rgba(255,255,255,.92);
      --text: #1f2a30;
      --muted: #52636b;
      --accent: #007da5;
      --shadow: 0 24px 70px rgba(22, 50, 62, .16);
    }

    html, body { background: #f4f7f8; color: var(--text); }
    body::before {
      background:
        radial-gradient(circle at 85% 16%, rgba(0,125,165,.12), transparent 28%),
        radial-gradient(circle at 10% 88%, rgba(84,130,53,.08), transparent 28%),
        linear-gradient(135deg, #ffffff, #f2f7f8 58%, #eaf2f4);
    }
    .brand { color: #263b45; letter-spacing: .08em; }
    .brand-mark { width: 5px; height: 34px; border-radius: 0; background: #007da5; box-shadow: none; }
    .slide::before { opacity: .28; filter: blur(30px); }
    .slide-content {
      padding: clamp(34px, 5vw, 72px);
      border-top: 5px solid var(--slide-color);
      background: rgba(255,255,255,.76);
      box-shadow: 0 24px 70px rgba(22,50,62,.10);
      backdrop-filter: blur(8px);
    }
    .hero-title, .slide-title, .game-copy h2, .modal-card h2 {
      color: #24343b;
      font-family: Georgia, "Times New Roman", serif;
      font-weight: 500;
      letter-spacing: -.035em;
    }
    .hero-title { font-size: clamp(3.3rem, 7vw, 7rem); }
    .slide-copy { color: #52636b; }
    .eyebrow { letter-spacing: .12em; }
    .primary-button, .spin-button, .home-button {
      border-radius: 3px;
      background: #007da5;
      box-shadow: 0 12px 28px rgba(0,125,165,.24);
    }
    .primary-button:hover, .spin-button:hover, .home-button:hover {
      box-shadow: 0 16px 34px rgba(0,125,165,.30);
    }
    .floating-game-button {
      border-color: rgba(0,125,165,.22);
      border-radius: 3px;
      background: #007da5;
      color: white;
      box-shadow: 0 12px 30px rgba(0,80,105,.22);
    }
    .floating-game-button .dot { background: white; box-shadow: none; }
    .floating-diagnostic-button {
      position: fixed; left: 34px; bottom: 28px; z-index: 25;
      border: 1px solid rgba(0,125,165,.28); border-radius: 3px; padding: 14px 20px;
      background: white; color: #006184; box-shadow: 0 12px 30px rgba(0,80,105,.14);
      cursor: pointer; font-weight: 850;
    }
    .progress-dot { background: rgba(0,78,102,.22); }
    .progress-dot.active { background: #007da5; }
    #game { background: linear-gradient(135deg, #f8fbfc, #eaf2f4); }
    .game-copy p { color: #52636b; }
    .exit-game { border-color: #c9dadd; background: white; color: #254653; }
    .modal { background: rgba(22,43,51,.76); }
    .modal-card {
      background: linear-gradient(145deg, #ffffff, color-mix(in srgb, var(--category-color) 7%, #f5f8f9));
      color: #24343b;
    }
    .answer-button { border-color: #ccdadd; background: white; color: #263b45; }
    .result-message, .idle-note { color: #52636b; }

    /* AJUSTE PARA MONITORES: toda la interacción visible sin desplazamiento. */
    @media (min-width: 901px) {
      .modal { padding: 12px; }
      .modal-card { max-height: calc(100vh - 24px); overflow: hidden; }
      #questionCard { width: min(1050px, 97vw); }
      #rewardCard { width: min(1180px, 97vw); }
      .diagnostic-card { max-height: calc(100vh - 24px); overflow: hidden; }
    }

    @media (min-width: 901px) and (max-height: 850px) {
      .modal-card { padding: 24px 30px; border-radius: 18px; }
      .category-badge { margin-bottom: 10px; padding: 7px 13px; font-size: .82rem; }
      .modal-card h2 { margin-bottom: 12px; font-size: clamp(2rem, 3.3vw, 3.2rem); }
      .answers { gap: 11px; margin-top: 18px; }
      .answer-button { min-height: 64px; padding: 12px 16px; font-size: clamp(.95rem, 1.2vw, 1.1rem); }
      .reward-layout { grid-template-columns: minmax(180px, .58fr) minmax(480px, 1.42fr); gap: 28px; }
      .qr-box { width: min(220px, 25vh); border-width: 9px; border-radius: 12px; }
      .reward-copy h2 { font-size: clamp(1.9rem, 3vw, 2.8rem); }
      .result-kicker { font-size: .95rem; }
      .result-message { margin-bottom: 12px; font-size: 1rem; line-height: 1.3; }
      .reward-copy .slide-copy { margin-bottom: 12px; font-size: 1.05rem; line-height: 1.3; }
      .reward-copy .action-row { gap: 8px; }
      .reward-copy .course-link, .reward-copy .secondary-button, .reward-copy .primary-button { margin: 0; padding: 10px 14px; font-size: .9rem; }
      .idle-note { margin-top: 8px; font-size: .8rem; }
      #diagnostic { padding: 12px; }
      .diagnostic-card { padding: 22px 28px; }
      .diagnostic-card h2 { margin: 8px auto 5px; font-size: clamp(1.9rem, 3.2vw, 3rem); }
      .diagnostic-help { margin-bottom: 8px; font-size: 1rem; }
      .diagnostic-options { grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
      .diagnostic-option { min-height: 62px; padding: 10px 12px; font-size: .95rem; }
      .diagnostic-result { grid-template-columns: 190px 1fr; gap: 26px; }
      .diagnostic-result .qr-box { width: 180px; }
      .diagnostic-result h2 { font-size: clamp(1.8rem, 2.8vw, 2.7rem); }
      .diagnostic-result .result-message, .diagnostic-result .alternative-course, .recommendation-note { margin: 9px 0; font-size: .94rem; line-height: 1.3; }
      .diagnostic-result .course-link, .diagnostic-result .secondary-button, .diagnostic-result .primary-button { margin: 0; padding: 9px 12px; font-size: .86rem; }
    }

    @media (min-width: 901px) and (max-height: 650px) {
      .modal-card { padding: 16px 22px; }
      .modal-card h2 { font-size: 2rem; }
      .answer-button { min-height: 52px; padding: 8px 12px; }
      .qr-box { width: 165px; }
      .reward-layout { grid-template-columns: 165px 1fr; gap: 22px; }
      .idle-note { display: none; }
      .diagnostic-card { padding: 15px 22px; }
      .diagnostic-option { min-height: 52px; padding: 8px 10px; font-size: .86rem; }
      .recommendation-note { padding: 8px 12px; }
    }

    /* Barra de acciones móvil: dos accesos claros y consistentes. */
    @media (max-width: 640px) {
      .slide { padding-bottom: 104px; }
      .floating-game-button, .floating-diagnostic-button {
        position: fixed;
        top: auto;
        bottom: max(12px, env(safe-area-inset-bottom));
        width: calc(50% - 17px);
        min-height: 58px;
        margin: 0;
        padding: 9px 12px;
        border-radius: 8px;
        font-size: .84rem;
        line-height: 1.15;
        text-align: center;
      }
      .floating-diagnostic-button { left: 12px; right: auto; }
      .floating-game-button { right: 12px; left: auto; }
      .floating-game-button .dot { display: none; }
      .modal, #diagnostic, .activity-menu-overlay {
        align-items: start;
        overflow: hidden;
      }
      .modal-card, .diagnostic-card, .activity-menu-card {
        max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
      }
    }

    @media (max-width: 410px) {
      .slide { padding-bottom: 160px; }
      .floating-game-button, .floating-diagnostic-button {
        left: 12px;
        right: 12px;
        width: auto;
        min-height: 54px;
      }
      .floating-game-button { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 60px); }
      .floating-diagnostic-button { bottom: max(10px, env(safe-area-inset-bottom)); }
    }
