:root {
  color-scheme: light;
  --bg: #f2f6f5;
  --white: #fff;
  --ink: #142a28;
  --muted: #526867;
  --line: #dce8e4;
  --green: #086653;
  --green-dark: #075241;
  --tint: #e6f3ee;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
p, h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #26816f; outline-offset: 3px; }
::selection { color: #104437; background: #b5ead4; }

.layout {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  align-items: start;
  gap: 1.65rem;
  max-width: 91rem;
  margin-inline: auto;
  padding: 1.8rem 2rem;
}
.sidebar, .workbench, .help {
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: 0 4px 16px #183f3510;
}
.sidebar {
  position: sticky;
  top: 1.8rem;
  display: flex;
  flex-direction: column;
  min-height: 25rem;
  padding: 1.1rem;
  border-radius: 1rem;
}
.brand {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: .7rem;
  margin: .22rem .34rem 1.6rem;
  font-size: 1.1rem;
  font-weight: 750;
  white-space: nowrap;
}
.brand strong { color: var(--green); }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: .72rem;
  color: #d1fae6;
  background: #164638;
}
.navigation { display: grid; gap: .35rem; }
.nav-link {
  display: flex;
  align-items: center;
  min-height: 2.7rem;
  gap: .65rem;
  padding: .5rem .75rem;
  border-radius: .55rem;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 650;
  white-space: nowrap;
}
.nav-link:hover, .nav-current { color: var(--green-dark); background: var(--tint); }
.sidebar-note, .mobile-note {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  color: var(--muted);
  font-size: .83rem;
  line-height: 1.55;
}
.sidebar-note { margin-top: auto; padding: .9rem .35rem 0; border-top: 1px solid var(--line); }
.mobile-note { display: none; }

.icon { display: inline-block; position: relative; width: 1rem; height: 1rem; flex: none; }
.icon::before, .icon::after { content: ""; position: absolute; }
.icon.lock::before { inset: 1px 4px 8px; border: 1.5px solid currentColor; border-radius: 5px 5px 0 0; }
.icon.lock::after { inset: 6px 2px 1px; border: 1.5px solid currentColor; border-radius: 2px; }
.icon.shield::before { inset: 1px 2px 0; background: currentColor; clip-path: polygon(50% 0, 100% 18%, 91% 66%, 69% 88%, 50% 100%, 31% 88%, 9% 66%, 0 18%); }
.icon.shield::after { top: 4px; left: 6px; width: 4px; height: 6px; border: solid var(--tint); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.icon.key::before { top: 1px; left: 1px; width: 8px; height: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon.key::after { top: 9px; left: 6px; width: 9px; height: 2px; background: currentColor; box-shadow: 4px 2px 0 -.5px currentColor; transform: rotate(43deg); }
.icon.info::before { inset: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon.info::after { top: 7px; left: 7px; width: 2px; height: 5px; border-radius: 1px; background: currentColor; box-shadow: 0 -3px 0 -0.35px currentColor; }

.content { display: grid; gap: 1rem; min-width: 0; }
.workbench { padding: clamp(1.35rem, 3.2vw, 3rem); border-radius: 1.2rem; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
h1 { font-size: clamp(1.7rem, 3.6vw, 2.7rem); line-height: 1.2; letter-spacing: -.04em; font-weight: 780; }
.page-header p { margin-top: .6rem; color: var(--muted); line-height: 1.5; }
.privacy {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex: none;
  border-radius: .5rem;
  padding: .48rem .65rem;
  font-size: .85rem;
  font-weight: 680;
  color: var(--green-dark);
  background: var(--tint);
}
.field-label { display: block; margin-bottom: .5rem; font-size: .96rem; font-weight: 720; }
textarea {
  display: block;
  width: 100%;
  min-height: 9.25rem;
  resize: vertical;
  padding: .95rem 1rem;
  border: 1px solid #c7dad3;
  border-radius: .7rem;
  color: var(--ink);
  background: #f6f9f8;
  font: 1rem/1.55 var(--font-mono);
}
textarea::placeholder { color: var(--muted); }
textarea[aria-invalid="true"] { border-color: #a64e3b; }
.field-meta, .result-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem 1rem; }
.field-meta { margin-top: .55rem; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.field-meta span { white-space: nowrap; }
.input-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.05rem; }
.input-error { margin-top: .55rem; color: #963a29; font-size: .9rem; line-height: 1.5; }
.button {
  display: inline-flex;
  min-height: 2.7rem;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  padding: .55rem .95rem;
  border: 1px solid var(--line);
  border-radius: .52rem;
  background: var(--white);
  color: var(--ink);
  font-weight: 680;
  white-space: nowrap;
}
.primary { min-height: 2.85rem; padding-inline: 1.2rem; border-color: var(--green); background: var(--green); color: var(--white); }
.primary:hover:not(:disabled) { background: var(--green-dark); }
.primary:disabled { opacity: .65; }
.secondary:hover:not(:disabled) { background: #f1f8f4; }
.secondary:disabled { color: #627472; background: #f7f9f8; }

.result-section { margin-top: 1.9rem; padding-top: 1.45rem; border-top: 1px solid var(--line); }
.result-heading { margin-bottom: .85rem; flex-wrap: wrap; }
.result-heading h2, .help h2 { font-size: 1.16rem; line-height: 1.4; font-weight: 750; }
.result-heading p { color: var(--muted); font-size: .85rem; }
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 5.3rem;
  padding: .75rem;
  border: 1px dashed #c9dcd3;
  border-radius: .68rem;
  background: #f8faf9;
  color: var(--muted);
  font-size: .94rem;
}
.empty-icon { display: grid; gap: .19rem; grid-template-columns: repeat(3, .22rem); color: var(--green); }
.empty-icon i { width: .22rem; height: .22rem; border-radius: 50%; background: currentColor; }
.results {
  --result-columns: minmax(11.7rem, 1.25fr) minmax(5.5rem, .65fr) minmax(7.5rem, 1fr);
  --result-gap: 1rem;
  border: 1px solid var(--line);
  background: #f5f9f7;
  border-radius: .68rem;
  overflow: hidden;
}
.results-header, .code-row { display: grid; grid-template-columns: var(--result-columns); align-items: center; gap: var(--result-gap); padding-inline: 1rem; }
.results-header { padding-block: .65rem; color: var(--muted); font-size: .84rem; font-weight: 650; }
.codes { padding: 0; margin: 0; list-style: none; }
.code-row { min-height: 4.1rem; padding-block: .55rem; background: var(--white); border-top: 1px solid var(--line); }
.code-cell { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .7rem; }
.code { font: 750 clamp(1.15rem, 2.5vw, 1.7rem)/1.25 var(--font-mono); white-space: pre; letter-spacing: .02em; color: var(--ink); }
.copy { min-height: 2.3rem; padding: .35rem .6rem; border-color: #d2e9de; background: var(--tint); color: var(--green-dark); font-size: .83rem; }
.copy:hover:not(:disabled) { background: #d5eee1; }
.copy:disabled { opacity: .58; }
.row-countdown { justify-self: start; padding: .28rem .48rem; border-radius: .4rem; background: #e9f2ee; color: var(--green-dark); font-size: .86rem; font-weight: 730; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-countdown.ending { background: #fff0db; color: #8e480f; }
.source-cell { display: flex; flex-wrap: wrap; align-items: baseline; gap: .23rem .6rem; }
.code-label { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.masked-key { font: 650 .9rem/1.4 var(--font-mono); color: #286050; white-space: nowrap; }
progress { display: block; width: 100%; height: .22rem; border: 0; appearance: none; background: var(--tint); color: #59a88a; }
progress::-webkit-progress-bar { background: var(--tint); }
progress::-webkit-progress-value { background: #59a88a; }
progress::-moz-progress-bar { background: #59a88a; }

.help { padding: 1.25rem clamp(1.35rem, 3.2vw, 3rem); border-radius: 1rem; scroll-margin-top: 1rem; }
.help h2 { display: flex; align-items: center; gap: .55rem; color: var(--green-dark); }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.3rem; margin-top: .85rem; }
.help h3 { font-size: .96rem; line-height: 1.45; }
.help p { margin-top: .2rem; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 58rem) {
  .layout { grid-template-columns: 10.5rem minmax(0, 1fr); gap: .9rem; padding: 1.15rem; }
  .sidebar { padding: .8rem; }
}
@media (max-width: 47rem) {
  .layout { display: block; padding: .8rem; }
  .sidebar { position: static; min-height: 0; margin-bottom: .8rem; padding: .52rem .7rem; flex-direction: row; align-items: center; justify-content: space-between; gap: .35rem; }
  .brand { margin: 0; align-self: center; }
  .navigation { display: flex; gap: .15rem; }
  .nav-current { display: none; }
  .sidebar-note { display: none; }
  .mobile-note { display: flex; padding: 0 .3rem .35rem; }
}
@media (max-width: 35rem) {
  .workbench, .help { padding: 1.05rem; }
  .page-header { flex-direction: column; gap: .6rem; margin-bottom: 1.25rem; }
  textarea { min-height: 8.2rem; }
  .result-section { margin-top: 1.35rem; padding-top: 1.05rem; }
  .results-header { display: none; }
  .code-row { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .65rem; padding: .7rem; }
  .code-row:first-child { border-top: 0; }
  .source-cell { grid-column: 1 / -1; }
  .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 23rem) {
  .input-actions { gap: .35rem; }
  .button { padding-inline: .55rem; font-size: .9rem; }
  .copy { font-size: .78rem; }
}
