:root {
  /* Surfaces */
  --bg:            #0d0d0f;
  --glass:         rgba(255, 255, 255, 0.04);
  --glass-lt:      rgba(255, 255, 255, 0.025);
  --glass-heavy:   rgba(255, 255, 255, 0.06);
  --glass-border:  rgba(255, 255, 255, 0.08);
  --glass-border-lt: rgba(255, 255, 255, 0.05);
  --glass-highlight: rgba(255, 255, 255, 0.06);

  /* Accent */
  --accent:     #11d6de;
  --accent-dim: rgba(17, 214, 222, 0.1);
  --accent-glow:rgba(17, 214, 222, 0.2);

  /* Text */
  --text:  #f1efe7;
  --text2: rgba(241, 239, 231, 0.65);
  --text3: rgba(241, 239, 231, 0.38);

  /* Semantic */
  --amber:  #f5a623;
  --red:    #f87171;
  --violet: #a78bfa;

  /* Shared */
  --blur:       blur(28px);
  --radius:     14px;
  --radius-sm:  10px;
  --mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(241,239,231, 0.15);
  border-radius: 4px;
}

/* ===== AMBIENT ORBS ===== */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.orb-1 {
  top: -100px;
  right: -100px;
  width: 550px;
  height: 550px;
  background: linear-gradient(135deg, rgba(17,214,222,0.15), #032c4a);
  opacity: 0.4;
}
.orb-2 {
  bottom: -150px;
  left: -150px;
  width: 650px;
  height: 650px;
  background: linear-gradient(135deg, #032c4a, rgba(17,214,222,0.12));
  opacity: 0.3;
}


/* ===================================================== */
/*  HEADER                                                */
/* ===================================================== */
.header {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-bottom: 1px solid var(--glass-border);
  padding: 10px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1500px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.page-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  white-space: nowrap;
}

/* Weight input group */
.weight-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 14px;
}

.weight-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.weight-input-group input {
  background: transparent;
  border: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  width: 64px;
  text-align: center;
  outline: none;
  font-family: var(--mono);
}

.weight-unit {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 600;
}

/* Soft glow pulse on weight input when no weight entered */
.weight-input-group.needs-weight {
  animation: weight-glow 3s ease-in-out infinite;
}
@keyframes weight-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(17, 214, 222, 0); border-color: var(--glass-border); }
  50% { box-shadow: 0 0 12px 2px rgba(17, 214, 222, 0.15); border-color: rgba(17, 214, 222, 0.4); }
}

/* Status strip */
.status-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
  background: var(--glass);
  border: 1px solid var(--glass-border-lt);
  border-radius: 10px;
  padding: 8px 18px;
}

.strip-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
}

.strip-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.strip-value {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
}

.strip-value.accent {
  color: var(--accent);
}

.strip-divider {
  width: 1px;
  height: 28px;
  background: var(--glass-border);
  flex-shrink: 0;
}

.status-pill {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: var(--font);
}

.status-muted {
  background: rgba(255,255,255,0.05);
  color: var(--text3);
}

.status-running {
  background: rgba(17, 214, 222, 0.12);
  color: var(--accent);
  border: 1px solid rgba(17, 214, 222, 0.3);
}


/* ===================================================== */
/*  RHYTHM ALERT BAR                                      */
/* ===================================================== */
.rhythm-check {
  background: rgba(248, 113, 113, 0.15);
  border-bottom: 2px solid var(--red);
  color: var(--red);
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.08em;
  animation: flash 0.8s infinite alternate;
  position: sticky;
  top: 64px;
  z-index: 9;
}

.alert-hidden { display: none; }

/* ===================================================== */
/*  COMPRESSOR SWAP ALERT BAR                             */
/* ===================================================== */
.swap-alert {
  background: rgba(245, 166, 35, 0.15);
  border-bottom: 2px solid var(--amber);
  color: var(--amber);
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.08em;
  position: sticky;
  top: 64px;
  z-index: 9;
  animation: flash-amber 0.5s infinite alternate;
}

/* ===================================================== */
/*  PAUSE ALERT BAR                                       */
/* ===================================================== */
.pause-alert {
  background: rgba(245, 166, 35, 0.15);
  border-bottom: 2px solid var(--amber);
  color: var(--amber);
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.06em;
  position: sticky;
  top: 64px;
  z-index: 9;
  animation: flash-amber 0.8s infinite alternate;
}

@keyframes flash-amber {
  0%   { box-shadow: inset 0 0 8px rgba(245,166,35,0.1); }
  100% { box-shadow: inset 0 0 20px rgba(245,166,35,0.3); }
}

