/* Палитра взята из лендинга (2-3-MVP/results/landing.html), чтобы бот, лендинг
   и мини-приложение выглядели одним продуктом, а не тремя разными вещами. */
:root {
  --cream: #FBF1E5;
  --cream-deep: #F2E1CB;
  --paper: #FFFBF4;
  --ink: #2B1D16;
  --ink-soft: #6B5B4E;
  --coral: #C1652E;
  --coral-deep: #9A4A1F;
  --coral-soft: #F1DCC6;
  --sage: #7C9473;
  --sage-soft: #DCE7D3;
  --line: #E7D3B8;
  --shadow: 0 10px 30px -12px rgba(43, 29, 22, 0.28);
  --radius: 16px;
}

/* Тёмная тема Telegram: не выкручиваем контраст, а приглушаем те же оттенки —
   продукт про спокойствие, резкий чёрно-белый вид тут был бы не к месту. */
body.dark {
  --cream: #1E140F;
  --cream-deep: #271A13;
  --paper: #241811;
  --ink: #F3E3D8;
  --ink-soft: #B8A99D;
  --coral: #E8895A;
  --coral-deep: #F0A176;
  --coral-soft: #3A2418;
  --sage: #9DB394;
  --sage-soft: #2C3828;
  --line: #3D2A1E;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

#app { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

.screen {
  padding: 20px 16px 8px;
  animation: fade .25s ease;
}

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- шапка --- */
.head { margin-bottom: 18px; }

.head__title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.head__sub {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

/* --- список задач --- */
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fade .2s ease;
}

.task--leaving { animation: leave .3s ease forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(28px) scale(.97); } }

.task__check {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border: 2px solid var(--sage);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  color: transparent;
  transition: background .18s ease, color .18s ease, transform .12s ease;
}

.task__check:active { transform: scale(.9); }
.task--done .task__check { background: var(--sage); color: #fff; }

.task__body { flex: 1 1 auto; min-width: 0; }

.task__text {
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
  cursor: text;
}

.task--done .task__text { color: var(--ink-soft); text-decoration: line-through; }

.task__date {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 9px;
  background: var(--coral-soft);
  color: var(--coral-deep);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.task__edit {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--coral);
  padding: 0 0 3px;
  outline: none;
}

.task__menu {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: .55;
}

.tasks--compact .task { padding: 11px 12px; }

/* --- добавление --- */
.add {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  z-index: 5;
}

.add--inline { position: static; margin-top: 12px; }

.add__input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 13px 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  outline: none;
}

.add__input:focus { border-color: var(--coral); }

.add__btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}

.add__btn:active { transform: scale(.92); }

/* --- календарь --- */
.cal__nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.cal__arrow {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 20px;
  color: var(--ink);
  cursor: pointer;
  flex: 0 0 auto;
}

.cal__weekdays,
.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.cal__weekdays {
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  text-transform: lowercase;
}

.cal__cell {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  transition: background .15s ease;
}

.cal__cell--empty { background: transparent; cursor: default; }
.cal__cell--other { color: var(--ink-soft); opacity: .4; }
.cal__cell--today { border-color: var(--coral); color: var(--coral-deep); }
.cal__cell--selected { background: var(--coral); color: #fff; }
.cal__cell--selected .cal__dot { background: #fff; }

.cal__dots { display: flex; gap: 3px; height: 5px; align-items: center; }

.cal__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }
.cal__dot--done { background: var(--sage); }

/* --- панель выбранного дня --- */
.day {
  margin-top: 20px;
  padding: 16px 14px 18px;
  background: var(--cream-deep);
  border-radius: var(--radius);
  animation: fade .2s ease;
}

.day__title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.day__empty { margin: 4px 0; color: var(--ink-soft); font-size: 14px; }

/* --- прогресс --- */
.pgroup { margin-bottom: 22px; animation: fade .25s ease; }

.pgroup__day {
  margin: 0 0 10px;
  font-family: 'Caveat', cursive;
  font-size: 24px;
  font-weight: 600;
  color: var(--coral-deep);
}

.pgroup__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.pitem {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--sage-soft);
  border-radius: 13px;
  font-size: 15px;
  line-height: 1.35;
}

.pitem__tick { color: var(--sage); flex: 0 0 auto; font-weight: 700; }

.warm {
  margin: 26px 4px 8px;
  font-family: 'Caveat', cursive;
  font-size: 25px;
  line-height: 1.3;
  text-align: center;
  color: var(--coral-deep);
}

.empty {
  margin: 40px 12px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.5;
}

/* --- нижние вкладки --- */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.tab {
  flex: 1 1 0;
  background: none;
  border: none;
  padding: 9px 4px 8px;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font: inherit;
}

.tab__icon { font-size: 19px; line-height: 1; filter: grayscale(1); opacity: .55; }
.tab__label { font-size: 11px; font-weight: 600; }
.tab--active { color: var(--coral-deep); }
.tab--active .tab__icon { filter: none; opacity: 1; }

/* --- заставка --- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--cream);
  z-index: 50;
}

.boot--hidden { opacity: 0; pointer-events: none; transition: opacity .3s ease; }

.boot__breath {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--coral-soft);
  border: 2px solid var(--coral);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(.78); opacity: .55; }
  50% { transform: scale(1.08); opacity: 1; }
}

.boot__text { margin: 0; font-family: 'Caveat', cursive; font-size: 30px; color: var(--coral-deep); }

/* --- ошибка --- */
.fatal { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 30px; background: var(--cream); z-index: 60; text-align: center; }
.fatal__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); white-space: pre-line; }
.fatal__btn { font: inherit; font-weight: 600; padding: 12px 22px; border: none; border-radius: 999px; background: var(--coral); color: #fff; cursor: pointer; }

/* --- всплывающая похвала --- */
.cheer {
  position: fixed;
  left: 50%;
  bottom: calc(130px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 88%;
  padding: 13px 20px;
  background: var(--coral);
  color: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-family: 'Caveat', cursive;
  font-size: 22px;
  text-align: center;
  z-index: 40;
  animation: cheer 2.4s ease forwards;
  pointer-events: none;
}

@keyframes cheer {
  0% { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.94); }
  12%, 78% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px) scale(.98); }
}
