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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ========== LAYOUT ========== */
.screen {
  max-width: 420px;
  width: 100%;
  margin: auto;
  padding: 24px 16px;
}

.hidden {
  display: none !important;
}

/* ========== LOADING SPINNER ========== */
#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== ERROR SCREEN ========== */
#error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  gap: 12px;
}

#error .error-icon {
  font-size: 48px;
}

#error h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

#error p {
  font-size: 14px;
  color: #64748b;
  max-width: 300px;
  line-height: 1.5;
}

/* ========== HEADER ========== */
header {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff;
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.30);
  margin-bottom: 20px;
}

header .greeting {
  font-size: 16px;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 4px;
}

header .days-label {
  font-size: 15px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 2px;
}

.big-number {
  font-size: 80px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  display: block;
  margin: 8px 0 4px;
}

/* ========== STATS ========== */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: #ffffff;
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.stat-icon {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
}

.stat-number {
  font-size: 26px;
  font-weight: 800;
  color: #22c55e;
  display: block;
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  display: block;
}

/* ========== NEXT CONTACT ========== */
.next-contact {
  background: #eff6ff;
  color: #3b82f6;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* ========== MOOD CARD ========== */
.mood-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  margin-bottom: 16px;
}

.mood-card h2 {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}

.mood-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.mood-btn {
  border: 2px solid #e2e8f0;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.15s;
  gap: 6px;
}

.mood-btn span.mood-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.mood-btn:hover {
  border-color: #86efac;
  background: #f0fdf4;
  transform: translateY(-1px);
}

.mood-btn.selected {
  border-color: #22c55e;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.20);
}

.mood-btn.selected span.mood-label {
  color: #16a34a;
}

/* ========== TEXTAREA ========== */
textarea {
  width: 100%;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  font-family: inherit;
  font-size: 16px;
  color: #1e293b;
  background: #f8fafc;
  resize: none;
  margin-bottom: 14px;
  transition: border-color 0.15s;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: #22c55e;
  background: #ffffff;
}

textarea::placeholder {
  color: #94a3b8;
}

/* ========== SUBMIT BUTTON ========== */
.submit-btn {
  width: 100%;
  background: #22c55e;
  color: #ffffff;
  border: none;
  border-radius: 16px;
  padding: 17px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.submit-btn:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ========== SUCCESS CARD ========== */
.success-card {
  background: #f0fdf4;
  border: 2px solid #22c55e;
  border-radius: 20px;
  padding: 28px;
  text-align: center;
  margin-bottom: 16px;
}

.success-card .success-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

.success-card h3 {
  font-size: 20px;
  font-weight: 800;
  color: #15803d;
  margin-bottom: 8px;
}

.success-card p {
  font-size: 14px;
  color: #16a34a;
  line-height: 1.5;
}

/* ========== FOOTER ========== */
.footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.6;
}

/* ========== RESPONSIVE TWEAKS ========== */
@media (max-width: 360px) {
  .big-number {
    font-size: 64px;
  }

  .mood-btn {
    font-size: 24px;
    padding: 12px 6px 10px;
  }
}

/* Remove tap highlight on mobile */
button, .mood-btn {
  -webkit-tap-highlight-color: transparent;
}

/* Inline submit error */
.submit-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
}
