:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --card: #161b22;
  --border: #262d36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #f7630c;
  --ok: #2ea043;
  --warn: #d29922;
  --bad: #da3633;
  --info: #58a6ff;
  --radius: 12px;

  --ember: #ff6a00;
  --ember-hot: #ffd166;
  --ember-deep: #c22a06;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body { position: relative; min-height: 100vh; overflow-x: hidden; }

.wrap {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ---------------------------------------------------------------- fire */

/* Ambient heat rising from the bottom of the viewport. */
.heat-glow {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
  background:
    radial-gradient(120% 100% at 50% 130%, rgba(255, 92, 0, .30) 0%, rgba(220, 48, 0, .12) 38%, rgba(120, 10, 0, 0) 72%),
    radial-gradient(80% 70% at 50% 108%, rgba(255, 170, 40, .22) 0%, rgba(255, 90, 0, 0) 60%);
  filter: blur(6px);
}

.page-fire {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.banner-fire {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 148px;
  z-index: 0;
  pointer-events: none;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------------------------------------------------------------- head */

.head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.head-row { display: flex; gap: 14px; align-items: center; }

.logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 21px;
}

h1 { font-size: 22px; margin: 0; letter-spacing: -0.2px; }

.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 9px 15px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; }

/* -------------------------------------------------------------- banner */

.banner {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px 22px;
  margin-bottom: 20px;
  /* padding-bottom is deliberately NOT transitioned: the flame band is a
     layout reservation, and animating it can leave the fire overlapping the
     text. The flame itself fades in via the canvas, not via layout. */
  transition: border-color .4s ease, box-shadow .4s ease;
}

.banner-content { position: relative; z-index: 2; }

/* Dark wash over the flame so the text stays readable. */
.banner-scrim {
  position: absolute;
  inset: 0 0 148px 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
  background: linear-gradient(
    180deg,
    rgba(22, 27, 34, .96) 0%,
    rgba(22, 27, 34, .88) 55%,
    rgba(22, 27, 34, .55) 88%,
    rgba(22, 27, 34, 0) 100%
  );
}

.state-outage .banner-scrim { opacity: 1; }

.banner-main { display: flex; gap: 14px; align-items: flex-start; }

.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 13px;
  background: var(--muted);
}

.state-outage { border-left-color: var(--bad); }
/* Reserve a band at the bottom of the banner for the flames. */
.state-outage { padding-bottom: 152px; }
.state-outage .dot {
  background: var(--bad);
  animation: pulse 1.6s ease-in-out infinite;
}
.state-outage .banner-title {
  color: #ff7b72;
  text-shadow: 0 0 18px rgba(255, 90, 20, .55);
  animation: titleFlicker 3.2s ease-in-out infinite;
}

@keyframes titleFlicker {
  0%, 100% {
    text-shadow: 0 0 14px rgba(255, 90, 20, .45), 0 0 32px rgba(255, 60, 0, .25);
  }
  28% {
    text-shadow: 0 0 22px rgba(255, 130, 30, .8), 0 0 46px rgba(255, 70, 0, .4);
  }
  52% {
    text-shadow: 0 0 12px rgba(255, 90, 20, .4), 0 0 26px rgba(255, 60, 0, .18);
  }
  74% {
    text-shadow: 0 0 26px rgba(255, 150, 40, .9), 0 0 56px rgba(255, 80, 0, .45);
  }
}
.state-outage {
  box-shadow:
    0 0 0 1px rgba(255, 110, 20, .18),
    0 10px 40px -12px rgba(255, 80, 0, .55),
    inset 0 -60px 80px -60px rgba(255, 90, 0, .5);
}

