:root {
  --bg1: #1e3a5f;
  --bg2: #2c5282;
  --card: rgba(255, 255, 255, 0.12);
  --text: #f5f7fa;
  --muted: rgba(245, 247, 250, 0.65);
  --accent: #4299e1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  min-height: 100%;
}

/* --- weather app (the cover) ----------------------------------------------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin: 8px 0 20px;
}

/* fun animated hero icon above the search */
.hero {
  display: flex;
  justify-content: center;
  margin: 28px 0 20px;
}

.hero-icon {
  width: 132px;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
}

/* the sun gently pulses and its rays slowly rotate */
.hero-icon .sun {
  transform-origin: 48px 40px;
  animation: sun-bob 4s ease-in-out infinite;
}

.hero-icon .rays {
  transform-origin: 48px 40px;
  animation: rays-spin 18s linear infinite;
}

/* the cloud drifts side to side */
.hero-icon .cloud {
  transform-origin: center;
  animation: cloud-drift 5s ease-in-out infinite;
}

@keyframes sun-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.04); }
}

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

@keyframes cloud-drift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(7px); }
}

/* respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  .hero-icon .sun,
  .hero-icon .rays,
  .hero-icon .cloud {
    animation: none;
  }
}

.search {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
}

.search input {
  flex: 1;
  padding: 14px 16px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  outline: none;
}

.search input::placeholder {
  color: var(--muted);
}

.search button {
  padding: 0 18px;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.weather {
  min-height: 240px;
}

.muted {
  color: var(--muted);
  text-align: center;
  margin-top: 40px;
}

.wx-card {
  background: var(--card);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  backdrop-filter: blur(8px);
}

.wx-emoji {
  font-size: 64px;
  line-height: 1;
}

.wx-temp {
  font-size: 56px;
  font-weight: 700;
  margin: 8px 0 2px;
}

.wx-label {
  font-size: 18px;
  color: var(--muted);
}

.wx-place {
  font-size: 16px;
  margin-top: 14px;
  font-weight: 500;
}

.wx-meta {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

/* --- chat overlay ---------------------------------------------------------- */
.chat {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 28, 0.96);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: opacity 0.18s ease;
}

.chat.hidden {
  opacity: 0;
  pointer-events: none;
}

.chat-panel {
  width: 100%;
  max-width: 520px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #11161f;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-title {
  font-weight: 600;
}

.chat-head button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  line-height: 1.4;
}

.msg-from {
  font-weight: 600;
  color: var(--accent);
}

.msg-text {
  flex: 1;
  word-break: break-word;
}

.msg-time {
  font-size: 11px;
  color: var(--muted);
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-form input {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  outline: none;
}

.chat-form button {
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
