:root {
  color-scheme: light dark;
  --gold: #f7bf2f;
  --gold-hot: #ffdc55;
  --coral: #ff7a59;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --latin: "Instrument Serif", "Noto Serif SC", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  /* Day: the sunny icon. */
  --bg: #fff6df;
  --glow-a: rgba(255, 196, 46, .42);
  --glow-b: rgba(255, 140, 70, .16);
  --fg: #2b2114;
  --fg-soft: #5d4b31;
  --dim: #8d7a5c;
  --line: rgba(43, 33, 20, .12);
  --accent-text: #c77800;
  --header-bg: rgba(255, 246, 223, .75);
  --phone-a: #4a3820; --phone-b: #20180d;
  --phone-glow: rgba(247, 160, 20, .35);
  --band: rgba(247, 191, 47, .14);
  --stage-a: #fffdf6; --stage-b: #fff1cc;
  --card-a: #fffdf7; --card-b: #fff4d6; --card-edge: #ecd29a; --card-text: #6b5a40;
  --grain: .05;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Night: the starry icon. */
    --bg: #0b0f1a;
    --glow-a: rgba(247, 191, 47, .14);
    --glow-b: rgba(80, 110, 190, .2);
    --fg: #f3eee3;
    --fg-soft: #c9cdd6;
    --dim: #8f97a8;
    --line: rgba(243, 238, 227, .12);
    --accent-text: var(--gold);
    --header-bg: rgba(11, 15, 26, .72);
    --phone-a: #2b3550; --phone-b: #121826;
    --phone-glow: rgba(247, 191, 47, .25);
    --band: rgba(247, 191, 47, .04);
    --stage-a: #1d2638; --stage-b: #0f1422;
    --card-a: #252f44; --card-b: #1b2333; --card-edge: #0e1420; --card-text: #b9bfcb;
    --grain: .07;
  }
}
* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  background:
    radial-gradient(1200px 700px at 85% -10%, var(--glow-a), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, var(--glow-b), transparent 60%),
    var(--bg);
}
body {
  margin: 0; color: var(--fg); font-family: var(--sans); line-height: 1.8;
  overflow-x: hidden; font-synthesis: none; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: .25em; }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 4px; }
::selection { background: var(--gold); color: #2b2114; }
.skip { position: absolute; top: -100px; left: 16px; padding: 8px 16px; background: var(--gold); color: #2b2114; z-index: 20; }
.skip:focus { top: 8px; }

.grain { opacity: calc(var(--grain) / .07); position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; mix-blend-mode: overlay; }
#taps { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 25; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px clamp(16px, 4vw, 48px);
  transition: background .4s var(--ease), backdrop-filter .4s;
}
.top.scrolled { background: var(--header-bg); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--latin); font-size: 26px; letter-spacing: -.01em; text-decoration: none; }
.brand img { border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.top nav { display: flex; gap: clamp(12px, 2.5vw, 28px); font-size: 14px; }
.top nav a { text-decoration: none; color: var(--dim); transition: color .2s; }
.top nav a:hover { color: var(--fg); }

main { width: min(1200px, calc(100% - 32px)); margin-inline: auto; }

/* Reveal: everything enters once, staggered by --d. */
.reveal { opacity: 0; transform: translateY(28px); filter: blur(6px); transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease); transition-delay: calc(var(--d, 0) * 110ms); }
.reveal.in { opacity: 1; transform: none; filter: none; }

