:root {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #202824;
  --muted: #64706a;
  --line: #dce2de;
  --green: #2f6d53;
  --green-soft: #e5f0e9;
  --blue: #486f8d;
  --blue-soft: #e8f0f5;
  --coral: #b6573e;
  --coral-soft: #f8ebe7;
  --shadow: 0 12px 32px rgba(31, 45, 38, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }

button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }

.wellness-label {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.app-shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.loading {
  padding: 48px 0;
  color: var(--muted);
  text-align: center;
}

.intro {
  padding: 8px 0 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: 44px; line-height: 1.08; }
h2 { margin-bottom: 10px; font-size: 22px; }
h3 { margin-bottom: 8px; font-size: 17px; }
.lede { max-width: 580px; margin-bottom: 0; color: var(--muted); font-size: 17px; }

.surface {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.surface + .surface, .surface + .section, .section + .surface { margin-top: 16px; }

.section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-child { border-bottom: 0; }

.field { display: grid; gap: 7px; margin: 0 0 18px; }
.field > span, .field legend { font-size: 14px; font-weight: 700; }
.hint { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #c8d0cb;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(72, 111, 141, 0.25);
  outline-offset: 2px;
}

fieldset { min-width: 0; padding: 0; border: 0; }

.segments {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segments.energy { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.segments.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.segment { position: relative; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: grid;
  min-height: 48px;
  padding: 8px;
  place-items: center;
  border: 1px solid #c8d0cb;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.segment input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: #1f563f;
  font-weight: 800;
}

.checks { display: grid; gap: 12px; margin: 20px 0; }
.check { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 14px; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--green); }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.button:hover { filter: brightness(0.96); }
.button:disabled { cursor: wait; opacity: 0.6; }
.button.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button.soft { border-color: #bdd0c5; background: var(--green-soft); color: #1f563f; }
.button.danger { border-color: #ebc9c0; background: var(--coral-soft); color: #843c29; }
.button.wide { width: 100%; }

.notice {
  margin: 0 0 18px;
  padding: 13px 14px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  color: #2e5069;
  font-size: 14px;
}

.notice.error { border-left-color: var(--coral); background: var(--coral-soft); color: #843c29; }
.notice.success { border-left-color: var(--green); background: var(--green-soft); color: #1f563f; }

.welcome-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.provider {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #cbd7df;
  border-radius: 6px;
  background: var(--blue-soft);
  color: #365d78;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.provider-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }

.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric { min-height: 76px; padding: 12px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-size: 22px; }
.metric span { color: var(--muted); font-size: 12px; }

.samsung-steps {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid #cad8e2;
  border-radius: 6px;
  background: var(--blue-soft);
}
.samsung-steps strong { display: block; margin-bottom: 4px; }
.samsung-steps p { margin: 0; color: #365d78; font-size: 13px; }

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

.action-band {
  padding: 22px;
  border-left: 5px solid var(--green);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.action-band .action-body { margin-bottom: 16px; font-size: 19px; font-weight: 750; }
.action-detail { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 14px; }
.action-detail strong { color: var(--ink); }

.completion-state { padding: 12px 14px; border-radius: 6px; background: var(--green-soft); color: #1f563f; font-weight: 750; }

.celebration { margin-top: 16px; padding: 18px; border: 1px solid #e4c9a4; border-radius: 8px; background: #fff7e8; }
.celebration h3 { color: #80551e; }
.celebration p { margin-bottom: 0; color: #755e3f; }

details.participation { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
details.participation summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 700; }
details.participation .button-row { margin-top: 14px; }

.footer { padding: 0 18px max(24px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 560px) {
  h1 { font-size: 32px; }
  .wellness-label { max-width: 105px; }
  .app-shell { padding-top: 20px; }
  .surface { padding: 18px; }
  .segments { grid-template-columns: 1fr; }
  .segments.energy { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .segments.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .input-grid { grid-template-columns: 1fr; gap: 0; }
  .welcome-row { display: grid; }
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2) { border-right: 0; }
  .metric:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .button-row .button { flex: 1 1 140px; }
}
