:root {
  color-scheme: dark;
  --bg: #171027;
  --surface: #251b3c;
  --ink: #fffaf3;
  --muted: #c3b8d7;
  --yellow: #ffcf36;
  --purple: #a58bff;
  --line: #514064;
  --green: #80ecc2;
  --red: #ffaaaa;
  --shadow: #0c0717;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 0%, #472271 0, transparent 48%), var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
button,
input,
select {
  font: inherit;
}
button,
a,
label,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a,
summary,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 5px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
p {
  margin-top: 0;
}
.wrap {
  max-width: 1080px;
  padding: 0 32px;
  margin: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 26px 0;
  border-bottom: 1px solid #ffffff18;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.topbar a {
  text-decoration: none;
  color: var(--muted);
}
.brand-dot {
  color: var(--yellow);
}
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  align-items: center;
  min-height: 370px;
  gap: 20px;
  padding: 40px 0;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 850;
  color: var(--purple);
  margin-bottom: 14px;
}
h1 {
  font-size: clamp(54px, 8vw, 84px);
  font-weight: 1000;
  line-height: 0.92;
  letter-spacing: -0.05em;
  transform: rotate(-3deg);
  text-shadow: 3px 5px 0 var(--shadow);
  margin: 0 0 25px;
}
h1 > span {
  display: block;
  color: var(--yellow);
}
.title-star {
  display: inline-block;
  font-size: 0.7em;
  margin-left: 14px;
  vertical-align: middle;
}
.intro {
  font-size: 18px;
  color: #ddd3ed;
  margin-bottom: 20px;
}
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero-tags span,
.pill {
  padding: 6px 11px;
  border: 1px solid #ffffff26;
  border-radius: 6px;
  background: #ffffff08;
}
.hero-art {
  position: relative;
  height: 300px;
}
.orbit {
  position: absolute;
  inset: 16px 5px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 8deg,
    #a571e723 0 12deg,
    transparent 12deg 30deg
  );
  transform: rotate(-10deg);
}
.hero-brawler {
  position: absolute;
  width: 64%;
  height: 280px;
  object-fit: contain;
  filter: drop-shadow(5px 10px 0 #10091e77);
}
.hero-left {
  left: -3%;
  top: 6px;
  transform: rotate(-9deg);
}
.hero-right {
  right: -3%;
  top: -6px;
  transform: rotate(9deg);
}
.art-sticker {
  position: absolute;
  bottom: 8px;
  left: 18%;
  background: var(--yellow);
  color: #261a0a;
  padding: 8px 18px;
  transform: rotate(-6deg);
  font-weight: 950;
  font-size: 15px;
  border: 3px solid #1a102a;
  box-shadow: 4px 4px 0 #0c0717;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 7px 0 #0c071760;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
legend,
.length-setting > label {
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 18px;
  display: block;
}
.step {
  color: var(--purple);
  font-size: 11px;
  margin-right: 8px;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #1d152f;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.mode-card input {
  position: absolute;
  right: 14px;
  top: 16px;
  accent-color: var(--yellow);
  width: 17px;
  height: 17px;
}
.mode-card:has(input:checked) {
  border-color: var(--yellow);
  background: #ffcf360b;
  box-shadow: 0 4px 0 #ffcf3620;
}
.mode-card:has(input:focus-visible) {
  outline: 3px solid white;
  outline-offset: 4px;
}
.mode-card:hover {
  transform: translateY(-2px);
}
.mode-icon {
  font-size: 32px;
  line-height: 1.2;
  color: var(--yellow);
  margin-bottom: 12px;
}
.mode-card strong {
  font-size: 18px;
  margin-bottom: 4px;
}
.mode-card > span:last-child {
  font-size: 12px;
  color: var(--muted);
}
.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  margin-top: 28px;
}
.segmented {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.segmented label {
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.segmented span {
  display: block;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}
.segmented input:checked + span {
  color: var(--ink);
  background: #7152b6;
  border-color: #b79be9;
}
.segmented input:focus-visible + span {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}
select,
input[type="search"] {
  background: #1a122c;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 8px;
  min-height: 44px;
}
select {
  width: 100%;
  font-size: 13px;
}
.start-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}
.start-row p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.button {
  border: 0;
  border-radius: 9px;
  padding: 13px 23px;
  font-weight: 850;
  min-height: 48px;
}
.primary {
  background: var(--yellow);
  color: #241908;
  box-shadow: 0 4px 0 #ad781d;
}
.primary:hover {
  background: #ffdd66;
}
.secondary {
  background: #7152b6;
  color: white;
  box-shadow: 0 4px 0 #423166;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 13px;
}
.revision {
  margin-top: 30px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 22px;
}
summary {
  cursor: pointer;
  font-weight: 750;
}
summary > span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.revision h2 {
  font-size: 20px;
  margin: 25px 0 8px;
}
.revision p,
.search-label {
  font-size: 13px;
  color: var(--muted);
}
.rank-ladder {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
}
.rank-ladder li {
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
}
.rank-ladder li:last-child {
  color: var(--yellow);
  border-color: var(--yellow);
}
input[type="search"] {
  width: 100%;
  margin: 8px 0 12px;
}
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 10px;
}
.roster-card {
  background: #1c132e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
}
.roster-card img {
  width: 100%;
  height: 100px;
  object-fit: contain;
}
.roster-card strong {
  display: block;
}
.roster-card small {
  color: var(--muted);
  display: block;
  font-size: 10px;
}
footer {
  padding: 35px 0 25px;
  text-align: center;
  color: #a99abd;
  font-size: 11px;
  max-width: 800px;
  margin: auto;
}
footer p {
  margin-bottom: 9px;
}
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0;
}
.pill {
  font-size: 12px;
}
.stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 10px;
}
progress {
  width: 100%;
  height: 9px;
  border: 0;
  border-radius: 9px;
  overflow: hidden;
  display: block;
  margin-bottom: 24px;
  background: #39294e;
}
progress::-webkit-progress-bar {
  background: #39294e;
}
progress::-webkit-progress-value {
  background: var(--yellow);
}
progress::-moz-progress-bar {
  background: var(--yellow);
}
.question-panel {
  max-width: 760px;
  margin: auto;
  text-align: center;
}
.question-panel h2 {
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.25;
  margin: 20px 0 10px;
}
.portrait-frame {
  position: relative;
  width: min(100%, 280px);
  margin: auto;
  background: radial-gradient(ellipse, #8e58d74d, transparent 70%);
  border-radius: 20px;
}
.portrait-frame img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  filter: drop-shadow(2px 7px 0 #0c071760);
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.answer {
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 16px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: #1c142d;
  color: var(--ink);
  font-weight: 700;
  min-height: 65px;
}
.answer-key {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: #ffffff0d;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.answer:hover:not(:disabled) {
  border-color: var(--purple);
  background: #3a2859;
}
.answer:disabled {
  opacity: 1;
  cursor: default;
}
.answer.correct {
  border-color: var(--green);
  background: #1b3b35;
}
.answer.wrong {
  border-color: var(--red);
  background: #482630;
}
.answer-mark {
  margin-left: auto;
}
.feedback {
  text-align: left;
  border-radius: 10px;
  background: #1c302c;
  border-left: 4px solid var(--green);
  padding: 16px;
  font-size: 14px;
}
.feedback.incorrect {
  background: #3c2534;
  border-left-color: var(--red);
}
.feedback strong {
  display: block;
  margin-bottom: 5px;
}
.question-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 60px;
  margin-top: 20px;
}
.keyboard-hint {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  margin-top: 20px;
}
.results {
  margin: 35px auto 0;
  text-align: center;
  max-width: 780px;
}
.result-star {
  font-size: 80px;
  line-height: 1.2;
  color: var(--yellow);
  filter: drop-shadow(0 6px 0 #a97418);
}
.results h2 {
  font-size: 32px;
  margin: 18px 0 5px;
}
.result-score {
  font-size: 48px;
  font-weight: 900;
  color: var(--yellow);
  margin: 8px;
}
.result-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 25px 0;
}
.breakdown {
  display: flex;
  justify-content: center;
  gap: 15px;
  font-size: 14px;
}
.breakdown p {
  background: #1c142d;
  border-radius: 8px;
  padding: 12px 18px;
}
.results details {
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.results ol {
  padding-left: 24px;
}
.results li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.results li p {
  margin: 6px 0;
}
.review-good {
  color: var(--green);
}
.review-wrong {
  color: var(--red);
}
#load-error,
#image-error {
  color: var(--red);
  font-size: 13px;
}
@media (max-width: 640px) {
  .wrap {
    padding: 0 18px;
  }
  .topbar {
    padding: 18px 0;
    font-size: 11px;
  }
  .hero {
    min-height: 0;
    padding: 32px 0;
    grid-template-columns: 1fr 0.65fr;
    gap: 0;
  }
  .hero-art {
    height: 230px;
    margin-left: -35px;
    pointer-events: none;
  }
  .hero-brawler {
    height: 210px;
    width: 95%;
  }
  .hero-left {
    left: -4%;
    top: 0;
  }
  .hero-right {
    display: none;
  }
  .art-sticker {
    left: 0;
    bottom: 5px;
    font-size: 10px;
    white-space: nowrap;
    padding: 5px 8px;
  }
  .orbit {
    inset: 25px 15px;
  }
  h1 {
    font-size: 57px;
  }
  .title-star {
    font-size: 0.45em;
    margin-left: 6px;
  }
  .intro {
    font-size: 14px;
  }
  .hero-tags {
    font-size: 9px;
    gap: 5px;
  }
  .hero-tags span {
    padding: 4px 6px;
  }
  .eyebrow {
    font-size: 10px;
  }
  .panel {
    padding: 20px;
    border-radius: 15px;
  }
  .mode-grid {
    gap: 8px;
  }
  .mode-card {
    padding: 13px 9px;
  }
  .mode-card input {
    right: 7px;
    top: 10px;
    width: 14px;
    height: 14px;
  }
  .mode-card strong {
    font-size: 13px;
  }
  .mode-card > span:last-child {
    font-size: 10px;
  }
  .mode-icon {
    font-size: 26px;
  }
  .settings-row {
    gap: 20px;
  }
  .start-row {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }
  .button {
    padding: 12px 17px;
  }
  .answers {
    gap: 9px;
  }
  .answer {
    padding: 12px 10px;
    font-size: 13px;
    gap: 8px;
  }
  .revision {
    padding: 16px;
  }
  summary > span {
    display: block;
    margin: 5px 0 0 18px;
  }
  .question-panel {
    padding: 22px 16px;
  }
  .question-actions {
    align-items: stretch;
    gap: 10px;
  }
  .question-actions .button {
    font-size: 13px;
  }
  .portrait-frame img {
    height: 190px;
  }
  .keyboard-hint {
    display: none;
  }
  .results h2 {
    font-size: 26px;
  }
}
@media (max-width: 370px) {
  h1 {
    font-size: 48px;
  }
  .hero-art {
    margin-left: -15px;
  }
  .answers {
    grid-template-columns: 1fr;
  }
  .hero-tags span:last-child {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px 8px;
  }
  .hero-copy {
    display: contents;
  }
  .hero-copy > .eyebrow {
    grid-column: 1 / -1;
    margin: 0;
  }
  .hero h1 {
    grid-column: 1;
    grid-row: 2;
    font-size: clamp(44px, 12vw, 70px);
    margin: 0;
  }
  .title-star {
    display: none;
  }
  .intro,
  .hero-tags {
    grid-column: 1 / -1;
    margin: 0;
  }
  .hero-art {
    grid-column: 2;
    grid-row: 2;
    height: 150px;
    margin: 0;
  }
  .hero-brawler {
    width: 100%;
    height: 140px;
  }
  .hero-left {
    left: 0;
    top: 0;
  }
  .art-sticker {
    left: -5%;
    bottom: 0;
    font-size: 9px;
  }
}