@keyframes flash {
  0%   { box-shadow: inset 0 0 8px rgba(248,113,113,0.1); }
  100% { box-shadow: inset 0 0 20px rgba(248,113,113,0.3); }
}


/* ===================================================== */
/*  MAIN LAYOUT                                           */
/* ===================================================== */
.layout {
  display: flex;
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px 24px;
  gap: 20px;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 70px);
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}


/* ===================================================== */
/*  GLASS UTILITIES                                       */
/* ===================================================== */
.glass {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border-lt);
  border-radius: var(--radius);
}

.glass-heavy {
  background: var(--glass-heavy);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: inset 0 2px 0 var(--glass-highlight);
}


/* ===================================================== */
/*  TIMER CARD                                            */
/* ===================================================== */
.timer-card {
  padding: 20px;
  position: relative;
  --progress: 0;
}

.timer-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 2px;
  background: conic-gradient(
    var(--accent) calc(var(--progress) * 360deg),
    transparent calc(var(--progress) * 360deg)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.timer-card:not(.timer-active)::before {
  opacity: 0;
}

.card-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.timer-top-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.timer-display {
  flex: 1;
  font-family: var(--mono);
  font-size: 4.5rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.04em;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border-lt);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 28px;
  text-shadow: 0 0 10px rgba(255,255,255,0.08);
  transition: all 0.2s;
}

.timer-display.running {
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  border-color: rgba(17, 214, 222, 0.2);
}

.timer-display.warning {
  color: var(--amber);
  text-shadow: 0 0 20px rgba(245, 166, 35, 0.4);
  border-color: rgba(245, 166, 35, 0.3);
  animation: timer-flash 0.5s infinite alternate;
}

@keyframes timer-flash {
  0%   { background: rgba(245, 166, 35, 0.04); }
  100% { background: rgba(245, 166, 35, 0.12); }
}

.timer-meta {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 100px;
}

.cycle-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.meta-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cycle-num {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--mono);
  line-height: 1;
}

/* Vent mini indicator */
.vent-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.vent-mini-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
}

.vent-mini-sub {
  font-size: 0.55rem;
  color: var(--text3);
  letter-spacing: 0.03em;
}

.vent-bubble-wrap {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vent-bubble {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(17, 214, 222, 0.35);
  position: relative;
  overflow: hidden;
  background: #053E3E;
  transition: width 0.08s ease-out, height 0.08s ease-out;
  filter: drop-shadow(0 0 10px rgba(17, 214, 222, 0.25));
}

.vent-wave {
  position: absolute;
  bottom: -200%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 35% 30%, #A3DEDE, #0EA5A8 40%, #0B7F82 70%, #053E3E);
  border-radius: 38%;
  animation: wave-spin 2s linear infinite;
  transition: bottom 0.08s ease-out;
}

@keyframes wave-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Timer controls */
.timer-controls {
  display: flex;
  gap: 12px;
}

.timer-controls .btn {
  flex: 1;
}


/* ===================================================== */
/*  BUTTONS                                               */
/* ===================================================== */
.btn {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  outline: none;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font);
}

.btn:active { transform: scale(0.96); }
.btn.disabled, .btn:disabled { opacity: 0.3; pointer-events: none; }

.btn-start {
  background: var(--accent);
  color: var(--bg);
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px var(--accent-dim);
}
.btn-start:hover {
  box-shadow: 0 4px 24px var(--accent-glow);
  background: #25e5ed;
}

.btn-pause {
  background: rgba(245, 166, 35, 0.1);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.3);
}
.btn-pause:hover { background: rgba(245, 166, 35, 0.18); }

.btn-outline {
  background: transparent;
  color: var(--text3);
  border: 1px solid var(--glass-border);
}
.btn-outline:hover {
  color: var(--text);
  border-color: var(--glass-border);
  background: var(--glass);
}

.btn-xs {
  padding: 6px 12px;
  font-size: 0.65rem;
  border-radius: 6px;
}

.btn-cyan {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 15px var(--accent-dim);
}
.btn-cyan:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  background: #25e5ed;
}

.btn-amber {
  background: rgba(245, 166, 35, 0.1);
  color: var(--amber);
  border: 1px solid var(--amber);
}
.btn-amber:hover { background: rgba(245, 166, 35, 0.2); }


/* ===================================================== */
/*  ALS CHECKLIST PANEL                                   */
/* ===================================================== */
.als-panel {
  padding: 12px 16px;
}

