:root {
  --bg: #f3f7fb;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #fffffe;
  --ink: #233047;
  --muted: #6e778e;
  --accent: #2fc2d8;
  --accent-deep: #1f4eae;
  --accent-soft: #8de3ea;
  --indigo: #4f5bcb;
  --mist: #edf3fb;
  --grid-major: rgba(47, 194, 216, 0.2);
  --grid-minor: rgba(47, 194, 216, 0.08);
  --trace: #111418;
  --shadow: 0 24px 70px rgba(31, 78, 174, 0.12);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(141, 227, 234, 0.35), rgba(141, 227, 234, 0) 28%),
    radial-gradient(circle at bottom right, rgba(79, 91, 203, 0.12), rgba(79, 91, 203, 0) 35%),
    linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 36px;
}

.hero,
.control-panel,
.monitor-card,
.learn-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(31, 78, 174, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding: 26px max(24px, calc((100vw - 1240px) / 2)) 24px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  box-shadow: 0 10px 30px rgba(31, 78, 174, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.96)),
    radial-gradient(circle at top left, rgba(141, 227, 234, 0.2), rgba(141, 227, 234, 0) 26%);
}

.eyebrow,
.monitor-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 5.4rem);
  line-height: 0.95;
}

h2 {
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.brand-subtitle,
.brand-tagline,
.monitor-description {
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.55;
}

.brand-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(47, 194, 216, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: #3158bc;
  text-decoration: none;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  background: rgba(47, 194, 216, 0.12);
  border-color: rgba(47, 194, 216, 0.3);
  color: #1f4eae;
}

.nav-link-active {
  background: linear-gradient(135deg, var(--accent), #35b7e5);
  border-color: transparent;
  color: white;
  box-shadow: 0 10px 18px rgba(47, 194, 216, 0.24);
}

.nav-link-return {
  padding-inline: 22px;
  background: linear-gradient(135deg, rgba(47, 194, 216, 0.14), rgba(53, 183, 229, 0.08));
  border-color: rgba(47, 194, 216, 0.24);
  color: #1f4eae;
  box-shadow: 0 10px 20px rgba(31, 78, 174, 0.08);
}

.brand-logo {
  display: block;
  width: min(560px, 48vw);
  max-width: 100%;
  height: auto;
}

.control-panel {
  margin-top: 26px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.2fr 1.2fr;
  gap: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(243, 247, 251, 0.96)),
    radial-gradient(circle at top right, rgba(141, 227, 234, 0.16), rgba(141, 227, 234, 0) 34%);
  border-color: rgba(47, 194, 216, 0.14);
}

.control {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.control > span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #6f86b9;
}

select,
.segmented,
.metric-grid article {
  border-radius: 18px;
}

select {
  width: 100%;
  border: 1px solid rgba(47, 194, 216, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.98));
  color: var(--ink);
  padding: 16px 18px;
  font: inherit;
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 8px 20px rgba(31, 78, 174, 0.06);
}

