:root {
  --forest: #244f3f;
  --forest-dark: #183c2e;
  --cream: #f8f6ee;
  --border: #c8d0bf;
  --muted: #485f52;
}
[hidden] { display: none !important; }
html { scroll-padding-top: 5rem; }
body { background: var(--cream); }
.wrap { max-width: 1200px; padding-right: clamp(1rem,4vw,3rem); padding-left: clamp(1rem,4vw,3rem); }
.site-head { background: #f9f8f0; border-color: #c7cdbc; }
.site-head .wrap { height: 4.25rem; }
.brand { font-size: 1.3rem; font-weight: 650; gap: .6rem; }
.brand .mark { width: 1.9rem; height: 1.9rem; flex-basis: 1.9rem; }
.nav { font-size: 1.03rem; gap: clamp(1.3rem,3vw,2.7rem); color: #364b3f; }
.mini-dl { font-size: 1rem; font-weight: 600; padding: .35rem 1rem; }
.hero { background: #19392e; isolation: isolate; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(90deg,rgba(15,43,33,.98),rgba(16,44,32,.91) 39%,rgba(17,45,34,.62) 70%,rgba(17,40,30,.57)),
  url('assets/library.jpg') center 48% / cover no-repeat; }
.hero::after { opacity: .04; z-index: -1; }
.hero .wrap { padding-top: clamp(2.1rem,4.2vw,4rem); padding-bottom: clamp(2.4rem,4.5vw,4.5rem); }
.hero h1 { font-family: 'Noto Serif CJK SC',var(--serif); font-size: clamp(2.85rem,5.3vw,4.8rem); line-height: 1.22; color: #fff8e4; }
.hero-lede { font-size: clamp(1.04rem,1.7vw,1.25rem); color: #e4ede1; margin-top: 1.1rem; }
.hero-actions { gap: .65rem; }
.btn { font-size: 1rem; font-weight: 600; justify-content: center; min-height: 2.85rem; padding: .55rem 1.3rem; }
.btn-primary { background: #e0bd77; color: #21352a; border-color: #e0bd77; }
.btn-primary:hover { background: #edce93; }
.btn-ghost { border-color: #899f8c; color: #fff8e4; }
.stack { width: min(100%, 25rem); max-width: none; }
.stack .sheet { border-radius: 18px; pointer-events: none; }
#hero-card { position: relative; min-height: 20rem; transform: rotate(-1deg); }
#hero-card .kc-source { display: none; }
.sec { padding: clamp(2.5rem,5vw,4.7rem) 0; }
.sec-head { margin-bottom: 1.25rem; }
.sec-head h2 { color: #254b3b; font-size: clamp(1.85rem,3.1vw,2.65rem); font-family: 'Noto Serif CJK SC',var(--serif); }
.card-demo { background: var(--card-2); }
.course-picker { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: .8rem 1.5rem; border-top: 1px solid var(--line); padding-top: .85rem; }
.course-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.course-group legend { padding: 0; margin-bottom: .35rem; color: var(--muted); font-weight: 600; }
.subject-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.course-group:nth-child(2) .subject-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.subject-group button {
  min-height: 2.65rem;
  padding: .45rem .4rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fffaf0;
  color: #253d2e;
  cursor: pointer;
  font: 550 1rem/1.35 var(--sans);
}
.subject-group button:hover { background: #edf0e7; }
.subject-group button[aria-pressed="true"] { border-color: var(--forest); background: var(--forest); color: #fff8e7; }
.demo-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .15rem 1rem; margin-block: .85rem 1rem; color: var(--muted); }
.sample-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.8rem, 1.8vw, 1.3rem); }
.sample-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(.75rem, 1.75vw, 1.25rem);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--card);
}
.sample-header { display: flex; justify-content: space-between; align-items: center; gap: .7rem; min-height: 2.5rem; margin-bottom: .7rem; }
.sample-header h3 { display: flex; align-items: center; gap: .55rem; font-size: clamp(1.2rem, 2.1vw, 1.45rem); line-height: 1.25; }
.sample-header h3::before { content: ''; width: .55rem; height: .55rem; flex: none; border-radius: 50%; background: var(--kc-accent, #2e7d6f); }
.sample-stage { position: relative; flex: 1; display: flex; flex-direction: column; padding: clamp(.4rem, 1.1vw, .85rem); border: 1px dashed var(--line); border-radius: 3px; background: var(--card-2); }
.sample-stage .kc-card { flex: 1; min-height: var(--sample-height, 18rem); }
.sample-stage .sample-measure { position: absolute; top: 0; left: 0; min-height: 0; visibility: hidden; }
.sample-stage .kc-card-type { display: none; }
.sample-next { border: 1px solid var(--line); background: #fffaf0; color: #244e37; border-radius: 4px; cursor: pointer; padding: .3rem .7rem; min-height: 2.35rem; font: inherit; white-space: nowrap; }
.sample-next:hover { border-color: var(--forest); background: #f6f4e9; }
.text-link { color: #315e43; font-weight: 600; text-underline-offset: .22rem; font-size: 1rem; }
#uses { background: #eff1e7; }
.use .desc,.chip { font-size: 1rem; }
.use h3 { font-size: 1.2rem; }
.download { display: flex; min-height: calc(100svh - 9.5rem); color: #f2efdf; background: radial-gradient(ellipse at 50% 36%, #2e5342, #193d30 67%); }
.download > .wrap { width: 100%; display: flex; flex-direction: column; }
.download .sec-head { max-width: none; margin: 0; padding-bottom: 1rem; border-bottom: 1px solid #627b6a; }
.download .sec-head h2 { color: #faf4df; }
.download-stage { flex: 1; display: grid; align-content: center; justify-items: center; text-align: center; padding: clamp(2.4rem, 5vw, 4.5rem) 0 clamp(1.8rem, 4vw, 3.3rem); }
.download-subject { position: relative; display: inline-flex; max-width: 100%; align-items: center; gap: .65rem; min-height: 2.75rem; padding: 0 .15rem; }
#download-title { color: #fff8e7; font: 600 clamp(1.6rem, 4vw, 3.1rem)/1.32 'Noto Serif CJK SC', var(--serif); }
.download-subject::after { content: ''; width: .54rem; height: .54rem; flex: none; border: solid #e5c68d; border-width: 0 2px 2px 0; transform: translateY(-.15rem) rotate(45deg); }
.download-subject select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: 1rem var(--sans); }
.package-button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; max-width: 100%; min-height: 3.7rem; margin-top: 1.35rem; padding: .65rem clamp(1.6rem, 4vw, 3rem); border-radius: 3rem; color: #183a2c; background: #f5e7be; box-shadow: 0 5px 14px #10291f55; font: 650 clamp(1.25rem, 2.3vw, 1.65rem)/1.3 var(--sans); text-decoration: none; }
.package-button svg { flex: none; }
.package-button:hover { background: #fff1cb; }
.package-button:active { background: #e6d4a7; }
.package-status { margin-top: 1.35rem; color: #d6ded8; font: 550 1.15rem/1.5 var(--sans); }
.download-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .25rem 1rem; min-height: 1.5em; margin-top: .65rem; color: #d4dfd2; font-size: 1rem; line-height: 1.5; }
.download-secondary { padding: .25rem .1rem; border: 0; background: transparent; color: #f4e8c5; font: inherit; text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }
.download-secondary:focus-visible { outline: 2px solid #f1d594; outline-offset: 3px; }
.devices { display: flex; justify-content: center; align-items: center; gap: clamp(.75rem, 3.4vw, 2.8rem); margin: clamp(1.6rem, 3.5vw, 2.9rem) 0 0; min-width: 0; max-width: 100%; padding: 0; border: 0; }
.devices label { position: relative; }
.devices input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.devices span { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.85rem; padding: .35rem .2rem; border-bottom: 2px solid transparent; color: #e7eee7; font: 550 1.075rem/1.25 var(--sans); cursor: pointer; }
.devices img { flex: none; object-fit: contain; filter: invert(92%); }
.devices input:checked + span { color: #fff5d8; border-color: #e6c382; }
.devices input:checked + span img { filter: invert(100%); }
.devices label:hover input:enabled + span { border-color: #e6c382; }
.devices input:disabled + span { color: #a7aaa9; cursor: default; }
.devices input:disabled + span img { filter: invert(66%); }
.download-subject:focus-within, .devices input:focus-visible + span, .download a:focus-visible { outline: 2px solid #f1d594; outline-offset: 4px; }
.foot { font-size: 1rem; }
@media (max-width: 700px) {
  .site-head .wrap { height: 3.55rem; }
  .hero .wrap { display: flex; flex-direction: column; gap: 1.6rem; }
  .hero h1 { font-size: clamp(2.45rem,9.6vw,3.5rem); }
  .hero::before { background-position: center; }
  .stack { width: min(86vw,25rem); margin-bottom: .4rem; }
}
@media (max-width: 880px) {
  .course-picker { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .sample-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .subject-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .devices { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .25rem; width: 100%; max-width: 21rem; }
  .devices span { flex-direction: column; gap: .38rem; min-width: 4rem; min-height: 3.8rem; font-size: 1rem; }
  .devices img { height: 1.5rem; }
}
