:root {
  color-scheme: light;
  --bg: #f3f7fd;
  --panel: #fff;
  --line: #d6e1f2;
  --ink: #142344;
  --muted: #4d6180;
  --accent: #2456c4;
  --accent-hover: #1945aa;
  --accent-soft: #eaf2ff;
  --accent-line: #b7cdf2;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 280px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 78% 9%, #dce9ff 0%, transparent 48%),
    var(--bg);
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.shell { width: min(100% - 64px, 960px); margin-inline: auto; }
.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 253px; overflow: hidden; }
.hero-copy { position: relative; z-index: 1; padding-block: 33px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; color: var(--accent); font: 600 .75rem var(--mono); letter-spacing: .18em; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; }
h1 { margin: 0; font-size: clamp(2.35rem, 6.5vw, 4.2rem); line-height: 1.14; letter-spacing: -.06em; font-weight: 800; }
h1 span { color: var(--accent); }
.subtitle { margin: 17px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.orbital {
  position: absolute; width: 360px; height: 250px; right: 2%; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  background: radial-gradient(ellipse, #659aff38, transparent 66%);
}
.orbit, .axis, .orbit-dot { position: absolute; }
.orbit { width: var(--size); height: var(--size); border: 1px solid #3468c942; border-radius: 50%; }
.orbit-outer { --size: 216px; border-style: dashed; }
.orbit-middle { --size: 172px; }
.orbit-inner { --size: 126px; border-color: #3468c962; }
.axis { width: 300px; height: 1px; background: linear-gradient(90deg, transparent, #3468c94d, transparent); }
.axis-y { width: 234px; transform: rotate(90deg); }
.orbit-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot-one { transform: translate(63px, -58px); }
.dot-two { transform: translate(-102px, 36px); opacity: .6; }
.dot-three { transform: translate(58px, 24px); opacity: .7; }
.orbital-core {
  z-index: 1; width: 77px; height: 77px; display: grid; place-items: center;
  border-radius: 23px; border: 1px solid #8eb0ee; color: var(--accent);
  background: linear-gradient(145deg, #f3f8ff, #c8dcff);
  box-shadow: 0 9px 28px #477fd232, inset 0 1px #fff;
}
.orbital-core svg { width: 36px; height: 36px; stroke-width: 1.3; }

@media (prefers-reduced-motion: no-preference) {
  .orbit-outer { animation: orbit-spin 48s linear infinite; }
  .dot-one { animation: orbit-spin 16s linear infinite; }
  .dot-two { animation: orbit-spin 24s linear infinite reverse; }
  .dot-three { animation: orbit-spin 12s linear infinite; }
  .orbital-core { animation: lock-float 4.8s ease-in-out infinite; }

  @keyframes orbit-spin {
    from { rotate: 0deg; }
    to { rotate: 1turn; }
  }
  @keyframes lock-float {
    0%, 100% { translate: 0 0; }
    50% { translate: 0 -5px; }
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .orbital-core { transition: box-shadow 600ms ease; }
  .orbital:hover .orbital-core { box-shadow: 0 12px 32px #477fd24a, inset 0 1px #fff; }
}

.generator {
  background: var(--panel); border: 1px solid var(--line); border-radius: 23px;
  box-shadow: 0 22px 52px #224d9814, 0 2px 6px #1837640a; overflow: hidden;
}
.result-section { padding: 25px 29px 26px; background: #f7faff; border-bottom: 1px solid var(--line); }
.result-heading, .length-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-heading { margin-bottom: 13px; font-size: .875rem; }
.result-heading label, .length-heading label, legend { font-weight: 650; }
.strength { --strength: var(--accent); display: flex; align-items: center; gap: 8px; color: var(--strength); white-space: nowrap; }
.strength[data-level="1"] { --strength: #a8373e; }
.strength[data-level="2"] { --strength: #885713; }
.strength[data-level="3"] { --strength: #237058; }
.strength-bars { display: flex; gap: 3px; }
.strength-bars i { width: 12px; height: 4px; border-radius: 3px; background: var(--strength); }
.strength[data-level="1"] i:nth-child(n+2), .strength[data-level="2"] i:nth-child(n+3), .strength[data-level="3"] i:nth-child(n+4) { background: var(--line); }
.result-field {
  display: flex; align-items: center; gap: 9px; min-height: 69px;
  border: 1px solid var(--accent-line); border-radius: 12px; padding: 10px; background: var(--panel);
}
.password-display { display: grid; flex: 1; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.password-display::after, #password {
  grid-area: 1 / 1;
  min-width: 0; padding: 8px 9px; border: 0;
  font: 600 clamp(.94rem, 2.7vw, 1.65rem)/1.35 var(--mono);
  letter-spacing: .035em; white-space: pre-wrap; word-break: break-all;
}
/* The invisible copy sizes the field to the same visual lines as the textarea. */
.password-display::after { content: attr(data-value); visibility: hidden; }
#password {
  width: 100%; min-height: calc(1.35em + 16px); resize: none; overflow: hidden;
  border-radius: 3px; background: transparent; color: var(--ink);
}
.icon-button, .copy-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 45px; border-radius: 8px; transition: background .18s, border-color .18s, transform .18s;
}
.icon-button { width: 45px; flex: none; background: #f4f8ff; border: 1px solid var(--line); color: var(--accent); }
.icon-button:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.copy-button { padding: 0 15px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: .875rem; font-weight: 750; white-space: nowrap; }
.copy-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:active { transform: translateY(1px); }
.settings { padding: 23px 29px 28px; }
.settings h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; font-size: 1.125rem; letter-spacing: .015em; }
.settings h2 svg { color: var(--accent); }
.length-heading { margin-bottom: 7px; }
.length-heading output {
  display: grid; place-items: center; min-width: 47px; height: 32px; border-radius: 7px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font: 600 1rem var(--mono);
}
#length {
  --progress: 26.6667%;
  appearance: none; display: block; width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
}
#length::-webkit-slider-runnable-track { height: 5px; border-radius: 10px; background: linear-gradient(to right, var(--accent) var(--progress), var(--line) var(--progress)); }
#length::-moz-range-track { height: 5px; border-radius: 10px; background: linear-gradient(to right, var(--accent) var(--progress), var(--line) var(--progress)); }
#length::-webkit-slider-thumb { appearance: none; width: 17px; height: 17px; margin-top: -6px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px #2456c41a; }
#length::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px #2456c41a; }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font: .75rem var(--mono); }
fieldset { padding: 0; border: 0; min-width: 0; margin: 20px 0 0; }
legend { margin-bottom: 11px; padding: 0; }
.character-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.option {
  position: relative; display: flex; align-items: center; gap: 9px; min-height: 53px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 9px; background: #f8faff; cursor: pointer; transition: border-color .18s, background .18s;
}
.option:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.option:hover { border-color: #789de3; }
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.option input, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.feedback-visible {
  position: fixed; z-index: 2; inset: auto auto 20px 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px); height: auto; margin: 0; padding: 10px 14px;
  clip-path: none; white-space: normal; border: 1px solid var(--accent-line); border-radius: 9px;
  background: var(--panel); color: var(--ink); box-shadow: 0 8px 24px #224d9826;
}
.sample { display: grid; flex: none; place-items: center; width: 29px; height: 29px; border-radius: 6px; background: #dbe8ff; color: #30538e; font: 600 .75rem var(--mono); }
.option-name { font-size: .875rem; white-space: nowrap; }
.tick { display: grid; flex: none; place-items: center; width: 16px; height: 16px; margin-left: auto; border: 1px solid #758bac; border-radius: 4px; color: transparent; }
.tick svg { width: 12px; height: 12px; stroke-width: 2.6; }
.option input:checked ~ .tick { color: #fff; background: var(--accent); border-color: var(--accent); }
.page-footer { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 22px 0 28px; color: var(--muted); font-size: .8125rem; }
.page-footer svg { width: 16px; height: 16px; color: #4e6ca6; }

@media (max-width: 720px) {
  .shell { width: calc(100% - 36px); }
  .hero { min-height: 211px; }
  .orbital { right: -65px; transform: translateY(-50%) scale(.8); opacity: .5; }
  .character-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 460px) {
  .hero { min-height: 185px; }
  .orbital { right: -121px; opacity: .27; }
  .result-section, .settings { padding: 18px 14px; }
  .result-field { padding: 6px; gap: 5px; }
  .password-display::after, #password { padding-inline: 4px; }
  .icon-button { width: 37px; }
  .icon-button, .copy-button { min-height: 40px; }
  .copy-button { padding-inline: 8px; gap: 4px; }
  .copy-button svg, .icon-button svg { width: 16px; height: 16px; }
  .option { gap: 6px; padding-inline: 6px; }
  .sample { width: 24px; height: 24px; }
  .option-name { font-size: .8125rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