select:focus-visible {
  border-color: rgba(47, 194, 216, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 0 0 4px rgba(47, 194, 216, 0.12);
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(239, 245, 252, 0.96), rgba(247, 250, 255, 0.96));
  border: 1px solid rgba(47, 194, 216, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.two-option-segmented {
  grid-template-columns: repeat(2, 1fr);
  width: fit-content;
  min-width: 0;
  justify-self: start;
}

.time-btn {
  border: 0;
  background: transparent;
  color: #58708e;
  padding: 14px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.time-btn:hover,
.time-btn:focus-visible {
  background: rgba(47, 194, 216, 0.1);
  color: #3158bc;
}

.time-btn.active {
  background: linear-gradient(135deg, var(--accent), #35b7e5);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(47, 194, 216, 0.28);
}

.challenge-time-btn {
  border: 0;
  background: transparent;
  color: #58708e;
  padding: 14px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.challenge-time-btn:hover,
.challenge-time-btn:focus-visible {
  background: rgba(47, 194, 216, 0.1);
  color: #3158bc;
}

.challenge-time-btn.active {
  background: linear-gradient(135deg, var(--accent), #35b7e5);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(47, 194, 216, 0.28);
}

.mode-panel,
.placeholder-card {
  margin-top: 22px;
  padding: 22px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(31, 78, 174, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mode-panel-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.mode-selector {
  min-width: 320px;
}

.challenge-card {
  margin-top: 22px;
}

.challenge-intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.challenge-intro .monitor-description {
  margin: 0;
}

.challenge-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.challenge-time-control {
  max-width: 360px;
}

.challenge-window-selector {
  min-width: 260px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: #58708e;
  padding: 14px 16px;
  font: inherit;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.mode-btn:hover,
.mode-btn:focus-visible {
  background: rgba(47, 194, 216, 0.1);
  color: #3158bc;
}

.mode-btn.active {
  background: linear-gradient(135deg, var(--accent), #35b7e5);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(47, 194, 216, 0.28);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-grid article {
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.95));
  border: 1px solid rgba(47, 194, 216, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 8px 18px rgba(31, 78, 174, 0.05);
}

.metric-grid small {
  display: block;
  color: #7b89a5;
  margin-bottom: 8px;
}

.metric-grid strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  color: #22408f;
}

.monitor-card {
  margin-top: 22px;
  padding: 22px;
}

.description-block {
  margin-top: 18px;
}

.description-block .monitor-description {
  margin: 0;
  max-width: none;
}

.learn-card {
  margin-top: 22px;
  padding: 22px;
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 18px;
}

.monitor-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.authoring-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.compare-btn {
  border: 1px solid rgba(47, 194, 216, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.98));
  color: #3158bc;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 18px rgba(31, 78, 174, 0.05);
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.compare-btn:hover,
.compare-btn:focus-visible {
  background: rgba(47, 194, 216, 0.12);
  border-color: rgba(47, 194, 216, 0.32);
  color: #1f4eae;
}

.compare-btn.is-active {
  background: linear-gradient(135deg, var(--accent), #35b7e5);
  color: white;
  border-color: transparent;
  box-shadow: 0 10px 18px rgba(47, 194, 216, 0.24);
}

.compare-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.learn-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 18px;
}

.canvas-wrap {
  position: relative;
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  background: linear-gradient(180deg, #fcfeff, #f5fbff);
  border: 1px solid rgba(47, 194, 216, 0.14);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 3.6;
}

.trace-overlay {
  position: absolute;
  left: 0;
  top: 50%;
  display: none;
  max-width: none;
  width: var(--svg-window-width, 100%);
  height: auto;
  transform: translateY(-50%) scaleY(var(--svg-uniform-scale, 1));
  transform-origin: left center;
  pointer-events: none;
}

.hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.hotspot-button {
  position: absolute;
  border: 1px dashed rgba(47, 194, 216, 0.72);
  background: rgba(47, 194, 216, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.hotspot-button:hover,
.hotspot-button:focus-visible,
.hotspot-button.is-active {
  background: rgba(47, 194, 216, 0.18);
  border-color: rgba(31, 78, 174, 0.82);
}

.hotspot-card {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  width: min(320px, calc(100% - 32px));
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(47, 194, 216, 0.18);
  box-shadow: 0 12px 24px rgba(31, 78, 174, 0.12);
}

.annotation-pin {
  position: absolute;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1f4eae, #35b7e5);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 78, 174, 0.24);
  cursor: pointer;
}

.annotation-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 8px;
  background: #35b7e5;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.annotation-pin:hover,
.annotation-pin:focus-visible,
.annotation-pin.is-active {
  transform: scale(1.06);
}

.annotation-layer.is-authoring {
  cursor: crosshair;
}

.annotation-delete-btn {
  border: 0;
  background: rgba(201, 92, 92, 0.1);
  color: #ab4040;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.annotation-delete-btn:hover,
.annotation-delete-btn:focus-visible {
  background: rgba(201, 92, 92, 0.18);
}

.annotation-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(47, 194, 216, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.95));
}

.annotation-summary-header {
  margin-bottom: 8px;
}

.annotation-summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.annotation-summary-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(47, 194, 216, 0.08);
}

.annotation-summary-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.annotation-summary-note {
  margin: 0;
  color: var(--ink);
  line-height: 1.4;
}

.annotation-summary-note strong {
  color: #22408f;
}

.conduction-explorer-card {
  margin-top: 22px;
  padding: 22px;
}

.conduction-explorer-card-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.conduction-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
}

.conduction-explorer-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.15fr);
  gap: 18px;
}

.conduction-explorer-stage {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.96));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conduction-panel {
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 18px rgba(31, 78, 174, 0.05);
}

.conduction-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}

.conduction-panel-header h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.18rem;
  color: #22408f;
}

.heart-conduction-map,
.animated-rhythm-svg {
  width: 100%;
  min-height: 320px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fcfeff, #f5fbff);
  border: 1px solid rgba(47, 194, 216, 0.12);
}

.heart-conduction-map {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.heart-png-stage {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.heart-png-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.heart-png-base {
  filter: drop-shadow(0 16px 28px rgba(31, 78, 174, 0.12));
}

.heart-png-overlay {
  mix-blend-mode: screen;
  opacity: 0.88;
}

.heart-png-map.tone-normal .heart-png-overlay {
  filter: drop-shadow(0 0 12px rgba(47, 194, 216, 0.28));
}

.heart-png-map.tone-delayed .heart-png-overlay {
  filter: hue-rotate(-24deg) saturate(1.05) drop-shadow(0 0 12px rgba(244, 183, 64, 0.32));
}

.heart-png-map.tone-blocked .heart-png-overlay {
  filter: hue-rotate(-62deg) saturate(1.1) drop-shadow(0 0 12px rgba(211, 79, 79, 0.3));
  opacity: 0.74;
}

.heart-png-map.tone-ectopic .heart-png-overlay {
  filter: hue-rotate(34deg) saturate(1.15) drop-shadow(0 0 12px rgba(160, 96, 255, 0.34));
}

.heart-png-map.tone-chaotic .heart-png-overlay {
  filter: hue-rotate(18deg) saturate(1.22) drop-shadow(0 0 14px rgba(187, 77, 120, 0.34));
  opacity: 0.92;
}

.heart-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.heart-map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(47, 194, 216, 0.16);
  color: #5d749a;
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(31, 78, 174, 0.08);
}

.heart-map-label.is-active {
  color: #1f4eae;
  border-color: rgba(47, 194, 216, 0.34);
  box-shadow: 0 8px 18px rgba(47, 194, 216, 0.16);
}

.animated-rhythm-svg {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ecg-phase-stage {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 8;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.ecg-phase-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ecg-phase-background {
  opacity: 1;
}

.ecg-phase-overlay {
  opacity: 0.96;
  mix-blend-mode: normal;
  filter: hue-rotate(-118deg) saturate(3) brightness(1.08) drop-shadow(0 0 6px rgba(236, 204, 74, 0.3));
}

.rhythm-svg-overlay {
  position: absolute;
  inset: 0;
}

.rhythm-playhead {
  position: absolute;
  top: 4%;
  bottom: 4%;
  width: 2px;
  background: linear-gradient(180deg, rgba(47, 194, 216, 0.2), rgba(47, 194, 216, 1), rgba(47, 194, 216, 0.2));
  box-shadow: 0 0 12px rgba(47, 194, 216, 0.36);
}

.rhythm-svg-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: block;
  pointer-events: none;
}

.marker-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2fc2d8;
  box-shadow: 0 0 0 3px rgba(47, 194, 216, 0.14);
  display: block;
}

.rhythm-svg-marker.is-active .marker-dot {
  background: #2fc2d8;
  box-shadow: 0 0 0 5px rgba(47, 194, 216, 0.12), 0 0 14px rgba(47, 194, 216, 0.28);
}

.marker-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(calc(-50% + var(--marker-label-dx, 0px)), calc(-50% + var(--marker-label-dy, -24px)));
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(47, 194, 216, 0.14);
  color: #22408f;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.type-pause .marker-dot,
.type-dropped_qrs .marker-dot {
  background: #d34f4f;
  box-shadow: 0 0 0 4px rgba(211, 79, 79, 0.12);
}

.type-pvc .marker-dot,
.type-pac .marker-dot,
.type-fibrillatory_baseline .marker-dot {
  background: #8a58ea;
  box-shadow: 0 0 0 4px rgba(138, 88, 234, 0.12);
}

.conduction-explorer-bottom {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.96));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conduction-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.conduction-panel-controls {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  padding-top: 2px;
}

.conduction-stage-controls {
  display: flex;
  justify-content: center;
}

.conduction-controls button,
.conduction-tabs button {
  border: 1px solid rgba(47, 194, 216, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.98));
  color: #3158bc;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.conduction-controls button:hover,
.conduction-controls button:focus-visible,
.conduction-tabs button:hover,
.conduction-tabs button:focus-visible,
.conduction-tabs button.is-active {
  background: rgba(47, 194, 216, 0.12);
  border-color: rgba(47, 194, 216, 0.32);
  color: #1f4eae;
}

.conduction-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.conduction-motion-note {
  color: #6f86b9;
  font-size: 0.86rem;
}

.conduction-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: #58708e;
  font-size: 0.88rem;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 999px;
  vertical-align: middle;
}

.legend-swatch.tone-normal {
  background: #2fc2d8;
}

.legend-swatch.tone-delayed {
  background: #f4b740;
}

.legend-swatch.tone-blocked {
  background: #d34f4f;
}

.legend-swatch.tone-ectopic {
  background: #8a58ea;
}

.legend-swatch.tone-chaotic {
  background: #bb4d78;
}

.conduction-fallback,
.conduction-explorer-fallback {
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed rgba(47, 194, 216, 0.22);
  background: rgba(248, 252, 255, 0.92);
  color: #58708e;
}

@media (max-width: 980px) {
  .conduction-explorer-header,
  .conduction-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .conduction-explorer-grid {
    grid-template-columns: 1fr;
  }

  .heart-conduction-map,
  .animated-rhythm-svg {
    min-height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .conduction-path,
  .chamber,
  .node,
  .focus,
  .rhythm-playhead,
  .rhythm-svg-marker,
  .marker-dot {
    transition: none !important;
    animation: none !important;
  }
}

.hotspot-card .monitor-label {
  margin-bottom: 6px;
}

.hotspot-explanation {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.challenge-answer-panel {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
}

.challenge-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.challenge-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 194, 216, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 18px rgba(31, 78, 174, 0.05);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.challenge-option:hover,
.challenge-option:focus-visible {
  border-color: rgba(47, 194, 216, 0.34);
  background: rgba(47, 194, 216, 0.08);
}

.challenge-option.is-selected {
  border-color: rgba(47, 194, 216, 0.42);
  background: rgba(47, 194, 216, 0.12);
  transform: translateY(-1px);
}

.challenge-option.is-correct {
  border-color: rgba(27, 145, 92, 0.42);
  background: rgba(27, 145, 92, 0.1);
}

.challenge-option.is-incorrect {
  border-color: rgba(201, 92, 92, 0.34);
  background: rgba(201, 92, 92, 0.1);
}

.challenge-option input {
  margin: 0;
  accent-color: var(--accent);
}

.challenge-option-text {
  color: var(--ink);
  font-weight: 600;
}

.challenge-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.challenge-feedback {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(47, 194, 216, 0.16);
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(240, 247, 252, 0.94));
}

.challenge-feedback.is-correct {
  border-color: rgba(27, 145, 92, 0.3);
  background: linear-gradient(180deg, rgba(243, 253, 247, 0.98), rgba(237, 249, 242, 0.95));
}

.challenge-feedback.is-incorrect {
  border-color: rgba(201, 92, 92, 0.28);
  background: linear-gradient(180deg, rgba(255, 248, 248, 0.98), rgba(252, 242, 242, 0.95));
}

.challenge-feedback h3 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.32rem;
  color: #22408f;
}

.challenge-feedback .monitor-description {
  margin: 0;
}

.challenge-feature-list-wrap {
  margin-top: 16px;
}

.challenge-feature-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.55;
}

.case-mode-card {
  margin-top: 22px;
}

.case-header-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: 20px;
  align-items: start;
}

