/* ----- RESET & BASE ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}
body {
  background: #f0f4f8;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
}
.phone {
  width: 100%;
  max-width: 390px;
  height: 780px;
  max-height: 780px;
  background: #ffffff;
  border-radius: 40px;
  box-shadow: 0 20px 60px rgba(0, 20, 30, 0.15);
  overflow: hidden;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
}

/* ----- СТАТУС БАР ----- */
.status-bar {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #1e293b;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9edf2;
  margin-bottom: 12px;
  flex-shrink: 0;
}

/* ----- КОНТЕЙНЕР ЭКРАНОВ ----- */
.screen-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.25s ease;
  min-height: 0;
}
.screen.active {
  display: flex;
}
@keyframes fadeIn {
  0% { opacity: 0.5; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ----- ЭКРАНЫ РЕГИСТРАЦИИ (исправлена прокрутка) ----- */
.reg-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  padding: 10px 0 20px;
}
.reg-screen .reg-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
  text-align: center;
}
.reg-screen .reg-sub {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
}
.reg-label {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 12px 0 4px;
}
.reg-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  font-size: 16px;
  background: #f8fafc;
  outline: none;
  transition: 0.15s;
}
.reg-input:focus {
  border-color: #0b3b5c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(11, 59, 92, 0.1);
}
.reg-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23475569' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
}
.reg-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #0b3b5c 0%, #1a5a7a 100%);
  border: none;
  border-radius: 60px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(11, 59, 92, 0.25);
  margin-top: 20px;
  cursor: pointer;
  transition: 0.15s;
  text-align: center;
  flex-shrink: 0;
}
.reg-btn:active {
  transform: scale(0.97);
}
.reg-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ----- ПРОГРЕСС-ИКОНКИ ДЛЯ РЕГИСТРАЦИИ ----- */
.progress-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 16px 0 20px;
  flex-shrink: 0;
}
.step-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  transition: 0.2s;
}
.step-icon svg {
  width: 36px;
  height: 36px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: 0.2s;
}
.step-icon .step-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.step-icon.active {
  color: #0b3b5c;
}
.step-icon.active svg {
  stroke-width: 2.5;
  filter: drop-shadow(0 2px 4px rgba(11, 59, 92, 0.15));
}
.step-icon.done {
  color: #16a34a;
}
.step-icon.done svg {
  stroke: #16a34a;
}

/* ----- ПРИВЕТСТВИЕ ----- */
.welcome-icon {
  font-size: 72px;
  text-align: center;
  margin: 20px 0 10px;
}
.welcome-text {
  text-align: center;
  font-size: 16px;
  color: #475569;
  line-height: 1.5;
  margin: 8px 0 16px;
}
.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 20px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid #e9edf2;
}
.feature-item .emoji {
  font-size: 28px;
}
.feature-item .text {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}
.feature-item .text small {
  font-weight: 400;
  color: #64748b;
  display: block;
  font-size: 12px;
}

/* ----- ФИНИШ ----- */
.finish-icon {
  font-size: 80px;
  text-align: center;
  margin: 20px 0 10px;
}
.finish-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}
.finish-text {
  text-align: center;
  color: #64748b;
  margin: 6px 0 16px;
  font-size: 15px;
}

