:root {
  color-scheme: light;
  --ink: #232044;
  --muted: #5d5973;
  --line: #dedbe9;
  --paper: #f8f7fd;
  --purple: #5135ba;
  --deep: #21194c;
  --lime: #e4ff91;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #805cf0; outline-offset: 3px; }
[hidden] { display: none !important; }
.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 4; top: 8px; left: 8px; padding: 8px; background: white; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.nav { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 20px; font-weight: 800; white-space: nowrap; text-decoration: none; }
.brand-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: white; background: var(--purple); font-size: 24px; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0 clamp(10px, 2vw, 28px); }
nav a, .link { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-weight: 650; text-decoration: none; }
.link { padding: 0; border: 0; background: none; }
nav a:hover, .link:hover { color: var(--purple); text-decoration: underline; }
.button { min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: 9px; padding: 9px 17px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; text-decoration: none; color: white; background: var(--purple); }
.button:hover { background: #3e2991; }
.outline { background: white; color: var(--purple); border-color: #d8cdef; }
.outline:hover { background: #f2ecff; }
.hero { position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: center; grid-template-columns: 1.05fr 1fr; min-height: 415px; margin-top: 30px; padding: 49px 56px; border-radius: 26px; color: white; background: radial-gradient(ellipse at 78% 43%, #3c286e 0%, var(--deep) 60%); }
.hero-copy { z-index: 1; }
.tag { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 10px; border: 1px solid #6b5c91; border-radius: 20px; color: #f1eaff; font-size: 14px; font-weight: 650; }
.tag span { color: var(--lime); }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2.4rem, 5.45vw, 4.6rem); line-height: 1.02; letter-spacing: -0.058em; }
h1 em { color: var(--lime); font-style: normal; }
.hero-copy > p:not(.tag) { max-width: 360px; margin: 18px 0 25px; color: #e4dcf7; font-size: 17px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.primary { color: var(--deep); background: var(--lime); }
.primary:hover { background: #f0ffc3; }
.ghost { background: transparent; border-color: #887aac; }
.ghost:hover { background: #433468; }
.art { position: absolute; right: 3%; top: 0; width: 46%; height: 100%; pointer-events: none; }
.orbit { position: absolute; left: 50%; top: 51%; width: 96%; height: 54%; transform: translate(-50%, -50%) rotate(-29deg); border: 1px solid #7966a1; border-radius: 50%; opacity: .58; }
.orbit-two { width: 79%; height: 48%; }
.orbit-three { width: 63%; height: 41%; }
.planet { position: absolute; left: 14%; bottom: 14%; width: 94px; aspect-ratio: 1; border-radius: 50%; background: repeating-linear-gradient(-27deg, transparent 0 13px, #ffffff29 13px 18px, transparent 18px 25px), linear-gradient(145deg,#b792ff,#6846c2); box-shadow: inset -12px -11px 0 #37246442; }
.planet::after { content: ""; position: absolute; inset: 30% -21%; border: 3px solid #dbcaef; border-top-color: transparent; border-radius: 50%; transform: rotate(-24deg); }
.moon { position: absolute; right: 13%; top: 20%; width: 45px; aspect-ratio: 1; border-radius: 50%; background: #ffc46b; box-shadow: inset -7px -7px #d37c59; }
.star { position: absolute; color: #f5e5ff; font-size: 25px; }
.star-one { top: 21%; left: 24%; }
.star-two { top: 46%; left: 5%; }
.star-three { bottom: 21%; right: 19%; color: var(--lime); }
.star-four { top: 12%; left: 54%; color: var(--lime); }
.star-five { bottom: 11%; left: 47%; }
.rocket { position: absolute; left: 49%; top: 46%; width: 123px; height: 192px; transform: translate(-50%, -50%) rotate(34deg); }
.rocket-body { position: absolute; inset: 0 18px 28px; border-radius: 52% 52% 27% 27% / 62% 62% 23% 23%; background: linear-gradient(#ff8368 0 23%, #fff3e1 23% 79%, #b9a3ff 79%); box-shadow: inset -13px -3px #6a51a82c, 0 10px 16px #18103075; }
.window { position: absolute; top: 45%; left: 50%; width: 43px; aspect-ratio: 1; transform: translate(-50%, -50%); border: 5px solid #b9a3ff; border-radius: 50%; background: #2e225f; box-shadow: inset 3px 4px #544489; }
.window::after { content: ""; position: absolute; left: 7px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: #e8dbff; }
.fin { position: absolute; bottom: 22px; width: 40px; height: 65px; background: #ff8368; }
.fin.left { left: 0; border-radius: 100% 0 70% 10%; }
.fin.right { right: 0; border-radius: 0 100% 10% 70%; }
.flame { position: absolute; left: 50%; bottom: -18px; width: 38px; height: 71px; transform: translateX(-50%); border-radius: 50% 50% 55% 55%; background: linear-gradient(#fff2a5, #ffc76d 65%, #ff8169); }
.library { margin-top: 42px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.15rem); line-height: 1.18; letter-spacing: -0.04em; }
h3 { margin: 0; line-height: 1.25; }
.section-head p, .research p { margin: 6px 0 0; color: var(--muted); }
.search { display: flex; align-items: center; min-height: 46px; gap: 8px; border: 1px solid var(--line); padding: 0 12px; border-radius: 11px; background: white; color: var(--muted); }
.search span { font-size: 25px; }
.search input { min-width: 0; width: 220px; border: 0; background: white; color: var(--ink); }
.search:focus-within { outline: 3px solid #805cf0; outline-offset: 2px; }
.search input:focus { outline: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 19px 0 16px; }
.filter { min-height: 44px; padding: 6px 14px; border-radius: 22px; border: 1px solid var(--line); background: white; font-weight: 650; color: var(--muted); }
.filter[aria-pressed="true"] { border-color: var(--purple); background: #eee8ff; color: #3d258d; }
.sets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.card { display: flex; flex-direction: column; overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.cover { position: relative; display: grid; place-items: center; height: 116px; overflow: hidden; background: var(--cover); color: var(--symbol); font-size: 52px; font-weight: 900; letter-spacing: -0.08em; }
.cover::before, .cover::after { content: ""; position: absolute; border: 1px solid currentColor; border-radius: 50%; opacity: .22; }
.cover::before { width: 51%; height: 115%; left: -10%; bottom: -65%; }
.cover::after { width: 45%; height: 125%; top: -67%; right: -9%; }
.cover span { display: grid; place-items: center; min-width: 79px; height: 77px; padding: 0 10px; border-radius: 17px; background: #ffffff70; transform: rotate(-8deg); }
.cover .question-image { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; margin: 0; object-fit: cover; border-radius: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 4px; }
.card-actions .button { font-size: 14px; padding-inline: 11px; }
.card-favorite { color: var(--purple); padding-inline: 10px; font-size: 23px; }
.library-options { display: flex; gap: 8px 17px; flex-wrap: wrap; margin: 0 0 14px; }
.library-options label, .class-filter { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14px; }
.library-options select, .class-filter select { min-height: 44px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--line); color: var(--ink); background: white; border-radius: 10px; }
.math { --cover: #ffe2ab; --symbol: #96500e; }
.science { --cover: #ccece0; --symbol: #285c55; }
.english { --cover: #e5d9fe; --symbol: #523497; }
.custom { --cover: #f9d9e3; --symbol: #8e3457; }
.card-body { display: flex; flex: 1; flex-direction: column; align-items: start; gap: 8px; padding: 16px; }
.card .category { margin: 0; color: var(--purple); font-size: 14px; font-weight: 750; }
.card p { margin: 0; color: var(--muted); }
.card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; width: 100%; margin-top: auto; padding-top: 7px; }
.card-foot > span { color: var(--muted); font-size: 14px; }
.card-foot .button { min-height: 44px; }
.research { margin-top: 38px; padding: 25px 29px; border: 1px solid #dcd0f6; border-radius: 17px; background: #f0eafb; }
.research ol { margin: 12px 0; padding-left: 24px; }
.research li { margin: 6px 0; }
.research summary, summary { cursor: pointer; font-weight: 700; color: var(--purple); }
.research summary { padding: 10px 0; min-height: 44px; }
.footer { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 32px; padding-block: 23px; border-top: 1px solid var(--line); color: var(--muted); }
.footer p { margin: 0; }
.footer > a:last-child { margin-left: auto; padding-block: 8px; }
dialog { width: min(660px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); background: white; box-shadow: 0 20px 72px #16112a4d; }
dialog::backdrop { background: #1b143baf; }
.dialog-shell { position: relative; padding: 28px; }
.close { position: absolute; top: 13px; right: 13px; width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f1ecfa; color: var(--ink); font-size: 25px; }
#panel-title { padding-right: 48px; }
.dialog-head p, .hint { margin: 7px 0; color: var(--muted); }
.mode-list, .answers, .form-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.mode, .answer { min-height: 54px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #f8f5ff; color: var(--ink); text-align: left; overflow-wrap: anywhere; }
.mode:hover, .answer:not(:disabled):hover { border-color: var(--purple); background: #eee7ff; }
.mode strong, .mode span { display: block; }
.mode span { color: var(--muted); }
.answer { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.answer b { align-self: start; flex: none; padding: 2px 7px; border-radius: 6px; background: #ebe4fd; color: var(--ink); }
.answer.good, .feedback.good { background: #e8f8ed; border-color: #51a26b; }
.answer.bad, .feedback.bad { background: #fff0ec; border-color: #cc7770; }
.game-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px; margin: 14px 0 4px; color: var(--muted); }
progress { width: 100%; height: 12px; accent-color: var(--purple); }
.question { margin-top: 12px; font-size: clamp(1.25rem, 4vw, 1.65rem); }
.question-image { display: block; max-width: 100%; max-height: 230px; object-fit: contain; margin: 9px auto 12px; border-radius: 9px; }
.question-audio { display: block; width: min(100%, 440px); margin: 10px 0; }
.audio-text { width: fit-content; }
.response-form .button { margin-top: 10px; }
.response-form .answers { margin-top: 5px; }
.response-form .answer input, .answer-key input { width: 19px; min-height: 19px; flex: none; padding: 0; accent-color: var(--purple); }
.answer-key { display: flex; flex-wrap: wrap; gap: 5px 16px; }
.answer-key label { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.response-form .answer:has(input:checked) { border-color: var(--purple); background: #eee7ff; }
.question-tools { margin: 12px 0; background: #f8f5ff; border-radius: 10px; padding: 8px 12px; }
.question-tools summary { padding: 6px 0; }
.question-tools .error { margin: 8px 0; }
.question-tools .question-image { max-height: 120px; margin-inline: 0; }
.feedback { padding: 10px 12px; margin-top: 13px; border: 1px solid; border-radius: 10px; }
.feedback p { margin: 3px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 17px 0; }
.stats div { padding: 9px; border-radius: 10px; background: #f3edff; }
.stats strong, .stats span { display: block; }
.stats strong { font-size: 23px; }
.stats span { font-size: 14px; }
.review, .history-list { padding-left: 21px; }
.review li, .history-list li { margin-top: 9px; }
.review p { margin: 2px 0; }
form { margin-top: 15px; }
form label { display: grid; gap: 4px; font-weight: 650; }
form input, form select, form textarea { width: 100%; min-height: 44px; padding: 8px; border: 1px solid #c8c1d8; border-radius: 8px; color: var(--ink); background: white; }
form textarea { resize: vertical; }
fieldset { margin: 12px 0; padding: 11px; min-width: 0; border: 1px solid var(--line); border-radius: 10px; }
legend { font-weight: 750; }
.form-options { margin: 8px 0; }
.field-bottom { margin-bottom: 9px; }
.error { color: #982a36; font-weight: 650; }
@media (max-width: 830px) {
  .wrap { width: calc(100% - 36px); }
  .hero { padding: 40px 34px; min-height: 365px; }
  .art { width: 48%; right: 1%; }
  .nav { flex-wrap: wrap; gap: 0 12px; padding: 10px 0; }
  nav { order: 3; width: 100%; }
  .sets { gap: 10px; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .nav { min-height: auto; }
  .brand { font-size: 16px; gap: 7px; }
  .brand-icon { width: 28px; height: 28px; }
  .nav .button, nav a, .link { font-size: 14px; }
  .nav .button { padding-inline: 9px; }
  .hero { display: block; margin-top: 15px; padding: 25px 20px 175px; min-height: 0; border-radius: 20px; }
  .art { width: min(330px, 86%); height: 170px; top: auto; bottom: 0; right: 3%; }
  .rocket { transform: translate(-50%, -50%) rotate(34deg) scale(.56); }
  .planet { width: 52px; }
  .moon { width: 27px; }
  .star { font-size: 19px; }
  .library { margin-top: 26px; }
  .section-head { align-items: stretch; flex-direction: column; gap: 11px; }
  .search input { width: 100%; }
  .sets { grid-template-columns: 1fr; }
  .cover { height: 94px; }
  .research { padding: 17px; }
  .footer > a:last-child { margin-left: 0; }
  .dialog-shell { padding: 20px 15px; }
  .mode-list { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .answers, .form-options { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .filter, .answer { transition: background-color .15s, border-color .15s; }
  .button:active { transform: translateY(1px); }
}
