body.theme-green {
  --primary-color: #92A8D1; /* Changed to Serenity Blue */
  --bg-color: #f5f7fa;
  --card-bg: rgba(255, 255, 255, 0.2);
  --wave-color-1: #92A8D1; /* Serenity Blue */
  --wave-color-2: #B19CD9; /* Soft Lavender */
  --wave-color-3: #D1D9E6; /* Light Blue-Grey instead of Sage Green */
  --wave-bg-start: #f8f9fb;
  --wave-bg-end: #e9eef5;
  --user-msg-bg: #6385B5; /* Darker point color */
  --user-msg-shadow: rgba(0, 0, 0, 0.1);
  --send-btn-gradient: linear-gradient(135deg, #92A8D1 0%, #6385B5 100%);
  --send-btn-shadow: rgba(146, 168, 209, 0.3);
  --send-btn-hover-shadow: rgba(146, 168, 209, 0.4);
}

:root {
  --serenity-blue: #92A8D1;
  --primary-color: #4A90E2;
  --bg-color: #F7F9FC;
  --card-bg: #F4F7F9;
  --text-dark: #333333;
  --text-light: #777777;
  --wave-color-1: rgba(74, 144, 226, 0.05);
  --wave-color-2: rgba(74, 144, 226, 0.03);
  --wave-color-3: rgba(142, 197, 252, 0.04);
  --wave-bg-start: #f0f4f8;
  --wave-bg-end: #d9e2ec;
  --user-msg-bg: #4A90E2; /* Darker point color */
  --user-msg-shadow: rgba(74, 144, 226, 0.3);
  --send-btn-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --send-btn-shadow: rgba(118, 75, 162, 0.3);
  --send-btn-hover-shadow: rgba(118, 75, 162, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Pretendard", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-dark);
  overscroll-behavior-y: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  max-width: 480px;
  margin: 0 auto;
  background: white;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 60px 24px 80px 24px; /* generous airy breathing space at top */
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

.home-header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
}

h1 {
  font-size: 26px;
  font-weight: 400;
  margin-bottom: 30px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--text-dark);
}

/* Cards Section Styles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  margin-bottom: 0;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.see-all {
  font-size: 13px;
  color: #E0E0E0;
  text-decoration: none;
  font-weight: 500;
}

.cards-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px;
  margin-bottom: 8px;
}

.card {
  width: 100%;
  height: auto;
  min-height: 64px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 16px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateX(4px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.06);
}

.card-image {
  display: none;
}

.card-content {
  padding: 0;
  background: transparent;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
  color: #2C3E50;
}

.card-content p {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.8;
  color: #7F8C8D;
}

/* Home Input Section */
.home-input-section {
  margin-bottom: 32px;
  z-index: 2;
  position: relative;
}

.home-input-section .chat-input-area {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.05);
  padding: 8px;
}

.title-group h2 {
  margin-bottom: 2px;
}

.sub-text {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

.update-notice {
  color: #D1D9E6; /* Light Blue-Grey for harmony with background waves */
}

/* Chat UI Improvements */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-container-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 0; /* Full screen look */
  border: none;
  overflow: hidden;
  margin-bottom: 0;
  box-shadow: none;
  padding: 0;
}

#tab-chat.tab-content {
  padding: 0;
  background: transparent;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-header {
  display: flex;
  justify-content: flex-end;
  padding: 20px 20px 10px 20px;
  flex-shrink: 0;
}

.close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
  overflow: hidden;
}

.chat-input-area-wrapper {
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

/* Wave Animation as Background (Mesh Gradient) */
.wave-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--wave-bg-start);
  overflow: hidden;
  z-index: 0; 
  pointer-events: none;
}

.wave {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  filter: blur(80px);
  opacity: 0.6;
  z-index: 0;
}

.wave:nth-child(1) {
  background: var(--wave-color-1);
  width: 150%;
  height: 150%;
  top: -25%;
  left: -25%;
  border-radius: 40%;
  animation: meshAnim 20s infinite alternate;
}

.wave:nth-child(2) {
  background: var(--wave-color-2);
  width: 140%;
  height: 140%;
  bottom: -20%;
  right: -20%;
  border-radius: 35%;
  animation: meshAnim 25s infinite alternate-reverse;
}

