:root {
  color-scheme: light;
  --navy: #172d48;
  --muted: #4a5d75;
  --yellow: #ffda6a;
  --line: #e8dec6;
  --paper: #fffdf7;
  font-family: Inter, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  color: var(--navy);
  background: #faf7ec;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid #2265ac; outline-offset: 3px; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: 24px; }
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 8px; align-items: center; font-size: 26px; font-weight: 850; letter-spacing: -1px; text-decoration: none; }
.brand img { border-radius: 50%; }
.brand b { color: #a36500; }
.cta { border: 1px solid #eac656; background: var(--yellow); padding: 8px 15px; border-radius: 999px; color: var(--navy); text-decoration: none; font-size: 14px; font-weight: 750; }
.intro {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 28px 0 24px;
  min-height: 142px;
  padding: 21px 34px;
  border: 1px solid #eed593;
  border-radius: 24px;
  background: radial-gradient(ellipse at right top, #ffdc73, transparent 58%), #fff1c9;
}
h1,h2,p { margin: 0; }
.intro h1 { font-size: clamp(29px, 4vw, 47px); line-height: 1.12; letter-spacing: -.035em; }
.intro p { margin-top: 9px; color: #4d4d49; }
.mascot { width: 126px; height: 126px; object-fit: contain; transform: rotate(4deg); }
.guide-layout { display: grid; grid-template-columns: 222px minmax(0,1fr); gap: 18px; align-items: start; }
.topics { display: grid; gap: 6px; margin-bottom: 10px; }
.topics a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 45px;
  padding: 9px 10px;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
  font-weight: 690;
}
.topics a span { color: #655528; font-size: 12px; font-variant-numeric: tabular-nums; }
.topics a[aria-current] { background: #ffebac; border-color: #dfb74c; font-weight: 800; }
.topics a:hover { border-color: #ac7d17; }
.lessons { min-width: 0; }
.lesson {
  scroll-margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  margin: 0 0 17px;
}
.lesson-head h2 { font-size: clamp(23px, 3.2vw, 32px); line-height: 1.22; letter-spacing: -.02em; }
.lesson-head p { margin-top: 7px; font-size: 15px; color: var(--muted); }
.lesson-body { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); align-items: start; gap: 20px; margin-top: 15px; }
.media { aspect-ratio: 1; position: relative; border: 1px solid #e7d8b5; background: #fff3d2; border-radius: 14px; overflow: hidden; }
.media video { width: 100%; height: 100%; display: block; }
.play {
  position: absolute; inset: 0; background: transparent; border: 0; cursor: pointer;
  display: flex; align-items: end; justify-content: start; padding: 13px; color: #fff;
}
.play span { min-height: 44px; display: grid; place-items: center; padding: 5px 13px; border: 2px solid #fff; border-radius: 999px; background: #173c61; box-shadow: 0 4px 11px #17335055; font-family: inherit; font-size: 14px; font-weight: 740; }
.play:focus-visible { outline-offset: -4px; }
.instructions :is(ol, ul) { margin: 0 0 14px; padding-left: 1.35em; }
.instructions li { color: #304863; margin-bottom: 7px; font-size: 15px; }
.instructions strong { color: var(--navy); }
.platforms { list-style: none; padding-left: 0 !important; }
.platforms strong { display: block; }
.example { background: #fff6d9; border-radius: 8px; padding: 8px 10px; margin-bottom: 11px; font-size: 14px; font-weight: 670; }
.image-open { display: flex; justify-content: space-between; gap: 12px; align-items: center; width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 9px; border: 1px solid #ead18b; background: #fff4d1; font-weight: 760; text-decoration: none; }
.image-open:hover { background: #ffebac; }
.image-open span:last-child { font-size: 22px; line-height: 1; }
.more { display: inline-block; margin-top: 11px; color: #225582; font-size: 14px; text-underline-offset: 3px; }
.back-to-topics { font-weight: 750; }
.footer { padding-block: 15px 30px; display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
#viewer {
  width: min(860px, calc(100% - 24px)); max-width: unset; max-height: 94vh; max-height: 94dvh;
  padding: 0; border: 0; border-radius: 14px; box-shadow: 0 18px 58px #07182d63;
  color: var(--navy);
}
#viewer::backdrop { background: #122840de; }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.viewer-head h2 { font-size: 16px; line-height: 1.25; }
.viewer-actions { flex: none; display: flex; gap: 6px; }
.viewer-actions button { cursor: pointer; min-height: 44px; background: #fff2c9; color: var(--navy); border: 1px solid #e6cd87; border-radius: 8px; padding-inline: 9px; font: inherit; font-size: 14px; white-space: nowrap; }
#image-stage { background: #fff8e9; overflow: auto; max-height: calc(94vh - 67px); max-height: calc(94dvh - 67px); overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
#image-stage img { display: block; width: 100%; height: auto; max-width: none; }
#image-stage.is-zoomed img { width: 200%; }
@media (max-width: 760px) {
  .wrap { padding-inline: 14px; }
  .topbar { min-height: 56px; }
  .intro { min-height: 116px; margin-block: 14px; padding: 13px 15px; border-radius: 17px; }
  .intro p { font-size: 14px; }
  .mascot { width: 82px; height: 82px; }
  .guide-layout { display: block; }
  .topics { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
  .topics a { min-height: 39px; font-size: 13px; gap: 5px; padding: 6px 8px; }
  .topics a span { font-size: 11px; }
  .lesson { padding: 12px; }
  .lesson-body { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
  .media, .instructions { width: 100%; }
  .instructions { display: flex; flex-direction: column; }
  .image-open { order: -1; margin-bottom: 9px; }
  .instructions :is(ol, ul) { margin-bottom: 6px; }
  .more { margin-top: 3px; }
}

/* Character sheet is displayed through crops so the original poses stay intact. */
.hamster {
  display: block;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  flex: none;
  mix-blend-mode: multiply;
  mask-image: radial-gradient(ellipse closest-side, #000 91%, transparent 139%);
}
.hamster::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("media/hamster-expressions.webp");
  background-repeat: no-repeat;
  background-size: 512% 341.333%;
  background-position: var(--pose-x) var(--pose-y);
  clip-path: polygon(var(--badge, 0%) 0, 100% 0, 100% 100%, 0 100%, 0 22%, var(--badge, 0%) 22%);
}
.p01 { --pose-x: 8%; --pose-y: 5.5%; --badge: 9%; }
.p02 { --pose-x: 39.8%; --pose-y: 5.7%; --badge: 7%; }
.p03 { --pose-x: 67.2%; --pose-y: 5.5%; --badge: 18%; }
.p04 { --pose-x: 96.4%; --pose-y: 5.0%; --badge: 14%; }
.p05 { --pose-x: 6.7%; --pose-y: 49.3%; --badge: 12%; }
.p06 { --pose-x: 38.2%; --pose-y: 49.3%; --badge: 11%; }
.p07 { --pose-x: 66.9%; --pose-y: 50.3%; --badge: 18%; }
.p08 { --pose-x: 96.4%; --pose-y: 49.8%; --badge: 16%; }
.p09 { --pose-x: 6.7%; --pose-y: 93.5%; --badge: 12%; }
.p10 { --pose-x: 37.4%; --pose-y: 93.2%; --badge: 9%; }
.p12 { --pose-x: 96.8%; --pose-y: 93.8%; --badge: 10%; }
.mascot-family { display: flex; flex: none; align-items: end; padding-right: 4px; }
.mascot-family .hamster { width: 151px; margin-inline: -8px; z-index: 1; }
.friend { width: 54px; aspect-ratio: 1; object-fit: contain; }
.hero-green { transform: rotate(-13deg) translateY(-8px); }
.hero-purple { transform: rotate(13deg) translateY(-7px); }
.intro { background: linear-gradient(108deg, #fff5d4 18%, #ffedbb 66%, #ffe29a); }
.intro > div:first-child { min-width: 0; }
.topic-group { display: grid; gap: 7px; margin-bottom: 8px; }
.topic-label { padding-left: 4px; font-size: 13px; color: var(--muted); font-weight: 750; }
.topic-links { display: grid; gap: 5px; }
.topics a { min-height: 40px; }
.lesson { --tint: #fff4d3; --edge: #eddbac; }
.lesson.sky { --tint: #edf5ff; --edge: #d9e6f4; }
.lesson.mint { --tint: #ecf6e7; --edge: #d5e6d0; }
.lesson.lilac { --tint: #f4effc; --edge: #e7def5; }
.lesson.peach { --tint: #fff1e4; --edge: #f3dfca; }
.lesson-head {
  position: relative;
  isolation: isolate;
  min-height: 98px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 117px 13px 15px;
  background: var(--tint);
  border: 1px solid var(--edge);
  border-radius: 13px;
}
.lesson-head h2 { text-wrap: pretty; }
.keep-together { display: inline-block; }
.lesson-hamster { position: absolute; right: 9px; bottom: 6px; width: 87px; }
.lesson-friend { position: absolute; right: 77px; bottom: 10px; width: 35px; transform: rotate(-10deg); }
.lesson-note { background: var(--tint); border: 1px solid var(--edge); padding: 9px 10px; border-radius: 8px; margin: 0 0 11px; color: #304863; font-size: 14px; }
@media (max-width: 760px) {
  .intro { min-height: 106px; }
  .intro h1 { font-size: clamp(22px,6.1vw,27px); }
  .intro p { text-wrap: pretty; }
  .mascot-family .hamster { width: clamp(52px, 21vw, 100px); margin-inline: -4px; }
  .mascot-family .friend { width: clamp(17px, 6vw, 29px); }
  .mascot-family { padding-right: 0; }
  .topics { display: grid; gap: 8px; }
  .topic-group { gap: 5px; margin: 0; }
  .topic-links { display: flex; flex-wrap: wrap; gap: 5px; }
  .topics a { min-height: 35px; }
  .lesson-head { min-height: 86px; padding: 10px 73px 11px 11px; }
  .lesson-hamster { width: 64px; right: 6px; bottom: 6px; }
  .lesson-friend { width: 24px; right: 53px; bottom: 5px; }
  .lesson-head p { font-size: 14px; }
}
