/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --border: #e0d9d0;
  --text: #2c2825;
  --text-muted: #8a8078;
  --accent: #7c5c3e;
  --accent-light: #f0e8df;
  --danger: #9b3a2a;
  --danger-light: #fdf0ee;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px 80px;
}

#app {
  width: 100%;
  max-width: 560px;
}

/* ===== Header ===== */
header {
  text-align: center;
  margin-bottom: 36px;
}

header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.5px;
}

.subtitle {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Progress Bar ===== */
#progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.35s ease;
  width: 25%;
}

#progress-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ===== Step Cards ===== */
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  animation: stepIn 0.2s ease;
}

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

.question {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.4;
}

/* ===== Text Inputs ===== */
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 16px;
}

input[type="text"]:focus {
  border-color: var(--accent);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

/* ===== Buttons ===== */
.next-btn,
#generate-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.next-btn:hover,
#generate-btn:hover {
  background: #6a4e33;
}

.next-btn:disabled,
#generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#generate-btn {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 1.05rem;
}

/* ===== Option Grid ===== */
.option-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.option-btn {
  text-align: left;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

.option-btn.danger {
  border-color: #e8c8c3;
  color: var(--danger);
}

.option-btn.danger:hover,
.option-btn.danger.selected {
  border-color: var(--danger);
  background: var(--danger-light);
}

/* ===== Skip Button ===== */
.skip-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.skip-btn:hover {
  color: var(--text);
}

/* ===== Card Output ===== */
#card-output {
  animation: stepIn 0.3s ease;
}

#card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 32px rgba(0, 0, 0, 0.1);
  padding: 48px 40px;
  text-align: center;
  position: relative;
}

#card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #c8a882, #e8c8a0, #c8a882);
  border-radius: var(--radius) var(--radius) 0 0;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.card-label {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: var(--text-muted);
  margin-bottom: 28px;
}

#card-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-line;
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.card-actions button {
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

#print-btn {
  background: var(--accent);
  color: #fff;
  border: none;
}

#print-btn:hover {
  background: #6a4e33;
}

#email-btn {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

#email-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

#mail-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  cursor: not-allowed;
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 5px;
}

.card-actions-secondary {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

#restart-btn {
  background: none;
  color: var(--text-muted);
  border: none;
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 12px;
}

#restart-btn:hover {
  color: var(--text);
}

/* ===== Error ===== */
#error-msg {
  background: var(--surface);
  border: 1px solid #e8c8c3;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--danger);
}

#error-msg p {
  margin-bottom: 16px;
}

#retry-btn {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}

/* ===== Utilities ===== */
.hidden {
  display: none !important;
}

/* ===== Print ===== */
@media print {
  body {
    background: white;
    padding: 0;
    align-items: center;
    justify-content: center;
  }

  #app > * {
    display: none;
  }

  #card-output {
    display: block !important;
  }

  .card-actions {
    display: none;
  }

  #card {
    box-shadow: none;
    border: 1px solid #ccc;
    max-width: 480px;
    margin: 40px auto;
  }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  header h1 {
    font-size: 1.6rem;
  }

  .step {
    padding: 24px 20px;
  }

  #card {
    padding: 36px 24px;
  }
}