.wave:nth-child(3) {
  background: var(--wave-color-3);
  width: 130%;
  height: 130%;
  top: 20%;
  left: 20%;
  border-radius: 45%;
  animation: meshAnim 30s infinite alternate;
}

@keyframes meshAnim {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(10%, 10%) rotate(180deg) scale(1.1); }
  100% { transform: translate(-5%, 5%) rotate(360deg) scale(1); }
}

/* Transitions */
#tab-chat {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  transform: translateY(100%);
  display: flex !important; /* Always flex but hidden by transform */
  pointer-events: none;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#tab-chat.active {
  transform: translateY(0);
  pointer-events: auto;
  opacity: 1;
}

.loading-dot {
  width: 8px;
  height: 8px;
  background-color: #8E8E93;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

.loading-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.7);
  align-self: flex-start;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  border: 1px solid rgba(255,255,255,0.8);
  width: fit-content;
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Full Chat Mode - Legacy, kept for compatibility if needed or removed */
body.full-chat .home-header,
body.full-chat .cards-section,
body.full-chat .bottom-nav {
  display: none !important;
}

body.full-chat .tab-content {
  padding-top: 20px;
}

body.full-chat #home-back-btn {
  display: flex !important;
}

#home-back-btn {
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(255, 255, 255, 0.8);
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  color: var(--serenity-blue);
  transition: all 0.2s ease;
}

#home-back-btn:hover {
  background: white;
  transform: scale(1.05);
}

body:not(.initial-state) .chat-input-area {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window {
  flex: 1;
  padding: 4px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.chat-support-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 8px;
  position: relative;
  z-index: 2;
}

.support-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 24px rgba(51, 78, 104, 0.08);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.support-card-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.support-card-copy strong {
  font-size: 15px;
  line-height: 1.5;
  color: #334e68;
}

.support-card-copy p {
  font-size: 13px;
  line-height: 1.6;
  color: #5b7186;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--serenity-blue);
  color: #ffffff;
  text-decoration: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(146, 168, 209, 0.28);
}

.support-btn:hover {
  transform: translateY(-1px);
}

.message {
  max-width: 85%;
  padding: 20px 24px;
  border-radius: 20px; /* soften borders */
  font-size: 19px;
  line-height: 1.7; /* increase line heights */
  backdrop-filter: blur(4px);
}

.message.ai {
  background: rgba(255, 255, 255, 0.7);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
  border: 1px solid rgba(255,255,255,0.8);
  color: #334e68;
}

.message.user {
  background: var(--user-msg-bg);
  color: #FFFFFF; /* High contrast white text */
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 5px var(--user-msg-shadow);
  border: 1px solid rgba(255,255,255,0.2);
}

.chat-input-area {
  display: flex;
  gap: 10px;
  background: rgba(255, 255, 255, 0.6);
  padding: 8px;
  border-radius: 28px;
  border: 1px solid rgba(225, 232, 237, 0.5);
  box-sizing: border-box;
  width: 100%;
  margin: 10px 0 20px 0;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
  padding: 12px 18px;
  border: none;
  border-radius: 16px; /* 16px as per guide v2.1 */
  outline: none;
  font-size: 14px;
  resize: none;
  background: transparent;
  line-height: 1.5;
}

.chat-input-area button {
  flex-shrink: 0;
  background: var(--serenity-blue);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(146, 168, 209, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-input-area button:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 6px 15px var(--send-btn-hover-shadow);
}

.chat-input-area button svg {
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.5));
}


/* Check-in Tab */
.mood-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.mood-btn {
  flex: 1 1 calc(33% - 10px);
  padding: 12px;
  background: white;
  border: 1px solid #eee;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.mood-btn.selected {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.journal-section textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #ddd;
  resize: none;
  font-size: 14px;
  margin-bottom: 12px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Bottom Nav */
.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-light);
  cursor: pointer;
  font-size: 12px;
  gap: 4px;
}

.nav-btn .icon {
  font-size: 20px;
}

.nav-btn.active {
  color: var(--primary-color);
}


.cards-section {
  margin-top: 20px;
}

.tab-content, .bottom-nav { z-index: 2; position: relative; }
