* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #e0f2fe 0%, #ecfdf5 60%, #ffffff 100%);
  color: #0f172a;
  min-height: 100vh;
}

/* HEADER */

.header {
  padding: 18px 16px 8px;
}

.header-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-end;
}

.header h1 {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(120deg, #22c55e, #38bdf8);
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0;
  color: #4b5563;
  max-width: 640px;
  font-size: 14px;
}

.header-link {
  font-size: 13px;
}

/* LAYOUT */

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .container {
    grid-template-columns: 2.1fr 1.3fr;
    align-items: flex-start;
  }

  .main-card {
    grid-column: 1 / 2;
  }

  .side-card {
    grid-column: 2 / 3;
  }
}

/* CARD */

.card {
  background: #ffffff;
  border-radius: 18px;
  padding: 18px 18px 20px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

h2 {
  margin: 4px 0 10px;
  font-size: 20px;
}

h3 {
  margin-top: 16px;
  margin-bottom: 8px;
  font-size: 16px;
  color: #0f172a;
}

.hint {
  font-size: 12px;
  color: #6b7280;
}

.link {
  color: #0ea5e9;
  text-decoration: none;
  font-weight: 500;
}
.link:hover {
  text-decoration: underline;
}

/* PROFILE */

.profile-form label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}

.profile-form input,
.profile-form select {
  margin-top: 4px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  background: #f9fafb;
  color: #0f172a;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

/* FORM GRID */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.form-grid select {
  border-radius: 10px;
  border: 1px solid #cbd5f5;
  padding: 8px 10px;
  background: #f9fafb;
  color: #0f172a;
}

.form-grid select:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.5);
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* BUTTONS */

.btn {
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  background: #ffffff;
  color: #0f172a;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.12s ease;
}

.btn.primary {
  background: linear-gradient(135deg, #22c55e, #38bdf8);
  border-color: transparent;
  color: #ffffff;
  font-weight: 600;
}

.btn.danger {
  border-color: #f97373;
  color: #b91c1c;
}

.btn.btn-secondary {
  background: #f9fafb;
  border: 1px solid #cbd5f5;
  color: #0f172a;
}

.btn:hover {
  opacity: 0.96;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

/* RESULT */

.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.wellness-avatar {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: radial-gradient(circle at 30% 20%, #bbf7d0, #22c55e);
  color: #064e3b;
}

.avatar-text {
  font-size: 14px;
  color: #1f2933;
}

.score-visual {
  margin-top: 12px;
}

.score-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
  border: 1px solid #cbd5f5;
}

.score-bar-inner {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97373, #facc15, #22c55e);
  transition: width 0.6s ease;
}

.score-bar-label {
  margin-top: 6px;
  font-size: 13px;
  color: #374151;
}

.result-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 10px 0 10px;
  font-weight: 600;
  font-size: 14px;
}

.status-green {
  background: #dcfce7;
  border: 1px solid #22c55e;
  color: #166534;
}

.status-yellow {
  background: #fef9c3;
  border: 1px solid #eab308;
  color: #854d0e;
}

.status-red {
  background: #fee2e2;
  border: 1px solid #ef4444;
  color: #b91c1c;
}

.result-message {
  font-size: 14px;
  line-height: 1.5;
}

/* MIND MAP */

.mindmap {
  margin-top: 6px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.8);
  padding: 10px 12px;
  background: linear-gradient(135deg, #ecfdf3, #eff6ff);
  font-size: 13px;
}

.mindmap-section + .mindmap-section {
  margin-top: 6px;
}

.mindmap-title {
  font-weight: 600;
  margin-bottom: 3px;
  color: #0f172a;
}

.mindmap-branch {
  margin: 0;
  padding-left: 16px;
}

.suggestions {
  padding-left: 18px;
  font-size: 14px;
  margin-top: 6px;
}

.disclaimer {
  margin-top: 12px;
  font-size: 11px;
  color: #6b7280;
}

/* HISTORY */

.history-list {
  list-style: none;
  padding-left: 0;
  margin: 6px 0 10px;
  font-size: 13px;
}

.history-list li {
  padding: 6px 8px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.history-score {
  font-weight: 600;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 8px auto 10px;
}

#weeklyChart {
  width: 100%;
  max-height: 260px;
}

/* FAB BUTTONS + SIDE PANELS */

.fab {
  position: fixed;
  right: 18px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
  background: radial-gradient(circle at 30% 20%, #22c55e, #16a34a);
  color: #ffffff;
  z-index: 30;
}

.breathing-fab {
  bottom: 150px;
}

.coach-fab {
  bottom: 90px;
  background: radial-gradient(circle at 30% 20%, #38bdf8, #0284c7);
}

.tips-fab {
  bottom: 30px;
  background: radial-gradient(circle at 30% 20%, #facc15, #f97316);
}

.side-panel {
  position: fixed;
  right: 16px;
  bottom: 150px;
  width: min(320px, 94vw);
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
  padding: 12px 14px 14px;
  z-index: 40;
}

.coach-panel {
  bottom: 90px;
}

.tips-panel {
  bottom: 30px;
}

.side-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.icon-btn {
  border: none;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  font-size: 16px;
}

/* BREATHING */

.breathing-wrapper {
  text-align: center;
  margin-top: 8px;
}

.breathing-circle {
  width: 90px;
  height: 90px;
  border-radius: 999px;
  border: 2px solid #22c55e;
  margin: 12px auto 6px;
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.6);
  opacity: 0.95;
}

.breathing-text {
  font-size: 13px;
  color: #1f2933;
}

.breathing-counter {
  font-size: 22px;
  font-weight: 600;
  color: #22c55e;
  margin-top: 2px;
}

/* 4–4–4 cycle animation */
.breathing-circle.breathing-active {
  animation: breathe444 12s ease-in-out infinite;
}

@keyframes breathe444 {
  0% {
    transform: scale(1);
    opacity: 0.95;
  }
  33% {
    transform: scale(1.35);
    opacity: 1;
  }
  66% {
    transform: scale(1.35);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.95;
  }
}

/* COACH */

.coach-messages {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 4px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 13px;
}

.msg {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 10px;
}

.msg-user {
  background: #dcfce7;
  align-self: flex-end;
}

.msg-bot {
  background: #e0f2fe;
}

.coach-form {
  display: flex;
  gap: 6px;
}

.coach-form input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #cbd5f5;
  padding: 7px 10px;
  background: #f9fafb;
  color: #0f172a;
}

/* FOOTER */

.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #6b7280;
}

