:root {
  --bg: #f3f1ea;
  --card: #ffffff;
  --text: #17210f;
  --muted: #68705f;
  --line: #e2ded1;
  --green: #234c14;
  --green-2: #3f7821;
  --green-soft: #e7f2dc;
  --amber: #a16207;
  --amber-soft: #fff2cc;
  --red: #9f2d16;
  --red-soft: #ffe4dc;
  --shadow: 0 14px 40px rgba(31, 44, 20, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(63, 120, 33, .16), transparent 34rem),
    linear-gradient(180deg, #f7f5ef 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 14px 52px;
}

.hero {
  color: white;
  background:
    linear-gradient(135deg, rgba(35, 76, 20, .97), rgba(12, 45, 28, .97)),
    linear-gradient(45deg, transparent 0 40%, rgba(255,255,255,.08) 40% 60%, transparent 60% 100%);
  border-radius: 30px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero__top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 6px;
  color: #cfe6be;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(32px, 9vw, 58px); line-height: .88; letter-spacing: -0.055em; }
h2 { margin-bottom: 4px; font-size: 17px; letter-spacing: -0.02em; }
p { color: var(--muted); line-height: 1.5; }
.hero p:not(.eyebrow) { color: #d9ebcf; margin-bottom: 0; font-size: 14px; }

.pill {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.12);
  color: white;
  padding: 9px 13px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 800;
}

.progress-card {
  margin-top: 26px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
}
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 800; }
.bar { margin-top: 9px; height: 10px; border-radius: 999px; background: rgba(255,255,255,.14); overflow: hidden; }
.bar span { display: block; width: 0%; height: 100%; border-radius: inherit; background: #d9f99d; transition: width .35s ease; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  padding: 12px 0;
  backdrop-filter: blur(12px);
}
.tab, .week-switch button, .mood-grid button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.76);
  color: var(--muted);
  min-height: 42px;
  border-radius: 15px;
  font-weight: 800;
}
.tab.active, .week-switch button.active, .mood-grid button.active {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.view { display: none; }
.view.active { display: block; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 2px 0 12px;
}
.stats article, .panel, .smart-card {
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(226, 222, 209, .9);
  box-shadow: var(--shadow);
}
.stats article {
  border-radius: 20px;
  padding: 16px 10px;
  text-align: center;
}
.stats strong { display: block; font-size: 25px; letter-spacing: -0.04em; }
.stats span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }

.smart-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.smart-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 900;
}
.smart-card strong { display: block; margin-bottom: 3px; }
.smart-card p { margin-bottom: 0; font-size: 13px; }
.smart-card.danger .smart-icon { color: var(--red); background: var(--red-soft); }
.smart-card.danger { border-color: #ffc3b5; }

.panel {
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.panel.compact { padding: 16px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head p { margin-bottom: 0; font-size: 13px; }

.week-switch {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-bottom: 12px;
}
.week-switch.two { grid-template-columns: repeat(2, 1fr); }
.week-switch button { min-height: 38px; font-size: 12px; }

.mission-list, .timeline { display: grid; gap: 9px; }
.mission {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf8;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.mission:hover { transform: translateY(-1px); border-color: #c7d8b5; }
.mission.done { background: var(--green-soft); border-color: #bfd9a8; }
.day {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: #f0eee7;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}
.mission.done .day { background: var(--green); color: white; }
.mission-title { font-weight: 900; font-size: 14px; }
.mission-detail { margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.42; }
.xp-badge {
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
}
.mission.done .xp-badge { background: var(--green); color: white; }

.sleep-row {
  border-style: dashed;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mood-grid button[data-mood="sakit"].active { background: var(--red); border-color: var(--red); }
.mood-grid button[data-mood="pegal"].active { background: var(--amber); border-color: var(--amber); }

.timeline .mission {
  grid-template-columns: 46px 1fr;
  align-items: start;
}
.timeline .xp-badge { justify-self: start; margin-top: 8px; }
.timeline .day { margin-top: 2px; }

.strength-table { display: grid; gap: 8px; }
.str-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fffdf8;
  padding: 13px;
}
.str-row strong { display: block; margin-bottom: 3px; }
.str-row p { margin-bottom: 0; font-size: 12px; }
.sets { align-self: start; padding: 7px 9px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-weight: 900; font-size: 12px; }

.mini-list { margin: 10px 0 0; padding-left: 20px; color: var(--muted); line-height: 1.7; font-size: 13px; }

.eval-form { display: grid; gap: 12px; }
.eval-form label { display: grid; gap: 7px; font-weight: 900; font-size: 13px; }
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffdf8;
  color: var(--text);
  padding: 12px;
  resize: vertical;
  outline: none;
}
textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(63, 120, 33, .13); }
.primary-btn {
  border: 0;
  border-radius: 16px;
  min-height: 46px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  background: #14220d;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.setup-error {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--red-soft);
  border: 1px solid #ffc3b5;
  color: var(--red);
  margin-top: 12px;
}
.setup-error code { background: rgba(255,255,255,.55); padding: 2px 6px; border-radius: 7px; }

@media (max-width: 560px) {
  .shell { padding-inline: 10px; }
  .hero { padding: 18px; border-radius: 24px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
  .stats article { padding-inline: 6px; }
  .mission { grid-template-columns: 38px 1fr; }
  .mission .xp-badge { grid-column: 2; justify-self: start; padding-block: 6px; }
  .week-switch { grid-template-columns: repeat(4, 1fr); }
}
