/* Vibe Prompt — the Floating style, at page scale. Colors come from the app's
   floatingDaylight tokens and contour ridge parameters. */

:root {
  --bg-a: #eef4fc;
  --bg-b: #f8fafe;
  --ink: #1d293b;
  --ink-2: #4b5a71;
  --ink-3: #8090a6;
  --blue: #7dadf0;
  --blue-deep: #3d7bd6;
  --band: #96c4f6;
  --line: rgba(194, 209, 235, 0.72);
  --line-strong: rgba(176, 195, 228, 0.9);
  --required: #cc2e29;
  --star: #ed990f;
  --var-bg: rgba(125, 173, 240, 0.22);
  --radius-l: 26px;
  --radius-m: 18px;
  --radius-s: 12px;
  --shadow-pane: 0 28px 56px -24px rgba(22, 42, 80, 0.22), 0 2px 6px rgba(22, 42, 80, 0.05);
  --shadow-lift: 0 40px 80px -30px rgba(22, 42, 80, 0.32), 0 6px 18px -6px rgba(22, 42, 80, 0.12);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", "Roboto Mono", "PingFang SC",
    "Hiragino Sans GB", monospace;
  --font-serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Songti SC", "STSong", serif;
  --gutter: clamp(16px, 4vw, 56px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html.has-overlay {
  overflow: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-a), var(--bg-b)) fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 3px solid rgba(61, 123, 214, 0.55);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 300;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  display: inline-flex;
  width: 1.05em;
  height: 1.05em;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* MARK: Type */

.display {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.045em;
  color: var(--ink);
  text-wrap: balance;
}

:root[data-lang="zh"] .display {
  font-family: var(--font-sans);
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.lead {
  margin: 0;
  max-width: 62ch;
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  color: var(--ink-2);
  text-wrap: pretty;
}

.lead code,
.syntax dd code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--var-bg);
  font-size: 0.88em;
  color: var(--ink);
}

.lead kbd {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: #fff;
  font-size: 0.82em;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

/* MARK: Controls */

.keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25em;
  height: 2.25em;
  padding: 0 0.65em;
  border: 1px solid rgba(194, 209, 235, 0.92);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f3f6fd);
  box-shadow:
    inset 0 1px 0 #fff,
    0 2px 0 rgba(160, 180, 215, 0.5),
    0 8px 16px -6px rgba(30, 50, 90, 0.18);
  font: 700 0.8rem/1 var(--font-mono);
  color: #2b394e;
  white-space: nowrap;
  transition:
    transform 0.12s var(--ease),
    box-shadow 0.12s var(--ease),
    background 0.12s;
}

.keycap.is-small {
  min-width: 1.9em;
  height: 1.9em;
  padding: 0 0.45em;
  border-radius: 7px;
  font-size: 0.72rem;
  box-shadow:
    inset 0 1px 0 #fff,
    0 1.5px 0 rgba(160, 180, 215, 0.5);
}

.keycap.is-mini {
  height: 1.7em;
  padding: 0 0.6em;
  border-radius: 7px;
  font-size: 0.66rem;
  box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(160, 180, 215, 0.45);
}

.keycap.is-faint {
  color: var(--ink-3);
}

.keycap.is-huge {
  min-width: 2.35em;
  height: 2.35em;
  padding: 0 0.6em;
  border-radius: 24px;
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  box-shadow:
    inset 0 2px 0 #fff,
    inset 0 -3px 0 rgba(222, 231, 246, 0.9),
    0 7px 0 rgba(160, 180, 215, 0.55),
    0 28px 40px -14px rgba(30, 50, 90, 0.3);
}

.keycap.is-space {
  min-width: 5.6em;
  font-size: clamp(1.25rem, 3vw, 2rem);
  height: calc(clamp(1.6rem, 3.6vw, 2.5rem) * 2.35);
  letter-spacing: 0.04em;
}

.keycap.is-down {
  transform: translateY(5px);
  background: linear-gradient(180deg, #f2f7ff, #e6effc);
  box-shadow:
    inset 0 2px 0 #fff,
    0 2px 0 rgba(160, 180, 215, 0.55),
    0 10px 18px -10px rgba(30, 50, 90, 0.3);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff, #f5f8fe);
  box-shadow: inset 0 1px 0 #fff, 0 10px 24px -14px rgba(22, 42, 80, 0.35);
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 #fff, 0 14px 28px -14px rgba(22, 42, 80, 0.45);
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button.primary {
  border-color: #172133;
  background: linear-gradient(180deg, #2c3b54, #172133);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 14px 30px -12px rgba(23, 33, 51, 0.6);
}

.button.primary .keycap {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.button:disabled {
  cursor: not-allowed;
  color: var(--ink-3);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  border-style: dashed;
}

.button.small {
  height: 34px;
  padding: 0 14px;
  font-size: 0.84rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-width: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 #fff;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.chip.is-small {
  height: 28px;
  padding: 0 10px;
  font-size: 0.76rem;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-chip {
  padding: 0;
  width: 36px;
}

.icon-chip[aria-pressed="true"] {
  color: var(--blue-deep);
  border-color: rgba(125, 173, 240, 0.8);
  background: rgba(238, 245, 255, 0.95);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 10px 24px -16px rgba(22, 42, 80, 0.4);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-deep);
  box-shadow: 0 0 0 0 rgba(61, 123, 214, 0.45);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 10px rgba(61, 123, 214, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 123, 214, 0);
  }
}

.glass {
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(249, 251, 255, 0.94) 60%, rgba(244, 247, 254, 0.92));
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.55), var(--shadow-pane);
}

/* MARK: Frame — backdrop, header, HUD */

/* One contour field behind every scene; each scene sets how strongly it shows. */
.ridges.page-ridges {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 1;
  transition: opacity 0.9s var(--ease);
}

.ridges {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  display: block;
}

.site-header {
  position: fixed;
  inset: 12px var(--gutter) auto;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
  padding: 0 10px 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition:
    background 0.3s,
    border-color 0.3s,
    box-shadow 0.3s,
    transform 0.45s var(--ease),
    opacity 0.3s;
}

.site-header.is-scrolled {
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(248, 251, 255, 0.8);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.5), 0 16px 40px -24px rgba(22, 42, 80, 0.45);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
}

