:root {
  color-scheme: dark;
  --bg: #090b0c;
  --ink: #f4f1ea;
  --muted: #aaa69a;
  --line: rgba(244, 241, 234, 0.16);
  --panel: rgba(20, 22, 23, 0.86);
  --red: #ff3b3b;
  --green: #41f0a0;
  --amber: #f6b44b;
  --blue: #72b7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 59, 59, 0.16), transparent 28rem),
    linear-gradient(135deg, #08090a 0%, #111414 46%, #17110f 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 28px;
  align-items: stretch;
  min-height: 460px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
  padding: 36px 0 36px 28px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(4.2rem, 13vw, 10.5rem);
  line-height: 0.86;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.verdict-line {
  max-width: 36rem;
  color: #ddd5c7;
  font-size: clamp(1.2rem, 2vw, 1.7rem);
  line-height: 1.55;
}

.monitor {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  border: 1px solid rgba(65, 240, 160, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(rgba(65, 240, 160, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 240, 160, 0.08) 1px, transparent 1px),
    #060908;
  background-size: 30px 30px;
  box-shadow: inset 0 0 44px rgba(65, 240, 160, 0.08);
}

#ecg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
}

.monitor-overlay {
  position: absolute;
  right: 24px;
  bottom: 20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--green);
  text-shadow: 0 0 18px rgba(65, 240, 160, 0.65);
}

.bpm {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(3rem, 7vw, 5.7rem);
  font-weight: 900;
}

.bpm-unit {
  font-size: 1rem;
  font-weight: 900;
}

.status-strip,
.grid {
  display: grid;
  gap: 14px;
}

.status-strip {
  grid-template-columns: repeat(4, 1fr);
  margin: 16px 0;
}

.status-strip article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status-strip article {
  min-height: 138px;
  padding: 18px;
}

.status-strip strong {
  display: block;
  margin: 12px 0 8px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.status-strip small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.panel {
  min-height: 300px;
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.diagnosis {
  min-height: 360px;
}

.large-text {
  color: #e8dfd1;
  font-size: 1.22rem;
  line-height: 1.6;
}

.reason-list,
.mini-list,
.pulse-list {
  display: grid;
  gap: 10px;
}

.reason,
.mini-row,
.pulse-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid rgba(244, 241, 234, 0.1);
  padding-top: 10px;
  color: #d6cec1;
}

.reason span,
.mini-row span,
.pulse-row span {
  color: var(--muted);
}

.sleep-meter {
  overflow: hidden;
  height: 14px;
  margin: 0 0 18px;
  border: 1px solid rgba(246, 180, 75, 0.45);
  border-radius: 999px;
  background: rgba(246, 180, 75, 0.08);
}

.sleep-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  transition: width 700ms ease;
}

.pulse-row {
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pulse-row strong {
  color: var(--green);
  font-size: 1.4rem;
}

.dead {
  color: var(--red);
}

.alive {
  color: var(--green);
}

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

@media (max-width: 900px) {
  .hero,
  .grid,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 10px;
  }

  .hero-copy,
  .panel,
  .status-strip article {
    padding: 16px;
  }

  .hero-copy {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .reason,
  .mini-row,
  .pulse-row,
  .panel-head {
    align-items: start;
    flex-direction: column;
  }
}
