* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --canvas: #f5f6ee;
  --paper: #fffef9;
  --ink: #20382d;
  --text: #40554a;
  --muted: #52665a;
  --green: #315942;
  --line: #d9e2d3;
  --tint: #eaf0e2;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.65;
  color: var(--ink);
  background: var(--canvas);
}
body { margin: 0; }
:lang(th) { font-family: Tahoma, "Leelawadee UI", sans-serif; }
:lang(ja) { overflow-wrap: anywhere; }
p, h1, h2, ul, dl, dd { margin: 0; }
a { text-decoration: none; color: inherit; }
select, button { font: inherit; }
select, button, summary { cursor: pointer; }
svg { vertical-align: middle; flex: none; }
:focus-visible { outline: 3px solid #926435; outline-offset: 3px; }
.shell { width: min(100% - 40px, 1000px); margin-inline: auto; }
.narrow { width: min(100% - 36px, 660px); }
.loading { padding-block: 45px; }
.skip { position: absolute; z-index: 2; top: -200px; padding: 7px 13px; border-radius: 7px; background: var(--paper); }
.skip:focus { top: 6px; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.top-inner, .header-right { display: flex; align-items: center; gap: 10px; }
.top-inner { justify-content: space-between; min-height: 63px; }
.header-right { justify-content: flex-end; flex-wrap: wrap; gap: 4px 12px; }
.brand { display: inline-flex; align-items: center; gap: 7px; flex: none; font-size: 1.15rem; font-weight: 850; white-space: nowrap; }
.brand img { width: 34px; height: 34px; }
.back { display: inline-flex; align-items: center; min-height: 42px; gap: 5px; color: var(--green); font-weight: 750; font-size: .9rem; white-space: nowrap; }
.back:hover { text-decoration: underline; }
.language { display: inline-flex; align-items: center; gap: 3px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding-inline: 7px; min-height: 40px; color: var(--green); }
.language select { border: 0; background: transparent; color: var(--ink); min-height: 36px; max-width: 135px; font-size: .82rem; font-weight: 700; }
.landing, .board-page, .narrow { padding-block: 26px 42px; }
.hero { display: grid; grid-template-columns: 1fr minmax(170px, 31%); align-items: center; overflow: hidden; min-height: 209px; padding: 9px 20px 9px clamp(21px, 5vw, 49px); border: 1px solid #d7e3d1; border-radius: 22px; background: #e7efde; }
.eyebrow { color: #375945; font-size: .84rem; font-weight: 800; }
.eyebrow span { margin-inline: 2px; }
.hero h1 { font-size: clamp(2.08rem, 5.3vw, 4rem); letter-spacing: -.055em; line-height: 1.15; margin-block: 10px 13px; }
.intro { color: var(--text); font-size: clamp(.92rem, 1.8vw, 1.06rem); }
.hero-art { width: 100%; max-height: 206px; object-fit: contain; }
.sets { margin-top: 23px; }
.sets h2 { font-size: 1.23rem; margin-bottom: 9px; }
.set-list { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0; }
.set-link { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; min-height: 68px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); transition: background .16s, border .16s; }
.set-link:hover { border-color: #9aaf98; background: #f3f7ef; }
.set-name { font-size: clamp(1rem, 2vw, 1.13rem); font-weight: 850; }
.set-link > svg { color: var(--green); }
.set-pill { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; width: max-content; border-radius: 8px; padding: 4px 10px; font-size: .83rem; font-weight: 850; }
.tone-A { background: #e2efda; color: #36543d; }
.tone-B { background: #f1e9cb; color: #614f29; }
.tone-C { background: #f1e1d5; color: #684932; }
.tone-D { background: #dfeae9; color: #365553; }
.tone-E { background: #e9e2ed; color: #584561; }
.tone-H { background: #e8e7f1; color: #4f4a69; }
.tone-I { background: #f3e5e1; color: #704f46; }
.help { margin-top: 15px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; background: var(--paper); }
.help summary { padding-block: 10px; font-weight: 750; }
.help ol { margin: 0 0 12px; padding-left: 1.5em; }
.help li + li { margin-top: 5px; }
.grammar-help { border-top: 1px solid var(--line); }
.grammar-help dl { padding-bottom: 11px; }
.grammar-help dl > div + div { margin-top: 8px; }
.grammar-help dt { font-weight: 800; }
.grammar-help dd { color: var(--text); }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 13px; }
.page-title h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.2; letter-spacing: -.045em; margin: 5px 0 1px; }
.page-title p { color: var(--text); font-weight: 700; }
.portrait { width: 65px; height: 65px; }
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 15px clamp(12px, 3vw, 22px); }
.metadata { display: grid; grid-template-columns: 1.2fr .65fr 1.1fr; gap: 5px; border-radius: 10px; padding: 9px 11px; background: var(--tint); }
.metadata dt { font-size: .78rem; color: var(--muted); font-weight: 750; }
.metadata dd { font-weight: 800; font-size: 1.05rem; }
.card-instruction { margin-top: 12px; color: var(--text); }
.facts { margin-top: 8px; border-block: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: .95fr 1.35fr; gap: 6px 11px; padding: 8px 2px; align-items: baseline; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-weight: 750; }
.facts dd { font-weight: 820; font-size: 1.05rem; }
rt { font-size: .57em; color: var(--muted); font-weight: 650; }
.btn { display: inline-flex; gap: 6px; min-height: 44px; justify-content: center; align-items: center; border: 1px solid #a7baa6; border-radius: 9px; padding: 7px 12px; background: var(--paper); color: var(--ink); font-size: .9rem; font-weight: 800; text-align: center; }
.btn:hover:not(:disabled) { background: #eef4e9; }
.btn.primary { background: var(--green); border-color: var(--green); color: white; }
.btn.primary:hover:not(:disabled) { background: #254735; }
.btn:disabled { cursor: default; opacity: .55; }
.board-page { width: min(100% - 42px, 1140px); }
.board { background: #fffdf7; }
.entry-heading { display: flex; justify-content: space-between; gap: 7px 12px; align-items: center; flex-wrap: wrap; padding: 11px 0 9px; }
.entry-heading p { color: var(--text); }
.record-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; }
.progress-stamps { display: flex; gap: 3px; }
.progress-stamp { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 6px; border: 1px dashed #aebfb0; background: #f4f6ef; color: #31593b; }
.progress-stamp.is-entered { border-style: solid; background: #e0ecd9; }
.progress-stamp.is-matched { border-style: solid; border-color: #83a782; background: #d9ebd0; }
.progress-stamp.needs-retry { border-style: solid; border-color: #cc9b64; background: #fae8d2; color: #6b4a22; }
.count { color: var(--green); font-size: .9rem; font-variant-numeric: tabular-nums; }
.board-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.board-row { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding: 9px; border: 1px solid #d6e0d1; border-radius: 12px; background: #fbfcf6; }
.board-label { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.board-label h2 { font-size: 1.05rem; font-weight: 850; }
.board-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; }
.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  min-height: 105px;
  padding: 3px 3px 6px;
  border: 1px solid #c0d0bf;
  border-radius: 9px;
  background: #fffef9;
  color: var(--ink);
  line-height: 1.44;
  font-weight: 750;
  font-size: clamp(.83rem, 1.45vw, 1.02rem);
  transition: background-color 160ms, border-color 160ms, box-shadow 160ms, transform 160ms;
}
.choice:not(:disabled):hover { border-color: #83a584; background: #f5f9ef; transform: translateY(-2px); box-shadow: 0 3px 0 #e0eadc; }
.choice:not(:disabled):active { transform: translateY(1px); box-shadow: none; }
.choice[aria-pressed="true"] { border-color: #719678; background: #eaf4e6; box-shadow: inset 0 0 0 1px #86a88a; }
.choice:disabled { opacity: 1; cursor: default; }
.choice:disabled[aria-pressed="false"] { color: #4c6156; }
.artwell { display: grid; place-items: center; min-height: 55px; height: clamp(54px, 6.35vw, 69px); border-radius: 6px; background: #f3f4e9; }
.choice:nth-child(2) .artwell { background: #f5f0e4; }
.choice:nth-child(3) .artwell { background: #edf1eb; }
.choice[aria-pressed="true"] .artwell { background: #dcebd6; }
.choice-art { display: block; width: 100%; max-width: 122px; height: 100%; }
.choice-title { display: grid; place-items: center; flex: 1; text-align: center; line-height: 1.57; padding-inline: 3px; }
.choice-pin { position: absolute; right: 6px; top: 6px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #315942; color: #fff; }
.room-map { gap: 3px; }
.room-map .choice { border-radius: 8px 8px 3px 3px; border-bottom-style: dashed; }
.map-hall { min-height: 17px; display: grid; place-items: center; background: #eee9db; color: #625744; border: 1px solid #e2d9c5; border-radius: 3px 3px 6px 6px; font-size: .68rem; font-weight: 750; letter-spacing: .04em; }
.field-match { border-color: #a6c0a4; background: #f3f8ee; }
.field-retry { border-color: #c8a273; background: #fcf5e8; }
.field-feedback { display: inline-flex; align-items: center; gap: 3px; border-radius: 7px; background: #e4f0de; color: #31543b; padding: 2px 5px; font-size: .77rem; font-weight: 800; }
.field-retry .field-feedback { background: #f3e3cb; color: #6b4a22; }
.field-feedback.field-entered { color: #415b4c; background: #edf1e8; }
.choice-tapped .choice-art { animation: choice-tap 280ms ease-out both; }
.stamp-in { animation: stamp-in 340ms cubic-bezier(.2,.7,.35,1.3) both; }
.board-row:nth-child(2) .stamp-in, .progress-stamp:nth-child(2).stamp-in { animation-delay: 40ms; }
.board-row:nth-child(3) .stamp-in, .progress-stamp:nth-child(3).stamp-in { animation-delay: 75ms; }
.board-row:nth-child(4) .stamp-in, .progress-stamp:nth-child(4).stamp-in { animation-delay: 105ms; }
@keyframes choice-tap { 0% { transform: scale(.91); } 58% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes stamp-in { 0% { transform: translateY(-5px) scale(.82); opacity: .35; } 100% { transform: none; opacity: 1; } }
.heard { margin: 9px 0 0; border: 1px solid var(--line); border-radius: 9px; padding: 2px 7px 5px; min-width: 0; }
.heard legend { font-size: .83rem; font-weight: 750; color: var(--text); padding-inline: 4px; }
.grammar-ticks { display: flex; gap: 2px 5px; flex-wrap: wrap; }
.grammar-ticks label { display: inline-flex; align-items: center; gap: 4px; min-height: 38px; padding: 3px 7px; font-size: .85rem; cursor: pointer; border-radius: 6px; }
.grammar-ticks label:has(:checked) { background: #e4f0de; }
input[type="checkbox"] { accent-color: var(--green); }
.board-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px 11px; margin-top: 9px; }
.board-footer > .primary { margin-inline-start: auto; }
.notice.good { position: relative; isolation: isolate; display: flex; align-items: center; gap: 8px; color: #275238; }
.done-icon { display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: #477653; }
.celebrate .done-icon { animation: stamp-in 440ms cubic-bezier(.2,.65,.35,1.3) both; }
.confetti { position: absolute; z-index: -1; top: 50%; left: 19px; pointer-events: none; }
.confetti i { position: absolute; inset: 0 auto auto 0; width: 6px; height: 4px; border-radius: 2px; background: #c79f54; opacity: 0; animation: confetti-out 760ms ease-out both; }
.confetti i:nth-child(1) { --x: -19px; --y: -29px; --turn: -120deg; }
.confetti i:nth-child(2) { --x: 10px; --y: -38px; --turn: 105deg; background: #8bb887; }
.confetti i:nth-child(3) { --x: 26px; --y: -31px; --turn: 72deg; background: #e6ab89; }
.confetti i:nth-child(4) { --x: 46px; --y: -34px; --turn: 170deg; }
.confetti i:nth-child(5) { --x: 43px; --y: 30px; --turn: 150deg; background: #8bb887; }
.confetti i:nth-child(6) { --x: 18px; --y: 30px; --turn: 160deg; }
.confetti i:nth-child(7) { --x: -17px; --y: 23px; --turn: -150deg; background: #e6ab89; }
.confetti i:nth-child(8) { --x: -22px; --y: 4px; --turn: -75deg; background: #8bb887; }
@keyframes confetti-out {
  0% { opacity: 0; transform: scale(.4); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--turn)); }
}
.notice.good h2 { font-size: 1.15rem; }
.notice.retry { color: #694821; font-weight: 750; }
.notice p, .storage-note { font-size: .88rem; }
.storage-note { color: #694821; margin-bottom: 4px; }
@media (max-width: 880px) {
  .set-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .shell { width: calc(100% - 24px); }
  .landing, .board-page, .narrow { padding-top: 15px; padding-bottom: 27px; }
  .set-list { grid-template-columns: 1fr; }
  .set-link { min-height: 54px; }
  .hero { min-height: 159px; padding-left: 14px; grid-template-columns: 1fr minmax(78px, 27%); }
  .hero h1 { font-size: clamp(1.57rem, 6.7vw, 2.5rem); }
  .metadata dd { font-size: .9rem; }
  .board-fields { grid-template-columns: 1fr; }
  .facts > div { grid-template-columns: 1fr; gap: 0; padding-block: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .choice, .set-link { transition: none; }
  .choice:not(:disabled):hover, .choice:not(:disabled):active { transform: none; }
  .choice-tapped .choice-art, .stamp-in, .celebrate .done-icon, .confetti i { animation: none; }
  .confetti { display: none; }
}
@media (max-width: 380px) {
  .top-inner { gap: 4px; }
  .brand { font-size: .96rem; gap: 3px; }
  .brand img { width: 29px; height: 29px; }
  .language select { max-width: 75px; }
  .back { font-size: .77rem; }
}
@media print {
  body { background: #fff; }
  .topbar, .skip { display: none !important; }
  #app .shell { width: 100%; }
  .student-card, .facts > div { break-inside: avoid; }
  .student-card { padding: 10px 16px; }
}