.case-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.case-meta-grid article,
.case-context-grid article {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 8px 18px rgba(31, 78, 174, 0.05);
}

.case-meta-grid small,
.case-context-grid small,
.case-channel-label span {
  display: block;
  color: #7b89a5;
}

.case-meta-grid strong,
.case-context-grid strong {
  display: block;
  margin-top: 8px;
  color: #22408f;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.case-prompt-card,
.case-viewer-card,
.case-questions-card,
.case-feedback-card {
  margin-top: 22px;
  padding: 20px;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid rgba(31, 78, 174, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.case-context-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.case-viewer-header .monitor-description,
.case-prompt-card .monitor-description {
  margin: 0;
}

.case-channel-rows {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(47, 194, 216, 0.12);
  background:
    linear-gradient(180deg, rgba(250, 253, 255, 0.98), rgba(244, 249, 255, 0.96)),
    radial-gradient(circle at top right, rgba(141, 227, 234, 0.08), rgba(141, 227, 234, 0) 36%);
}

.stacked-channel-row,
.case-channel-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 4px;
  align-items: stretch;
}

.stacked-channel-row.is-emphasized .stacked-channel-label strong,
.case-channel-row.is-emphasized .case-channel-label strong {
  color: #1f4eae;
}

.stacked-channel-label,
.case-channel-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 2px 5px 2px 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(47, 194, 216, 0.12);
  text-align: right;
}

.stacked-channel-label strong,
.case-channel-label strong {
  font-size: 0.68rem;
  line-height: 1.05;
  color: #3158bc;
  letter-spacing: 0.02em;
  text-transform: none;
}

.stacked-channel-viewport,
.case-channel-viewport {
  position: relative;
  min-height: var(--case-channel-height, 68px);
  height: var(--case-channel-height, 68px);
  overflow: hidden;
  border-radius: 2px;
  border: 0;
  background:
    linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(244, 250, 255, 0.96)),
    repeating-linear-gradient(to right, rgba(79, 91, 203, 0.045) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(to bottom, rgba(79, 91, 203, 0.04) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(to right, rgba(47, 194, 216, 0.1) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(to bottom, rgba(47, 194, 216, 0.08) 0 1px, transparent 1px 70px);
  isolation: isolate;
}

.stacked-channel-viewport.is-ekg,
.case-channel-viewport.is-ekg {
  box-shadow:
    inset 0 0 0 1px rgba(47, 194, 216, 0.22),
    0 0 0 1px rgba(31, 78, 174, 0.05);
}

.case-ekg-wrap,
.case-channel-svg,
.case-channel-placeholder {
  width: 100%;
  height: 100%;
}

.case-ekg-wrap {
  position: relative;
}

.case-ekg-canvas {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.case-trace-overlay {
  position: absolute;
  left: 0;
  top: 50%;
}

.stacked-channel-svg,
.case-channel-svg {
  display: block;
  max-width: none;
  object-fit: fill;
}

.stacked-channel-placeholder,
.case-channel-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  color: #6f86b9;
  font-size: 0.82rem;
  text-align: center;
}

.stacked-channel-badge {
  position: absolute;
  top: 4px;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(31, 78, 174, 0.9);
  color: white;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 6px 12px rgba(31, 78, 174, 0.14);
}

.case-signal-notes {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(47, 194, 216, 0.12);
}

.case-signal-notes-toggle-wrap {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}

.case-viewer-subheader {
  margin-bottom: 10px;
}

.case-signal-notes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.case-signal-note-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(47, 194, 216, 0.12);
  background: rgba(250, 253, 255, 0.92);
}

.case-signal-note-card small {
  color: #6f86b9;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.case-signal-note-card strong {
  color: #213055;
  font-size: 0.92rem;
  line-height: 1.35;
}

.case-questions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.case-question-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 251, 0.95));
}

