/* ---- Nico's Weather World ---- */
:root {
  --bg: #1b2a52;
  --bg2: #2b3f73;
  --card: #ffffff;
  --ink: #1b2a52;
  --pop: #ffd23f;
  font-size: clamp(16px, 4.2vw, 22px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Baloo 2", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(120% 80% at 50% 0%, var(--bg2) 0%, var(--bg) 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.screen { display: none; min-height: 100dvh; padding: env(safe-area-inset-top) 1rem 2rem; }
.screen.active { display: block; }

/* ---------- HOME ---------- */
.home-head { text-align: center; padding: 1.4rem 0 0.6rem; }
.title {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0,0,0,0.18);
  letter-spacing: 0.5px;
}
.title-emoji { display: inline-block; animation: spin 14s linear infinite; }
.today { margin: 0.3rem 0 0; color: var(--pop); font-weight: 700; font-size: 1.05rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
  max-width: 540px;
  margin: 1.4rem auto 0;
}

.cat-card {
  border: none;
  border-radius: 1.4rem;
  padding: 1.2rem 0.8rem;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 8px 0 rgba(0,0,0,0.18), inset 0 2px 6px rgba(255,255,255,0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  min-height: 130px;
  justify-content: center;
}
.cat-card:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,0.18), inset 0 2px 6px rgba(255,255,255,0.35); }
.cat-card .c-emoji { font-size: 3.1rem; line-height: 1; filter: drop-shadow(0 3px 2px rgba(0,0,0,0.25)); }
.cat-card .c-label { text-shadow: 0 2px 0 rgba(0,0,0,0.18); }

.footnote { text-align: center; color: rgba(255,255,255,0.75); margin-top: 1.6rem; font-size: 0.95rem; }

/* ---------- DETAIL ---------- */
#detail { padding-top: calc(env(safe-area-inset-top) + 0.5rem); }
.back {
  position: sticky; top: 0.5rem; left: 0;
  border: none; background: rgba(255,255,255,0.92);
  color: var(--ink); font-size: 1.8rem; font-weight: 800;
  width: 3.2rem; height: 3.2rem; border-radius: 50%;
  cursor: pointer; box-shadow: 0 5px 0 rgba(0,0,0,0.2);
  z-index: 5;
}
.back:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,0.2); }

.champion {
  max-width: 540px; margin: -2.4rem auto 0; text-align: center;
  color: #fff;
}
.cat-banner {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 1.6rem; font-weight: 800; margin-bottom: 0.3rem;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
}
.cat-banner span:first-child { font-size: 2rem; }

/* Mascot */
.mascot { width: 160px; height: 160px; margin: 0.4rem auto 0.6rem; position: relative; }

.place { margin-top: 0.2rem; }
.flag { font-size: 3rem; line-height: 1; display: block; }
.place-name { margin: 0.2rem 0 0; font-size: 2.4rem; font-weight: 800; text-shadow: 0 3px 0 rgba(0,0,0,0.22); }
.place-country { margin: 0.1rem 0 0; font-size: 1.1rem; opacity: 0.9; font-weight: 700; }

