:root {
  color-scheme: light;
  --bg: #f9f4ef;
  --bg-accent: #f2ede6;
  --ink: #1d1b1a;
  --muted: #5b5754;
  --edge: #ded6cc;
  --primary: #0f4c5c;
  --primary-dark: #0b3b48;
  --accent: #e09f3e;
  --card: #ffffff;
  --shadow: 0 20px 50px rgba(15, 20, 30, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  background: radial-gradient(circle at top left, #f9f4ef 20%, #f2f8f7 60%, #fef8ef 100%);
  color: var(--ink);
  min-height: 100vh;
  padding: 40px clamp(20px, 5vw, 64px) 32px;
  position: relative;
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 20%, rgba(224, 159, 62, 0.15), transparent 55%),
    radial-gradient(circle at 80% 10%, rgba(15, 76, 92, 0.12), transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(202, 230, 210, 0.35), transparent 55%);
  z-index: -1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 20px;
  font-weight: 600;
}

.brand-sub {
  color: var(--muted);
  font-size: 14px;
  font-family: "Newsreader", serif;
}

.badge {
  border: 1px solid var(--edge);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-accent);
}

.layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  align-items: start;
}

.panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(222, 214, 204, 0.7);
}

.input-panel h1 {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
  margin-bottom: 12px;
}

.lead {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 24px;
  font-family: "Newsreader", serif;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

label {
  font-size: 14px;
  font-weight: 600;
}

.field-help {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

textarea,
input[type="text"] {
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 76, 92, 0.15);
}

.preset-group {
  margin-bottom: 24px;
}

.preset-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.preset-group .field-help {
  margin-top: 6px;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.chip.active {
  background: rgba(15, 76, 92, 0.1);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.primary,
.secondary {
  border: none;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary {
  background: linear-gradient(180deg, #0f5f72 0%, #0f4c5c 55%, #0b3b48 100%);
  color: #fff;
  padding: 16px 22px;
  font-size: 16px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid rgba(8, 40, 49, 0.6);
  box-shadow:
    0 14px 24px rgba(10, 44, 55, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.primary:hover {
  background: linear-gradient(180deg, #11687d 0%, #0f4f60 55%, #0a3641 100%);
  transform: translateY(-1px);
  box-shadow:
    0 18px 28px rgba(10, 44, 55, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.primary[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary:active {
  transform: translateY(1px);
  box-shadow:
    0 10px 18px rgba(10, 44, 55, 0.24),
    inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.secondary {
  background: #fff;
  color: var(--primary);
  border: 1px solid rgba(15, 76, 92, 0.3);
  padding: 8px 14px;
  font-size: 13px;
}

.secondary:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 16px rgba(15, 76, 92, 0.12);
}

.hint {
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  margin-top: -2px;
}

.error {
  margin-top: 14px;
  color: #8a2d2d;
  background: #fbeaea;
  border: 1px solid #f3c4c4;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: none;
}

.error.visible {
  display: block;
}

.output-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.output-header h2 {
  font-size: 24px;
  margin-bottom: 6px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  font-family: "Newsreader", serif;
}

.reply-grid {
  display: grid;
  gap: 16px;
}

.reply-card {
  border-radius: var(--radius-md);
  border: 1px solid var(--edge);
  padding: 18px 18px 16px;
  background: #fffaf4;
  display: grid;
  gap: 12px;
  min-height: 160px;
}

.reply-title {
  font-weight: 600;
  font-size: 15px;
}

.reply-text {
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-line;
  min-height: 72px;
}

.cta {
  border-radius: var(--radius-md);
  border: 1px dashed rgba(15, 76, 92, 0.4);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--primary-dark);
  background: rgba(15, 76, 92, 0.08);
  opacity: 1;
  transform: translateY(0);
  transition: all 0.3s ease;
}

.cta span {
  font-weight: 600;
}

.site-footer {
  margin-top: 32px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.site-footer p + p {
  margin-top: 6px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
  animation: spin 0.9s linear infinite;
}

.loading .spinner {
  display: inline-block;
}

.loading .btn-text {
  opacity: 0.7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  body {
    padding: 28px 20px 24px;
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
}
