/* The sky is the metric: the background follows the air. See lib/sky.js. */
@property --sky-top { syntax: '<color>'; inherits: true; initial-value: #0c0e1b; }
@property --sky-bottom { syntax: '<color>'; inherits: true; initial-value: #3a2a2c; }

:root {
  --ink: #14212b;
  --muted: #4d5d69;
  --paper: #ffffff;
  --blue: #0b5cab;
  --blue-dark: #084a8c;
  --display: "Yatra One", "Noto Sans Devanagari", Georgia, serif;
  --text: "Hind", system-ui, "Noto Sans Devanagari", sans-serif;
  --on-sky: #fff;
  --sky-top: #0c0e1b;
  --sky-bottom: #3a2a2c;
}
body[data-sky="night"]        { --sky-top: #0c0e1b; --sky-bottom: #4a3027; --on-sky: #fff; }
body[data-sky="haze"]         { --sky-top: #aaa397; --sky-bottom: #e3dfd5; --on-sky: #1d1b16; }
body[data-sky="good"]         { --sky-top: #6fbdec; --sky-bottom: #dff1fb; --on-sky: #0f2a3a; }
body[data-sky="satisfactory"] { --sky-top: #93cbd6; --sky-bottom: #e6f1e4; --on-sky: #0f2a3a; }
body[data-sky="moderate"]     { --sky-top: #d3c88c; --sky-bottom: #f0e9cc; --on-sky: #2a2616; }
body[data-sky="poor"]         { --sky-top: #d4a870; --sky-bottom: #efd9bc; --on-sky: #2b1d0e; }
body[data-sky="very_poor"]    { --sky-top: #b5826c; --sky-bottom: #e1c5b6; --on-sky: #2b150f; }
body[data-sky="severe"]       { --sky-top: #55393a; --sky-bottom: #96705f; --on-sky: #fff; }
body[data-sky="clear"]        { --sky-top: #4fa9e8; --sky-bottom: #e6f6ff; --on-sky: #08283d; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--on-sky);
  font: 17px/1.55 var(--text);
  background: linear-gradient(var(--sky-top), var(--sky-bottom)) fixed;
  transition: --sky-top 1.2s ease, --sky-bottom 1.2s ease;
}
:lang(hi) body, body:lang(hi) { line-height: 1.7; }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }

/* header + journey */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; max-width: 600px; margin: 0 auto; }
.brand { font: 400 20px/1 var(--display); letter-spacing: .01em; }
.pill { font: 600 14px var(--text); padding: 6px 14px; border-radius: 999px; border: 1.5px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.steps { display: flex; justify-content: space-between; gap: 4px; max-width: 600px; margin: 0 auto; padding: 4px 16px 10px; }
.steps button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: inherit; font: 600 12px/1.2 var(--text); opacity: .65; cursor: pointer; padding: 4px 0; }
.steps button i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.steps button[aria-current="step"] { opacity: 1; }
.steps button[aria-current="step"] i { background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 25%, transparent); }

.shell { max-width: 600px; margin: 0 auto; }
.screen { padding: 8px 16px 56px; }
.screen[hidden] { display: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0 0 12px; letter-spacing: .005em; }
h1 { font-size: clamp(34px, 10vw, 52px); line-height: 1.08; }
h2 { font-size: 28px; line-height: 1.2; }
h3 { font-size: 22px; }
:lang(hi) h1 { font-size: clamp(30px, 8.5vw, 44px); line-height: 1.3; }
:lang(hi) h2 { line-height: 1.4; }
.lede { font-size: 18px; opacity: .9; margin: 0 0 8px; }
.note { font-size: 14px; opacity: .8; margin: 6px 0; }
.who { font: 600 13px var(--text); letter-spacing: .04em; text-transform: uppercase; opacity: .85; margin: 4px 0; }
:lang(hi) .who { text-transform: none; letter-spacing: 0; }

/* surfaces */
.card { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 20px; margin: 12px 0; box-shadow: 0 12px 32px rgb(20 33 43 / .14); }
.card .note { color: var(--muted); opacity: 1; }
.card a { color: var(--blue); }

/* buttons */
.primary { display: inline-block; font: 600 17px var(--text); padding: 13px 22px; background: var(--blue); color: #fff; border: 0; border-radius: 999px; cursor: pointer; text-decoration: none; margin: 8px 8px 8px 0; }
.primary:hover { background: var(--blue-dark); }
body[data-sky="night"] .primary { background: #fff; color: var(--ink); }
.linkbtn { font: inherit; background: none; border: 0; color: inherit; opacity: .8; text-decoration: underline; cursor: pointer; padding: 6px 0; }
select, textarea { width: 100%; font: inherit; color: var(--ink); background: #f3f6f7; border: 2px solid #d3dde3; border-radius: 14px; padding: 12px; margin: 4px 0 8px; }

/* The Night */
#night { color: #fff; padding-top: 24px; }
.timeline { margin: 28px 0 24px; border-left: 2px solid rgb(255 255 255 / .28); padding-left: 20px; }
.event { position: relative; margin: 0 0 30px; }
.event::before { content: ""; position: absolute; left: -27px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: #ffb86b; box-shadow: 0 0 14px #ffb86b; }
.event .when { margin: 0; font: 600 13px var(--text); letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
:lang(hi) .event .when { text-transform: none; letter-spacing: 0; }
.event h3 { margin: 2px 0 0; font-size: 21px; }
.event .num { margin: 0; font: 400 clamp(48px, 15vw, 72px)/1 var(--display); color: #ffcf99; }
.event .unit { margin: 4px 0 0; font-size: 15px; opacity: .85; }
.event .src { margin: 6px 0 0; font-size: 13px; opacity: .7; }
.event a { color: inherit; }
@media (prefers-reduced-motion: no-preference) { .event { animation: rise .7s ease both; } .event:nth-child(2) { animation-delay: .12s; } .event:nth-child(3) { animation-delay: .24s; } .event:nth-child(4) { animation-delay: .36s; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Your Body */
.stat { margin: 4px 0 18px; }
.stat .big { font: 400 clamp(54px, 17vw, 84px)/1 var(--display); color: var(--ink); }
.stat .big small { font: 600 18px var(--text); color: var(--muted); }
.stat p { margin: 6px 0 0; }
.na { font: 600 18px var(--text); color: var(--muted); }

/* cigarette sticks: the unit of air */
.sticks { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 5px; margin: 12px 0 4px; }
.sticks i { width: 9px; height: calc(46px * var(--h)); min-height: 6px; border-radius: 2px; outline: 1px solid rgb(20 33 43 / .22); background: linear-gradient(to top, #d99a4e 0 22%, #f7f5ef 22% 88%, #6b6b6b 88%); }
.sticks b { align-self: center; font: 600 18px var(--text); color: var(--muted); }

/* Game */
.opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; font: 600 17px/1.35 var(--text); color: var(--ink); padding: 14px 16px; margin: 10px 0; background: var(--paper); border: 2px solid transparent; border-radius: 18px; box-shadow: 0 6px 18px rgb(20 33 43 / .1); cursor: pointer; }
.opt:hover { border-color: var(--blue); }
.opt small { font-weight: 400; font-size: 14px; color: var(--muted); }
.opt.locked { background: rgb(255 255 255 / .55); border: 2px dashed rgb(20 33 43 / .35); box-shadow: none; cursor: not-allowed; }
.card.meter { padding: 14px 18px; }
.limits { font-weight: 600; }

/* Map */
.india { display: block; width: 100%; max-width: 520px; margin: 8px auto; }
.india path { fill: rgb(255 255 255 / .82); stroke: rgb(20 33 43 / .35); stroke-width: 1; }
.india g { cursor: pointer; }
.india text { fill: var(--on-sky); paint-order: stroke; stroke: color-mix(in srgb, var(--sky-bottom) 80%, transparent); stroke-width: 3px; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 4px 0 12px; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.chip { display: inline-block; font: 600 13px var(--text); padding: 2px 10px; border-radius: 999px; background: var(--c); color: #fff; vertical-align: middle; text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
.spark { display: block; width: 100%; max-width: 320px; height: 90px; }

/* Act */
canvas.card { padding: 0; width: 100%; max-width: 320px; display: block; }
a.link { display: inline-block; }

@media (prefers-reduced-motion: reduce) { body { transition: none; } .event { animation: none; } }
