/* HVCMD.com-inspired palette: navy, heart red, clean light backgrounds */
:root {
  --hvcmd-navy: #1e3a5f;
  --hvcmd-navy-dark: #0d2137;
  --hvcmd-red: #c41e3a;
  --hvcmd-red-soft: rgba(196, 30, 58, 0.12);
  --hvcmd-red-strong: #a01830;
  --bg: #f0f2f5;
  --bg-soft: #e8ecf1;
  --bg-softer: #ffffff;
  --accent: var(--hvcmd-red);
  --accent-soft: var(--hvcmd-red-soft);
  --accent-strong: var(--hvcmd-red-strong);
  --warn: #c41e3a;
  --text: #1e3a5f;
  --text-soft: #2d4a6f;
  --muted: #5c6b7a;
  --border: rgba(30, 58, 95, 0.2);
  --radius-lg: 12px;
  --radius-md: 10px;
  --shadow-soft: 0 4px 20px rgba(30, 58, 95, 0.08);
  --shadow-chip: 0 2px 12px rgba(30, 58, 95, 0.06);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.app-shell {
  max-width: 1200px;
  width: 100%;
  padding: 24px clamp(18px, 4vw, 28px) 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.app-header {
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--hvcmd-navy) 0%, var(--hvcmd-navy-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-soft);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.4vw, 2.2rem);
  letter-spacing: 0.02em;
  color: #ffffff;
}

.header-subtitle {
  margin: 8px 0 10px;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  font-weight: 400;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.01em;
  max-width: 52rem;
}

.tagline {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
}

.tagline strong {
  color: #fecaca;
}

.app-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* One section visible at a time */
.app-main.step-1 .results-panel,
.app-main.step-1 .checklist-panel {
  display: none;
}
.app-main.step-2 .intake-panel,
.app-main.step-2 .checklist-panel {
  display: none;
}
.app-main.step-3 .intake-panel,
.app-main.step-3 .results-panel {
  display: none;
}

.step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.panel {
  background: var(--bg-softer);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: -120px;
  background: radial-gradient(
    circle at top,
    var(--hvcmd-red-soft),
    transparent 65%
  );
  opacity: 0.5;
  pointer-events: none;
}

.panel > * {
  position: relative;
}

.panel h2 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--hvcmd-navy);
}

.hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.intake-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-grid-full {
  grid-column: 1 / -1;
}

.two-col-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
}