.als-header {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.als-grid {
  display: flex;
  gap: 8px;
}

.als-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border-lt);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.als-check-item:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--glass-border);
}
.als-check-item:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.als-check-item.checked {
  border-color: rgba(17, 214, 222, 0.3);
  background: rgba(17, 214, 222, 0.05);
}

.als-check-icon {
  font-size: 1.3rem;
  color: var(--text3);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  line-height: 1;
}

.als-check-item.checked .als-check-icon {
  color: var(--accent);
}

.als-check-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.als-check-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.als-check-sub {
  font-size: 0.65rem;
  color: var(--text3);
  font-weight: 600;
}

.als-check-status {
  flex-shrink: 0;
}

.als-check-etco2 {
  cursor: default;
}

.als-etco2-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.als-etco2-controls input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border-lt);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  width: 70px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  font-family: var(--mono);
}

.als-etco2-controls input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}

.btn-etco2-log {
  padding: 6px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 0.15s ease;
  font-family: var(--font);
}

.btn-etco2-log:hover {
  background: #25e5ed;
  box-shadow: 0 4px 12px var(--accent-dim);
}

.als-value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}


/* ===================================================== */
/*  GUIDANCE PANEL (Advisor + ETCO2)                      */
/* ===================================================== */
.guidance-panel {
  padding: 16px 18px;
  flex: 1;
}

.guidance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 16px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
}

.etco2-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.etco2-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.05em;
}

.etco2-inline input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border-lt);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 8px;
  width: 60px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  font-family: var(--mono);
}

.etco2-inline input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-dim);
}

.advisor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.advisor-label {
  color: var(--text3);
}

.advisor-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.advisor-item {
  font-size: 0.8rem;
  font-weight: 400;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid transparent;
  background: rgba(255,255,255,0.02);
  line-height: 1.45;
}

.advisor-item strong {
  font-weight: 600;
}

.advisor-item.muted  { border-left-color: var(--text3); color: var(--text2); }
.advisor-item.action { border-left-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.advisor-item.warn   { border-left-color: var(--amber); color: var(--text); background: rgba(245, 166, 35, 0.08); }


/* ===================================================== */
/*  LOG SECTION (collapsible)                             */
/* ===================================================== */
.log-section {
  border: 1px solid var(--glass-border-lt);
  border-radius: var(--radius);
  background: var(--glass-lt);
  overflow: hidden;
}

.log-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  cursor: pointer;
  user-select: none;
}

.log-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-chevron {
  font-size: 0.75rem;
  color: var(--text3);
  transition: transform 0.2s;
}

.log-chevron.open {
  transform: rotate(180deg);
}

.log-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.log-body.open {
  max-height: 350px;
  overflow-y: auto;
}

.log-table-wrapper {
  border-top: 1px solid var(--glass-border-lt);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border-lt);
  background: rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table td {
  font-size: 0.8rem;
  color: var(--text2);
  padding: 10px 16px;
  border-bottom: 1px solid var(--glass-border-lt);
  transition: background 0.2s;
}

.data-table tbody tr:hover { background: rgba(17, 214, 222, 0.03); }
.data-table tbody tr:last-child td { border-bottom: none; }


/* ===================================================== */
/*  DRUG PANEL (right sidebar)                            */
/* ===================================================== */
.drug-panel {
  width: 340px;
  flex-shrink: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-self: stretch;
}

.drug-panel-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.drug-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  padding: 10px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-top: 4px;
}

/* Drug row */
.drug-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.drug-row:last-child { border-bottom: none; }

.drug-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drug-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.drug-detail {
  font-size: 0.65rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 5px;
}

.drug-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-primary   { background: var(--accent-dim); color: var(--accent); }
.badge-warning   { background: rgba(245, 166, 35, 0.1); color: var(--amber); }
.badge-violet    { background: rgba(167, 139, 250, 0.1); color: var(--violet); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text3); }

.drug-dose {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  min-width: 76px;
  text-align: right;
  white-space: nowrap;
}