.case-question-title {
  margin: 0 0 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
}

.case-question-options {
  display: grid;
  gap: 10px;
}

.case-question-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(47, 194, 216, 0.12);
  background: rgba(255, 255, 255, 0.75);
}

.case-question-option input {
  margin: 0;
  accent-color: var(--accent);
}

.case-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.case-feedback-card {
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(240, 247, 252, 0.95));
}

.case-feedback-card h3 {
  margin: 0 0 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  color: #22408f;
}

.case-feedback-answer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-feedback-answer {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 194, 216, 0.14);
  background: rgba(255, 255, 255, 0.84);
}

.case-feedback-answer.is-correct {
  border-color: rgba(27, 145, 92, 0.26);
  background: rgba(243, 253, 247, 0.92);
}

.case-feedback-answer.is-incorrect {
  border-color: rgba(201, 92, 92, 0.24);
  background: rgba(255, 248, 248, 0.92);
}

.case-feedback-answer h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--ink);
}

.case-feedback-answer .monitor-description {
  margin: 0 0 8px;
  max-width: none;
}

.case-feedback-section {
  margin-top: 18px;
}

.case-feedback-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.55;
}

.case-unavailable {
  margin-top: 22px;
}

.compare-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(31, 78, 174, 0.08);
}

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

.compare-header h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
  color: #3158bc;
}

