/* Baby name swipe — mobile-first, soft babymoon palette */

:root {
  --bg: #f7f1ea;
  --bg-grad-1: #f7f1ea;
  --bg-grad-2: #efe6df;
  --card: #fffefb;
  --ink: #2a2420;
  --muted: #7a6e64;
  --keep: #4a8a5e;
  --keep-bg: #e6f1e8;
  --maybe: #b88840;
  --maybe-bg: #f7eed9;
  --ignore: #a35858;
  --ignore-bg: #f0e0e0;
  --border: #ebe0d2;
  --accent: #6b5cc4;
  --accent-soft: #8478d2;
  --shadow-sm: 0 1px 2px rgba(74, 56, 40, 0.04);
  --shadow: 0 2px 12px rgba(74, 56, 40, 0.06);
  --shadow-lg: 0 12px 36px rgba(74, 56, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  background: var(--bg);
  background: radial-gradient(ellipse 80% 50% at 50% 0%, #faf4ec 0%, transparent 60%), linear-gradient(180deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.55;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* App header */
.app-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 241, 234, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  flex: 1;
  min-width: 0;
}

.round-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(107, 92, 196, 0.08);
  border-radius: 999px;
}

.progress {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-soft) 100%);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 2px;
}

.had-enough {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  transition: background 0.15s ease;
}

.had-enough:active {
  background: var(--border);
}

/* Card area */
.card-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  position: relative;
}

