/* 美国地址生成器 — 纯本地样式，无外部字体与框架 */
:root {
  --bg: #f4f6fa;
  --surface: #fff;
  --text: #1a1d26;
  --muted: #5c6370;
  --border: #e2e6ef;
  --primary: #1a56db;
  --primary-hover: #1547b8;
  --focus: #1a56db;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-size: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  background: linear-gradient(135deg, #1a56db 0%, #0d3d9c 100%);
  color: #fff;
  padding: 1.75rem 0 2rem;
  box-shadow: var(--shadow-lg);
}

.logo {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  opacity: 0.92;
  font-size: 0.95rem;
}

main.wrap {
  padding-top: 1.75rem;
  padding-bottom: 2.5rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.lead-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 0 0 1.25rem;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.lead-box .lead {
  margin-bottom: 0.65rem;
}

.lead-box .lead:last-child {
  margin-bottom: 0;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.badges li {
  font-size: 0.8rem;
  padding: 0.25rem 0.65rem;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  font-weight: 600;
}

.controls label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

select {
  flex: 1 1 200px;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--surface);
  cursor: pointer;
}

select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-hover);
}

.btn.ghost {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: #f0f4ff;
}

.btn.small {
  min-height: 36px;
  padding: 0 0.75rem;
  font-size: 0.875rem;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.result-block {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.result-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.output {
  font-size: 0.95rem;
  min-height: 5rem;
}

.result-shell {
  background: #e8ecf3;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.result-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.result-row {
  display: grid;
  gap: 0.6rem;
}

.result-cols-2 {
  grid-template-columns: 1fr 1fr;
}

.result-cols-1 {
  grid-template-columns: 1fr;
}

.result-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.4rem 0.55rem 0.4rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.result-field-tall {
  align-items: flex-start;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.result-field-tall .btn-copy-field {
  margin-top: 0.15rem;
}

.result-label {
  flex: 0 0 auto;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.result-value {
  flex: 1 1 auto;
  text-align: right;
  color: var(--text);
  font-size: 0.95rem;
  word-break: break-word;
  min-width: 0;
}

.result-value-multiline {
  white-space: pre-wrap;
  text-align: left;
}

.btn-copy-field {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  position: relative;
  flex-shrink: 0;
}

.btn-copy-field:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.btn-copy-field:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-copy-field::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z'/%3E%3C/svg%3E") center/contain no-repeat;
}

@media (max-width: 640px) {
  .result-cols-2 {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.saved-section .saved-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.saved-section h2 {
  margin: 0;
  font-size: 1.15rem;
}

.export-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.export-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
}

.data-table button.link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}

.data-table button.link:focus-visible {
  outline: 2px solid var(--focus);
  border-radius: 2px;
}

.features {
  margin-top: 2rem;
}

.features h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.features-intro {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.feature-grid li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.feature-grid h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.feature-grid p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.cta {
  text-align: center;
  margin-top: 1.5rem;
}

.cta h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}

.cta p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #1e293b;
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease;
  z-index: 50;
  max-width: min(90vw, 360px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .toast {
    transition: none;
  }
  .btn:active {
    transform: none;
  }
}
