:root {
  /* Light sections and policy pages */
  --bg: #fbf8f2;
  --surface: #fffdf8;
  --text: #2f2b24;
  --muted: #6c655a;
  --accent: #7b6a45;
  --line: #e6e0d4;
  --mint: #cfe6df;
  --cream: #fbf1e4;

  /* The dark space at the top */
  --ink: #101315;
  --ink-2: #172021;
  --ink-text: #efe9df;
  --ink-muted: #a7a296;
  --ink-line: rgba(239, 233, 223, 0.14);
  --gold: #dcc896;

  --max: 1040px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --zh: "Songti TC", "Noto Serif TC", "PingFang TC", "Heiti TC", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #211e1a;
    --text: #f1ebe1;
    --muted: #b4aa9c;
    --accent: #d8bf8c;
    --line: #36302a;
    --mint: #1b2725;
    --cream: #1d1a16;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
}

a { color: var(--accent); }

[lang="zh-Hant"] { font-family: var(--zh); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

.narrow > * { max-width: 820px; }
.narrow .meaning { max-width: 520px; }

/* Header */

header.site {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font: 600 22px/1 var(--serif);
}

.brand img { border-radius: 7px; }

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 20px;
  font-size: 15px;
}

nav a:hover { color: var(--text); }

header.on-dark {
  background: var(--ink);
  border-bottom-color: transparent;
}

header.on-dark .brand { color: var(--ink-text); }
header.on-dark nav a { color: var(--ink-muted); }
header.on-dark nav a:hover { color: var(--ink-text); }

/* Shared section type */

.home section { padding: 72px 0; }

.home h1 {
  font: 500 clamp(40px, 7.5vw, 76px)/1.05 var(--serif);
  letter-spacing: -0.02em;
  margin: 0;
}

.home h2 {
  font: 500 clamp(30px, 4.6vw, 44px)/1.15 var(--serif);
  letter-spacing: -0.01em;
  margin: 0;
}

.zh {
  margin: 10px 0 24px;
  font-size: clamp(19px, 2.4vw, 24px);
  letter-spacing: 0.08em;
  opacity: 0.72;
}

.zh-lead {
  font-size: clamp(22px, 3vw, 30px);
  margin-bottom: 48px;
}

.zh-body, .zh-small { opacity: 0.72; }

.home p { max-width: 38em; }

/* Dark sections */

.dark {
  background: var(--ink);
  color: var(--ink-text);
}

.dark a { color: var(--gold); }

.hero {
  background:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(150, 205, 190, 0.16), transparent 70%),
    var(--ink);
  padding-top: 64px !important;
}

/* The reading stage */

.stage {
  position: relative;
  margin: 0 -8px;
  padding: 0 8px;
}

.passage {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: none !important;
  font: 400 clamp(23px, 3.3vw, 32px)/2.3 var(--serif);
  color: var(--ink-text);
}

.w {
  position: relative;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  transition: color 0.3s;
}

.w.tappable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: underline dotted rgba(239, 233, 223, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}

.w.tappable:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 6px; }

.w.on { color: #ffffff; }

.gloss {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: -2px;
  transform: translateX(-50%);
  font: 600 13px/1 var(--zh);
  letter-spacing: 0.04em;
  color: var(--gold);
  white-space: nowrap;
  pointer-events: none;
  animation: rise 0.35s ease-out;
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 4px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.drop {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 999px;
  opacity: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(255, 255, 255, 0.22), transparent 70%),
    rgba(190, 228, 216, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    inset 0 -6px 12px rgba(120, 190, 170, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(150, 215, 195, 0.18);
  -webkit-backdrop-filter: blur(1px) saturate(1.6);
  backdrop-filter: blur(1px) saturate(1.6);
  transition:
    transform 0.42s cubic-bezier(0.3, 1.35, 0.5, 1),
    width 0.42s cubic-bezier(0.3, 1.35, 0.5, 1),
    height 0.42s ease,
    opacity 0.4s;
}

.drop.shown { opacity: 1; }

.stage-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 28px;
}

.listen {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--ink-line);
  background: rgba(239, 233, 223, 0.06);
  color: var(--ink-text);
  font: 500 16px/1 var(--sans);
  cursor: pointer;
}

.listen:hover { background: rgba(239, 233, 223, 0.12); }

.listen-icon {
  width: 0;
  height: 0;
  border-left: 11px solid currentColor;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

.listen.playing .listen-icon {
  width: 11px;
  height: 11px;
  border: 0;
  border-radius: 2px;
  background: currentColor;
}

.hint {
  margin: 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.meaning {
  margin-top: 28px;
  padding: 18px 22px;
  min-height: 108px;
  border-radius: 22px;
  border: 1px solid var(--ink-line);
  background: rgba(239, 233, 223, 0.05);
  max-width: 520px;
  opacity: 0;
  transition: opacity 0.3s;
}

.meaning.shown { opacity: 1; }

.m-word {
  margin: 0 0 4px;
  font: 500 22px/1.3 var(--serif);
}

.m-pos {
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--ink-line);
  font-size: 13px;
  color: var(--ink-muted);
  vertical-align: 3px;
}

.m-mean {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.04em;
}

.m-note {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--ink-muted);
}

.m-note:empty { display: none; }

.example {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.words { border-top: 1px solid var(--ink-line); }

.words p:not(.zh) { font-size: 19px; color: var(--ink-muted); }

.flat {
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

.pains {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink-line);
}

.pains li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--ink-line);
  font-size: 18px;
}