/* Hero */
.hero { min-height: 100svh; display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(32px, 6vw, 88px); align-items: center; padding-block: 120px 60px; }
.kicker { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; color: var(--accent-text); margin: 0 0 28px; }
h1 { font-family: var(--serif); font-weight: 900; font-size: clamp(56px, 9vw, 128px); line-height: 1.02; letter-spacing: -.04em; margin: 0 0 32px; }
h1 .line { display: block; }
.accent-line {
  background: linear-gradient(100deg, var(--gold) 0%, var(--gold-hot) 35%, var(--coral) 70%, var(--gold) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 6s linear infinite;
}
@keyframes sheen { to { background-position: -250% 0; } }
.lede { font-size: clamp(17px, 1.5vw, 19px); color: var(--fg-soft); max-width: 30em; margin: 0 0 40px; }
.cta-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.ghost { color: var(--dim); text-decoration: none; transition: color .2s; }
.ghost:hover { color: var(--fg); }

/* A button that is a key: it presses down. */
.keycap-btn { --h: 7px; display: inline-block; text-decoration: none; padding-bottom: var(--h); border-radius: 16px; background: #b07a1c; transition: padding .12s var(--ease), transform .12s var(--ease); }
.keycap-btn .cap { display: block; padding: 16px 28px; border-radius: 16px; background: linear-gradient(180deg, var(--gold-hot), var(--gold)); color: #2b2114; font-weight: 700; font-size: 17px; box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 18px 40px -12px rgba(247,191,47,.55); transition: box-shadow .3s; }
.keycap-btn:hover .cap { box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 24px 60px -10px rgba(247,191,47,.8); }
.keycap-btn:active { padding-bottom: 1px; transform: translateY(calc(var(--h) - 1px)); }
.keycap-btn.big .cap { padding: 22px 44px; font-size: 21px; border-radius: 20px; }
.keycap-btn.big { border-radius: 20px; --h: 9px; }

/* Demo phone */
.demo { margin: 0; justify-self: center; width: min(420px, 100%); }
.phone {
  position: relative; border-radius: 42px; padding: 14px; background: linear-gradient(160deg, var(--phone-a), var(--phone-b));
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 60px 120px -30px rgba(0,0,0,.8), 0 0 120px -20px var(--phone-glow);
  transform: perspective(1400px) rotateY(-8deg) rotateX(4deg); transition: transform .8s var(--ease);
}
.demo:hover .phone { transform: perspective(1400px) rotateY(0) rotateX(0); }
.sheet { position: relative; min-height: 132px; border-radius: 30px 30px 14px 14px; background: #f6f2e8; color: #1b2333; padding: 26px 24px; font-family: var(--serif); font-weight: 600; font-size: 25px; line-height: 1.5; }
.sheet-text { display: inline; margin: 0; }
.sheet-text .ch { display: inline-block; animation: rise .5s var(--spring) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.6); } }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--gold); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.kb {
  margin-top: 10px; border-radius: 34px; padding: 8px 6px 4px; color: #111; position: relative;
  background: linear-gradient(180deg, rgba(236, 236, 242, .92), rgba(224, 225, 233, .92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px rgba(255,255,255,.4);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
}
.comp { height: 20px; padding: 0 14px; font-family: var(--mono); font-size: 13px; color: #4a5060; letter-spacing: .02em; }
.comp .fix { color: #d98a00; font-weight: 600; }
.cands { position: relative; height: 40px; display: flex; align-items: center; gap: 24px; padding: 0 40px 0 14px; font-size: 20px; overflow: hidden; white-space: nowrap; }
.cands .ph { color: #8b919c; font-size: 14px; }
.cands .more { position: absolute; right: 12px; font-weight: 400; font-size: 20px; color: #333; top: 2px; }
.cands .top1 { font-weight: 600; animation: pop .35s var(--spring); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.cands .pressed { background: #fff; border-radius: 12px; padding: 2px 10px; margin: 0 -10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.rows { display: grid; gap: 10px; padding: 6px 0 0; }
.row { display: flex; justify-content: center; gap: 5px; }
.key { position: relative; flex: 0 0 calc((100% - 45px) / 10); height: 44px; display: grid; place-items: center; border-radius: 11px; background: #fff; font-size: 20px; font-weight: 400; box-shadow: 0 1px 1px rgba(0,0,0,.06); transition: background .15s, transform .15s; }
.key.wide { flex-basis: calc((100% - 45px) / 10 * 1.4); font-size: 15px; }
.key.ret { font-size: 20px; }
.key.space { flex: 1 1 auto; }
.key.hit { background: #e4e6ec; transform: scale(.96); }
.key.miss { background: #ffe7a8; }
.key .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.sys { display: flex; justify-content: space-between; padding: 12px 18px 8px; }
.sys svg { width: 24px; height: 24px; fill: none; stroke: #333; stroke-width: 1.6; stroke-linecap: round; }
@media (prefers-color-scheme: dark) {
  .kb { color: #f2f2f5; background: linear-gradient(180deg, rgba(58, 58, 66, .9), rgba(40, 40, 47, .92)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
  .key { background: rgba(255, 255, 255, .2); box-shadow: none; }
  .key.hit { background: rgba(255, 255, 255, .32); }
  .key.miss { background: rgba(247, 191, 47, .55); }
  .comp { color: #c4c7d0; }
  .comp .fix { color: var(--gold); }
  .cands .more, .cands .ph { color: #c4c7d0; }
  .cands .pressed { background: rgba(255,255,255,.22); }
  .sys svg { stroke: #e8e8ee; }
}
.dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: radial-gradient(circle, rgba(255,122,89,.95) 0 35%, rgba(255,122,89,.0) 70%); pointer-events: none; animation: dot 900ms var(--ease) forwards; z-index: 2; }
.dot.ok { background: radial-gradient(circle, rgba(60,130,255,.85) 0 35%, rgba(60,130,255,0) 70%); }
.dot::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid currentColor; color: rgba(255,122,89,.8); animation: ring 700ms var(--ease) forwards; }
.dot.ok::after { color: rgba(60,130,255,.6); }
@keyframes dot { 0% { transform: scale(.4); } 20% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 0; } }
@keyframes ring { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.demo figcaption { margin-top: 22px; font-size: 13px; color: var(--dim); text-align: center; }

/* Marquee of codes */
.marquee { margin: 40px calc(50% - 50vw); padding: 26px 0; border-block: 1px solid var(--line); overflow: hidden; transform: rotate(-2deg); background: var(--band); }
.track { display: flex; gap: 44px; width: max-content; align-items: baseline; animation: slide 40s linear infinite; }
.track span { font-family: var(--mono); font-size: clamp(22px, 3vw, 34px); color: var(--dim); }
.track i { font-style: normal; font-family: var(--serif); font-weight: 900; font-size: clamp(30px, 4.4vw, 52px); color: var(--fg); }
@keyframes slide { to { transform: translateX(-50%); } }

/* Probability cloud */
.cloud-sec { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: clamp(90px, 14vw, 180px); }
h2 { font-family: var(--serif); font-weight: 900; font-size: clamp(40px, 5.6vw, 76px); line-height: 1.1; letter-spacing: -.035em; margin: 0 0 28px; }
h2 em { font-style: normal; color: var(--accent-text); }
.cloud-copy p { color: var(--fg-soft); font-size: 17px; max-width: 26em; }
.cloud-stage { position: relative; aspect-ratio: 10 / 4.6; border-radius: 28px; background: radial-gradient(120% 120% at 50% 0%, var(--stage-a), var(--stage-b)); box-shadow: 0 0 0 1px var(--line), 0 40px 90px -30px rgba(40,25,0,.35); overflow: hidden; cursor: crosshair; }
#cloud { width: 100%; height: 100%; display: block; }

/* Offline */
.offline { padding-block: clamp(60px, 10vw, 140px); text-align: center; }
.split { font-size: clamp(38px, 11vw, 168px); white-space: nowrap; line-height: 1; margin-bottom: 56px; }
.split .c { display: inline-block; opacity: 0; transform: translateY(.6em) rotate(8deg); transition: opacity .7s var(--ease), transform .9s var(--spring); transition-delay: calc(var(--i) * 70ms); }
.split.in .c { opacity: 1; transform: none; }
.offline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; max-width: 900px; margin-inline: auto; text-align: left; color: var(--fg-soft); font-size: 18px; }
.offline-grid a { color: var(--accent-text); text-decoration: none; }

/* Feature keycaps */
.caps { padding-block: clamp(60px, 10vw, 140px); }
.cap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; perspective: 1200px; }
.feature-cap {
  --rx: 0deg; --ry: 0deg; position: relative; padding: 26px 22px 30px; border-radius: 22px;
  background: linear-gradient(180deg, var(--card-a), var(--card-b)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 0 var(--card-edge), 0 30px 50px -20px rgba(40,25,0,.35);
  transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .25s var(--ease), box-shadow .2s;
}
.feature-cap.in { transform: rotateX(var(--rx)) rotateY(var(--ry)); }
.feature-cap:hover { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 4px 0 var(--card-edge), 0 20px 50px -16px rgba(247,191,47,.35); translate: 0 6px; }
.legend { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: #2b2114; background: var(--gold); padding: 2px 10px; border-radius: 6px; margin-bottom: 20px; }
.feature-cap h3 { font-family: var(--serif); font-size: 22px; line-height: 1.4; margin: 0 0 10px; }
.feature-cap p { margin: 0; color: var(--card-text); font-size: 15px; }

/* Final */
.final { text-align: center; padding-block: clamp(90px, 14vw, 200px); }
.final h2 { margin-bottom: 48px; }
.fine { margin: 40px auto 0; max-width: 34em; color: var(--dim); font-size: 14px; }
.fine a { color: var(--accent-text); text-decoration: none; }

.foot { width: min(1200px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; color: var(--dim); font-size: 13px; }
.foot p { margin: 0; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 110px; min-height: auto; }
  .phone { transform: none; }
  .cloud-sec { grid-template-columns: 1fr; }
  .cap-grid { grid-template-columns: 1fr 1fr; }
  .offline-grid { grid-template-columns: 1fr; text-align: center; }
}
@media (max-width: 540px) {
  .key { height: 40px; font-size: 18px; }
  .top nav { gap: 12px; font-size: 13px; }
  .cap-grid { grid-template-columns: 1fr; }
  .sheet { font-size: 22px; min-height: 112px; }
  .foot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .split .c { opacity: 1; transform: none; filter: none; }
}

/* Mascot, drawn from the app icon. */
.mascot { overflow: visible; }
.mascot .ear { fill: #ffe39a; opacity: .95; }
@media (prefers-color-scheme: dark) { .mascot .ear { fill: #f4ead2; } }
.mascot .body { fill: #fffdf7; filter: drop-shadow(0 6px 10px rgba(120, 70, 0, .25)); }
.mascot .eyes ellipse { fill: #1d1a14; }
.mascot .glint { fill: #fff; }
.mascot .blush { fill: #ffb9b5; opacity: .85; }
.mascot .mouth { fill: #e05263; }
.mascot .eyes { transition: transform .25s var(--ease); transform-box: fill-box; }
.mascot.blink .eyes { transform: scaleY(.1); transform-origin: center; }
.mascot .bob { animation: bob 3.2s ease-in-out infinite; transform-origin: 54px 90px; }
.mascot .ear-a { animation: ear 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 100% 50%; }
.mascot .ear-b { animation: ear 3.2s ease-in-out -.4s infinite; transform-box: fill-box; transform-origin: 100% 50%; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-2deg); } }
@keyframes ear { 50% { rotate: 8deg; } }
.mascot.hop .bob { animation: hop .5s var(--spring); }
@keyframes hop { 30% { transform: translateY(-12px) rotate(6deg) scale(1.04, .96); } }
.perched { position: absolute; width: 128px; right: -46px; top: -86px; z-index: 3; }
.final-mascot { width: 180px; margin: 0 auto 8px; }
.final-mascot .mascot { width: 100%; }
@media (max-width: 540px) { .perched { width: 92px; right: -6px; top: -64px; } }

/* Sky: a slow sun by day, twinkling stars by night. */
.sky { position: absolute; inset: 0 0 auto 0; height: 100svh; pointer-events: none; overflow: hidden; z-index: -1; }
.sun { position: absolute; width: 46vmin; height: 46vmin; right: -10vmin; top: -14vmin; border-radius: 50%;
  background: radial-gradient(circle, #fff3c4 0 52%, rgba(255, 230, 150, .55) 53% 66%, transparent 67%);
  box-shadow: 0 0 120px 40px rgba(255, 210, 90, .35); animation: sun 9s ease-in-out infinite; }
@keyframes sun { 50% { transform: scale(1.05) translateY(10px); } }
.stars { display: none; position: absolute; inset: 0; }
.stars i { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff; opacity: .2; animation: twinkle var(--t, 3s) ease-in-out var(--dl, 0s) infinite; }
.stars i.big { width: 0; height: 0; background: none; }
.stars i.big::before { content: "✦"; position: absolute; transform: translate(-50%, -50%); color: #fff; font-size: 18px; }
@keyframes twinkle { 50% { opacity: .95; transform: scale(1.4); } }
@media (prefers-color-scheme: dark) {
  .sun { width: 30vmin; height: 30vmin; right: 6vmin; top: 6vmin; background: radial-gradient(circle, rgba(255, 236, 190, .14), transparent 65%); box-shadow: none; }
  .stars { display: block; }
  .mascot .body { filter: drop-shadow(0 0 18px rgba(255, 220, 140, .45)); }
}