/* ============================================================ */
/* ----- НИЖНЯЯ НАВИГАЦИЯ (SVG иконки) ----- */
/* ============================================================ */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 10px;
  border-top: 1px solid #e9edf2;
  flex-shrink: 0;
  background: #ffffff;
  margin-top: 4px;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  font-size: 9px;
  color: #94a3b8;
  padding: 4px 8px;
  cursor: pointer;
  transition: 0.15s;
  gap: 1px;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  min-width: 48px;
}
.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: 0.15s;
}
.nav-item .nav-label {
  font-weight: 500;
  letter-spacing: 0.2px;
}
.nav-item.active {
  color: #0b3b5c;
}
.nav-item.active .nav-icon {
  transform: scale(1.05);
}
.nav-item:active {
  transform: scale(0.92);
}
.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  background: #0b3b5c;
  border-radius: 0 0 4px 4px;
}
.nav-item.nav-add {
  background: linear-gradient(135deg, #0b3b5c 0%, #1a5a7a 100%);
  color: #ffffff;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  padding: 0;
  margin-top: -14px;
  box-shadow: 0 4px 16px rgba(11, 59, 92, 0.3);
  transition: 0.15s;
  justify-content: center;
  gap: 0;
}
.nav-item.nav-add .nav-icon {
  width: 28px;
  height: 28px;
  stroke: #fff;
  stroke-width: 2.5;
}
.nav-item.nav-add .nav-label {
  display: none;
}
.nav-item.nav-add:active {
  transform: scale(0.90);
  box-shadow: 0 2px 8px rgba(11, 59, 92, 0.2);
}
.nav-item.nav-add.active {
  color: #fff;
}
.nav-item.nav-add.active::after {
  display: none;
}

/* ============================================================ */
/* ----- ОБЩИЕ СТИЛИ ДЛЯ ВКЛАДОК (main-tab) ----- */
/* ============================================================ */
.main-tab {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.main-tab.active-tab {
  display: flex;
}

/* ============================================================ */
/* ----- ВКЛАДКА "ЗАДАНИЯ" ----- */
/* ============================================================ */
.top-section {
  flex-shrink: 0;
  margin-bottom: 4px;
}
.greeting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}
.greeting h1 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.greeting .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.greeting .header-actions .edit-tasks-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: 0.15s;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.greeting .header-actions .edit-tasks-btn:hover {
  background: #f1f5f9;
  color: #0b3b5c;
}
.greeting .header-actions .edit-tasks-btn:active {
  transform: scale(0.9);
}
.greeting .header-actions .edit-tasks-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.greeting span {
  font-size: 12px;
  color: #475569;
}

.companion-badge {
  background: #fef9c3;
  padding: 4px 12px;
  border-radius: 40px;
  font-size: 12px;
  font-weight: 600;
  color: #854d0e;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.companion-badge .emoji-big {
  font-size: 18px;
}
.current-task {
  background: #f8fafc;
  border-radius: 14px;
  padding: 8px 14px;
  border: 1px solid #e9edf2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.current-task .icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.current-task .info .title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.current-task .info .desc {
  font-size: 11px;
  color: #64748b;
}

/* КНОПКА */
.btn-done-wrapper {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 55px 0 20px;
}
.btn-done {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
  position: relative;
  user-select: none;
  background: linear-gradient(135deg, #0b3b5c 0%, #1a5a7a 100%);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
  box-shadow: 0 12px 40px rgba(11, 59, 92, 0.35);
  letter-spacing: 0.5px;
  line-height: 1.2;
  padding: 0 10px;
  text-align: center;
}
.btn-done:active {
  transform: scale(0.94);
  box-shadow: 0 6px 20px rgba(11, 59, 92, 0.3);
}
.btn-done::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid rgba(11, 59, 92, 0.15);
  animation: pulse-ring 2s ease-out infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.25); opacity: 0; }
}
.btn-done.success {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}
.btn-done.success::after {
  border-color: rgba(22, 163, 74, 0.2);
}
.btn-done.alert {
  animation: soft-blink 1s ease-in-out infinite;
  background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
}
.btn-done.alert::after {
  border-color: rgba(185, 28, 28, 0.2);
}
@keyframes soft-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Таймер */
.timer-section {
  text-align: center;
  margin: 0 0 6px;
  flex-shrink: 0;
}
.timer-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.timer-value {
  font-size: 28px;
  font-weight: 800;
  color: #0b3b5c;
  letter-spacing: 2px;
  background: #f1f5f9;
  display: inline-block;
  padding: 2px 18px;
  border-radius: 40px;
  min-width: 100px;
}
.timer-value.warning {
  color: #b91c1c;
  background: #fee2e2;
}

