:root {
  --bg-hero: #f7f0e4;
  --bg-section: #fffdf8;
  --text: #4a4540;
  --title: #7a1e1e;
  --gold: #c9a227;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "SimSun", serif;
  color: var(--text);
  line-height: 1.75;
  background: var(--bg-section);
}

.nushu-font {
  font-family: "Noto Sans Nushu", "Noto Serif SC", serif;
  font-feature-settings: "liga" 1;
}

.nushu-font--sans {
  font-family: "Noto Sans Nushu", "Noto Serif SC", serif;
  font-feature-settings: "liga" 1;
}

.nushu-font--traditional {
  font-family: "Noto Traditional Nushu", "Noto Sans Nushu", "Noto Serif SC", serif;
  font-feature-settings: "liga" 1;
}

.nushu-font--unicode {
  font-family: "Unicode Nushu", "Noto Sans Nushu", "Noto Serif SC", serif;
  font-feature-settings: "liga" 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
  background: var(--bg-hero);
}

.hero-deco {
  margin-bottom: 1rem;
}

.deco-nushu {
  font-size: clamp(2rem, 6vw, 3.25rem);
  color: var(--title);
  letter-spacing: 0.15em;
}

.title-cn {
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--title);
  letter-spacing: 0.12em;
}

.subtitle {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  color: #6b6560;
}

.divider {
  width: min(280px, 70%);
  height: 3px;
  margin: 1.5rem auto;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold) 15%,
    var(--gold) 85%,
    transparent
  );
  border-radius: 2px;
}

.lead {
  max-width: 42rem;
  margin: 0 auto;
  font-size: 1.05rem;
}

.section {
  padding: 2.5rem 1.5rem 3rem;
  max-width: 960px;
  margin: 0 auto;
}

.section-alt {
  background: var(--bg-section);
}

.section-title {
  text-align: center;
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--title);
  font-weight: 700;
}

.section-sub {
  text-align: center;
  margin: 0.5rem 0 2rem;
  color: #6b6560;
}

.section h3 {
  color: var(--title);
  font-size: 1.2rem;
  margin-top: 0;
}

.section h4 {
  color: #5c4033;
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
}

.grid-2 {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.grid-2.tight {
  margin-top: 2rem;
}

.grid-2 ul {
  margin: 0;
  padding-left: 1.1rem;
}

.prose-block {
  margin-top: 2rem;
}

.prose-block:first-of-type {
  margin-top: 0;
}

.prose-block h3 {
  margin-bottom: 0.65rem;
}

.prose-block p {
  margin: 0.6rem 0 0;
  max-width: 52rem;
}

.prose-block p:first-of-type {
  margin-top: 0;
}

.note {
  font-size: 0.9rem;
  color: #6b6560;
  margin-top: 0.75rem;
  line-height: 1.65;
}

.timeline {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  border-left: 3px solid var(--gold);
}

.timeline li {
  position: relative;
  margin: 0 0 1.25rem 1.25rem;
  padding: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.45rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--title);
  border: 2px solid #fffdf8;
  box-shadow: 0 0 0 1px var(--gold);
}

.timeline__year {
  display: block;
  font-weight: 700;
  color: var(--title);
  margin-bottom: 0.25rem;
}

.timeline__text {
  display: block;
  color: var(--text);
}

.table-wrap {
  margin-top: 0.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  border: 1px solid #d4c9b8;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
}

.data-table th,
.data-table td {
  border: 1px solid #d4c9b8;
  padding: 0.7rem 0.85rem;
  vertical-align: top;
  text-align: left;
}

.data-table th {
  background: #efe6d8;
  color: var(--title);
  font-weight: 600;
}

.data-table tbody tr:nth-child(even) {
  background: #faf7f2;
}

.contact-list {
  margin: 0.75rem 0 0;
  padding-left: 1.15rem;
  max-width: 52rem;
}

.contact-list li {
  margin: 0.65rem 0;
  line-height: 1.65;
}

.contact-list a {
  color: #5a1a1a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contact-list a:hover {
  color: var(--title);
}

main a:focus-visible {
  outline: 2px solid var(--title);
  outline-offset: 2px;
}

.converter {
  display: grid;
  gap: 2rem;
}

@media (min-width: 800px) {
  .converter {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.converter-col h3 {
  margin-top: 0;
}

.font-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.font-picker__label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--title);
}

.font-picker__select {
  min-width: 14rem;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #c4b8a8;
  border-radius: 8px;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.font-picker__select:focus {
  outline: 2px solid var(--title);
  outline-offset: 1px;
}

textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #c4b8a8;
  border-radius: 8px;
  font-family: "Noto Serif SC", serif;
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
  background: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.chip {
  padding: 0.45rem 0.85rem;
  border: 1px solid #c4b8a8;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

.chip:hover {
  border-color: var(--title);
  color: var(--title);
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: var(--title);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.nushu-panel {
  position: relative;
  min-height: 160px;
  padding: 1.25rem 1rem;
  border: 1px solid #c4b8a8;
  border-radius: 8px;
  background: #fffef9;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.nushu-panel__placeholder {
  margin: 0;
  color: #999;
  font-size: 1rem;
  font-family: "Noto Serif SC", "Songti SC", serif;
  line-height: 1.6;
  max-width: 18em;
}

.nushu-panel__text {
  display: none;
  width: 100%;
  min-height: 7rem;
  text-align: start;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  line-height: 1.9;
  letter-spacing: 0.18em;
  white-space: pre-wrap;
  word-break: keep-all;
}

.nushu-panel--has-text {
  display: block;
}

.nushu-panel--has-text .nushu-panel__placeholder {
  display: none;
}

.nushu-panel--has-text .nushu-panel__text {
  display: block;
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: #7a7268;
  line-height: 1.6;
}

.hint a {
  color: #5a1a1a;
}

.sample-nushu {
  font-size: 1.5rem;
  line-height: 2;
  letter-spacing: 0.1em;
  margin: 0.5rem 0 1rem;
  writing-mode: horizontal-tb;
  word-break: keep-all;
}

.footer {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-hero);
  border-top: 1px solid #e5dcc8;
}

.footer-brand {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--title);
  writing-mode: horizontal-tb;
  letter-spacing: 0.08em;
}

.footer .muted {
  color: #8a8278;
  font-size: 0.9rem;
}
