/* ====== Tasks Button + Modal ======
   Плавающая кнопка «Задания» под кнопкой лидерборда,
   модальное окно с двумя вкладками (Задания / Партнёры),
   список карточек заданий с кнопками «Выполнить / Проверить / Выполнено».
   Палитра/шрифты соответствуют .fantasy-modal / leaderboard.css. */

/* ── Плавающая кнопка под кнопкой лидерборда ── */
.tasks-btn {
  position: fixed;
  top: calc(var(--top-panel-h, 80px) + 64px + 8px);
  right: 10px;
  width: 64px;
  height: 64px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 99;
  display: none;
  transition: transform 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.show-ui .tasks-btn {
  display: block;
}

.tasks-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6))
          drop-shadow(0 0 6px rgba(255, 215, 0, 0.4));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.tasks-btn:hover img {
  transform: scale(1.08);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.7))
          drop-shadow(0 0 12px rgba(255, 215, 0, 0.7));
}

.tasks-btn:active img {
  transform: scale(0.95);
}

@media (max-width: 480px) {
  .tasks-btn {
    width: 54px;
    height: 54px;
    right: 8px;
    top: calc(var(--top-panel-h, 80px) + 54px + 6px);
  }
}

/* ── Контент модалки ── */
#tasks-modal .modal-content {
  padding: 0 22px 22px;
  padding-top: 20%;
  color: #f4e9c1;
  font-family: 'Cinzel', Georgia, serif;
  display: flex;
  flex-direction: column;
  height: 95vh;
  max-height: 95vh;
  box-sizing: border-box;
  overflow: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#tasks-modal .modal-content::-webkit-scrollbar { display: none; }

/* ── Вкладки ── */
.tasks-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  margin: 6px 0 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 12px;
  padding: 6px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}
.tasks-tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #c0a878;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}
.tasks-tab.active {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.08));
  color: #ffd700;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35), inset 0 0 8px rgba(255, 215, 0, 0.2);
}

/* ── Тело вкладки (скроллится) ── */
.tasks-tab-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-right: 4px;
  padding-bottom: 8px;
}
.tasks-tab-body::-webkit-scrollbar { width: 5px; }
.tasks-tab-body::-webkit-scrollbar-thumb { background: rgba(255, 215, 0, 0.4); border-radius: 3px; }
.tasks-tab-body::-webkit-scrollbar-track { background: transparent; }

/* ── Карточка задания ── */
.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.task-card:hover {
  border-color: rgba(255, 215, 0, 0.4);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}
.task-card.completed {
  background: linear-gradient(135deg, rgba(20, 50, 30, 0.4), rgba(10, 30, 18, 0.4));
  border-color: rgba(80, 200, 120, 0.45);
  opacity: 0.85;
}

/* Иконка/картинка задания */
.task-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.18), rgba(0, 0, 0, 0.5));
  border: 1.5px solid rgba(255, 215, 0, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.task-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.task-icon-placeholder {
  font-size: 1.6rem;
  color: #ffd700;
  filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.5));
}

/* Информация о задании */
.task-info {
  flex: 1;
  min-width: 0;
}
.task-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8d8b0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.task-card.completed .task-title { color: #9fd9b0; }
.task-desc {
  font-size: 0.74rem;
  color: #9a8a68;
  margin-top: 3px;
  line-height: 1.35;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-reward {
  margin-top: 5px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 4px;
}
.task-reward img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Кнопки действия */
.task-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 92px;
}
.task-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.15s ease;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.task-btn:active { transform: translateY(1px); }
.task-btn-do {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.25), rgba(184, 134, 11, 0.2));
  border-color: rgba(255, 215, 0, 0.6);
  color: #ffd700;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}
.task-btn-do:hover {
  background: linear-gradient(180deg, rgba(255, 215, 0, 0.4), rgba(184, 134, 11, 0.35));
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}
.task-btn-check {
  background: linear-gradient(180deg, rgba(80, 160, 255, 0.25), rgba(40, 100, 180, 0.2));
  border-color: rgba(120, 200, 255, 0.6);
  color: #9fcfff;
  box-shadow: 0 0 8px rgba(120, 200, 255, 0.2);
}
.task-btn-check:hover {
  box-shadow: 0 0 12px rgba(120, 200, 255, 0.4);
}
.task-btn-check.loading {
  opacity: 0.6;
  pointer-events: none;
}
.task-btn-done {
  background: linear-gradient(180deg, rgba(46, 160, 67, 0.3), rgba(30, 100, 45, 0.25));
  border-color: rgba(80, 200, 120, 0.6);
  color: #9fd9b0;
  cursor: default;
  box-shadow: 0 0 8px rgba(80, 200, 120, 0.2);
}

/* ── Состояния загрузки/пусто ── */
.tasks-loading,
.tasks-empty,
.tasks-error {
  text-align: center;
  padding: 36px 16px;
  color: #c0a878;
  font-size: 0.9rem;
  line-height: 1.5;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.tasks-error { color: #ff8585; }
.tasks-loading::after {
  content: '';
  display: block;
  width: 32px;
  height: 32px;
  margin: 14px auto 0;
  border: 3px solid rgba(255, 215, 0, 0.25);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: tasksSpin 0.8s linear infinite;
}
@keyframes tasksSpin { to { transform: rotate(360deg); } }

/* ── Toast внутри модалки (поверх .fantasy-modal) ── */
.tasks-toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(20, 30, 18, 0.95), rgba(10, 18, 12, 0.95));
  border: 1px solid rgba(80, 200, 120, 0.6);
  color: #9fd9b0;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(80, 200, 120, 0.3);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  max-width: 80%;
  text-align: center;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.tasks-toast.error {
  background: linear-gradient(135deg, rgba(40, 12, 12, 0.95), rgba(28, 8, 8, 0.95));
  border-color: rgba(218, 54, 51, 0.7);
  color: #ff9b9b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(218, 54, 51, 0.3);
}
.tasks-toast.hiding {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* ── Инструкции верификации пересылкой ── */
.tasks-forward-box {
  position: relative;
  background: linear-gradient(135deg, rgba(20, 30, 50, 0.92), rgba(10, 18, 34, 0.92));
  border: 1.5px solid rgba(120, 200, 255, 0.55);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 0;
  box-shadow: 0 0 16px rgba(120, 200, 255, 0.2), inset 0 0 10px rgba(0, 0, 0, 0.4);
  z-index: 5;
}
.tasks-forward-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #9fcfff;
  text-shadow: 0 0 8px rgba(120, 200, 255, 0.5);
  margin-bottom: 8px;
}
.tasks-forward-text {
  font-size: 0.8rem;
  color: #c9d8ec;
  line-height: 1.5;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 12px;
}
.tasks-forward-text b { color: #ffd700; }
.tasks-forward-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.tasks-forward-actions .task-btn { flex: 1; min-width: 90px; }
.tasks-forward-wait {
  font-size: 0.78rem;
  color: #9ab0c8;
  text-align: center;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}
.tasks-forward-wait::before {
  content: '⏳ ';
}
