:root {
  color-scheme: light;
  --background: #f6efd9;
  --paper: #fffaf0;
  --ink: #182821;
  --muted: #4e5b50;
  --line: #b4af96;
  --lime: #d6f24f;
  --red: #af392d;
  --green: #345445;
  --yellow: #ffe29b;
  --shadow: 5px 5px 0 var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  line-height: 1.55;
}

button {
  font: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

.shell {
  width: min(1100px, calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 2;
  inset: 12px auto auto 12px;
  padding: 8px 14px;
  transform: translateY(-200%);
  background: var(--paper);
  font-weight: 750;
}

.skip-link:focus {
  transform: none;
}

.site-header, .site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  min-height: 78px;
  padding-block: 14px;
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-size: 1.65rem;
  font-weight: 930;
  letter-spacing: -.075em;
}

.brand img {
  border-radius: 12px;
}

.brand-accent, .hero h1 span, .lesson-copy h2 span {
  color: var(--red);
}

.site-header nav, .site-footer nav, .hero-actions, .game-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.section-link {
  color: var(--green);
  font-weight: 760;
  text-decoration: underline;
  text-decoration-thickness: .09em;
  text-underline-offset: .24em;
}

.section-link:hover {
  color: var(--red);
}

.store-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 49px;
  padding: 10px 17px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--lime);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-weight: 830;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.store-button:hover {
  background: #e5f88a;
}

.store-button:active {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--ink);
}

.store-button-small {
  min-height: 44px;
  padding-inline: 13px;
  background: var(--paper);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  align-items: center;
  gap: clamp(32px, 6vw, 76px);
  padding-block: clamp(40px, 7vw, 108px);
}

.hero-label, .lesson-label {
  margin: 0 0 16px;
  color: var(--green);
  font-weight: 790;
}

.hero h1, .lesson-copy h2 {
  margin: 0;
  font-weight: 940;
  letter-spacing: -.057em;
  line-height: .96;
}

.hero h1 {
  font-size: clamp(2.85rem, 6vw, 5.7rem);
}

.hero h1 span {
  display: block;
}

.hero-description {
  max-width: 37ch;
  margin: 22px 0;
  font-size: clamp(1.06rem, 2vw, 1.25rem);
  line-height: 1.48;
}

.hero-facts {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 650;
}

.game-card {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 22px;
  padding: clamp(16px, 3vw, 25px);
  background: var(--paper);
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
}

.game-card h2 {
  margin: 0 0 11px;
  font-size: clamp(1rem, 2.2vw, 1.28rem);
  letter-spacing: -.02em;
  line-height: 1.3;
}

.character {
  display: grid;
  min-height: 121px;
  margin: 0 0 13px;
  padding: 8px 10px;
  place-items: center;
  border-radius: 13px;
  color: var(--paper);
  background: radial-gradient(circle at 80% 18%, #3b5948 0, #22392d 40%, var(--ink) 78%);
  text-shadow: 2px 3px 0 var(--red);
  font-family: "PingFang TC", "Hiragino Sans GB", "Noto Sans CJK TC", sans-serif;
  font-size: clamp(3.55rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
}

.character:focus-visible {
  outline-offset: 2px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 1.35vw, 11px);
}

.choice {
  position: relative;
  min-width: 0;
  min-height: 68px;
  padding: 2px;
  border: 2px solid var(--ink);
  border-radius: 11px;
  background: var(--background);
  color: var(--ink);
  cursor: pointer;
}

.choice:hover:not([aria-disabled="true"]) {
  background: var(--yellow);
  box-shadow: 0 2px 0 var(--ink);
}

.choice img {
  width: 100%;
  height: auto;
}

.choice[aria-disabled="true"] {
  cursor: default;
}

.choice[data-result="correct"] {
  border-color: var(--green);
  background: #e4edcb;
}

.choice[data-result="missed"] {
  border-color: var(--red);
}

.choice-mark:not(:empty) {
  position: absolute;
  inset: auto 3px 3px;
  padding: 2px;
  border-radius: 5px;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  font-size: .875rem;
  font-weight: 720;
}

.feedback {
  min-height: 1.55em;
  margin: 13px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.feedback b {
  color: var(--ink);
}

.game-actions {
  margin-top: 13px;
  gap: 10px 15px;
}

.replay {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.lesson-section {
  border-block: 1px solid var(--line);
  background: var(--paper);
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(26px, 6vw, 76px);
  align-items: center;
  padding-block: clamp(45px, 7vw, 90px);
}

.lesson-copy h2 {
  max-width: 12ch;
  font-size: clamp(2.5rem, 5.2vw, 4.5rem);
}

.lesson-copy p:not(.lesson-label) {
  max-width: 43ch;
  margin: 18px 0;
}

.screens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(12px, 2.5vw, 27px);
}

.screens figure {
  margin: 0;
}

.screens img {
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: clamp(10px, 2vw, 20px);
  background: var(--background);
  box-shadow: 3px 3px 0 var(--ink);
}

.screens figcaption {
  margin-top: 13px;
  color: var(--green);
  font-size: .875rem;
  font-weight: 720;
}

.site-footer {
  padding-block: 22px;
}

.site-footer p {
  flex: 1 1 260px;
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
}

.footer-brand {
  font-size: 1.13rem;
  font-weight: 850;
}

@media (max-width: 735px) {
  .shell {
    width: calc(100% - 34px);
  }

  .hero, .lesson-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-block: 30px 47px;
  }

  .hero h1 {
    font-size: clamp(2.8rem, 9.7vw, 4.5rem);
  }

  .hero-description {
    margin-block: 15px 17px;
  }

  .game-card {
    max-width: 535px;
  }

  .screens {
    width: min(100%, 440px);
  }
}

@media (max-width: 380px) {
  .site-header nav .section-link {
    display: none;
  }

  .hero-actions {
    gap: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
