:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --border: #e3e6ea;
  --line: #eef0f3;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #2563eb;
  --soft: #f3f4f6;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 20px 40px;
}

.page-head { margin-bottom: 24px; }

.page-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: .2px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.field-head label,
.field-title {
  font-size: 14px;
  font-weight: 600;
}

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

.meta {
  font-size: 13px;
  color: var(--muted);
}

.num {
  width: 64px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fcfcfd;
  color: var(--text);
  font: 14px/20px var(--mono);
  text-align: center;
  outline: none;
}

.num:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.range {
  display: block;
  width: 100%;
  margin: 6px 0 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.strength-label { font-weight: 600; }

.strength-bars {
  display: inline-flex;
  gap: 4px;
}

.strength-bars i {
  width: 22px;
  height: 5px;
  border-radius: 3px;
  background: #e8eaee;
}

.strength[data-level="1"] { --level-color: #dc2626; }
.strength[data-level="2"] { --level-color: #d97706; }
.strength[data-level="3"] { --level-color: #2563eb; }
.strength[data-level="4"] { --level-color: #16a34a; }

.strength[data-level="1"] i:nth-child(-n+1),
.strength[data-level="2"] i:nth-child(-n+2),
.strength[data-level="3"] i:nth-child(-n+3),
.strength[data-level="4"] i:nth-child(-n+4) { background: var(--level-color); }

.divider {
  height: 1px;
  margin: 18px 0 16px;
  background: var(--line);
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.opt {
  position: relative;
  display: block;
  cursor: pointer;
}

.opt input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.opt-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fcfcfd;
  transition: border-color .15s, background-color .15s;
}

.opt:hover .opt-body { border-color: #c9d2e3; }

.opt input:checked + .opt-body {
  border-color: var(--accent);
  background: #f5f8ff;
}

.opt input:checked + .opt-body .opt-name { color: var(--accent); }

.opt input:focus-visible + .opt-body {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.opt-name { font-size: 14px; }

.opt-sample {
  color: var(--muted);
  font: 13px/1.5 var(--mono);
  white-space: nowrap;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
}

.switch-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.switch-hint {
  margin-left: auto;
  color: var(--muted);
  font: 13px/1.5 var(--mono);
}

.btn {
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}

.btn:focus-visible,
.btn-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: #4b5563;
}

.btn-ghost:hover:not(:disabled) { background: var(--soft); }

.btn-mini {
  padding: 4px 10px;
  font-size: 13px;
  line-height: 20px;
}

.btn-primary {
  padding: 6px 14px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

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

.btn-link {
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.btn-link:hover:not(:disabled) { text-decoration: underline; }

.btn-link:disabled {
  color: #b6bbc4;
  cursor: not-allowed;
}

.error {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 5px;
  background: #fef2f2;
  color: #b42318;
  font-size: 13px;
}

.result-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.result-line:last-child { border-bottom: 0; }

.result-text {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font: 15px/1.5 var(--mono);
  letter-spacing: .3px;
  word-break: break-all;
  user-select: all;
  cursor: text;
}

.result-text.is-empty {
  color: #a1a7b0;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0;
  user-select: none;
  cursor: default;
}

.js-copy {
  flex: 0 0 72px;
  width: 72px;
  text-align: center;
}

/* 复制结果后的轻提示，按钮本身不变化 */
.toast {
  position: fixed;
  left: 50%;
  top: 28px;
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(31, 41, 55, .8);
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(16, 24, 40, .16);
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}

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

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .opt-body { transition: none; }
}

@media (max-width: 560px) {
  .wrap { padding: 32px 14px 28px; }
  .card { padding: 16px; }
  .head-actions { gap: 8px; }
  .option-grid { grid-template-columns: minmax(0, 1fr); }
  .result-text { font-size: 14px; }
}
