/* ===== PREMIUM DESIGN SYSTEM ===== */
:root {
  --bg: #050508;
  --card: #0F0F1A;
  --card-hover: #16162A;
  --violet: #8B5CF6;
  --indigo: #6366F1;
  --cyan: #06B6D4;
  --gold: #F59E0B;
  --rose: #F43F5E;
  --emerald: #10B981;
  --text: #F8FAFC;
  --text-dim: #94A3B8;
  --text-muted: #475569;
  --border: rgba(139, 92, 246, 0.15);
  --glass: rgba(8, 8, 14, 0.9);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }

/* Critical SVG Reset to prevent explosions */
svg { width: 24px; height: 24px; flex-shrink: 0; display: block; }

html, body {
  height: 100%; width: 100%; overflow: hidden; background: #000;
  color: var(--text); font-family: 'Outfit', sans-serif; line-height: 1.4;
}

.shell {
  width: 100%; height: 100dvh; display: flex; align-items: center; justify-content: center;
  background: #050508;
}

.phone {
  width: min(390px, 100vw); height: min(844px, 100dvh);
  background: var(--bg); position: relative; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.9);
}

@media (max-width: 430px) { .phone { width: 100%; height: 100%; border-radius: 0; } }

.screens { flex: 1; position: relative; overflow: hidden; background: var(--bg); }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  opacity: 0; pointer-events: none; transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg); padding-bottom: 30px;
}
.screen.active { opacity: 1; pointer-events: all; }
.screen::-webkit-scrollbar { display: none; }

