:root {
  --bg: #07080a;
  --surface-1: #0d0f13;
  --surface-2: #12151b;
  --surface-3: #191d26;
  --surface-inset: #090b0e;

  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.135);
  --specular: rgba(255, 255, 255, 0.08);

  --text-primary: #f4f5f8;
  --text-secondary: #9da6b5;
  --text-muted: #707989;

  --accent: #eab05c;
  --accent-bright: #f6c478;
  --accent-ink: #0b0d11;
  --accent-soft: rgba(234, 176, 92, 0.13);
  --accent-soft-strong: rgba(234, 176, 92, 0.22);
  --accent-line: rgba(234, 176, 92, 0.44);

  --sage: #74c6a3;
  --sage-soft: rgba(116, 198, 163, 0.15);
  --sage-line: rgba(116, 198, 163, 0.42);

  --iris: #9db2f6;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "Noto Sans CJK SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-prose: "Iowan Old Style", "Charter", "Palatino", "Georgia", serif;

  --text-heading: clamp(1.625rem, 2.5vw, 2.25rem);
  --text-body: 1rem;
  --text-sm: 0.875rem;
  --text-prose: clamp(1.0625rem, 1.32vw, 1.22rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.2, 0, 0, 1);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 9px;
  --radius-sm: 6px;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.75rem;
  background-color: var(--bg);
  color: var(--text-primary);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 76% 420px at 50% -70px, rgba(234, 176, 92, 0.13), rgba(136, 155, 204, 0.035) 52%, transparent 82%),
    radial-gradient(ellipse 48% 300px at 82% 8%, rgba(255, 255, 255, 0.028), transparent 72%);
  background-repeat: no-repeat;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: rgba(234, 176, 92, 0.28);
  color: #ffffff;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.icon {
  display: block;
  flex-shrink: 0;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
dialog:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(100%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  left: 1rem;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.5rem 0.875rem;
  clip-path: none;
  background-color: var(--text-primary);
  color: var(--bg);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  z-index: 100;
}

.wrap {
  width: min(1120px, calc(100% - clamp(2.5rem, 7vw, 7rem)));
  margin-inline: auto;
}

.dict-meta {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Header (Seamless y = 0 bleed, frosted separation on scroll)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(7, 8, 10, 0);
  border-bottom: 1px solid transparent;
  transition:
    background-color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    backdrop-filter 200ms var(--ease-out);
}

html[data-scrolled="true"] .site-header {
  background-color: rgba(7, 8, 10, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line);
}

.nav-bar {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.brand-name {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.125rem, 2.4vw, 2rem);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.site-nav > a:not(.nav-cta) {
  white-space: nowrap;
  transition: color 150ms var(--ease-out);
}

.site-nav .nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.125rem;
  padding: 0 0.6875rem 0 0.8125rem;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.075);
  border: 1px solid var(--line-strong);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition:
    background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    transform 150ms var(--ease-out);
}

.site-nav .nav-cta:active {
  transform: scale(0.96);
}

/* ==========================================================================
   Hero & Live Reading Workbench
   ========================================================================== */
.hero {
  padding-top: clamp(3rem, 7.2vh, 5.25rem);
  padding-bottom: clamp(4.5rem, 8vw, 7.5rem);
}

.hero-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: clamp(2.25rem, 4.8vh, 3.5rem);
}

.product-intro {
  margin: 0 0 clamp(18px, 2.6vh, 28px);
  font: 400 clamp(1rem, 1.35vw, 1.18rem)/1.65 var(--font-sans);
  color: #cdd1d8;
  text-wrap: balance;
}
.product-intro span { display: inline-block; }

