body {
  font-family: 'Caveat', cursive;
  font-size: 24px;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  color: #111827;

  /* Soft baby-blue gradient background, fixed and subtle */
  background: linear-gradient(180deg, #e6f2ff 0%, #d4ecff 55%, #f8fbff 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  transition: background 400ms ease-in-out;
}

/* Atmosphere Layer - Rain Effect */
#atmosphereLayer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 998;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

#atmosphereLayer.rain-active {
  opacity: 1;
}

.rain-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.rain-drop {
  position: absolute;
  bottom: 100%;
  width: 15px;
  height: 120px;
  pointer-events: none;
  animation: rainFall 0.8s linear infinite;
  opacity: 0.7;
}

@keyframes rainFall {
  0% {
    transform: translateY(0vh);
  }
  100% {
    transform: translateY(100vh);
  }
}

.rain-stem {
  width: 1px;
  height: 60%;
  margin-left: 7px;
  background: linear-gradient(to bottom, rgba(167, 199, 231, 0.2), rgba(167, 199, 231, 0.6));
}

.rain-splat {
  width: 15px;
  height: 10px;
  display: none;
}

.app {
  max-width: 1120px;
  width: 100%;
  padding: 40px 32px 32px;
  box-sizing: border-box;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(10,20,30,0.08);
}

.app-header {
  text-align: center;
  margin-bottom: 32px;
}

.app-title {
  margin: 0;
  font-size: clamp(40px, 6vw, 56px);
  margin: 0;
  letter-spacing: 0.06em;
  color: #0f1724;
  text-align: center;
  text-shadow:
    0 6px 18px rgba(15,23,42,0.08),
    0 0 12px rgba(220,230,255,0.45);
  line-height: 1.05;
}

.app-subtitle {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 20px;
  color: #6b7280;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tabs {
  display: inline-flex;
  align-self: center;
  background: rgba(255,255,255,0.7);
  border-radius: 999px;
  padding: 4px;
  box-shadow:
    0 16px 30px rgba(15,23,42,0.16),
    0 0 0 1px rgba(148,163,184,0.3);
}

.tab {
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 18px;
  font-family: 'Caveat', cursive;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: #6b7280;
  transition:
    background-color 140ms ease-out,
    color 140ms ease-out,
    box-shadow 140ms ease-out,
    transform 120ms ease-out;
}

.tab.active {
  background: linear-gradient(90deg, #ec4899, #f97316, #eab308);
  color: #f9fafb;
  box-shadow: 0 10px 22px rgba(248,113,113,0.45);
  transform: translateY(-1px);
}

.app-view {
  display: none;
  margin-top: 20px;
  display: none;
}

.app-view.active {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.jar-panel {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.jar-shell {
  padding: 18px 18px 12px;
  border-radius: 40px;
  background: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.35));
  box-shadow:
    0 28px 60px rgba(15,23,42,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.8);
}

/* Pour area — positioned over the jar opening so drops fall into the glass */

#pourArea {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -12px; /* sit slightly above the jar rim */
  width: 100%;
  height: 40px;
  pointer-events: none;
  display: block;
  z-index: 5;
}

/* Jar */

#jar {
  width: 160px;
  height: 260px;
  border: 5px solid #cbd5e1;
  border-radius: 0 0 60px 60px;
  position: relative;
  overflow: hidden;
  cursor: pointer;

  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);

  box-shadow:
    inset 0 0 20px rgba(255,255,255,0.6),
    0 10px 30px rgba(0,0,0,0.1);
}

/* Canvas that holds the liquid animation */

#jarCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

#jar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;

  /* Soft water-like texture/highlights inside the glass */
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.45) 0, transparent 55%),
    radial-gradient(circle at 80% 25%, rgba(255,255,255,0.22) 0, transparent 55%),
    radial-gradient(circle at 15% 80%, rgba(255,255,255,0.16) 0, transparent 60%);

  mix-blend-mode: screen;
  opacity: 0.8;
}

/* We no longer use DOM layers; the liquid is drawn on canvas */

.jar-message {
  margin: 0;
  font-size: 18px;
  color: #9ca3af;
  text-align: center;
}

.jar-counter {
  width: 100%;
  max-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.jar-counter-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  box-shadow:
    inset 0 0 0 1px rgba(148,163,184,0.35),
    0 10px 20px rgba(15,23,42,0.12);
  overflow: hidden;
}

.jar-counter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ec4899, #eab308, #22c55e, #38bdf8);
  transition: width 300ms ease-out;
}

.jar-counter-text {
  font-size: 16px;
  color: #6b7280;
}

.secondary-btn {
  margin-top: 14px;
  border-radius: 999px;
  padding: 8px 16px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255,255,255,0.9);
  color: #4b5563;
  box-shadow:
    0 10px 20px rgba(15,23,42,0.18),
    0 0 0 1px rgba(148,163,184,0.25);
  transition:
    transform 120ms ease-out,
    box-shadow 120ms ease-out,
    background-color 120ms ease-out;
}

