:root {
  color-scheme: dark;
  --bg: #080b14;
  --surface: rgba(19, 23, 38, 0.72);
  --text: #eef2ff;
  --muted: #98a4c0;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --input-bg: rgba(255, 255, 255, 0.04);
  --soft-bg: rgba(255, 255, 255, 0.045);
  --chip-bg: rgba(255, 255, 255, 0.05);
  --result-bg: rgba(255, 255, 255, 0.03);
  --tab-active: rgba(255, 255, 255, 0.1);
  --icon-bg: rgba(139, 108, 255, 0.14);
  --accent: #8b6cff;
  --accent-light: #22d3ee;
  --accent-soft: rgba(139, 108, 255, 0.12);
  --accent-border: rgba(139, 108, 255, 0.35);
  --focus-ring: rgba(139, 108, 255, 0.22);
  --danger: #fb7185;
  --switch-off: #2b3247;
  --toast-bg: rgba(24, 29, 46, 0.94);
  --error-bg: rgba(251, 113, 133, 0.1);
  --error-border: rgba(251, 113, 133, 0.28);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --placeholder: #63708f;
  --radius: 20px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: rgba(255, 255, 255, 0.82);
  --text: #172033;
  --muted: #667085;
  --border: rgba(16, 24, 40, 0.1);
  --border-strong: rgba(16, 24, 40, 0.16);
  --input-bg: rgba(255, 255, 255, 0.9);
  --soft-bg: rgba(255, 255, 255, 0.7);
  --chip-bg: rgba(124, 92, 255, 0.06);
  --result-bg: rgba(248, 250, 255, 0.8);
  --tab-active: rgba(255, 255, 255, 0.95);
  --icon-bg: rgba(124, 92, 255, 0.1);
  --accent: #6d4aff;
  --accent-light: #0891b2;
  --accent-soft: rgba(109, 74, 255, 0.08);
  --accent-border: rgba(109, 74, 255, 0.28);
  --focus-ring: rgba(109, 74, 255, 0.16);
  --danger: #e11d48;
  --switch-off: #d7dce7;
  --toast-bg: rgba(255, 255, 255, 0.94);
  --error-bg: rgba(225, 29, 72, 0.08);
  --error-border: rgba(225, 29, 72, 0.24);
  --shadow: 0 20px 50px rgba(16, 24, 40, 0.08);
  --placeholder: #98a2b3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.36;
}

