* { box-sizing: border-box; }

:root {
  --bg: #dfe6e4;
  --surface: #f5f8f7;
  --surface-2: #eaf0ee;
  --text: #223130;
  --muted: #5f7270;
  --water: #0284c7;
  --run: #7c3aed;
  --food: #ea580c;
  --accent: #4d7c0f;
  --ring-bg: #d5dfdc;
  --line: #ccd8d5;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 85% -10%, #d4e6e1 0%, transparent 55%),
    radial-gradient(700px 420px at -10% 5%, #dfe6d4 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.app__header { margin-bottom: 28px; }

.app__badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--accent);
  border: 1px solid rgba(77, 124, 15, .4);
  background: rgba(77, 124, 15, .1);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 14px;
}

.app__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 800;
}

.app__title .accent { color: var(--accent); }

.app__sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- TIPS ---------- */
.tips {
  background: linear-gradient(135deg, #eaf3f0, #eef2e2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 6px 18px rgba(40, 70, 65, .07);
}

.tips__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tips__icon { font-size: 18px; }

.tips__next {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.tips__next:hover { background: var(--surface-2); }
.tips__next:active { transform: scale(.96); }

.tips__text {
  margin: 12px 0 0;
  font-size: 16px;
  line-height: 1.5;
  transition: opacity .15s ease;
  min-height: 48px;
}

.tips__auto {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

/* ---------- HABITS ---------- */
.habits, .manual, .stats {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 8px 22px rgba(40, 70, 65, .08);
  margin-top: 34px;
}

.manual h2, .stats h2, .habits h2 { margin: 0 0 16px; font-size: 18px; }

.habits__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.habit {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  user-select: none;
}

.habit:hover { border-color: var(--muted); }

.habit input {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.habit:has(input:checked) {
  background: #e7f0da;
  border-color: #b9d195;
}

.habit:has(input:checked) span {
  text-decoration: line-through;
  color: var(--muted);
}

.habit--water:has(input:checked) { background: #d8ecf7; border-color: #a9d4ea; }
.habit--run:has(input:checked) { background: #e6e0f7; border-color: #c4b7ef; }
.habit--food:has(input:checked) { background: #fbe4d2; border-color: #f0c2a0; }

.habits__counter {
  font-size: 14px;
  color: var(--muted);
}
.habits__counter b { color: var(--accent); font-size: 16px; }

/* ---------- CARDS ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 20px 18px;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 8px 22px rgba(40, 70, 65, .08);
}

.card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(40, 70, 65, .13); }
.card--water { border-top: 3px solid var(--water); }
.card--run   { border-top: 3px solid var(--run); }
.card--food  { border-top: 3px solid var(--food); }

.card__top { display: flex; align-items: center; gap: 10px; }

.card__icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card__name { font-weight: 700; font-size: 15px; color: var(--muted); }

.card__value {
  margin-top: 14px;
  display: flex; align-items: baseline; gap: 6px;
}

.card__value span {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.card__value small { color: var(--muted); font-size: 15px; }

/* Ring */
.ring {
  position: absolute;
  top: 16px; right: 16px;
  width: 74px; height: 74px;
}

.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring__bg { fill: none; stroke: var(--ring-bg); stroke-width: 9; }

.ring__fg {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .6s ease;
}

.card--water .ring__fg { stroke: var(--water); }
.card--run   .ring__fg { stroke: var(--run); }
.card--food  .ring__fg { stroke: var(--food); }

.ring__pct {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
  color: var(--text);
}

.card__goal {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.card__goal b { color: var(--text); }

.card__rate {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  transition: color .2s ease;
}

.card[data-rate="below"] { border-color: #f3b4b4; }
.card[data-rate="ok"] { border-color: #b9d195; }
.card[data-rate="above"] { border-color: #a9d4ea; }

/* Quick buttons */
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick button {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 9px 0;
  border: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}

.quick button:hover { background: var(--line); }
.quick button:active { transform: scale(.96); }

.quick button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.card--water .quick button:not(.ghost) { background: #d8ecf7; color: #075985; }
.card--run   .quick button:not(.ghost) { background: #e6e0f7; color: #5b21b6; }
.card--food  .quick button:not(.ghost) { background: #fbe4d2; color: #9a3412; }

/* ---------- MANUAL FORM ---------- */


.manual h2, .stats h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.manual__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.manual__form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.manual__form input {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .15s ease;
}

.manual__form input:focus { border-color: var(--accent); }

.btn-primary {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #f7fee7;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(.97); }

.manual__hint {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--accent);
}



/* ---------- STATS ---------- */
.stats__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
}

.stat span {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
}

.stat--burn span { color: var(--food); }

.stat small { color: var(--muted); font-size: 12px; }

.btn-ghost {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: color .15s, border-color .15s;
}

.btn-ghost:hover { color: #dc2626; border-color: #dc2626; }

.app__footer {
  margin-top: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 80px);
  background: #17202e;
  color: #d9f99d;
  border: 1px solid rgba(163, 230, 53, .5);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s ease, opacity .3s ease;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 560px) {
  .ring { width: 60px; height: 60px; }
  .card__value span { font-size: 36px; }
}