@media (max-width: 520px) {
  .two-col-fields {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}

.field label {
  color: var(--hvcmd-navy);
  font-weight: 500;
}

.field-help {
  font-size: 0.75rem;
  color: var(--muted);
}

.field input,
.field select {
  border-radius: var(--radius-md);
  border: 1px solid rgba(30, 58, 95, 0.25);
  padding: 6px 9px;
  font-size: 0.86rem;
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}

.field input::placeholder {
  color: var(--muted);
}

.field input:focus,
.field select:focus {
  border-color: var(--hvcmd-red);
  box-shadow: 0 0 0 2px var(--hvcmd-red-soft);
}

.field-group {
  margin: 6px 0 0;
  padding: 8px 10px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.field-group legend {
  padding: 0 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-top: 6px;
}

@media (max-width: 520px) {
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

.checkbox-grid label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.checkbox-grid input[type="checkbox"] {
  margin-top: 2px;
}

.small-note {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.dna-viewport {
  margin-top: 12px;
  border-radius: var(--radius-md);
  padding: 10px 10px 14px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  background: radial-gradient(circle at top, #020617, #020617 70%);
  min-height: 260px;
  max-height: 360px;
  overflow-y: auto;
  position: relative;
}

.dna-viewport::before {
  content: "";
  position: absolute;
  inset: 14px 50%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(148, 163, 184, 0.8),
    transparent
  );
  opacity: 0.7;
  transform: translateX(-0.5px);
}

.dna-step {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out,
    background-color 120ms ease-out, border-color 120ms ease-out;
  border-radius: 999px;
}

.dna-step:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.8);
  background: rgba(15, 23, 42, 0.85);
}

.dna-step.selected {
  border: 1px solid rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
  background: radial-gradient(
    circle at center,
    rgba(56, 189, 248, 0.14),
    rgba(15, 23, 42, 0.9)
  );
}

.dna-base {
  flex: 0 0 80px;
  padding: 7px 10px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #020617;
  font-weight: 600;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-chip);
}

.dna-base span.letter {
  font-size: 1.1rem;
}

.dna-base small {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dna-base.left {
  transform: translateX(2px) rotate(-6deg);
}

.dna-base.right {
  transform: translateX(-2px) rotate(6deg);
}

.dna-base-a {
  background: radial-gradient(circle at top, #fed7aa, var(--dna-a));
}

.dna-base-t {
  background: radial-gradient(circle at top, #bfdbfe, var(--dna-t));
}

.dna-base-c {
  background: radial-gradient(circle at top, #bbf7d0, var(--dna-c));
}

.dna-base-g {
  background: radial-gradient(circle at top, #e9d5ff, var(--dna-g));
}

.dna-rung {
  flex: 1 1 auto;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    rgba(148, 163, 184, 0.1),
    rgba(248, 250, 252, 0.8),
    rgba(148, 163, 184, 0.1)
  );
  position: relative;
  overflow: hidden;
}

.dna-rung::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    135deg,
    transparent 0,
    rgba(56, 189, 248, 0.6) 30%,
    rgba(129, 140, 248, 0.5) 70%,
    transparent 100%
  );
  opacity: 0.2;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 7px 14px;
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 100ms ease-out, box-shadow 120ms ease-out,
    background-color 120ms ease-out, border-color 120ms ease-out,
    color 120ms ease-out;
}

.btn.primary {
  background: linear-gradient(135deg, var(--hvcmd-red), var(--hvcmd-red-strong));
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(196, 30, 58, 0.35);
}

.btn.secondary {
  background: var(--bg-softer);
  color: var(--hvcmd-navy);
  border-color: var(--hvcmd-red);
}

.btn.warning {
  background: linear-gradient(135deg, var(--hvcmd-red), var(--hvcmd-red-strong));
  color: #ffffff;
  box-shadow: 0 2px 12px rgba(196, 30, 58, 0.35);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.results-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.results-section {
  margin-top: 4px;
  padding: 10px 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.86rem;
}

.results-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

/* Traffic light graphic: red (high), yellow (intermediate), green (low) */
.traffic-light {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: #1e3a5f;
  border-radius: 12px;
  border: 2px solid var(--border);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

.traffic-light-bulb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.traffic-light-bulb.traffic-red {
  background: #7f1d1d;
}
.traffic-light-bulb.traffic-yellow {
  background: #713f12;
}
.traffic-light-bulb.traffic-green {
  background: #14532d;
}

.traffic-light.risk-high .traffic-red {
  background: #dc2626;
  box-shadow: 0 0 12px #ef4444;
}
.traffic-light.risk-high .traffic-yellow,
.traffic-light.risk-high .traffic-green {
  background: rgba(255, 255, 255, 0.12);
}

.traffic-light.risk-intermediate .traffic-yellow {
  background: #eab308;
  box-shadow: 0 0 12px #facc15;
}
.traffic-light.risk-intermediate .traffic-red,
.traffic-light.risk-intermediate .traffic-green {
  background: rgba(255, 255, 255, 0.12);
}

.traffic-light.risk-low .traffic-green {
  background: #16a34a;
  box-shadow: 0 0 12px #22c55e;
}
.traffic-light.risk-low .traffic-red,
.traffic-light.risk-low .traffic-yellow {
  background: rgba(255, 255, 255, 0.12);
}

.traffic-light.badge-neutral {
  opacity: 0.5;
}

.results-title {
  font-weight: 500;
  color: var(--hvcmd-navy);
}

.results-text {
  margin: 4px 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.results-subtitle {
  margin: 8px 0 2px;
  font-size: 0.9rem;
  color: var(--hvcmd-navy);
}

.results-subsubtitle {
  margin: 6px 0 2px;
  font-size: 0.86rem;
  color: var(--hvcmd-navy);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-neutral {
  background: var(--bg-soft);
  color: var(--hvcmd-navy);
  border: 1px solid var(--border);
}

.badge-low {
  background: rgba(34, 139, 34, 0.12);
  color: #166534;
  border: 1px solid rgba(34, 139, 34, 0.4);
}

.badge-intermediate {
  background: rgba(196, 30, 58, 0.1);
  color: var(--hvcmd-red-strong);
  border: 1px solid rgba(196, 30, 58, 0.4);
}

.badge-high {
  background: var(--hvcmd-red-soft);
  color: var(--hvcmd-red-strong);
  border: 1px solid var(--hvcmd-red);
}

.alert {
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
}

.alert-warning {
  background: var(--hvcmd-red-soft);
  border-color: var(--hvcmd-red);
  color: var(--hvcmd-red-strong);
}

.checklist-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.print-summary {
  margin-top: 6px;
  padding: 10px 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.83rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.print-summary h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--hvcmd-navy);
}

.print-summary h4 {
  margin: 8px 0 2px;
  font-size: 0.85rem;
  color: var(--hvcmd-navy);
}

.print-summary-section {
  margin-top: 4px;
}

.print-summary-list {
  margin: 2px 0 0;
  padding-left: 16px;
}

.print-summary-list li {
  margin: 1px 0;
}

/* On screen: hide the print-only block (it is populated and shown only when printing) */
.printable-patient-summary {
  display: none;
}

@media print {
  .app-shell,
  .app-shell * {
    display: none !important;
  }
  .printable-patient-summary {
    display: block !important;
    padding: 24px;
    max-width: 100%;
    font-size: 11pt;
    line-height: 1.4;
    color: #1e3a5f;
    background: #fff;
  }
  .printable-patient-summary h3 {
    font-size: 14pt;
    margin-top: 0;
    color: #1e3a5f;
    border-bottom: 2px solid #c41e3a;
    padding-bottom: 6px;
  }
  .printable-patient-summary h4 {
    font-size: 12pt;
    margin-top: 12px;
    color: #1e3a5f;
  }
  .printable-patient-summary ul {
    margin: 4px 0;
    padding-left: 20px;
  }
  .printable-patient-summary p {
    margin: 6px 0;
  }
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(30, 58, 95, 0.15);
}

.btn.primary:hover,
.btn.warning:hover {
  box-shadow: 0 4px 16px rgba(196, 30, 58, 0.4);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.palette-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.palette {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.base-chip {
  border-radius: 999px;
  padding: 9px 12px;
  background: radial-gradient(circle at top, #0f172a, #020617 90%);
  border: 1px solid rgba(148, 163, 184, 0.9);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-chip);
  cursor: grab;
  user-select: none;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out,
    border-color 120ms ease-out, background-color 120ms ease-out;
}

.base-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #020617;
}

.base-chip small {
  font-size: 0.75rem;
  color: var(--muted);
}

.base-chip.base-a span {
  background: radial-gradient(circle at top, #fed7aa, var(--dna-a));
}

.base-chip.base-t span {
  background: radial-gradient(circle at top, #bfdbfe, var(--dna-t));
}

.base-chip.base-c span {
  background: radial-gradient(circle at top, #bbf7d0, var(--dna-c));
}

.base-chip.base-g span {
  background: radial-gradient(circle at top, #e9d5ff, var(--dna-g));
}

.base-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.95);
  border-color: rgba(56, 189, 248, 0.9);
  background: radial-gradient(circle at top, #020617, #020617 90%);
}

.base-chip:active {
  transform: translateY(0);
  box-shadow: none;
  cursor: grabbing;
}

.info-card {
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 0.82rem;
  color: var(--text-soft);
}

.info-card h3 {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--hvcmd-navy);
}

.info-card ul {
  margin: 0;
  padding-left: 18px;
}

.info-card li {
  margin: 2px 0;
}

.story-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
}

.story-challenge {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #e5e7eb;
}

.melon-game {
  margin-top: 10px;
  padding: 10px 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: radial-gradient(circle at top, #020617, #020617 90%);
}

.melon-game h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.melon-preview {
  position: relative;
  width: 120px;
  height: 70px;
  margin: 4px auto 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.melon-rind {
  width: 100%;
  height: 60px;
  border-radius: 999px 999px 10px 10px;
  background: linear-gradient(to bottom, #16a34a, #15803d);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4px 6px 2px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
}

.melon-flesh {
  width: 100%;
  height: 100%;
  border-radius: 999px 999px 6px 6px;
  background: radial-gradient(circle at top, #fecaca, #f97373);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.melon-seeds {
  display: flex;
  gap: 6px;
}

.melon-seeds .seed {
  width: 6px;
  height: 10px;
  border-radius: 999px;
  background: #020617;
  box-shadow: 0 0 3px rgba(15, 23, 42, 0.8);
}

.melon-label {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.melon-preview.melon-empty .melon-flesh {
  background: radial-gradient(circle at top, #e5e7eb, #9ca3af);
}

.melon-preview.melon-sweet .melon-flesh {
  background: radial-gradient(circle at top, #fecaca, #fb7185);
}

.melon-preview.melon-cool .melon-flesh {
  background: radial-gradient(circle at top, #e0f2fe, #38bdf8);
}

.melon-preview.melon-gold .melon-flesh {
  background: radial-gradient(circle at top, #fef3c7, #facc15);
}

.melon-preview.melon-moon .melon-flesh {
  background: radial-gradient(circle at top, #ede9fe, #a855f7);
}

.melon-preview.melon-mixed .melon-flesh {
  background: radial-gradient(circle at top, #fecaca, #a855f7);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  border-radius: 999px;
  padding: 6px 10px;
  background: radial-gradient(circle at top, #020617, #020617 90%);
  border: 1px solid rgba(148, 163, 184, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.stat-chip .label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-chip .value {
  font-weight: 600;
  color: #e5e7eb;
}

.app-footer {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 4px 16px 0;
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 14px;
  }

  .panel {
    padding-inline: 14px;
  }
}