.compare-wrap {
  opacity: 0.96;
}

.video-frame {
  position: relative;
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  min-height: 280px;
  background: linear-gradient(135deg, #edf5fb, #fafdff);
  border: 1px solid rgba(47, 194, 216, 0.14);
}

.video-frame iframe {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: 0;
  aspect-ratio: 16 / 9;
}

.video-frame.has-video iframe {
  display: block;
}

.video-frame.has-video .video-placeholder {
  display: none;
}

.video-placeholder {
  display: flex;
  min-height: 280px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: #58708e;
  text-align: center;
}

.video-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(47, 194, 216, 0.14), rgba(79, 91, 203, 0.12));
  position: relative;
}

.video-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 20px solid #2fc2d8;
  transform: translateX(4px);
}

.placeholder-card h2 {
  margin-top: 6px;
}

@media (max-width: 980px) {
  .hero,
  .monitor-header,
  .learn-header {
    flex-direction: column;
    align-items: start;
  }

  .monitor-actions {
    align-items: flex-start;
    width: 100%;
  }

  .mode-panel-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .challenge-answer-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .challenge-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mode-selector {
    min-width: 0;
    width: 100%;
  }

  .compare-header {
    flex-direction: column;
    align-items: start;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .control-panel {
    grid-template-columns: 1fr;
  }

  .case-header-shell,
  .case-context-grid,
  .case-channel-row {
    grid-template-columns: 1fr;
  }

  .case-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-bottom: 22px;
  }

  .hero,
  .control-panel,
  .monitor-card,
  .learn-card {
    padding: 18px;
    border-radius: 22px;
  }

  .top-nav {
    width: 100%;
    gap: 10px;
  }

  .brand-mark {
    grid-template-columns: repeat(2, 60px);
  }

  .mark-tile {
    width: 60px;
    height: 60px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .challenge-options {
    grid-template-columns: 1fr;
  }

  .case-meta-grid,
  .case-context-grid {
    grid-template-columns: 1fr;
  }
}