.site-header.is-hidden {
  transform: translateY(calc(-100% - 24px));
  opacity: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  border-radius: 7px;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.4);
}

.brand.is-small {
  font-size: 0.9rem;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.keycap-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 8px;
  border: 1px solid #172133;
  border-radius: 999px;
  background: linear-gradient(180deg, #2c3b54, #172133);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 24px -12px rgba(23, 33, 51, 0.6);
}

.keycap-button .keycap,
.hud-summon .keycap {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.keycap-button span {
  margin-left: 4px;
}

/* The HUD: where you are, where you can go, and the shortcut — always at hand. */
.hud {
  --hud-ink: var(--ink-2);
  --hud-faint: rgba(75, 90, 113, 0.35);
  color: var(--hud-ink);
}

:root[data-current-scene="styles"]:not([data-style="floating"]):not([data-style="paper"]) .hud {
  --hud-ink: rgba(244, 240, 228, 0.82);
  --hud-faint: rgba(244, 240, 228, 0.3);
}

.hud-index {
  position: fixed;
  left: var(--gutter);
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.hud-num {
  font-size: 1.05rem;
  font-weight: 800;
}

.hud-total {
  color: var(--hud-faint);
}

.hud-label {
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hud-rail {
  position: fixed;
  right: 18px;
  top: 50%;
  z-index: 40;
  display: grid;
  gap: 10px;
  translate: 0 -50%;
}

.hud-tick {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.hud-tick::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: var(--hud-faint);
  translate: 0 -50%;
  transition:
    width 0.3s var(--ease),
    background 0.3s;
}

.hud-tick.is-current::before,
.hud-tick:hover::before {
  width: 18px;
  background: var(--hud-ink);
}

.hud-tick-label {
  position: absolute;
  right: 28px;
  top: 50%;
  translate: 6px -50%;
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(29, 41, 59, 0.92);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    translate 0.2s var(--ease);
}

.hud-tick:hover .hud-tick-label,
.hud-tick:focus-visible .hud-tick-label {
  opacity: 1;
  translate: 0 -50%;
}

.hud-summon {
  position: fixed;
  right: var(--gutter);
  bottom: 16px;
  z-index: 40;
  display: inline-flex;
  gap: 5px;
  padding: 6px;
  border: 1px solid #172133;
  border-radius: 12px;
  background: linear-gradient(180deg, #2c3b54, #172133);
  box-shadow: 0 12px 24px -12px rgba(23, 33, 51, 0.6);
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.hud-summon:hover {
  transform: translateY(-2px);
}

/* MARK: Hero */

.hero {
  overflow: hidden;
  isolation: isolate;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

/* Sized so the longest line, braces included ("{{prompts}}." is 12
   monospace columns; "{{你的提示词}}" about 7.4em), never wraps. */
.hero-title {
  margin: 4px 0;
  font-size: clamp(2.4rem, 12.4vw, 7.2rem);
  white-space: nowrap;
  text-shadow: 0 2px 30px rgba(248, 250, 254, 0.9);
}

:root[data-lang="zh"] .hero-title {
  font-size: clamp(2.4rem, 11vw, 7rem);
}

.hero-lead {
  max-width: 44ch;
  font-size: clamp(1.05rem, 1.6vw, 1.26rem);
  color: var(--ink-2);
  text-shadow: 0 1px 14px rgba(248, 250, 254, 0.95);
}

.var {
  position: relative;
  display: inline-block;
  padding: 0 0.12em;
  border-radius: 0.16em;
  background: rgba(125, 173, 240, 0);
  color: var(--ink);
  animation: fill-var 0.9s 1.4s var(--ease) forwards;
}

.var .brace {
  display: inline-block;
  max-width: 1.3em;
  overflow: hidden;
  vertical-align: bottom;
  color: var(--blue);
  animation: drop-brace 0.7s 1.4s var(--ease) forwards;
}

@keyframes fill-var {
  to {
    background: rgba(125, 173, 240, 0.3);
    box-shadow: inset 0 -0.08em 0 rgba(61, 123, 214, 0.35);
  }
}

@keyframes drop-brace {
  to {
    max-width: 0;
    opacity: 0;
  }
}

.hero-keys {
  display: inline-flex;
  align-items: center;
  gap: clamp(10px, 2vw, 22px);
  padding: 6px 10px 16px;
  border-radius: 34px;
  cursor: pointer;
}

.hero-plus {
  font: 700 clamp(1.4rem, 3vw, 2.2rem) / 1 var(--font-mono);
  color: var(--ink-3);
}

.hero-keys:hover .keycap {
  transform: translateY(-2px);
}

.hero-press {
  margin: -12px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.hero-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* Real cards drifting around the headline. */
.hero-cards {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  translate: calc(var(--dx, 0) * -12px) calc(var(--dy, 0) * -10px);
  transition: translate 0.8s var(--ease);
}

.hero-card {
  position: absolute;
  width: clamp(196px, 15vw, 244px);
  pointer-events: auto;
  rotate: var(--r, 0deg);
  animation: hero-card-in 0.9s calc(0.3s + var(--slot) * 0.12s) var(--ease) backwards;
}

.hero-card .vp-card {
  width: 100%;
  height: auto;
  min-height: 0;
}

.hero-card .vp-card-prompt {
  max-height: 7em;
}

.hero-card:nth-child(1) { left: max(18px, 3vw); top: 15%; --r: -7deg; }
.hero-card:nth-child(2) { left: max(30px, 5.5vw); top: 57%; --r: 5deg; }
.hero-card:nth-child(3) { right: max(22px, 3.4vw); top: 13%; --r: 6deg; }
.hero-card:nth-child(4) { right: max(36px, 6vw); top: 56%; --r: -4deg; }

@keyframes hero-card-in {
  from {
    opacity: 0;
    translate: 0 40px;
    scale: 0.92;
  }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  translate: -50% 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-3);
}

.scroll-cue-line {
  position: relative;
  width: 1px;
  height: 38px;
  overflow: hidden;
  background: rgba(125, 160, 214, 0.3);
}

.scroll-cue-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 1px;
  height: 40%;
  background: var(--blue-deep);
  animation: cue 1.8s var(--ease) infinite;
}

@keyframes cue {
  to {
    top: 100%;
  }
}

/* MARK: Scenes */

html {
  scroll-behavior: smooth;
}

@media (min-width: 900px) and (min-height: 700px) {
  html {
    scroll-snap-type: y mandatory;
  }
}

.scene {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 96px var(--gutter) 76px;
  scroll-snap-align: start;
}

.scene-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.section-head {
  display: grid;
  gap: 20px;
  margin-bottom: clamp(26px, 3.4vw, 44px);
}

.section-head .display {
  font-size: clamp(2.2rem, 4.6vw, 4.4rem);
}

.section-head.is-split {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: end;
  gap: 20px 48px;
}

.section-head.is-split > div {
  display: grid;
  gap: 20px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-deep);
}

.vp-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid rgba(194, 209, 235, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f4f7fd);
  box-shadow: inset 0 1px 0 #fff, 0 1.5px 0 rgba(160, 180, 215, 0.45);
  font: 700 0.78rem/1 var(--font-mono);
  letter-spacing: 0;
  color: var(--ink);
}

/* MARK: Steps */

.loop-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.loop .section-head {
  margin-bottom: 0;
}

.loop .section-head .display {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
}

.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.surface {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.97);
  border-radius: 24px;
  background: linear-gradient(180deg, #fff, #f9fbff 60%, #f4f7fe);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 24px 36px -22px rgba(22, 42, 80, 0.3);
}

.step {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 228px;
  padding: 22px 24px 26px;
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.step-keys {
  display: flex;
  gap: 6px;
}

.step-index {
  font: 800 0.78rem/1 var(--font-mono);
  color: var(--ink-3);
}

.step h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  translate: calc(var(--px, 0) * 4px) calc(var(--py, 0) * 3px);
  transition: translate 0.2s var(--ease);
}

:root[data-lang="zh"] .step h3 {
  font-family: var(--font-sans);
  letter-spacing: 0;
}

.step p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-2);
}

/* MARK: Playground */

.playground {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  gap: 18px;
  height: clamp(320px, 42svh, 440px);
}

.templates .section-head {
  margin-bottom: 28px;
}

.templates .section-head .display {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 20px;
}

.pane-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 12px;
}

.pane-kicker {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.code-input {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #f7f9fe;
  font: 500 0.84rem/1.7 var(--font-mono);
  color: var(--ink);
  resize: none;
}

.code-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(125, 173, 240, 0.2);
}

.pg-form .vars,
.result-text {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.pg-form .vars {
  padding: 2px 4px 4px 2px;
}

.result-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink-2);
}

