:root {
  color-scheme: dark;
  --ink: #11100f;
  --ink-soft: #1c1a18;
  --paper: #f0e8d8;
  --paper-deep: #e4d9c4;
  --red: #f04438;
  --red-dark: #bd211b;
  --muted: #a69d8e;
  --line-dark: rgb(240 232 216 / 20%);
  --line-light: rgb(17 16 15 / 20%);
  --display: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Franklin Gothic Condensed', sans-serif;
  --body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', 'Noto Sans Arabic', 'Noto Naskh Arabic', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Thai', 'Noto Sans SC', 'PingFang SC', sans-serif;
  font-family: var(--body);
  background: var(--ink);
  color: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--paper);
}

a { color: inherit; }

button, textarea { font: inherit; }

button { color: inherit; }

:focus-visible {
  outline: 3px solid #ffcb69;
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.8rem 1rem;
  transform: translateY(-160%);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 0 5.4vw;
  border-bottom: 1px solid var(--line-dark);
  background: var(--ink);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  text-decoration: none;
}

.wordmark__seal {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  transform: rotate(-8deg);
  border: 1px solid var(--red);
  color: var(--red);
  font: 800 0.78rem/1 var(--display);
}

.wordmark__name {
  font: 800 0.76rem/1 var(--display);
  letter-spacing: 0.16em;
}

.wordmark__name span { color: var(--red); }

.topnav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 3.8rem);
}

.topnav a {
  color: #d8d0c2;
  font-size: 0.76rem;
  text-decoration: none;
  transition: color 160ms ease;
}

.topnav a:hover { color: var(--red); }

.topnav a span {
  margin-left: 0.35rem;
  color: var(--muted);
  font: 0.63rem/1 var(--display);
}

.topbar__edition {
  color: var(--muted);
  font: 0.65rem/1 var(--display);
  letter-spacing: 0.16em;
}

.topbar__tools { display: flex; align-items: center; gap: 1rem; }
.language-control { position: relative; }
.language-control select {
  max-width: 11.5rem;
  min-height: 2.2rem;
  padding: 0.35rem 1.8rem 0.35rem 0.55rem;
  border: 1px solid rgb(240 232 216 / 32%);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font: 0.72rem/1.2 var(--body);
}
.language-control select:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  position: relative;
  display: flex;
  min-height: min(790px, calc(100svh - 78px));
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 3.8rem) 8.6vw 2.1rem;
  isolation: isolate;
  background:
    linear-gradient(116deg, transparent 0 63%, rgb(240 68 56 / 7%) 63.1% 63.35%, transparent 63.45%),
    radial-gradient(ellipse at 75% 48%, rgb(240 68 56 / 10%), transparent 33%),
    var(--ink);
}

.hero::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 4px, rgb(240 232 216 / 2.4%) 4.5px 5px);
  content: '';
  opacity: 0.28;
  pointer-events: none;
}

.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, var(--ink) 0 28%, transparent 82%);
  content: '';
  pointer-events: none;
}

.hero__ornament { position: absolute; z-index: -1; pointer-events: none; }

.hero__ornament--orbit {
  top: 10%;
  right: 12%;
  width: min(46vw, 610px);
  aspect-ratio: 1;
  border: 1px solid rgb(240 68 56 / 25%);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgb(240 68 56 / 3%), 0 0 0 76px rgb(240 68 56 / 2%);
  animation: orbit-breathe 8s ease-in-out infinite alternate;
}

.hero__ornament--orbit::before,
.hero__ornament--orbit::after {
  position: absolute;
  inset: 12%;
  border: 1px solid rgb(240 68 56 / 16%);
  border-radius: 50%;
  content: '';
}

.hero__ornament--orbit::after { inset: 25%; }

.hero__ornament--flare {
  top: 20%;
  right: 15%;
  width: min(38vw, 490px);
  aspect-ratio: 1;
  background: repeating-conic-gradient(from 5deg, rgb(240 68 56 / 19%) 0deg 0.6deg, transparent 0.8deg 6deg);
  opacity: 0.42;
  mask-image: radial-gradient(circle, #000 10%, transparent 71%);
}

.hero__topline, .hero__bottomline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  color: var(--red);
  font: 800 0.68rem/1.4 var(--display);
  letter-spacing: 0.19em;
}

.eyebrow__dot {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 12px var(--red);
}

.hero__index {
  margin: 0;
  color: #81796d;
  font: 0.6rem/1.8 var(--display);
  letter-spacing: 0.13em;
  text-align: right;
}

.hero__index strong { color: var(--paper); font-weight: 500; }

