/* ============================================================
   SLIIT FLOOD CHECK — styles
   Modes: loading | yay (flood!) | study (no flood) | error
   ============================================================ */
:root {
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-meme: "Bangers", "Impact", system-ui, sans-serif;

  /* default (loading) palette */
  --bg-1: #0b0d1a;
  --bg-2: #14172e;
  --accent: #8b93ff;
  --accent-2: #5ee7ff;
  --text: #f3f4ff;
  --muted: #a3a8cc;
  --card: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.12);
  --glow-a: rgba(139, 147, 255, 0.35);
  --glow-b: rgba(94, 231, 255, 0.25);
  --radius: 22px;
}

body[data-mode="yay"] {
  --bg-1: #1a0638;
  --bg-2: #2d0b52;
  --accent: #ff4fa3;
  --accent-2: #b6ff5c;
  --muted: #d7c3f5;
  --glow-a: rgba(255, 79, 163, 0.45);
  --glow-b: rgba(51, 225, 255, 0.35);
}

body[data-mode="study"] {
  --bg-1: #070b14;
  --bg-2: #101a2c;
  --accent: #6c9bff;
  --accent-2: #94a8c9;
  --muted: #90a0bd;
  --glow-a: rgba(80, 120, 200, 0.3);
  --glow-b: rgba(60, 80, 120, 0.25);
}

body[data-mode="error"] {
  --bg-1: #140a0a;
  --bg-2: #261112;
  --accent: #ffb454;
  --accent-2: #ff7a59;
  --muted: #c9a9a0;
  --glow-a: rgba(255, 150, 80, 0.3);
  --glow-b: rgba(255, 90, 90, 0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  overflow-x: hidden;
  transition: background 0.8s ease;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: rgba(255,255,255,.1); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ---------- ambient background ---------- */
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 15% 10%, var(--glow-a), transparent 70%),
    radial-gradient(700px 500px at 90% 85%, var(--glow-b), transparent 70%);
  transition: background 0.8s ease;
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2%, 2%, 0) scale(1.06); }
}

#fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; width: 100%; height: 100%; }

/* ---------- layout ---------- */
.app {
  position: relative; z-index: 2;
  max-width: 1040px; margin: 0 auto;
  padding: 20px 18px 48px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; letter-spacing: .12em; font-size: .85rem; }
.brand b { color: var(--accent); font-weight: 700; }
.brand__logo { font-size: 1.4rem; }

.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: .8rem; color: var(--muted);
}
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: #ffc857; box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; color: #ffc857; }
.live.ok .live__dot { background: #4ade80; color: #4ade80; }
.live.bad .live__dot { background: #ff6b6b; color: #ff6b6b; animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: 18px 0 34px; }

.hero__eyebrow {
  text-transform: uppercase; letter-spacing: .28em; font-size: .78rem;
  color: var(--accent-2); font-weight: 600; margin-bottom: 10px;
}

.hero__title {
  font-family: var(--font-meme);
  font-weight: 400;
  font-size: clamp(2.6rem, 10vw, 6.2rem);
  line-height: 1;
  letter-spacing: .03em;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .2em;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 24px var(--glow-a));
}
.hero__emoji {
  -webkit-text-fill-color: initial; color: initial;
  display: inline-block; animation: bob 2.4s ease-in-out infinite;
}
body[data-mode="yay"] .hero__title { animation: wiggle 2.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
@keyframes wiggle { 0%,100% { transform: rotate(-1.2deg) scale(1); } 50% { transform: rotate(1.2deg) scale(1.03); } }

.hero__sub {
  max-width: 620px; margin: 12px auto 0;
  color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.2rem); line-height: 1.5;
}
.hero__sub b { color: var(--text); }

/* ---------- meme card ---------- */
.meme {
  width: min(460px, 100%); margin: 26px auto 0;
  padding: 12px 12px 16px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03) inset;
  transform: rotate(-1deg);
  transition: transform .3s ease;
}
.meme:hover { transform: rotate(0deg) scale(1.01); }

