@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-glow: rgba(99, 102, 241, 0.4);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --locked-bg: rgba(51, 65, 85, 0.4);
  --border-color: rgba(148, 163, 184, 0.15);
  --border-accent: rgba(99, 102, 241, 0.5);
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-dark: linear-gradient(180deg, #0a0e1a 0%, #1e1b4b 100%);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--gradient-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.2), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 40% 30% at 10% 80%, rgba(168, 85, 247, 0.1), transparent);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

/* ==================== WELCOME SCREEN ==================== */
.welcome {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome__logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 32px;
  background: var(--gradient-primary);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow), 0 8px 32px rgba(99, 102, 241, 0.3);
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.welcome__logo-icon {
  font-size: 48px;
}

.welcome__title {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.welcome__subtitle {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 48px;
  line-height: 1.5;
}

.welcome__button {
  width: 100%;
  border: none;
  background: var(--gradient-primary);
  color: #fff;
  padding: 18px 32px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  position: relative;
  overflow: hidden;
}

.welcome__button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.welcome__button:hover::before {
  left: 100%;
}

.welcome__button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.welcome__button:active {
  transform: translateY(0);
}

.welcome__start {
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.welcome__start::before {
  content: '📅';
}

/* ==================== COMMON SECTION STYLES ==================== */
.main, .tasks, .task, .leaderboard, .links {
  width: 100%;
  max-width: 380px;
  animation: fadeInUp 0.5s ease-out;
}

/* ==================== SECTION HEADER ==================== */
.main__header, .tasks__header, .task__header, .leaderboard__header, .links__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.main__title, .tasks__title, .leaderboard__title, .links__title {
  font-size: 28px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 28px;
}

/* ==================== MAIN SCREEN ==================== */
.main__list {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.main__card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 20px 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.main__card::before {
  content: '';
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.main__card:nth-child(1)::before { content: '📢'; font-size: 20px; line-height: 44px; text-align: center; background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.main__card:nth-child(2)::before { content: '💬'; font-size: 20px; line-height: 44px; text-align: center; background: linear-gradient(135deg, #10b981, #059669); }
.main__card:nth-child(3)::before { content: '✨'; font-size: 20px; line-height: 44px; text-align: center; background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.main__card:nth-child(4)::before { content: '📚'; font-size: 20px; line-height: 44px; text-align: center; background: linear-gradient(135deg, #f59e0b, #d97706); }

.main__card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateX(4px);
  box-shadow: var(--shadow-card);
}

.main__bottom {
  display: flex;
  gap: 12px;
}

.main__bottom-btn {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.main__bottom-btn:first-child::before { content: '🏆'; }
.main__bottom-btn:last-child::before { content: '🔗'; }

.main__bottom-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ==================== TASKS SCREEN ==================== */
.tasks__list {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.tasks__card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 20px 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.tasks__card::before {
  content: '';
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 44px;
  text-align: center;
}

.tasks__card::after {
  content: '→';
  position: absolute;
  right: 20px;
  font-size: 18px;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.tasks__card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateX(4px);
  box-shadow: var(--shadow-card);
}

.tasks__card:hover::after {
  right: 16px;
  color: var(--accent-primary);
}

/* Locked task card */
.tasks__card--locked {
  background: var(--locked-bg);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: transparent;
}

.tasks__card--locked::before {
  content: '🔒';
  background: rgba(100, 116, 139, 0.3);
}

.tasks__card--locked::after {
  content: '';
}

.tasks__card--locked:hover {
  transform: none;
  background: var(--locked-bg);
  border-color: transparent;
  box-shadow: none;
}

/* Completed task card */
.tasks__card--done {
  background: var(--success-bg);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.tasks__card--done::before {
  content: '✓';
  background: linear-gradient(135deg, #10b981, #059669);
  font-weight: 700;
}

.tasks__card--done::after {
  content: '✓';
  color: var(--success);
  font-weight: 700;
}

.tasks__card--done:hover {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.2);
}

.tasks__bottom {
  display: flex;
  gap: 12px;
}

.tasks__bottom-btn {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tasks__bottom-btn:first-child::before { content: '🏆'; }
.tasks__bottom-btn:last-child::before { content: '🔗'; }

.tasks__bottom-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ==================== TASK DETAIL SCREEN ==================== */
.task {
  text-align: left;
}

.task__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.3;
}

.task__text {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.task__button {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.task__button:first-of-type::before {
  content: '✨';
}

.task__button:last-of-type::before {
  content: '📤';
}

.task__button:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.task__button--primary {
  background: var(--gradient-primary);
  border: none;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.task__button--primary:hover {
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.task__bottom {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.task__bottom-btn {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.task__bottom-btn:first-child::before { content: '🏆'; }
.task__bottom-btn:last-child::before { content: '🔗'; }

.task__bottom-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ==================== LEADERBOARD SCREEN ==================== */
.leaderboard__card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 8px;
  margin-bottom: 24px;
  max-height: 55vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-primary) transparent;
}

.leaderboard__card::-webkit-scrollbar {
  width: 6px;
}

.leaderboard__card::-webkit-scrollbar-track {
  background: transparent;
}

.leaderboard__card::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 3px;
}

.leaderboard__row {
  display: grid;
  grid-template-columns: 36px 1fr 60px;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.leaderboard__row:hover {
  background: rgba(99, 102, 241, 0.08);
}

.leaderboard__me {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 12px;
}

.leaderboard__row--me {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
  border: 1px solid var(--border-accent);
  border-radius: 12px;
}

.leaderboard__pos {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.leaderboard__card .leaderboard__row:nth-child(-n+3) .leaderboard__pos {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.leaderboard__card .leaderboard__row:nth-child(1) .leaderboard__pos {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
}

.leaderboard__card .leaderboard__row:nth-child(2) .leaderboard__pos {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  color: #1a1a2e;
}

.leaderboard__card .leaderboard__row:nth-child(3) .leaderboard__pos {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
}

.leaderboard__row--me .leaderboard__pos {
  color: var(--accent-primary);
}

.leaderboard__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard__row--me .leaderboard__name {
  font-weight: 600;
  color: var(--accent-primary);
}

.leaderboard__score {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.leaderboard__score::after {
  content: '⭐';
  font-size: 12px;
}

.leaderboard__row--me .leaderboard__score {
  color: var(--accent-primary);
}

.leaderboard__bottom {
  display: flex;
  gap: 12px;
}

.leaderboard__bottom-btn {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.leaderboard__bottom-btn:first-child::before { content: '📋'; }
.leaderboard__bottom-btn:last-child::before { content: '🔗'; }

.leaderboard__bottom-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ==================== LINKS SCREEN ==================== */
.links__list {
  display: grid;
  gap: 14px;
  margin-bottom: 28px;
}

.links__card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 20px 24px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  position: relative;
}

.links__card::before {
  content: '';
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 44px;
  text-align: center;
}

.links__card:nth-child(1)::before { content: '📢'; background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.links__card:nth-child(2)::before { content: '💬'; background: linear-gradient(135deg, #10b981, #059669); }
.links__card:nth-child(3)::before { content: '✨'; background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.links__card:nth-child(4)::before { content: '📚'; background: linear-gradient(135deg, #f59e0b, #d97706); }

.links__card::after {
  content: '↗';
  position: absolute;
  right: 20px;
  font-size: 16px;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.links__card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateX(4px);
  box-shadow: var(--shadow-card);
}

.links__card:hover::after {
  right: 16px;
  color: var(--accent-primary);
}

.links__bottom {
  display: flex;
  gap: 12px;
}

.links__bottom-btn {
  flex: 1;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.links__bottom-btn:first-child::before { content: '🏆'; }
.links__bottom-btn:last-child::before { content: '📋'; }

.links__bottom-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-2px);
}

/* ==================== HIDDEN ELEMENTS ==================== */
[hidden] {
  display: none !important;
}

/* ==================== SCROLLBAR GLOBAL ==================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.5);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 400px) {
  .app {
    padding: 20px 16px;
  }
  
  .welcome__title {
    font-size: 32px;
  }
  
  .main__title, .tasks__title, .leaderboard__title, .links__title {
    font-size: 24px;
  }
  
  .main__card, .tasks__card, .links__card {
    padding: 16px 20px;
  }
  
  .main__card::before, .tasks__card::before, .links__card::before {
    width: 38px;
    height: 38px;
    font-size: 16px;
    line-height: 38px;
  }
}

/* ==================== SAFE AREA FOR iOS ==================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}