/* КАРУСЕЛЬ (без заголовка "Остальные задания") */
.carousel-section {
  flex-shrink: 0;
  margin-top: 12px;
}
.carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.carousel-container {
  overflow: hidden;
  flex: 1;
  border-radius: 18px;
}
.carousel-track {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  gap: 14px;
  padding: 4px 0;
  will-change: transform;
}
.carousel-item {
  flex: 0 0 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border-radius: 20px;
  padding: 16px 10px 14px;
  border: 1px solid #e9edf2;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  position: relative;
  transition: opacity 0.4s, transform 0.4s;
}
.carousel-item .icon {
  font-size: 38px;
  margin-bottom: 6px;
  transition: filter 0.4s, opacity 0.4s;
}
.carousel-item .label {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2px;
  text-align: center;
  transition: filter 0.4s, opacity 0.4s;
}
.carousel-item .mini-timer {
  font-size: 15px;
  font-weight: 700;
  color: #0b3b5c;
  background: #e9edf2;
  padding: 4px 16px;
  border-radius: 30px;
  margin-top: 6px;
  transition: filter 0.4s, opacity 0.4s;
}
.carousel-item .mini-timer.done {
  background: #d1fae5;
  color: #166534;
}
.carousel-item .mini-timer.warning {
  background: #fee2e2;
  color: #b91c1c;
}

/* Кнопка редактирования на карточке */
.carousel-item .edit-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255,255,255,0.8);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.15s;
  color: #475569;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  opacity: 0.7;
}
.carousel-item .edit-btn:hover {
  opacity: 1;
  background: #ffffff;
  color: #0b3b5c;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.carousel-item .edit-btn:active {
  transform: scale(0.9);
}

/* Бейдж +20 — всегда чёткий */
.carousel-item .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #16a34a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 2;
  white-space: nowrap;
  filter: none !important;
}
.carousel-item .badge.show {
  opacity: 1;
  transform: scale(1);
}

/* Выполненная карточка */
.carousel-item.completed {
  pointer-events: none;
  border-color: #d1fae5;
  opacity: 0.85;
}
.carousel-item.completed .icon,
.carousel-item.completed .label,
.carousel-item.completed .mini-timer {
  filter: blur(1px);
  opacity: 0.7;
}
.carousel-item.completed .badge {
  filter: none !important;
  opacity: 1 !important;
  transform: scale(1) !important;
}
.carousel-item.completed .edit-btn {
  pointer-events: none;
  opacity: 0.3;
}

.carousel-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.carousel-btn:hover {
  background: #e2e8f0;
}
.carousel-btn:active {
  transform: scale(0.92);
}
.carousel-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* Анимация покачивания — очень редкая */
@keyframes wiggle {
  0% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
  100% { transform: translateX(0); }
}
.carousel-track.wiggle {
  animation: wiggle 0.5s ease-in-out;
}

