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

:root {
  --bg: #0d0f14;
  --surface: #14171f;
  --surface2: #1c2030;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --text: #f0eee8;
  --text-muted: #8a8d96;
  --text-dim: #555a66;
  --accent: #e8624a;
  --accent-soft: rgba(232, 98, 74, 0.12);
  --green: #4caf82;
  --green-soft: rgba(76, 175, 130, 0.12);
  --amber: #e8a84a;
  --amber-soft: rgba(232, 168, 74, 0.12);
  --red: #e84a4a;
  --red-soft: rgba(232, 74, 74, 0.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background effects ── */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
}

.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.orb1 {
  width: 600px;
  height: 600px;
  background: rgba(232, 98, 74, 0.06);
  top: -200px;
  right: -100px;
}
.orb2 {
  width: 400px;
  height: 400px;
  background: rgba(76, 175, 130, 0.04);
  bottom: -100px;
  left: -50px;
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* ── Header ── */
header {
  margin-bottom: 3rem;
}

.heartbeat-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heartbeat-icon svg {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.08); opacity: 0.8; }
}

h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.6rem;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 480px;
}

/* ── Form cards ── */
.form-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 1.2rem;
  transition: border-color 0.2s;
}

.card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-label::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border);
}

/* ── Fields ── */
.field {
  margin-bottom: 1.4rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.field-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 300;
}

/* ── Inputs (masked) ── */
input[type="password"] {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  letter-spacing: 0.2em;
}

input[type="password"]:focus {
  border-color: var(--accent);
  background: rgba(232, 98, 74, 0.04);
}

input[type="password"]::placeholder {
  color: var(--text-dim);
  letter-spacing: normal;
}

/* ── Blood pressure row ── */
.bp-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.bp-sep {
  text-align: center;
  color: var(--text-dim);
  font-size: 1.3rem;
  padding-bottom: 2px;
}

/* ── Toggle buttons ── */
.toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toggle-btn {
  padding: 0.72rem 1rem;
  border-radius: 10px;
  border: 0.5px solid var(--border);
  background: var(--surface2);
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.toggle-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.toggle-btn.sel-yes {
  background: var(--red-soft);
  border-color: rgba(232, 74, 74, 0.35);
  color: #f07070;
}

.toggle-btn.sel-no {
  background: var(--green-soft);
  border-color: rgba(76, 175, 130, 0.35);
  color: #6fcca0;
}

/* ── Predict button ── */
.predict-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 0.5rem;
}

.predict-btn:hover  { opacity: 0.9; }
.predict-btn:active { transform: scale(0.99); }

/* ── Error message ── */
.error-msg {
  font-size: 0.8rem;
  color: #f07070;
  margin-top: 0.8rem;
  padding: 0.7rem 1rem;
  background: rgba(232, 74, 74, 0.08);
  border: 0.5px solid rgba(232, 74, 74, 0.2);
  border-radius: 10px;
  display: none;
}

/* ── Result section ── */
.result-wrap {
  display: none;
}

.result-card {
  border-radius: 20px;
  padding: 1.8rem;
  border: 0.5px solid;
  margin-bottom: 1rem;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card.low    { background: var(--green-soft); border-color: rgba(76, 175, 130, 0.25); }
.result-card.medium { background: var(--amber-soft); border-color: rgba(232, 168, 74, 0.25); }
.result-card.high   { background: var(--red-soft);   border-color: rgba(232, 74, 74, 0.25); }

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 1.2rem;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  font-size: 1.2rem;
}

.risk-badge.low    { background: rgba(76, 175, 130, 0.18); }
.risk-badge.medium { background: rgba(232, 168, 74, 0.18); }
.risk-badge.high   { background: rgba(232, 74, 74, 0.18); }

.result-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 3px;
}

.result-title.low    { color: var(--green); }
.result-title.medium { color: var(--amber); }
.result-title.high   { color: var(--red); }

.result-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Factor breakdown list ── */
.factors-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.8rem;
}

.factor-list {
  list-style: none;
}

.factor-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0.7rem 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 0.84rem;
  line-height: 1.5;
}

.factor-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.factor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.dot-high        { background: var(--red); }
.dot-medium      { background: var(--amber); }
.dot-medium-high { background: #e87a4a; }
.dot-low         { background: var(--green); }

.factor-name   { font-weight: 500; color: var(--text); margin-right: 4px; }
.factor-reason { color: var(--text-muted); }

/* ── Disclaimer ── */
.disclaimer {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 0.5px solid var(--border);
}

/* ── Reset button ── */
.reset-btn {
  width: 100%;
  padding: 0.8rem;
  border-radius: 12px;
  border: 0.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0.5rem;
}

.reset-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
  background: var(--surface2);
}

/* ── Footer ── */
footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .container { padding: 2rem 1rem 3rem; }
  .form-card  { padding: 1.4rem; }
  h1          { font-size: 1.8rem; }
}
