:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --ink: #16201c;
  --muted: #66726d;
  --line: #d7dfdb;
  --panel: #ffffff;
  --panel-soft: #eef5f1;
  --green: #226f54;
  --green-dark: #174c3c;
  --teal: #2c7f86;
  --yellow: #d89b26;
  --orange: #cf6930;
  --red: #b63d44;
  --sky: #d7edf1;
  --shadow: 0 18px 50px rgba(36, 56, 49, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(215, 237, 241, 0.8), transparent 36%),
    linear-gradient(315deg, rgba(255, 238, 202, 0.65), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.4rem, 6vw, 5.2rem);
  line-height: 0.92;
  letter-spacing: 0;
  max-width: 950px;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.lede {
  margin-bottom: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.status-card,
.panel {
  border: 1px solid rgba(22, 32, 28, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.status-card {
  display: grid;
  align-content: center;
  min-height: 168px;
  padding: 22px;
}

.status-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.status-card strong {
  display: block;
  margin: 6px 0;
  font-size: 4rem;
  line-height: 0.95;
}

.status-card span:last-child {
  color: var(--green-dark);
  font-weight: 800;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(360px, 1fr) minmax(300px, 390px);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
}

.assessment-panel {
  grid-row: span 3;
}

.result-panel {
  min-height: 520px;
}

.physiology-panel {
  min-height: 360px;
}

.sources-panel {
  grid-column: 2 / 4;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.reset-button,
.timer-controls button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.reset-button {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.82rem;
}

.reset-button:hover,
.timer-controls button:hover,
.segmented button:hover {
  border-color: rgba(34, 111, 84, 0.52);
}

fieldset {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.question {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
  font-size: 0.94rem;
  font-weight: 700;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.compact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compact-grid label {
  display: grid;
  gap: 7px;
}

.compact-grid span,
.toggle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.compact-grid input,
.compact-grid select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.toggle {
  display: flex;
  gap: 9px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--ink);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.meter-wrap {
  position: relative;
  display: grid;
  width: min(320px, 100%);
  margin: 8px auto 16px;
  place-items: center;
}

.meter {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  max-height: 320px;
  filter: drop-shadow(0 18px 22px rgba(22, 32, 28, 0.1));
  transform: rotate(-90deg);
}

.meter-track,
.meter-progress {
  fill: none;
  stroke-width: 15;
}

.meter-track {
  stroke: #e0e8e3;
}

.meter-progress {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 477.52;
  stroke-dashoffset: 477.52;
  transition: stroke-dashoffset 260ms ease, stroke 260ms ease;
}

.pupil {
  fill: #15241f;
  transform-origin: 90px 90px;
  transition: transform 260ms ease;
}

.lens {
  fill: rgba(215, 237, 241, 0.84);
  stroke: #7fb8be;
  stroke-width: 4;
  transform-origin: 90px 90px;
  transition: transform 260ms ease;
}

.meter-copy {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  text-align: center;
  min-width: 130px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(8px);
}

.meter-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.meter-copy strong {
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  line-height: 1;
}

.summary {
  text-align: center;
}

.summary p {
  margin: 10px auto 22px;
  max-width: 540px;
  color: var(--muted);
  line-height: 1.55;
}

.recommendations {
  padding: 16px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.recommendations ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.recommendations li {
  line-height: 1.45;
}

.alert-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(182, 61, 68, 0.22);
  border-radius: 8px;
  background: rgba(255, 243, 242, 0.9);
}

.alert-box p {
  margin: 6px 0 0;
  color: #604347;
  font-size: 0.9rem;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 0;
}

.segmented button.active {
  background: var(--green);
  color: #fff;
}

.timer-face {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 18px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.82), transparent 32%),
    linear-gradient(160deg, #d7edf1, #eff7ed 55%, #fff2d8);
  text-align: center;
}

.timer-face span {
  color: var(--green-dark);
  font-weight: 900;
  text-transform: uppercase;
}

.timer-face strong {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 13vw, 5.6rem);
  line-height: 0.95;
}

.timer-face p {
  max-width: 300px;
  margin-bottom: 0;
  color: #42514c;
  line-height: 1.45;
}

.timer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.timer-controls button {
  min-height: 48px;
}

.timer-controls .primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.break-coach {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.45;
}

.break-coach p {
  margin-bottom: 0;
}

.breath-orbit {
  display: grid;
  width: 78px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.breath-orbit span {
  width: 32px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--teal);
  animation: blinkPulse 4s ease-in-out infinite;
}

.visual-system {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 16px;
  align-items: center;
}

.eye-diagram {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.95), rgba(215, 237, 241, 0.5)),
    repeating-linear-gradient(0deg, transparent, transparent 25px, rgba(34, 111, 84, 0.05) 26px);
}

.cornea {
  position: absolute;
  top: 36px;
  left: 28px;
  width: 110px;
  height: 138px;
  border: 5px solid rgba(44, 127, 134, 0.58);
  border-right: 0;
  border-radius: 90% 0 0 90%;
}

.diagram-lens {
  position: absolute;
  top: 54px;
  left: 104px;
  width: 58px;
  height: 102px;
  border: 5px solid #7fb8be;
  border-radius: 50%;
  background: rgba(215, 237, 241, 0.92);
  transition: transform 260ms ease;
}

.retina {
  position: absolute;
  top: 24px;
  right: 32px;
  width: 24px;
  height: 162px;
  border-radius: 50%;
  background: linear-gradient(#b63d44, #d89b26, #226f54);
}

.focus-ray {
  position: absolute;
  left: 0;
  width: calc(100% - 42px);
  height: 2px;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(207, 105, 48, 0), rgba(207, 105, 48, 0.8), rgba(207, 105, 48, 0));
}

.ray-one {
  top: 76px;
  transform: rotate(10deg);
}

.ray-two {
  bottom: 76px;
  transform: rotate(-10deg);
}

.focus-stack {
  display: grid;
  gap: 10px;
}

.focus-stack div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.focus-stack span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.focus-stack strong {
  display: block;
  margin-top: 4px;
}

.explain,
.fine-print {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding-left: 18px;
}

.source-list li {
  line-height: 1.45;
}

@keyframes blinkPulse {
  0%,
  100% {
    transform: scale(0.72);
    opacity: 0.82;
  }
  50% {
    transform: scale(1.22);
    opacity: 1;
  }
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: minmax(300px, 0.92fr) minmax(360px, 1.08fr);
  }

  .timer-panel,
  .physiology-panel {
    grid-column: auto;
  }

  .sources-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 620px);
    padding-top: 18px;
  }

  .topbar,
  .dashboard,
  .compact-grid,
  .visual-system,
  .source-list {
    grid-template-columns: 1fr;
  }

  .assessment-panel {
    grid-row: auto;
  }

  .status-card {
    min-height: 120px;
  }

  .status-card strong {
    font-size: 3.2rem;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading {
    align-items: center;
  }

  .break-coach {
    grid-template-columns: 62px 1fr;
  }

  .breath-orbit {
    width: 62px;
  }

  .focus-stack {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .focus-stack,
  .timer-controls {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 132px;
  }

  .source-list {
    padding-left: 16px;
  }
}