.btn-drug {
  padding: 7px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 6px;
  background: var(--glass-heavy);
  color: var(--text2);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-drug:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-drug:active { transform: scale(0.96); }

/* Shock row highlight - removed, defib uses standard drug-row */

.btn-drug-shock {
  padding: 7px 12px;
  font-size: 0.65rem;
  font-weight: 800;
  border-radius: 6px;
  background: rgba(245, 166, 35, 0.1);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-drug-shock:hover {
  background: rgba(245, 166, 35, 0.2);
  box-shadow: 0 0 10px rgba(245, 166, 35, 0.1);
}

.btn-drug-shock:active { transform: scale(0.96); }


/* ===================================================== */
/*  MODAL                                                 */
/* ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.25s;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  max-width: 600px;
  margin: auto;
  padding: 6px 16px 12px;
  min-height: 70vh;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), inset 0 1px 0 var(--glass-highlight);
  border-color: rgba(255,255,255,0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Modal countdown progress bar */
.modal-countdown-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: var(--red);
  transition: width 1s linear;
  border-radius: 0 2px 2px 0;
}

/* ECG Stacked Layout in Modal */
.ecg-two-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

/* Column headers kept for potential future use */
.ecg-col-header {
  display: none;
}

.ecg-col-header-shock {
  display: none;
}

.ecg-strip-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ecg-strip-card:hover {
  background: rgba(17, 214, 222, 0.08);
  border-color: var(--accent);
}

.ecg-strip-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.ecg-strip-waveform {
  width: 100%;
  flex: 1;
  min-height: 40px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(0,0,0,0.3);
}

toddle-vfib_ecg,
toddle-pvt_ecg,
toddle-asystole_ecg,
toddle-pea_ecg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ecg-col-btn removed — rhythm selection via strip cards */

/* Legacy clickable ECG class (kept for JS selectors) */
.ecg-selectable {
  cursor: pointer;
}

.modal-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Modal steps — use visibility + clip instead of display:none so web components can initialize */
.modal-step.hidden {
  visibility: hidden;
  height: 0;
  flex: 0;
  overflow: hidden;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

/* Pulse check options */
.pulse-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

/* Compact pulse check row (single-page modal) */
.pulse-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.pulse-check-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  white-space: nowrap;
}
.btn-pulse-rosc {
  flex: 1;
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(17, 214, 222, 0.3);
  border-radius: 6px;
  background: rgba(17, 214, 222, 0.08);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-pulse-rosc:hover {
  background: rgba(17, 214, 222, 0.2);
  border-color: var(--accent);
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.modal-text {
  font-size: 0.85rem;
  color: var(--text2);
  text-align: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.text-amber { color: var(--amber); }

/* rhythm-options removed — buttons now inside ecg-col */

.btn-rhythm {
  flex-direction: column;
  padding: 12px 10px;
  gap: 4px;
  height: auto;
  border-radius: 8px;
}

.rhythm-title {
  font-size: 0.8rem;
  font-weight: 800;
}

.rhythm-desc {
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text2);
}

.btn-rhythm-ns {
  background: var(--glass-heavy);
  color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn-rhythm-ns:hover { background: rgba(255,255,255,0.08); }

.btn-rhythm-s {
  background: rgba(245, 166, 35, 0.08);
  color: var(--amber);
  border: 1px solid rgba(245, 166, 35, 0.3);
}
.btn-rhythm-s:hover { background: rgba(245, 166, 35, 0.15); }

.btn-rhythm-rosc {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(17, 214, 222, 0.3);
}
.btn-rhythm-rosc:hover { background: rgba(17, 214, 222, 0.15); }

.protocol-action {
  background: var(--glass-heavy);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
  margin-top: 16px;
  border: 1px solid var(--glass-border);
}

.protocol-action.hidden { display: none; }

.protocol-action .action-title {
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.protocol-action .btn { margin-top: 12px; }


/* ===================================================== */
/*  RESPONSIVE                                            */
/* ===================================================== */
@media (max-width: 1100px) {
  .layout {
    flex-direction: column;
  }
  .drug-panel {
    width: 100%;
    position: static;
    max-height: none;
    /* Switch to 2-column grid on tablet */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 20px;
  }
  .drug-panel-title,
  .drug-group-label {
    grid-column: 1 / -1;
  }
  .timer-display { font-size: 4rem; }
}

@media (max-width: 700px) {
  .header { padding: 12px 16px; }
  .header-inner {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .header-left { justify-content: space-between; }
  .status-strip {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
  }
  .layout { padding: 16px; gap: 16px; }
  .timer-card { padding: 16px; }
  .timer-top-row { flex-direction: column; gap: 12px; }
  .timer-display { font-size: 3.5rem; padding: 16px; }
  .timer-meta { flex-direction: row; justify-content: center; gap: 24px; }
  .als-grid { flex-direction: column; }
  .ecg-two-col { grid-template-columns: 1fr; }
  .guidance-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .drug-panel {
    grid-template-columns: 1fr;
  }
}

/* Confetti */
.confetti-piece {
  position: fixed;
  top: -10px;
  z-index: 9999;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
