@font-face {
  font-family: Vazirmatn;
  src: url('/assets/fonts/vazirmatn-arabic.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #171c33;
  --muted: #4d5268;
  --cream: #f8f5ea;
  --paper: #fffcf2;
  --blue: #243fc8;
  --yellow: #ffda4e;
  --orange: #ff9955;
  --lime: #baf465;
  --line: #d8d6cc;
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(#27294730 1px, transparent 1px);
  background-size: 20px 20px;
}

.topbar, .shell { width: min(calc(100% - 32px), 1060px); margin-inline: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 72px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.22rem; }
.brand b { color: var(--blue); }
.brand-icon { display: block; flex: none; }
.logout { background: var(--paper); font-size: .9rem; }

.shell {
  margin-block: auto;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 5px 7px var(--ink);
  display: grid;
  isolation: isolate;
}

.lab {
  --screen-color: var(--yellow);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 193px;
  background-color: #202e79;
  background-image: linear-gradient(#ffffff19 1px, transparent 1px), linear-gradient(90deg, #ffffff19 1px, transparent 1px);
  background-size: 24px 24px;
  color: #fdf5dd;
  border-radius: 18px 18px 0 0;
  border-bottom: 3px solid var(--ink);
}
.lab-header, .lab-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  background: #151b3a;
  font-size: .72rem;
  font-weight: 800;
}
.lab-header { border-bottom: 1px solid #7f86b2; }
.lab-footer { border-top: 1px solid #7f86b2; }
.lab-code { color: #eceda8; font: 700 .69rem/1.2 ui-monospace, monospace; }
.lab-status { display: flex; align-items: center; gap: 7px; }
.lab-status > i { width: 7px; height: 7px; border-radius: 50%; background: var(--screen-color); }
.hazard { width: 58px; height: 8px; background: repeating-linear-gradient(-45deg, var(--yellow) 0 5px, transparent 5px 9px); }
.machine-bay { position: relative; min-height: 126px; display: grid; place-items: center; }
.machine-bay::before {
  content: '';
  position: absolute;
  width: min(65%, 255px);
  aspect-ratio: 1;
  border: 1px dashed #ffffff6b;
  border-radius: 50%;
}
.bolt { position: absolute; color: var(--screen-color); font: 700 24px/1 system-ui, sans-serif; }
.bolt-top { top: 15%; inset-inline-start: 13%; }
.bolt-bottom { bottom: 11%; inset-inline-end: 14%; font-size: 19px; }
.machine {
  direction: ltr;
  position: absolute;
  width: 226px;
  transform: scale(.48) rotate(-7deg);
  transition: transform 220ms cubic-bezier(.2,.75,.35,1.25);
}
.antenna {
  position: absolute;
  z-index: 1;
  left: 63%;
  bottom: calc(100% - 5px);
  width: 12px;
  height: 36px;
  border: 3px solid var(--ink);
  background: #8ea2ff;
  transform: rotate(16deg);
}
.antenna::before {
  content: '';
  position: absolute;
  top: -16px;
  left: -8px;
  width: 23px;
  height: 23px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--screen-color);
  box-shadow: 2px 2px var(--ink);
}
.machine-shell {
  position: relative;
  z-index: 2;
  background: #6e8bff;
  padding: 19px 15px 13px;
  border: 4px solid var(--ink);
  border-radius: 24px;
  box-shadow: 5px 6px var(--ink), 12px 13px #1016359c, inset 0 3px #c5cbff;
}
.screen {
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
  height: 112px;
  border: 4px solid var(--ink);
  border-radius: 17px;
  background-color: var(--screen-color);
  background-image: repeating-linear-gradient(0deg, transparent 0 5px, #24223519 5px 6px);
  box-shadow: inset 0 3px #171c3332;
  transition: background-color 180ms ease-out;
}
.screen::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px dashed #171c336b;
  border-radius: 10px;
}
.face { position: relative; display: flex; gap: 42px; align-items: center; justify-content: center; padding-bottom: 20px; }
.face i { display: block; width: 13px; height: 22px; border-radius: 3px; background: var(--ink); }
.face i:first-child::before {
  content: '';
  display: block;
  width: 19px;
  height: 4px;
  margin: -7px 0 0 -3px;
  background: var(--ink);
  transform: rotate(-18deg);
}
.face b { position: absolute; bottom: 1px; width: 23px; height: 5px; background: var(--ink); transform: rotate(-8deg); }
.screw { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.screw-top { top: 7px; left: 13px; }
.screw-bottom { bottom: 8px; right: 13px; }
.machine-controls { display: flex; align-items: center; gap: 9px; margin-top: 10px; }
.vents {
  width: 54px;
  height: 12px;
  margin-right: auto;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 8px);
}
.control-light { width: 20px; height: 11px; border: 2px solid var(--ink); border-radius: 5px; background: var(--lime); }
.control-light:last-of-type { background: var(--orange); }

.content { display: grid; align-content: center; min-width: 0; padding: 25px clamp(15px, 6vw, 32px) 23px; }
section { min-width: 0; animation: arrive 240ms cubic-bezier(.2,.75,.28,1.15) both; }
@keyframes arrive { from { opacity: .65; transform: translateY(8px) scale(.985); } }
.kicker { color: var(--blue); font-weight: 850; margin: 0 0 8px; font-size: .85rem; display: flex; align-items: center; gap: 7px; }
.kicker::before { content: ''; width: 7px; height: 7px; transform: rotate(45deg); background: currentColor; }
h1 { margin: 0; font-size: clamp(1.8rem, 7.3vw, 3rem); font-weight: 900; line-height: 1.27; }
h1:focus { outline: none; }
h1 em { font-style: normal; color: var(--blue); }
h1 .emoji { display: inline-block; font-size: .72em; vertical-align: .1em; }
.intro { margin: 10px 0 23px; color: var(--muted); font-size: .96rem; line-height: 1.8; }
.login-brand { display: flex; align-items: center; gap: clamp(8px, 2vw, 18px); }
.login-brand img { display: block; flex: none; width: clamp(49px, 12vw, 76px); height: auto; }
#login h1 { font-size: clamp(1.56rem, 5.7vw, 2.8rem); }
label { display: block; margin-bottom: 5px; font-weight: 800; font-size: .91rem; }
input:not([type='radio']) {
  width: 100%;
  min-height: 48px;
  border: 2px solid #898b9c;
  border-radius: 9px;
  background: #fff;
  padding: 8px 11px;
  color: var(--ink);
  margin-bottom: 13px;
}
.password-field { position: relative; }
.password-field input { padding-left: 70px; }
.password-field button { position: absolute; inset-inline-end: 3px; top: 2px; min-height: 44px; padding-inline: 9px; }
button, input { font: inherit; }
button {
  --button-color: var(--cream);
  min-height: 46px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--button-color);
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  box-shadow: 2px 3px var(--ink);
  transition: box-shadow 140ms ease-out, transform 140ms cubic-bezier(.2,.75,.28,1.4), background-color 140ms ease-out;
}
@media (hover: hover) {
  button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 2px 5px var(--ink); }
}
button:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 0 1px var(--ink); }
button:disabled { cursor: wait; opacity: .68; }
button:focus-visible, input:focus-visible, .history-list:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.primary { --button-color: var(--blue); color: white; }
.secondary { --button-color: var(--yellow); }
.quiet { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink); }
.quiet:hover:not(:disabled) { background: #eae8df; box-shadow: none; transform: none; }
.logout { border-color: var(--ink); background: var(--paper); box-shadow: 2px 3px var(--ink); }
.full { width: 100%; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choices button { min-height: 62px; font-size: 1.14rem; }
#yes { --button-color: var(--yellow); }
#no { --button-color: var(--lime); color: var(--ink); }
.history-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  padding-inline: 4px 7px;
  border-top: 1px dashed #aaa9a8;
  border-radius: 0;
  font-size: .92rem;
  color: var(--blue);
}
.history-link span:last-child { font-size: 1.14rem; }
.notice, .action-status, #music-status { font-size: .9rem; margin: 10px 0 0; }
.action-status, #music-status { color: var(--muted); }
.notice { color: #8a2a08; font-weight: 750; }
.notice:empty, .action-status:empty, #music-status:empty, #history-status:empty { margin: 0; }
.back { margin-top: 5px; }

#severity h1, #owner h1 { font-size: clamp(1.65rem, 6.6vw, 2.45rem); }
.readout {
  container-type: inline-size;
  margin-top: 12px;
  padding: 9px 12px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff8e2;
  border: 2px solid var(--ink);
  box-shadow: inset 0 0 0 1px #58658f;
}
.readout-value { display: flex; align-items: baseline; gap: 8px; }
.readout-value span { font-size: .76rem; color: #d6dafa; }
.readout-value .level-mode {
  margin-inline-start: auto;
  padding: 2px 8px;
  border: 1px solid #6d7599;
  border-radius: 6px;
  background: #2a3255;
  color: #fff8dc;
  font-weight: 750;
}
.level-mode:empty { visibility: hidden; }
#level-number { font-size: 2.4rem; line-height: 1.15; font-weight: 900; color: var(--yellow); font-variant-numeric: tabular-nums; }
.level-note { margin: 5px 0 9px; font-size: .89rem; line-height: 1.5; min-height: 1.5em; }
#levels { min-width: 0; margin: 0; padding: 0; border: 0; }
.gauge {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  touch-action: none;
  user-select: none;
}
@container (min-width: 400px) {
  .gauge { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}
.meter-step {
  --tone: var(--lime);
  position: relative;
  display: grid;
  grid-template-rows: 13px auto;
  gap: 5px;
  min-height: 51px;
  padding: 5px 3px 2px;
  margin: 0;
  border-radius: 6px;
  cursor: pointer;
}
.meter-step:nth-child(n+4) { --tone: var(--yellow); }
.meter-step:nth-child(n+7) { --tone: var(--orange); }
.meter-step:nth-child(10) { --tone: #ff655d; }
.meter-segment {
  border: 1px solid #85899b;
  border-radius: 4px;
  background: #5b6071;
  transition: background-color 105ms ease-out, transform 135ms cubic-bezier(.2,.82,.36,1.22), box-shadow 140ms;
}
.meter-segment.lit { background: var(--tone); border-color: var(--tone); }
.meter-step[data-active] .meter-segment { transform: scaleY(1.17); box-shadow: 0 0 8px var(--tone); }
.meter-number {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 5px;
  color: #edf0ff;
  background: #282f4d;
  font-weight: 850;
  transition: background-color 105ms, color 105ms, border-color 105ms;
}
.meter-step[data-selected] .meter-number { border-color: #a9b6ff; }
.meter-step[data-active] .meter-number { background: var(--tone); color: var(--ink); }
.meter-step:has(input:focus-visible) { outline: 2px solid #fff1a7; outline-offset: 1px; }
.range-labels { display: flex; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: .78rem; margin: 6px 0 11px; }

.record-card { background: #eef1ff; border: 2px solid var(--ink); border-radius: 10px; padding: 13px 12px; margin-top: 15px; }
.record-card strong { display: block; font-size: 1.08rem; }
.record-card p { margin: 4px 0 0; color: var(--muted); }
time { font-variant-numeric: tabular-nums; }
.history-list {
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  min-height: 60px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fffefa;
}
table { border-collapse: collapse; width: 100%; text-align: right; font-size: .82rem; }
th, td { padding: 5px 6px; }
th { position: sticky; top: 0; background: #e6eaff; }
td { border-top: 1px solid var(--line); }
td time { display: inline-block; direction: ltr; white-space: nowrap; }

body:has(#shell[data-view='history']) { min-height: 0; height: 100svh; height: 100dvh; }
body:has(#shell[data-view='history']) .topbar { min-height: 56px; }
body:has(#shell[data-view='history']) > footer { display: none; }
.shell[data-view='history'] {
  flex: 1;
  min-height: 0;
  margin-block: 0 12px;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.shell[data-view='history'] .lab { display: none; }
.shell[data-view='history'] .content {
  grid-template-rows: minmax(0, 1fr);
  grid-auto-rows: auto;
  padding: 8px clamp(9px, 3vw, 28px) 9px;
}
#history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  animation: none;
}
#history h1 { font-size: clamp(1.3rem, 5.6vw, 2rem); }
#history-status { margin: 0; }
#history-status:empty { display: none; }
.report-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
  margin: -2px;
}
.history-chart { min-width: 0; flex: none; }
.report-actions { flex: none; }
.report-actions button { min-height: 42px; padding-block: 4px; }
.anger-trend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin-bottom: 6px;
  padding: 4px 7px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #e6eaff;
}
.anger-trend[data-direction='down'] { background: #e2f9bd; }
.anger-trend[data-direction='up'] { background: #ffdfb6; }
.anger-trend p { margin: 0; font-size: .8rem; }
.trend-title, #trend-message { font-weight: 850; }
#trend-dates { margin-inline-start: auto; color: var(--muted); font-size: .75rem; }
#trend-dates:empty { display: none; }
.chart-card { padding: clamp(6px, 1.5vw, 12px); border: 2px solid var(--ink); border-radius: 12px; background: #fffefa; animation: none; }
.chart-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.chart-heading h2 { margin: 0; font-size: clamp(.98rem, 3vw, 1.2rem); font-weight: 900; }
.chart-filter select {
  min-height: 34px;
  padding: 2px 6px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: #ffeb98;
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
}
.chart-filter select:focus-visible, .chart-scroll:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.chart-empty { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.chart-empty:empty { display: none; }
#chart-body { margin-top: 4px; }
.chart-axis-title {
  align-self: start;
  justify-self: center;
  inline-size: calc(var(--chart-height) + 12px);
  margin: 0;
  font-size: .74rem;
  font-weight: 850;
  line-height: 14px;
  text-align: center;
  writing-mode: vertical-rl;
  text-orientation: sideways;
  transform: rotate(180deg);
}
.chart-stage {
  --chart-height: clamp(66px, calc(28svh - 91px), 180px);
  --chart-height: clamp(66px, calc(28dvh - 91px), 180px);
  display: grid;
  grid-template-columns: 15px 23px minmax(0, 1fr);
  padding: 4px 5px 3px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #1b2245;
  color: #e0e6ff;
}
.chart-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  height: calc(var(--chart-height) + 12px);
  margin-top: 0;
  padding-top: 1px;
  font-size: .7rem;
  line-height: 12px;
}
.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #8d9cff #323a65;
  scrollbar-width: thin;
}
.chart-scroll:focus-visible { outline-color: var(--yellow); outline-offset: -2px; }
.chart-timeline { min-width: calc(var(--day-count) * 38px); padding-top: 6px; }
.chart-plot {
  position: relative;
  height: calc(var(--chart-height) + 1px);
  border-bottom: 1px solid #929ecb;
  background-image: linear-gradient(to bottom, #8091c549 1px, transparent 1px),
                    linear-gradient(to right, #8091c534 1px, transparent 1px);
  background-size: 100% 20%, calc(100% / var(--day-count)) 100%;
}
.chart-point {
  --bar-color: #c7f274;
  position: absolute;
  left: var(--spot);
  transform: translateX(-50%);
  width: calc(100% / var(--day-count));
  inset-block: 0;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 5px 5px 0 0;
  padding: 0;
  box-shadow: none;
  transition: background-color 150ms;
}
.chart-point[data-score='0'] { --bar-color: #6cec9e; }
.chart-point:is([data-score='4'], [data-score='5'], [data-score='6']) { --bar-color: #ffd262; }
.chart-point:is([data-score='7'], [data-score='8'], [data-score='9']) { --bar-color: #ff975b; }
.chart-point[data-score='10'] { --bar-color: #ff6269; }
button.chart-point:is(:hover, :focus-visible, :active, [data-active]) {
  transform: translateX(-50%);
  box-shadow: none;
  background: #ecf0ff25;
  z-index: 1;
}
.chart-point:focus-visible { outline: 2px solid #fff1a7; outline-offset: -2px; }
.chart-bar {
  position: absolute;
  display: grid;
  place-items: start center;
  width: min(70%, 34px);
  left: 50%;
  bottom: 0;
  height: calc(var(--score) * 10%);
  transform: translateX(-50%);
  transform-origin: bottom;
  background: var(--bar-color);
  border-radius: 6px 6px 2px 2px;
  color: #171c33;
  font-size: .76rem;
  line-height: 1.2;
  padding-top: 2px;
  animation: chart-grow 300ms cubic-bezier(.18,.75,.24,1) both;
}
.chart-point[data-score='0'] .chart-bar {
  width: 24px;
  height: 18px;
  border-radius: 6px;
  bottom: -6px;
  z-index: 1;
}
@keyframes chart-grow { from { opacity: .6; transform: translateX(-50%) scaleY(.2); } }
.chart-dates { position: relative; height: 28px; color: #dce3ff; }
.chart-date {
  position: absolute;
  left: var(--spot);
  top: 12px;
  transform: translateX(-50%);
  font-size: .7rem;
  white-space: nowrap;
}
.chart-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1px 7px; margin: 4px 0; color: var(--muted); font-size: .73rem; }
.chart-caption b { color: #1c6141; }
.chart-detail {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  gap: 2px 10px;
  min-height: 44px;
  padding: 3px 7px;
  border: 1px dashed #737eac;
  border-radius: 7px;
  background: #f2f4fd;
  font-size: .8rem;
}
.chart-detail-date { font-weight: 850; }
.chart-detail-value { color: var(--blue); font-weight: 800; }
.chart-detail-status { flex-basis: 100%; margin: 0; }
.chart-prompt { color: var(--muted); }

@media (min-width: 720px), (min-width: 560px) and (max-height: 520px) {
  .report-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 12px; }
  .report-body:has(.history-list[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .history-chart, .history-list { align-self: start; }
  .history-list { max-height: 100%; }
  .chart-stage {
    --chart-height: clamp(72px, calc(52svh - 155px), 270px);
    --chart-height: clamp(72px, calc(52dvh - 155px), 270px);
  }
}

@media (min-width: 560px) and (max-height: 460px) {
  body:has(#shell[data-view='history']) .topbar { min-height: 50px; }
  .shell[data-view='history'] .content { padding-block: 6px 8px; }
  #history { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); gap: 5px 8px; }
  .report-body, #history-status { grid-column: 1 / -1; }
  .report-actions { grid-column: 2; grid-row: 1; }
  .report-actions button { min-height: 38px; }
  .report-body:has(.history-list:not([hidden])) { grid-template-rows: auto minmax(0, 1fr); gap: 6px 12px; }
  .report-body:has(.history-list:not([hidden])) .history-chart { display: contents; }
  .report-body:has(.history-list:not([hidden])) .chart-card { grid-area: 1 / 1 / 3 / 2; align-self: start; }
  .report-body:has(.history-list:not([hidden])) .anger-trend { grid-area: 1 / 2; margin: 0; }
  .report-body:has(.history-list:not([hidden])) .history-list { grid-area: 2 / 2; }
  .chart-filter select { min-height: 30px; }
  .chart-detail { min-height: 0; }
  .chart-detail-status { flex-basis: auto; }
  .chart-stage {
    --chart-height: clamp(64px, calc(38svh - 83px), 110px);
    --chart-height: clamp(64px, calc(38dvh - 83px), 110px);
  }
}

.shell[data-view='celebration'] { background: #f1ffc8; }
.shell[data-view='celebration'] .lab { --screen-color: var(--lime); background-color: #244d84; }
.shell[data-view='celebration'] .face b { height: 12px; background: transparent; border-bottom: 5px solid var(--ink); border-radius: 0 0 12px 12px; transform: none; }
.shell[data-view='celebration'] .face i { height: 10px; }
.shell[data-view='celebration'] .face i::before { display: none; }
.shell[data-view='celebration'] .machine { animation: jackpot 650ms cubic-bezier(.2,.8,.3,1) both; }
#celebration h1 { font-size: clamp(2.1rem, 8.8vw, 3.6rem); animation: jackpot-title 500ms cubic-bezier(.18,.82,.37,1.15) both; }
#celebration h1 em { display: inline-block; background: var(--yellow); padding-inline: 5px; box-shadow: 2px 3px var(--ink); transform: rotate(-3deg); }
@keyframes jackpot { 35% { scale: 1.18; rotate: 12deg; } 65% { scale: .97; rotate: -5deg; } }
@keyframes jackpot-title { from { transform: scale(.72) rotate(3deg); } 65% { transform: scale(1.04) rotate(-1deg); } }
.shell[data-level='warning'] .lab { --screen-color: #ffbc61; }
.shell[data-level='alert'] .lab { --screen-color: #ff9b58; }
.shell[data-level='max'] .lab { --screen-color: #ff794f; }
.shell:is([data-level='alert'], [data-level='max']) .face i:first-child::before { transform: rotate(26deg); }
.shell:is([data-level='alert'], [data-level='max']) .face b { transform: none; height: 9px; background: transparent; border-top: 5px solid var(--ink); border-radius: 10px 10px 0 0; }

#fireworks { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }
footer { width: fit-content; margin: 20px auto 0; padding: 8px 10px 14px; color: var(--muted); font-size: .8rem; font-weight: 700; }
footer span { color: var(--blue); margin-inline-end: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 720px) {
  .topbar, .shell { width: min(calc(100% - 80px), 1060px); }
  .topbar { min-height: 86px; }
  .shell { grid-template-columns: 1.12fr 1fr; border-radius: 27px; box-shadow: 8px 10px var(--ink); }
  .lab { grid-column: 2; grid-row: 1; border-radius: 22px 0 0 22px; border-bottom: 0; border-inline-start: 3px solid var(--ink); }
  .lab-header, .lab-footer { padding: 15px 17px; font-size: .83rem; }
  .lab-code { font-size: .76rem; }
  .machine-bay { min-height: 350px; }
  .machine { transform: rotate(-7deg) scale(.95); }
  .bolt-top { top: 21%; inset-inline-start: 15%; font-size: 33px; }
  .bolt-bottom { bottom: 17%; inset-inline-end: 16%; font-size: 25px; }
  .content { grid-column: 1; grid-row: 1; padding: clamp(25px, 4vw, 48px); }
  h1 { font-size: clamp(2.25rem, 4.6vw, 3.55rem); }
  .choices button { min-height: 68px; }
  table { font-size: .92rem; }
  th, td { padding: 9px 12px; }
  footer { margin-top: 30px; }
}

@media (max-width: 360px) {
  .topbar, .shell { width: calc(100% - 26px); }
  .lab { min-height: 177px; }
  .machine-bay { min-height: 110px; }
  .machine { transform: scale(.42) rotate(-7deg); }
  .intro { margin-bottom: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .meter-step[data-active] .meter-segment { transform: none; }
}