.seg {
  padding: 0.08em 0.24em;
  border-radius: 6px;
  background: var(--var-bg);
  color: var(--ink);
  font-weight: 600;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.seg-placeholder {
  background: rgba(204, 46, 41, 0.07);
  color: var(--required);
  font-weight: 500;
}

.syntax {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.syntax > div {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.syntax dt code {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--blue-deep);
  overflow-wrap: anywhere;
}

.syntax dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-2);
}

.syntax dd code {
  padding: 0.05em 0.3em;
  border-radius: 5px;
  background: var(--var-bg);
}

/* MARK: Variable form (playground and overlay) */

.vars,
.ov-vars-body {
  display: grid;
  align-content: start;
  gap: 16px;
}

.var-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.var-row.is-nested {
  margin-left: 6px;
  padding-left: 14px;
  border-left: 2px solid rgba(125, 173, 240, 0.4);
}

.var-row.is-disabled {
  opacity: 0.42;
}

.var-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
}

.var-required {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(204, 46, 41, 0.1);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--required);
}

.var-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, #fff, #f6f9ff);
  box-shadow: 0 6px 14px -12px rgba(22, 42, 80, 0.4);
  font: 500 0.86rem/1.5 var(--font-mono);
  color: var(--ink);
  resize: none;
  overflow: hidden;
}

.var-input::placeholder {
  color: rgba(97, 115, 140, 0.75);
}

.var-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(125, 173, 240, 0.2);
}

.var-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 13px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, #fff, #f7f9fe);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.choice:hover:not(:disabled) {
  border-color: var(--line-strong);
}

.choice:disabled,
.toggle:disabled {
  cursor: not-allowed;
}

.choice-mark {
  position: relative;
  width: 14px;
  height: 14px;
  border: 1.5px solid #a9b8cf;
  border-radius: 50%;
  background: #fff;
  flex: none;
}

.choice.is-multi .choice-mark {
  border-radius: 4px;
}

.choice.is-selected {
  border-color: rgba(125, 173, 240, 0.95);
  background: linear-gradient(180deg, rgba(232, 241, 255, 0.95), rgba(219, 233, 253, 0.95));
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(125, 173, 240, 0.14);
}

.choice.is-selected .choice-mark {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
  box-shadow: inset 0 0 0 2.5px #fff;
}

.choice.is-multi.is-selected .choice-mark {
  box-shadow: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 11px no-repeat,
    var(--blue-deep);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: 0.86rem;
  color: var(--ink-2);
  cursor: pointer;
}

.toggle-track {
  position: relative;
  flex: none;
  width: 42px;
  height: 25px;
  border-radius: 999px;
  background: #d5deeb;
  box-shadow: inset 0 1px 2px rgba(22, 42, 80, 0.18);
  transition: background 0.2s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(22, 42, 80, 0.3);
  transition: transform 0.2s var(--ease);
}

.toggle.is-on .toggle-track {
  background: var(--blue-deep);
}

.toggle.is-on .toggle-track::after {
  transform: translateX(17px);
}

.toggle.is-on {
  color: var(--ink);
}

