:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --bg-strong: #eef1ec;
  --card: #ffffff;
  --text: #101826;
  --muted: #5b6470;
  --border: #e2e6df;
  --accent: #0f766e;
  --accent-strong: #0c5c56;
  --shadow: 0 18px 40px rgba(16, 24, 38, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(15, 118, 110, 0.08), transparent 55%),
    radial-gradient(circle at 90% 0%, rgba(16, 24, 38, 0.06), transparent 45%),
    linear-gradient(180deg, #fafbf9 0%, var(--bg) 100%);
  min-height: 100vh;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 22px 84px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: rise 520ms ease-out;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-top {
  display: flex;
  justify-content: flex-end;
}

.goal-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.goal-text {
  margin: 0;
  font-family: "Source Serif 4", "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.2;
}

.ai-profile {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.level-chip {
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-strong);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.prompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 16px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(16, 24, 38, 0.05);
  resize: vertical;
  min-height: 140px;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.6);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.12);
}

.actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.small {
  padding: 8px 14px;
  font-size: 13px;
}

button#submitButton {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}

button#submitButton:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none;
}

.status {
  font-size: 14px;
  color: var(--muted);
}

.reply {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: rise 420ms ease-out;
}

.reply-bubble {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 16px;
  line-height: 1.6;
  box-shadow: 0 12px 26px rgba(16, 24, 38, 0.06);
  white-space: pre-wrap;
}

.reply-meta {
  font-size: 13px;
  color: var(--muted);
}

.end-notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-strong);
  font-size: 14px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.modal-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: pop 320ms ease-out;
}

.modal-card textarea {
  min-height: 120px;
  box-shadow: none;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.hidden {
  display: none;
}

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

.modal-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: var(--muted);
}

.secondary {
  background: var(--bg-strong);
  color: var(--text);
  border: 1px solid var(--border);
}

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 640px) {
  .page {
    padding: 40px 16px 64px;
    gap: 26px;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  button {
    width: 100%;
  }
}
