/* Interactive Mastery Passport, CVP <-> VExUS Hemodynamic Sandbox, and Bedside Pitfalls Lab */

.mastery-card,
.hemo-sandbox,
.pitfalls-lab {
  margin: 26px 0 32px;
  padding: 22px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.mastery-header,
.sandbox-header,
.pitfalls-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.mastery-header h2,
.sandbox-header h3,
.pitfalls-header h3 {
  margin: 2px 0 4px;
}

.mastery-sub,
.sandbox-sub,
.pitfalls-sub {
  margin: 0;
  color: #565656;
  font-size: 14px;
  line-height: 1.45;
  max-width: 64ch;
}

.mastery-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ededed;
  border: 1px solid #c6c6c6;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.mastery-progress-svg {
  display: block;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.mastery-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.mastery-step {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 13px;
  background: #fff;
  border: 1px solid #d8d8d8;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  min-height: 88px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

@media (hover: hover) {
  .mastery-step:hover {
    border-color: #8f6b24;
    box-shadow: 0 2px 6px rgba(27, 27, 27, 0.08);
  }
}

.mastery-step[data-status="done"] {
  background: #f6faf6;
  border-color: #7ea885;
}

.mastery-step[data-status="started"] {
  border-color: #c8a458;
}

.mastery-step-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #646464;
}

.mastery-step[data-status="done"] .mastery-step-state {
  color: #236335;
}

.mastery-step[data-status="started"] .mastery-step-state {
  color: #87621b;
}

.mastery-step strong {
  font-size: 14px;
  line-height: 1.3;
  color: #1d1d1d;
}

.mastery-step-detail {
  font-size: 12px;
  color: #5c5c5c;
}

.mastery-veins {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.mastery-vein-pill {
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--light);
  border: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.mastery-portfolio-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding-top: 12px;
  border-top: 1px solid #dfdfdf;
}

.mastery-portfolio-bar label {
  font-size: 13px;
  font-weight: 700;
  color: #323232;
}

.mastery-portfolio-bar input[type="text"] {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #b8b8b8;
  border-radius: 6px;
  background: #fff;
  color: #1d1d1d;
  font-size: 14px;
  min-width: 210px;
  flex: 1 1 210px;
  max-width: 300px;
}

.mastery-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #8b6826;
  background: #fff4d6;
  color: #1f1f1f;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.mastery-btn-secondary {
  border-color: #bbbbbb;
  background: #fff;
  color: #454545;
  font-weight: 600;
}

@media (hover: hover) {
  .mastery-btn:hover {
    background: #f9e6b3;
  }
  .mastery-btn-secondary:hover {
    background: #f2f2f2;
    border-color: #8b6826;
  }
}

.mastery-print-meta {
  display: none;
}

/* CVP <-> VExUS Hemodynamic Sandbox */
.sandbox-presets,
.pitfalls-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.sandbox-preset,
.pitfall-tab {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #b8b8b8;
  background: #fff;
  color: #282828;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sandbox-preset[aria-pressed="true"],
.pitfall-tab[aria-pressed="true"] {
  background: #fff0c6;
  border-color: #8b6826;
  box-shadow: inset 0 0 0 1px #8b6826;
  color: #1c1c1c;
}

@media (hover: hover) {
  .sandbox-preset:hover:not([aria-pressed="true"]),
  .pitfall-tab:hover:not([aria-pressed="true"]) {
    border-color: #89651f;
    background: #fcf6e8;
  }
}

.sandbox-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(190px, 1fr);
  gap: 12px 18px;
  align-items: end;
  margin-bottom: 14px;
}

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

.sandbox-control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: #292929;
}

.sandbox-control-label output {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #7c5b1c;
}

.sandbox-control input[type="range"] {
  width: 100%;
  height: 36px;
  margin: 0;
  accent-color: #89651f;
}

.sandbox-control select {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #b8b8b8;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  color: #1f1f1f;
}

.sandbox-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 12px 0;
  margin-bottom: 14px;
  border-block: 1px solid var(--line);
}

.sandbox-metric {
  padding: 2px 14px;
}