.vars-empty {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-3);
}

/* MARK: Context */

.context-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.context .section-head {
  margin-bottom: 0;
}

.context .section-head .display {
  font-size: clamp(2.3rem, 5vw, 4.4rem);
}

.app-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px 0 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.15s;
}

.app-chip:hover {
  transform: translateY(-1px);
}

.app-mono {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(160deg, #3a4a64, #1c2638);
  font: 800 0.95rem/1 var(--font-mono);
  color: #fff;
}

.app-chip.is-selected {
  border-color: rgba(125, 173, 240, 0.95);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(125, 173, 240, 0.18), 0 14px 28px -18px rgba(22, 42, 80, 0.5);
}

.app-chip.is-selected .app-mono {
  background: linear-gradient(160deg, #6ea6f2, #3d7bd6);
}

.ctx-window {
  display: grid;
  gap: 20px;
  padding: 22px;
  min-height: 460px;
  align-content: start;
}

.ctx-head {
  display: flex;
  justify-content: center;
}

.ov-host {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: min(340px, 100%);
  height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.7), 0 10px 22px -16px rgba(22, 42, 80, 0.45);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.ov-host-box {
  width: 13px;
  height: 13px;
  border: 1.5px solid #6d7d95;
  border-radius: 3px;
}

.ctx-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 18px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: rgba(247, 250, 255, 0.85);
  align-items: center;
}

.ctx-facts dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ctx-facts dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.ctx-facts dd code {
  font-size: 0.78rem;
  color: var(--ink-3);
}

.ctx-facts .ctx-var {
  font-size: 0.86rem;
  color: var(--blue-deep);
  font-weight: 700;
}

.ctx-arrow {
  color: var(--ink-3);
}

.ctx-cards {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ctx-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fafe);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.55), 0 12px 24px -20px rgba(22, 42, 80, 0.55);
  animation: ctx-in 0.45s calc(var(--i) * 60ms) var(--ease) both;
}

.ctx-card-title {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

:root[data-lang="zh"] .ctx-card-title {
  font-family: var(--font-sans);
}

@keyframes ctx-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* MARK: Styles */

.styles {
  color: var(--s-ink);
  background: var(--s-bg);
  transition:
    background-color 0.6s,
    color 0.6s;
  isolation: isolate;
  overflow: hidden;
  --s-bg: rgba(241, 246, 253, 0.82);
  --s-ink: var(--ink);
  --s-ink-2: var(--ink-2);
  --s-accent: var(--blue-deep);
  --s-head: var(--font-mono);
}

.styles::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--s-glow);
}

.styles[data-style="floating"] {
  --s-glow: radial-gradient(70% 60% at 70% 30%, rgba(150, 196, 246, 0.35), transparent 70%);
}

.styles[data-style="holo"] {
  --s-bg: #1f2133;
  --s-ink: #f4ead6;
  --s-ink-2: rgba(244, 234, 214, 0.72);
  --s-accent: #e8bb62;
  --s-glow: radial-gradient(60% 50% at 15% 0%, rgba(232, 187, 98, 0.22), transparent 70%),
    radial-gradient(50% 60% at 90% 100%, rgba(129, 120, 255, 0.28), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px) 0 0 / 32px 100%;
}

.styles[data-style="paper"] {
  --s-bg: #efe7d6;
  --s-ink: #2b241c;
  --s-ink-2: rgba(43, 36, 28, 0.72);
  --s-accent: #a5532c;
  --s-head: var(--font-serif);
  --s-glow: radial-gradient(80% 60% at 50% 0%, rgba(255, 255, 255, 0.5), transparent 70%),
    repeating-linear-gradient(0deg, rgba(90, 70, 40, 0.035) 0 1px, transparent 1px 3px);
}

.styles[data-style="ascii"] {
  --s-bg: #0a0c0b;
  --s-ink: #b8f3c6;
  --s-ink-2: rgba(184, 243, 198, 0.7);
  --s-accent: #6fe18f;
  --s-glow: radial-gradient(60% 50% at 50% 0%, rgba(111, 225, 143, 0.14), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
}

.styles .section-head .display,
.styles .lead {
  color: inherit;
}

.styles .lead {
  color: var(--s-ink-2);
}

.styles .kicker {
  color: var(--s-accent);
}

.styles:not([data-style="floating"]) .vp-num {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  color: inherit;
}

.styles[data-style="paper"] .vp-num {
  border-color: rgba(43, 36, 28, 0.3);
  background: rgba(255, 255, 255, 0.5);
}

.style-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.5fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
}

.style-copy-col .section-head {
  margin-bottom: 26px;
}

.style-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.style-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px 0 7px;
  border: 1px solid color-mix(in srgb, var(--s-ink) 22%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--s-bg) 70%, white 30%);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--s-ink);
  cursor: pointer;
}

.style-tab-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--s-ink) 25%, transparent);
  font: 700 0.76rem/1 var(--font-mono);
}

.style-tab.is-selected {
  border-color: var(--s-accent);
  background: var(--s-accent);
  color: var(--s-bg);
}

.style-tab.is-selected .style-tab-num {
  border-color: transparent;
  background: color-mix(in srgb, var(--s-bg) 25%, transparent);
}

.style-copy h3 {
  margin-bottom: 12px;
  font-family: var(--s-head);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: inherit;
}

.styles[data-style="holo"] .style-copy h3 {
  text-shadow: 0 0 28px rgba(232, 187, 98, 0.55);
}

.styles[data-style="paper"] .style-copy h3 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

.styles[data-style="ascii"] .style-copy h3::before {
  content: "# ";
  color: var(--s-accent);
}

.style-copy p {
  margin: 0;
  font-size: 1.02rem;
  color: var(--s-ink-2);
}

.styles[data-style="ascii"] .style-copy p {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.style-shot {
  margin: 0;
}

.shot-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: none;
  cursor: zoom-in;
  perspective: 1600px;
}