.meme__frame {
  position: relative; overflow: hidden; border-radius: 14px;
  background: rgba(0,0,0,.35);
  min-height: 220px; display: grid; place-items: center;
}
.meme__frame img {
  display: block; width: 100%; max-height: 360px; object-fit: contain;
  opacity: 0; transition: opacity .4s ease;
}
.meme__frame img.show { opacity: 1; }
.meme__loader {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.1) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
}
.meme__loader.hide { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

.meme__caption {
  font-family: var(--font-meme); letter-spacing: .04em;
  font-size: clamp(1.25rem, 4vw, 1.7rem); line-height: 1.15;
  margin: 14px 8px 12px; text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
}

.btn {
  font-family: var(--font-body); font-weight: 600; font-size: .95rem;
  color: var(--text); cursor: pointer;
  padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--card-border);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 35%, transparent), color-mix(in srgb, var(--accent-2) 20%, transparent));
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 10px 24px -8px var(--glow-a); filter: brightness(1.15); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

.card {
  padding: 22px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--card-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px -25px rgba(0,0,0,.7);
  display: flex; flex-direction: column; gap: 14px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card__head h2 { font-size: 1.15rem; font-weight: 600; }
.card__head h2 small { display: block; font-size: .7rem; font-weight: 400; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.card__hint { font-size: .88rem; color: var(--muted); line-height: 1.45; }
.card__hint b { color: var(--accent-2); }
.card__foot {
  margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--card-border);
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: .75rem; color: var(--muted);
}

.chip {
  padding: 5px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255,255,255,.1); color: var(--text);
}
.chip[data-level="normal"]   { background: rgba(255,255,255,.12); }
.chip[data-level="alert"]    { background: #a9ff6e; color: #16310a; }
.chip[data-level="minor"]    { background: #f9e973; color: #3b3205; }
.chip[data-level="major"]    { background: #ff9b2b; color: #3b1d00; }
.chip[data-level="critical"] { background: #ec3e40; color: #fff; }

/* ---------- stations ---------- */
.stations { display: flex; flex-direction: column; gap: 14px; }
.station {
  padding: 14px 16px; border-radius: 16px;
  background: rgba(0,0,0,.22); border: 1px solid var(--card-border);
}
.station__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.station__name { font-weight: 600; font-size: .98rem; }
.station__level { font-family: var(--font-meme); font-size: 1.9rem; letter-spacing: .03em; line-height: 1; }
.station__level small { font-family: var(--font-body); font-size: .8rem; color: var(--muted); margin-left: 3px; }
.station__meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }

.gauge { position: relative; height: 12px; border-radius: 99px; background: rgba(255,255,255,.1); margin: 14px 0 22px; overflow: visible; }
.gauge__fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit;
  background: linear-gradient(90deg, #6ee7a8, #f9e973, #ff9b2b);
  transition: width 1.1s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 0 14px rgba(249,233,115,.35);
}
.gauge__tick {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: rgba(255,255,255,.55);
  transform: translateX(-1px);
}
.gauge__tick span {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap;
}
.gauge__tick.minor { background: #f9e973; }
.gauge__tick.minor span { color: #f9e973; font-weight: 700; }

/* ---------- weather ---------- */
.wx__main { display: flex; align-items: center; gap: 16px; }
.wx__icon { font-size: 3.6rem; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); animation: bob 3.4s ease-in-out infinite; }
.wx__temp { font-family: var(--font-meme); font-size: 3.4rem; line-height: 1; letter-spacing: .02em; }
.wx__temp small { font-size: 1.4rem; color: var(--muted); }
.wx__desc { color: var(--muted); font-size: .95rem; margin-top: 2px; }

.wx__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.22); border: 1px solid var(--card-border); }
.stat b { display: block; font-size: 1.05rem; font-weight: 600; }
.stat span { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.wx__rain-title { margin-top: 18px; font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 84px; margin-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.bar__col {
  width: 100%; min-height: 4px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #5ee7ff, #4b79ff); opacity: .9;
  transition: height .9s cubic-bezier(.2,.8,.2,1);
}
.bar__pct { font-size: .62rem; color: var(--text); font-weight: 600; }
.bar__t { font-size: .6rem; color: var(--muted); }

.skeleton { height: 90px; border-radius: 16px; background: linear-gradient(110deg, rgba(255,255,255,.04) 30%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.04) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }

.error-box { padding: 14px 16px; border-radius: 14px; background: rgba(255,120,90,.12); border: 1px solid rgba(255,140,110,.35); color: #ffd2c4; font-size: .9rem; line-height: 1.45; }

/* ---------- river groups, level chips, trend ---------- */
.river-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 2px -4px; }
.river-head h3 { font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
.river-head a { margin-left: auto; font-size: .72rem; }
.river-head + .station { margin-top: 0; }
.stations > .river-head:not(:first-child) { margin-top: 12px; padding-top: 14px; border-top: 1px dashed var(--card-border); }

.lv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lv {
  padding: 3px 9px; border-radius: 999px; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid var(--card-border); color: var(--muted); background: transparent;
}
.lv.hit.alert    { background: #a9ff6e; color: #16310a; border-color: transparent; }
.lv.hit.minor    { background: #f9e973; color: #3b3205; border-color: transparent; }
.lv.hit.major    { background: #ff9b2b; color: #3b1d00; border-color: transparent; }
.lv.hit.critical { background: #ec3e40; color: #fff; border-color: transparent; }

.trend { font-size: .72rem; font-weight: 600; margin-left: auto; }
.trend.up { color: #ff9b6b; }
.trend.down { color: #6ee7a8; }
.trend.flat { color: var(--muted); }
.impact-river__head .trend { margin-left: 0; }

/* ---------- impact ---------- */
.impact { margin-top: 18px; gap: 16px; }
#impact-body { display: flex; flex-direction: column; gap: 16px; }
.impact-wx { padding: 12px 16px; border-radius: 14px; font-size: .88rem; line-height: 1.5; background: rgba(94,231,255,.1); border: 1px solid rgba(94,231,255,.3); }
.impact-wx.heavy { background: rgba(255,155,43,.12); border-color: rgba(255,155,43,.4); }
.impact-wx.dry { background: rgba(110,231,168,.1); border-color: rgba(110,231,168,.3); }

.impact-river { padding: 16px 18px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1px solid var(--card-border); border-left: 4px solid rgba(255,255,255,.25); }
.impact-river[data-level="alert"]    { border-left-color: #a9ff6e; }
.impact-river[data-level="minor"]    { border-left-color: #f9e973; }
.impact-river[data-level="major"]    { border-left-color: #ff9b2b; }
.impact-river[data-level="critical"] { border-left-color: #ec3e40; }
.impact-river__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.impact-river__head h3 { font-size: 1.05rem; font-weight: 600; }
.impact-river__title { margin: 6px 0 12px; font-weight: 500; color: var(--text); }

.ladder { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.step { padding: 5px 11px; border-radius: 999px; font-size: .7rem; font-weight: 600; border: 1px solid var(--card-border); color: var(--muted); opacity: .6; }
.step.past { opacity: .85; }
.step.on { opacity: 1; color: #111; border-color: transparent; transform: scale(1.04); box-shadow: 0 6px 18px -6px rgba(0,0,0,.6); }
.step.on.normal   { background: #fff; }
.step.on.alert    { background: #a9ff6e; }
.step.on.minor    { background: #f9e973; }
.step.on.major    { background: #ff9b2b; }
.step.on.critical { background: #ec3e40; color: #fff; }

.impact-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .impact-cols { grid-template-columns: 1fr; } }
.impact-col h4 { font-size: .82rem; margin-bottom: 6px; letter-spacing: .04em; }
.impact-col p, .impact-col li { font-size: .88rem; line-height: 1.55; color: var(--muted); }
.impact-col ul { padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.impact__note { font-size: .75rem; color: var(--muted); line-height: 1.6; padding-top: 10px; border-top: 1px dashed var(--card-border); }

/* ---------- footer ---------- */
.legal { margin-top: 30px; text-align: center; font-size: .78rem; color: var(--muted); line-height: 1.6; max-width: 700px; margin-inline: auto; }
.legal__tip { margin-top: 8px; opacity: .8; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #fx { display: none; }
}
