/* Style A, "Lugn": warm light ground, forest green, Nunito. */
:root {
  --bg: #FAF7F2;
  --card: #FFFFFF;
  --text: #1F1B17;
  --muted: #6B6259;
  --line: #E9E2D7;
  --ring: #D8CFC2;
  --accent: #2F6B4F;
  --accent-soft: #E3EFE8;
  --part: #C98B45;
  --danger: #B3412F;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 Nunito, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 32px);
}

h1 { font-size: 30px; font-weight: 800; line-height: 1.1; margin: 0; }
h2 { font-size: 22px; font-weight: 800; margin: 0; }
.muted { color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.center { text-align: center; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
.primary, .secondary, .log-btn {
  border-radius: 999px;
  min-height: 48px;
  padding: 10px 18px;
  font-weight: 700;
}
.primary { background: var(--accent); border: 0; color: #fff; font-weight: 800; }
.secondary { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.small { min-height: 36px; padding: 6px 12px; }
.link { background: none; border: 0; color: var(--muted); padding: 8px 0; min-height: 44px; font-size: 15px; }
.link.strong { color: var(--accent); font-weight: 700; }
.error { color: var(--danger); min-height: 1.4em; margin: 8px 0 0; font-size: 15px; }
.banner { background: #F6EAD9; border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-size: 15px; }

/* Week */
.week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.nav-group { display: flex; gap: 8px; }
.nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 22px; line-height: 1; }

.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 18px; }
.strip-day {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; font-weight: 700;
}
.strip-dot {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 15px;
}
.strip-dot svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.strip-day.today { color: var(--text); font-weight: 800; }
.strip-day.klart .strip-dot { background: var(--accent); border-color: var(--accent); }
.strip-day.delvis .strip-dot { background: var(--part); border-color: var(--part); }
.strip-day.sel .strip-dot { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.strip-day.sel.inte .strip-dot { border: 3px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 800; box-shadow: none; }

.day {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.day-head { display: flex; align-items: center; gap: 10px; }
.chip { background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.day-text { margin: 0; color: var(--muted); }
.day-text strong { color: var(--text); }

.box {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--ring); background: var(--card);
  display: grid; place-items: center; padding: 0;
}
.box svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.box.klart { background: var(--accent); border-color: var(--accent); }
.box.delvis { background: var(--part); border-color: var(--part); }
.day-head .box { width: 34px; height: 34px; }

.items { list-style: none; margin: 0; padding: 0; }
.item { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 52px; background: none; border: 0; padding: 0; font-size: 18px; text-align: left; }
.item.done > span:last-child { color: var(--muted); text-decoration: line-through; }

.strava { display: flex; flex-wrap: wrap; gap: 6px; }
.strava span { font-size: 14px; font-weight: 700; color: #A83A08; background: #FFF0E8; border-radius: 999px; padding: 4px 12px; }

.logs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.log-btn { border: 1px solid var(--accent); background: transparent; color: var(--accent); font-size: 16px; padding: 10px 8px; white-space: nowrap; }
.log-btn.primary { background: var(--accent); color: #fff; font-weight: 800; }
.log-btn.done { border-color: var(--line); background: var(--bg); color: var(--muted); }
.day > .link { align-self: flex-start; }

.note { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
textarea {
  font: inherit; font-size: 16px; color: var(--text); width: 100%;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg); resize: vertical;
}

.buddy { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px; }
.buddy .lemming { width: 80px; height: 72px; flex: none; }
.bubble {
  margin: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 16px; font-weight: 600;
}

.strava-note, .fine { font-size: 13px; margin-top: 8px; }
.fine a { color: var(--accent); }

/* Full plan */
.full .md { font-size: 16px; overflow-x: auto; }
.full .md h2 { font-size: 19px; margin: 24px 0 8px; }
.full .md ul { padding-left: 20px; }
.full .md li { margin: 6px 0; }
.md blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.md blockquote p { margin: 0; }
.md table { border-collapse: collapse; font-size: 14px; }
.md td, .md th { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: left; }
.more { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 8px; }
.more > summary { color: var(--muted); padding: 12px 0; min-height: 44px; cursor: pointer; }
.more h2 { color: var(--muted); }

/* Mascot and check-in */
.mascot { display: grid; justify-items: center; gap: 10px; }
.lemming { width: 190px; height: 171px; }
.says {
  margin: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 10px 16px; font-size: 17px; font-weight: 600; text-align: center;
}
.bob .lemming { animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .bob .lemming { animation: none; } }

.checkin {
  display: flex; flex-direction: column; gap: 16px;
  min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 56px);
}
.checkin h2 { font-size: 26px; text-align: center; margin-top: 8px; }
.checkin.done { justify-content: center; align-items: center; text-align: center; }
.ci-top { display: flex; align-items: center; gap: 14px; }
.progress { flex: 1; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; }
.progress span { height: 6px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--accent); }
.big { display: block; text-align: center; font-size: 72px; font-weight: 800; color: var(--accent); line-height: 1; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 44px; }
.ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; }
.ci-nav { margin-top: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ci-nav button { min-height: 54px; font-size: 17px; }

/* Login and empty states */
.login, .empty { display: grid; gap: 12px; justify-items: center; text-align: center; padding-top: 12vh; }
.login form { display: grid; gap: 10px; width: 100%; max-width: 320px; }
.login input { font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px);
  max-width: 488px; margin: 0 auto;
  background: var(--text); color: #fff; border-radius: 14px; padding: 12px 14px;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.toast[hidden] { display: none; }
