:root {
  color-scheme: light;
  --page: #f2f4ed;
  --ink: #0b1f0d;
  --muted: #50584d;
  --forest: #10341a;
  --ice: #f8faef;
  --line: #486436;
  --lime: #d3ff47;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #6a8f28; outline-offset: 4px; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.75rem;
  margin-inline: clamp(1rem, 2vw, 2rem);
  padding: 0.7rem clamp(0rem, 1.55vw, 1.5rem);
  border-bottom: 1px solid var(--line);
}

.wordmark, .local-caption { display: flex; align-items: center; gap: 0.7rem; }
.wordmark { font-size: clamp(1.4rem, 2.6vw, 2.4rem); font-weight: 850; }
.wordmark img { width: clamp(1.05rem, 1.8vw, 1.75rem); height: auto; }
.local-caption { font-size: clamp(0.875rem, 1.65vw, 1.5rem); font-weight: 650; }
.local-caption svg { width: 1.3em; height: 1.3em; }

main { width: min(93.2%, 90rem); margin-inline: auto; padding-bottom: 2.2rem; }
.intro { text-align: center; margin: clamp(2.4rem, 3.4vw, 3.35rem) auto clamp(2rem, 3.7vw, 3.65rem); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.35rem, 6.2vw, 5.9rem); font-weight: 900; letter-spacing: -0.055em; line-height: 1.14; }
.intro p { color: var(--muted); margin-top: 1rem; font-size: clamp(1rem, 2.15vw, 2rem); line-height: 1.65; }

.workbench {
  display: grid;
  grid-template-columns: 46% 54%;
  border: 1.5px solid var(--line);
  border-radius: clamp(1rem, 2.6vw, 2.5rem);
  background: #fff;
  overflow: hidden;
}

.setup, .output { min-width: 0; padding: clamp(1.15rem, 2.7vw, 2.7rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.8rem); font-weight: 850; line-height: 1.25; }
.hint { color: var(--muted); font-size: clamp(0.875rem, 1.8vw, 1.65rem); margin-top: 0.95rem; line-height: 1.6; overflow-wrap: anywhere; }
.key-entry {
  display: flex;
  align-items: stretch;
  margin-top: clamp(1rem, 2.15vw, 2.05rem);
  border: 1px solid var(--line);
  border-radius: clamp(0.5rem, 0.9vw, 0.9rem);
  min-height: clamp(3rem, 5.3vw, 4.9rem);
}
.key-entry:focus-within { outline: 2px solid #7da240; outline-offset: 2px; }
.key-entry:has([aria-invalid='true']) { border-color: #a03324; }
.key-entry input { width: 100%; min-width: 0; padding: 0 0.9em; border: 0; border-radius: inherit; outline: none; color: var(--ink); background: transparent; font-size: clamp(1rem, 1.9vw, 1.75rem); }
.key-entry input::placeholder { color: #676f61; opacity: 1; }
.toggle { display: grid; place-items: center; align-self: center; border: 0; border-left: 1px solid #bdc7b6; width: clamp(3rem, 5.5vw, 5.3rem); min-height: 2.6rem; color: var(--ink); background: transparent; flex: none; }
.toggle svg { width: clamp(1.25rem, 2.1vw, 2rem); height: auto; }
.eye-slash { display: none; }
.toggle[aria-pressed='true'] .eye-slash { display: initial; }

.primary, .secondary, .copy { border-radius: clamp(0.5rem, 0.95vw, 0.95rem); font-size: clamp(1rem, 2.1vw, 1.95rem); font-weight: 750; min-height: clamp(3rem, 5.35vw, 5rem); }
.primary, .copy { width: 100%; }
.primary { margin-top: clamp(1rem, 2.4vw, 2.4rem); padding: 0.65em; color: var(--ice); border: 1px solid var(--forest); background: var(--forest); }
.primary:hover { background: #1a4827; }
.primary:disabled { opacity: 0.75; }
.setup-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.65rem 1rem; margin-top: clamp(0.9rem, 2vw, 2rem); }
.secondary { min-height: clamp(2.65rem, 4.6vw, 4.2rem); padding: 0.5em 1.3em; font-size: clamp(0.9rem, 1.7vw, 1.62rem); color: var(--ink); border: 1px solid var(--line); background: #fff; }
.secondary:hover:enabled { background: #f2f5e9; }
.secondary:disabled { color: #667362; border-color: #c5cec0; }
.error { font-size: 0.9rem; color: #a03324; line-height: 1.45; }
.error:empty { display: none; }

.output { background: var(--forest); color: var(--ice); display: flex; flex-direction: column; justify-content: space-between; }
.output-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.remaining { color: var(--ice); white-space: nowrap; font-size: clamp(1rem, 2.5vw, 2.35rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.code {
  display: block;
  text-align: center;
  margin: clamp(0.95rem, 2.1vw, 1.9rem) 0;
  white-space: nowrap;
  font: 800 clamp(2.65rem, 9.35vw, 8.75rem)/1.18 ui-monospace, 'Cascadia Code', Consolas, monospace;
  letter-spacing: -0.09em;
}
.code.wide { font-size: clamp(2rem, 7.55vw, 7rem); }
.code[aria-label='等待生成验证码'] { color: #a8bca6; letter-spacing: -0.16em; }
.progress { width: 100%; height: clamp(0.4rem, 1.05vw, 0.95rem); appearance: none; border: 0; border-radius: 999px; background: #47644c; color: var(--lime); overflow: hidden; }
.progress::-webkit-progress-bar { background: #47644c; }
.progress::-webkit-progress-value { background: var(--lime); border-radius: 999px; }
.progress::-moz-progress-bar { background: var(--lime); border-radius: 999px; }
.copy { margin-top: clamp(1.15rem, 3.2vw, 3.2rem); padding: 0.6em; color: var(--ice); border: 2px solid var(--ice); background: transparent; }
.copy:hover:enabled { background: #23492d; }
.copy:disabled { color: #b8c5b8; border-color: #819481; }
.output :focus-visible { outline-color: var(--lime); }
.privacy { text-align: center; margin-top: clamp(1.45rem, 2.3vw, 2.2rem); font-size: clamp(0.875rem, 1.6vw, 1.5rem); line-height: 1.6; color: var(--muted); }
.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: 650px) {
  .site-header { min-height: 3.65rem; }
  main { width: calc(100% - 2rem); }
  .intro { margin-top: 2rem; }
  .intro p { max-width: 23rem; margin-inline: auto; }
  .workbench { grid-template-columns: 1fr; }
  .output { min-height: 14rem; }
  .code { font-size: clamp(2.35rem, 12vw, 5rem); }
  .code.wide { font-size: clamp(1.9rem, 9.7vw, 4.25rem); }
}
