* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  background-color: #EFF6FF;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: background-color 1.2s ease;
}

#app {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
}

#top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

#settings-button {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  color: #6B7280;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

#settings-button:hover { color: #111827; }

#app-name {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  letter-spacing: -0.2px;
}

#city-button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6B7280;
  font-size: 12px;
  transition: background 0.15s;
}

#city-button:hover { background: rgba(0, 0, 0, 0.04); }

#city-icon { font-size: 11px; opacity: 0.6; }

#search-box {
  display: none;
  gap: 8px;
  padding: 4px;
}

#search-box.open { display: flex; }

#search-input {
  flex: 1;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 14px;
  background: white;
  color: #111827;
  outline: none;
  transition: border-color 0.15s;
}

#search-input:focus { border-color: #60A5FA; }

#search-cancel {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: #6B7280;
  cursor: pointer;
  padding: 0 8px;
}

#settings-panel {
  display: none;
  background: white;
  border-radius: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

#settings-panel.open { display: block; }

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-label {
  font-size: 11px;
  font-weight: 500;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#skin-swatches,
#hair-colors {
  display: flex;
  gap: 10px;
}

.swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}

.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: #111827; }

#hair-styles,
#outfit-palettes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #374151;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover { background: rgba(0, 0, 0, 0.06); }
.pill-btn.active {
  background: #111827;
  color: white;
  border-color: #111827;
}

#character-card {
  position: relative;
  border-radius: 24px;
  padding-top: 28px;
  padding-bottom: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: background 0.8s ease;
  overflow: hidden;
  min-height: 240px;
  background: white;
}

#scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

#ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.06), rgba(0,0,0,0.14));
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  z-index: 2;
}

#ground::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 1px;
  background: repeating-linear-gradient(to right, rgba(255,255,255,0.5) 0 12px, transparent 12px 24px);
}

#character-svg {
  width: 100px;
  height: 145px;
  position: relative;
  z-index: 3;
  margin-bottom: -18px;
}

#character-card.scene-hot   { background: linear-gradient(to bottom, #FDE68A 0%, #FED7AA 100%); }
#character-card.scene-warm  { background: linear-gradient(to bottom, #BFDBFE 0%, #DBEAFE 100%); }
#character-card.scene-mild  { background: linear-gradient(to bottom, #DBEAFE 0%, #E0E7FF 100%); }
#character-card.scene-cool  { background: linear-gradient(to bottom, #CBD5E1 0%, #E2E8F0 100%); }
#character-card.scene-cold  { background: linear-gradient(to bottom, #94A3B8 0%, #CBD5E1 100%); }

#character-card.night {
  background: linear-gradient(to bottom, #1E293B 0%, #334155 100%);
}

#character-card.night #ground {
  background: linear-gradient(to bottom, rgba(255,255,255,0.06), rgba(255,255,255,0.14));
  border-top: 1px solid rgba(255,255,255,0.2);
}

#character-card.night #ground::before {
  background: repeating-linear-gradient(to right, rgba(255,255,255,0.3) 0 12px, transparent 12px 24px);
}

.sun {
  position: absolute;
  top: 22px;
  right: 30px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #FBBF24;
  box-shadow: 0 0 30px 8px rgba(251, 191, 36, 0.5);
  animation: sunGlow 3s ease-in-out infinite;
}

@keyframes sunGlow {
  0%, 100% { box-shadow: 0 0 30px 8px rgba(251, 191, 36, 0.5); }
  50%      { box-shadow: 0 0 40px 14px rgba(251, 191, 36, 0.7); }
}

.moon {
  position: absolute;
  top: 22px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #F1F5F9;
  box-shadow: inset -12px -6px 0 0 #CBD5E1, 0 0 25px 4px rgba(241, 245, 249, 0.4);
  animation: moonGlow 4s ease-in-out infinite;
}

