:root {
  --bg: #0F1316;
  --card: #171C20;
  --card-hi: #1D2429;
  --line: #262D33;
  --text: #E6E2D8;
  --muted: #8A938C;
  --accent: #7E9B5A;
  --accent-dim: #5E7543;
  --amber: #C8873F;
  --blue: #5A7E9B;
  --nav-h: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.view { display: block; }
.view[hidden] { display: none; }

/* ---------- Герой ---------- */

.hero { position: relative; height: 44vh; min-height: 260px; max-height: 420px; overflow: hidden; }
.hero-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-fade {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(15,19,22,0) 40%, rgba(15,19,22,0.75) 78%, var(--bg) 100%);
}
.hero-text { position: absolute; left: 20px; right: 20px; bottom: 14px; }
.hero-place {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.hero-day { font-size: 30px; font-weight: 700; letter-spacing: 0.02em; }

/* ---------- Аватар ---------- */

.avatar-stage {
  position: relative; height: 52vh; min-height: 300px; max-height: 520px;
  overflow: hidden; background: #0A0D0F;
}
.avatar-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain; object-position: center bottom;
  display: block;
}
.avatar-top { transition: opacity 900ms ease; opacity: 0; }
.avatar-fade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(15,19,22,0.35) 0%, rgba(15,19,22,0) 25%, rgba(15,19,22,0.6) 88%, var(--bg) 100%);
}

/* ---------- Карта ---------- */

.map-stage { position: relative; height: 46vh; min-height: 280px; max-height: 460px; overflow: hidden; background: #0A0D0F; }
.map-img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.map-fade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(15,19,22,0.25) 0%, rgba(15,19,22,0) 30%, rgba(15,19,22,0.7) 85%, var(--bg) 100%);
}

/* ---------- Панель ---------- */

.panel { padding: 4px 16px 28px; margin-top: -8px; position: relative; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

.label {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.section-label { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 10px; }
.count { letter-spacing: 0.04em; text-transform: none; font-weight: 400; }

.dim { color: var(--muted); font-weight: 400; }

.hint { font-size: 13px; line-height: 1.55; color: var(--muted); margin-top: 10px; }
.hint.center { text-align: center; margin-top: 14px; padding: 0 8px; }

/* ---------- Прогресс ---------- */

.progress-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.progress-value { font-size: 24px; font-weight: 700; margin-top: 5px; }

.streak {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px 6px 11px; background: var(--card-hi);
  flex-shrink: 0;
}
.streak-num { font-size: 19px; font-weight: 700; color: var(--accent); }
.streak-cap { font-size: 9px; line-height: 1.15; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.bar { height: 7px; border-radius: 999px; background: #23292E; overflow: hidden; margin-top: 13px; }
.bar.thin { height: 5px; margin-top: 8px; }
.bar-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--accent); transition: width 600ms ease;
}
.bar-fill.green { background: var(--accent); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.blue  { background: var(--blue); }

/* ---------- Нужды ---------- */

.needs { display: flex; flex-direction: column; gap: 10px; }

.need {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
  text-align: left;
  width: 100%;
  color: inherit;
  font: inherit;
}
.need:active { background: var(--card-hi); }
.need.on { border-color: var(--accent-dim); background: rgba(126,155,90,0.07); }

.need-box {
  width: 24px; height: 24px; flex-shrink: 0;
  border: 1.5px solid #39424A; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 13px; color: transparent;
  transition: all 160ms ease;
}
.need.on .need-box { border-color: var(--accent); background: var(--accent); color: #101418; }

.need-body { flex: 1; min-width: 0; }
.need-name { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.need.on .need-name { color: var(--accent); }
.need-target { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.need-info {
  flex-shrink: 0; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
  display: grid; place-items: center;
  background: transparent; cursor: pointer;
}
.need-info:active { background: var(--card-hi); }

/* ---------- Кнопки ---------- */

.primary {
  display: block; width: 100%;
  margin-top: 20px; padding: 17px 20px;
  border: 0; border-radius: 13px;
  background: var(--accent); color: #0E1216;
  font-size: 15px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; font-family: inherit;
  transition: opacity 160ms ease;
}
.primary:active { opacity: 0.82; }
.primary.done { background: var(--card); color: var(--muted); border: 1px solid var(--line); }

.secondary {
  display: block; width: 100%;
  margin-top: 14px; padding: 13px 18px;
  border: 1px solid var(--line); border-radius: 11px;
  background: transparent; color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.secondary:active { background: var(--card-hi); }

/* ---------- Сообщение ---------- */

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  background: rgba(200,135,63,0.07);
  border-radius: 11px;
  padding: 13px 15px;
  font-size: 13.5px; line-height: 1.55;
  margin-bottom: 14px;
}
.notice[hidden] { display: none; }
.notice b { color: var(--amber); font-weight: 600; }

/* ---------- Вес ---------- */

.weight-row { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; }
.weight-now { font-size: 30px; font-weight: 700; }
.weight-delta { font-size: 14px; font-weight: 600; color: var(--accent); }

/* ---------- Показатели ---------- */

.stats { display: flex; flex-direction: column; gap: 18px; }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 600; }
.stat-num { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.stat-note { font-size: 12px; color: var(--muted); margin-top: 7px; }

/* ---------- Локации ---------- */

.route-week { font-size: 24px; font-weight: 700; margin-top: 6px; }

.locations { padding: 6px 0; }
.loc {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.loc:last-child { border-bottom: 0; }
.loc-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #2E353B; flex-shrink: 0;
}
.loc.done .loc-dot { background: var(--accent-dim); }
.loc.now .loc-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(126,155,90,0.18); }
.loc-name { font-size: 14.5px; flex: 1; color: var(--muted); }
.loc.done .loc-name { color: var(--text); }
.loc.now .loc-name { color: var(--accent); font-weight: 600; }
.loc-week { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Навигация ---------- */

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center;
  background: rgba(19,23,27,0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.nav-btn {
  flex: 1 1 0; max-width: 187px;
  border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 10.5px; letter-spacing: 0.05em;
  font-family: inherit; padding: 0;
}
.nav-ico { font-size: 15px; line-height: 1; }
.nav-btn.active { color: var(--accent); }

/* ---------- Шторка ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-wrap[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6,9,11,0.72); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 10px 20px calc(26px + env(safe-area-inset-bottom));
  max-height: 84vh; overflow-y: auto;
  animation: rise 240ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle {
  width: 38px; height: 4px; border-radius: 999px;
  background: #333B42; margin: 4px auto 18px;
}
.sheet h3 { font-size: 20px; margin: 0 0 6px; font-weight: 700; }
.sheet .sheet-sub { font-size: 13px; color: var(--muted); margin: 0 0 20px; line-height: 1.55; }
.sheet ul { margin: 0 0 18px; padding-left: 20px; }
.sheet li { font-size: 14.5px; line-height: 1.7; margin-bottom: 4px; }
.sheet .kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.sheet .kv:last-of-type { border-bottom: 0; }
.sheet .kv span:last-child { color: var(--muted); text-align: right; }
.sheet .warn { font-size: 13px; line-height: 1.6; color: var(--muted); border-left: 3px solid var(--amber); padding-left: 13px; margin: 18px 0 0; }

.num-input {
  width: 100%; margin: 4px 0 0; padding: 15px 16px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  color: var(--text); font-size: 22px; font-weight: 700; font-family: inherit;
  text-align: center;
}
.num-input:focus { outline: none; border-color: var(--accent-dim); }

@media (min-width: 620px) {
  .hero { height: 380px; max-height: none; }
  .avatar-stage { height: 480px; }
  .map-stage { height: 420px; }
}