/* ----- ПРОФИЛЬ ----- */
#main-profile {
  overflow-y: auto;
  padding-bottom: 8px;
}
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0 4px;
  position: relative;
}
.profile-header .edit-btn {
  position: absolute;
  top: 12px;
  right: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: 0.15s;
  color: #94a3b8;
}
.profile-header .edit-btn:hover {
  background: #f1f5f9;
  color: #0b3b5c;
}
.profile-header .edit-btn:active {
  transform: scale(0.9);
}
.profile-header .edit-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.companion-big {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 8px 20px rgba(11, 59, 92, 0.15));
}
.companion-name {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.companion-mood {
  font-size: 14px;
  color: #475569;
  background: #f1f5f9;
  padding: 4px 18px;
  border-radius: 40px;
  margin-top: 2px;
}
.level-box {
  display: flex;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 18px;
  padding: 14px 20px;
  margin: 12px 0;
  border: 1px solid #e9edf2;
}
.level-box .item { text-align: center; }
.level-box .item .val {
  font-size: 20px;
  font-weight: 700;
  color: #0b3b5c;
}
.level-box .item .lbl {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.badge-item {
  background: #f1f5f9;
  padding: 8px 14px;
  border-radius: 40px;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge-item.locked {
  opacity: 0.4;
  filter: grayscale(0.6);
}

/* Кнопка выхода */
.logout-btn {
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  background: #fee2e2;
  border: none;
  border-radius: 60px;
  font-size: 16px;
  font-weight: 600;
  color: #b91c1c;
  cursor: pointer;
  transition: 0.15s;
}
.logout-btn:active {
  transform: scale(0.97);
}

/* ============================================================ */
/* ----- ВКЛАДКА "СТАТИСТИКА" (обновлена) ----- */
/* ============================================================ */
#main-stats {
  overflow-y: auto;
  padding-bottom: 8px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 12px;
}
.stat-card {
  background: #f8fafc;
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  border: 1px solid #e9edf2;
}
.stat-card .number {
  font-size: 28px;
  font-weight: 800;
  color: #0b3b5c;
}
.stat-card .label {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}
.stat-card .trend {
  font-size: 13px;
  font-weight: 600;
  color: #16a34a;
  margin-top: 4px;
}
.stat-card .trend.down { color: #dc2626; }
.chart-placeholder {
  background: #f1f5f9;
  border-radius: 18px;
  height: 110px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  padding: 10px 8px 8px;
  margin-top: 6px;
  border: 1px solid #e9edf2;
}
.chart-bar {
  width: 18px;
  background: #0b3b5c;
  border-radius: 6px 6px 0 0;
  min-height: 8px;
}
.chart-bar:nth-child(1) { height: 50px; background: #1a5a7a; }
.chart-bar:nth-child(2) { height: 75px; background: #0b3b5c; }
.chart-bar:nth-child(3) { height: 40px; background: #3b82f6; }
.chart-bar:nth-child(4) { height: 65px; background: #0b3b5c; }
.chart-bar:nth-child(5) { height: 80px; background: #1a5a7a; }
.chart-bar:nth-child(6) { height: 48px; background: #3b82f6; }
.chart-bar:nth-child(7) { height: 70px; background: #0b3b5c; }

/* ----- СООБЩЕСТВО ----- */
#screen-community {
  overflow-y: auto;
  padding-bottom: 8px;
}
.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.community-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.community-header span {
  font-size: 13px;
  color: #3b82f6;
  cursor: default;
  font-weight: 500;
}
.community-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.community-stat-card {
  flex: 1;
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  border: 1px solid #e9edf2;
}
.community-stat-card .number {
  font-size: 22px;
  font-weight: 700;
  color: #0b3b5c;
}
.community-stat-card .label {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}
.community-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.feed-item {
  background: #f8fafc;
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid #e9edf2;
  display: flex;
  align-items: center;
  gap: 12px;
}
.feed-item .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.feed-item .content {
  flex: 1;
}
.feed-item .content .name {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}
.feed-item .content .action {
  font-size: 12px;
  color: #475569;
}
.feed-item .content .time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}
.feed-item .like-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: default;
  transition: 0.15s;
  padding: 4px 6px;
}
.feed-item .like-btn:active {
  transform: scale(0.85);
}

/* ============================================================ */
/* ----- ЭКРАН ВСЕХ ЗАДАНИЙ (screen-all-tasks) ----- */
/* ============================================================ */
#screen-all-tasks {
  padding-bottom: 12px;
}
.all-tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.all-tasks-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-all-tasks {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.15s;
}
.btn-close-all-tasks:active {
  transform: scale(0.85);
}
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}
.task-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid #e9edf2;
  transition: 0.15s;
}
.task-list-item .task-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.task-list-item .task-info .icon {
  font-size: 24px;
}
.task-list-item .task-info .details {
  display: flex;
  flex-direction: column;
}
.task-list-item .task-info .details .title {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}
.task-list-item .task-info .details .meta {
  font-size: 12px;
  color: #64748b;
}
.task-list-item .task-actions {
  display: flex;
  gap: 6px;
}
.task-list-item .task-actions button {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.15s;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-list-item .task-actions .edit-btn svg,
.task-list-item .task-actions .delete-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.task-list-item .task-actions .edit-btn:hover {
  background: #e9edf2;
  color: #0b3b5c;
}
.task-list-item .task-actions .delete-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
}
.task-list-item .task-actions button:active {
  transform: scale(0.9);
}
.task-list-item.completed {
  opacity: 0.6;
}
.task-list-item.completed .task-info .details .title {
  text-decoration: line-through;
  color: #94a3b8;
}

/* ----- ЭКРАН НАСТРОЕК (НАПОМИНАНИЙ) ----- */
#screen-settings {
  padding-bottom: 12px;
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.settings-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-settings {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.15s;
}
.btn-close-settings:active {
  transform: scale(0.85);
}
.settings-group {
  margin-bottom: 16px;
}
.settings-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}
.settings-group select,
.settings-group input[type="time"],
.settings-group input[type="date"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  font-size: 16px;
  background: #f8fafc;
  outline: none;
  transition: 0.15s;
}
.settings-group select:focus,
.settings-group input[type="time"]:focus,
.settings-group input[type="date"]:focus {
  border-color: #0b3b5c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(11, 59, 92, 0.1);
}
.days-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.day-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-btn.active {
  background: #0b3b5c;
  color: #ffffff;
  border-color: #0b3b5c;
}
.day-btn:active {
  transform: scale(0.92);
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.toggle-row span {
  font-size: 14px;
  color: #475569;
}
.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: #cbd5e1;
  border-radius: 40px;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}
.toggle-switch.active {
  background: #0b3b5c;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle-switch.active::after {
  left: 23px;
}
.btn-save-settings {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #0b3b5c 0%, #1a5a7a 100%);
  border: none;
  border-radius: 60px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(11, 59, 92, 0.25);
  margin-top: 12px;
  cursor: pointer;
  transition: 0.15s;
}
.btn-save-settings:active {
  transform: scale(0.97);
}

/* ----- ЭКРАН РЕДАКТИРОВАНИЯ ЗАДАНИЯ ----- */
#screen-edit-task {
  padding-bottom: 12px;
}
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.edit-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-edit {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.15s;
}
.btn-close-edit:active {
  transform: scale(0.85);
}

/* ----- ЭКРАН РЕДАКТИРОВАНИЯ ПРОФИЛЯ ----- */
#screen-profile-edit {
  padding-bottom: 12px;
}
.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.edit-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-edit {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.15s;
}
.btn-close-edit:active {
  transform: scale(0.85);
}

/* ----- TOAST-УВЕДОМЛЕНИЯ ----- */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}