@keyframes moonGlow {
  0%, 100% { box-shadow: inset -12px -6px 0 0 #CBD5E1, 0 0 25px 4px rgba(241, 245, 249, 0.4); }
  50%      { box-shadow: inset -12px -6px 0 0 #CBD5E1, 0 0 35px 8px rgba(241, 245, 249, 0.6); }
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle 2.5s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.4); }
}

.cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  opacity: 0.9;
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}

.cloud-1 {
  top: 30px;
  left: -60px;
  width: 60px;
  height: 18px;
  animation: drift 20s linear infinite;
}
.cloud-1::before { width: 24px; height: 24px; top: -12px; left: 10px; }
.cloud-1::after  { width: 18px; height: 18px; top: -8px; right: 12px; }

.cloud-2 {
  top: 70px;
  left: -80px;
  width: 45px;
  height: 14px;
  opacity: 0.7;
  animation: drift 28s linear infinite;
  animation-delay: -10s;
}
.cloud-2::before { width: 18px; height: 18px; top: -9px; left: 8px; }
.cloud-2::after  { width: 14px; height: 14px; top: -6px; right: 8px; }

@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(500px); }
}

.grey-cloud { background: #94A3B8; opacity: 0.6; }
.grey-cloud::before,
.grey-cloud::after { background: #94A3B8; }

.night-cloud { background: #475569; opacity: 0.7; }
.night-cloud::before,
.night-cloud::after { background: #475569; }

.raindrop {
  position: absolute;
  width: 2px;
  height: 10px;
  background: linear-gradient(to bottom, transparent, #60A5FA);
  border-radius: 2px;
  animation: rainFall 0.9s linear infinite;
  opacity: 0.7;
}

@keyframes rainFall {
  from { transform: translateY(-20px); opacity: 0; }
  10%  { opacity: 0.7; }
  90%  { opacity: 0.7; }
  to   { transform: translateY(240px); opacity: 0; }
}

.snowflake {
  position: absolute;
  color: white;
  font-size: 14px;
  animation: snowFall 6s linear infinite;
  opacity: 0.85;
}

@keyframes snowFall {
  from { transform: translateY(-20px) translateX(0);  opacity: 0; }
  10%  { opacity: 0.85; }
  50%  { transform: translateY(120px) translateX(15px); }
  90%  { opacity: 0.85; }
  to   { transform: translateY(240px) translateX(-15px); opacity: 0; }
}

.info-card {
  background: white;
  border-radius: 20px;
  padding: 18px 22px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

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

.card-label {
  font-size: 11px;
  font-weight: 500;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#condition-label {
  font-size: 15px;
  font-weight: 500;
  color: #111827;
}

#temp-display {
  font-size: 44px;
  font-weight: 500;
  color: #111827;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 8px;
}

#rec-message {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.6;
}

#clothing-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 6px 14px;
}

#hint {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.55;
  padding: 10px 12px;
  background: #F9FAFB;
  border-left: 3px solid #D1D5DB;
  border-radius: 0 8px 8px 0;
  margin-top: 10px;
  display: none;
}

#weather-stats {
  background: white;
  border-radius: 18px;
  padding: 16px 22px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  justify-content: space-between;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 11px;
  color: #9CA3AF;
}

.stat-value {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

#forecast-strip {
  background: white;
  border-radius: 20px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.forecast-label {
  font-size: 11px;
  font-weight: 500;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

#forecast-days {
  display: flex;
  gap: 8px;
}

.forecast-day {
  flex: 1;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 14px;
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.forecast-day:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.forecast-day.selected {
  background: #EFF6FF;
  border-color: #BFDBFE;
}

.forecast-day-name {
  font-size: 11px;
  font-weight: 500;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.forecast-day-svg {
  width: 40px;
  height: 55px;
}

.forecast-day-temp {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
}

.loading #character-card {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

#error-box {
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  text-align: center;
}

#error-box p.icon {
  font-size: 36px;
  margin-bottom: 14px;
}

#error-box p.msg {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.65;
}

@media (max-width: 400px) {
  body {
    padding: 16px;
    align-items: flex-start;
    padding-top: 32px;
  }
}