.reading { margin: 0.8rem 0 0.2rem; display: flex; flex-direction: column; align-items: center; }
.big-number {
  font-size: 4.6rem; font-weight: 800; line-height: 1;
  color: var(--pop); text-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.small-number { font-size: 1.4rem; font-weight: 700; opacity: 0.85; margin-top: 0.1rem; }

.comparison {
  background: rgba(255,255,255,0.95); color: var(--ink);
  border-radius: 1.2rem; padding: 0.9rem 1.1rem; margin: 0.9rem auto 0;
  max-width: 460px; font-size: 1.25rem; font-weight: 700;
  box-shadow: 0 6px 0 rgba(0,0,0,0.15);
}

.map {
  width: 100%; max-width: 460px; margin: 1.1rem auto 0; display: block;
  background: #bfe3ff; border-radius: 1rem;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.5), 0 6px 0 rgba(0,0,0,0.15);
}
.continent { fill: #76c893; stroke: #5aa776; stroke-width: 0.6; }
.pin-ring { fill: none; stroke: #ff3b3b; stroke-width: 3; opacity: 0.9; transform-origin: center; animation: ping 1.6s ease-out infinite; transform-box: fill-box; }
.pin-dot { fill: #ff3b3b; stroke: #fff; stroke-width: 1.5; }

.fun-fact { font-size: 1.05rem; margin: 1rem auto 0; max-width: 460px; opacity: 0.95; min-height: 1.2em; }

.runners { margin: 1.4rem auto 0; max-width: 460px; }
.runners-title { font-weight: 800; opacity: 0.85; margin: 0 0 0.5rem; }
.runners-list { display: flex; flex-direction: column; gap: 0.5rem; }
.runner {
  display: flex; align-items: center; gap: 0.6rem;
  background: rgba(255,255,255,0.14); border-radius: 0.9rem; padding: 0.55rem 0.9rem;
  font-weight: 700;
}
.runner .r-flag { font-size: 1.5rem; }
.runner .r-name { flex: 1; text-align: left; }
.runner .r-val { color: var(--pop); font-weight: 800; }

/* ---------- Loading ---------- */
.loading {
  position: fixed; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem;
  background: radial-gradient(120% 80% at 50% 30%, var(--bg2) 0%, var(--bg) 75%);
  color: #fff; font-weight: 800; z-index: 20;
}
.loading.show { display: flex; }
.cb { display: flex; gap: 0.5rem; font-size: 4.6rem; line-height: 1; }
.cb-emoji { display: inline-block; filter: drop-shadow(0 6px 4px rgba(0,0,0,0.3)); }
.chicken { animation: cbDance 0.55s ease-in-out infinite; }
.banana  { animation: cbDance 0.55s ease-in-out infinite 0.275s; }
.cb-text { font-size: 1.8rem; color: var(--pop); animation: cbPulse 0.55s ease-in-out infinite; }
.cb-sub  { font-size: 1rem; opacity: 0.8; font-weight: 700; }
@keyframes cbDance { 0%,100% { transform: translateY(0) rotate(-10deg); } 50% { transform: translateY(-26px) rotate(10deg); } }
@keyframes cbPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@media (prefers-reduced-motion: reduce) { .chicken, .banana, .cb-text { animation: none !important; } }

/* ---------- Mascot effects ---------- */
.face {
  position: absolute; inset: 0; border-radius: 50%;
  background: var(--pop);
  box-shadow: inset 0 -10px 0 rgba(0,0,0,0.08), 0 8px 0 rgba(0,0,0,0.18);
  z-index: 2;
}
.eye { position: absolute; top: 40%; width: 18px; height: 22px; background: #1b2a52; border-radius: 50%; }
.eye.l { left: 32%; } .eye.r { right: 32%; }
.eye::after { content:""; position:absolute; top:3px; left:4px; width:6px; height:6px; background:#fff; border-radius:50%; }
.mouth { position: absolute; bottom: 26%; left: 50%; transform: translateX(-50%); width: 46px; height: 24px; border-bottom: 7px solid #1b2a52; border-radius: 0 0 46px 46px; }
.cheek { position:absolute; top:54%; width:16px; height:11px; background:#ff8aa0; border-radius:50%; opacity:0.7; }
.cheek.l{ left:18%; } .cheek.r{ right:18%; }

/* rays for hot */
.ray { position:absolute; top:50%; left:50%; width:14px; height:36px; margin:-18px 0 0 -7px; background:#ffb800; border-radius:7px; transform-origin: 7px 80px; }
.rays { position:absolute; inset:-30px; animation: spin 9s linear infinite; z-index:1; }

/* falling particles (rain/snow) */
.fall { position:absolute; top:-10px; font-size:18px; animation: fall 1.4s linear infinite; z-index:3; }

/* wind streaks */
.gust { position:absolute; height:6px; background:rgba(255,255,255,0.8); border-radius:6px; right:-30px; animation: gust 1.1s ease-in-out infinite; z-index:3; }

.sweat { position:absolute; font-size:20px; z-index:4; animation: drip 1.6s ease-in infinite; }
.shiver { animation: shiver 0.18s infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { stroke-width: 4; opacity: 0.9; r: 4; } 100% { stroke-width: 0.5; opacity: 0; r: 18; } }
@keyframes fall { 0% { transform: translateY(0) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(180px) rotate(40deg); opacity: 0; } }
@keyframes gust { 0%,100% { transform: translateX(0); opacity: 0.3; } 50% { transform: translateX(-26px); opacity: 1; } }
@keyframes drip { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(40px); opacity: 0; } }
@keyframes shiver { 0%{transform:translate(0,0)} 25%{transform:translate(-2px,1px)} 50%{transform:translate(2px,-1px)} 75%{transform:translate(-1px,-1px)} }
@keyframes bob { 0%,100%{ transform: translateY(0);} 50%{ transform: translateY(-8px);} }
.bob { animation: bob 2.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .title-emoji, .rays, .fall, .gust, .sweat, .pin-ring, .bob, .shiver { animation: none !important; }
}