.hero-head h1 {
  margin: 0;
  max-width: 24ch;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(2.25rem, 4.3vw, 3.875rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-feature-settings: "halt" 1;
  color: var(--text-primary);
  text-wrap: balance;
}

@supports (-webkit-background-clip: text) {
  .hero-head h1 {
    background-image: linear-gradient(180deg, #ffffff 18%, #e2e6ef 74%, #aeb7c8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.h1-clause {
  display: inline-block;
}

.hero-actions {
  margin-top: clamp(1.375rem, 2.8vh, 1.875rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5625rem;
  min-height: 2.875rem;
  padding: 0 1.0625rem 0 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background-color: #f2f4f8;
  background-image: linear-gradient(180deg, #ffffff 0%, #e5e8f0 100%);
  color: #090b0f;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 10px 28px -8px rgba(0, 0, 0, 0.65);
  transition:
    transform 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out),
    filter 150ms var(--ease-out);
}

.btn-primary:active {
  transform: scale(0.96);
}

/* Linear-grade Obsidian Glass Workbench */
.workbench {
  background-color: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 32px 80px -28px rgba(0, 0, 0, 0.82);
  overflow: hidden;
}

.wb-topbar {
  min-height: 3.5rem;
  padding: 0.625rem clamp(1.125rem, 2.4vw, 1.875rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background-color: rgba(255, 255, 255, 0.016);
  border-bottom: 1px solid var(--line);
}

/* Concentric Segmented Controls (outer 9px = inner 6px + 3px pad) */
.passage-switch,
.seg-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 3px;
  gap: 2px;
  background-color: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.doc-tab,
.seg-btn {
  min-height: 1.875rem;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition:
    color 150ms var(--ease-out),
    background-color 150ms var(--ease-out),
    box-shadow 150ms var(--ease-out);
}

.doc-tab.is-active,
.seg-btn.is-active {
  background-color: var(--surface-3);
  color: var(--text-primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Switch Control */
.switch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0 0.75rem 0 0.5rem;
  border-radius: var(--radius-md);
  background-color: var(--surface-inset);
  border: 1px solid var(--line-strong);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  transition:
    color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    background-color 150ms var(--ease-out);
}

.switch-track {
  position: relative;
  width: 26px;
  height: 15px;
  border-radius: 999px;
  background-color: var(--surface-3);
  border: 1px solid var(--line-strong);
  flex-shrink: 0;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

.switch-thumb {
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  transition:
    transform 180ms var(--ease-spring),
    background-color 160ms var(--ease-out);
}

.switch-pill[aria-pressed="true"],
.switch-pill.is-on {
  color: var(--text-primary);
  border-color: var(--accent-line);
  background-color: var(--accent-soft);
}

.switch-pill[aria-pressed="true"] .switch-track,
.switch-pill.is-on .switch-track {
  background-color: rgba(234, 176, 92, 0.32);
  border-color: var(--accent);
}

.switch-pill[aria-pressed="true"] .switch-thumb,
.switch-pill.is-on .switch-thumb {
  transform: translateX(11px);
  background-color: var(--accent-bright);
}

.wb-body {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(310px, 1fr);
  min-height: 25rem;
}

/* Reader Pane */
.reader-pane {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.75rem;
  min-width: 0;
  padding: clamp(1.5rem, 3vw, 2.375rem) clamp(1.375rem, 2.8vw, 2.375rem);
  border-inline-end: 1px solid var(--line);
}

.reader-article {
  flex: 1;
}

.reader-article h2 {
  margin: 0 0 1.25rem;
  font-family: var(--font-prose);
  font-weight: 600;
  font-size: clamp(1.375rem, 1.9vw, 1.75rem);
  line-height: 1.28;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.passage-prose {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  max-width: 56ch;
}

.sent-block {
  margin: 0;
  padding: 0.375rem 0.625rem;
  margin-inline: -0.625rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out);
}

.sent-block.is-context {
  background-color: rgba(255, 255, 255, 0.022);
  border-left-color: rgba(234, 176, 92, 0.55);
}

.sent-en {
  display: block;
  font-family: var(--font-prose);
  font-size: var(--text-prose);
  line-height: 1.72;
  color: #e3e6ee;
  text-wrap: pretty;
}

.sent-zh {
  display: block;
  margin-top: 0.45rem;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.62;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.term {
  display: inline;
  font: inherit;
  line-height: 1.3;
  color: #f6f7fa;
  padding: 0.05em 0.22em;
  margin-inline: -0.04em;
  border-radius: 4px;
  border-bottom: 1px dashed rgba(234, 176, 92, 0.55);
  transition:
    background-color 140ms var(--ease-out),
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out);
}

.term[aria-pressed="true"] {
  background-color: var(--accent-soft-strong);
  color: var(--accent-bright);
  border-bottom: 1.5px solid var(--accent);
}

.term.is-saved::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 3px;
  vertical-align: super;
  border-radius: 50%;
  background-color: var(--sage);
}

.reader-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--line);
}

.reader-status {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.kbd-sep {
  opacity: 0.5;
  margin-inline: 0.15rem;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.32rem;
  border-radius: 4px;
  background-color: var(--surface-2);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.45);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1;
  color: var(--text-secondary);
}

/* Extension Sidebar Pane */
.extension-pane {
  background-color: var(--surface-inset);
  display: flex;
  flex-direction: column;
}

.ext-tabs {
  display: flex;
  align-items: stretch;
  gap: 1.375rem;
  padding-inline: clamp(1.25rem, 2.4vw, 1.75rem);
  min-height: 3.125rem;
  border-bottom: 1px solid var(--line);
}

.ext-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition:
    color 150ms var(--ease-out),
    border-color 150ms var(--ease-out);
}

.ext-tab[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background-color: var(--surface-2);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.ext-tab[aria-selected="true"] .tab-count {
  background-color: var(--accent-soft);
  color: var(--accent-bright);
}

.ext-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ext-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 2.4vw, 1.75rem);
}

.dict-card {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.dict-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.dict-word-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.dict-word-line strong {
  font-family: var(--font-prose);
  font-size: clamp(1.75rem, 2.2vw, 2.125rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.dict-meaning {
  margin: 0.75rem 0 0.3rem;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

.dict-note {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.context-box {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.context-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
}

.context-quote {
  margin: 0;
  padding-left: 0.875rem;
  border-left: 2px solid var(--accent-line);
  font-family: var(--font-prose);
  font-size: var(--text-body);
  line-height: 1.65;
  color: #d6dbe6;
  text-wrap: pretty;
}

.context-quote mark,
.entry-quote mark {
  background-color: var(--accent-soft-strong);
  color: var(--accent-bright);
  padding: 0.04em 0.25em;
  border-radius: 3px;
}

.dict-actions {
  margin-top: auto;
  padding-top: 1.375rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}

/* Cross-fading contextual SVG icon container */
.icon-swap {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.icon-swap > .icon {
  grid-area: 1 / 1;
  transition:
    opacity 240ms var(--ease-spring),
    transform 240ms var(--ease-spring);
}

.icon-swap > .icon-saved {
  opacity: 0;
  transform: scale(0.45);
}

.btn-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 1.0625rem 0 0.875rem;
  border-radius: 8px;
  border: 1px solid rgba(234, 176, 92, 0.5);
  background-color: var(--accent);
  color: var(--accent-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  transition:
    background-color 150ms var(--ease-out),
    color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    transform 150ms var(--ease-out);
}

.btn-save:active {
  transform: scale(0.96);
}

.btn-save[aria-pressed="true"] {
  background-color: var(--sage-soft);
  border-color: var(--sage-line);
  color: var(--sage);
}

.btn-save[aria-pressed="true"] .icon-idle,
.copy-pill.is-copied .icon-idle {
  opacity: 0;
  transform: scale(0.45);
}

.btn-save[aria-pressed="true"] .icon-saved,
.copy-pill.is-copied .icon-saved {
  opacity: 1;
  transform: scale(1);
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.375rem;
  padding: 0 0.75rem 0 0.875rem;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background-color: var(--surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  color: var(--text-secondary);
  white-space: nowrap;
  transition:
    color 150ms var(--ease-out),
    border-color 150ms var(--ease-out),
    background-color 150ms var(--ease-out),
    transform 150ms var(--ease-out);
}

.btn-ghost-sm:active {
  transform: scale(0.96);
}

/* Notebook & History Lists */
.panel-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  max-height: 18.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.125rem;
}

.entry-item {
  padding: 0.75rem 0.875rem;
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.entry-word-btn {
  text-align: start;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.entry-word-btn strong {
  font-family: var(--font-prose);
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  transition: color 140ms var(--ease-out);
}

.entry-meaning {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.entry-quote {
  margin: 0.2rem 0 0;
  padding-left: 0.625rem;
  border-left: 2px solid var(--accent-line);
  font-family: var(--font-prose);
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--text-muted);
}

.entry-remove {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding: 0.125rem 0.45rem;
  border-radius: 5px;
  border: 1px solid transparent;
  transition:
    color 140ms var(--ease-out),
    border-color 140ms var(--ease-out);
}

.empty-state {
  margin: auto 0;
  padding: 1.25rem 1rem;
  background-color: var(--surface-1);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
}

.empty-state p {
  margin: 0 0 0.875rem;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ==========================================================================
   Below-the-fold Architectural Sections (Strict 3-Size Body Discipline)
   ========================================================================== */
.section-stage,
.section-folio,
.section-install {
  padding-block: clamp(4.75rem, 8.5vw, 7.75rem);
  border-top: 1px solid var(--line);
}

.phrase-column h2,
.folio-info h2,
.install-cta-col h2 {
  margin: 0;
  font-size: var(--text-heading);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.025em;
  font-feature-settings: "halt" 1;
  color: var(--text-primary);
  text-wrap: balance;
}

/* Raycast-style Command Switcher */
.stage-grid {
  display: grid;
  grid-template-columns: minmax(270px, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
}

.phrase-list {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.phrase-item {
  width: 100%;
  text-align: start;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.9375rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition:
    background-color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    box-shadow 160ms var(--ease-out);
}

.phrase-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 8px;
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  color: var(--text-muted);
  flex-shrink: 0;
  transition:
    color 160ms var(--ease-out),
    border-color 160ms var(--ease-out),
    background-color 160ms var(--ease-out);
}

.phrase-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.phrase-text strong {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-secondary);
  transition: color 160ms var(--ease-out);
}

.phrase-text span {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-muted);
  transition: color 160ms var(--ease-out);
}

.phrase-item[aria-selected="true"] {
  background-color: var(--surface-1);
  border-color: var(--line-strong);
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 12px 28px -16px rgba(0, 0, 0, 0.6);
}

.phrase-item[aria-selected="true"] .phrase-icon {
  background-color: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-bright);
}

.phrase-item[aria-selected="true"] .phrase-text strong {
  color: var(--text-primary);
}

.phrase-item[aria-selected="true"] .phrase-text span {
  color: var(--text-secondary);
}

/* Stage Viewport */
.stage-viewport {
  background-color: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 24px 64px -24px rgba(0, 0, 0, 0.72);
  min-height: 23.5rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stage-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.stage-card-bar {
  min-height: 3.375rem;
  padding: 0.625rem 1.375rem;
  background-color: rgba(255, 255, 255, 0.016);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stage-bar-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.stage-card-content {
  flex: 1;
  padding: clamp(1.375rem, 2.6vw, 2rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
}

.mini-prose {
  margin: 0;
  font-family: var(--font-prose);
  font-size: var(--text-prose);
  line-height: 1.72;
  color: #e4e8f0;
  text-wrap: pretty;
}

.hl-selection {
  background-color: var(--accent-soft-strong);
  color: var(--accent-bright);
  padding: 0.08em 0.3em;
  border-radius: 4px;
  border-bottom: 1.5px solid var(--accent);
}

.inline-popover-demo,
.quiz-card,
.pair-terminal {
  padding: 1.125rem 1.25rem;
  background-color: var(--surface-inset);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
}

.pop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.625rem;
  margin-bottom: 0.5rem;
}

.pop-head strong {
  font-family: var(--font-prose);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pop-gloss {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.pop-sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.bi-demo-list {
  gap: 1rem;
}

.bi-pair {
  padding: 0.9375rem 1.125rem;
  background-color: var(--surface-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.bi-pair p {
  margin: 0;
}

.bi-pair p[lang="en"] {
  font-family: var(--font-prose);
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--text-primary);
}

.bi-pair .bi-trans {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  line-height: 1.62;
  color: var(--accent-bright);
}

.bi-demo-list.is-mono .bi-trans {
  display: none;
}

.quiz-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-meaning {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  transition:
    color 160ms var(--ease-out),
    background-color 160ms var(--ease-out);
}

.quiz-meaning.is-masked {
  color: transparent;
  background-color: var(--surface-3);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  user-select: none;
  cursor: pointer;
}

.pair-terminal {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.pair-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.pair-row strong {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.pair-row code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  background-color: var(--surface-2);
  border: 1px solid var(--accent-line);
  color: var(--accent-bright);
}

.pair-explain {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ==========================================================================
   Folio Split & Real Extension Showcase
   ========================================================================== */
.folio-split,
.install-split {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(290px, 0.94fr);
  gap: clamp(2.5rem, 5.5vw, 4.5rem);
  align-items: center;
}

.install-split {
  align-items: start;
}

.folio-info .clean-steps {
  margin-top: 2rem;
}

.clean-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.clean-steps li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.875rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}

.clean-steps li:first-child {
  border-top-color: var(--line-strong);
}

.step-idx {
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  padding-top: 0.15rem;
}

.clean-steps h3 {
  margin: 0 0 0.25rem;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
}

.clean-steps p {
  margin: 0;
  max-width: 54ch;
  font-size: var(--text-body);
  line-height: 1.65;
  color: var(--text-secondary);
  text-wrap: pretty;
}

.clean-steps code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: var(--text-sm);
  padding: 0.125rem 0.4rem;
  border-radius: 4px;
  background-color: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-primary);
}

.real-shot-card {
  margin: 0;
  padding: 1.25rem;
  background-color: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 24px 64px -24px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shot-frame {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background-color: var(--surface-inset);
  border: 1px solid var(--line);
  display: flex;
  justify-content: center;
}

.shot-frame img {
  width: min(304px, 100%);
  border-radius: 10px;
  outline: 1px solid oklch(1 0 0 / 0.1);
  outline-offset: -1px;
  box-shadow: 0 18px 42px -12px rgba(0, 0, 0, 0.62);
}

.shot-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-inline: 0.25rem;
}

.shot-meta strong {
  display: block;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.shot-meta span {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ==========================================================================
   Install & Local-First Privacy
   ========================================================================== */
.install-downloads {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.link-source {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-block: 0.25rem;
  transition: color 150ms var(--ease-out);
}

.copy-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.copy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.25rem;
  padding: 0 0.6875rem 0 0.75rem;
  border-radius: 8px;
  background-color: var(--surface-1);
  border: 1px solid var(--line-strong);
  transition:
    border-color 150ms var(--ease-out),
    background-color 150ms var(--ease-out),
    transform 150ms var(--ease-out);
}

.copy-pill:active {
  transform: scale(0.96);
}

.copy-pill code {
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.copy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent-bright);
}

.copy-pill.is-copied {
  border-color: var(--sage-line);
}

.copy-pill.is-copied .copy-badge {
  color: var(--sage);
}

.privacy-disclosure {
  margin-top: 0.75rem;
  padding: 1rem 1.125rem;
  background-color: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.privacy-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.privacy-disclosure summary::-webkit-details-marker {
  display: none;
}

.chevron-icon {
  color: var(--text-muted);
  transition: transform 200ms var(--ease-spring);
}

.privacy-disclosure[open] .chevron-icon {
  transform: rotate(180deg);
}

.privacy-disclosure p {
  margin: 0.75rem 0 0;
  font-size: var(--text-body);
  line-height: 1.68;
  color: var(--text-secondary);
  text-wrap: pretty;
}

/* ==========================================================================
   Dialog Lightbox
   ========================================================================== */
.shot-dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background-color: var(--surface-1);
  color: var(--text-primary);
  width: min(468px, 92vw);
  max-height: 92dvh;
  padding: 1rem;
  overscroll-behavior: contain;
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 32px 72px rgba(0, 0, 0, 0.75);
}

.shot-dialog::backdrop {
  background-color: rgba(5, 6, 9, 0.82);
  backdrop-filter: blur(6px);
}

.dialog-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid var(--line);
}

.dialog-bar h2 {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
}

.dialog-body {
  display: flex;
  justify-content: center;
}

.dialog-body img {
  max-height: 74dvh;
  width: auto;
  object-fit: contain;
  border-radius: 10px;
  outline: 1px solid oklch(1 0 0 / 0.1);
  outline-offset: -1px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 2.75rem;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-brand {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  font-size: var(--text-body);
  font-weight: 600;
}

.footer-brand img {
  border-radius: 5px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.footer-links a {
  transition: color 150ms var(--ease-out);
}

/* ==========================================================================
   Hover Gate (Only on hover-capable pointers)
   ========================================================================== */
@media (hover: hover) {
  .site-nav > a:not(.nav-cta):hover {
    color: var(--text-primary);
  }

  .site-nav .nav-cta:hover {
    background-color: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.24);
  }

  .btn-primary:hover {
    filter: brightness(1.03);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.98),
      0 14px 34px -8px rgba(234, 176, 92, 0.25),
      0 10px 28px -8px rgba(0, 0, 0, 0.72);
  }

  .doc-tab:not(.is-active):hover,
  .seg-btn:not(.is-active):hover {
    color: var(--text-secondary);
  }

  .switch-pill:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.24);
  }

  .term:hover {
    background-color: var(--accent-soft);
    border-bottom-style: solid;
    border-bottom-color: var(--accent);
  }

  .ext-tab:hover {
    color: var(--text-secondary);
  }

  .btn-save:not([aria-pressed="true"]):hover {
    background-color: var(--accent-bright);
  }

  .btn-ghost-sm:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.24);
    background-color: var(--surface-3);
  }

  .entry-word-btn:hover strong {
    color: var(--accent-bright);
  }

  .entry-remove:hover {
    color: var(--text-primary);
    border-color: var(--line-strong);
  }

  .phrase-item:not([aria-selected="true"]):hover {
    background-color: rgba(255, 255, 255, 0.025);
  }

  .link-source:hover,
  .footer-links a:hover {
    color: var(--text-primary);
  }

  .copy-pill:hover {
    border-color: var(--accent-line);
    background-color: var(--surface-2);
  }
}

/* ==========================================================================
   Responsive Breakpoints (1000px, 720px, 390px, 320px)
   ========================================================================== */
@media (max-width: 920px) {
  .wb-body {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .reader-pane {
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage-grid,
  .folio-split,
  .install-split {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .stage-viewport {
    min-height: 19rem;
  }

  .kbd-hint {
    display: none;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: calc(100% - 2.25rem);
  }

  .nav-bar {
    min-height: 3.75rem;
    gap: 0.625rem;
  }

  .nav-hide-mobile {
    display: none;
  }

  .site-nav {
    gap: 0.875rem;
  }

  .hero {
    padding-top: 2.25rem;
    padding-bottom: 3.5rem;
  }

  .hero-head {
    margin-bottom: 2rem;
  }

  .hero-head h1 {
    font-size: clamp(1.625rem, 7.5vw, 2.35rem);
    line-height: 1.28;
  }

  .wb-topbar {
    padding: 0.625rem 0.875rem;
  }

  .doc-tab {
    padding: 0 0.55rem;
  }

  .reader-pane,
  .ext-panel {
    padding: 1.25rem 1rem;
  }

  .ext-tabs {
    padding-inline: 1rem;
    gap: 1.125rem;
  }

  .section-stage,
  .section-folio,
  .section-install {
    padding-block: 3.75rem;
  }
}

@media (max-width: 375px) {
  .wrap {
    width: calc(100% - 1.75rem);
  }

  .brand-name {
    font-size: 1.0625rem;
  }

  .site-nav {
    gap: 0.625rem;
  }

  .site-nav .nav-cta {
    padding: 0 0.5rem 0 0.625rem;
  }

  .site-nav .nav-cta .icon {
    display: none;
  }

  .passage-switch {
    width: 100%;
    justify-content: space-between;
  }

  .doc-tab {
    flex: 1;
    padding: 0 0.35rem;
    text-align: center;
  }
}

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

  .site-header,
  .doc-tab,
  .seg-btn,
  .switch-pill,
  .switch-track,
  .switch-thumb,
  .sent-block,
  .term,
  .ext-tab,
  .icon-swap > .icon,
  .phrase-item,
  .phrase-icon,
  .chevron-icon {
    transition-duration: 0.01ms !important;
  }
}