.secondary-btn:hover {
  transform: translateY(-1px);
  background: #f9fafb;
  box-shadow:
    0 16px 28px rgba(15,23,42,0.22),
    0 0 0 1px rgba(148,163,184,0.35);
}

/* Reset specific button to handwritten font */
#resetJarBtn {
  font-family: 'Caveat', cursive;
  font-size: 18px;
}

/* Right side controls + cards */

.controls-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: rgba(255,255,255,0.92);
  border-radius: 28px;
  padding: 20px 22px 22px;
  box-shadow:
    0 25px 60px rgba(15,23,42,0.18),
    0 0 0 1px rgba(148,163,184,0.18);
  backdrop-filter: blur(20px);
}

.card-label {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mood-btn {
  border: none;
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f3f4f6;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 12px rgba(15,23,42,0.05);
  transition:
    transform 120ms ease-out,
    box-shadow 120ms ease-out,
    background-color 120ms ease-out,
    border-color 120ms ease-out;
  border: 1px solid transparent;
}

.mood-btn .mood-emoji {
  font-size: 28px;
  text-shadow: 0 4px 10px rgba(15,23,42,0.06);
}

.mood-btn .mood-label {
  font-size: 24px;
  font-weight: 500;
  color: #374151;
  font-family: 'Caveat', cursive;
}

.mood-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(15,23,42,0.14);
}

.mood-btn.selected {
  border-color: rgba(59,130,246,0.9);
  box-shadow: 0 12px 24px rgba(59,130,246,0.18);
  background: rgba(239,246,255,0.95);
}

/* Soft mood-specific pastel backgrounds */

.mood-btn[data-mood="happy"] {
  /* Happy – Apricot
     Hex: #FFFAA0
     RGB: 255, 250, 160
     HSL: 57, 100, 81 */
  background: #FFFAA0;
}

.mood-btn[data-mood="neutral"] {
  /* Neutral – Nude */
  background: #f2d2bd;
}

.mood-btn[data-mood="energetic"] {
  /* Energetic – Nyanza */
  background: #ecffdc;
}

.mood-btn[data-mood="loved"] {
  /* Loved – Light Pink */
  background: #ffb6c1;
}

.mood-btn[data-mood="sad"] {
  /* Sad – Pastel Blue */
  background: #a7c7e7;
}

.mood-btn[data-mood="angry"] {
  /* Angry – Crimson */
  background: #dc143c;
}

.mood-btn[data-mood="anxious"] {
  /* Anxious – Wisteria
     Hex: #BDB5D5
     RGB: 189, 181, 213
     HSL: 255, 28, 77 */
  background: #BDB5D5;
}

.mood-btn[data-mood="surprised"] {
  /* Surprised – Coral
     Hex: #FF7F50
     RGB: 255, 127, 80
     HSL: 16, 100, 66 */
  background: #FF7F50;
}

.note-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 16px;
  border: 2px dashed #e5e7eb;
  background: #fffef8;
  box-sizing: border-box;
  color: #4b5563;
  margin-bottom: 14px;
}

.note-input::placeholder {
  color: #9ca3af;
}

.note-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.3);
}

.primary-btn {
  width: 100%;
  border-radius: 18px;
  padding: 12px 0;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: #f9fafb;
  cursor: pointer;
  background: linear-gradient(90deg, #ec4899, #f97316, #eab308);
  box-shadow:
    0 14px 30px rgba(248,113,113,0.4),
    0 0 0 1px rgba(248,250,252,0.6);
  transition:
    transform 120ms ease-out,
    box-shadow 120ms ease-out,
    filter 120ms ease-out;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow:
    0 18px 40px rgba(248,113,113,0.5),
    0 0 0 1px rgba(248,250,252,0.8);
}

.primary-btn:active {
  transform: translateY(0);
  box-shadow:
    0 10px 24px rgba(248,113,113,0.4),
    0 0 0 1px rgba(248,250,252,0.7);
}

/* Recent moods card */

.recent-card {
  padding-top: 18px;
}

.recent-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.recent-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(191,219,254,0.95);
  font-size: 15px;
}

.recent-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-empty {
  margin: 4px 0 0;
  font-size: 18px;
  color: #9ca3af;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(249,250,251,0.96);
}

.recent-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  flex-shrink: 0;
}

.recent-text-main {
  font-size: 16px;
  font-weight: 500;
  color: #111827;
}

.recent-text-sub {
  font-size: 14px;
  color: #9ca3af;
}

/* Archive view */

.archive-panel {
  flex: 1;
}

