@font-face { font-family: "OB Wordmark"; font-weight: 700; font-display: block; src: url(assets/ZenMaruGothic-700-latin.woff2) format("woff2"); }

:root {
  --sc-canvas:     #BEDCF1;
  --sc-surface:    #FFFFFF;
  --sc-ink:        #183C50;
  --sc-ink-soft:   #526773;
  --sc-accent:     #B94C30;
  --sc-accent-ink: #FFFFFF;
  --sc-font-display: "Noto Sans TC", "PingFang TC", "PingFang HK", system-ui, sans-serif;
  --sc-font-text:    "Noto Sans TC", "PingFang TC", "PingFang HK", system-ui, sans-serif;
  --sc-shadow-color: 205 25% 35%;

  --kb-bg: #E3E4E9;
  --kb-key: #FEFDFB;
  --kb-mod: #C3BDB3;
  --kb-letter: #1A1917;
  --kb-radical: #B0603F;
  --kb-accent: #2C5FCB;
  --kb-soft: rgba(30, 28, 25, .5);
  --field-bg: rgba(255, 255, 255, .94);
  --caret: #237F8C;
  --chrome-h: 80px;
  --keys-font: -apple-system, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
}

body {
  background:
    radial-gradient(65rem 50rem at 15% 0%, #E0F0FB, transparent 72%),
    linear-gradient(155deg, #CBE4F6 0%, #BEDCF1 48%, #A8CCE8 100%) fixed;
  letter-spacing: .01em;
  line-height: 1.7;
}
em { font-style: normal; color: var(--sc-accent); }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--sc-accent); outline-offset: 3px; border-radius: 8px;
}
.wordmark { font-family: "OB Wordmark", ui-rounded, var(--sc-font-display); font-weight: 700; letter-spacing: -0.035em; }

/* ---------------------------------------------------------------- chrome -- */
.chrome {
  position: fixed; inset: 0 0 auto 0; z-index: var(--sc-z-chrome); height: var(--chrome-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sc-4);
  padding: 0 var(--sc-gutter);
  background: rgba(213, 234, 249, .88);
  -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid rgba(24, 60, 80, .08);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 50px; height: 50px; border-radius: 13px; box-shadow: var(--sc-e1); }
