:root {
  --primary: #2d6a4f;
  --primary-dark: #1b4332;
  --surface: #f8f9f8;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --error: #c1121f;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
  background: linear-gradient(160deg, #e8f5e9 0%, var(--surface) 45%);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

header h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--primary-dark);
}

header p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

header .header-lede {
  text-align: left;
}

header .header-lede p + p {
  margin-top: 0.65em;
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(45, 106, 79, 0.08);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--primary-dark);
}

.field-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--primary-dark);
}

.field-hint {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.bundled-special-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.875rem;
}

.bundled-special-row:has(input:checked) {
  border-color: var(--primary);
  background: rgba(45, 106, 79, 0.06);
}

/* 首行与 .chips label 一致：复选框 + 文案垂直居中 */
.bundled-special-line1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

.bundled-special-title {
  font-weight: 500;
  color: var(--primary-dark);
  line-height: 1.25;
}

/* 与首行「标题」左缘对齐（复选框 1rem + gap 8px，与 chips 一致） */
.bundled-special-set {
  padding-left: calc(1rem + 8px);
  font-family:
    ui-monospace,
    'SF Mono',
    Menlo,
    monospace;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.row-salt {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.row-salt input {
  flex: 1;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfd8dc;
  border-radius: 8px;
  font-size: 1rem;
}

input:focus {
  outline: 2px solid rgba(45, 106, 79, 0.35);
  border-color: var(--primary);
}

.btn-ghost {
  padding: 8px 12px;
  border: 1px solid #cfd8dc;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.btn-ghost:hover {
  background: #f5f5f5;
}

.length-row {
  margin-top: 8px;
}

.length-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#length {
  width: 100%;
  margin-top: 8px;
}

.chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 8px;
}

.chips label {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  padding: 7px 10px;
  border: 1px solid #cfd8dc;
  border-radius: 10px;
  user-select: none;
}

.chips label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(45, 106, 79, 0.08);
}

.chips input[type='checkbox'],
.bundled-special-line1 input[type='checkbox'] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.chips .chip-label {
  display: inline-block;
  line-height: 1.25;
}

.actions {
  margin-top: 20px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.alert {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffebee;
  color: var(--error);
  font-size: 0.875rem;
}

.result {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.result h2 {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#output {
  font-family:
    ui-monospace,
    'Cascadia Code',
    'SF Mono',
    Menlo,
    monospace;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  word-break: break-all;
  padding: 12px;
  background: #f1f3f4;
  border-radius: 8px;
  margin-bottom: 12px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 10px;
  font-size: 0.9375rem;
  cursor: pointer;
}

.btn-outline:hover {
  background: rgba(45, 106, 79, 0.06);
}

.note {
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

footer.footer-algo {
  text-align: left;
  max-width: 100%;
}

footer.footer-algo p {
  margin: 0 0 0.75em;
  line-height: 1.5;
}

footer.footer-algo p:last-child {
  margin-bottom: 0;
}

.footer-algo-title {
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5em;
  text-align: center;
}
