/* ===== Base Styles ===== */
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #f7f8fa;
  color: #222;
}

main {
  max-width: min(420px, 92vw);
  margin: clamp(24px, 6vw, 60px) auto;
  padding: clamp(16px, 4vw, 20px);
  text-align: center;
  position: relative;
}

h1 {
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  margin-bottom: 0.2em;
}

.tagline {
  font-size: clamp(0.9rem, 1.8vw, 1rem);
  color: #666;
  margin-bottom: 2em;
}

/* ===== Mood Box ===== */
.mood-box p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 1em;
}

button {
  font-size: clamp(1.4rem, 3.5vw, 1.8rem);
  padding: clamp(8px, 1.5vw, 12px) clamp(10px, 2vw, 16px);
  margin: 6px;
  border: none;
  border-radius: 12px;
  background-color: #ffffff;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mood-box button.selected {
  box-shadow: 0 0 0 6px rgba(0, 180, 255, 0.25);
  transform: scale(1.15);
}

textarea, input, select {
  width: 80%;
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
  box-sizing: border-box;
}

textarea {
  resize: none;
}

/* Footer text */
.footer {
  margin-top: 2em;
  font-size: 0.95rem;
  color: #555;
}

/* ===== Emotional stream ===== */
.stream-section {
  margin-top: 1.5em;
  width: 100%;
  max-width: min(680px, 96vw);
}
.stream-label {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 8px;
}
.stream-stats {
  font-size: 0.9rem;
  color: #666;
  margin: 0 0 10px;
  min-height: 1.4em;
}
.stream-with-notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 520px) {
  .stream-with-notes {
    flex-direction: row;
    align-items: center;
  }
  .stream-with-notes .stream-container {
    flex: 1;
    min-width: 0;
  }
  .stream-with-notes .notes-ticker-container {
    width: 180px;
    flex-shrink: 0;
    height: 320px;
    max-height: 320px;
    align-self: center;
  }
}
.stream-container {
  position: relative;
  width: 100%;
  min-height: 320px;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 24px rgba(0,0,0,0.06);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: box-shadow 0.4s ease, filter 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stream-container.stream-ripple-active {
  animation: streamPulse 1.6s ease-out;
}
@keyframes streamPulse {
  0%, 100% { filter: brightness(1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 4px 24px rgba(0,0,0,0.06); }
  15% { filter: brightness(1.08); box-shadow: inset 0 1px 0 rgba(255,255,255,0.95), 0 6px 32px rgba(0,0,0,0.08); }
  40% { filter: brightness(1.04); }
  70% { filter: brightness(1.02); }
}
.stream-wave-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
}
.stream-waves {
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity 0.4s ease;
}
.stream-wave-fill {
  transition: fill 0.4s ease;
}
.stream-wave-fill.wave-pulse {
  animation: waveFillPulse 1.5s ease-out;
}
@keyframes waveFillPulse {
  0%, 100% { opacity: 1; }
  20% { opacity: 0.92; }
  35% { opacity: 1.05; }
  60% { opacity: 1; }
}
.stream-wave-overlay {
  pointer-events: none;
}
.stream-flow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 15%, rgba(255,255,255,0.25) 50%, rgba(255,255,255,0.08) 85%, transparent 100%);
  background-size: 60% 100%;
  background-repeat: no-repeat;
  animation: streamFlow 4s linear infinite;
}
@keyframes streamFlow {
  from { background-position: -60% 0; }
  to { background-position: 160% 0; }
}
.stream-shimmer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.35) 45%, rgba(255,255,255,0.5) 50%, rgba(255,255,255,0.35) 55%, transparent 100%);
  background-size: 200% 100%;
  animation: streamShimmer 1.8s ease-out forwards;
  border-radius: inherit;
}
@keyframes streamShimmer {
  0% { background-position: 200% 0; opacity: 1; }
  100% { background-position: -100% 0; opacity: 0; }
}
.droplet-splash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Notes ticker ===== */
.notes-ticker-container {
  display: flex;
  flex-direction: column;
}
.notes-ticker-wrap {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notes-ticker-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.notes-ticker-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes-ticker-list.notes-ticker-scrollable {
  overflow-y: scroll;
}
.notes-ticker-item {
  font-size: 0.82rem;
  color: #444;
  line-height: 1.35;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  border-left: 3px solid rgba(100, 100, 100, 0.3);
  display: flex;
  gap: 6px;
  align-items: flex-start;
}
.notes-ticker-mood {
  flex-shrink: 0;
  font-size: 1rem;
}
.notes-ticker-text {
  flex: 1;
  word-break: break-word;
}
.notes-ticker-premium-hint {
  font-size: 0.75rem;
  color: #888;
  margin-top: 6px;
}

/* ===== Droplet picker ===== */
.droplet-picker {
  margin-top: 1.5em;
}
.droplet-picker-label {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 10px;
}
.droplet-solidarity {
  font-size: 0.88rem;
  color: #666;
  margin: 0 0 8px;
  min-height: 1.3em;
  font-style: italic;
}
.droplet-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.droplet-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: var(--droplet-color, #ccc);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.droplet-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.droplet-btn.selected {
  border-color: #1a73e8;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.25);
  transform: scale(1.08);
}
.droplet-picker textarea {
  display: block;
  margin: 0 auto 12px;
}
.submit-droplet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  border: none;
  background: linear-gradient(135deg, #1a73e8, #0d65d6);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.submit-droplet:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.4);
}
.submit-droplet[hidden] {
  display: none;
}

/* Droplet fall animation (used by JS) */
.droplet-falling {
  position: fixed;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  animation: dropletFall 280ms ease-in forwards;
}
@keyframes dropletFall {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0.7;
    transform: translate(-50%, calc(-50% + 80px)) scale(1.2);
  }
}
.droplet-splash-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  animation: splashRing 700ms ease-out forwards;
  pointer-events: none;
}
.droplet-splash-ring.ring-2 { animation-delay: 80ms; animation-duration: 800ms; }
.droplet-splash-ring.ring-3 { animation-delay: 160ms; animation-duration: 900ms; }
@keyframes splashRing {
  from { transform: scale(0.2); opacity: 0.9; }
  to { transform: scale(4.5); opacity: 0; }
}