.brand__text { display: flex; flex-direction: column; gap: 5px; line-height: 1.15; }
.brand .wordmark { font-size: 1.5rem; }
.brand__sub { font-size: .9rem; color: var(--sc-ink-soft); letter-spacing: .04em; }
/* Open text navigation, with a separate entry to the live keyboard. */
.tabs { display: flex; align-items: center; gap: clamp(12px, 1.8vw, 28px); }
.tabs a {
  position: relative; padding: 10px 0; font-size: .95rem; font-weight: 500;
  text-decoration: none; color: var(--sc-ink-soft); white-space: nowrap;
  transition: color 160ms var(--sc-ease-out);
}
.tabs a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 2px;
  background: #237F8C; transform: scaleX(0); transform-origin: left;
  transition: transform 160ms var(--sc-ease-out);
}
.tabs a[aria-current="true"] { color: var(--sc-ink); }
.tabs a[aria-current="true"]::after { transform: scaleX(1); }
.tabs a.tabs__try {
  padding: 9px 20px; margin-left: 8px; border-radius: 10px;
  background: linear-gradient(135deg, #C65A3D, #B64332); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(167, 66, 44, .2), inset 0 1px 0 rgba(255,255,255,.2);
  transition: background 160ms ease, box-shadow 160ms ease;
}
.tabs a.tabs__try::after { content: none; }
@media (hover: hover) and (pointer: fine) {
  .tabs a:hover { color: var(--sc-ink); }
  .tabs a:hover::after { transform: scaleX(1); }
  .tabs a.tabs__try:hover { background: #A9402E; color: #fff; box-shadow: 0 5px 15px rgba(167, 66, 44, .28); }
}
.tabs a:active { transform: translateY(1px); }

/* --------------------------------------------------------- the type act -- */
.stage {
  display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 34rem);
  justify-content: center;
  align-items: center; gap: clamp(2rem, 4vw, 4rem);
  padding: calc(var(--chrome-h) + var(--sc-5)) var(--sc-gutter) var(--sc-6);
  overflow: hidden;
}
.radicals { position: absolute; inset: 0; pointer-events: none; }
.radicals span {
  position: absolute; left: var(--x); top: var(--y);
  font-size: calc(clamp(5rem, 11vw, 10rem) * var(--s)); font-weight: 700; line-height: 1;
  color: #237F8C; opacity: .07;
  transform: translate3d(calc(var(--mx, 0) * var(--d) * -28px), calc((var(--sc-p, 0) * -140px - var(--my, 0) * 20px) * var(--d)), 0);
  filter: blur(calc((1 - var(--d)) * 3px));
}
.panel { position: relative; height: min(34rem, 70vh); align-self: center; }
.note { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: var(--sc-4); max-width: 30rem; }
.hero-brand { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 900; letter-spacing: .01em; color: var(--sc-ink); }
.hero-brand img { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 8px 18px -8px rgba(24, 60, 80, .5); }
.hero-title > em { color: var(--kb-accent); }
.hero-title__line2 em { position: relative; display: inline-block; isolation: isolate; }
.hero-title__line2 em::after {
  content: ""; position: absolute; z-index: -1; left: -.06em; right: -.06em; bottom: .02em; height: .3em;
  border-radius: 999px; background: rgba(185, 76, 48, .3); transform-origin: left center;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-title__line2 em::after { transform: scaleX(0); animation: swipe-trail .7s cubic-bezier(.3, .7, .2, 1) .6s forwards; }
}
@keyframes swipe-trail { to { transform: scaleX(1); } }
.hero-title__line2 { font-size: .74em; font-weight: 700; letter-spacing: .02em; }
.hero-title { margin: 0; font-size: clamp(2.3rem, 1.5rem + 3vw, 4.2rem); line-height: 1.32; font-weight: 900; letter-spacing: .01em; text-wrap: balance; }
.hero-body { margin: 0; font-size: var(--sc-t-lg); color: #415D6D; max-width: 24em; text-wrap: pretty; }
.note__label { margin: 0; font-size: var(--sc-t-sm); color: var(--sc-ink-soft); letter-spacing: .12em; }
.note__big { margin: 0; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.6rem); font-weight: 900; line-height: 1.15; letter-spacing: .01em; text-wrap: balance; }
.note--quiet .note__big { font-weight: 500; color: #415D6D; }
.note__line { margin: 0; font-size: var(--sc-t-lg); color: #415D6D; max-width: 26em; text-wrap: pretty; }
.status { margin: var(--sc-2) 0 0; display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.status__n { font-size: clamp(3rem, 2rem + 4vw, 5.5rem); font-weight: 900; line-height: 1; color: var(--sc-accent); min-width: 1.2ch; }
.status__unit { font-size: var(--sc-t-xl); color: var(--sc-ink-soft); }

.store-badge { display: inline-flex; align-self: flex-start; text-decoration: none; border-radius: 10px; }
.store-badge img { display: block; width: 180px; height: auto; }
.store-badge[aria-disabled="true"] { cursor: default; }

/* ------------------------------------------------------------ surface -- */
.surface, .try-surface { position: relative; container-type: inline-size; width: 100%; }
.surface { justify-self: end; }
.field {
  position: relative; z-index: 1; display: flex; align-items: center; min-height: 15cqw;
  padding: 0 6cqw; border-radius: 7cqw; background: var(--field-bg);
  border: 1.5px solid rgba(24, 60, 80, .18); box-shadow: var(--sc-e3);
  font-size: 7.2cqw; line-height: 1; white-space: nowrap; overflow: hidden;
}
.field__text { display: inline-flex; }
.field__text .ch { display: inline-block; transform-origin: 50% 80%; }
.field__text .latin { font-family: var(--keys-font); }
.caret { display: inline-block; width: .5cqw; min-width: 2px; height: 8cqw; margin-left: 1cqw; background: var(--caret); border-radius: 2px; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.field__placeholder { position: absolute; left: 8cqw; color: rgba(65, 93, 109, .7); font-size: 4.6cqw; pointer-events: none; }
.field--live:not(.has-text) .caret { margin-left: 0; }
.field--live.has-text .field__placeholder { display: none; }

.kb {
  --pad: 1.6cqw; --gap: 1.35cqw;
  --kw: calc((100cqw - 2 * var(--pad) - 9 * var(--gap)) / 10);
  --kh: calc(var(--kw) * 1.3);
  position: relative; z-index: 3; margin-top: 4.5cqw; border-radius: 5.5cqw; background: var(--kb-bg);
  padding: 0 var(--pad) calc(var(--pad) * 2); box-shadow: var(--sc-e3), inset 0 1px 0 rgba(255, 255, 255, .7);
  color: var(--kb-letter); font-family: var(--keys-font); user-select: none; -webkit-user-select: none;
  transition: opacity 220ms var(--sc-ease-out), filter 220ms var(--sc-ease-out);
}
.kb.is-dim { opacity: .38; filter: saturate(.6); }
.kb-bar { position: relative; height: 11cqw; display: flex; align-items: center; }
.kb-idle { position: absolute; left: 2cqw; top: 0; bottom: 0; display: flex; align-items: center; gap: 1.6cqw; font-size: 3.6cqw; white-space: nowrap; }
.kb-idle .kb-name { color: var(--kb-accent); }
.kb-idle .kb-mode { color: var(--kb-soft); font-family: var(--sc-font-text); display: inline-grid; }
.kb-mode span { grid-area: 1 / 1; }
.kb-code { position: absolute; left: 2.2cqw; top: .6cqw; font-size: 2.2cqw; line-height: 1; color: var(--kb-accent); letter-spacing: .1em; font-family: var(--sc-font-text); }
.kb-cands { position: absolute; left: 0; right: 9cqw; top: 1.4cqw; bottom: 0; display: flex; align-items: center; gap: .6cqw; overflow: hidden; }
.kb-cand {
  flex: none; border: 0; background: none; padding: 1.2cqw 2.4cqw; border-radius: 2.4cqw;
  font-family: var(--sc-font-text); font-size: 4.4cqw; line-height: 1.1; color: var(--kb-letter); cursor: default;
}
.kb-cand.is-lead { background: rgba(26, 25, 23, .08); }
.kb-cand.is-press { background: rgba(44, 95, 203, .18); }
.kb--live .kb-cand { cursor: pointer; }
.kb-gear { position: absolute; right: 2cqw; width: 5cqw; height: 5cqw; color: #8E8A84; }
.kb-keys { position: relative; display: flex; flex-direction: column; gap: calc(var(--gap) * 1.55); }
.kb--live .kb-keys { touch-action: none; }
.kb-row { display: flex; gap: var(--gap); justify-content: center; }
.key {
  position: relative; flex: 0 0 var(--kw); height: var(--kh); border: 0; padding: 0; border-radius: 1.4cqw;
  background: var(--kb-key); box-shadow: 0 .35cqw 0 rgba(70, 58, 44, .28);
  display: flex; align-items: center; justify-content: center; color: inherit; font: inherit; cursor: default;
}
.key .let { font-size: 4.4cqw; font-weight: 500; line-height: 1; }
.key .rad { position: absolute; top: .7cqw; right: .9cqw; font-size: 2.5cqw; line-height: 1; color: var(--kb-radical); font-family: var(--sc-font-text); transition: opacity 200ms var(--sc-ease-out); }
.kb.no-radicals .key .rad { opacity: 0; }
.key.mod { background: var(--kb-mod); font-size: 3.6cqw; }
.key.w15 { flex-basis: calc(var(--kw) * 1.5 + var(--gap) * .5); }
.key.w12 { flex-basis: calc(var(--kw) * 1.2); }
.key.space { flex: 1 1 auto; font-size: 3.2cqw; letter-spacing: .5em; color: var(--kb-soft); font-family: var(--sc-font-text); }
.key.ret { flex-basis: calc(var(--kw) * 1.9); background: var(--kb-accent); color: #fff; }
.key.zh { font-family: var(--sc-font-text); }
.key svg { width: 4.6cqw; height: 4.6cqw; }
.key.is-press::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: rgba(26, 25, 23, .16); }
.key.is-mode { background: #fff; box-shadow: 0 0 0 .5cqw var(--kb-accent); }
.kb--live .key[data-k] { cursor: pointer; }
.kb-trail { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.kb-trail polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------- themes rail -- */
.themes-stage { display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: clamp(24px, 4vh, 42px); padding: calc(var(--chrome-h) + 24px) 0 32px; overflow: hidden; }
.rail { display: flex; align-items: flex-start; gap: clamp(1.5rem, 3vw, 3rem); padding: 0 var(--sc-gutter); width: max-content; }
.themes-head { padding: 0 var(--sc-gutter); text-align: center; }
.themes-head .section-body { margin: 0 auto; max-width: 40em; }
.themes-gallery { width: 100%; min-width: 0; }
.section-title { margin: 0 0 var(--sc-4); font-size: clamp(2rem, 1.3rem + 2.6vw, 3.6rem); line-height: 1.15; font-weight: 900; letter-spacing: .01em; text-wrap: balance; }
.section-body { margin: 0; font-size: var(--sc-t-lg); color: #415D6D; max-width: 26em; text-wrap: pretty; }
.theme { margin: 0; flex: 0 0 clamp(17rem, 30vw, 27rem); }
.theme img { width: 100%; height: auto; border-radius: 18px; box-shadow: var(--sc-e3); outline: 1px solid rgba(24, 60, 80, .12); outline-offset: -1px; }
.theme figcaption { display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; margin-top: var(--sc-4); }
.theme figcaption b { font-size: var(--sc-t-xl); font-weight: 700; }
.theme figcaption span { font-family: var(--keys-font); color: var(--sc-ink-soft); font-size: var(--sc-t-sm); }
.theme figcaption p { grid-column: 1 / -1; margin: 2px 0 0; color: #526773; font-size: var(--sc-t-sm); }
.theme figcaption i { grid-column: 1 / -1; justify-self: start; margin-top: 8px; font-style: normal; font-size: var(--sc-t-xs); color: var(--sc-accent); border: 1px solid currentColor; border-radius: 6px; padding: 1px 8px; }
.rail__end { flex: 0 0 min(18rem, 70vw); color: #415D6D; font-size: var(--sc-t-lg); }
@media (prefers-reduced-motion: no-preference) {
  .theme { opacity: 1; }
}

/* ------------------------------------------------------------- privacy -- */
.act-privacy { padding-top: calc(var(--sc-section) * .8); padding-bottom: calc(var(--sc-section) * .7); }
.privacy-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(2rem, 6vw, 6rem); row-gap: var(--sc-8); align-items: start; }
.rows { list-style: none; margin: 0; padding: 0; border-radius: 16px; background: rgba(255, 255, 255, .76); box-shadow: var(--sc-e2), var(--sc-edge); }
.rows li { display: flex; flex-direction: column; gap: 4px; padding: 18px 22px; }
.rows li + li { border-top: 1px solid rgba(24, 60, 80, .1); }
.rows b { font-size: var(--sc-t-lg); }
.rows span { color: #526773; font-size: var(--sc-t-base); }
.extras { grid-column: 1 / -1; }
.extras h3 { margin: 0 0 var(--sc-4); font-size: var(--sc-t-xl); }
.extras ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 10px 32px; }
.extras li { padding: 12px 0; border-top: 1px solid rgba(24, 60, 80, .14); color: #415D6D; }
.extras li b { font-family: var(--keys-font); color: var(--sc-accent); margin-right: 4px; }

/* ----------------------------------------------------------------- try -- */
.try-stage {
  display: grid; grid-template-columns: minmax(0, 30rem) minmax(0, 34rem);
  justify-content: center;
  column-gap: clamp(2rem, 4vw, 4rem); align-items: center;
  padding: calc(var(--chrome-h) + var(--sc-5)) var(--sc-gutter) 0;
}
.try-copy { display: flex; flex-direction: column; gap: var(--sc-5); }
.download { display: flex; flex-direction: column; gap: var(--sc-3); }
.download__hint { margin: 0; color: var(--sc-ink-soft); font-size: var(--sc-t-sm); }
.store-hint { margin: 0; font-size: var(--sc-t-base); color: #415D6D; }
.store-hint b { color: var(--sc-accent); }
.no-store [data-appstore] { display: inline-flex; }
html:not(.no-store) .store-hint { display: none; }
.try-surface { justify-self: end; }
.try-note { margin: var(--sc-4) 0 0; color: var(--sc-ink-soft); font-size: var(--sc-t-xs); line-height: 1.6; }
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sc-3);
  padding: var(--sc-5) var(--sc-gutter) max(var(--sc-5), env(safe-area-inset-bottom));
  border-top: 1px solid rgba(24, 60, 80, .1); color: var(--sc-ink-soft); font-size: var(--sc-t-sm);
}
.foot nav { display: flex; flex-wrap: wrap; gap: var(--sc-5); }
.foot p { margin: 0; }
.field--live:focus-visible { outline: 2px solid var(--sc-accent); outline-offset: 3px; }

/* -------------------------------------------------------------- phone -- */
@media (max-width: 860px) {
  :root { --chrome-h: 72px; }
  .tabs a:not(.tabs__try) { display: none; }
  .tabs { background: none; }
  .chrome { padding-inline: 16px; gap: 10px; }
  .brand { gap: 9px; }
  .brand img { width: 44px; height: 44px; border-radius: 11px; }
  .brand .wordmark { font-size: 1.3rem; }
  .brand__sub { font-size: .65rem; letter-spacing: 0; }
  .tabs a.tabs__try { padding: 8px 14px; margin-left: 0; }
  .stage {
    grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: var(--sc-4);
    padding: calc(var(--chrome-h) + var(--sc-3)) 16px max(16px, env(safe-area-inset-bottom));
    align-items: end;
  }
  /* The keyboard rises in once the visitor starts scrolling, so the first screen is just the pitch. */
  .surface {
    position: absolute; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
    width: auto; opacity: var(--peek, 0); transform: translateY(calc((1 - var(--peek, 0)) * 36px));
    pointer-events: none;
  }
  .panel { height: 100%; min-height: 12rem; }
  .note { justify-content: flex-end; gap: var(--sc-3); padding-bottom: calc(var(--surface-h, 0px) + var(--sc-4)); }
  .note--hero { justify-content: center; padding-bottom: 0; }
  .hero-brand { gap: 14px; font-size: 1.5rem; }
  .hero-brand img { width: 84px; height: 84px; border-radius: 21px; box-shadow: 0 10px 24px -10px rgba(24, 60, 80, .5); }
  .hero-title { font-size: clamp(2rem, 9vw, 2.6rem); }
  .hero-body, .note__line { font-size: var(--sc-t-base); }
  .note__big { font-size: clamp(1.75rem, 8vw, 2.3rem); }
  .status__n { font-size: 3rem; }
  .surface { justify-self: stretch; }
  .radicals span { opacity: .06; }
  .themes-head .section-title { font-size: clamp(1.8rem, 6vw, 2.7rem); }
  .themes-head .section-body { font-size: var(--sc-t-base); }
  .rail__end { flex-basis: 40vw; font-size: var(--sc-t-base); }
  .theme { flex-basis: 78vw; }
  .privacy-grid { grid-template-columns: 1fr; row-gap: var(--sc-6); }
  .try-stage { grid-template-columns: 1fr; align-content: center; row-gap: var(--sc-5); padding: calc(var(--chrome-h) + var(--sc-3)) 16px 16px; }
  .try-copy { gap: var(--sc-3); }
  .try-copy .section-title { margin-bottom: 0; font-size: clamp(1.8rem, 8vw, 2.4rem); }
  .try-copy .section-body { font-size: var(--sc-t-base); }
  .try-surface { justify-self: stretch; }
  .foot { flex-direction: column; padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 860px) and (max-height: 700px) {
  .hero-body { display: none; }
  .try-copy .section-body { display: none; }
  html:not(.no-store) .download__hint { display: none; }
  .try-stage { row-gap: var(--sc-3); }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .radicals span { transform: none; }
}

/* Guided practice */
.lesson-guide { margin-bottom: 14px; }
.lesson-guide b { font-size: 1.15rem; }
.lesson-guide p { margin: 4px 0 0; color: var(--sc-ink-soft); font-size: .95rem; }
.key.is-guide { outline: 2px solid #237F8C; outline-offset: -2px; }
.lesson-feedback { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 12px; }
.lesson-feedback p { margin: 0; font-size: .9rem; }
.lesson-feedback button { flex: none; border: 1px solid #526773; background: transparent; color: var(--sc-ink); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; }
.kb[aria-busy="true"] { opacity: .7; }
@media (max-width: 860px) { .try-copy .download { display: none; } .try-stage { row-gap: 16px; } .try-note { font-size: .7rem; } }

.key[data-step]::before {
  content: attr(data-step); position: absolute; z-index: 6; top: -1.4cqw; left: -1.3cqw;
  display: grid; place-items: center; width: 4.5cqw; height: 4.5cqw;
  border-radius: 50%; background: #237F8C; color: #fff;
  font: 700 2.9cqw/1 var(--keys-font);
  box-shadow: 0 0 0 .35cqw var(--kb-bg); pointer-events: none;
}
.lesson-trail { position: absolute; z-index: 4; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lesson-trail polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lesson-trail__route { stroke: #237F8C; stroke-width: calc(var(--guide-unit) * .045); stroke-dasharray: 4 7; opacity: .35; }
.lesson-trail__stroke { stroke: #237F8C; stroke-width: calc(var(--guide-unit) * .09); }
.lesson-trail__finger { fill: #237F8C; stroke: white; stroke-width: 2px; }

.kb--live .key:not(.is-guide) { opacity: .28; }
.kb--live .key.is-guide { outline-width: 2.5px; }

/* Completion replaces the keyboard rather than leaving disabled keys behind. */
.kb[hidden], .lesson-celebration[hidden] { display: none; }
.lesson-celebration { position: relative; display: grid; place-items: center; padding: 18px 0 8px; }
.lesson-otter { width: clamp(150px, 17vw, 230px); aspect-ratio: 1; background: url(assets/otter-cheer.png) 0 0 / 200% 200% no-repeat; transition: transform 140ms ease-in-out; }
.lesson-celebration[data-frame="1"] .lesson-otter { background-position: 100% 0; transform: translateY(-22px); }
.lesson-celebration[data-frame="2"] .lesson-otter { background-position: 0 100%; }
.try-stage.is-complete .lesson-guide b { display: block; font-size: clamp(2rem, 3vw, 3rem); font-weight: 900; line-height: 1.2; }
.try-stage.is-complete .lesson-guide p { margin-top: 12px; font-size: 1.1rem; }
.try-stage.is-complete .lesson-feedback { justify-content: center; }
.try-stage.is-complete [data-lesson-status], .try-stage.is-complete .try-note, .try-stage.is-complete .caret { display: none; }
.try-stage.is-complete .field { justify-content: center; }
.try-stage.is-complete .lesson-feedback button { padding: 10px 22px; background: var(--sc-ink); border-color: var(--sc-ink); color: white; }
@media (max-width: 860px) { .try-stage.is-complete .try-copy .section-title { font-size: clamp(2rem, 9vw, 2.8rem); } .try-stage.is-complete .lesson-guide { text-align: center; } }
@media (prefers-reduced-motion: reduce) { .lesson-otter { transition: none; } }

.lesson-celebration[data-frame="3"] .lesson-otter { background-position: 100% 100%; }
.lesson-confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Feature cloud: scattered labels with a soft, independent palette. */
.features-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--chrome-h) + 20px) 0 24px; }
.features-intro { text-align: center; padding: 0 20px; }
.features-intro .section-title { font-size: clamp(28px, 3.6vw, 48px); }
.features-intro .section-body { margin: 12px auto 0; font-size: clamp(14px, 1.2vw, 18px); }
.feature-cloud { position: relative; width: min(1050px, 94vw); height: min(480px, 54svh); margin-top: 28px; container-type: inline-size; }
.feature-cloud::before { content: ""; position: absolute; inset: 8% 12%; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.3), transparent 70%); }
.feature-cloud ul { margin: 0; padding: 0; list-style: none; }
.feature-tag { position: absolute; left: var(--x); top: var(--y); white-space: nowrap; line-height: 1.2; font-weight: 500; font-size: clamp(14px, 2.1cqw, 22px); color: #456C86; transform: translate(-50%, -50%) rotate(var(--angle, 0deg)); }
.feature-tag--2 { font-size: clamp(22px, 3.2cqw, 34px); font-weight: 700; color: #235C7D; }
.feature-tag--3 { font-size: clamp(32px, 4.9cqw, 52px); font-weight: 900; letter-spacing: -.04em; color: var(--sc-accent); }
@media (max-width: 860px) {
  .features-stage { padding-top: calc(var(--chrome-h) + 18px); }
  .features-intro .section-title { font-size: 27px; }
  .features-intro .note__label { font-size: 12px; }
  .features-intro .section-body { max-width: 20em; }
  .feature-cloud { height: min(430px, 57svh); margin-top: 20px; }
  .feature-tag { left: var(--mobile-x); top: var(--mobile-y); font-size: clamp(11px, 3.2cqw, 16px); }
  .feature-tag--2 { font-size: clamp(17px, 4.7cqw, 24px); }
  .feature-tag--3 { font-size: clamp(22px, 6.5cqw, 30px); }
}
@media (max-height: 580px) and (min-width: 861px) {
  .features-stage { padding-top: var(--chrome-h); }
  .features-intro .section-title { font-size: 26px; }
  .features-intro .section-body, .features-intro .note__label { display: none; }
  .feature-cloud { height: 58svh; margin-top: 12px; }
}

.feature-tag--1:nth-child(3n) { color: #317889; font-size: clamp(14px, 2.3cqw, 24px); }
.feature-tag--1:nth-child(4n) { font-size: clamp(14px, 1.8cqw, 19px); }
@media (max-width: 860px) {
  .feature-tag--1:nth-child(3n), .feature-tag--1:nth-child(4n) { font-size: clamp(11px, 3.2cqw, 16px); }
}

.feature-tag--medium { font-size: clamp(19px, 2.6cqw, 28px); font-weight: 700; color: #317889; }
@media (max-width: 860px) {
  .feature-tag--medium { font-size: clamp(15px, 4cqw, 20px); }
  .feature-cloud { height: min(430px, 54svh); margin-bottom: 28px; }
}

.feature-cloud .feature-tag {
  --tag-ink: #426E71; --tag-fill: rgba(241, 249, 249, .55); --tag-line: rgba(107, 149, 155, .32);
  color: var(--tag-ink); background: var(--tag-fill); border: 1px solid var(--tag-line);
  border-radius: 14px; padding: .28em .55em;
  box-shadow: 0 3px 9px rgba(48, 87, 113, .06);
}
.feature-cloud .feature-tag:nth-child(4n + 2) { --tag-ink: #527185; --tag-fill: rgba(239, 245, 249, .6); --tag-line: rgba(117, 147, 168, .3); }
.feature-cloud .feature-tag:nth-child(4n + 3) { --tag-ink: #426E71; --tag-fill: rgba(235, 246, 243, .55); --tag-line: rgba(107, 149, 155, .32); }
.feature-cloud .feature-tag:nth-child(4n) { --tag-ink: #527185; --tag-fill: rgba(239, 245, 249, .6); --tag-line: rgba(117, 147, 168, .3); }
.feature-cloud .feature-tag--1:nth-child(3n + 1) { background: rgba(255,255,255,.22); box-shadow: none; }
.feature-cloud .feature-tag--3 { --tag-ink: #FFFFFF; --tag-fill: #527F83; --tag-line: #527F83; border-radius: 18px; padding: .25em .48em; box-shadow: 0 7px 18px rgba(38, 99, 102, .09); }
@media (max-width: 860px) {
  .feature-cloud .feature-tag { padding: .28em .4em; border-radius: 8px; }
  .feature-cloud .feature-tag--3 { padding: .27em .42em; border-radius: 11px; }
}

/* A short swim between the typing story and the feature cloud. */
.otter-crossing { scroll-margin-top: 65svh; position: relative; height: clamp(240px, 42svh, 400px); overflow: clip; }
.crossing-water { position: absolute; inset: 8% -10%; background: radial-gradient(ellipse at center, rgba(223,247,250,.4), transparent 65%); }
.crossing-water::after { content: ""; position: absolute; left: 15%; right: 15%; top: 55%; height: 1px; background: linear-gradient(90deg, transparent, rgba(82,127,131,.16), transparent); }
.crossing-swimmer { position: absolute; left: 0; top: 50%; width: clamp(210px, 26vw, 340px); aspect-ratio: 1; transform: translate(-110%, -50%); }
.crossing-otter { position: absolute; inset: 0; background: url(assets/otter-swim.png) 0 0 / 400% 200% no-repeat; }
.crossing-wake { position: absolute; inset: 0; }
.crossing-wake i { position: absolute; top: 38%; left: -9%; width: 36%; height: 26%; border: 1px solid rgba(82,127,131,.3); border-right-color: transparent; border-radius: 50%; }
.crossing-wake i:nth-child(2) { left: -30%; top: 34%; height: 34%; opacity: .6; }
.crossing-wake i:nth-child(3) { left: -55%; top: 29%; height: 44%; opacity: .3; }
@media (prefers-reduced-motion: reduce) {
  .crossing-swimmer { left: 50%; transform: translate(-50%, -50%); }
}

.theme-pair { position: relative; width: 100%; aspect-ratio: 880 / 576; border-radius: 18px; overflow: hidden; box-shadow: var(--sc-e3); outline: 1px solid rgba(24,60,80,.12); outline-offset: -1px; }
.theme-half { position: absolute; inset: 0; }
.theme-half--dark { clip-path: polygon(56% 0, 100% 0, 100% 100%, 44% 100%); }
.theme-pair img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; box-shadow: none; outline: none; }
@media (max-height: 620px) and (min-width: 861px) {
  .themes-stage { gap: 18px; padding-top: calc(var(--chrome-h) + 12px); }
  .themes-head .section-title { font-size: 30px; margin-bottom: 8px; }
  .themes-head .section-body { font-size: 14px; }
  .theme { flex-basis: min(30vw, 360px); }
}

@media (max-width: 360px) {
  .chrome { padding-inline: 12px; gap: 8px; }
  .brand .wordmark { font-size: 1.1rem; }
  .brand__sub { font-size: .6rem; }
  .tabs a.tabs__try { padding: 9px 12px; font-size: .85rem; }
}
/* scroll hint: sits in the hero note, which fades out as the visitor scrolls */
.scroll-hint {
  margin: var(--sc-3) 0 0; width: fit-content; display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 18px; border-radius: 999px;
  background: var(--sc-accent); color: var(--sc-accent-ink);
  font-size: 1rem; font-weight: 700; letter-spacing: .06em;
  box-shadow: 0 8px 20px -8px rgba(185, 76, 48, .7);
}
.scroll-hint svg { width: 26px; height: 26px; flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .scroll-hint { animation: scroll-hint-pulse 2s ease-out infinite; }
  .scroll-hint svg { animation: scroll-hint-bob 1.1s ease-in-out infinite; }
}
@keyframes scroll-hint-bob { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(5px); } }
@keyframes scroll-hint-pulse {
  0% { box-shadow: 0 8px 20px -8px rgba(185, 76, 48, .7), 0 0 0 0 rgba(185, 76, 48, .45); }
  70%, 100% { box-shadow: 0 8px 20px -8px rgba(185, 76, 48, .7), 0 0 0 16px rgba(185, 76, 48, 0); }
}

/* desktop: a mouse-wheel cue instead of the pill */
.scroll-hint__mouse { display: none; }
@media (min-width: 861px) {
  .scroll-hint { background: none; box-shadow: none; padding: 0; gap: 14px; margin-top: var(--sc-5); color: var(--sc-ink); animation: none; }
  .scroll-hint span { font-size: 1.05rem; font-weight: 500; letter-spacing: .14em; color: var(--sc-ink-soft); }
  .scroll-hint svg { display: none; }
  .scroll-hint__mouse {
    display: block; position: relative; flex: none; width: 24px; height: 38px; box-sizing: border-box;
    border: 2px solid var(--sc-ink); border-radius: 13px;
  }
  .scroll-hint__mouse b {
    position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px;
    border-radius: 2px; background: var(--sc-accent);
  }
  .scroll-hint span::after {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-left: 12px; vertical-align: 2px;
    border-right: 2px solid var(--sc-accent); border-bottom: 2px solid var(--sc-accent); transform: rotate(45deg);
  }
}
@media (min-width: 861px) and (prefers-reduced-motion: no-preference) {
  .scroll-hint__mouse b { animation: scroll-hint-wheel 1.7s cubic-bezier(.45, 0, .2, 1) infinite; }
  .scroll-hint span { animation: scroll-hint-nudge 1.7s ease-in-out infinite; }
}
@keyframes scroll-hint-wheel {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(12px); opacity: 0; }
}
@keyframes scroll-hint-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* try: a darker stage so the hands-on demo stands apart from the pale pages above it */
.act-try {
  background:
    radial-gradient(ellipse 60% 55% at 72% 50%, rgba(44, 95, 203, .38), transparent 70%),
    linear-gradient(180deg, #1B4A66 0%, #123249 55%, #0E2738 100%);
  color: #fff;
}
.act-try .try-label {
  align-self: flex-start; width: fit-content; margin: 0; padding: 6px 14px; border-radius: 999px;
  background: rgba(143, 211, 220, .14); border: 1px solid rgba(143, 211, 220, .45);
  color: #B5E7EE; font-size: var(--sc-t-sm); font-weight: 700; letter-spacing: .1em; line-height: 1.3;
}
.act-try .section-title { color: #fff; }
.act-try .section-title em { color: #FF9A74; }
.act-try .section-body, .act-try .download__hint, .act-try .store-hint { color: rgba(255, 255, 255, .82); }
.act-try .lesson-guide b { color: #fff; }
.act-try .lesson-guide p, .act-try .try-note, .act-try .lesson-feedback p { color: rgba(255, 255, 255, .72); }
.act-try .lesson-feedback button { border-color: rgba(255, 255, 255, .55); color: #fff; }
.act-try .try-stage.is-complete .lesson-feedback button { background: var(--sc-accent); border-color: var(--sc-accent); color: #fff; }
.act-try .field--live:focus-visible { outline-color: #FF9A74; }

/* lesson status: a visible message chip rather than small print */
.lesson-feedback p[data-lesson-status] { font-size: 1.05rem; font-weight: 700; line-height: 1.35; }
.lesson-feedback p[data-state] { padding: 8px 14px; border-radius: 12px; border: 1px solid transparent; }
.act-try .lesson-feedback p[data-state="hint"] { background: rgba(143, 211, 220, .16); border-color: rgba(143, 211, 220, .5); color: #CFF1F5; }
.act-try .lesson-feedback p[data-state="miss"] { background: #FF9A74; border-color: #FF9A74; color: #4A1A0B; }
.act-try .lesson-feedback p[data-state="ok"] { background: #7FDDA0; border-color: #7FDDA0; color: #0F3B22; }
@media (prefers-reduced-motion: no-preference) {
  .lesson-feedback p.is-shake { animation: lesson-shake .4s ease; }
}
@keyframes lesson-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* try: switch the guided demo between 倉頡 / 速成 / 粵拼 */
.lesson-modes { display: flex; gap: 8px; margin-bottom: 12px; }
.lesson-modes button {
  border: 1px solid rgba(255, 255, 255, .4); background: transparent; color: rgba(255, 255, 255, .85);
  border-radius: 999px; padding: 6px 16px; font: inherit; font-size: .95rem; font-weight: 700; letter-spacing: .06em; cursor: pointer;
}
.lesson-modes button[aria-pressed="true"] { background: #fff; border-color: #fff; color: #123249; }
.lesson-modes button:focus-visible { outline: 2px solid #FF9A74; outline-offset: 3px; }

/* the input field stays light on the dark try stage, so its text must stay dark */
.act-try .field, .act-try .field--live { color: var(--sc-ink); }

/* the demo note shares the "再試一次" row, so nothing sits under the back-to-top button */
.lesson-feedback__msg { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.lesson-feedback__msg .try-note { margin: 0; font-size: .78rem; line-height: 1.5; }
.lesson-feedback__msg p[data-lesson-status]:empty { display: none; }
.lesson-feedback:has([data-state]) .try-note { display: none; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nowrap { white-space: nowrap; }