.sandbox-metric:first-child {
  padding-left: 0;
}

.sandbox-metric + .sandbox-metric {
  border-left: 1px solid var(--line);
}

.sandbox-metric span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.sandbox-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.sandbox-metric small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.sandbox-metric[data-alert="warn"] strong {
  color: #962b1b;
}

.sandbox-monitor,
.pitfall-monitor {
  background: #121519;
  border-radius: 8px;
  padding: 10px 12px 8px;
  border: 1px solid #2a3038;
  margin-bottom: 12px;
}

.sandbox-monitor svg,
.pitfall-monitor svg {
  display: block;
  width: 100%;
  height: auto;
}

.sandbox-readout {
  margin: 4px 0 0;
  padding: 12px 2px 0;
  background: transparent;
  border-top: 1px solid var(--line);
  border-radius: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* The chart's trace names, shown as text under it on phones, where the drawn labels would be too small. */
.sandbox-key {
  display: none;
  list-style: none;
  margin: 8px 0 2px;
  padding: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #e5e8ec;
}

.sandbox-key li {
  position: relative;
  padding-left: 18px;
  margin-top: 4px;
}

.sandbox-key li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 11px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}

.sandbox-key .key-cvp::before { background: #e6c47a; }
.sandbox-key .key-hepatic::before { background: #62cae8; }
.sandbox-key .key-portal::before { background: #ff8e6e; }
.sandbox-key .key-renal::before { background: #76a8ff; }
.sandbox-key .key-ecg { color: #bbc4ce; }
.sandbox-key .key-ecg::before { background: #63d483; }

/* Traces that mislead */
.pitfalls-tabs + .pitfalls-tabs {
  margin-top: -4px;
}

.pitfalls-group-label {
  flex-basis: 100%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
}

.pitfall-note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: #bbc4ce;
}

.pitfall-monitors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.pitfall-monitor-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #e5e8ec;
}

.pitfall-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(235, 106, 82, 0.2);
  color: #ff9d8a;
}

.pitfall-tag-good {
  background: rgba(98, 206, 133, 0.18);
  color: #8ce8a8;
}

.pitfall-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pitfall-info-card {
  padding: 2px 16px;
  font-size: 13.5px;
  line-height: 1.5;
}

.pitfall-info-card:first-child {
  padding-left: 0;
}

.pitfall-info-card:last-child {
  padding-right: 0;
}

.pitfall-info-card + .pitfall-info-card {
  border-left: 1px solid var(--line);
}

.pitfall-info-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.pitfall-info-card p {
  margin: 0;
  color: var(--ink-soft);
}

@media (max-width: 760px) {
  .mastery-card,
  .hemo-sandbox,
  .pitfalls-lab {
    padding: 16px;
  }
  .sandbox-controls,
  .pitfall-monitors,
  .pitfall-cards {
    grid-template-columns: 1fr;
  }
  .pitfall-info-card {
    padding: 10px 0;
  }
  .pitfall-info-card + .pitfall-info-card {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .sandbox-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }
  .sandbox-metric {
    padding: 2px 0;
  }
  .sandbox-metric + .sandbox-metric {
    border-left: 0;
  }
  .sandbox-preset,
  .pitfall-tab {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
  }
}

@media (max-width: 600px) {
  .sandbox-monitor svg text {
    display: none;
  }
  .sandbox-key {
    display: block;
  }
}

@media (pointer: coarse) {
  .mastery-portfolio-bar input[type="text"],
  .sandbox-control select {
    font-size: 16px;
  }
  .sandbox-control input[type="range"] {
    height: 44px;
  }
}

@media print {
  .site-header,
  .article-nav,
  .learn-topics,
  .article-content > section:not(#mastery-track),
  .mastery-portfolio-bar button,
  .site-footer nav {
    display: none !important;
  }
  .article-layout {
    display: block !important;
  }
  .mastery-card {
    border: 2px solid #222 !important;
    box-shadow: none !important;
    background: #fff !important;
    margin: 0 !important;
  }
  .mastery-print-meta {
    display: block !important;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid #ccc;
    font-size: 12px;
    color: #333;
  }
}
