:root {
  --bg: #FAF6F2;
  --surface: #FFFFFF;
  --surface-alt: #F2E9E3;
  --text: #2B211C;
  --text-muted: #7A6B60;
  --accent: #A8574B;
  --accent-deep: #8A4339;
  --accent-soft: #F0DAD3;
  --sage: #7C8B6F;
  --border: #E6DAD0;
  --error: #B3423A;
  --font-display: 'Noto Naskh Arabic', serif;
  --font-body: 'Vazirmatn', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  height: 100%;
}

body {
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.app-shell {
  width: 100%;
  max-width: 560px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

.progress-track {
  height: 3px;
  background: var(--border);
  display: flex;
  gap: 4px;
}
.progress-track .seg {
  flex: 1;
  background: var(--border);
  transition: background 0.4s ease;
}
.progress-track .seg.active { background: var(--accent); }

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 24px 28px;
}
.screen.hidden { display: none; }

.step-eyebrow {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0 0 6px;
}

.headline {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 10px;
  color: var(--text);
}
.headline-sm {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 6px;
}

.subtext {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 20px;
  max-width: 46ch;
}
.subtext-sm {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 18px;
}

.form-error {
  font-size: 13.5px;
  color: var(--error);
  background: #FBEAE8;
  border: 1px solid #EFC5C0;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 0 0 18px;
}

.field-group { margin-bottom: 26px; }

.field-label {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
}
.field-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.type-choice-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.type-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  gap: 5px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.type-card:hover { border-color: var(--accent); }
.type-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.type-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.type-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}
.baumann-intro {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: -8px 0 18px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.chip,
.type-card {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-align: inherit;
  margin: 0;
}

.chip {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--accent); }
.chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.privacy-note {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 18px;
  line-height: 1.6;
}

/* صفحه گفتگو */
#screenChat { padding-bottom: 0; }

.chat-header { margin-bottom: 8px; }

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 2px 16px;
}

.bubble {
  max-width: 82%;
  padding: 12px 15px;
  font-size: 14.5px;
  line-height: 1.65;
  border-radius: 14px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-right-radius: 4px;
}
.bubble.user {
  align-self: flex-end;
  background: var(--accent-soft);
  color: var(--text);
  border-top-left-radius: 4px;
}
.bubble.error {
  align-self: center;
  background: #FBEAE8;
  border: 1px solid #EFC5C0;
  color: var(--error);
  font-size: 13.5px;
}

.typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  border-top-right-radius: 4px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 0 22px;
  background: var(--bg);
  position: sticky;
  bottom: 0;
}
.chat-input-row input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.chat-input-row input:focus { border-color: var(--accent); }
.btn-send {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn-send:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }

/* صفحه پایان */
#screenDone {
  justify-content: center;
  text-align: center;
  align-items: center;
}
#screenDone .sage-mark {
  width: 40px;
  height: 2px;
  background: var(--sage);
  margin-bottom: 22px;
}

.settings-btn {
  position: fixed;
  left: 14px;
  bottom: 14px;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 15px;
  text-decoration: none;
  opacity: 0.6;
}
.settings-btn:hover { opacity: 1; }

@media (max-width: 380px) {
  .headline { font-size: 24px; }
  .screen { padding: 24px 18px 20px; }
  .type-choice-row { flex-direction: column; }
}