.shot-button img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--s-ink) 14%, transparent);
  box-shadow: 0 50px 90px -40px rgba(0, 0, 0, 0.55);
  transform: rotateY(-6deg) rotateX(3deg);
  transform-origin: 60% 50%;
  transition:
    transform 0.6s var(--ease),
    box-shadow 0.6s var(--ease);
  animation: shot-in 0.5s var(--ease);
}

.shot-button:hover img,
.shot-button:focus-visible img {
  transform: none;
  box-shadow: 0 60px 110px -40px rgba(0, 0, 0, 0.6);
}

@keyframes shot-in {
  from {
    opacity: 0.2;
    translate: 0 8px;
  }
}

.zoom-hint {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(23, 33, 51, 0.82);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0;
  translate: 0 6px;
  transition:
    opacity 0.25s,
    translate 0.25s var(--ease);
  backdrop-filter: blur(6px);
}

.shot-button:hover .zoom-hint,
.shot-button:focus-visible .zoom-hint {
  opacity: 1;
  translate: 0 0;
}

/* MARK: Bento */

.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 22px 24px;
  overflow: hidden;
}

.tile h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.18rem;
  letter-spacing: -0.03em;
}

:root[data-lang="zh"] .tile h3 {
  font-family: var(--font-sans);
  letter-spacing: 0;
}

.tile p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.diff {
  display: grid;
  margin-top: auto;
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: #f9fbff;
  font: 500 0.72rem/1.65 var(--font-mono);
  overflow: hidden;
}

.diff-line {
  display: block;
  padding: 1px 12px 1px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
}

.diff-gutter {
  display: inline-block;
  width: 32px;
  text-align: center;
  color: var(--ink-3);
}

.diff-line.is-del {
  background: rgba(220, 70, 60, 0.08);
  color: #a33b33;
}

.diff-line.is-add {
  background: rgba(52, 168, 84, 0.1);
  color: #1f7a3c;
}

.terminal {
  margin: auto 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-s);
  background: #131b29;
  color: #d9e6ff;
  font-size: 0.72rem;
  line-height: 1.65;
  overflow-x: auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.terminal .prompt {
  color: var(--blue);
}

.approval {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 30px -24px rgba(22, 42, 80, 0.55);
}

.approval-text {
  display: grid;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.approval-text strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.84rem;
}

.approval .button {
  flex: none;
  pointer-events: none;
}

.sync-map {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.sync-node {
  flex: none;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  font: 700 0.72rem/1 var(--font-mono);
  color: var(--ink);
}

.sync-node.is-lock {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.sync-wire {
  flex: 1;
  min-width: 10px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--blue) 0 6px, transparent 6px 11px);
  background-size: 22px 2px;
  animation: wire 1.2s linear infinite;
}

@keyframes wire {
  to {
    background-position: 22px 0;
  }
}

.text-link {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--blue-deep);
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.sound-rings {
  position: relative;
  flex: 1;
  height: 54px;
}

.sound-rings span {
  position: absolute;
  left: 30%;
  top: 50%;
  width: 40px;
  height: 22px;
  border: 2px solid var(--band);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ring 3s var(--ease) infinite;
  opacity: 0;
}

.sound-rings span:nth-child(2) {
  animation-delay: 1s;
}

.sound-rings span:nth-child(3) {
  animation-delay: 2s;
}

@keyframes ring {
  0% {
    opacity: 0.9;
    width: 20px;
    height: 12px;
  }
  100% {
    opacity: 0;
    width: 200px;
    height: 80px;
  }
}

.tile-sound .button[aria-pressed="true"] {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.tile .ticker {
  margin-top: auto;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  color: var(--blue-deep);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticker.is-flip {
  animation: flip 0.45s var(--ease);
}

@keyframes flip {
  from {
    opacity: 0;
    translate: 0 40%;
  }
}

.tile .file-chip {
  display: inline-flex;
  align-self: flex-start;
  gap: 12px;
  margin-top: auto;
  padding: 8px 12px;
  border-radius: 10px;
  background: #131b29;
  font: 600 0.78rem/1 var(--font-mono);
  color: #d9e6ff;
}

.file-chip .perm {
  color: #8fe3a8;
}

/* MARK: CTA and footer */

.cta {
  grid-template-rows: 1fr auto;
  padding-bottom: 0;
  text-align: center;
}

.cta-inner {
  display: grid;
  justify-items: center;
  align-self: center;
  gap: 22px;
}

.cta-icon {
  width: 112px;
  height: 112px;
  filter: drop-shadow(0 24px 30px rgba(22, 42, 80, 0.35));
}

.cta .display {
  font-size: clamp(2.8rem, 8vw, 7rem);
  text-shadow: 0 2px 30px rgba(248, 250, 254, 0.9);
}

.cta .lead {
  text-shadow: 0 1px 14px rgba(248, 250, 254, 0.95);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 26px;
  padding: 28px var(--gutter) 64px;
  font-size: 0.84rem;
  color: var(--ink-3);
}

.site-footer a {
  color: var(--ink-2);
}

/* MARK: Overlay cards */

.vp-card {
  --accent: var(--blue);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  min-height: 280px;
  padding: 16px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.97);
  border-radius: 24px;
  background: linear-gradient(180deg, #fff, #f9fbff 60%, #f4f7fe);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 24px 36px -22px rgba(22, 42, 80, 0.3);
  text-align: left;
  cursor: pointer;
}

.vp-card.is-dimmed {
  opacity: 0.18;
  pointer-events: none;
  filter: saturate(0.4);
  transition: opacity 0.25s;
}

.vp-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.vp-star {
  color: var(--star);
  font-size: 1rem;
}

.vp-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font: 700 0.72rem/1 var(--font-mono);
  color: var(--ink);
}

.vp-count .icon {
  width: 0.95em;
  height: 0.95em;
  color: var(--ink-2);
}

.vp-card-title {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--ink);
  translate: calc(var(--px, 0) * 4px) calc(var(--py, 0) * 3px);
  transition: translate 0.2s var(--ease);
}

:root[data-lang="zh"] .vp-card-title {
  font-family: var(--font-sans);
  letter-spacing: 0;
  font-size: 1.2rem;
}

