/* X Series screen replica skin — modeled on the Operator's Guide (9650-002355-01) screen
   figures: white top bar, yellow message bar, left quick-access keys, black waveform area,
   bottom parameter tiles with colored header bands. Training simulator — not a medical device. */
:root {
  /* parameter colors per the real display */
  --ecg: #00e75c;      /* ECG / HR  green   */
  --spo2: #ffe600;     /* SpO2      yellow  */
  --nibp: #00cfff;     /* NIBP      cyan    */
  --co2: #ff2da0;      /* CO2/Resp  magenta */
  --ibp: #ff4040;      /* IBP P1    red     */
  --temp: #ffffff;     /* Temp      white   */
  --screen: #000000;
  --key-bg: #23272c;
  --key-edge: #3d434b;
  --bezel: #16181b;
  --msg-yellow: #ffd400;
  --danger: #ff3b3b;
  --charge: #ffcc00;
  --dim: #9aa4b0;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  background: #0a0b0d;
  color: #e8edf2;
  font-family: "Arial Narrow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none; user-select: none;
  overflow: hidden;
}

/* ============ device = unit-top + screen + bezel controls ============ */
#device {
  height: 100vh; width: 100vw;
  display: grid;
  grid-template-rows: 40px 1fr auto;
  background: var(--bezel);
  padding: 8px; gap: 8px;
}

/* --- unit top: alarm beacons + name + green power switch --- */
#unitTop { display: flex; align-items: center; gap: 14px; padding: 0 6px; }
#beacons { display: flex; gap: 6px; }
#beacons .beacon { width: 12px; height: 12px; border-radius: 50%; opacity: .25; }
#beacons .beacon.red { background: #ff3b3b; }
#beacons .beacon.yellow { background: #ffcc00; }
#beacons .beacon.green { background: #17e05a; }
#beacons.selftest .beacon { animation: beaconflash .35s infinite alternate; }
#beacons.selftest .beacon.yellow { animation-delay: .12s; }
#beacons.selftest .beacon.green { animation-delay: .24s; }
@keyframes beaconflash { from { opacity: .2; } to { opacity: 1; } }
.unit-name { color: #7f8892; font-size: 13px; letter-spacing: .5px; }
.unit-name b { color: #d7dde4; }
#unitTop .unit-name { flex: 1; }
#powerBtn {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  background: radial-gradient(circle at 40% 35%, #2ecf6b, #0c7a38);
  border: 2px solid #0a5c2b; border-radius: 9px; color: #eafff1;
  padding: 6px 14px; font-weight: 800; font-size: 12px;
  box-shadow: 0 0 12px rgba(23,224,90,.5), inset 0 1px 2px rgba(255,255,255,.3);
}
#powerBtn:active { transform: translateY(1px); }
#powerBtn .pwr-ic { font-size: 17px; }

/* --- powered-off cover / self test --- */
#powerOff {
  position: absolute; inset: 0; z-index: 40; background: #000;
  display: none; align-items: center; justify-content: center;
}
#powerOff.show { display: flex; }
.po-inner { text-align: center; }
.po-logo { font-size: 30px; font-weight: 800; color: #2a2f36; letter-spacing: 1px; }
.po-logo b { color: #17e05a; }
.po-msg { margin-top: 14px; color: #17e05a; font-size: 15px; font-weight: 700; }
.po-hint { margin-top: 6px; color: #4a5058; font-size: 12px; }

/* ============ the SCREEN (replica area) ============ */
#screenFrame {
  background: var(--screen);
  border: 2px solid #000;
  border-radius: 4px;
  display: grid;
  grid-template-rows: 26px 24px 1fr auto;
  grid-template-columns: 64px 1fr;
  overflow: hidden;
  position: relative;
}

/* --- top system bar (white, black text) --- */
#topbar {
  grid-column: 1 / 3; grid-row: 1;
  background: #e9edf0; color: #000;
  display: flex; align-items: center;
  font-size: 13px; font-weight: 700;
  padding: 0 6px; gap: 10px;
}
#topbar .dt { font-variant-numeric: tabular-nums; }
#topbar .pmode { flex: 1; text-align: center; font-size: 14px; }
#battIcon {
  width: 30px; height: 13px; border: 2px solid #000; border-radius: 2px; position: relative;
  background: #fff;
}
#battIcon::before { content: ""; position: absolute; right: -5px; top: 2px; width: 3px; height: 5px; background: #000; }
#battIcon .fill { position: absolute; inset: 1px; width: 85%; background: #17c14e; }
#elapsed {
  background: #000; color: #fff; font-variant-numeric: tabular-nums;
  padding: 1px 7px; font-size: 14px; font-weight: 800; border-radius: 2px;
}