.card-area::before {
  content: "";
  position: absolute;
  inset: 10% 5%;
  background: radial-gradient(ellipse at center, rgba(107, 92, 196, 0.06), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 40px 28px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 18px 48px -12px rgba(74, 56, 40, 0.18), 0 4px 12px rgba(74, 56, 40, 0.06);
  width: 100%;
  max-width: 440px;
  text-align: center;
  position: relative;
  z-index: 1;
  border: 1px solid rgba(235, 224, 210, 0.7);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
}

.card.swiping-keep {
  transform: translateX(70%) rotate(10deg);
  opacity: 0;
}

.card.swiping-ignore {
  transform: translateX(-70%) rotate(-10deg);
  opacity: 0;
}

.card.swiping-maybe {
  transform: translateY(24%) scale(0.88);
  opacity: 0;
}

.name {
  font-size: 52px;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 18px 0;
  line-height: 1.05;
  color: var(--ink);
  font-feature-settings: "liga", "dlig", "kern";
  text-wrap: balance;
}

.meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.tag {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.meaning {
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 14px 0;
  font-style: italic;
  line-height: 1.45;
}

.source-note {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* Action buttons */
.actions {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.btn {
  flex: 1;
  padding: 20px 12px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease, filter 0.1s ease;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: scale(0.96);
  box-shadow: none;
  filter: brightness(0.96);
}

.btn-icon {
  font-size: 24px;
  line-height: 1;
}

.btn-keep .btn-icon {
  font-size: 22px;
  transform: translateY(-1px);
}

.btn-keep {
  background: var(--keep-bg);
  color: var(--keep);
}

.btn-maybe {
  background: var(--maybe-bg);
  color: var(--maybe);
}

.btn-ignore {
  background: var(--ignore-bg);
  color: var(--ignore);
}

.undo {
  text-align: center;
  padding: 0 18px 14px;
}

.undo button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.undo button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Empty / done states */
.done-state {
  padding: 40px 24px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.done-state h1 {
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 14px 0;
  letter-spacing: -0.01em;
}

.done-state p {
  color: var(--muted);
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.cta {
  display: inline-block;
  background: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent) 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border: none;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  margin: 6px;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 14px -4px rgba(107, 92, 196, 0.35);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.cta:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 2px 6px -2px rgba(107, 92, 196, 0.3);
}

.cta-secondary {
  background: transparent;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Setup, overlap, discuss pages */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 18px max(28px, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

.page h1 {
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  text-wrap: balance;
}

.page h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px 0;
  letter-spacing: -0.005em;
}

.page p {
  margin: 0 0 16px 0;
  color: var(--muted);
}

.page p.lede {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.5;
}

.intro-emoji {
  font-size: 32px;
  margin-bottom: 4px;
  display: block;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--ink);
}

/* Radio rows — full-width tappable cards on mobile */
.field:has(input[type="radio"]) {
  margin-bottom: 10px;
}

.field:has(input[type="radio"]) > label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 15px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  margin-bottom: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background 0.15s ease;
  line-height: 1.4;
  text-align: left;
}

.field:has(input[type="radio"]:checked) > label {
  border-color: var(--accent);
  background: linear-gradient(180deg, #fffefb 0%, #f4f0ff 100%);
}

.field input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease;
}

.field input[type="radio"]:checked {
  border-color: var(--accent);
}

.field input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.field-hint {
  margin: 6px 0 4px 38px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

/* Pool-list step-by-step disclosure */
.prompt-steps {
  background: linear-gradient(180deg, #fffefb 0%, #fbf6ee 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  margin: 0 0 20px 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.prompt-steps > summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompt-steps > summary::-webkit-details-marker {
  display: none;
}

.prompt-steps > summary::after {
  content: "+";
  font-size: 22px;
  font-weight: 400;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.prompt-steps[open] > summary::after {
  content: "−";
}

.prompt-steps[open] > summary {
  border-bottom: 1px solid var(--border);
}

.steps {
  margin: 0;
  padding: 18px 18px 18px 36px;
  font-size: 14px;
  line-height: 1.6;
}

.steps li {
  margin-bottom: 16px;
}

.steps li:last-child {
  margin-bottom: 0;
}

.steps strong {
  color: var(--ink);
}

.steps code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.cta-small {
  padding: 8px 14px;
  font-size: 13px;
  margin: 8px 4px 4px 0;
  display: inline-block;
}

.prompt-preview {
  margin-top: 8px;
  font-size: 13px;
}

.prompt-preview > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
}

.prompt-preview > summary:hover {
  color: var(--accent);
  background: rgba(107, 92, 196, 0.05);
}

.prompt-preview pre {
  background: var(--bg);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 8px 0 0 0;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, monospace;
  border: 1px solid var(--border);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-row .cta {
  flex: 1;
  min-width: 140px;
  margin: 0;
}

.callout {
  background: linear-gradient(180deg, #fffefb 0%, #fbf6ee 100%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-soft);
  padding: 14px 18px;
  border-radius: 10px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

.callout strong {
  color: var(--ink);
}

.error {
  background: var(--ignore-bg);
  color: var(--ignore);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin: 12px 0;
}

.success {
  background: var(--keep-bg);
  color: var(--keep);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin: 12px 0;
}

/* Overlap result lists */
.overlap-section {
  margin: 28px 0;
}

.overlap-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 10px 0;
}

.name-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.name-pill {
  background: var(--bg);
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

.name-pill.both-kept {
  background: var(--keep-bg);
  color: var(--keep);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 1px 3px rgba(74, 138, 94, 0.15);
}

.name-pill.soft {
  background: var(--maybe-bg);
  color: var(--maybe);
}

.name-pill.diverge {
  background: var(--ignore-bg);
  color: var(--ignore);
  text-decoration: line-through;
  opacity: 0.7;
}

/* Nav */
.nav {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav a:hover {
  border-color: var(--accent-soft);
  color: var(--accent);
}

.nav a.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

/* Discussion mode */
.discuss-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.discuss-card h3 {
  margin: 0 0 6px 0;
  font-size: 26px;
  font-weight: 500;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  letter-spacing: -0.01em;
}

.discuss-card .origin-meaning {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 18px;
  font-style: italic;
}

.discuss-card ul {
  margin: 0;
  padding-left: 22px;
}

.discuss-card li {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

/* Empty state — discuss page */
#empty-state {
  text-align: center;
  padding: 40px 24px;
  background: transparent;
  border: 1px dashed var(--border);
  box-shadow: none;
}

#empty-state::before {
  content: "🌱";
  display: block;
  font-size: 32px;
  margin-bottom: 12px;
}

@media print {
  .nav, .had-enough, .actions, .cta { display: none !important; }
  .discuss-card { break-inside: avoid; page-break-inside: avoid; }
  body { background: white; }
}

/* Tablets/laptops */
@media (min-width: 768px) {
  .name { font-size: 60px; }
  .actions { max-width: 520px; }
  .page { padding: 40px 24px; }
}