.orb-one {
  top: -240px;
  left: -180px;
  background: radial-gradient(circle, #7c5cff 0%, transparent 68%);
}

.orb-two {
  right: -180px;
  bottom: -280px;
  background: radial-gradient(circle, #22d3ee 0%, transparent 68%);
  opacity: 0.24;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 52px 52px;
  opacity: 0.32;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
}

[data-theme="light"] .orb-one {
  opacity: 0.14;
}

[data-theme="light"] .orb-two {
  opacity: 0.12;
}

.site-header,
main,
.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.brand-copy strong {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--soft-bg);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--soft-bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.icon-button:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-sun {
  display: none;
}

[data-theme="light"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: block;
}

.hero {
  padding: 62px 0 32px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--soft-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.eyebrow span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-light);
  box-shadow: 0 0 10px var(--accent-light);
}

.hero h1 {
  margin: 22px 0 16px;
  font-size: clamp(32px, 5.2vw, 56px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.16;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.hero-copy {
  max-width: 610px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.85;
}

.tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 24px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  backdrop-filter: blur(18px);
}

.tab {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 24px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.tab svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.tab[aria-selected="true"] {
  background: var(--tab-active);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.tab:focus-visible,
.button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
.panel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel {
  animation: fade-up 0.38s ease both;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 26px;
}

.card-head-row > div {
  flex: 1;
}

.head-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: none;
  place-items: center;
  border-radius: 12px;
  background: var(--icon-bg);
  color: var(--accent);
}

.head-icon svg {
  width: 21px;
  height: 21px;
}

.card-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.field > label,
.charset-group legend,
.label-row label {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

input::placeholder {
  color: var(--placeholder);
}

select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a4c0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

select option {
  background: #151a2b;
  color: #eef2ff;
}

[data-theme="light"] select option {
  background: #fff;
  color: #172033;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--soft-bg);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.switch-row:hover {
  border-color: var(--border-strong);
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch {
  position: relative;
  width: 40px;
  height: 23px;
  flex: none;
  border-radius: 999px;
  background: var(--switch-off);
  transition: background 0.2s ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  content: "";
  transition: transform 0.2s ease;
}

.switch-row input:checked + .switch {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

.switch-row input:checked + .switch::after {
  transform: translateX(17px);
}

.switch-row input:focus-visible + .switch {
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.switch-copy {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.switch-copy small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.form-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--error-border);
  border-radius: 10px;
  background: var(--error-bg);
  color: var(--danger);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.button svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  box-shadow: 0 10px 24px rgba(109, 74, 255, 0.28);
}

.button-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.button-ghost {
  border-color: var(--border);
  background: var(--soft-bg);
  color: var(--text);
}

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

.button-secondary {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--text);
}

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

.button-icon {
  width: 40px;
  height: 40px;
  min-height: 0;
  flex: none;
  margin-left: auto;
  padding: 0;
  border-color: var(--border);
  background: var(--soft-bg);
  color: var(--muted);
}

.button-full {
  width: 100%;
  margin-top: 18px;
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.output-card {
  display: flex;
  flex-direction: column;
}

.result-area {
  display: flex;
  min-height: 268px;
  flex: 1;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--result-bg);
}

.placeholder {
  margin: auto;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.placeholder svg {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  opacity: 0.52;
}

.placeholder p {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.placeholder span {
  font-size: 12px;
}

.result-list {
  display: flex;
  width: 100%;
  max-height: 390px;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 9px;
  padding: 18px;
  overflow-y: auto;
}

.number-chip {
  min-width: 54px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  animation: chip-in 0.32s ease both;
  animation-delay: var(--delay, 0ms);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.meta-row strong {
  color: var(--text);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.label-row output {
  min-width: 50px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.length-controls {
  display: grid;
  grid-template-columns: 1fr 78px;
  align-items: center;
  gap: 14px;
}

.range-input {
  width: 100%;
  height: 6px;
  margin: 0;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent-light) var(--range-progress, 9%),
    var(--switch-off) var(--range-progress, 9%)
  );
  outline: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  appearance: none;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.range-input::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.length-number {
  height: 42px;
  text-align: center;
}

.charset-group {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

.charset-group legend {
  margin-bottom: 10px;
  padding: 0;
}

.chip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--soft-bg);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.check-chip:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.check-chip input {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.check-chip code {
  margin-left: 2px;
  color: var(--muted);
  font-size: 11px;
}

.switch-stack {
  margin-top: 12px;
}

.switch-stack .switch-row + .switch-row {
  margin-top: 9px;
}

.password-display {
  display: grid;
  min-height: 124px;
  place-items: center;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--result-bg);
  overflow-wrap: anywhere;
}

.password-placeholder {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.password-value {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: clamp(17px, 2.3vw, 25px);
  letter-spacing: 0.035em;
  line-height: 1.55;
  text-align: center;
  user-select: all;
  animation: fade-up 0.3s ease both;
}

.strength-block {
  margin-top: 20px;
}

.strength-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.strength-label span:first-child {
  color: var(--text);
  font-weight: 600;
}

.strength-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--switch-off);
}

.strength-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
  transition: width 0.35s ease, background-color 0.25s ease;
}

.strength-bar[data-level="weak"] {
  background: #fb7185;
}

.strength-bar[data-level="medium"] {
  background: #fbbf24;
}

.strength-bar[data-level="good"] {
  background: #34d399;
}

.strength-bar[data-level="strong"] {
  background: linear-gradient(90deg, #34d399, #22d3ee);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 44px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 50;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 18px);
  backdrop-filter: blur(16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 24px;
  padding: 14px;
  border: 1px solid var(--error-border);
  border-radius: 12px;
  background: var(--error-bg);
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 880px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .result-area {
    min-height: 220px;
  }
}

@media (max-width: 600px) {
  .site-header,
  main,
  .site-footer {
    width: calc(100% - 28px);
  }

  .site-header {
    height: 74px;
  }

  .brand-copy small,
  .privacy-badge {
    display: none;
  }

  .hero {
    padding: 44px 0 26px;
  }

  .hero h1 br {
    display: none;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
  }

  .card {
    padding: 20px;
  }

  .field-row,
  .chip-grid {
    grid-template-columns: 1fr;
  }

  .length-controls {
    grid-template-columns: 1fr 70px;
  }

  .actions .button-primary {
    flex: 1;
  }

  .site-footer {
    flex-direction: column;
    text-align: center;
  }
}

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