* { box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", Arial, sans-serif; margin: 0; color: #222; background: #f4f3ef; }
h1 { font-size: 20px; margin: 16px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: #777; font-weight: normal; }
.hidden { display: none; }

/* Landing */
body.landing { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.card { background: #fff; border-radius: 12px; padding: 28px; width: 420px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.card label { display: block; font-size: 13px; margin: 10px 0 4px; font-weight: 600; }
.card input[type=text] { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; }
.card button { margin-top: 16px; width: 100%; padding: 10px; border: 0; border-radius: 6px; background: #1d1d1d; color: #fff; font-size: 14px; cursor: pointer; }
.link-row { margin-top: 14px; font-size: 13px; }
.link-row span { display: block; color: #777; margin-bottom: 2px; }
.link-row a { word-break: break-all; color: #185fa5; }
.code-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid #eee; font-size: 13px; color: #555; text-align: center; }
.code-display { margin-top: 8px; font-size: 32px; font-weight: 700; letter-spacing: 8px; color: #1d1d1d; }

/* Instructor */
body.instructor { padding: 0 16px 40px; }
.panel { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.header-row { display: flex; justify-content: space-between; align-items: center; padding-right: 16px; }
.settings-wrap { position: relative; }
.settings-wrap button { padding: 8px 14px; border-radius: 8px; border: 1px solid #ccc; background: #fff; cursor: pointer; font-size: 13px; }
.settings-panel { position: absolute; right: 0; top: 40px; width: 280px; background: #fff; border: 1px solid #ddd; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); padding: 12px 14px; z-index: 20; }
.settings-panel.hidden { display: none; }
.settings-title { font-size: 12px; color: #999; margin-bottom: 8px; }
.settings-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.settings-row label { font-size: 13px; font-weight: 600; }
.settings-row select { padding: 8px; border-radius: 6px; border: 1px solid #ccc; font-size: 13px; }
.settings-hint { font-size: 11px; color: #999; }

.rhythm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.rhythm-grid button { padding: 12px 8px; border-radius: 8px; border: 1px solid #ccc; background: #fafafa; cursor: pointer; font-size: 13px; }
.rhythm-grid button.active { border-color: #185fa5; background: #e6f1fb; font-weight: 600; }
.rhythm-grid button.kritisch { border-color: #e24b4a; color: #a32d2d; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.preset-grid button { padding: 14px 10px; border-radius: 8px; border: 1px solid #ccc; background: #fafafa; cursor: pointer; font-size: 13px; font-weight: 600; }
.preset-grid button.active { border-color: #0f6e56; background: #e1f5ee; color: #085041; }
.slider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.slider-row { display: flex; flex-direction: column; }
.slider-row label { font-size: 13px; margin-bottom: 4px; }
.slider-row .val { font-weight: 600; }
.checkbox-row { display: block; margin-top: 14px; font-size: 13px; }
.log { max-height: 220px; overflow-y: auto; font-size: 13px; }
.log-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #eee; }
.log-time { color: #999; }

/* Trainee monitor */
body.trainee { background: #16181b; margin: 0; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
.device-frame { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #000; }
.topbar { display: none; }
.demo-watermark { display: none; }
.monitor { flex: 1; display: flex; background: #000; min-height: 0; position: relative; }

body.skin-lifepak15 .device-frame { background: linear-gradient(180deg, #c2c1bc, #adaca6); padding: 10px; border-radius: 16px; margin: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
body.skin-lifepak15 .monitor { border-radius: 6px; overflow: hidden; }
body.skin-lifepak15 .topbar { display: flex; justify-content: space-between; align-items: center; padding: 2px 10px 6px; font-size: 12px; color: #fff; font-family: monospace; }
body.skin-lifepak15 .topbar-icons { display: flex; gap: 10px; align-items: center; }
body.skin-lifepak15 .icon-bt { color: #4fb8ff; }
body.skin-lifepak15 #joulesBadge { background: #1d1d1d; color: #f2a340; padding: 1px 8px; border-radius: 4px; }
body.skin-lifepak15 .demo-watermark { display: block; text-align: center; color: #f2a340; font-size: 11px; padding: 4px; font-family: monospace; background: #000; }
body.skin-lifepak15 .num-label, body.skin-lifepak15 .num-value, body.skin-lifepak15 .num-sub { font-family: monospace; }

.numerics { width: 180px; display: flex; flex-direction: column; border-right: 2px solid #333; }
.num-block { flex: 1; padding: 6px 10px; border-bottom: 1px solid #222; }
.num-label { font-size: 12px; color: #aaa; }
.num-value { font-size: 34px; font-weight: 700; line-height: 1.1; }
.num-sub { font-size: 13px; color: #ccc; }
.num-block.hr .num-value { color: #6fe36f; }
.num-block.spo2 .num-value { color: #4fb8ff; }
.num-block.co2 .num-value { color: #f2a340; }
.num-block.temp .num-value { color: #fff; }
.num-block.nibp .num-value { color: #cfe8ff; }
.num-block.nibp { cursor: pointer; }
.num-block.nibp .num-label { display: flex; align-items: center; gap: 6px; }
.nibp-countdown { font-size: 11px; background: #1d1d1d; color: #ffe08a; padding: 0 5px; border-radius: 3px; font-family: monospace; }
.nibp-countdown.hidden { display: none; }
.nibp-readout .num-value { font-size: 26px; line-height: 1.15; }
.nibp-map { font-size: 13px; color: #9fc7e8; margin: 1px 0; }
.nibp-message.hidden { display: none; }
.nibp-message { color: #f0a0a0; font-size: 12px; font-weight: 700; margin-top: 2px; }
.signal-message.hidden { display: none; }
.signal-message { color: #f0a0a0; font-size: 11px; font-weight: 700; margin-top: 2px; }

.spo2-row { display: flex; align-items: flex-end; gap: 8px; }
.spo2-bar-wrap { width: 8px; height: 26px; background: #0a2a3a; border-radius: 2px; display: flex; align-items: flex-end; overflow: hidden; margin-bottom: 3px; }
.spo2-bar { width: 100%; height: 100%; background: #4fb8ff; transform: scaleY(0); transform-origin: bottom; }

.wave-overlay { position: absolute; top: 4px; right: 8px; z-index: 5; pointer-events: none; }
.ecg-lead-label { font-size: 12px; color: #6fe36f; font-family: monospace; background: rgba(0,0,0,0.4); padding: 1px 5px; border-radius: 3px; }

.splash-screen.hidden { display: none; }
.splash-screen {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: -apple-system, "Segoe UI", Arial, sans-serif;
  color: #fff;
  text-align: center;
}
.splash-logo { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 1px; line-height: 1.15; }
.splash-logo-mark { background: #c8102e; color: #fff; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 2px; font-size: 15px; font-weight: 700; }
.splash-title { font-size: 30px; font-weight: 700; margin-top: 10px; }
.splash-title-num { color: #c8102e; }
.splash-subtitle { font-size: 11px; letter-spacing: 3px; color: #ccc; }
.splash-footer { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 14px; font-size: 9px; }
.splash-selftest { color: #f2c200; }
.splash-copyright { color: #999; line-height: 1.4; text-align: left; }
.splash-masimo { color: #ccc; text-align: right; line-height: 1.3; }

.alarm-bell { display: none; }
body.skin-lifepak15 .alarm-bell { display: inline-block; cursor: pointer; font-size: 13px; opacity: 0.5; }
body.skin-lifepak15 .alarm-bell.lit { opacity: 1; color: #ffe08a; }
body.skin-lifepak15 .alarm-bell.ringing { animation: bell-blink 1s steps(1) infinite; }
@keyframes bell-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.25; } }

.num-value.alarm-blink { animation: value-blink 1s steps(1) infinite; }
@keyframes value-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.3; } }

.nibp-menu.hidden { display: none; }
.nibp-menu {
  position: absolute;
  left: 16px;
  bottom: 60px;
  width: 190px;
  background: #111;
  border: 2px solid #333;
  border-radius: 6px;
  overflow: hidden;
  font-family: monospace;
  z-index: 25;
}
.nibp-menu-title { background: #e8b23a; color: #1a1a1a; font-weight: 700; text-align: center; padding: 4px; font-size: 13px; }
.nibp-menu-row { display: flex; justify-content: space-between; padding: 8px 10px; color: #ddd; font-size: 12px; border-bottom: 1px solid #222; cursor: pointer; }
.nibp-menu-row:last-child { border-bottom: none; }
.nibp-menu-row.selected { background: #23262b; color: #fff; }
.nibp-menu-row.editing { background: #185fa5; color: #fff; }

.quick-menu.hidden { display: none; }
.quick-menu {
  position: absolute;
  width: 170px;
  background: #111;
  border: 2px solid #333;
  border-radius: 6px;
  overflow: hidden;
  font-family: monospace;
  z-index: 25;
}
.quick-menu-title { background: #e8b23a; color: #1a1a1a; font-weight: 700; text-align: center; padding: 4px; font-size: 13px; }
.quick-menu-options { max-height: 200px; overflow-y: auto; }
.quick-menu-options button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  color: #ddd;
  background: transparent;
  border: none;
  border-bottom: 1px solid #222;
  font-family: monospace;
  font-size: 12px;
  cursor: pointer;
}
.quick-menu-options button:last-child { border-bottom: none; }
.quick-menu-options button.selected { background: #185fa5; color: #fff; }
.quick-menu.pos-lead { top: 40px; left: 200px; }
.quick-menu.pos-alarm { top: 40px; right: 216px; }
#waveCanvas { flex: 1; display: block; width: 100%; height: 100%; min-height: 0; min-width: 0; }
.controls { background: #23262b; padding: 10px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.control-group { display: flex; gap: 8px; align-items: center; }
.controls button { padding: 12px 14px; border-radius: 8px; border: 1px solid #555; background: #35383e; color: #fff; font-size: 13px; cursor: pointer; }
.controls button.active { background: #185fa5; border-color: #185fa5; }
.controls button.warn { background: #854f0b; border-color: #ef9f27; }
.controls button.danger { background: #791f1f; border-color: #e24b4a; }
.controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.controls #energyVal { color: #fff; min-width: 50px; text-align: center; font-size: 14px; }
.energy-center { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; }
.energy-caption { font-size: 10px; color: #999; }
.shock-btn { border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.shock-icon { font-size: 18px; }

/* Elemente, die es nur im Lifepak-Skin gibt (echtes Geraet hat kein Aequivalent im Standard-Skin) */
.lifepak-only-btn { display: none; }
.lifepak-only-group { display: none; }
.rotate-hint { display: none; }
.pacer-readout { display: none; }
.options-panel { display: none; }

/* Querformat-Layout: Bildschirm links, physisches Bedienfeld rechts (wie Lifepak 15) */
body.skin-lifepak15.trainee { flex-direction: row; }
body.skin-lifepak15 .device-frame { margin: 8px 0 8px 8px; }

body.skin-lifepak15 .lifepak-only-btn { display: inline-block; }
body.skin-lifepak15 .lifepak-only-group { display: flex; }

body.skin-lifepak15 .controls {
  flex-direction: column;
  flex-wrap: nowrap;
  width: 200px;
  flex-shrink: 0;
  background: #b8b7b2;
  background: linear-gradient(180deg, #c2c1bc, #adaca6);
  border-radius: 10px;
  margin: 8px 8px 8px 0;
  padding: 8px;
  gap: 8px;
  align-items: stretch;
  justify-content: flex-start;
  overflow-y: auto;
  min-height: 0;
}
body.skin-lifepak15 .control-group { gap: 6px; }
body.skin-lifepak15 .control-group.main-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "cpr      energy"
    "analyze  charge"
    "lead     shock"
    "size     shock"
    "sync     pacer"
    "nibp     rate"
    "alarms   current"
    "options  pause"
    "event    event";
}
body.skin-lifepak15 #cprBtn { grid-area: cpr; }
body.skin-lifepak15 .control-group.energy { grid-area: energy; }
body.skin-lifepak15 #analyzeBtn { grid-area: analyze; }
body.skin-lifepak15 #chargeBtn { grid-area: charge; }
body.skin-lifepak15 #ablBtn { grid-area: lead; }
body.skin-lifepak15 #shockBtn { grid-area: shock; align-self: center; justify-self: center; }
body.skin-lifepak15 #amplBtn { grid-area: size; }
body.skin-lifepak15 #syncBtn { grid-area: sync; }
body.skin-lifepak15 #pacerBtn { grid-area: pacer; }
body.skin-lifepak15 #nibpBtn { grid-area: nibp; }
body.skin-lifepak15 #pacerRateBtn { grid-area: rate; }
body.skin-lifepak15 #alarmsBtn { grid-area: alarms; }
body.skin-lifepak15 #pacerCurrentBtn { grid-area: current; }
body.skin-lifepak15 #optionsBtn { grid-area: options; }
body.skin-lifepak15 #pacerPauseBtn { grid-area: pause; }
body.skin-lifepak15 #eventBtn { grid-area: event; }

body.skin-lifepak15 .control-group.energy {
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;
  background: linear-gradient(180deg, #333335, #201f21);
  border-radius: 6px;
  padding: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 2px rgba(0,0,0,0.4);
}
body.skin-lifepak15 .control-group.dial-group { flex-direction: row; align-items: center; justify-content: space-between; padding: 2px 4px; }

body.skin-lifepak15 .control-group.power-row { justify-content: flex-end; padding: 0 2px; }
body.skin-lifepak15 .power-btn {
  width: auto;
  padding: 6px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #6a6f6a, #4a4e4a);
  color: #eee;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), inset 0 -2px 3px rgba(0,0,0,0.3);
}
body.skin-lifepak15:not(.device-off) .power-btn {
  background: linear-gradient(180deg, #6fbf73, #3f8f46);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), inset 0 -2px 3px rgba(0,0,0,0.25), 0 0 6px 2px rgba(90,220,110,0.5);
}
body.skin-lifepak15 .contrast-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex: none;
  font-size: 13px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.skin-lifepak15.device-off .controls .control-group:not(.power-row) { opacity: 0.35; pointer-events: none; }
body.skin-lifepak15 .device-frame.sunvue .monitor { filter: grayscale(1) contrast(1.6) brightness(1.1); }
body.skin-lifepak15.device-off .topbar,
body.skin-lifepak15.device-off .numerics,
body.skin-lifepak15.device-off #waveCanvas,
body.skin-lifepak15.device-off .wave-overlay,
body.skin-lifepak15.device-off .demo-watermark { visibility: hidden; }

body.skin-lifepak15 .controls button {
  padding: 9px 4px;
  font-size: 10.5px;
  border-radius: 6px;
  border: none;
  background: linear-gradient(180deg, #47474a, #29292b);
  color: #f0f0ef;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 2px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.3);
}
body.skin-lifepak15 .controls button:active { box-shadow: inset 0 2px 3px rgba(0,0,0,0.5); transform: translateY(1px); }
body.skin-lifepak15 .controls button.active { background: linear-gradient(180deg, #2b74b8, #185fa5); color: #fff; }
body.skin-lifepak15 .controls button.warn {
  background: linear-gradient(180deg, #ffcc5c, #e8a923);
  color: #3a2a04;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -2px 2px rgba(0,0,0,0.2), 0 1px 1px rgba(0,0,0,0.3);
}
body.skin-lifepak15 .controls button.danger { background: linear-gradient(180deg, #d8503f, #b53020); color: #fff; }
body.skin-lifepak15 .controls #energyVal { color: #fff; font-weight: 600; font-size: 13px; }
body.skin-lifepak15 .energy-caption { color: #999; }
body.skin-lifepak15 .rocker-btn {
  width: 26px;
  flex: none;
  padding: 4px 0;
  background: linear-gradient(180deg, #47474a, #29292b);
  font-size: 10px;
}
body.skin-lifepak15 .shock-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb84d, #e8952f 55%, #b5691a 100%);
  box-shadow: inset 0 2px 3px rgba(255,255,255,0.4), inset 0 -3px 5px rgba(0,0,0,0.3), 0 2px 3px rgba(0,0,0,0.4);
  margin-top: 4px;
}
body.skin-lifepak15 .shock-btn:disabled { opacity: 0.55; }
body.skin-lifepak15 .shock-icon { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,0.4); }
body.skin-lifepak15 .home-btn { width: 30px; height: 30px; border-radius: 50%; flex: none; font-size: 15px; line-height: 1; padding: 0; display: flex; align-items: center; justify-content: center; }

body.skin-lifepak15 .controls button { position: relative; }
.led { display: none; }
body.skin-lifepak15 .led {
  display: block;
  position: absolute;
  top: 3px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1a1a1a;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.6);
}
body.skin-lifepak15 .led.lit {
  background: #ffb020;
  box-shadow: 0 0 5px 2px rgba(255, 176, 32, 0.7);
}
body.skin-lifepak15 .led.blinking { animation: bell-blink 1s steps(1) infinite; }

body.skin-lifepak15 .home-btn {
  background: linear-gradient(180deg, #47474a, #29292b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), inset 0 -2px 2px rgba(0,0,0,0.35), 0 1px 1px rgba(0,0,0,0.3);
}

body.skin-lifepak15 .control-group.dial-group { padding: 6px 4px 4px; }
body.skin-lifepak15 .speed-dial {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #58585c, #38383a 55%, #1e1e20 100%);
  border: 5px solid;
  border-color: #d4d3ce #8f8e89 #7a7975 #d4d3ce;
  box-shadow: 0 2px 4px rgba(0,0,0,0.45), inset 0 -2px 3px rgba(0,0,0,0.4);
  touch-action: none;
  cursor: grab;
  flex: none;
}
body.skin-lifepak15 .speed-dial.active { border-color: #4fb8ff; cursor: grabbing; }
body.skin-lifepak15 .speed-dial:focus-visible { outline: 2px solid #4fb8ff; outline-offset: 2px; }
body.skin-lifepak15 .dial-indicator {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 5px;
  height: 22px;
  background: #eee;
  box-shadow: 0 0 3px rgba(255,255,255,0.5);
  border-radius: 2px;
  transform: translateX(-50%) rotate(0rad);
  transform-origin: 2.5px 34px;
  pointer-events: none;
}

body.skin-lifepak15 .pacer-readout.hidden { display: none; }
body.skin-lifepak15 .pacer-readout {
  position: absolute;
  top: 30px;
  right: 216px;
  background: #000;
  color: #ffe08a;
  font-family: monospace;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 15;
}

body.skin-lifepak15 .options-panel.hidden { display: none; }
body.skin-lifepak15 .options-panel {
  position: absolute;
  top: 40px;
  right: 216px;
  background: #23262b;
  border: 1px solid #555;
  border-radius: 8px;
  padding: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 200px;
}
body.skin-lifepak15 .options-row { display: flex; flex-direction: column; gap: 4px; }
body.skin-lifepak15 .options-row label { font-size: 12px; color: #ccc; }
body.skin-lifepak15 .options-panel button { align-self: flex-end; background: #35383e; color: #fff; border: 1px solid #555; padding: 6px 12px; border-radius: 6px; }

body.skin-lifepak15 .rotate-hint {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: #791f1f;
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 13px;
}
@media (orientation: landscape) {
  body.skin-lifepak15 .rotate-hint { display: none !important; }
}
@media (orientation: portrait) {
  body.skin-lifepak15 .rotate-hint { display: block; }
}
