/* Everyday Satiety — Routine-Score MVP · responsive, accessible styling.
   Design targets an everyday adult beginner: large tap targets, high contrast,
   plain layout, light + dark. */

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #21201c;
  --muted: #5c574e;
  --accent: #8a5a1f;
  --accent-ink: #ffffff;
  --established: #4f7a34;
  --developing: #b5730a;
  --starting: #8a4636;
  --line: #ded9d0;
  --danger: #8a4636;
  --focus: #0b5fff;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}
.skip-link:focus {
  left: 0;
}

.disclaimer {
  background: #fff7e6;
  border-bottom: 3px solid var(--developing);
  color: #4a3608;
  padding: 1rem 1.25rem;
  font-size: 1rem;
}
.disclaimer strong {
  color: #3a2a06;
}

.site-header,
main,
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  padding-top: 1.5rem;
  padding-bottom: 0.5rem;
}
.site-header h1 {
  margin: 0;
  color: var(--accent);
  font-size: 2rem;
}
.tagline {
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
}
.card h2 {
  margin-top: 0;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  padding: 0.75rem 1rem 1rem;
}
legend {
  font-weight: 700;
  padding: 0 0.4rem;
}

.field {
  margin: 0.75rem 0;
}
label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
select,
input[type="text"],
textarea {
  width: 100%;
  min-height: 48px; /* large tap target */
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
textarea {
  min-height: 64px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus,
button:focus,
summary:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

button {
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.2rem;
  min-height: 52px;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
}
button.primary:hover {
  filter: brightness(1.05);
}
button.danger {
  background: #fff;
  color: var(--danger);
  border: 2px solid var(--danger);
}
button.danger:hover {
  background: var(--danger);
  color: #fff;
}

.errors {
  color: var(--danger);
  font-weight: 600;
  margin: 0.75rem 0;
}
.errors ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
}
.errors:empty {
  display: none;
}

/* Result */
.score-headline {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.score-number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}
.band {
  font-weight: 800;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  color: #fff;
}
.band.Established {
  background: var(--established);
}
.band.Developing {
  background: var(--developing);
}
.band.Starting {
  background: var(--starting);
}

.meter {
  height: 14px;
  border-radius: 999px;
  background: #ece7df;
  overflow: hidden;
  margin: 0.75rem 0 1rem;
}
.meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.factors {
  list-style: none;
  margin: 0;
  padding: 0;
}
.factors li {
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
.factor-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-weight: 600;
}
.factor-bar {
  height: 8px;
  border-radius: 999px;
  background: #ece7df;
  margin: 0.35rem 0;
  overflow: hidden;
}
.factor-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.factor-why {
  color: var(--muted);
  font-size: 0.95rem;
}

.experiment {
  background: #f4efe6;
  border: 1px solid #e0d6c3;
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
}
.experiment h3 {
  margin: 0 0 0.35rem;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.streak {
  color: var(--accent);
  font-weight: 700;
}
.history {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}
.history .meta {
  color: var(--muted);
  font-size: 0.9rem;
}
.history .del {
  background: none;
  border: none;
  color: var(--danger);
  font-weight: 700;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
}

.danger-zone {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
}

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;
  padding-top: 1rem;
  padding-bottom: 2rem;
  text-align: center;
}

@media (max-width: 480px) {
  body {
    font-size: 17px;
  }
  .score-number {
    font-size: 2.5rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --card: #211d17;
    --ink: #f1ece3;
    --muted: #b3ab9d;
    --line: #3d372d;
    --accent: #d09a4e;
    --accent-ink: #23180a;
  }
  .disclaimer {
    background: #2a2410;
    color: #ffe9b8;
    border-bottom-color: #b5730a;
  }
  .disclaimer strong {
    color: #fff3d6;
  }
  select,
  input,
  textarea {
    background: #100e0a;
    color: var(--ink);
  }
  .experiment {
    background: #2a2318;
    border-color: #4a3f2a;
  }
}