.toast {
  padding: 12px 20px;
  border-radius: 16px;
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  width: 100%;
  text-align: center;
  pointer-events: auto;
  animation: slideDown 0.3s ease forwards;
  transition: opacity 0.3s;
}

.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #3b82f6; }
.toast.warning { background: #f59e0b; }

@keyframes slideDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.toast.hide {
  opacity: 0;
  transform: translateY(-20px);
}

/* ----- АДАПТИВ ----- */
@media (max-width: 420px) {
  .phone { padding: 14px 12px 0; height: 720px; max-height: 720px; }
  .btn-done-wrapper { padding: 40px 0 10px; }
  .btn-done { width: 160px; height: 160px; font-size: 22px; }
  .btn-done.success { font-size: 22px; }
  .timer-value { font-size: 24px; padding: 2px 14px; }
  .carousel-item { flex: 0 0 120px; min-width: 100px; padding: 12px 8px 10px; }
  .carousel-item .icon { font-size: 30px; }
  .carousel-item .label { font-size: 14px; }
  .carousel-item .mini-timer { font-size: 13px; padding: 3px 12px; }
  .carousel-btn { width: 30px; height: 30px; font-size: 16px; }
  .top-section .greeting h1 { font-size: 16px; }
  .top-section .current-task .info .title { font-size: 13px; }
  .top-section .current-task .info .desc { font-size: 10px; }
  .nav-item .nav-icon { width: 20px; height: 20px; }
  .nav-item .nav-label { font-size: 8px; }
  .bottom-nav { padding: 4px 0 8px; }
  .day-btn { width: 34px; height: 34px; font-size: 12px; }
  .nav-item.nav-add { width: 46px; height: 46px; margin-top: -10px; }
  .nav-item.nav-add .nav-icon { width: 24px; height: 24px; }
  .community-stat-card .number { font-size: 18px; }
  .carousel-section { margin-top: 8px; }
  .profile-header .edit-btn svg { width: 18px; height: 18px; }
  .step-icon svg { width: 28px; height: 28px; }
  .progress-steps { gap: 12px; }
  .task-list-item { padding: 10px 12px; }
  .task-list-item .task-info .icon { font-size: 20px; }
  .task-list-item .task-info .details .title { font-size: 13px; }
  .greeting .header-actions .edit-tasks-btn svg { width: 18px; height: 18px; }
}

/* ----- ДНИ НЕДЕЛИ (с явным выделением) ----- */
.days-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.day-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day-btn.active {
  background: #0b3b5c;
  color: #ffffff;
  border-color: #0b3b5c;
  box-shadow: 0 2px 8px rgba(11, 59, 92, 0.2);
}
.day-btn:not(.active) {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
  opacity: 0.6;
}
.day-btn:active {
  transform: scale(0.92);
}
/* убираем галочки, которые могли быть добавлены ранее */
.day-btn::after {
  display: none !important;
}

/* ----- ЭКРАН ИСТОРИИ ----- */
#screen-history {
  padding-bottom: 12px;
}
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.history-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}
.btn-close-history {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0 4px;
  transition: 0.15s;
}
.btn-close-history:active {
  transform: scale(0.85);
}
.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.history-day-group {
  background: #f8fafc;
  border-radius: 18px;
  padding: 12px 16px;
  border: 1px solid #e9edf2;
}
.history-day-group .day-title {
  font-weight: 700;
  font-size: 16px;
  color: #0f172a;
  margin-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.history-item:last-child {
  border-bottom: none;
}
.history-item .icon {
  font-size: 24px;
}
.history-item .info {
  flex: 1;
}
.history-item .info .title {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
}
.history-item .info .time {
  font-size: 12px;
  color: #64748b;
}
.history-item .status {
  font-size: 13px;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 30px;
  white-space: nowrap;
}
.history-item .status.done {
  background: #d1fae5;
  color: #166534;
}
.history-item .status.pending {
  background: #fef3c7;
  color: #92400e;
}
.history-item .status.future {
  background: #e2e8f0;
  color: #475569;
}
.history-item .status.missed {
  background: #fee2e2;
  color: #b91c1c;
}
.history-empty {
  text-align: center;
  color: #94a3b8;
  padding: 40px 0;
  font-size: 16px;
}

/* ----- ИСТОРИЯ ЗАДАНИЙ (только скролл, без слёта) ----- */
#screen-history {
    height: 100%;
    overflow: hidden;
}