.state-ok { border-left-color: var(--ok); }
.state-ok .dot { background: var(--ok); }
.state-ok .banner-title { color: #56d364; }

.state-maintenance { border-left-color: var(--warn); }
.state-maintenance .dot { background: var(--warn); }
.state-maintenance .banner-title { color: #e3b341; }

.state-stale { border-left-color: var(--warn); }
.state-stale .dot { background: var(--warn); }
.state-stale .banner-title { color: #e3b341; }

.state-loading { border-left-color: var(--info); }
.state-loading .dot { background: var(--info); animation: pulse 1.6s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.banner-title { font-size: 20px; font-weight: 650; letter-spacing: -0.2px; }
.banner-sub { color: var(--muted); font-size: 14px; margin-top: 3px; }

.state-outage .banner-sub { color: #d9a184; }

/* Our own dramatic voice. Microsoft's own wording is rendered verbatim and
   deliberately NOT shouted, so the two sources stay distinguishable. */
.dr {
  text-transform: uppercase;
  letter-spacing: .045em;
  font-weight: 650;
}

.card-title.dr,
.meta-label.dr {
  letter-spacing: .09em;
}

.banner-meta {
  display: flex;
  gap: 28px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.meta-value { font-size: 14px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- cards */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px 22px;
  margin-bottom: 16px;
  transition: border-color .4s ease, box-shadow .4s ease;
}

.card-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

.card-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin: 0 0 14px;
  font-weight: 600;
}

.card-head-row .card-title { margin-bottom: 14px; }

/* Cards catch a warm edge from the fire above them. */
body.firing .card {
  border-color: rgba(255, 110, 20, .16);
  box-shadow: 0 8px 30px -18px rgba(255, 80, 0, .45);
}

/* --------------------------------------------------------------- chips */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  position: relative;
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(248, 81, 73, .12);
  border: 1px solid rgba(248, 81, 73, .32);
  color: #ffa198;
  font-size: 13px;
  font-weight: 500;
}

body.firing .chip {
  color: #ffd9a8;
  border-color: rgba(255, 140, 40, .5);
  background: linear-gradient(180deg, rgba(255, 110, 20, .22), rgba(200, 45, 5, .14));
  box-shadow: 0 0 16px -4px rgba(255, 110, 20, .6), inset 0 1px 0 rgba(255, 200, 120, .25);
  animation: chipFlicker 2.6s ease-in-out infinite;
}

body.firing .chip:nth-child(2n) { animation-delay: -.7s; }
body.firing .chip:nth-child(3n) { animation-delay: -1.4s; }

@keyframes chipFlicker {
  0%, 100% { box-shadow: 0 0 16px -4px rgba(255, 110, 20, .55), inset 0 1px 0 rgba(255, 200, 120, .25); }
  50% { box-shadow: 0 0 26px -2px rgba(255, 150, 50, .85), inset 0 1px 0 rgba(255, 210, 140, .35); }
}

/* -------------------------------------------------------------- detail */

.incident + .incident {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.incident-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.incident-head h3 { margin: 0; font-size: 16px; font-weight: 620; }

body.firing .incident-head h3 { color: #ffcf9a; }

.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.badge-servicedegradation,
.badge-serviceincident,
.badge-servicesecurityevent {
  background: rgba(248, 81, 73, .14);
  border-color: rgba(248, 81, 73, .38);
  color: #ff7b72;
}

body.firing .badge-servicedegradation,
body.firing .badge-serviceincident,
body.firing .badge-servicesecurityevent {
  color: #ffb066;
  border-color: rgba(255, 130, 40, .5);
  background: linear-gradient(180deg, rgba(255, 110, 20, .28), rgba(180, 35, 5, .16));
  box-shadow: 0 0 18px -3px rgba(255, 110, 20, .75);
  animation: chipFlicker 1.8s ease-in-out infinite;
}

.badge-servicemaintenance {
  background: rgba(210, 153, 34, .14);
  border-color: rgba(210, 153, 34, .38);
  color: #e3b341;
}

.badge-serviceoperational,
.badge-available {
  background: rgba(46, 160, 67, .14);
  border-color: rgba(46, 160, 67, .38);
  color: #56d364;
}

.field { margin-bottom: 13px; }

.field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 3px;
}

/* Microsoft's text is reproduced exactly as published. */
.field-value {
  font-size: 14.5px;
  white-space: pre-wrap;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

body.firing .field-value { color: #f0ddd0; }

/* ------------------------------------------------------------- history */

.hist-strip { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 10px; }

.pip {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: var(--border);
}

.pip-outage {
  background: linear-gradient(180deg, #ff8a1e, #c92a05);
  box-shadow: 0 0 8px -1px rgba(255, 110, 20, .85);
}
.pip-ok { background: var(--ok); }
.pip-maintenance { background: var(--warn); }
.pip-loading, .pip-stale { background: var(--muted); }

/* --------------------------------------------------------------- misc */

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

.foot p { margin: 0; }
.foot a { color: var(--info); }
.foot p.sig { margin-top: 9px; color: #c08a6a; font-style: italic; }

@media (max-width: 600px) {
  .wrap { padding: 22px 14px 48px; }
  .banner-meta { gap: 18px; }
  .banner-title { font-size: 18px; }
  h1 { font-size: 19px; }
  .banner { padding-bottom: 118px; }
  .state-outage { padding-bottom: 118px; }
  .banner-fire { height: 116px; }
  .banner-scrim { inset: 0 0 116px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none !important; }
  .state-outage .banner-title { animation: none !important; }
  body.firing .chip,
  body.firing .badge-servicedegradation,
  body.firing .badge-serviceincident,
  body.firing .badge-servicesecurityevent { animation: none !important; }
  .heat-glow, .banner-scrim { transition: none; }
}

/* ------------------------------------------------------------------ chaos
 *
 * The meltdown state. Whenever anything is offline the page goes fully
 * unhinged: a ticker drags one shared message across the screen, the
 * headline moves in its own way, the chips strobe, the headings wobble and
 * lights flash all over the place. When everything is up, none of this
 * exists.
 *
 * The shape of the meltdown is re-rolled on every check - which motion each
 * element gets, how fast, how many lights, where they sit, which way the
 * ticker scrolls - so two chaotic refreshes never look alike.
 */

.chaos-lights {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
}

.chaos-light {
  position: absolute;
  display: block;
  border-radius: 50%;
  mix-blend-mode: screen;
  opacity: 0;
  animation-name: chaosBlink;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  will-change: opacity, transform;
}

.chaos-light-big {
  animation-name: chaosGlow;
  filter: blur(9px);
}

/* --- the ticker ------------------------------------------------------- */

.chaos-ticker {
  position: relative;
  display: none;
  overflow: hidden;
  white-space: nowrap;
  margin: 0 0 18px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 90, 20, .3);
  border-bottom: 1px solid rgba(255, 90, 20, .3);
  background: rgba(255, 59, 48, .07);
}

body.chaos .chaos-ticker { display: block; }

/* Soften the edges so the text runs off rather than being chopped. */
.chaos-ticker {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 2.5%, #000 97.5%, transparent);
}

.chaos-ticker-track {
  display: inline-block;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  will-change: transform;
  animation: chaosScroll var(--ticker-dur, 22s) linear infinite;
}

.chaos-ticker-track.reverse { animation-direction: reverse; }

.chaos-ticker-track.static {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes chaosScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* --- the many ways text moves ------------------------------------------ */

@keyframes chaosBlink {
  0%, 100% { opacity: 0; transform: scale(0.45); }
  30% { opacity: 0.92; transform: scale(1.25); }
  55% { opacity: 0.12; transform: scale(0.8); }
  75% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes chaosGlow {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 0.5; transform: scale(1.25); }
}

@keyframes chaosSpinA {
  0%, 100% { transform: rotate(-3deg) scale(1); }
  50% { transform: rotate(3deg) scale(1.05); }
}

@keyframes chaosSpinB {
  0%, 100% { transform: rotate(2deg) translateY(0); }
  25% { transform: rotate(-4deg) translateY(-4px); }
  75% { transform: rotate(4deg) translateY(3px); }
}

@keyframes chaosSpinC {
  0%, 100% { transform: skewX(0deg) scale(1); }
  50% { transform: skewX(-9deg) scale(1.04); }
}

@keyframes chaosShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -3px); }
  80% { transform: translate(2px, 3px); }
}

@keyframes chaosSlide {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes chaosSkew {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(-7deg); }
}

@keyframes chaosPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes chaosTilt {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-4deg) scale(1.03); }
  70% { transform: rotate(4deg) scale(0.98); }
}

@keyframes chaosDrop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes chaosTextFlash {
  0%, 100% { color: var(--chaos-c1, #ff6a3d); }
  33% { color: var(--chaos-c2, #ffd60a); }
  66% { color: var(--chaos-c3, #ff3b30); }
}

@keyframes chaosTitleGlow {
  0%, 100% { text-shadow: 0 0 14px rgba(255, 90, 20, .45), 0 0 32px rgba(255, 60, 0, .25); }
  50% { text-shadow: 0 0 26px rgba(255, 120, 40, .9), 0 0 60px rgba(255, 40, 0, .55); }
}

@keyframes chaosChipFlash {
  0%, 49% {
    border-color: rgba(247, 99, 12, 0.38);
    box-shadow: 0 0 0 rgba(255, 90, 20, 0);
  }
  50%, 100% {
    border-color: rgba(255, 214, 10, 0.95);
    box-shadow: 0 0 20px rgba(255, 90, 20, 0.8);
  }
}

@keyframes chaosDotFlash {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 214, 10, 0); }
  50% { opacity: 0.25; box-shadow: 0 0 16px 4px rgba(255, 214, 10, 0.85); }
}

@keyframes chaosLabelFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* --- wiring ------------------------------------------------------------ */

body.chaos .banner-title {
  /* A long headline rotated a few degrees dips at its ends, so give it room
   * to swing without landing on the subtitle. */
  padding-bottom: 18px;
  animation:
    var(--chaos-anim, chaosShake) var(--chaos-dur, 0.6s) ease-in-out infinite,
    chaosTextFlash var(--chaos-flash-dur, 0.7s) steps(4, end) infinite,
    chaosTitleGlow 2.4s ease-in-out infinite;
  animation-delay: var(--chaos-delay, 0s), var(--chaos-delay, 0s), 0s;
}

body.chaos .banner-sub {
  /* Slower and shallower than the headline - this one carries words people
     are actually trying to read. */
  animation:
    var(--chaos-anim, chaosPulse) var(--chaos-dur, 1.2s) ease-in-out infinite,
    chaosLabelFlash 1.6s steps(2, end) infinite;
  animation-delay: var(--chaos-delay, 0s), var(--chaos-delay, 0s);
}

body.chaos .dot {
  animation: chaosDotFlash 0.45s steps(2, end) infinite;
}

body.chaos .chip {
  animation:
    chaosChipFlash var(--chip-dur, 0.8s) steps(2, end) infinite,
    var(--chaos-anim, chaosPulse) var(--chaos-dur, 1s) ease-in-out infinite;
  animation-delay: var(--chip-delay, 0s), var(--chip-delay, 0s);
}

body.chaos .badge {
  animation:
    chaosChipFlash 0.6s steps(2, end) infinite,
    var(--chaos-anim, chaosTilt) var(--chaos-dur, 0.8s) ease-in-out infinite;
}

body.chaos .badge-refrain {
  max-width: 60%;
}

body.chaos .meta-label {
  animation: chaosLabelFlash 1.1s steps(2, end) infinite;
}

body.chaos .meta-value {
  animation: var(--chaos-anim, chaosShake) var(--chaos-dur, 0.6s) ease-in-out infinite;
}

body.chaos .card-title {
  animation: var(--chaos-anim, chaosSlide) var(--chaos-dur, 1s) ease-in-out infinite;
}

/* Reduced motion: the shared message stays, every movement goes. */
@media (prefers-reduced-motion: reduce) {
  .chaos-light { display: none; }
  .chaos-ticker-track { animation: none; }
  body.chaos .banner-title { padding-bottom: 0; }
  body.chaos .banner-title,
  body.chaos .banner-sub,
  body.chaos .dot,
  body.chaos .chip,
  body.chaos .badge,
  body.chaos .meta-label,
  body.chaos .meta-value,
  body.chaos .card-title { animation: none !important; }
}
