:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #737373;
  --muted-2: #a3a3a3;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --accent: #171717;
  --accent-fg: #fafafa;
  --focus: #2563eb;
  --radius: 14px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --pad-x: max(1.25rem, env(safe-area-inset-left));
  --pad-x-r: max(1.25rem, env(safe-area-inset-right));
  --pad-b: max(1.5rem, env(safe-area-inset-bottom));
  --touch: 44px;
  --max: 960px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
  font-feature-settings: "ss01" on, "cv11" on, "kern" on;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
}

@media (min-width: 861px) {
  body {
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }
}

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: max(2rem, env(safe-area-inset-top)) var(--pad-x) 0 var(--pad-x-r);
}

/* ——— Hero ——— */
.hero {
  padding: 1.5rem 0 2.25rem;
  max-width: 40rem;
}

.brand-label {
  margin: 0 0 1.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--ink);
}

.subline {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.45;
  max-width: 28rem;
}

/* ——— Layout ——— */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-bottom: 2.5rem;
}

.output {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.bubble-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  min-height: 8rem;
  animation: fade-in 0.35s var(--ease);
}

.bubble-card.flash {
  animation: fade-in 0.32s var(--ease);
}

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

#bubbleText {
  margin: 0;
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  font-weight: 400;
  line-height: 1.65;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ——— Controls ——— */
.controls {
  background: transparent;
  border: none;
  padding: 0;
}

.controls-title {
  margin: 0 0 1.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.field > span {
  font-weight: 500;
  color: var(--ink);
  font-size: 0.8125rem;
}

.optional {
  font-style: normal;
  font-weight: 400;
  color: var(--muted-2);
}

select,
input[type="text"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  min-height: var(--touch);
  padding: 0.65rem 0.9rem;
  font: inherit;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

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

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  min-height: var(--touch);
  margin-bottom: 0.75rem;
}

.toggle input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  min-height: var(--touch);
  padding: 0.7rem 1rem;
  font: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: #f5f5f5;
  border-color: var(--line-strong);
}

.btn:active {
  opacity: 0.85;
}

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

.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}

.btn.primary:hover {
  background: #262626;
  border-color: #262626;
}

.btn.ghost {
  background: transparent;
}

/* ——— Share ——— */
.share-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.share-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.share-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.share-pill:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
}

.share-pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.share-hint {
  margin: 0.55rem 0 0;
  font-size: 0.7rem;
  color: var(--muted-2);
}

.copy-feedback {
  margin: 0.75rem 0 0;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  animation: fade-in 0.25s var(--ease);
}

.site-footer {
  padding: 0 0 calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--muted-2);
  font-size: 0.7rem;
  line-height: 1.4;
}

.site-footer p {
  margin: 0;
  max-width: 36rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sticky CTA */
.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0.75rem var(--pad-x) calc(0.75rem + env(safe-area-inset-bottom)) var(--pad-x-r);
  background: linear-gradient(180deg, transparent, rgba(250, 250, 250, 0.92) 35%);
  pointer-events: none;
}

.sticky-cta .sticky-generate {
  pointer-events: auto;
  width: 100%;
}

@media (min-width: 861px) {
  .sticky-cta {
    display: none;
  }

  .page {
    padding: 3rem 1.5rem 0;
  }

  .hero {
    padding: 1rem 0 2.75rem;
  }

  .layout {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3rem;
    align-items: start;
    padding-bottom: 3.5rem;
  }

  .bubble-card {
    padding: 1.75rem 1.6rem;
    min-height: 12rem;
  }

  #bubbleText {
    font-size: 1.125rem;
    line-height: 1.7;
  }

  .actions {
    grid-template-columns: 1.4fr 1fr;
  }

  .site-footer {
    padding-bottom: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble-card,
  .bubble-card.flash,
  .copy-feedback {
    animation: none;
  }

  .btn,
  .share-pill {
    transition: none;
  }
}
