:root {
  color-scheme: light;
  --background: #f5f6f3;
  --surface: #ffffff;
  --ink: #25362f;
  --muted: #6c766e;
  --line: #e0e5dd;
  --green: #315d48;
  --tint: #edf3ed;
  --error: #a3322b;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, input, .script-choice span { transition: border-color 150ms, background-color 150ms, color 150ms; }
button:focus-visible, input:focus-visible, .result-text:focus-visible { outline: 3px solid #71937f; outline-offset: 4px; }
button:disabled:hover { background: transparent; }
::selection { background: #dce9d9; }
.page { width: min(1120px, calc(100% - 96px)); margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; padding: 32px 0; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; gap: 12px; align-items: center; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.wordmark > span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 8px; background: var(--green); color: white; font-family: "Songti SC", SimSun, serif; font-size: 23px; font-weight: 400; }
.header-note { color: var(--muted); font-size: 13px; letter-spacing: 1px; }
.workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); margin-top: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 8px 32px #25362f04; }
.input-panel { padding: 28px 30px 32px; border-right: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }
.text-button { color: var(--muted); background: transparent; border: 0; padding: 10px 0 10px 12px; min-height: 44px; font-size: 13px; }
.text-button:hover { color: var(--green); }
.input-panel > label { display: block; margin: 22px 0 12px; color: var(--muted); font-size: 13px; }
#amount { width: 100%; min-width: 0; border: 1px solid #a8b9a9; background: #fbfcfa; border-radius: 8px; color: var(--ink); padding: 16px 14px; font-size: clamp(19px, 2.1vw, 25px); font-weight: 500; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.6px; }
#amount:hover { border-color: var(--green); }
#amount::placeholder { color: #8a958c; font-size: 18px; letter-spacing: 0; }
#amount[aria-invalid="true"] { border-color: var(--error); background: #fffafa; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.error { min-height: 21px; margin: 8px 0 14px; color: var(--error); font-size: 12px; line-height: 1.75; }
.result-panel { padding: 30px 34px 18px; min-width: 0; }
.result-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 23px; border-bottom: 1px solid var(--line); }
.formatted { color: var(--green); font-size: 12px; font-variant-numeric: tabular-nums; }
.result-block { padding-top: 20px; }
h3 { margin: 0; font-size: 13px; font-weight: 500; }
h3 > span { margin-left: 7px; color: #8b948a; font-size: 10px; letter-spacing: 1px; }
.copy-button { display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 6px; padding: 0; background: var(--tint); color: var(--green); transition: background-color 150ms ease, transform 150ms var(--ease-out); }
.copy-button svg { width: 20px; height: 20px; }
.copy-symbol, .check-symbol { transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out); transform-origin: 12px 12px; }
.check-symbol { opacity: 0; transform: scale(.9); }
.copy-button.is-copied .copy-symbol { opacity: 0; transform: scale(.9); }
.copy-button.is-copied .check-symbol { opacity: 1; transform: scale(1); }
.copy-button:active:not(:disabled):not(:focus-visible) { transform: scale(.97); }
.copy-button:focus-visible .copy-symbol, .copy-button:focus-visible .check-symbol { transition: none; }
@media (hover: hover) and (pointer: fine) {
  .copy-button:hover:not(:disabled) { background: #e0ebdf; }
}
.result-text { margin: 16px 0 26px; overflow-wrap: anywhere; }
.english { font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.7; letter-spacing: .1px; }
.chinese-block { border-top: 1px solid var(--line); padding-top: 20px; }
.chinese-heading { justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.chinese-heading > .copy-button { margin-left: auto; }
.chinese { font-family: "Songti SC", "Songti TC", "Noto Serif CJK SC", SimSun, serif; font-size: 23px; line-height: 1.85; letter-spacing: 1px; }
.script-choice { display: flex; margin: 0; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.script-choice label { position: relative; cursor: pointer; }
.script-choice input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.script-choice span { display: block; min-width: 45px; padding: 10px 9px; border-radius: 4px; font-size: 12px; line-height: 18px; color: var(--muted); }
.script-choice input:checked + span { background: var(--tint); color: var(--green); }
.script-choice input:focus-visible + span { outline: 3px solid #71937f; outline-offset: 3px; }
.copy-status { min-height: 20px; margin: 0; color: var(--green); font-size: 12px; line-height: 1.7; }
.is-empty { color: #899387; font-family: inherit; font-size: 15px; letter-spacing: 0; }
.page-footer { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; padding: 22px 0 40px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .page { width: min(600px, calc(100% - 40px)); }
  .page-header { padding: 24px 0; }
  .workspace { grid-template-columns: minmax(0, 1fr); margin-top: 24px; }
  .input-panel { padding: 22px 24px 26px; border-right: 0; border-bottom: 1px solid var(--line); }
  .input-panel > label { margin-top: 12px; }
  #amount { font-size: 26px; }
  .result-panel { padding: 24px 24px 18px; }
  .english { font-size: 21px; }
  .chinese { font-size: 22px; }
}

@media (max-width: 400px) {
  .page { width: calc(100% - 28px); }
  .input-panel, .result-panel { padding-left: 20px; padding-right: 20px; }
  #amount { font-size: 22px; }
  h3 > span { display: none; }
  .chinese-heading { gap: 10px; }
  .script-choice span { min-width: 38px; padding-left: 6px; padding-right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  button, input, .script-choice span { transition: none; }
  .copy-button, .copy-button:active:not(:disabled):not(:focus-visible) { transform: none; }
  .copy-button .copy-symbol, .copy-button .check-symbol { transform: none; transition: opacity 150ms ease; }
}
