:root {
  --linen: #ebe6df;
  --linen-deep: #ddd6cc;
  --slate: #3d4a57;
  --slate-soft: #5c6b7a;
  --coral: #e86f5c;
  --coral-glow: rgba(232, 111, 92, 0.22);
  --ink: #1e2830;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Outfit", system-ui, sans-serif;
  --max: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--linen);
  line-height: 1.5;
  min-height: 100vh;
}

.clinic-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(165deg, rgba(255,255,255,0.55) 0%, transparent 42%),
  repeating-linear-gradient(
    90deg,
    transparent,
    transparent 79px,
    rgba(61, 74, 87, 0.04) 79px,
    rgba(61, 74, 87, 0.04) 80px
  ),
  var(--linen);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  padding: 0.5rem 1rem;
  z-index: 99;
}
.skip:focus { left: 1rem; top: 1rem; }

.clinic-head {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid var(--slate);
  position: relative;
  flex-shrink: 0;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid var(--coral);
  border-right-color: transparent;
  transform: rotate(-35deg);
}

.brand strong {
  display: block;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.brand small {
  display: block;
  font-size: 0.78rem;
  color: var(--slate-soft);
}

.clinic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.88rem;
}
.clinic-nav a {
  color: var(--slate);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.clinic-nav a:hover { border-bottom-color: var(--coral); }

.ward {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}

@media (max-width: 860px) {
  .ward {
    grid-template-columns: 1fr;
  }
  .dial-column { order: -1; }
}

.intro h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.15;
  margin: 0.5rem 0 1rem;
  color: var(--slate);
}

.tag {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate-soft);
  margin: 0;
}

.lede {
  font-family: var(--serif);
  font-size: 1.08rem;
  color: var(--slate);
  max-width: 36em;
  margin: 0 0 1.25rem;
}

.hint-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
  color: var(--slate-soft);
}
.hint-list li {
  padding: 0.35rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--linen-deep);
  margin-bottom: 0.35rem;
}

.dial-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.dial-panel {
  width: 100%;
  max-width: 340px;
  background: #f6f3ef;
  border: 1px solid rgba(61, 74, 87, 0.12);
  border-radius: 1.25rem;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.8) inset,
    0 24px 48px -28px rgba(30, 40, 48, 0.35);
}

.dial-face {
  position: relative;
  width: min(72vw, 260px);
  aspect-ratio: 1;
  margin: 0 auto 1rem;
  transition: filter 0.4s ease;
}
.dial-face.is-pulse {
  filter: drop-shadow(0 0 18px var(--coral-glow));
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.dial-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#dial-ring {
  transition: stroke-dashoffset 0.15s linear;
}

.dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#dial-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 8vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--slate);
  margin: 0;
}

.dial-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate-soft);
  margin: 0.15rem 0 0;
}

#pulse-btn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 1rem 1.25rem;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--slate);
  color: #f6f3ef;
  transition: background 0.2s, transform 0.15s;
}
#pulse-btn:hover { background: #2f3a45; }
#pulse-btn:active { transform: scale(0.98); }
#pulse-btn.is-live {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 8px 28px -8px rgba(232, 111, 92, 0.65);
}
#pulse-btn.is-live:hover { background: #d85f4d; }

.avg-strip {
  width: 100%;
  max-width: 340px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: rgba(61, 74, 87, 0.06);
  border-radius: 0.75rem;
  font-size: 0.9rem;
}
.avg-strip dt { margin: 0; color: var(--slate-soft); }
.avg-strip dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}

.log-block {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

.log-block h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--slate);
}

.log-wrap {
  overflow-x: auto;
  border: 1px solid rgba(61, 74, 87, 0.1);
  border-radius: 0.75rem;
  background: #f6f3ef;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(61, 74, 87, 0.08);
}
th {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-soft);
  background: rgba(61, 74, 87, 0.04);
}
tr:last-child td { border-bottom: none; }
tr.empty td {
  text-align: center;
  color: var(--slate-soft);
  font-family: var(--serif);
  padding: 1.5rem;
}

.log-tools {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}
#clear-log {
  border: none;
  background: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--slate-soft);
  text-decoration: underline;
  cursor: pointer;
}
#clear-log:hover { color: var(--coral); }

.disclaimer {
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-size: 0.92rem;
  color: var(--slate-soft);
  border-left: 3px solid var(--coral);
  padding: 0.75rem 0 0.75rem 1rem;
  margin: 0.5rem 0 0;
  max-width: 42em;
}

.clinic-foot {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  border-top: 1px solid rgba(61, 74, 87, 0.1);
  font-size: 0.82rem;
  color: var(--slate-soft);
}
.clinic-foot p { margin: 0.35rem 0; }
.clinic-foot a { color: var(--slate); }
.clinic-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
}

/* Legal shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.shell .topbar {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.shell .topbar .brand span { display: block; font-size: 0.78rem; color: var(--slate-soft); }
.shell .prose {
  flex: 1;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  font-family: var(--serif);
}
.shell .prose h1 { font-family: var(--sans); color: var(--slate); }
.shell .foot {
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
  font-size: 0.82rem;
  color: var(--slate-soft);
  border-top: 1px solid rgba(61, 74, 87, 0.1);
}