:root {
      --page-bg: #fff8fc;
      --surface: rgba(255, 255, 255, 0.92);
      --surface-strong: #ffffff;
      --ink: #2b2331;
      --muted: #64576d;
      --soft-border: rgba(87, 66, 102, 0.13);
      --primary: #6f3fd4;
      --primary-dark: #5630ad;
      --pink: #ff7bc0;
      --orange: #f59e0b;
      --blue: #2563eb;
      --green: #16a34a;
      --red: #dc2626;
      --shadow: 0 18px 48px rgba(46, 30, 66, 0.10);
      --shadow-strong: 0 24px 70px rgba(46, 30, 66, 0.16);
      --radius-xl: 28px;
      --radius-lg: 22px;
      --radius-md: 16px;
    }

    * { box-sizing: border-box; }

    html {
      scroll-behavior: smooth;
      -webkit-text-size-adjust: 100%;
    }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: Arial, Helvetica, sans-serif;
      color: var(--ink);
      background:
        radial-gradient(circle at top left, rgba(255, 226, 240, 0.95), transparent 32%),
        radial-gradient(circle at bottom right, rgba(221, 237, 255, 0.95), transparent 34%),
        var(--page-bg);
    }

    a { color: inherit; }

    button,
    input,
    textarea,
    select {
      font: inherit;
    }

    .site-header {
      position: sticky;
      top: 0;
      z-index: 20;
      background: rgba(255, 248, 252, 0.84);
      border-bottom: 1px solid var(--soft-border);
      backdrop-filter: blur(18px);
    }

    .topbar,
    .page-shell {
      width: min(1120px, calc(100% - 36px));
      margin: 0 auto;
    }

    .topbar {
      min-height: 72px;
      padding: 12px 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 16px;
    }

    .brand,
    .nav-link,
    .back-link {
      text-decoration: none;
      font-weight: 900;
    }

    .brand {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      white-space: nowrap;
    }

    .logo {
      width: 42px;
      height: 42px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      background: linear-gradient(135deg, var(--primary), var(--pink));
      color: #ffffff;
      box-shadow: 0 12px 26px rgba(123, 69, 223, 0.22);
    }

    .topbar-links {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .nav-link {
      font-size: 0.9rem;
      padding: 9px 11px;
      border-radius: 999px;
      color: #44354d;
    }

    .nav-link:hover,
    .nav-link:focus-visible,
    .nav-link.active-link {
      background: rgba(255, 255, 255, 0.88);
      outline: none;
    }

    .page-shell {
      padding: clamp(26px, 5vw, 52px) 0 42px;
    }

    .hero {
      margin-bottom: 16px;
    }

    .hero-copy,
    .teacher-note,
    .branch-card,
    .game-card,
    .summary,
    .rule-card {
      background: var(--surface);
      border: 1px solid var(--soft-border);
      box-shadow: var(--shadow);
    }

    .hero-copy {
      position: relative;
      overflow: hidden;
      border-radius: var(--radius-xl);
      padding: clamp(18px, 3vw, 26px);
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 16px;
    }

    .hero-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
    }

    .hero-text {
      min-width: 0;
    }

    .hero-copy::before,
    .game-card::before,
    .branch-card::before {
      content: "";
      position: absolute;
      inset: 0 0 auto;
      height: 8px;
      background: linear-gradient(90deg, var(--primary), var(--pink), var(--orange));
    }

    .eyebrow {
      margin: 0 0 12px;
      color: var(--primary);
      text-transform: uppercase;
      letter-spacing: 0.11em;
      font-size: 0.78rem;
      font-weight: 900;
    }

    h1 {
      max-width: 760px;
      margin: 0;
      font-size: clamp(2rem, 4.5vw, 3.55rem);
      line-height: 1;
      letter-spacing: -0.06em;
    }

    .lead {
      max-width: 680px;
      margin: 10px 0 0;
      color: var(--muted);
      line-height: 1.45;
      font-size: clamp(0.98rem, 1.8vw, 1.08rem);
    }

    .hero-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 0;
    }

    .back-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 42px;
      padding: 10px 14px;
      border-radius: 999px;
      background: #ffffff;
      border: 1px solid var(--soft-border);
      color: #44354d;
    }

    .branch-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      margin: 2px 0 0;
    }

    .branch-card {
      position: relative;
      overflow: hidden;
      border-radius: 22px;
      min-height: 0;
      padding: 13px 14px;
      text-align: left;
      color: var(--ink);
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 10px;
      transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    }

    .branch-card:hover,
    .branch-card:focus-visible,
    .branch-card.active {
      transform: translateY(-3px);
      border-color: rgba(111, 63, 212, 0.34);
      box-shadow: var(--shadow-strong);
      outline: none;
    }

    .branch-card:nth-child(2)::before { background: linear-gradient(90deg, var(--blue), var(--primary), var(--pink)); }
    .branch-card:nth-child(3)::before { background: linear-gradient(90deg, var(--orange), var(--pink), var(--primary)); }

    .branch-icon {
      width: 38px;
      height: 38px;
      flex: 0 0 38px;
      display: grid;
      place-items: center;
      border-radius: 14px;
      background: linear-gradient(135deg, #f7edff, #ffe7f5);
      font-size: 1.22rem;
      box-shadow: inset 0 0 0 1px rgba(87, 66, 102, 0.08);
    }

    .branch-card h2 {
      margin: 0;
      font-size: 1.02rem;
      letter-spacing: -0.03em;
    }

    .branch-card p,
    .mini-tags {
      display: none;
    }

    .game-card {
      position: relative;
      overflow: hidden;
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-strong);
      padding: clamp(18px, 4vw, 34px);
      margin-bottom: 22px;
    }

    .game-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 18px;
      padding-top: 4px;
    }

    .pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      gap: 8px;
      padding: 9px 13px;
      border-radius: 999px;
      background: #f3e8ff;
      color: #5b21b6;
      font-weight: 900;
    }

    .score-pill {
      background: #dbeafe;
      color: #1d4ed8;
    }

    .question-grid {
      display: grid;
      grid-template-columns: minmax(245px, 330px) minmax(0, 1fr);
      gap: clamp(18px, 4vw, 30px);
      align-items: stretch;
    }

    .picture-card {
      min-height: 342px;
      border-radius: var(--radius-xl);
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.70)),
        linear-gradient(135deg, #fde68a, #fbcfe8, #bfdbfe);
      border: 1px solid rgba(87, 66, 102, 0.10);
      display: grid;
      place-items: center;
      padding: 20px;
      position: relative;
      overflow: hidden;
    }

    .picture-card::before,
    .picture-card::after {
      content: "";
      position: absolute;
      width: 160px;
      height: 160px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.46);
    }

    .picture-card::before { top: -52px; left: -42px; }
    .picture-card::after { bottom: -62px; right: -46px; }

    .emoji-scene {
      position: relative;
      z-index: 2;
      display: grid;
      gap: 14px;
      place-items: center;
      text-align: center;
    }

    .emoji-main {
      font-size: clamp(4.8rem, 12vw, 8rem);
      line-height: 1;
      filter: drop-shadow(0 16px 18px rgba(31, 41, 55, 0.16));
    }

    .emoji-caption {
      padding: 10px 14px;
      border-radius: 18px;
      background: rgba(255, 255, 255, 0.82);
      font-weight: 900;
      color: #44354d;
    }

    .task-area {
      min-width: 0;
      display: flex;
      flex-direction: column;
    }

    .branch-title {
      margin: 0 0 8px;
      color: var(--primary);
      text-transform: uppercase;
      letter-spacing: 0.10em;
      font-size: 0.78rem;
      font-weight: 900;
    }

    .sentence {
      margin: 0 0 12px;
      font-size: clamp(2rem, 5vw, 3.25rem);
      line-height: 1.05;
      letter-spacing: -0.055em;
      font-weight: 900;
    }

    .instruction {
      margin: 0 0 18px;
      color: var(--muted);
      line-height: 1.55;
      font-size: 1.04rem;
    }

    .options {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 14px;
    }

    .option-btn {
      min-height: 64px;
      border: 2px solid rgba(87, 66, 102, 0.12);
      background: #ffffff;
      border-radius: var(--radius-lg);
      color: var(--ink);
      font-size: clamp(1.05rem, 3vw, 1.32rem);
      font-weight: 900;
      cursor: pointer;
      transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    }

    .option-btn:hover:not(:disabled),
    .option-btn:focus-visible:not(:disabled) {
      transform: translateY(-2px);
      border-color: rgba(111, 63, 212, 0.36);
      background: #fbf8ff;
      outline: none;
    }

    .option-btn:disabled { cursor: default; opacity: 0.95; }
    .option-btn.correct { background: #dcfce7; border-color: rgba(22, 163, 74, 0.46); color: #166534; }
    .option-btn.wrong { background: #fee2e2; border-color: rgba(220, 38, 38, 0.36); color: #991b1b; }

    .feedback {
      min-height: 110px;
      padding: 16px;
      border-radius: var(--radius-lg);
      background: #fff7fb;
      border: 1px solid rgba(87, 66, 102, 0.10);
      color: var(--muted);
      line-height: 1.55;
    }

    .feedback strong { color: var(--ink); }
    .feedback.good { background: #dcfce7; border-color: rgba(22, 163, 74, 0.28); }
    .feedback.bad { background: #fee2e2; border-color: rgba(220, 38, 38, 0.22); }

    .controls,
    .summary-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin-top: 16px;
    }

    .primary-btn,
    .secondary-btn {
      border: 0;
      min-height: 48px;
      padding: 12px 18px;
      border-radius: var(--radius-md);
      font-weight: 900;
      cursor: pointer;
      font-size: 1rem;
      transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }

    .primary-btn {
      background: linear-gradient(135deg, var(--primary), var(--pink));
      color: #ffffff;
      box-shadow: 0 12px 24px rgba(111, 63, 212, 0.20);
    }

    .secondary-btn {
      background: #ffffff;
      color: #44354d;
      border: 1px solid var(--soft-border);
    }

    .primary-btn:hover:not(:disabled),
    .secondary-btn:hover {
      transform: translateY(-1px);
    }

    .primary-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      box-shadow: none;
    }

    .progress-wrap {
      margin-top: 18px;
      height: 12px;
      border-radius: 999px;
      background: rgba(87, 66, 102, 0.12);
      overflow: hidden;
    }

    .progress-bar {
      height: 100%;
      width: 0%;
      border-radius: inherit;
      background: linear-gradient(90deg, var(--primary), var(--pink), var(--orange));
      transition: width 0.25s ease;
    }

    .summary {
      display: none;
      border-radius: var(--radius-xl);
      padding: clamp(20px, 4vw, 34px);
      margin-bottom: 22px;
      text-align: center;
    }

    .summary.show { display: block; }
    .summary h2 {
      margin: 0 0 10px;
      font-size: clamp(2rem, 5vw, 3.15rem);
      line-height: 1;
      letter-spacing: -0.055em;
    }

    .summary p {
      margin: 0 auto;
      max-width: 700px;
      color: var(--muted);
      line-height: 1.6;
      font-size: 1.05rem;
    }

    .summary .primary-btn { margin-top: 18px; }

    .cheat-sheet {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin: 0 0 18px;
    }

    .rule-card {
      border-radius: var(--radius-lg);
      padding: 18px;
    }

    .rule-card h3 {
      margin: 0 0 10px;
      font-size: 1.2rem;
      letter-spacing: -0.03em;
    }

    .rule-card p {
      margin: 8px 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .rule-card code {
      background: #f3e8ff;
      padding: 2px 6px;
      border-radius: 8px;
      color: #5b21b6;
      font-weight: 900;
    }

    footer {
      text-align: center;
      color: var(--muted);
      padding: 18px 0 8px;
    }

    @media (max-width: 900px) {
      .hero-head {
        align-items: flex-start;
        flex-direction: column;
      }

      .question-grid,
      .cheat-sheet {
        grid-template-columns: 1fr;
      }

      .picture-card { min-height: 250px; }
      .branch-card { min-height: auto; }
    }

    @media (max-width: 640px) {
      .topbar,
      .page-shell { width: min(100% - 28px, 1120px); }

      .topbar {
        align-items: flex-start;
        flex-direction: column;
      }

      .topbar-links {
        width: 100%;
        justify-content: flex-start;
      }

      .nav-link,
      .back-link {
        font-size: 0.86rem;
      }

      .hero-copy,
      .branch-card,
      .game-card,
      .summary,
      .rule-card {
        border-radius: 22px;
      }

      .branch-grid {
        grid-template-columns: 1fr;
      }

      .options { grid-template-columns: 1fr; }
      .sentence { font-size: 2rem; }
      .option-btn { min-height: 58px; }
      .controls > *,
      .summary .primary-btn { width: 100%; }
    }