.vp-card-desc {
  flex: none;
  font-size: 0.74rem;
  line-height: 1.45;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vp-card-label {
  flex: none;
  margin-top: 4px;
  font: 800 0.62rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: #4d607d;
}

.vp-card-label::after {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--accent);
}

/* The prompt takes whatever height the card has left and fades out. */
.vp-card-prompt {
  flex: 1 1 auto;
  min-height: 2em;
  margin: 0;
  overflow: hidden;
  font: 500 0.7rem/1.7 var(--font-mono);
  color: #47546a;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 1.6em), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 1.6em), transparent);
}

.vp-card-prompt .seg {
  padding: 0.05em 0.2em;
  background: color-mix(in srgb, var(--accent) 16%, white);
  font-weight: 700;
  color: var(--ink);
}

.vp-card-prompt .seg-placeholder {
  background: color-mix(in srgb, var(--accent) 9%, white);
  color: var(--ink);
}

.vp-card-foot {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.vp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.vp-tag {
  padding: 3px 7px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, white);
  font: 700 0.66rem/1.2 var(--font-mono);
  color: var(--ink);
}

.vp-version {
  margin-left: auto;
  font: 800 0.8rem/1 var(--font-mono);
}

.vp-card.is-large {
  min-height: 0;
  padding: 26px 26px 22px;
  cursor: default;
}

.vp-card.is-large .vp-card-title {
  font-size: 2rem;
}

.vp-card.is-large .vp-card-desc {
  font-size: 1rem;
  -webkit-line-clamp: 3;
}

.vp-card.is-large .vp-card-prompt {
  max-height: 14em;
  font-size: 0.9rem;
}

/* MARK: Motion — the app's idle sway and hover tilt */

/* The sway runs on its own animatable angle so that hovering can blend it
   out (the app's hover blend) without restarting the card's animations. */
@property --sway {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --sway-amount {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

[data-tilt] {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    scale 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.3s var(--ease),
    --sway-amount 0.18s ease-out;
}

[data-tilt].is-hovering {
  z-index: 2;
  scale: 1.07;
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 40px 60px -26px rgba(22, 42, 80, 0.42);
  transition:
    transform 0.12s ease-out,
    scale 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s var(--ease),
    --sway-amount 0.18s ease-out;
}

[data-tilt].is-hovering.is-held {
  scale: 1.04;
  transition:
    transform 0.12s ease-out,
    scale 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.3s var(--ease),
    --sway-amount 0.18s ease-out;
}

/* ±1.5° over 2.6 s: alternate half cycles with a sine-like ease. */
.sways {
  rotate: calc(var(--sway) * var(--sway-amount));
  animation: sway 1.3s ease-in-out calc(var(--phase, 0) * -2.6s) infinite alternate;
}

.sways.is-hovering {
  --sway-amount: 0;
}

@keyframes sway {
  from {
    --sway: -1.5deg;
  }
  to {
    --sway: 1.5deg;
  }
}

/* MARK: Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 72px clamp(16px, 4vw, 64px) 40px;
  background: rgba(14, 20, 32, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transition: opacity 0.22s ease;
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox-figure {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100svh - 150px);
  border-radius: 16px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.7);
  scale: 0.96;
  transition: scale 0.3s var(--ease);
  cursor: default;
}

.lightbox.is-open .lightbox-figure img {
  scale: 1;
}

.lightbox-figure figcaption {
  max-width: 70ch;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

/* Fixed to the lightbox itself, which scrolls sideways on phones. */
.lightbox-close {
  position: fixed;
  z-index: 1;
  left: clamp(16px, 4vw, 32px);
  top: 22px;
  min-width: 58px;
  height: 36px;
  cursor: pointer;
}

/* MARK: Overlay */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: linear-gradient(180deg, rgba(238, 244, 252, 0.9), rgba(248, 250, 254, 0.9));
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  opacity: 0;
  transition: opacity 0.25s ease;
  isolation: isolate;
}

.overlay[hidden] {
  display: none;
}

.overlay.is-open {
  opacity: 1;
}

.ov-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 10px;
}

.ov-esc {
  position: absolute;
  left: 32px;
  top: 28px;
  min-width: 58px;
  height: 36px;
  cursor: pointer;
}

.ov-tools {
  position: absolute;
  right: 32px;
  top: 28px;
  display: grid;
  gap: 10px;
}

.ov-tool {
  width: 52px;
  height: 32px;
  padding: 0;
  cursor: pointer;
}

.ov-tool.is-static {
  cursor: default;
  color: var(--ink);
}

.ov-tool .icon,
.ov-tool svg {
  width: 17px;
  height: 17px;
}

.ov-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  justify-items: center;
  overflow: visible;
  padding: 18px max(104px, 6vw) 8px;
}

.ov-focus {
  justify-self: stretch;
}

.overlay.is-focused .ov-stage {
  overflow: auto;
}

.ov-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
  max-width: 1280px;
  margin: 0 auto;
  transform-origin: 50% 0;
  translate: var(--fit-x, 0) 0;
  scale: var(--fit, 1);
}

/* The app's classic grid: five fixed-size cards per row, scaled as a whole
   (by overlay.mjs) when the screen is smaller than the grid. */
@media (min-width: 721px) {
  .ov-grid {
    grid-template-columns: repeat(5, 236px);
    width: max-content;
  }

  .ov-grid .vp-card {
    height: 300px;
    min-height: 0;
  }
}

.overlay.is-open .ov-grid .vp-card {
  animation:
    card-in 0.5s var(--delay, 0ms) var(--ease) backwards,
    sway 1.3s ease-in-out calc(var(--phase, 0) * -2.6s) infinite alternate;
}

@keyframes card-in {
  from {
    opacity: 0;
    translate: 0 18px;
    scale: 0.97;
  }
}

.overlay.is-focused .ov-grid,
.overlay.is-focused .ov-empty {
  display: none;
}

.ov-empty {
  margin: 40px 0;
  text-align: center;
  font-family: var(--font-mono);
  color: var(--ink-3);
}

