:root {
  --cm-panel: rgba(255, 255, 255, 0.94);
  --cm-border: #dce5f0;
  --cm-text: #142033;
  --cm-muted: #637086;
  --cm-accent: #178b76;
  --cm-blue: #2788db;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cm-text);
  background:
    radial-gradient(700px 340px at 10% 0%, rgba(30, 150, 132, 0.12), transparent 64%),
    radial-gradient(600px 320px at 90% 15%, rgba(39, 136, 219, 0.12), transparent 65%),
    #eef3f8;
}

.climate-shell { width: min(1240px, calc(100% - 32px)); margin: 34px auto 52px; }
.climate-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.climate-heading h1 { margin: 8px 0 8px; font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.04em; }
.climate-heading p { margin: 0; color: var(--cm-muted); font-weight: 650; }
.eyebrow, .section-label { color: var(--cm-accent); font-size: 11px; font-weight: 900; letter-spacing: 0.14em; }
.model-badge { padding: 9px 14px; border: 1px solid #bdddd6; border-radius: 999px; background: #e9f8f4; color: #166b5e; font-size: 12px; font-weight: 850; white-space: nowrap; }
.panel-card { border: 1px solid var(--cm-border); border-radius: 22px; background: var(--cm-panel); box-shadow: 0 16px 38px rgba(28, 48, 74, 0.09); }
.preset-panel { padding: 17px 18px; margin-bottom: 18px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset-btn, .mode-btn, .secondary-action { border: 1px solid #d3deeb; background: #f6f9fc; color: #334158; border-radius: 11px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
.preset-btn:hover, .preset-btn.is-active { color: #fff; border-color: var(--cm-accent); background: linear-gradient(135deg, #198e79, #237f9f); }
.climate-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.visual-column { min-width: 0; display: grid; gap: 18px; }
.map-card, .chart-card, .control-panel { padding: 18px; }
.card-head, .control-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-head strong { display: block; margin-top: 5px; font-size: 17px; }
.year-display { color: #142d49; font-size: 32px; font-weight: 900; letter-spacing: -0.04em; }
.year-display small { margin-left: 3px; font-size: 13px; color: var(--cm-muted); }
.climate-map { position: relative; overflow: hidden; isolation: isolate; aspect-ratio: 1.62 / 1; margin-top: 14px; border-radius: 18px; background: #102b48; box-shadow: inset 0 0 55px rgba(0,0,0,.32); }
.temperature-layer { position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, #85d4ee 0%, #38a0c5 26%, #257aa8 50%, #38a0c5 74%, #85d4ee 100%); transition: filter .2s, background .2s; }
.ocean-rise-layer { position: absolute; inset: auto 0 0; z-index: -1; height: 0%; background: linear-gradient(0deg, rgba(14,108,194,.68), rgba(61,180,225,.1)); transition: height .25s; }
.world-map { position: absolute; inset: 7% 4%; width: 92%; height: 86%; object-fit: contain; filter: drop-shadow(0 7px 10px rgba(0,0,0,.28)) sepia(.08); transition: filter .25s; }
.ice-cap { position: absolute; left: 7%; width: 86%; height: 17%; border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.95), rgba(210,241,251,.7) 52%, transparent 70%); filter: blur(2px); transition: transform .25s, opacity .25s; }
.ice-cap--north { top: -7%; transform-origin: top; }
.ice-cap--south { bottom: -7%; transform-origin: bottom; }
.map-scanline { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.025) 6px); pointer-events: none; }
.map-legend { position: absolute; right: 12px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; color: #fff; background: rgba(7,20,36,.68); font-size: 10px; font-weight: 750; }
.map-legend i { width: 70px; height: 6px; border-radius: 9px; background: linear-gradient(90deg, #77d8f4, #f4c65a, #e95445); }
.timeline-wrap { margin-top: 16px; }
.timeline-wrap label { display: block; margin-bottom: 8px; font-size: 12px; color: var(--cm-muted); font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--cm-accent); }
.timeline-labels { position: relative; display: flex; justify-content: space-between; margin-top: 4px; color: #7c899a; font-size: 10px; }
.timeline-labels .current-year-label { position: absolute; left: var(--current-year-position, 70.4%); transform: translateX(-50%); color: var(--cm-accent); font-weight: 900; }
.play-controls { display: flex; gap: 9px; margin-top: 14px; }
.primary-action { flex: 1; border: 0; border-radius: 12px; padding: 12px 18px; color: #fff; background: linear-gradient(135deg, #178b76, #237f9f); font-weight: 900; cursor: pointer; box-shadow: 0 9px 20px rgba(23,139,118,.2); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric-card { padding: 15px; border: 1px solid var(--cm-border); border-radius: 17px; background: var(--cm-panel); box-shadow: 0 10px 22px rgba(28,48,74,.06); }
.metric-card span, .metric-card small { display: block; color: var(--cm-muted); font-size: 11px; font-weight: 750; }
.metric-card strong { display: block; margin: 7px 0 5px; font-size: 22px; }
.chart-head { margin-bottom: 12px; }
.chart-legend { display: flex; gap: 14px; font-size: 11px; font-weight: 800; }
.chart-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.temp-key::before { background: #e75145; }.sea-key::before { background: #2788db; }
#climate-chart { display: block; width: 100%; height: 240px; }
.control-panel { position: sticky; top: 18px; }
.control-head h2 { margin: 5px 0 0; font-size: 21px; }
.mode-btn { padding: 8px 10px; font-size: 11px; }
.control-group { padding: 17px 0; border-bottom: 1px solid #e8edf3; }
.control-group label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; font-size: 13px; font-weight: 850; }
.control-group output { color: var(--cm-accent); }
.control-group p { margin: 8px 0 0; color: var(--cm-muted); font-size: 11px; line-height: 1.55; }
.advanced-controls[hidden] { display: none; }
.interpretation-card { margin-top: 18px; padding: 15px; border: 1px solid #cde2de; border-radius: 15px; background: #eff9f6; }
.interpretation-card p { margin: 8px 0 0; color: #38544f; font-size: 12px; line-height: 1.65; font-weight: 650; }

html[data-site-theme="dark"] { --cm-panel: rgba(15, 27, 43, .94); --cm-border: #304159; --cm-text: #eef5ff; --cm-muted: #a9b7ca; }
html[data-site-theme="dark"] body { background: radial-gradient(700px 340px at 10% 0%, rgba(30,150,132,.15), transparent 64%), #08111f !important; }
html[data-site-theme="dark"] .model-badge, html[data-site-theme="dark"] .interpretation-card { background: #132f31; border-color: #275653; color: #c8fff3; }
html[data-site-theme="dark"] .interpretation-card p { color: #c3dcd8; }
html[data-site-theme="dark"] .preset-btn, html[data-site-theme="dark"] .mode-btn, html[data-site-theme="dark"] .secondary-action { background: #15243a; border-color: #33465f; color: #dce8f8; }
html[data-site-theme="dark"] .year-display { color: #eaf4ff; }
html[data-site-theme="dark"] .control-group { border-color: #293a50; }

@media (max-width: 980px) {
  .climate-grid { grid-template-columns: 1fr; }
  .control-panel { position: static; }
}
@media (max-width: 700px) {
  .climate-shell { width: calc(100% - 16px); margin-top: 18px; }
  .climate-heading { align-items: flex-start; flex-direction: column; }
  .climate-heading h1 { font-size: 32px; }
  .preset-panel, .map-card, .chart-card, .control-panel { padding: 14px; border-radius: 18px; }
  .preset-row { display: grid; grid-template-columns: repeat(2, 1fr); }
  .preset-btn { padding: 10px 6px; font-size: 12px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-card strong { font-size: 19px; }
  .climate-map { aspect-ratio: 1.45 / 1; }
  #climate-chart { height: 205px; }
}