.pains strong { font: 500 21px/1.35 var(--serif); }
.pains span { color: var(--ink-muted); }

/* Dark to light */

.threshold {
  height: 340px;
  background: linear-gradient(180deg, var(--ink-2) 0%, #2c3c39 28%, #7fa79c 62%, var(--mint) 100%);
  display: flex;
  justify-content: center;
  padding-top: 40px;
}

.threshold p {
  margin: 0;
  font: italic 400 22px/1.4 var(--serif);
  color: var(--ink-text);
  text-align: center;
  opacity: 0.85;
}

.threshold span {
  display: block;
  font-style: normal;
  font-size: 16px;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

@media (prefers-color-scheme: dark) {
  .threshold { background: linear-gradient(180deg, var(--ink-2) 0%, #1f2b29 60%, var(--mint) 100%); }
}

/* Light sections */

.light { background: var(--bg); }

.space {
  background: linear-gradient(180deg, var(--mint) 0%, var(--cream) 100%);
  padding-top: 24px !important;
}

.narrow-head { max-width: 760px; margin-bottom: 40px; }
.narrow-head p:not(.zh) { font-size: 19px; color: var(--muted); }

.senses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.sense {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 24px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sense svg {
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sense h3 {
  margin: 0;
  font: 500 22px/1.25 var(--serif);
}

.sense .zh-small {
  margin: 2px 0 10px;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.sense p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.after { background: var(--cream); }

.gains {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 24px;
}

.gains li {
  border-top: 1px solid var(--line);
  padding: 20px 0 8px;
}

.gains .num {
  display: block;
  font: 500 14px/1 var(--sans);
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

.gains strong {
  display: block;
  font: 500 22px/1.3 var(--serif);
  margin-bottom: 4px;
}

.gains li > span:last-child { color: var(--muted); }

.own { background: var(--bg); }

.own-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: start;
}

.app-icon {
  width: 120px;
  height: 120px;
  filter: drop-shadow(0 10px 24px rgba(70, 90, 80, 0.22));
}

.own p:not(.zh):not(.soon) { color: var(--muted); font-size: 18px; }

.soon {
  display: inline-block;
  margin: 8px 0 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
}

.home .questions { padding: 8px 0 24px; }
.questions p { margin: 0; color: var(--muted); }

/* Footer */

footer.site {
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 14px;
}

.home footer.site { margin-top: 0; }

footer.site p { margin: 4px 0; }

/* Policy pages */

.doc { max-width: 760px; }

.doc h1 {
  font: 600 clamp(30px, 5vw, 40px)/1.2 var(--serif);
  margin: 48px 0 8px;
}

.doc .updated {
  color: var(--muted);
  margin: 0 0 24px;
}

.doc h2 {
  font: 600 22px/1.3 var(--serif);
  margin: 32px 0 8px;
}

.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  margin: 12px 0;
}

.doc th, .doc td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  padding: 8px 8px 8px 0;
}

.table-scroll { overflow-x: auto; }

@media (max-width: 700px) {
  .home section { padding: 56px 0; }
  .hero { padding-top: 40px !important; }
  .zh-lead { margin-bottom: 36px; }
  .passage { line-height: 2.2; }
  .threshold { height: 260px; }
  .own-grid { grid-template-columns: 1fr; gap: 24px; }
  .app-icon { width: 96px; height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .drop, .gloss, .meaning { transition: none; animation: none; }
}