.ov-footer {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 24px 22px;
}

.overlay.is-focused .ov-footer {
  display: none;
}

.ov-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: min(820px, 100%);
}

.ov-filter,
.ov-search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 12px 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.97);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.65), 0 18px 34px -24px rgba(22, 42, 80, 0.55);
}

.ov-filter {
  min-width: 220px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.ov-filter span:nth-child(2) {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.ov-filter-icon,
.ov-search-icon {
  font-size: 1.1rem;
  color: var(--ink-3);
}

.ov-search {
  flex: 1;
  min-width: 240px;
}

.ov-search-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.98rem;
  color: var(--ink);
}

.ov-search-input:focus {
  outline: none;
}

.ov-search:focus-within {
  box-shadow: inset 0 0 0 1px rgba(125, 173, 240, 0.9), 0 0 0 4px rgba(125, 173, 240, 0.18);
}

.ov-hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-3);
}

.ov-focus {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 22px;
  max-width: 1400px;
  min-height: 100%;
  margin: 0 auto;
  animation: focus-in 0.4s var(--ease);
}

.ov-focus[hidden] {
  display: none;
}

@keyframes focus-in {
  from {
    opacity: 0;
    scale: 0.98;
  }
}

.ov-focus-left {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
  min-width: 0;
}

.ov-pane {
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.97);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, #fff, #f9fbff 60%, #f4f7fe);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 24px 36px -22px rgba(22, 42, 80, 0.3);
}

.ov-pane-kicker {
  margin: 0 0 6px;
  font: 800 0.72rem/1.2 var(--font-sans);
  color: #4d607d;
}

.ov-pane-title {
  margin: 0 0 16px;
  font-size: 1.2rem;
  color: var(--ink);
}

.ov-preview {
  display: flex;
  flex-direction: column;
}

.ov-preview-text {
  flex: 1;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-2);
}

.ov-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.ov-shortcuts {
  display: grid;
  align-content: start;
  gap: 12px;
}

.ov-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.ov-shortcut-keys {
  display: flex;
  gap: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  z-index: 200;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.97);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.7), 0 20px 40px -18px rgba(22, 42, 80, 0.5);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  opacity: 0;
  transform: translate(-50%, -14px);
  pointer-events: none;
  transition:
    opacity 0.25s,
    transform 0.25s var(--ease);
}

.toast::before {
  content: "✓";
  margin-right: 8px;
  color: var(--blue-deep);
}

.toast[data-kind="warning"]::before {
  content: "!";
  color: #dc7309;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* MARK: Reveal */

.is-ready [data-reveal]:not(.is-in) {
  opacity: 0;
  translate: 0 26px;
}

[data-reveal]:not([data-tilt]) {
  transition:
    opacity 0.8s var(--ease),
    translate 0.8s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}

/* Tilting cards keep their own transitions and add the reveal to them. */
[data-reveal][data-tilt]:not(.is-hovering) {
  transition:
    transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1),
    scale 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.3s var(--ease),
    --sway-amount 0.18s ease-out,
    opacity 0.8s var(--ease) calc(var(--i, 0) * 90ms),
    translate 0.8s var(--ease) calc(var(--i, 0) * 90ms);
}

/* MARK: Responsive */

/* Too narrow for cards beside the headline: they fan out below it instead,
   like a hand of cards, and still open in the demo when tapped. */
@media (max-width: 1240px) {
  .hero {
    grid-template-rows: auto auto;
    align-content: center;
  }

  .hero-cards {
    --w: 200px;
    position: relative;
    inset: auto;
    order: 2;
    height: calc(var(--w) * 0.96);
    margin-top: 28px;
    translate: none;
  }

  .hero-card {
    left: calc(50% - var(--w) / 2 + var(--x)) !important;
    right: auto !important;
    top: var(--y) !important;
    width: var(--w);
    rotate: var(--r);
  }

  .hero-card:nth-child(1) { --x: calc(var(--w) * -0.72); --y: 26px; --r: -13deg; z-index: 1; }
  .hero-card:nth-child(2) { --x: calc(var(--w) * -0.24); --y: 4px; --r: -4deg; z-index: 2; }
  .hero-card:nth-child(3) { --x: calc(var(--w) * 0.24); --y: 4px; --r: 4deg; z-index: 2; }
  .hero-card:nth-child(4) { --x: calc(var(--w) * 0.72); --y: 26px; --r: 13deg; z-index: 1; }

  .hero-card .vp-card-prompt {
    max-height: 5.2em;
  }

  .scroll-cue {
    display: none;
  }
}