.archive-root-card {
  width: 100%;
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.archive-eyebrow {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
}

.archive-title {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.archive-empty {
  margin: 4px 0 0;
  font-size: 18px;
  color: #9ca3af;
}

.archive-item {
  border: none;
  padding: 12px 12px 10px;
  border-radius: 20px;
  background: rgba(249,250,251,0.98);
  box-shadow:
    0 16px 30px rgba(15,23,42,0.16),
    0 0 0 1px rgba(148,163,184,0.16);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.archive-mini-jar {
  align-self: stretch;
}

.archive-mini-glass {
  width: 100%;
  height: 90px;
  border-radius: 40px;
  border: 3px solid #d1d5db;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(248,250,252,0.7));
  display: flex;
  align-items: flex-end;
  justify-content: stretch;
}

.archive-mini-layers {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
}

.archive-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px;
  position: relative;
}

.archive-item {
  display: flex;
  gap: 12px;
  align-items: center;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}

.archive-meta-title {
  margin: 0;
  font-weight: 700;
}

.archive-meta-sub {
  margin: 2px 0 0 0;
  color: #6b7280;
  font-size: 13px;
}

.archive-edit {
  border: none;
  background: rgba(255,255,255,0.9);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(15,23,42,0.06);
}

.archive-edit:hover { transform: translateY(-1px); }

.archive-delete {
  border: none;
  background: rgba(255,255,255,0.95);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(15,23,42,0.06);
  margin-left: 6px;
}

.archive-delete:hover { transform: translateY(-1px); }

.archive-card.deleting {
  transition: transform 300ms ease, opacity 300ms ease;
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

.modal-primary-danger {
  background: linear-gradient(90deg, #f97316, #ef4444);
  color: #fff;
  box-shadow: 0 12px 28px rgba(239,68,68,0.18);
}

.archive-mini-layer {
  width: 100%;
  height: 12px;
}

.archive-meta-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.archive-meta-sub {
  font-size: 14px;
  color: #9ca3af;
  margin: 2px 0 0;
}

/* Mood wrap popup + modals */

/* Floating emoji */

.floating-emoji {
  position: absolute;
  font-size: 24px;
  animation: floatUp 2s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-120px) scale(1.8);
  }
}

/* Pour drop */

.liquid-drop {
  position: absolute;
  top: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  animation: pourDown 1s ease-in forwards;
  z-index: 10;
}

@keyframes pourDown {
  0% {
    transform: translate(-50%, 0);
  }
  80% {
    transform: translate(-50%, 220px);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 240px);
    opacity: 0;
  }
}

/* Wrap popup — hidden by default */

#wrapPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

  background: rgba(0,0,0,0.3);

  display: none;
  align-items: center;
  justify-content: center;

  z-index: 999;
}

#wrapPopup.active {
  display: flex;
}

.wrap-card {
  background: rgba(255,255,255,0.98);
  padding: 22px 22px 20px;
  border-radius: 28px;
  width: 320px;
  box-shadow:
    0 26px 60px rgba(15,23,42,0.35),
    0 0 0 1px rgba(148,163,184,0.3);
  backdrop-filter: blur(24px);
}

/* Wrap / Archive Tabs + Diary styles */
.wrap-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  justify-content: center;
}

.wrap-tab {
  border: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  cursor: pointer;
  font-weight: 600;
  color: #374151;
}

.wrap-tab.active {
  background: linear-gradient(90deg, #ec4899, #f97316, #eab308);
  color: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.wrap-content {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  flex-direction: column;
}

.wrap-pane {
  min-height: 160px;
}

.wrap-diary-card {
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
  margin-bottom: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.wrap-diary-emoji {
  font-size: 20px;
}

.wrap-diary-body {
  flex: 1;
}

.wrap-diary-head {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 18px;
}

.wrap-diary-text {
  color: #374151;
  margin-bottom: 6px;
  font-size: 16px;
}

.wrap-diary-time {
  font-size: 12px;
  color: #9ca3af;
}

.wrap-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.wrap-pill {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 0 0, #f9a8d4, #facc15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 12px 26px rgba(248,113,113,0.5),
    0 0 0 1px rgba(248,250,252,0.7);
}

.wrap-pill-icon {
  font-size: 18px;
}

.wrap-eyebrow {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ca3af;
}

.wrap-total-label {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.wrap-close {
  margin-left: auto;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  color: #9ca3af;
}

#wrapStats h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

#wrapStats p {
  margin: 4px 0;
  font-size: 15px;
  color: #4b5563;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 950;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: rgba(255,255,255,0.98);
  padding: 22px 22px 18px;
  border-radius: 24px;
  width: 320px;
  box-shadow:
    0 26px 60px rgba(15,23,42,0.38),
    0 0 0 1px rgba(148,163,184,0.35);
}

.modal-title {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: #111827;
}

.modal-body {
  margin: 0 0 16px;
  font-size: 16px;
  color: #4b5563;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.modal-primary {
  flex: 1;
}

.modal-secondary {
  flex: 1;
  text-align: center;
}

.archive-detail-card {
  background: rgba(255,255,255,0.98);
  padding: 20px 22px 18px;
  border-radius: 26px;
  width: 420px;
  max-width: 90vw;
  box-shadow:
    0 26px 60px rgba(15,23,42,0.38),
    0 0 0 1px rgba(148,163,184,0.35);
}

.archive-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.archive-detail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.archive-detail-sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: #9ca3af;
}

.archive-detail-content {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-direction: column;
}

.archive-detail-jar-shell {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.archive-detail-jar-shell .archive-mini-glass {
  height: 140px;
  width: 160px;
}

#archiveDetailStats h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

#archiveDetailStats p {
  margin: 3px 0;
  font-size: 13px;
  color: #4b5563;
}
