:root {
  color: #162033;
  background: #f4f6f9;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  --accent: #176b5b;
  --accent-hover: #115548;
  --accent-soft: #e8f4f0;
  --blue: #2459a8;
  --surface: #ffffff;
  --border: #dbe1e8;
  --muted: #687387;
  --error: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background-color: #dce4e8;
  background-image:
    linear-gradient(180deg, #ffffff 0, #ffffff 72px, transparent 72px),
    linear-gradient(rgba(11, 27, 33, 0.08), rgba(11, 27, 33, 0.08)),
    url("./background.webp");
  background-position: center, center, center;
  background-repeat: no-repeat;
  background-size: auto, auto, cover;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.site-header {
  width: min(1280px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  display: block;
}

.brand span {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 15px;
  line-height: 20px;
}

.primary-button svg,
.copy-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  width: min(1280px, calc(100% - 40px));
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  padding: clamp(44px, 9vh, 88px) 0 48px;
}

.tool {
  width: min(760px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(26, 39, 57, 0.08);
}

.tool-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 32px 24px;
  border-bottom: 1px solid #edf0f4;
}

.section-label {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  line-height: 16px;
}

h1 {
  margin: 0;
  color: #121a28;
  font-size: 26px;
  line-height: 34px;
}

.standard {
  display: flex;
  gap: 16px;
  padding-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.standard span + span::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 10px 3px 0;
  border-radius: 50%;
  background: #aab2bf;
}

form {
  padding: 28px 32px 32px;
}

label {
  display: inline-block;
  margin-bottom: 9px;
  color: #283448;
  font-size: 14px;
  font-weight: 650;
}

.secret-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 52px;
  border: 1px solid #cbd3dd;
  border-radius: 6px;
  background: #ffffff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.secret-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.13);
}

.secret-control:has(input[aria-invalid="true"]) {
  border-color: var(--error);
}

#secret {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 0 0 16px;
  color: #172033;
  background: transparent;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  line-height: 50px;
}

#secret::placeholder {
  color: #9aa4b2;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.text-action {
  min-width: 64px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 650;
}

.text-action:hover {
  color: #183f7c;
}

.field-error {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 18px;
}

.field-error {
  display: none;
  color: var(--error);
}

.field-error:not(:empty) {
  display: block;
}

.field-error:not(:empty) + .primary-button {
  margin-top: 14px;
}

.primary-button,
.copy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 6px;
  font-weight: 700;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.primary-button {
  min-width: 150px;
  margin-top: 14px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.primary-button:active,
.copy-button:active {
  transform: translateY(1px);
}

.result {
  min-height: 206px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px auto;
  align-items: center;
  gap: 28px;
  padding: 30px 32px;
  border-top: 1px solid var(--border);
  background: #f9fafc;
}

.result-copy {
  min-width: 0;
}

.code {
  display: block;
  color: #1a2435;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 42px;
  font-weight: 720;
  line-height: 52px;
}

.result.is-active .code {
  color: var(--accent);
}

.result-status {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 20px;
}

.countdown {
  position: relative;
  width: 88px;
  height: 88px;
}

.countdown svg {
  width: 88px;
  height: 88px;
  transform: rotate(-90deg);
}

.countdown circle {
  fill: none;
  stroke-width: 6;
}

.countdown-track {
  stroke: #e2e7ed;
}

.countdown-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 238.76;
  stroke-dashoffset: 238.76;
  transition: stroke-dashoffset 200ms linear;
}

.countdown > span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #243146;
}

.countdown strong {
  font-size: 22px;
  line-height: 26px;
}

.countdown small {
  align-self: center;
  padding-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.copy-button {
  min-width: 132px;
  padding: 0 18px;
  border: 1px solid #bfc8d4;
  background: #ffffff;
  color: #273347;
}

.copy-button:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-button:disabled {
  opacity: 0.5;
}

footer {
  width: min(1280px, calc(100% - 40px));
  min-height: 60px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 89, 168, 0.28);
  outline-offset: 2px;
}

@media (max-width: 680px) {
  body {
    background-image:
      linear-gradient(180deg, #ffffff 0, #ffffff 66px, transparent 66px),
      linear-gradient(rgba(11, 27, 33, 0.08), rgba(11, 27, 33, 0.08)),
      url("./background.webp");
    background-position: center, center, 64% center;
  }

  .site-header,
  .app-shell,
  footer {
    width: min(100% - 28px, 760px);
  }

  .site-header {
    height: 66px;
  }

  .app-shell {
    min-height: calc(100vh - 122px);
    padding: 24px 0 36px;
  }

  .tool-heading {
    display: grid;
    gap: 16px;
    padding: 24px 20px 20px;
  }

  h1 {
    font-size: 23px;
    line-height: 30px;
  }

  .standard {
    gap: 12px;
    padding: 0;
  }

  .standard span + span::before {
    margin-right: 8px;
  }

  form {
    padding: 22px 20px 24px;
  }

  .primary-button {
    width: 100%;
  }

  .result {
    min-height: 292px;
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 18px;
    padding: 24px 20px;
  }

  .code {
    font-size: 35px;
    line-height: 44px;
  }

  .countdown,
  .countdown svg {
    width: 76px;
    height: 76px;
  }

  .copy-button {
    width: 100%;
    grid-column: 1 / -1;
  }

  footer {
    min-height: 56px;
  }
}

@media (max-width: 380px) {
  .site-header,
  .app-shell,
  footer {
    width: calc(100% - 20px);
  }

  .tool-heading,
  form,
  .result {
    padding-left: 16px;
    padding-right: 16px;
  }

  .code {
    font-size: 31px;
  }
}

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