/* ===== COMPONENTS ===== */
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; }
.logo { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.logo .oig { color: var(--cyan); }
.logo .gyan { background: linear-gradient(135deg, #fff, var(--violet)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.icon-btn {
  width: 40px; height: 40px; background: var(--card); border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; stroke: var(--text-dim); fill: none; stroke-width: 2; }

/* ===== HERO ===== */
.hero {
  margin: 10px 16px; padding: 26px; border-radius: 32px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.hero-badge {
  display: inline-flex; padding: 6px 12px; background: rgba(6, 182, 212, 0.1);
  border-radius: 100px; font-size: 10px; font-weight: 800; color: var(--cyan); margin-bottom: 14px;
}
.hero h2 { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.hero p { font-size: 13px; color: var(--text-dim); margin-bottom: 22px; }

.countdown { display: flex; gap: 10px; }
.cd-item { flex: 1; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 16px; padding: 12px 5px; text-align: center; }
.cd-num { font-size: 18px; font-weight: 900; color: #fff; line-height: 1; }
.cd-lbl { font-size: 8px; color: var(--text-muted); margin-top: 4px; font-weight: 700; text-transform: uppercase; }

/* ===== GRID & LISTS ===== */
.section-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 20px 10px; }
.section-title { font-size: 16px; font-weight: 800; }
.section-link { font-size: 12px; font-weight: 700; color: var(--violet); }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 16px; }
.qcard { background: var(--card); border: 1px solid rgba(255,255,255,0.03); border-radius: 22px; padding: 20px 10px; text-align: center; cursor: pointer; }
.qicon { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.qi1 { background: rgba(139, 92, 246, 0.15); }
.qcard-label { font-size: 11px; font-weight: 700; color: var(--text-dim); }

.hscroll { display: flex; gap: 14px; padding: 0 16px 15px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hscroll::-webkit-scrollbar { display: none; }
.trend-card { min-width: 170px; background: var(--card); border: 1px solid rgba(255,255,255,0.03); border-radius: 24px; padding: 18px; flex-shrink: 0; }
.trend-badge { font-size: 9px; font-weight: 800; padding: 3px 9px; border-radius: 100px; display: inline-block; margin-bottom: 8px; }
.trend-badge.nb-urgent { background: rgba(244, 63, 94, 0.2); color: var(--rose); }
.trend-badge.nb-info { background: rgba(6, 182, 212, 0.2); color: var(--cyan); }
.trend-badge.nb-normal { background: rgba(139, 92, 246, 0.2); color: var(--violet); }
.trend-title { font-size: 13px; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }

/* ===== CLASSES ===== */
.page-title { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 800; padding: 15px 20px; }
.class-cards { display: flex; flex-direction: column; gap: 14px; padding: 0 16px; }
.ccard { border-radius: 28px; padding: 24px; border: 1px solid rgba(255,255,255,0.03); position: relative; overflow: hidden; cursor: pointer; }
.cc10 { background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.05)); }
.cc11 { background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(8, 145, 178, 0.05)); }
.cc12 { background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(139, 92, 246, 0.05)); }
.ccard-num { position: absolute; right: 20px; top: 10px; font-size: 64px; font-weight: 900; color: rgba(255, 255, 255, 0.04); }
.ccard h3 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.ccard p { font-size: 12px; color: var(--text-dim); }
.subj-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.pill { font-size: 10px; font-weight: 700; padding: 5px 12px; border-radius: 100px; background: rgba(255,255,255,0.05); color: var(--text-dim); }
.ccard-arrow { position: absolute; right: 24px; bottom: 24px; width: 34px; height: 34px; background: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ccard-arrow svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2.5; }

/* ===== QUIZ ===== */
.daily-card { margin: 10px 16px; padding: 26px; border-radius: 32px; background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.15)); border: 1px solid var(--border); }
.daily-badge { font-size: 9px; font-weight: 900; color: var(--gold); background: rgba(245, 158, 11, 0.1); padding: 4px 12px; border-radius: 100px; margin-bottom: 12px; display: inline-block; }
.daily-title { font-size: 20px; font-weight: 800; margin-bottom: 15px; }
.quiz-btn { display: inline-flex; padding: 12px 24px; background: #fff; color: #000; border-radius: 16px; font-weight: 800; text-decoration: none; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 10px 16px; }
.stat-card { background: var(--card); border: 1px solid rgba(255,255,255,0.03); border-radius: 22px; padding: 18px 10px; text-align: center; }
.stat-num { font-size: 20px; font-weight: 800; display: block; }
.stat-lbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

.leaderboard { margin: 10px 16px; background: var(--card); border-radius: 28px; overflow: hidden; border: 1px solid rgba(255,255,255,0.03); }
.lb-item { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.lb-rank { font-size: 14px; font-weight: 800; min-width: 24px; }
.lb-avatar { width: 36px; height: 36px; border-radius: 50%; background: #24243D; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.lb-name { flex: 1; font-weight: 700; font-size: 14px; }
.lb-xp { font-weight: 800; color: var(--violet); font-size: 12px; }

/* ===== PROFILE ===== */
.profile-top { display: flex; flex-direction: column; align-items: center; padding: 40px 20px 20px; }
.profile-avatar { width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--cyan)); display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 900; box-shadow: 0 15px 35px rgba(139, 92, 246, 0.3); margin-bottom: 15px; }
.profile-name { font-family: 'Sora', sans-serif; font-size: 24px; font-weight: 800; margin-bottom: 5px; }
.profile-class { font-size: 12px; color: var(--violet); font-weight: 700; text-transform: uppercase; }

.streak-strip { margin: 10px 16px; padding: 20px; border-radius: 24px; background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(139, 92, 246, 0.1)); border: 1px solid rgba(245, 158, 11, 0.1); display: flex; align-items: center; gap: 15px; }
.streak-num { font-size: 24px; font-weight: 900; color: var(--gold); }

.pmenu { margin: 10px 16px; background: var(--card); border-radius: 28px; overflow: hidden; border: 1px solid rgba(255,255,255,0.03); }
.pmenu-item { display: flex; align-items: center; gap: 15px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.03); cursor: pointer; }
.pmenu-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.pmenu-icon svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2.2; }