.history-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.history-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}
.btn-close-history {
    background: none;
    border: none;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
    transition: 0.15s;
}
.btn-close-history:active {
    transform: scale(0.85);
}

.history-list {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}

/* Красивый скролл */
.history-list::-webkit-scrollbar {
    width: 4px;
}
.history-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.history-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.history-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Остальные стили групп и элементов (без изменений) */
.history-day-group {
    background: #f8fafc;
    border-radius: 18px;
    padding: 12px 16px;
    border: 1px solid #e9edf2;
    margin-bottom: 12px;
}
.history-day-group .day-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
    margin-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 6px;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.history-item:last-child {
    border-bottom: none;
}
.history-item .icon {
    font-size: 24px;
}
.history-item .info {
    flex: 1;
}
.history-item .info .title {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}
.history-item .info .time {
    font-size: 12px;
    color: #64748b;
}
.history-item .status {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 12px;
    border-radius: 30px;
    white-space: nowrap;
}
.history-item .status.done {
    background: #d1fae5;
    color: #166534;
}
.history-item .status.pending {
    background: #fef3c7;
    color: #92400e;
}
.history-item .status.future {
    background: #e2e8f0;
    color: #475569;
}
.history-item .status.missed {
    background: #fee2e2;
    color: #b91c1c;
}
.history-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 0;
    font-size: 16px;
}

/* Статус "Выполнено с опозданием" */
.history-item .status.late {
    background: #fef3c7;
    color: #92400e;
}

/* Статус в истории – две строки */
.history-item .status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 30px;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
    line-height: 1.3;
}

.history-item .status .status-main {
    font-size: 13px;
}

.history-item .status .status-sub {
    font-size: 10px;
    opacity: 0.8;
}

.history-item .status.done {
    background: #d1fae5;
    color: #166534;
}
.history-item .status.pending {
    background: #fef3c7;
    color: #92400e;
}
.history-item .status.future {
    background: #e2e8f0;
    color: #475569;
}
.history-item .status.missed {
    background: #fee2e2;
    color: #b91c1c;
}
.history-item .status.late {
    background: #fef3c7;
    color: #92400e;
}

