@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600&display=swap');

:root {
  --ink: #222;
  --muted: #777;
  --line: #dedede;
  --soft: #f7f7f7;
  --sans: "Montserrat", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #fff;
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.65;
}
a { color: inherit; }
.wrap { width: min(900px, calc(100% - 80px)); margin: 0 auto; }

.site-header { padding: 34px 0 26px; border: 0; background: #1d1d1d; }
.site-header .wrap { display: block; }
.brand { display: block; color: #fff; text-decoration: none; font-size: clamp(1.8rem, 4.5vw, 2.35rem); font-weight: 600; line-height: 1.2; }
.brand-mark { display: none; }
.site-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 18px; }
.site-nav a { color: #c8c8c8; text-decoration: none; font-size: .94rem; font-weight: 600; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; }
.site-nav .nav-cta { color: #c8c8c8; background: none; }

h1, h2, h3 { color: #222; line-height: 1.25; }
h1 { margin: 0 0 22px; font-size: clamp(2rem, 5vw, 2.7rem); font-weight: 600; letter-spacing: -.02em; }
h2 { margin: 52px 0 14px; font-size: 1.45rem; font-weight: 600; }
h3 { margin: 32px 0 12px; font-size: 1rem; font-weight: 600; }
.eyebrow { margin: 0 0 10px; color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; }
.lede { max-width: 760px; color: #444; font-size: 1.05rem; }

.home-main { padding: 58px 0 90px; }
.intro { max-width: 760px; font-size: 1.05rem; }
.intro p:first-child { font-size: 1.25rem; }
.resource-list { margin-top: 52px; border-top: 1px solid var(--line); }
.resource-row { display: grid; grid-template-columns: 190px 1fr auto; gap: 28px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.resource-row strong { font-weight: 600; }
.resource-row span { color: var(--muted); }
.resource-row:hover strong { text-decoration: underline; text-underline-offset: 4px; }
.dialect-note { max-width: 760px; margin-top: 54px; padding-left: 18px; border-left: 2px solid #333; color: #555; font-size: .9rem; }

.page-hero { padding: 64px 0 18px; }
.content { padding-bottom: 90px; }
.prose { max-width: 820px; }
.prose p, .prose li { color: #444; }
.notice { margin: 20px 0 38px; padding: 16px 18px; background: var(--soft); border-left: 3px solid #333; font-size: .9rem; }
.roman, .ipa { font-family: var(--mono); }
.ipa { color: #666; }

.table-wrap { overflow-x: auto; margin: 18px 0 30px; border-top: 1px solid #aaa; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 11px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #666; background: var(--soft); font-size: .69rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.grammar-section tbody td:not(.form) { color: #666; font-size: .79rem; }
.tone-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 20px 0 28px; border: 1px solid var(--line); background: var(--line); }
.tone { padding: 16px; background: #fff; }
.tone b { display: block; font-size: 1.7rem; font-weight: 600; }
.tone span { color: var(--muted); font-size: .78rem; }

.button { color: #222; font-weight: 600; text-underline-offset: 4px; }
.dictionary-hero { padding: 54px 0 22px; }
.dictionary-hero h1 { margin-bottom: 8px; }
.dictionary-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: .9rem; }
.placeholder { max-width: 720px; padding: 64px 0 100px; }
.placeholder p { color: #444; }
.placeholder .status { margin-bottom: 24px; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.planned { margin: 34px 0 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.planned li { padding: 12px 0; border-bottom: 1px solid var(--line); color: #555; }
.contents { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 32px 0 44px; padding: 14px 0; border-block: 1px solid var(--line); font-size: .84rem; }
.contents a { color: #555; text-underline-offset: 3px; }
.grammar-section { scroll-margin-top: 20px; }
.example { margin: 20px 0 26px; padding: 15px 18px; border-left: 3px solid #333; background: var(--soft); }
.example .tujia { margin: 0; color: #1d1d1d; font-family: var(--mono); font-size: 1.1rem; font-weight: 600; line-height: 1.45; }
.example .ipa-line { margin: 3px 0; color: #777; font-family: var(--mono); font-size: .73rem; line-height: 1.45; }
.example .gloss { margin: 5px 0 0; color: #888; font-family: var(--mono); font-size: .68rem; line-height: 1.45; }
.example .translation { margin: 4px 0 0; color: #666; font-size: .77rem; }
.form { color: #1d1d1d; font-family: var(--mono); font-size: 1.04rem; font-weight: 600; line-height: 1.35; }
.form > span { display: block; margin-top: 2px; color: #888; font-size: .69rem; font-weight: 400; line-height: 1.45; }
.form > small { display: block; margin-top: 3px; color: #666; font-family: var(--sans); font-size: .71rem; font-weight: 400; line-height: 1.45; }
.pattern { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--line); }
.pattern strong, .pattern span { display: block; }
.pattern span { margin-top: 4px; color: var(--muted); font-size: .84rem; }
.distance-list { padding-left: 24px; }
.distance-list li { margin: 12px 0; padding-left: 6px; }
.distance-list .form { display: inline-block; min-width: 200px; vertical-align: top; }
.source-ref { color: var(--muted); font-size: .76rem; }
.feature-list { padding-left: 20px; }
.feature-list li { margin-bottom: 9px; }

.text-hero { padding-bottom: 30px; }
.text-collection { margin-top: 8px; }
.text-collection-heading { margin-bottom: 28px; }
.text-collection-heading h2 { margin: 4px 0 12px; font-size: 1.55rem; }
.text-collection-heading > p:not(.eyebrow) { max-width: 760px; color: #555; font-size: .9rem; }
.archive-stats { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 28px; padding: 18px 0; border-block: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.archive-stats strong { margin-right: 4px; color: #222; font-size: 1.1rem; font-weight: 600; }
.text-index { max-width: 820px; }
.text-category { margin-top: 54px; }
.text-category h2 { margin: 4px 0 3px; }
.category-translation { margin: 0 0 16px; color: #777 !important; font-size: .78rem; }
.text-card-list { border-top: 1px solid #aaa; }
.text-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 16px; align-items: baseline; padding: 15px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }
.text-card:hover .text-card-title { text-decoration: underline; text-underline-offset: 4px; }
.text-number { color: var(--muted); font-family: var(--mono); font-size: .72rem; }
.text-card-title { color: #222; font-size: .98rem; font-weight: 600; }
.text-card-title small { display: block; margin-top: 3px; color: #777; font-size: .68rem; font-weight: 400; }
.text-card-meta { color: var(--muted); font-size: .7rem; }
.archive-credit { margin-top: 58px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted) !important; font-size: .7rem; }

.text-detail-hero { padding-bottom: 30px; }
.whole-recording { display: grid; grid-template-columns: 150px minmax(280px, 1fr); gap: 18px; align-items: center; max-width: 680px; margin-top: 28px; padding: 14px 0; border-block: 1px solid var(--line); }
.whole-recording span { color: #555; font-size: .75rem; font-weight: 600; }
.whole-recording audio { width: 100%; height: 34px; }
.text-detail { max-width: 820px; }
.text-toolbar { display: flex; justify-content: space-between; gap: 20px; margin: 14px 0 44px; padding-bottom: 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.text-toolbar a { color: #333; font-weight: 600; text-underline-offset: 3px; }
.archive-text-section { margin: 0 0 68px; scroll-margin-top: 20px; }
.text-section-heading { margin-bottom: 18px; }
.text-section-heading h2 { margin: 6px 0 12px; }
.text-detail-hero h1 small, .text-section-heading h2 small { display: block; margin-top: 6px; color: #777; font-size: .45em; font-weight: 400; letter-spacing: 0; }
.text-section-heading .eyebrow small { display: block; margin-top: 3px; color: #999; font-size: .82em; font-weight: 500; letter-spacing: .03em; text-transform: none; }
.section-description { max-width: 720px; color: #666 !important; font-size: .8rem; }
.section-description.secondary { margin-top: -5px; color: #888 !important; font-size: .72rem; }
.text-lines { border-top: 1px solid #aaa; }
.text-line { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 16px; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.line-play { align-self: start; display: flex; gap: 6px; align-items: center; margin-top: 3px; padding: 4px 0; border: 0; color: #666; background: none; font-family: var(--mono); font-size: .7rem; cursor: pointer; }
.line-play span { display: inline-block; width: 10px; color: #222; font-size: .62rem; }
.line-play:hover, .line-play.is-playing { color: #111; }
.line-play.is-playing { font-weight: 600; }
.draft-transcription, .source-transcription, .line-translation { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 10px; align-items: baseline; }
.draft-transcription { margin: 0; color: #1d1d1d !important; font-family: var(--mono); font-size: 1.04rem; font-weight: 600; line-height: 1.65; }
.line-label { color: #aaa; font-family: var(--sans); font-size: .56rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.line-value { min-width: 0; }
.source-transcription { margin: 3px 0 0; color: #888 !important; font-family: var(--mono); font-size: .68rem; font-weight: 400; line-height: 1.5; }
.source-transcription sup { color: #888; font-size: .68em; font-weight: 400; }
.line-translation { margin: 7px 0 0; color: #666 !important; font-size: .76rem; line-height: 1.55; }
.line-translation.secondary { margin-top: 2px; color: #888 !important; font-size: .7rem; }

.site-footer { padding: 30px 0 42px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 20px; }

.dictionary-widget { position: fixed; right: 22px; bottom: 22px; z-index: 1000; font-family: var(--sans); }
.dictionary-widget-button { display: flex; align-items: center; gap: 7px; padding: 10px 15px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; color: #fff; background: rgba(25,25,25,.9); box-shadow: 0 6px 22px rgba(0,0,0,.16); font: 600 .78rem/1 var(--sans); cursor: pointer; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.dictionary-widget-button span { font-size: 1rem; font-weight: 400; }
.dictionary-widget-button:hover { background: #111; }
.dictionary-widget-panel { position: absolute; right: 0; bottom: 50px; display: flex; flex-direction: column; width: min(390px, calc(100vw - 44px)); height: min(560px, calc(100vh - 100px)); overflow: hidden; border: 1px solid rgba(255,255,255,.56); border-radius: 12px; background: rgba(248,248,248,.48); box-shadow: 0 14px 42px rgba(0,0,0,.16); opacity: 0; visibility: hidden; transform: translateY(10px) scale(.985); transform-origin: bottom right; transition: opacity .16s ease, transform .16s ease, visibility .16s; backdrop-filter: blur(8px) saturate(115%); -webkit-backdrop-filter: blur(8px) saturate(115%); }
.dictionary-widget.is-open .dictionary-widget-panel { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.dictionary-widget.is-open .dictionary-widget-button { background: #111; }
.dictionary-widget-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 12px 10px 15px; border-bottom: 1px solid rgba(0,0,0,.1); background: rgba(255,255,255,.52); }
.dictionary-widget-bar strong { display: block; font-size: .84rem; font-weight: 600; }
.dictionary-widget-bar small { display: block; margin-top: 1px; color: #777; font-size: .6rem; }
.dictionary-widget-actions { display: flex; align-items: center; gap: 5px; }
.dictionary-widget-actions a, .dictionary-widget-actions button { display: grid; place-items: center; width: 29px; height: 29px; padding: 0; border: 0; border-radius: 50%; color: #444; background: transparent; font: 500 1rem/1 var(--sans); text-decoration: none; cursor: pointer; }
.dictionary-widget-actions a:hover, .dictionary-widget-actions button:hover { color: #111; background: rgba(0,0,0,.07); }
.dictionary-widget iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: transparent; }

@media (max-width: 650px) {
  .wrap { width: calc(100% - 40px); }
  .site-header { padding: 24px 0 22px; }
  .site-nav { gap: 8px 16px; }
  .home-main, .content { padding-bottom: 60px; }
  .page-hero { padding-top: 44px; }
  .resource-row { grid-template-columns: 1fr auto; gap: 8px 16px; }
  .resource-row span { grid-column: 1 / -1; }
  .tone-grid { grid-template-columns: repeat(2, 1fr); }
  .text-card { grid-template-columns: 42px 1fr; }
  .text-card-meta { grid-column: 2; }
  .whole-recording { grid-template-columns: 1fr; gap: 8px; }
  .text-toolbar { flex-direction: column; gap: 5px; }
  .text-line { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; }
  .site-footer .wrap { flex-direction: column; }
  .dictionary-widget { right: 14px; bottom: 14px; }
  .dictionary-widget-panel { position: fixed; inset: 12px; width: auto; height: auto; border-radius: 10px; transform-origin: bottom right; }
}