/* --- message bar (yellow) --- */
#msgbar {
  grid-column: 1 / 3; grid-row: 2;
  background: var(--msg-yellow); color: #000;
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; padding: 0 10px;
  visibility: hidden;
}
#msgbar.red { background: var(--danger); color: #fff; }
#msgbar.show { visibility: visible; }

/* --- left quick access keys --- */
#quickkeys {
  grid-column: 1; grid-row: 3 / 5;
  background: #000;
  display: flex; flex-direction: column; gap: 5px;
  padding: 6px 5px;
}
.qk {
  flex: 1; max-height: 56px;
  background: linear-gradient(180deg, #33383f, var(--key-bg));
  border: 1px solid var(--key-edge);
  border-radius: 5px;
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-align: center;
  cursor: pointer; line-height: 1.15; padding: 2px;
}
.qk:hover { background: #3d434b; }
.qk:active { transform: translateY(1px); }
.qk.green { color: #2ee56b; font-size: 20px; }
.qk.cross { color: #fff; font-size: 20px; }
.qk .codot { color: var(--ecg); font-size: 8px; vertical-align: super; margin-left: 2px; }
.qk.active { outline: 2px solid var(--ecg); }
.qk small { font-size: 9px; display: block; color: #cbd3db; }

/* --- lead Source popup (per reference) --- */
#srcMenu { position: absolute; left: 52px; top: 40px; z-index: 40; background: #14181d;
  border: 1px solid #3d434b; border-radius: 4px; min-width: 96px; box-shadow: 0 10px 30px rgba(0,0,0,.7);
  font-size: 13px; overflow: hidden; }
#srcMenu .src-title { background: #2a2f36; color: #cfd6dd; font-weight: 700; padding: 5px 12px; font-size: 12px; }
#srcMenu .src-item { padding: 5px 12px; color: #e6ebf1; cursor: pointer; }
#srcMenu .src-item:hover { background: #262c33; }
#srcMenu .src-item.on { color: var(--ecg); font-weight: 800; }

/* --- Home/Display cycling layer --- */
#displayLayer { grid-column: 1 / 3; grid-row: 3 / 5; background: #000; z-index: 5;
  display: none; flex-direction: column; padding: 14px 18px; overflow: auto; }
#displayLayer.show { display: flex; }
#displayLayer .ln-title { color: var(--dim); font-size: 12px; letter-spacing: 1px; margin-bottom: 12px; }
#displayLayer .ln-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; flex: 1; }
#displayLayer .ln-cell { background: #0a0d12; border: 1px solid #1a1f26; border-radius: 8px; padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; }
#displayLayer .ln-lab { font-size: 14px; color: var(--dim); font-weight: 700; }
#displayLayer .ln-val { font-size: 58px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
#displayLayer .ln-unit { font-size: 16px; margin-left: 6px; color: var(--dim); }
#displayLayer .trend-tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
#displayLayer .trend-tbl th, #displayLayer .trend-tbl td { border: 1px solid #1a1f26; padding: 8px 10px; text-align: left; font-variant-numeric: tabular-nums; }
#displayLayer .trend-tbl th { color: var(--dim); font-size: 12px; }

/* --- Large Numerics per reference image 2 --- */
.ln-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1; }
.ln-tile { background: #000; border: 1px solid #14181d; display: flex; flex-direction: column; position: relative; }
.ln-band { display: flex; justify-content: space-between; padding: 3px 10px; font-size: 13px; font-weight: 800; color: #04120a; }
.ln-band.hr { background: var(--ecg); }
.ln-band.spo2 { background: var(--spo2); }
.ln-band.nibp { background: var(--nibp); }
.ln-band.co2 { background: var(--co2); color: #fff; }
.ln-big { flex: 1; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 64px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: .95; }
.ln-big.nibp-stack { flex-direction: column; font-size: 44px; align-items: flex-start; padding-left: 22px; gap: 0; }
.ln-big.nibp-stack .u { text-decoration: underline; text-underline-offset: 6px; }
.ln-big.nibp-stack .map { font-size: 24px; font-weight: 700; }
.ln-sub { position: absolute; right: 14px; bottom: 8px; font-size: 18px; font-weight: 700; }
.ln-sub b { font-size: 26px; }
.ln-ts { position: absolute; left: 10px; bottom: 6px; color: #8b95a1; font-size: 12px; }
.spo2bar { width: 12px; height: 64px; border: 1px solid var(--spo2); display: inline-flex; align-items: flex-end; }
.spo2bar span { width: 100%; background: var(--spo2); display: block; }
.ln-strip { display: flex; gap: 8px; margin-top: 8px; }
.ln-mini { flex: 1; background: #000; border: 1px solid #14181d; display: flex; align-items: center; gap: 10px; padding: 4px; }
.ln-mini .lab { font-size: 12px; font-weight: 800; color: #fff; padding: 3px 8px; }
.ln-mini b { font-size: 24px; font-variant-numeric: tabular-nums; }

/* --- Trends per reference image 3 --- */
.trend-hdr { background: #8e6bbf; color: #fff; text-align: center; font-weight: 800; font-size: 15px;
  padding: 4px; margin-bottom: 6px; border-radius: 2px; }
.trend-cols th small { font-weight: 400; }

/* --- waveform area --- */
#waves { grid-column: 2; grid-row: 3; position: relative; background: var(--screen); min-height: 0; overflow: hidden; }
#waveCanvas { position: absolute; inset: 0; display: block; }
#waveLabels { position: absolute; inset: 0; pointer-events: none; }
#waveLabels span { position: absolute; left: 8px; font-size: 13px; font-weight: 700; text-shadow: 0 0 4px #000; }

/* --- defib/pacer status band (above params, like on-screen therapy band) --- */
#therapyBand {
  grid-column: 2; grid-row: 4;
  display: none;
  background: #101214; border-top: 1px solid #22262b;
  color: var(--charge); font-weight: 800; font-size: 15px;
  padding: 3px 10px; gap: 18px; align-items: center;
}
#therapyBand.show { display: flex; }
#therapyBand .tb-state { color: #fff; }
#therapyBand .tb-pace { color: var(--nibp); }

/* ============ parameter tiles (colored header bands) ============ */
#params {
  grid-column: 1 / 3;
  background: #000;
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 1.3fr 1.2fr;
  grid-template-rows: auto auto;
  gap: 2px; padding: 2px;
}
.tile { background: #000; position: relative; cursor: pointer; }
.tile .band {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 800; font-size: 13px; color: #000;
  padding: 1px 8px;
}
.tile .body { padding: 2px 8px 6px; display: flex; align-items: baseline; gap: 10px; min-height: 52px; }
.tile .big { font-size: 44px; font-weight: 800; line-height: .95; font-variant-numeric: tabular-nums; }
.tile .mid { font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 15px; font-weight: 700; }
.tile.hr .band { background: var(--ecg); }   .tile.hr .big, .tile.hr .sub { color: var(--ecg); }
.tile.nibp .band { background: var(--nibp); } .tile.nibp .mid, .tile.nibp .sub { color: var(--nibp); }
.tile.co2 .band { background: var(--co2); }  .tile.co2 .big, .tile.co2 .sub { color: var(--co2); }
.tile.spo2 .band { background: var(--spo2); } .tile.spo2 .big, .tile.spo2 .sub { color: var(--spo2); }
.tile.temp .band { background: #cfd6dd; }    .tile.temp .mid, .tile.temp .sub { color: var(--temp); }
.tile.ibp .band { background: var(--ibp); }  .tile.ibp .mid, .tile.ibp .sub { color: var(--ibp); }
.tile .stack { display: flex; flex-direction: column; line-height: 1.1; }
.tile .stack .mid { font-size: 30px; text-decoration: underline; text-underline-offset: 4px; }  /* per reference: NIBP values underlined */
.tile.co2 .sub { color: var(--co2); font-weight: 700; }
.tile.alarming .band { animation: bandflash .6s infinite; }
@keyframes bandflash { 50% { background: var(--danger); color: #fff; } }
.tile .warn-msg { color: var(--spo2); font-size: 16px; font-weight: 800; }

/* second row tiles are shorter */
#params .short .body { min-height: 34px; }
#params .short .mid { font-size: 26px; }

/* ============ bezel (physical controls) ============ */
#bezel {
  display: flex; align-items: stretch; gap: 8px;
  padding: 2px 4px 4px;
}
.bz-group {
  display: flex; gap: 5px; align-items: stretch;
  background: #1d2024; border: 1px solid #2a2e34; border-radius: 8px; padding: 5px;
}
.bz-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 8px; letter-spacing: 1px; color: #6a727c; text-align: center; }
.bz {
  min-width: 58px; padding: 6px 8px;
  background: linear-gradient(180deg, #383e46, #24282e);
  border: 1px solid #454c55; border-radius: 6px;
  color: #e6ebf1; font-size: 11px; font-weight: 800; text-align: center;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.bz:active { transform: translateY(1px); }
.bz.active { outline: 2px solid var(--ecg); }
.bz .icon { font-size: 15px; }
#bzCharge { background: linear-gradient(180deg, #6b5500, #4a3a00); border-color: var(--charge); color: var(--charge); }
#bzCharge.armed { background: var(--charge); color: #201400; animation: pulse 1s infinite; }
.bz.cam-off { border-color: var(--danger); color: #ff9a9a; }
.bz .cam-slash { position: relative; display: inline-block; }
.bz .cam-slash::after { content: ""; position: absolute; left: -2px; top: 50%; width: 120%; height: 2px; background: var(--danger); transform: rotate(-20deg); }
#bzShock { background: linear-gradient(180deg, #5a0f0f, #3a0000); border-color: var(--danger); color: #ff9a9a; border-radius: 50%; min-width: 62px; }
#bzShock.ready { background: var(--danger); color: #fff; animation: pulse .7s infinite; }
@keyframes pulse { 50% { filter: brightness(1.45); } }
#bzEnergyVal { color: var(--charge); font-size: 20px; font-weight: 800; min-width: 52px; display: flex; align-items: center; justify-content: center; }
.spacer { flex: 1; }
.sess-note { align-self: center; font-size: 11px; color: var(--dim); }

/* ============ overlay windows (device-style) ============ */
#overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: flex-start; justify-content: center; z-index: 50;
  overflow: auto; padding: 3vh 0;
}
#overlay.show { display: flex; }
.panel {
  background: #101418; border: 2px solid #3d434b; border-radius: 6px;
  width: min(780px, 94vw); max-height: 94vh; overflow: auto; padding: 16px 18px;
  margin: auto; box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.panel h2 { margin: 0 0 4px; font-size: 17px; color: #fff; }
.panel .hint { color: var(--dim); font-size: 13px; margin-bottom: 10px; }
.panel .close { float: right; cursor: pointer; color: var(--dim); font-size: 20px; }
.rhythm-group h3 { font-size: 12px; color: var(--spo2); letter-spacing: 1px; margin: 10px 0 6px; text-transform: uppercase; }
.rhythm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 6px; }
.rhythm-chip {
  background: #191d24; border: 1px solid #2a313b; border-radius: 5px;
  padding: 7px 9px; cursor: pointer; font-size: 13px; color: #dfe6ee;
}
.rhythm-chip:hover { border-color: var(--ecg); }
.rhythm-chip.active { background: var(--ecg); color: #041014; font-weight: 700; }
.rhythm-chip small { display: block; color: var(--dim); font-size: 11px; }
.rhythm-chip.active small { color: #052; }
#rhythmDesc { margin-top: 10px; padding: 10px; background: #0b0e13; border-radius: 6px; font-size: 13px; color: #c6cfd8; line-height: 1.5; min-height: 38px; }
.ctrl-row { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.ctrl-row label { width: 150px; font-size: 13px; color: var(--dim); }
.ctrl-row input[type=range] { flex: 1; }
.ctrl-row .val { width: 74px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.btn { background: #2a2f36; border: 1px solid #3b424c; color: #e8edf2; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn.primary { background: var(--ecg); color: #041014; border: none; }
.btn.danger { background: var(--danger); color: #fff; border: none; }
table.limits { width: 100%; font-size: 13px; border-collapse: collapse; }
table.limits td { border: 1px solid #23262c; padding: 6px 8px; }

/* pacer settings window rows */
.pace-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.pace-row label { width: 110px; font-size: 14px; color: var(--dim); font-weight: 700; }
.pace-row .pval { font-size: 26px; font-weight: 800; color: var(--nibp); width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
.pace-row .btn { min-width: 46px; font-size: 16px; }

/* ============ session extras ============ */
#pip {
  position: fixed; bottom: 90px; left: 12px; width: 200px;
  background: #000; border: 2px solid var(--nibp); border-radius: 6px;
  display: none; z-index: 60; overflow: hidden;
}
#pip.show { display: block; }
#pip video { width: 100%; display: block; }
#pip .pip-label { position: absolute; top: 2px; left: 6px; font-size: 11px; color: var(--nibp); text-shadow: 0 0 4px #000; }
#pip .pip-close { position: absolute; top: 2px; right: 6px; cursor: pointer; color: #fff; }
#callBanner {
  position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
  background: #0b3d2e; border: 1px solid var(--ecg); color: var(--ecg);
  padding: 7px 16px; border-radius: 8px; display: none; z-index: 60; font-weight: 700; font-size: 13px;
}
#callBanner.show { display: block; }
.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: #1b2028; border: 1px solid #333; padding: 9px 16px; border-radius: 8px;
  z-index: 70; font-size: 13px; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.legal-footer { position: fixed; bottom: 1px; right: 8px; font-size: 9px; color: #4a5058; z-index: 5; }
.legal-footer a { color: #5a6068; }

/* --- DEFIB mode UI per reference: right energy ladder + bottom Defibrillator panel --- */
#energyLadder { position: absolute; right: 0; top: 34px; bottom: 118px; width: 44px; z-index: 6;
  background: #0a0d12; border-left: 1px solid #23282f; display: flex; flex-direction: column; overflow: hidden; }
.el-step { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 11px;
  font-weight: 700; color: #cfd6dd; border-bottom: 1px solid #14181d; cursor: pointer; min-height: 0; }
.el-step:hover { background: #1d232b; }
.el-step.sel { background: #e6ebf1; color: #0a0d12; font-size: 14px; }
#defibPanel { position: absolute; left: 46px; right: 44px; bottom: 0; height: 118px; z-index: 6;
  background: #d7dde3; color: #10151b; display: grid; grid-template-columns: 1fr 2fr auto 1.2fr;
  align-items: center; border-top: 3px solid #59636e; padding: 0 10px; gap: 10px; }
#defibPanel .dp-title { font-size: 18px; font-weight: 800; }
#defibPanel .dp-mid { text-align: center; }
#defibPanel .dp-state { font-size: 22px; font-weight: 800; }
#defibPanel .dp-state.red { color: #c81e1e; }
#defibPanel .dp-state.amber { color: #b25e04; }
#defibPanel .dp-sub { font-size: 16px; font-weight: 700; }
#defibPanel .dp-count { background: #10151b; color: #ffd400; font-size: 16px; padding: 8px 10px;
  border-radius: 4px; font-weight: 800; }
#defibPanel .dp-count b { color: #fff; margin-left: 4px; }
#defibPanel .dp-energy { text-align: center; background: #10151b; color: #e6ebf1; border-radius: 4px;
  padding: 6px 8px; }
#defibPanel .dp-energy span { display: block; font-size: 12px; color: #9aa4b0; }
#defibPanel .dp-energy b { font-size: 26px; }

/* --- 12-lead Analysis / Snapshot pages per reference --- */
.an-head { background: #2f6db3; color: #fff; font-weight: 700; padding: 4px 10px; font-size: 13px;
  display: flex; justify-content: space-between; }
.an-body { display: flex; gap: 10px; }
.an-left { flex: 1.4; }
.an-rt { width: 170px; border-left: 1px solid #23282f; padding-left: 8px; }
.an-rt .rt-title { background: #17e05a; color: #04120a; font-weight: 800; font-size: 12px;
  text-align: center; border-radius: 3px; margin-bottom: 4px; padding: 1px; }
.an-rt canvas { width: 100%; height: 34px; display: block; }
.an-rt .rt-lab { font-size: 10px; color: #17e05a; margin: 0; }
.an-stmt { font-size: 14px; line-height: 1.7; padding: 8px 4px; }
.an-stmt div { border-bottom: 1px solid #1a1f26; padding: 4px 2px; }
.an-stmt .stemi { color: #ff5b5b; font-weight: 800; }
.an-meas { font-size: 13px; line-height: 1.75; padding: 6px 4px; color: #dfe6ec; }
.an-meas b { color: #fff; }
.stj-tbl { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 4px; }
.stj-tbl td, .stj-tbl th { border: 1px solid #1a1f26; padding: 2px 4px; text-align: center; }
.stj-tbl th { color: var(--dim); }

/* --- alarm beacons flash + silence state --- */
#beacons.alarm-red .beacon.red { animation: beaconflash .3s infinite alternate; }
#beacons.alarm-yellow .beacon.yellow { animation: beaconflash .45s infinite alternate; }
#bzSilence.armed { background: #4a3200; border-color: var(--charge); color: var(--charge); }
#defibPanel .dp-clabel { display: block; font-size: 10px; color: #ffd400; font-weight: 700; letter-spacing: .5px; }

/* --- bezel: uniform grey keys; only PACER (teal) and SHOCK (red) are colored --- */
#bezel { background: #b9bfc6; border-radius: 10px; padding: 8px 10px; }
#bezel .bz { background: linear-gradient(180deg, #e8ebee, #c6ccd2); border: 1px solid #98a0a8;
  color: #2a2f36; font-weight: 800; border-radius: 8px; }
#bezel .bz:hover { background: #dfe4e9; }
#bezel .bz-label { color: #5b6168; }
#bezel .mode-btn.active { outline: 3px solid #17a04e; }
#bzPacer { background: radial-gradient(circle at 40% 35%, #1d6d63, #0d453e) !important;
  color: #eafff8 !important; border-radius: 50% !important; min-width: 60px; border-color: #072f2a !important; }
#bzEnergyVal { background: #10151b; color: #ffd400; border-radius: 5px; padding: 4px 8px; font-weight: 800; }
#bzCharge.armed { outline: 3px solid #ffcc00; }
#bzShock { background: radial-gradient(circle at 38% 32%, #ff5d47, #b31307) !important;
  border: 3px solid #7e0d04 !important; color: #fff !important; border-radius: 50% !important;
  min-width: 66px; position: relative; box-shadow: 0 2px 8px rgba(179,19,7,.5); }
#bzShock.ready { animation: shockpulse .6s infinite alternate; }
@keyframes shockpulse { from { box-shadow: 0 0 6px rgba(255,60,40,.6); } to { box-shadow: 0 0 22px rgba(255,60,40,1); } }

/* --- responsive: iPad + phone --- */
@media (max-width: 1100px) {
  #quickkeys { grid-column: 1; }
  .qk { font-size: 10px; }
  .tile .big { font-size: 30px; }
  .tile .stack .mid { font-size: 22px; }
}
@media (max-width: 900px) {
  html, body { overflow: auto; }
  #device { height: auto; min-height: 100vh; grid-template-rows: 34px 62vh auto; padding: 4px; gap: 4px; }
  #screenFrame { grid-template-columns: 46px 1fr; grid-template-rows: 22px 20px 1fr auto; }
  .qk { max-height: 44px; font-size: 9px; padding: 1px; }
  .qk svg { transform: scale(.8); }
  #topbar { font-size: 10px; gap: 5px; } #topbar .pmode { font-size: 11px; }
  #elapsed { font-size: 11px; padding: 0 4px; }
  .tile .band { font-size: 9px; padding: 1px 5px; }
  .tile .big { font-size: 24px; } .tile .mid { font-size: 16px; }
  .tile .stack .mid { font-size: 18px; }
  .tile .sub { font-size: 10px; }
  #bezel { flex-wrap: wrap; gap: 6px; padding: 6px; align-items: center; }
  .bz-group { flex-wrap: wrap; align-items: center; }
  #bezel .bz { min-width: 44px; max-height: 52px; font-size: 9px; padding: 5px 6px; }
  #bzPacer, #bzShock { height: 52px; }
  #bzShock { min-width: 54px; } #bzPacer { min-width: 50px; }
  #energyLadder { width: 32px; } .el-step { font-size: 9px; } .el-step.sel { font-size: 11px; }
  #defibPanel { height: 84px; left: 46px; right: 32px; }
  #defibPanel .dp-state { font-size: 15px; } #defibPanel .dp-sub { font-size: 12px; }
  #defibPanel .dp-title { font-size: 13px; } #defibPanel .dp-energy b { font-size: 18px; }
  .panel { width: 96vw; padding: 10px; }
  .legal-footer { position: static; text-align: center; }
}
@media (max-width: 520px) {
  #device { grid-template-rows: 30px 56vh auto; }
  .unit-name { display: none; }
  .tile .big { font-size: 19px; }
  #params { font-size: 11px; }
  #waveLabels span { font-size: 10px; }
  #bezel .bz { min-width: 38px; font-size: 8px; }
  #miniPrev { display: none; }
}
