/* ==================================================================
   Andningshjälpen — enkel, stor, tydlig. iPhone + iPad.
   ================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: #FFFFFF;
  color: #111;
  -webkit-text-size-adjust: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ================= SKÄRM 1 — hennes knappar ================= */
#screen-home { gap: 10px; padding: 10px; }

#home-buttons {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-level {
  flex: 1;
  min-height: 25dvh;
  border: none;
  border-radius: 18px;
  font-size: clamp(28px, 5.5vw, 56px);
  font-weight: 800;
  line-height: 1.15;
  padding: 12px 20px;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-level:active { filter: brightness(0.85); }

.btn-secondary {
  min-height: 64px;
  border: 3px solid #555;
  border-radius: 14px;
  background: #F2F2F2;
  color: #222;
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 700;
  cursor: pointer;
}

/* ================= SKÄRM 2 — personalskärm ================= */
#screen-staff { background: #FFFFFF; }

.staff-band {
  padding: 18px 20px;
  text-align: center;
}
.staff-band h1 {
  font-size: clamp(34px, 5.5vw, 64px);
  font-weight: 900;
  letter-spacing: 1px;
}
.staff-band .patient-name {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 700;
  margin-top: 2px;
}
.staff-band.flash { animation: flashband 0.8s infinite; }
@keyframes flashband {
  0%, 49.9% { filter: none; }
  50%, 100% { filter: brightness(1.9); }
}

.draft-badge {
  background: #FFF3CD;
  color: #7A5C00;
  border-bottom: 2px solid #E0C860;
  text-align: center;
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 700;
  padding: 6px 10px;
}

.hearing-banner {
  background: #111;
  color: #FFEB3B;
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 800;
  padding: 14px 18px;
  line-height: 1.3;
}

.comm-note {
  background: #FFEB3B;
  color: #111;
  border-bottom: 4px solid #111;
  font-size: clamp(19px, 2.4vw, 28px);
  font-weight: 800;
  padding: 12px 18px;
  line-height: 1.3;
}

.staff-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
}

#staff-content, #ambulance-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.staff-steps { list-style: none; counter-reset: step; }
.staff-steps li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: clamp(24px, 2.8vw, 34px);
  line-height: 1.35;
  padding: 10px 0;
  border-bottom: 1px solid #E5E5E5;
  font-weight: 600;
}
.staff-steps li::before {
  content: counter(step);
  flex: 0 0 auto;
  width: 1.7em;
  height: 1.7em;
  border-radius: 50%;
  background: #111;
  color: #FFF;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95em;
}

.escalation-box {
  border: 5px solid #C62828;
  border-radius: 14px;
  margin: 18px 0 10px;
  padding: 14px 16px;
  background: #FFF5F5;
}
.escalation-box.top { margin-top: 0; }
.escalation-box h2 {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 900;
  color: #C62828;
  margin-bottom: 6px;
}
.escalation-box p {
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}
.escalation-box p:last-child { margin-bottom: 0; }

.med-box {
  border: 3px solid #1565C0;
  border-radius: 14px;
  background: #F0F6FF;
  margin: 10px 0 16px;
  padding: 12px 16px;
}
.med-box h2 {
  font-size: clamp(19px, 2.2vw, 26px);
  color: #1565C0;
  font-weight: 800;
  margin-bottom: 6px;
}
.med-box p, .med-box li {
  font-size: clamp(18px, 2.1vw, 25px);
  line-height: 1.35;
  font-weight: 600;
}
.med-box ul { list-style: disc; padding-left: 1.2em; margin-top: 4px; }

.alert-status {
  margin: 4px 0 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #ECEFF1;
  color: #37474F;
  font-size: clamp(18px, 2.1vw, 25px);
  font-weight: 700;
}
.alert-status.alert-ok { background: #E8F5E9; color: #1B5E20; }
.alert-status.alert-fail { background: #FFF3CD; color: #7A5C00; }

.staff-footer {
  display: flex;
  gap: 12px;
  padding: 10px 14px 14px;
  align-items: center;
}
.btn-write {
  flex: 1;
  min-height: 74px;
  border: none;
  border-radius: 14px;
  background: #1565C0;
  color: #FFF;
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 800;
  cursor: pointer;
}
.btn-ambulance {
  min-height: 74px;
  min-width: 84px;
  border: 3px solid #C62828;
  border-radius: 14px;
  background: #FFF;
  font-size: clamp(28px, 3.4vw, 40px);
  cursor: pointer;
}

/* Ambulansöverlämning */
.amb-box {
  border: 3px solid #555;
  border-radius: 14px;
  background: #FAFAFA;
  margin: 0 0 14px;
  padding: 12px 16px;
}
.amb-box h2 {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 800;
  margin-bottom: 6px;
}
.amb-box p {
  font-size: clamp(19px, 2.2vw, 26px);
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: 4px;
}
.amb-timeline { list-style: none; }
.amb-timeline li {
  font-size: clamp(18px, 2.1vw, 25px);
  line-height: 1.45;
  font-weight: 600;
  padding: 4px 0;
  border-bottom: 1px solid #E5E5E5;
}
.amb-time {
  display: inline-block;
  min-width: 3.2em;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  color: #C62828;
}

.btn-back {
  min-height: 54px;
  padding: 0 20px;
  border: 2px solid #999;
  border-radius: 12px;
  background: #FFF;
  color: #555;
  font-size: clamp(16px, 1.8vw, 22px);
  cursor: pointer;
}

/* ================= SKÄRM 3 — Skriv till mig ================= */
#screen-write { background: #FFFFFF; }

.write-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  gap: 20px;
  min-height: 45dvh;
}
.write-message {
  font-weight: 900;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  width: 100%;
}
.write-placeholder { color: #AAA; font-size: clamp(20px, 3vw, 30px); font-weight: 600; }

.write-replies {
  display: flex;
  gap: 14px;
  width: 100%;
}
.btn-reply {
  flex: 1;
  min-height: 16dvh;
  border: none;
  border-radius: 18px;
  font-size: clamp(30px, 5vw, 60px);
  font-weight: 900;
  color: #FFF;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-reply:active { filter: brightness(0.85); }
.btn-ja { background: #2E7D32; }
.btn-nej { background: #C62828; }
.btn-vetinte { background: #757575; font-size: clamp(20px, 3vw, 38px); flex: 0.7; }

.write-staff-area {
  border-top: 3px solid #DDD;
  background: #F7F7F7;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}
.write-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip {
  border: 2px solid #1565C0;
  color: #1565C0;
  background: #FFF;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: clamp(16px, 1.9vw, 22px);
  font-weight: 700;
  cursor: pointer;
}
.chip:active { background: #E3F0FF; }

/* AI-föreslagna fraser */
.chip-smart {
  border-color: #6A1B9A;
  color: #6A1B9A;
  background: #FAF4FF;
}
.chip-smart:active { background: #F0DFFF; }

.write-input-row { display: flex; gap: 10px; margin-bottom: 10px; }
#write-input {
  flex: 1;
  font-size: clamp(20px, 2.4vw, 28px);
  padding: 14px;
  border: 3px solid #1565C0;
  border-radius: 12px;
}
.btn-show {
  min-width: 110px;
  border: none;
  border-radius: 12px;
  background: #1565C0;
  color: #FFF;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 800;
  cursor: pointer;
}

/* Fullskärmssvar */
.reply-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: clamp(80px, 20vw, 260px);
  font-weight: 900;
}