.hero__title-wrap {
  position: relative;
  z-index: 1;
  width: min(100%, 1120px);
  margin: auto 0;
  padding: 4rem 0 3.4rem;
}

.hero__pretitle {
  margin: 0 0 0.5rem 0.3rem;
  color: #b5aa99;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  letter-spacing: 0.22em;
}

.hero h1 {
  display: flex;
  align-items: baseline;
  gap: clamp(0.15rem, 1.2vw, 1rem);
  margin: 0;
  font: 900 clamp(6.5rem, 18.6vw, 17rem)/0.79 var(--display);
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.hero__title-si { color: var(--red); text-shadow: 5px 5px 0 #651915; }

.hero__title-cn {
  position: relative;
  top: -0.06em;
  color: var(--paper);
  font: 900 clamp(2.8rem, 7.3vw, 7.7rem)/0.9 var(--body);
  letter-spacing: 0.02em;
  text-shadow: 3px 4px 0 rgb(240 232 216 / 15%);
}

.hero__title-ai {
  color: transparent;
  -webkit-text-stroke: 2px var(--paper);
  text-shadow: 6px 7px 0 rgb(240 68 56 / 30%);
}

.hero__english {
  margin: 1.9rem 0 0 0.45rem;
  color: #b7ad9e;
  font-size: clamp(0.95rem, 1.3vw, 1.08rem);
  letter-spacing: 0.025em;
}

.hero__dek {
  margin: 0;
  color: #c9c0b1;
  font-size: 0.9rem;
  line-height: 1.9;
}

.sound-control { width: min(310px, 100%); }

.sound-button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.8rem;
  width: 100%;
  min-height: 58px;
  padding: 0.65rem 1rem;
  border: 1px solid rgb(240 232 216 / 36%);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.sound-button:hover { border-color: var(--red); background: rgb(240 68 56 / 8%); }
.sound-button:disabled { cursor: wait; opacity: 0.72; }

.sound-button__icon {
  grid-row: span 2;
  display: grid;
  width: 29px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: var(--ink);
  font-size: 0.7rem;
}

.sound-button__en {
  color: var(--muted);
  font: 0.57rem/1.3 var(--display);
  letter-spacing: 0.12em;
}

.sound-button__copy { display: grid; gap: 0.15rem; }

.audio-status { min-height: 1.1rem; margin: 0.45rem 0 0; color: #c9c0b1; font-size: 0.72rem; }

.scroll-cue {
  position: absolute;
  bottom: 2.3rem;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transform: translateX(-50%);
  color: #8f8678;
  font: 0.59rem/1 var(--display);
  letter-spacing: 0.16em;
  text-decoration: none;
}

.scroll-cue span { color: var(--red); font-size: 1rem; }

.hero__side-note {
  position: absolute;
  right: 3.2vw;
  bottom: 26%;
  margin: 0;
  color: rgb(240 232 216 / 22%);
  font: 0.55rem/1.7 var(--display);
  letter-spacing: 0.16em;
  text-align: right;
  writing-mode: vertical-rl;
}

.converter-section {
  position: relative;
  padding: clamp(5rem, 9vw, 8.2rem) 7vw;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

.converter-section::before {
  position: absolute;
  top: -60px;
  right: -70px;
  width: 240px;
  aspect-ratio: 1;
  border: 1px solid rgb(17 16 15 / 8%);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgb(17 16 15 / 2%), 0 0 0 50px rgb(17 16 15 / 2%);
  content: '';
}

.converter-wrap { position: relative; width: min(100%, 920px); margin: 0 auto; }

.section-heading { position: relative; margin-bottom: 2.6rem; }

.section-heading__number {
  margin: 0 0 1.25rem;
  color: #776d60;
  font: 0.66rem/1.2 var(--display);
  letter-spacing: 0.17em;
}

.section-heading h2 {
  margin: 0;
  font: 900 clamp(2.6rem, 5vw, 4.4rem)/1 var(--body);
  letter-spacing: -0.06em;
}

.section-heading__summary {
  max-width: 650px;
  margin: 1rem 0 0;
  color: #655d52;
  font-size: clamp(0.88rem, 1.4vw, 1rem);
  line-height: 1.8;
}

.section-heading__stamp {
  position: absolute;
  top: 1.2rem;
  right: 2.3rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  transform: rotate(8deg);
  border: 2px solid var(--red-dark);
  color: var(--red-dark);
  font-weight: 900;
  letter-spacing: 0.2em;
  opacity: 0.78;
}

.converter-form {
  padding: clamp(1rem, 2.5vw, 2rem);
  border: 1px solid rgb(17 16 15 / 25%);
  background: rgb(255 252 245 / 45%);
  box-shadow: 7px 7px 0 rgb(17 16 15 / 8%);
}

.converter-form label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.converter-form label span,
.result-card__heading h3 span,
.copy-button span {
  color: #776d60;
  font: 0.6rem/1 var(--display);
  letter-spacing: 0.1em;
}

.converter-form textarea {
  display: block;
  width: 100%;
  min-height: 155px;
  resize: vertical;
  padding: 1rem;
  border: 1px solid rgb(17 16 15 / 22%);
  border-radius: 0;
  background: #faf6ed;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.8;
}

.converter-form textarea::placeholder { color: #82796e; opacity: 1; }

.converter-form__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.55rem 0 1.25rem;
  color: #766d62;
  font: 0.59rem/1.4 var(--display);
  letter-spacing: 0.08em;
}

.submit-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: 62px;
  padding: 0.9rem 1rem 0.9rem 1.2rem;
  border: 0;
  background: var(--red);
  color: #fff9ef;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 850;
  text-align: left;
  transition: background-color 160ms ease, transform 160ms ease;
}

.submit-button:hover { transform: translateY(-2px); background: #d92e25; }

.submit-button span[lang="en"] {
  margin-left: auto;
  font: 0.62rem/1 var(--display);
  letter-spacing: 0.1em;
}

.submit-button__arrow { font-size: 1.1rem; }

.result-card { margin-top: 2.2rem; border-top: 1px solid var(--line-light); }

.result-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 0.7rem;
}

.result-card__heading h3 { margin: 0; font-size: 0.82rem; }

.copy-button {
  padding: 0.5rem 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.copy-button:disabled { cursor: not-allowed; opacity: 0.45; }

.result-output {
  display: block;
  min-height: 0;
  padding: 0;
  color: #302a24;
  font-size: 0.95rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.result-output:empty { display: none; }

.result-output:not(:empty) { padding: 1.1rem 1rem; border-inline-start: 3px solid var(--red); background: rgb(17 16 15 / 4%); }

.converter-status { min-height: 1.2rem; margin: 0.55rem 0 0; color: #554b3e; font-size: 0.75rem; }

.converter-footnote {
  margin: 1.2rem 0 0;
  color: #655d52;
  font-size: 0.72rem;
  line-height: 1.7;
}

.converter-footnote span { padding-right: 0.3rem; color: var(--red-dark); }

.context-section {
  padding: clamp(4rem, 8vw, 7.5rem) 8.6vw;
  background: var(--ink-soft);
}

.context-section__marker {
  display: flex;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line-dark);
  color: #928879;
  font: 0.63rem/1.2 var(--display);
  letter-spacing: 0.16em;
}

.context-section__marker span:first-child { color: var(--red); }

.context-section__grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(3rem, 9vw, 9rem);
  padding-top: clamp(3rem, 6vw, 5.5rem);
}

.eyebrow--light { color: #ff7166; }

.context-section h2 {
  margin: 1.3rem 0 0;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 1.04;
}

.context-copy { max-width: 680px; }

.context-copy p { margin: 0 0 1.25rem; color: #c7bdaf; font-size: 0.9rem; line-height: 1.9; }

.context-copy .context-copy__lead { color: var(--paper); font-size: clamp(1.1rem, 1.8vw, 1.35rem); font-weight: 700; line-height: 1.7; }

.context-copy__lead em { color: #ff7166; font-family: var(--display); font-style: normal; }

.context-copy .context-copy__english { margin-top: 1.8rem; padding: 1rem 0 1rem 1rem; border-left: 1px solid var(--red); color: #a99f91; font-size: 0.82rem; }

.source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
  color: var(--paper);
  font: 0.68rem/1.4 var(--display);
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 160ms ease;
}

.source-link:hover { color: #ff7166; }

.source-link span:last-child { color: var(--red); font-size: 1rem; }

.footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  padding: 2rem 8.6vw;
  border-top: 1px solid var(--line-dark);
  background: var(--ink);
}

.footer__wordmark {
  color: var(--red);
  font: 900 1.6rem/1 var(--display);
  letter-spacing: -0.04em;
  text-decoration: none;
}

.footer__wordmark span { padding: 0 0.15rem; color: var(--paper); font: 800 0.7rem/1 var(--body); }

.footer p { margin: 0; color: #a39a8c; font-size: 0.65rem; line-height: 1.8; }

.footer p span { color: #777064; font-size: 0.58rem; }

.footer .footer__note { font: 0.57rem/1.8 var(--display); letter-spacing: 0.08em; text-align: right; }

@keyframes orbit-breathe {
  from { transform: scale(0.98); opacity: 0.68; }
  to { transform: scale(1.025); opacity: 1; }
}

@media (min-width: 1500px) {
  .hero { padding-right: max(8.6vw, calc((100vw - 1500px) / 2)); padding-left: max(8.6vw, calc((100vw - 1500px) / 2)); }
}

@media (max-width: 850px) {
  .topbar { min-height: 68px; padding: 0 5vw; }
  .topbar__edition { display: none; }
  .topbar__tools { gap: 0; }
  html[dir="rtl"] .footer .footer__note { text-align: right !important; }
  .hero { min-height: max(650px, calc(100svh - 68px)); padding-right: 6vw; padding-left: 6vw; }
  .hero h1 { font-size: clamp(5.2rem, 17vw, 9.8rem); }
  .hero__title-cn { font-size: clamp(2.3rem, 7.3vw, 4.5rem); }
  .hero__ornament--orbit { top: 20%; right: -5%; width: 66vw; }
  .hero__ornament--flare { top: 26%; right: -5%; width: 58vw; }
  .hero__side-note { right: 2.2vw; }
  .context-section__grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .context-section h2 br { display: none; }
  .footer { grid-template-columns: auto 1fr; }
  .footer__note { grid-column: 2; text-align: left !important; }
}

@media (max-width: 560px) {
  .topbar { min-height: 62px; padding: 0 1.15rem; }
  .wordmark__seal { width: 30px; }
  .wordmark__name { font-size: 0.66rem; }
  .topnav { display: none; }
  .language-control select { max-width: 7.8rem; min-height: 2rem; font-size: 0.64rem; }
  .hero { min-height: 700px; min-height: max(700px, calc(100svh - 62px)); padding: 1.5rem 1.25rem 2rem; }
  .hero__topline { gap: 0.6rem; }
  .hero .eyebrow { max-width: 62%; font-size: 0.55rem; letter-spacing: 0.12em; }
  .hero__index { font-size: 0.5rem; }
  .hero__title-wrap { padding: 3rem 0; }
  .hero__pretitle { margin-left: 0; font-size: 0.78rem; }
  .hero h1 { flex-wrap: wrap; gap: 0.05em 0.18em; max-width: 100%; font-size: clamp(5.1rem, 23vw, 7.3rem); line-height: 0.8; white-space: normal; }
  .hero__title-cn { top: 0; font-size: clamp(2.35rem, 11.5vw, 3.6rem); }
  .hero__title-ai { margin-left: 0.22em; }
  .hero__english { max-width: 300px; margin: 1.5rem 0 0; font-size: 0.84rem; line-height: 1.6; }
  .hero__bottomline { flex-direction: column; gap: 1.4rem; }
  .hero__dek { font-size: 0.8rem; }
  .sound-control { width: 100%; max-width: 330px; }
  .sound-button { min-height: 54px; }
  .scroll-cue { bottom: 1rem; left: auto; right: 1.25rem; transform: none; font-size: 0.52rem; }
  .hero__side-note { display: none; }
  .hero__ornament--orbit { top: 29%; right: -32%; width: 96vw; }
  .hero__ornament--flare { top: 34%; right: -26%; width: 90vw; }
  .converter-section { padding: 4.5rem 1.15rem; }
  .section-heading { margin-bottom: 1.8rem; }
  .section-heading h2 { max-width: 75%; font-size: 2.45rem; }
  .section-heading__stamp { top: 2.2rem; right: 0.2rem; font-size: 0.76rem; }
  .section-heading__summary { font-size: 0.85rem; }
  .converter-form { padding: 1rem; }
  .converter-form__meta { font-size: 0.51rem; }
  .converter-form__meta span:first-child { font-family: var(--body); font-size: 0.63rem; }
  .submit-button { min-height: 58px; }
  .submit-button span[lang="en"] { font-size: 0.54rem; }
  .context-section { padding: 4rem 1.25rem; }
  .context-section__grid { gap: 2rem; padding-top: 2.7rem; }
  .context-section h2 { font-size: 3rem; }
  .context-copy p { font-size: 0.84rem; }
  .context-copy .context-copy__lead { font-size: 1.1rem; }
  .footer { grid-template-columns: 1fr; gap: 1rem; padding: 1.5rem 1.25rem; }
  .footer__note { grid-column: auto; }
  .footer .footer__note { text-align: left !important; }
}

html[dir="rtl"] .hero__index { text-align: left; }
html[dir="rtl"] .hero h1 { direction: ltr; }
html[dir="rtl"] .sound-button { text-align: right; }
@media (max-width: 560px) {
  html[dir="rtl"] .scroll-cue { right: auto; left: 1.25rem; }
  html[dir="rtl"] .footer .footer__note { text-align: right !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