/* Mood overlay (for border flash) */
#mood-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border: 0 solid transparent;
  box-sizing: border-box;
  transition: opacity 1.5s ease, border-color 0.3s ease;
  opacity: 0;
}

/* ===== Auth Box (login/signup) ===== */
.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 1em;
}

.auth-box input, .auth-box select {
  width: 90%;
}

.auth-box button {
  width: 50%;
  font-size: 1.2rem;
  padding: 10px;
  margin-top: 10px;
}

/* ===== Reset password expired banner ===== */
.reset-expired-banner {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.reset-expired-banner[hidden] {
  display: none;
}

.reset-expired-title {
  margin: 0 0 0.35em;
  font-weight: 600;
  color: #c53030;
  font-size: 1rem;
}

.reset-expired-text {
  margin: 0 0 0.75em;
  font-size: 0.9rem;
  color: #742a2a;
  line-height: 1.4;
}

.reset-expired-link {
  display: inline-block;
  font-size: 0.95rem;
  color: #2b6cb0;
  text-decoration: none;
  font-weight: 500;
}

.reset-expired-link:hover {
  text-decoration: underline;
}

/* ===== Mood Period Toggle ===== */
.mood-period-toggle button {
  padding: 6px 12px;
  margin-right: 6px;
  border: none;
  border-radius: 12px;
  background: rgba(240, 240, 240, 0.8);
  color: #333;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  font-size: 0.9rem;
}

.mood-period-toggle button:hover {
  background: rgba(220, 240, 255, 0.6);
  transform: scale(1.05);
}

.mood-period-toggle button.selected {
  background: linear-gradient(135deg, #a8e6cf, #dcedc1);
  color: #333;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* ===== Submit Arrow ===== */
#submit-arrow {
  font-size: clamp(1.4rem, 3vw, 2rem);
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: #fff;
  border-radius: 50%;
  width: clamp(44px, 10vw, 56px);
  height: clamp(44px, 10vw, 56px);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ===== 7-Day Mood Row ===== */
#city-mood-7day {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

#city-mood-7day > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px;
  border-radius: 10px;
  background-color: rgba(250, 250, 250, 0.8);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

#city-mood-7day > div:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#city-mood-7day span:nth-child(2) {
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
  line-height: 1;
}

#city-mood-7day span:nth-child(1) {
  font-size: 0.7rem;
  color: #666;
  margin-bottom: 4px;
}

/* ===== OAuth & Anonymous Buttons ===== */
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 1em 0;
  text-align: center;
}

.oauth-buttons p {
  margin-bottom: 5px;
  font-size: 0.95rem;
  color: #555;
}

.oauth-buttons button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s ease;
}

.oauth-buttons button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

#google-btn {
  background-color: #4285F4;
}

#apple-btn {
  background-color: #000;
}

#microsoft-btn {
  background-color: #0078D4;
}

#anonymous-btn {
  background-color: #777;
  color: #fff;
  margin-top: 0.5em;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
}

#anonymous-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

/* ===== Dashboard link (main page, when logged in) ===== */
.dashboard-link-wrap {
  margin-top: 1.5em;
  font-size: 0.95rem;
}

.dashboard-link {
  color: #1a73e8;
  font-weight: 500;
  text-decoration: none;
}

.dashboard-link:hover {
  text-decoration: underline;
}

/* ===== Mobile: touch-friendly sizes, avoid oversized elements ===== */
@media (max-width: 600px) {
  main { padding: 20px; }
  h1 { font-size: clamp(1.6rem, 6vw, 2rem); }
  .tagline { font-size: 1rem; }
  .droplet-btn { width: 40px; height: 40px; }
  textarea, input, select { width: 95%; font-size: 1rem; }
  #city-mood-display { width: clamp(48px, 14vw, 60px); height: clamp(48px, 14vw, 60px); font-size: clamp(1.4rem, 5vw, 1.8rem); line-height: clamp(48px, 14vw, 60px); }
}

/* ===== Location consent overlay ===== */
.location-consent {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 10000;
  padding: 24px;
}
.location-consent[hidden] { display: none; }
.location-consent-card {
  max-width: 360px;
  padding: 28px 24px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
}
.location-consent-text {
  margin: 0 0 20px;
  font-size: 1.1rem;
  line-height: 1.5;
  color: #333;
}
.location-consent-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.location-consent-btn {
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.location-consent-allow {
  background: #1a73e8;
  color: #fff;
}
.location-consent-allow:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}
.location-consent-skip {
  background: #f0f4f8;
  color: #555;
}
.location-consent-skip:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}