@media (max-width: 1100px) {
  .nav-links {
    display: none;
  }

  .loop-grid,
  .context-grid,
  .style-layout,
  .section-head.is-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .playground {
    grid-template-columns: 1fr 1fr;
    height: auto;
  }

  .pg-source {
    grid-column: 1 / -1;
  }

  .code-input {
    min-height: 200px;
  }

  .pg-form .vars,
  .result-text {
    max-height: 360px;
  }

  .syntax {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shot-button img {
    transform: none;
  }
}

@media (max-width: 900px) {
  .ov-focus {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .ov-focus-left {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto;
  }
}

/* Short screens: the focused card gives up its shortcut pane first. */
@media (max-height: 640px) and (min-width: 901px) {
  .ov-focus-left {
    grid-template-rows: auto;
  }

  .ov-shortcuts {
    display: none;
  }

  .vp-card.is-large .vp-card-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .site-header {
    inset: 8px 12px auto;
    gap: 8px;
    padding: 0 6px 0 12px;
  }

  .brand span {
    display: none;
  }

  .keycap-button {
    padding: 0 12px 0 6px;
  }

  .hud-index,
  .hud-rail,
  .scroll-cue {
    display: none;
  }

  .hud-summon {
    right: 14px;
    bottom: 14px;
  }

  .scene {
    min-height: 0;
    padding: 88px var(--gutter) 64px;
  }

  .hero {
    min-height: 100svh;
  }

  .steps,
  .playground,
  .bento {
    grid-template-columns: minmax(0, 1fr);
  }

  .syntax {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .step {
    min-height: 0;
  }

  .ctx-window {
    min-height: 0;
    padding: 16px;
  }

  .ctx-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .sync-map {
    flex-wrap: wrap;
  }

  .zoom-hint {
    opacity: 1;
    translate: 0 0;
  }

  .ov-top {
    padding: 18px 16px 8px;
    justify-content: flex-end;
  }

  .ov-esc {
    left: 16px;
    top: 18px;
  }

  .ov-host {
    min-width: 0;
    margin-right: 64px;
  }

  .ov-tools {
    right: 16px;
    top: 18px;
  }

  .ov-tool.is-static {
    display: none;
  }

  .ov-stage {
    overflow: auto;
    padding: 18px 16px 24px;
  }

  .ov-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .ov-grid .vp-card {
    height: 236px;
    padding: 14px;
    border-radius: 20px;
  }

  .ov-focus,
  .ov-focus-left {
    grid-template-columns: minmax(0, 1fr);
  }

  .ov-shortcuts,
  .ov-hint {
    display: none;
  }

  .ov-filter {
    min-width: 0;
    flex: none;
    padding: 0 16px;
  }

  .ov-filter .keycap,
  .ov-search .keycap {
    display: none;
  }
}

/* MARK: Phones */

@media (max-width: 720px) {
  .site-header {
    top: max(8px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
  }

  /* The header already offers the demo; the floating key only shows while it is away. */
  .hud-summon {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    opacity: 0;
    translate: 0 14px;
    pointer-events: none;
    transition:
      opacity 0.25s,
      translate 0.3s var(--ease);
  }

  :root.nav-hidden .hud-summon {
    opacity: 1;
    translate: 0 0;
    pointer-events: auto;
  }

  .hero {
    padding-top: 92px;
    padding-bottom: 28px;
  }

  .hero-inner {
    gap: 16px;
  }

  .hero-lead {
    font-size: 1rem;
  }

  .hero-cards {
    --w: 148px;
    margin-top: 18px;
  }

  .hero-card .vp-card {
    padding: 12px 13px;
    border-radius: 18px;
  }

  .hero-card .vp-card-title {
    font-size: 0.98rem;
  }

  .hero-card .vp-card-desc {
    font-size: 0.66rem;
  }

  .hero-card .vp-card-prompt {
    font-size: 0.6rem;
  }

  .section-head .display,
  .loop .section-head .display,
  .templates .section-head .display {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  /* Steps: a swipeable row with the next card peeking in. */
  .steps {
    display: flex;
    gap: 14px;
    margin: 4px calc(-1 * var(--gutter)) 0;
    padding: 10px var(--gutter) 28px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .steps::-webkit-scrollbar {
    display: none;
  }

  .step {
    flex: 0 0 80%;
    min-height: 212px;
    scroll-snap-align: start;
  }

  /* The playground grows with its content instead of scrolling inside the page. */
  .playground {
    height: auto;
  }

  .code-input {
    min-height: 210px;
  }

  .pg-form .vars,
  .result-text {
    max-height: none;
    overflow: visible;
  }

  .syntax dd {
    font-size: 0.76rem;
  }

  .style-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .style-tab {
    justify-content: flex-start;
  }

  .tile {
    padding: 20px;
  }

  .cta {
    padding-bottom: 0;
  }

  .site-footer {
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }

  /* iOS zooms into fields set below 16px. */
  .code-input,
  .var-input,
  .ov-search-input {
    font-size: 16px;
  }

  /* The demo on a phone. */
  .ov-top {
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .ov-bottom {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .ov-filter {
    height: 48px;
    gap: 8px;
    padding: 0 14px;
  }

  .ov-search {
    min-width: 0;
    height: 48px;
    padding: 0 14px;
  }

  .ov-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .ov-focus-left {
    display: none;
  }

  /* Fade only: a scale would re-anchor the fixed action bar while it runs. */
  .ov-focus {
    gap: 14px;
    animation: focus-fade 0.3s var(--ease);
  }

  @keyframes focus-fade {
    from {
      opacity: 0;
    }
  }

  .overlay.is-focused .ov-stage {
    padding-bottom: 104px;
  }

  .ov-pane {
    padding: 20px;
  }

  .ov-preview-text {
    font-size: 0.95rem;
  }

  /* Copy and write-back stay at the thumb while the fields scroll. */
  .ov-preview-actions {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.96);
    border-radius: 20px;
    background: rgba(248, 251, 255, 0.86);
    box-shadow: inset 0 0 0 1px rgba(217, 227, 245, 0.6), 0 18px 40px -18px rgba(22, 42, 80, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .ov-preview-actions .button {
    height: 44px;
  }

  /* Screenshots are wide: let them run past the screen and pan. */
  .lightbox {
    place-items: center start;
    padding: 72px 0 32px;
    overflow-x: auto;
    overscroll-behavior: contain;
  }

  .lightbox-figure {
    justify-items: start;
    padding: 0 16px;
  }

  .lightbox-figure img {
    width: 190vw;
    max-width: none;
    max-height: none;
  }

  .lightbox-figure figcaption {
    position: sticky;
    left: 16px;
    max-width: calc(100vw - 32px);
    text-align: left;
  }
}

/* Touch screens: no keyboard to press, nothing to hover. */
@media (hover: none) and (pointer: coarse) {
  button,
  a,
  .vp-card,
  .hero-keys {
    -webkit-tap-highlight-color: transparent;
  }

  .vp-card:active,
  .hero-keys:active .keycap {
    scale: 0.97;
  }

  .ov-esc,
  .lightbox-close {
    font-size: 0;
  }

  .ov-esc::before,
  .lightbox-close::before {
    content: "✕";
    font-size: 0.9rem;
  }

  .ov-hint,
  .ov-shortcuts,
  .ov-filter .keycap,
  .ov-search .keycap {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .sways,
  .scroll-cue-line::after {
    animation: none !important;
  }

  .sound-rings span {
    opacity: 0.5;
  }
}

