:root {
  color-scheme: light dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  --bg: #f7f8fb;
  --text: #1d1f2f;
  --text-muted: #5b6278;
  --accent: #4b67f2;
  --border: rgba(13, 18, 35, 0.12);
  --card: #ffffff;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 248, 251, 0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.site-nav a {
  margin-left: 1rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--text-muted);
}

.hero {
  padding: 6rem 1.5rem 4rem;
  display: flex;
  justify-content: center;
}

.hero__content {
  max-width: 640px;
  text-align: center;
}

.hero__content h1 {
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  margin-bottom: 1rem;
}

.hero__content p {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.hero__cta {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 15px 30px rgba(75, 103, 242, 0.35);
}

.generator {
  padding: 2rem 1.5rem 4rem;
}

.generator--standalone {
  padding-top: 6rem;
}

.generator__inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: start;
}

.generator__form {
  background: var(--card);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.generator__form h1,
.generator__form h2 {
  margin: 0;
  font-size: 1.5rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

legend {
  font-weight: 600;
  padding: 0 0.35rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
}

label input,
label select,
label textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  resize: vertical;
}

label textarea {
  min-height: 90px;
}

.help-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bubble-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.bubble-options label {
  flex: 1 1 120px;
  align-items: center;
  grid-template-columns: auto 1fr;
  column-gap: 0.5rem;
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.switch input {
  width: 1.1rem;
  height: 1.1rem;
}

.button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(75, 103, 242, 0.25);
}

.button:disabled {
  opacity: 0.5;
  cursor: progress;
}

.button--secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid rgba(75, 103, 242, 0.35);
}

.button--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.generator__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.export-feedback {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.export-feedback[data-tone="error"] {
  color: #e5484d;
}

.export-feedback[data-tone="warn"] {
  color: #d97706;
}

.generator__preview {
  position: sticky;
  top: 6.5rem;
}

.phone {
  width: min(340px, 100%);
  margin: 0 auto;
  border-radius: 36px;
  padding: 1.5rem 1rem 1.2rem;
  background: linear-gradient(160deg, #f1f4ff, #ffffff 40%, #e6eafc);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 640px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.phone[data-theme="dark"] {
  background: linear-gradient(160deg, #141927, #070b16 60%, #1c2238);
  color: #f3f4f9;
}

.phone[data-device="android"] .phone__status {
  justify-content: flex-end;
  font-weight: 500;
}

.phone__status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: inherit;
}

.phone__header {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.phone__contact {
  font-weight: 600;
  margin: 0;
  font-size: 1.05rem;
}

.phone__meta {
  margin: 0;
  font-size: 0.8rem;
  color: inherit;
  opacity: 0.75;
}

.phone__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  scrollbar-width: none;
}

.phone__messages::-webkit-scrollbar {
  display: none;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  position: relative;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
  align-self: flex-start;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  white-space: pre-wrap;
}

.chat-bubble--outgoing {
  align-self: flex-end;
  background: rgba(75, 103, 242, 0.92);
  color: #fff;
}

.chat-bubble__timestamp {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

.phone[data-theme="dark"] .chat-bubble {
  background: rgba(241, 245, 255, 0.08);
  color: #f8fafc;
}

.phone[data-theme="dark"] .chat-bubble--outgoing {
  background: rgba(87, 122, 255, 0.65);
}

.phone__typing {
  display: flex;
  gap: 0.35rem;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.55rem 0.85rem;
  border-radius: 1rem;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.1);
}

.phone[data-theme="dark"] .phone__typing {
  background: rgba(241, 245, 255, 0.1);
}

.phone__typing span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(75, 103, 242, 0.7);
  animation: typing 1s infinite ease-in-out;
}

.phone__typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.phone__typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.phone__read {
  align-self: flex-end;
  font-size: 0.78rem;
  opacity: 0.65;
}

.bubble-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1rem;
}

.bubble-list__item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: grid;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.6);
}

.bubble-list__item--empty {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: transparent;
  border-style: dashed;
}

.bubble-list__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.bubble-list__controls {
  display: flex;
  gap: 0.5rem;
}

.bubble-list__controls button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 0.6rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.bubble-list__controls button:hover {
  background: rgba(75, 103, 242, 0.12);
}

.bubble-list textarea,
.bubble-list input {
  width: 100%;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.site-footer {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .site-header {
    position: static;
  }
  .generator__preview {
    position: static;
  }
  .phone {
    min-height: 540px;
  }
}