/* ===== PAPER FEED & POSTS ===== */
.filter-chips { display: flex; gap: 10px; padding: 12px 16px 16px; overflow-x: auto; }
.chip { padding: 8px 18px; border-radius: 100px; font-size: 12px; font-weight: 800; background: var(--card); border: 1px solid rgba(255,255,255,0.03); color: var(--text-dim); flex-shrink: 0; }
.chip.active { background: var(--violet); color: #fff; border-color: var(--violet); box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3); }

.post { background: var(--card); border: 1px solid rgba(255, 255, 255, 0.04); border-radius: 32px; margin: 15px 16px; overflow: hidden; }
.post-header { padding: 16px 18px; display: flex; align-items: center; gap: 12px; }
.post-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--violet), var(--indigo)); display: flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; }
.post-name { font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.verified-badge { background: var(--indigo); width: 15px; height: 15px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.verified-badge svg { stroke: #fff; stroke-width: 3.5; width: 9px; height: 9px; }
.post-time { font-size: 11px; color: var(--text-muted); }
.post-caption { padding: 0 18px 12px; font-size: 13.5px; color: rgba(255, 255, 255, 0.8); line-height: 1.5; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 16px; }
.post-tag { font-size: 10px; font-weight: 800; color: var(--violet); background: rgba(139, 92, 246, 0.1); padding: 4px 10px; border-radius: 8px; }

.carousel-wrap { padding: 0 16px 16px; position: relative; width: 100%; }
.carousel { 
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; 
    gap: 12px; border-radius: 24px; padding: 0 20px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x;
}
.carousel::-webkit-scrollbar { display: none; }
.slide { 
    min-width: 280px; width: 85%; height: 240px; border-radius: 20px; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    padding: 24px; scroll-snap-align: center; position: relative;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.2); flex-shrink: 0;
}
.slide-s1 { background: linear-gradient(135deg, #1e1b4b, #312e81); }
.slide-s2 { background: linear-gradient(135deg, #2e1065, #4c1d95); }
.slide-s3 { background: linear-gradient(135deg, #083344, #155e75); }

.slide-page { position: absolute; top: 18px; left: 18px; font-size: 10px; font-weight: 900; color: rgba(255,255,255,0.4); }
.slide-title { font-family: 'Sora', sans-serif; font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.slide-sub { font-size: 13px; color: rgba(255,255,255,0.6); text-align: center; }
.slide-type { position: absolute; bottom: 18px; right: 18px; font-size: 10px; font-weight: 800; background: rgba(255,255,255,0.1); padding: 5px 10px; border-radius: 8px; }

.dots { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.dot { width: 6px; height: 6px; border-radius: 10px; background: var(--text-muted); transition: 0.3s; }
.dot.active { width: 20px; background: var(--violet); }

.post-actions { display: flex; border-top: 1px solid rgba(255, 255, 255, 0.05); padding: 8px 10px; }
.paction { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; padding: 12px; cursor: pointer; transition: 0.2s; }
.paction:active { transform: scale(0.9); opacity: 0.7; }
.paction svg { width: 20px; height: 20px; stroke: var(--text-dim); fill: none; stroke-width: 1.8; }
.paction span { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.paction.liked svg { fill: var(--rose); stroke: var(--rose); }
.paction.saved svg { fill: var(--gold); stroke: var(--gold); }

/* CAROUSEL NAV BUTTONS */
.c-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; background: rgba(0,0,0,0.6); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;
    border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(5px);
}
.c-prev { left: 5px; }
.c-next { right: 5px; }
.c-nav svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 3; }

/* MODAL / FULL VIEW */
.modal {
    display: none; position: fixed; z-index: 2000; inset: 0;
    background: rgba(0,0,0,0.95); backdrop-filter: blur(10px);
    flex-direction: column; align-items: center; justify-content: center;
}
.modal.active { display: flex; }
.modal-content-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 20px; }
.modal-content { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; transition: 0.3s; }
.close { position: absolute; top: 30px; right: 30px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; z-index: 2100; }

.slide img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }

/* ===== NAVBAR ===== */
.navbar {
  height: 72px; background: var(--glass); backdrop-filter: blur(20px); border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: space-around; padding: 0 10px calc(env(safe-area-inset-bottom, 0px) + 8px);
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; cursor: pointer; opacity: 0.5; }
.nav-item.active { opacity: 1; }
.nav-item svg { width: 22px; height: 22px; stroke: var(--text-muted); fill: none; stroke-width: 2.2; }
.nav-item.active svg { stroke: var(--violet); }
.nav-item span { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.nav-item.active span { color: var(--violet); }

/* AUTH STATES */
body:not(.logged-in) .navbar, body:not(.logged-in) .top-bar { display: none; }
body.logged-in #s-auth { display: none; }
.btn-primary { width: 100%; padding: 18px; border-radius: 18px; background: var(--violet); color: #fff; border: none; font-weight: 800; font-size: 16px; cursor: pointer; }