/* График (динамические столбцы) */
.chart-placeholder {
    background: #f1f5f9;
    border-radius: 18px;
    height: 110px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 10px 8px 8px;
    margin-top: 6px;
    border: 1px solid #e9edf2;
}
.chart-bar {
    width: 18px;
    background: #0b3b5c;
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
    position: relative;
}
.chart-bar::after {
    content: attr(data-count);
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: #475569;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}
.chart-bar:hover::after {
    opacity: 1;
}
.chart-bar:nth-child(1) { background: #1a5a7a; }
.chart-bar:nth-child(2) { background: #0b3b5c; }
.chart-bar:nth-child(3) { background: #3b82f6; }
.chart-bar:nth-child(4) { background: #0b3b5c; }
.chart-bar:nth-child(5) { background: #1a5a7a; }
.chart-bar:nth-child(6) { background: #3b82f6; }
.chart-bar:nth-child(7) { background: #0b3b5c; }

/* ----- Блок призов в Сообществе ----- */
.prizes-block {
    margin-top: 20px;
    background: #f8fafc;
    border-radius: 24px;
    padding: 16px 12px 12px;
    border: 1px solid #e9edf2;
}

.prizes-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.prizes-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}
.prizes-sub {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.prizes-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prizes-carousel-container {
    overflow: hidden;
    flex: 1;
    border-radius: 16px;
}

.prizes-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    gap: 12px;
    padding: 4px 0;
}

.prize-card {
    flex: 0 0 calc(100% - 8px);
    background: #ffffff;
    border-radius: 20px;
    padding: 16px 12px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.prize-card.gold {
    border-color: #fbbf24;
    background: #fffbeb;
}
.prize-card.silver {
    border-color: #d1d5db;
    background: #f9fafb;
}
.prize-card.bronze {
    border-color: #d97706;
    background: #fffbeb;
}

.prize-place {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 4px;
}

.prize-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
}

.prize-image {
    font-size: 42px;
    margin: 8px 0;
}

.prize-name {
    font-weight: 600;
    font-size: 16px;
    color: #0f172a;
}

.prize-desc {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    max-width: 200px;
}

.prize-carousel-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
    user-select: none;
}
.prize-carousel-btn:hover {
    background: #e2e8f0;
}
.prize-carousel-btn:active {
    transform: scale(0.92);
}
.prize-carousel-btn.disabled {
    opacity: 0.25;
    pointer-events: none;
}

.prizes-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.prizes-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: 0.2s;
    cursor: pointer;
}
.prizes-dots .dot.active {
    background: #0b3b5c;
    width: 20px;
    border-radius: 4px;
}
/* ----- Лента достижений (карусель) ----- */
.feed-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.feed-carousel-container {
    overflow: hidden;
    flex: 1;
    border-radius: 16px;
}

.feed-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    gap: 12px;
    padding: 4px 0;
}

.feed-card {
    flex: 0 0 calc(100% - 8px);
    background: #ffffff;
    border-radius: 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e9edf2;
    min-height: 80px;
}

.feed-card .feed-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.feed-card .feed-content {
    flex: 1;
    min-width: 0;
}
.feed-card .feed-content .feed-name {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}
.feed-card .feed-content .feed-action {
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.feed-card .feed-content .feed-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.feed-card .feed-like {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: 0.15s;
    flex-shrink: 0;
    color: #94a3b8;
}
.feed-card .feed-like:active {
    transform: scale(0.85);
}

.feed-carousel-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: 0.2s;
    user-select: none;
}
.feed-carousel-btn:hover {
    background: #e2e8f0;
}
.feed-carousel-btn:active {
    transform: scale(0.92);
}
.feed-carousel-btn.disabled {
    opacity: 0.25;
    pointer-events: none;
}

.feed-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
.feed-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: 0.2s;
    cursor: pointer;
}
.feed-dots .dot.active {
    background: #0b3b5c;
    width: 20px;
    border-radius: 4px;
}

#screen-all-tasks {
    overflow: hidden;
    min-height: 0;
}