:root{
  --bg:#0b1020;
  --panel:rgba(16,22,40,.74);
  --panel2:rgba(16,22,40,.54);
  --text:#e7ecff;
  --muted:#aeb7e6;
  --stroke:rgba(220,230,255,.15);
  --accent:#7dd3fc;
  --itcz:#f59e0b;
  --iso:#93c5fd;
  --rain:#34d399;
  --shadow:0 14px 40px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji";
  background:
    radial-gradient(1100px 800px at 20% -20%, rgba(125, 211, 252,.18), transparent 60%),
    radial-gradient(900px 700px at 100% 0%, rgba(52, 211, 153,.12), transparent 55%),
    radial-gradient(900px 700px at 0% 100%, rgba(245, 158, 11,.10), transparent 55%),
    linear-gradient(180deg, #070a14, var(--bg));
  color:var(--text);
  overflow:hidden;
}

.stage{
  --hud-gap: 14px;
}

.back{
  position:fixed;
  left:14px;
  top:14px;
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:rgba(10,14,28,.7);
  backdrop-filter:blur(10px);
  color:var(--text);
  text-decoration:none;
  box-shadow:var(--shadow);
  z-index:50;
}
.back:hover{border-color:rgba(220,230,255,.28)}

.hud{
  position:fixed;
  left:70px;
  right:14px;
  top:14px;
  padding:14px 16px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:var(--panel);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
  z-index:40;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.row + .row{margin-top:10px}

.title{min-width:240px}
.kicker{font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.h1{font-size:16px;font-weight:700}

.controls{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.btn{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:rgba(12,16,30,.55);
  color:var(--text);
  cursor:pointer;
  box-shadow:none;
}
.btn:hover{border-color:rgba(220,230,255,.28)}
.btn:active{transform:translateY(1px)}
.btn-ic{
  width:18px;
  display:inline-block;
  text-align:center;
  color:var(--accent);
  font-weight:800;
}
.btn.is-playing .btn-ic{color:rgba(248,113,113,.95)}
.btn-tx{font-size:13px;font-weight:700}
.toggle{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:rgba(12,16,30,.4);
  cursor:pointer;
  user-select:none;
}
.toggle input{accent-color:var(--accent)}
.toggle span{font-size:13px;color:var(--text)}

.timeline{
  flex:1;
  min-width:240px;
  display:grid;
  grid-template-columns:auto 1fr;
  grid-template-rows:auto auto;
  gap:8px 12px;
  align-items:center;
}
.month-label{display:flex;flex-direction:column;gap:2px}
#month-name{font-weight:800;font-size:14px}
.month-sub{font-size:12px;color:var(--muted)}
#month{width:100%}
.timeline-hint{
  grid-column:1/-1;
  font-size:12px;
  color:var(--muted);
}

.legend{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.chip{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--stroke);
  border-radius:12px;
  background:rgba(12,16,30,.32);
  font-size:12px;
  color:var(--muted);
}
.sw{width:10px;height:10px;border-radius:3px}
.sw-itcz{background:var(--itcz)}
.sw-iso{background:var(--iso)}
.sw-rain{background:linear-gradient(90deg, rgba(52,211,153,.2), rgba(52,211,153,.9))}

.stage{
  position:absolute;
  /* Topo acompanha a altura real do HUD para evitar sobreposição */
  inset:calc(var(--hud-h, 76px) + 28px) 14px 56px 14px;
  display:grid;
  grid-template-columns:1fr 340px;
  grid-template-areas:"map hadley";
  gap:14px;
}
.map{grid-area:map}
.hadley{grid-area:hadley}
.hadley.is-hidden{
  visibility:hidden;
  pointer-events:none;
}

.hadley{
  border:1px solid var(--stroke);
  border-radius:16px;
  background:var(--panel2);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
  padding:12px;
  overflow:hidden;
}
.hadley canvas{
  width:100%;
  height:auto;
  border-radius:12px;
  border:1px solid rgba(220,230,255,.10);
  background:rgba(7,10,20,.55);
}
.caption{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
  line-height:1.25;
}

.map{
  border:1px solid var(--stroke);
  border-radius:16px;
  background:rgba(7,10,20,.3);
  backdrop-filter:blur(10px);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.map-inner{
  position:relative;
  width:100%;
  height:100%;
}
#gl,#overlay{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
}
#overlay{pointer-events:none}

.foot{
  position:fixed;
  left:14px;
  right:14px;
  bottom:10px;
  z-index:30;
}
.foot-inner{
  border:1px solid var(--stroke);
  border-radius:14px;
  background:rgba(10,14,28,.55);
  backdrop-filter:blur(10px);
  padding:10px 12px;
  box-shadow:var(--shadow);
}
.note{font-size:12px;color:var(--muted);line-height:1.25}

@media (max-width: 980px){
  body{overflow:auto}
  .hud{position:static;margin:14px;border-radius:14px}
  .back{position:static;margin:14px 14px 0 14px}
  .stage{
    position:static;
    inset:auto;
    grid-template-columns:1fr;
    grid-template-areas:
      "map"
      "hadley";
    margin:0 14px 14px 14px
  }
  .foot{position:static;margin:0 14px 14px 14px}
}
