:root {
  --ink: #30323a;
  --muted: #6d7079;
  --paper: #fffdf9;
  --line: #e8e4df;
  --aura: #cef4f8;
  --mint: #c5ebd5;
  --pink: #fed3d9;
  --yellow: #fdf0d7;
  --violet: #d1cceb;
  --blue: #55b9c7;
  --rose: #d86f87;
  --green: #68aa80;
  --shadow: 0 24px 60px rgba(48,50,58,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(circle at 8% 16%, rgba(206,244,248,.74), transparent 25rem),
    radial-gradient(circle at 93% 34%, rgba(254,211,217,.52), transparent 27rem),
    linear-gradient(180deg, #fff 0%, var(--paper) 62%, rgba(253,240,215,.54) 100%);
  color: var(--ink);
  font-family: "Source Sans 3", sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar { align-items: center; backdrop-filter: blur(24px); background: rgba(255,250,248,.9); border-bottom: 1px solid rgba(234,223,228,.95); display: flex; gap: 16px; justify-content: space-between; padding: 13px clamp(16px,4vw,60px); position: sticky; top: 0; z-index: 100; }
.brand { align-items: center; color: var(--ink); display: inline-flex; flex-shrink: 0; gap: 11px; text-decoration: none; }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand strong { font: 700 18px "Nunito", sans-serif; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 1px; }
.brand-mark { align-items: center; background: linear-gradient(135deg,var(--ink),#4a4d59); border-radius: 10px; display: inline-flex; flex-shrink: 0; gap: 3px; height: 44px; justify-content: center; position: relative; width: 44px; }
.mark-eye { background: white; border-radius: 50%; display: inline-block; height: 10px; position: relative; width: 10px; }
.mark-eye::after { background: var(--ink); border-radius: 50%; content: ""; height: 4px; left: 3px; position: absolute; top: 3px; width: 4px; }
.mark-lens { border: 2px solid var(--pink); border-radius: 50%; display: inline-block; height: 11px; margin-left: 1px; position: relative; width: 11px; }
.mark-lens::after { background: var(--pink); border-radius: 3px; content: ""; height: 8px; position: absolute; right: -5px; top: 7px; transform: rotate(-42deg); width: 2px; }
.back-link { background: var(--yellow); border: 1px solid rgba(213,166,66,.22); border-radius: 999px; color: var(--ink); font: 900 .86rem "Nunito", sans-serif; padding: 9px 15px; text-decoration: none; }
.back-link:hover { background: #f9e4b9; }

main { margin: 0 auto; max-width: 1180px; padding: clamp(36px,5vw,64px) clamp(14px,3vw,28px) 72px; }
.hero { margin: 0 auto 28px; max-width: 880px; text-align: center; }
.eyebrow, .toolbar-kicker { color: #997329; display: block; font: 900 .75rem "Nunito", sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.hero h1 { font: 900 clamp(2.2rem,5vw,4rem)/1.04 "Nunito", sans-serif; letter-spacing: -.045em; margin-top: 9px; }
.hero h1 em { color: var(--rose); font-style: normal; }
.hero > p { color: var(--muted); font-size: clamp(.98rem,1.7vw,1.15rem); line-height: 1.55; margin: 15px auto 0; max-width: 690px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.hero-pills span { background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; font-weight: 800; padding: 7px 12px; }

.quiz-shell { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; padding: clamp(20px,4vw,38px); }
.launch-panel { align-items: center; display: grid; gap: clamp(22px,4vw,50px); grid-template-columns: 1.08fr .92fr; min-height: 330px; }
.launch-copy h2 { font: 900 clamp(1.55rem,3.4vw,2.65rem)/1.08 "Nunito",sans-serif; letter-spacing: -.035em; margin-top: 7px; }
.launch-copy p { color: var(--muted); font-size: 1rem; line-height: 1.55; margin-top: 13px; max-width: 580px; }
.launch-action { align-items: center; background: linear-gradient(135deg,#4f4a66,#30323a); border: 0; border-radius: 14px; box-shadow: 0 12px 26px rgba(48,50,58,.2); color: white; cursor: pointer; display: inline-flex; font: 900 .92rem "Nunito",sans-serif; gap: 9px; margin-top: 20px; min-height: 50px; padding: 11px 20px; }
.launch-action span { font-size: 1.25rem; }
.launch-action:hover { transform: translateY(-2px); }
.launch-visual { align-items: center; aspect-ratio: 16/10; background: linear-gradient(135deg,rgba(206,244,248,.72),rgba(209,204,235,.55),rgba(253,240,215,.7)); border: 1px solid rgba(159,150,201,.2); border-radius: 21px; display: flex; justify-content: center; overflow: hidden; padding: 22px; position: relative; }
.launch-puzzle { display: grid; filter: drop-shadow(0 13px 20px rgba(76,72,98,.13)); gap: 5px; grid-template-columns: repeat(2,72px); grid-template-rows: repeat(4,42px); transform: rotate(-2deg); }
.launch-puzzle span { align-items: center; background: rgba(255,255,255,.78); border: 1px dashed rgba(122,112,172,.48); color: rgba(87,82,110,.55); display: flex; font: 900 .78rem "Nunito",sans-serif; justify-content: center; }
.launch-puzzle span:nth-child(1) { border-radius: 16px 4px 4px 4px; }
.launch-puzzle span:nth-child(2) { border-radius: 4px 16px 4px 4px; }
.launch-puzzle span:nth-child(7) { border-radius: 4px 4px 4px 16px; }
.launch-puzzle span:nth-child(8) { border-radius: 4px 4px 16px 4px; }
.launch-puzzle span:nth-child(3n+1) { background: rgba(255,255,255,.9); }
.launch-seal { align-items: center; background: rgba(255,255,255,.93); border: 1px solid rgba(159,150,201,.22); border-radius: 18px; box-shadow: 0 10px 26px rgba(48,50,58,.13); display: flex; flex-direction: column; gap: 1px; left: 50%; padding: 9px 16px; position: absolute; top: 50%; transform: translate(-50%,-50%); }
.launch-seal strong { color: var(--rose); font: 900 1.35rem "Nunito",sans-serif; line-height: 1; }
.launch-seal small { color: var(--ink); font: 900 .7rem "Nunito",sans-serif; white-space: nowrap; }
.stage-frame[hidden] { display: none; }
.stage-controls { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }
.exit-stage, .fullscreen-stage { background: white; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); cursor: pointer; font: 900 .76rem "Nunito",sans-serif; min-height: 38px; padding: 7px 12px; }
.exit-stage span { font-size: 1.1rem; margin-right: 3px; }
.exit-stage { display: none; }
.fullscreen-stage span { font-size: .92rem; margin-right: 4px; }
.quiz-shell.stage-active { background: linear-gradient(145deg,#fff 0%,#fbfcff 52%,#fffaf3 100%); border: 0; border-radius: 0; box-shadow: none; height: 100dvh; inset: 0; max-width: none; overflow: auto; padding: clamp(13px,2vw,24px); position: fixed; width: 100vw; z-index: 1000; }
.quiz-shell.stage-active .launch-panel { display: none; }
.quiz-shell.stage-active .fullscreen-stage { display: none; }
.quiz-shell.stage-active .exit-stage { display: inline-block; }
.quiz-shell.stage-active .stage-frame { display: flex; flex-direction: column; min-height: calc(100dvh - clamp(26px,4vw,48px)); }
.quiz-shell.stage-active .quiz-toolbar { align-items: center; }
.quiz-shell.stage-active .quiz-toolbar h2 { font-size: clamp(1.25rem,2.2vw,1.75rem); }
.quiz-shell.stage-active .progress-track { margin-top: 10px; }
.quiz-shell.stage-active .quiz-note { margin-top: 7px; }
.quiz-shell.stage-active .activity-layout { flex: 1; gap: clamp(14px,2vw,24px); grid-template-columns: minmax(0,1fr) minmax(380px,1fr); margin-top: 13px; min-height: 0; }
.quiz-shell.stage-active .puzzle-panel { align-items: center; display: flex; flex-direction: column; justify-content: center; min-height: 0; padding: 11px 15px; }
.quiz-shell.stage-active .puzzle-panel h3 { font-size: 1.12rem; }
.quiz-shell.stage-active .puzzle-panel > p { margin-top: 2px; }
.quiz-shell.stage-active .magic-puzzle { margin: 7px auto 2px; max-height: calc(100dvh - 265px); width: min(100%,560px); }
.quiz-shell.stage-active #quizForm { align-self: stretch; height: 100%; max-height: calc(100dvh - 155px); overflow: auto; padding: 0; width: 100%; }
.quiz-shell.stage-active .questions-grid { display: block; height: 100%; }
.quiz-shell.stage-active .question-card { box-shadow: 0 14px 34px rgba(48,50,58,.1); min-height: min(54dvh,500px); padding: clamp(22px,2.4vw,32px); }
.quiz-shell.stage-active .question-text { font-size: 1.05rem; }
.quiz-shell.stage-active .option-content { min-height: 50px; padding: 8px 11px; }
.quiz-shell.stage-active .option-value { font-size: .96rem; }
body.activity-running { overflow: hidden; }
.quiz-toolbar { align-items: flex-end; display: flex; gap: 20px; justify-content: space-between; }
.quiz-toolbar h2, .result-panel h2 { font: 900 clamp(1.35rem,2.6vw,2rem)/1.12 "Nunito", sans-serif; letter-spacing: -.025em; margin-top: 5px; }
.progress-copy { align-items: baseline; background: var(--yellow); border-radius: 999px; display: flex; flex-shrink: 0; gap: 3px; padding: 8px 13px; }
.progress-copy strong { font: 900 1.05rem "Nunito", sans-serif; }
.progress-copy span { color: var(--muted); font-size: .72rem; font-weight: 800; }
.progress-track { background: #eeeae4; border-radius: 999px; height: 7px; margin-top: 18px; overflow: hidden; }
.progress-track span { background: linear-gradient(90deg,var(--blue),var(--mint)); border-radius: inherit; display: block; height: 100%; transition: width .25s ease; width: 0; }
.quiz-note { color: var(--muted); font-size: .84rem; font-weight: 600; margin-top: 10px; }

.activity-layout { align-items: stretch; display: grid; gap: 24px; grid-template-columns: minmax(0,1fr) minmax(380px,1fr); margin-top: 28px; }
.activity-layout > #quizForm { display: flex; height: 100%; min-width: 0; width: 100%; }
.activity-layout .questions-grid { flex: 1; height: 100%; min-width: 0; width: 100%; }
.puzzle-panel { background: linear-gradient(155deg,rgba(209,204,235,.42),rgba(206,244,248,.42) 48%,rgba(253,240,215,.55)); border: 1px solid rgba(159,150,201,.24); border-radius: 22px; padding: 20px 18px 17px; position: static; text-align: center; }
.puzzle-kicker { color: #7a70ac; display: block; font: 900 .7rem "Nunito",sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.puzzle-panel h3 { font: 900 1.32rem/1.15 "Nunito",sans-serif; margin-top: 5px; }
.puzzle-panel > p { color: var(--muted); font-size: .83rem; margin-top: 5px; }
.magic-puzzle { display: block; margin: 12px auto 6px; width: min(100%,680px); }
.character-puzzle { aspect-ratio: 1/1; background: radial-gradient(circle at 50% 40%,rgba(255,255,255,.96),rgba(255,255,255,.46)); border: 1px solid rgba(159,150,201,.22); border-radius: 20px; overflow: hidden; position: relative; }
.puzzle-piece { filter: drop-shadow(0 2px 3px rgba(48,50,58,.07)); transform-box: fill-box; transform-origin: center; }
.piece-base { fill: rgba(255,255,255,.84); transition: opacity .32s ease; }
.puzzle-piece:nth-of-type(2n) .piece-base { fill: rgba(238,235,246,.84); }
.piece-image { opacity: 0; pointer-events: none; transition: opacity .38s ease; }
.piece-outline { fill: none; stroke: rgba(122,112,172,.48); stroke-dasharray: 7 5; stroke-linejoin: round; stroke-width: 2; transition: stroke .35s ease; }
.piece-number { fill: #80798b; font: 900 16px "Nunito",sans-serif; text-anchor: middle; }
.puzzle-piece.filled .piece-base, .puzzle-piece.filled .piece-number { opacity: 0; }
.puzzle-piece.filled .piece-image { opacity: 1; }
.puzzle-piece.filled .piece-outline { stroke: rgba(255,255,255,.84); stroke-dasharray: none; }
.puzzle-piece.just-filled { animation: piece-pop .55s ease; }
.piece-dots { display: flex; gap: 6px; justify-content: center; margin-top: -2px; }
.piece-dots span { background: rgba(255,255,255,.8); border: 1px solid rgba(77,77,87,.22); border-radius: 50%; height: 9px; transition: .25s ease; width: 9px; }
.piece-dots span.filled { background: var(--dot-color); border-color: transparent; transform: scale(1.18); }
.puzzle-status { color: #67616f; display: block; font: 800 .78rem "Nunito",sans-serif; margin-top: 10px; }
.puzzle-panel.complete .magic-puzzle { animation: picture-glow 1.4s ease both; }
.questions-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.question-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; display: flex; flex-direction: column; height: 100%; justify-content: center; min-height: 400px; min-width: 0; padding: clamp(15px,2vw,19px); position: relative; transition: border-color .2s, box-shadow .2s; width: 100%; }
.question-card[hidden] { display: none !important; }
.question-card.unanswered { border-color: #d98576; box-shadow: 0 0 0 4px rgba(217,133,118,.12); }
.question-head { align-items: flex-start; display: flex; gap: 11px; }
.question-number { align-items: center; background: linear-gradient(135deg,var(--aura),var(--yellow)); border-radius: 11px; display: inline-flex; flex: 0 0 auto; font: 900 .9rem "Nunito", sans-serif; height: 36px; justify-content: center; width: 36px; }
.question-text { font: 800 .94rem/1.38 "Nunito", sans-serif; padding-top: 5px; }
.question-visual { align-items: center; background: linear-gradient(135deg,rgba(206,244,248,.24),rgba(253,240,215,.2)); border: 1px solid rgba(48,50,58,.06); border-radius: 15px; display: flex; justify-content: center; margin: 15px 0; min-height: 130px; overflow: hidden; padding: 12px; }
.question-visual:empty { display: none; }
.question-visual svg { display: block; height: auto; max-height: 190px; max-width: 100%; width: 100%; }
.visual-grid { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; width: 100%; }
.visual-chip { align-items: center; background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: 11px; display: flex; justify-content: center; min-height: 76px; padding: 5px; }
.visual-chip svg { max-height: 66px; }
.match-list { display: grid; gap: 7px; width: 100%; }
.match-row { align-items: center; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 8px; grid-template-columns: 22px 1fr 74px; min-height: 50px; padding: 4px 9px; }
.match-row > b { font: 900 .8rem "Nunito",sans-serif; }
.match-row svg { max-height: 40px; }

.options { display: grid; gap: 6px; margin-top: 12px; }
.option { cursor: pointer; position: relative; }
.option input { opacity: 0; position: absolute; }
.option-content { align-items: center; background: #faf9f6; border: 2px solid transparent; border-radius: 11px; display: grid; gap: 8px; grid-template-columns: 28px 1fr; min-height: 44px; padding: 6px 9px; transition: .15s ease; }
.option-letter { align-items: center; background: white; border: 1px solid var(--line); border-radius: 8px; display: inline-flex; font: 900 .74rem "Nunito",sans-serif; height: 26px; justify-content: center; width: 26px; }
.option-value { font-size: .88rem; font-weight: 700; line-height: 1.22; }
.match-option { align-items: center; display: grid; gap: 7px; grid-template-columns: minmax(0,1fr) 48px; width: 100%; }
.match-option svg { height: 34px; width: 100%; }
.match-option .notation { font-size: .86rem; min-width: 30px; }
.option:hover .option-content { border-color: #cbc6be; transform: translateY(-1px); }
.option input:checked + .option-content { background: linear-gradient(135deg,rgba(209,204,235,.42),rgba(206,244,248,.45)); border-color: #9f96c9; }
.option input:focus-visible + .option-content { outline: 3px solid rgba(85,185,199,.45); outline-offset: 2px; }
.question-card.solved { border-color: rgba(104,170,128,.5); box-shadow: 0 8px 24px rgba(104,170,128,.09); }
.question-card.solved .option { cursor: default; }
.question-card.solved .option:hover .option-content { transform: none; }
.option.correct .option-content { background: rgba(197,235,213,.62); border-color: #68aa80; }
.option.wrong-attempt .option-content { animation: gentle-nudge .28s ease; background: rgba(253,240,215,.78); border-color: #d5a642; }
.explanation { background: #f8f7f4; border-radius: 11px; color: var(--muted); display: none; font-size: .82rem; line-height: 1.42; margin-top: 10px; padding: 10px 12px; }
.question-card.solved .explanation { display: block; }
.attempt-note { color: #8c6922; font-size: .8rem; font-weight: 700; line-height: 1.4; margin-top: 9px; min-height: 0; }
.notation { align-items: center; display: inline-flex; font: 800 1rem/1 "Nunito",sans-serif; justify-content: center; min-width: 34px; white-space: nowrap; vertical-align: middle; }
.length-symbol { font: 800 1rem "Nunito",sans-serif; }

.form-warning { color: #a44839; font-size: .86rem; font-weight: 800; margin-top: 16px; min-height: 20px; text-align: center; }
.quiz-actions { display: flex; justify-content: center; margin-top: 5px; }
.primary-action, .secondary-action { border-radius: 12px; cursor: pointer; font: 900 .9rem "Nunito",sans-serif; min-height: 47px; padding: 10px 20px; }
.primary-action { background: var(--ink); border: 1px solid var(--ink); color: white; min-width: 230px; }
.primary-action:hover { background: #474a53; }
.secondary-action { background: white; border: 1px solid var(--line); color: var(--ink); margin-top: 14px; }
.result-exit { background: transparent; border: 0; color: var(--muted); cursor: pointer; font: 800 .84rem "Nunito",sans-serif; margin-left: 10px; padding: 10px; text-decoration: underline; text-underline-offset: 3px; }

.result-panel { align-items: center; background: linear-gradient(115deg,#eef9f3,#fff8e9,#eefafd); border: 1px solid rgba(104,170,128,.25); border-radius: 20px; display: grid; gap: 24px; grid-template-columns: auto 1fr; margin-top: 26px; padding: clamp(18px,3vw,28px); }
.result-panel[hidden] { display: none; }
.quiz-shell.stage-active .result-panel:not([hidden]) { box-shadow: 0 0 0 100vmax rgba(39,40,47,.48),0 28px 70px rgba(48,50,58,.28); left: 50%; margin: 0; max-width: 680px; position: fixed; top: 50%; transform: translate(-50%,-50%); width: calc(100% - 32px); z-index: 8; }
.result-badge { align-items: center; background: rgba(255,255,255,.92); border-radius: 50%; color: #d5a642; display: flex; font: 900 3.2rem "Nunito",sans-serif; height: 116px; justify-content: center; width: 116px; }
.result-panel p { color: var(--muted); font-size: .95rem; line-height: 1.5; margin-top: 7px; }

@keyframes piece-pop { 45% { transform: scale(1.08); } }
@keyframes gentle-nudge { 35% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
@keyframes picture-glow { 45% { box-shadow: 0 0 28px rgba(246,202,104,.66); transform: translateY(-4px); } }

footer { align-items: center; border-top: 1px solid #eadfe4; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 13px; gap: 14px 22px; justify-content: center; padding: 17px; }
footer a { color: inherit; text-decoration: none; }

@media (max-width: 900px) {
  .launch-panel { grid-template-columns: 1fr; }
  .launch-visual { display: none; }
  .activity-layout { grid-template-columns: 1fr; }
  .magic-puzzle { max-width: 380px; }
  .activity-layout > #quizForm, .activity-layout .questions-grid, .question-card { height: auto; }
  .question-card { min-height: 0; }
  .questions-grid { grid-template-columns: 1fr; }
  .question-visual { min-height: 115px; }
  .quiz-shell.stage-active .activity-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .quiz-shell.stage-active .puzzle-panel { min-height: auto; }
  .quiz-shell.stage-active .magic-puzzle { max-height: none; max-width: 380px; }
  .quiz-shell.stage-active #quizForm { max-height: none; overflow: visible; }
  .quiz-shell.stage-active .question-card { min-height: 0; }
}

@media (max-width: 480px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .brand small { display: none; }
  .back-link { font-size: .75rem; padding: 8px 10px; }
  main { padding-left: 9px; padding-right: 9px; }
  .quiz-shell { border-radius: 19px; padding: 17px 12px; }
  .launch-panel { min-height: 0; padding: 12px 0; text-align: center; }
  .launch-action { justify-content: center; width: 100%; }
  .quiz-toolbar { align-items: flex-start; }
  .stage-controls { align-items: flex-end; flex-direction: column; }
  .quiz-shell.stage-active { padding: 11px 9px; }
  .quiz-shell.stage-active .stage-frame { min-height: calc(100dvh - 22px); }
  .quiz-shell.stage-active .quiz-toolbar { align-items: flex-start; }
  .quiz-shell.stage-active .quiz-note { font-size: .75rem; }
  .quiz-shell.stage-active .activity-layout { margin-top: 10px; }
  .progress-copy { padding: 7px 10px; }
  .question-card { border-radius: 16px; padding: 15px 12px; }
  .question-text { font-size: .94rem; }
  .activity-layout { margin-top: 20px; }
  .puzzle-panel { padding: 17px 12px 13px; }
  .magic-puzzle { max-width: 300px; }
  .visual-grid { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 20px 1fr 64px; }
  .result-panel { grid-template-columns: 1fr; text-align: center; }
  .result-badge { margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
