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

:root {
  --navy: #0d1f3c;
  --navy-light: #1a3260;
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --white: #ffffff;
  --bg: #f8f9fc;
  --bg2: #eef1f8;
  --text: #1a2340;
  --gray: #6b7a99;
  --border: rgba(201,168,76,0.25);
  --border2: #dde3f0;
  --success: #28a745;
  --danger: #dc3545;
}
* { margin:0; padding:0; box-sizing:border-box; }
html { overflow-x:hidden; -webkit-text-size-adjust:100%; text-size-adjust:100%; }
img, video, iframe { max-width:100%; }
body { font-family:'Raleway',sans-serif; background:var(--bg); color:var(--text); min-height:100vh; display:flex; flex-direction:column; overflow-x:hidden; }

/* ===== HEADER ===== */
header {
  background:rgba(255,255,255,0.98); backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(13,31,60,0.08);
  padding:0 max(1.75rem, env(safe-area-inset-right)) 0 max(1.75rem, env(safe-area-inset-left));
  padding-top:env(safe-area-inset-top);
  position:sticky; top:0; z-index:100;
  box-shadow:0 4px 24px rgba(13,31,60,0.06);
}
.header-inner {
  max-width:1280px; margin:0 auto;
  display:flex; align-items:center; justify-content:space-between;
  height:88px; gap:1rem;
}
.logo { display:flex; align-items:center; gap:14px; text-decoration:none; cursor:pointer; flex-shrink:0; }
.logo img {
  width:68px; height:68px; object-fit:contain; border-radius:50%;
  box-shadow:0 4px 16px rgba(13,31,60,0.14);
  border:2px solid rgba(201,168,76,0.25);
}
.logo-text { font-family:'Playfair Display',serif; font-size:1.65rem; font-weight:700; color:var(--navy); line-height:1.1; }
.logo-text span { color:var(--gold); }
.logo-sub { display:block; font-size:0.72rem; font-weight:600; color:var(--navy-light); font-family:'Raleway',sans-serif; margin-top:3px; opacity:0.8; }

/* Desktop nav */
.header-nav { display:flex; gap:0.25rem; align-items:center; flex:1; justify-content:center; }
.header-nav > a,
.header-nav > .dropdown > a {
  color:var(--navy); text-decoration:none;
  font-size:0.97rem; font-weight:600; letter-spacing:0.01em;
  padding:0.55rem 1rem; border-radius:10px;
  transition:color 0.18s, background 0.18s, box-shadow 0.18s;
  cursor:pointer; white-space:nowrap;
}
.header-nav > a:hover,
.header-nav > .dropdown > a:hover {
  color:var(--navy-light); background:rgba(13,31,60,0.05);
}
.header-nav > a.active,
.header-nav > .dropdown > a.active {
  color:var(--navy); font-weight:700;
  background:linear-gradient(135deg,rgba(201,168,76,0.18),rgba(232,201,122,0.12));
  box-shadow:inset 0 0 0 1px rgba(201,168,76,0.35);
}
.btn-login {
  background:linear-gradient(135deg,var(--navy),var(--navy-light)) !important;
  color:var(--white) !important; padding:11px 24px !important;
  border-radius:10px; font-size:0.95rem !important; font-weight:700 !important;
  box-shadow:0 4px 14px rgba(13,31,60,0.22);
}
.btn-login:hover { transform:translateY(-1px); box-shadow:0 6px 18px rgba(13,31,60,0.28) !important; color:var(--white) !important; }

/* Nav user block */
.nav-user {
  display:flex; align-items:center; gap:0.75rem; flex-shrink:0;
  padding:0.4rem 0.5rem 0.4rem 0.65rem;
  background:linear-gradient(135deg,rgba(13,31,60,0.04),rgba(201,168,76,0.06));
  border:1px solid rgba(201,168,76,0.28); border-radius:14px;
}
.nav-user-avatar {
  width:40px; height:40px; border-radius:50%; flex-shrink:0;
  background:linear-gradient(135deg,var(--navy),var(--navy-light));
  color:var(--gold-light); font-size:1rem; font-weight:800;
  display:flex; align-items:center; justify-content:center;
  font-family:'Playfair Display',serif;
}
.nav-user-info { min-width:0; }
.nav-user-name {
  font-size:0.95rem; font-weight:700; color:var(--navy);
  white-space:nowrap; max-width:180px; overflow:hidden; text-overflow:ellipsis; line-height:1.25;
}
.nav-user-group { font-size:0.8rem; color:#8a6d1f; font-weight:700; margin-top:1px; }
.btn-nav-logout {
  background:var(--white); border:1.5px solid rgba(13,31,60,0.15);
  color:var(--navy); padding:0.45rem 1rem; border-radius:9px;
  font-size:0.88rem; font-weight:700; cursor:pointer;
  font-family:'Raleway',sans-serif; transition:all 0.18s; white-space:nowrap;
}
.btn-nav-logout:hover { background:var(--danger); border-color:var(--danger); color:white; }

/* Dropdown */
.dropdown { position:relative; }
.dropdown-menu {
  display:none; position:absolute; top:calc(100% + 10px); left:0;
  background:var(--white); border-radius:14px;
  box-shadow:0 12px 40px rgba(13,31,60,0.14);
  border:1px solid rgba(201,168,76,0.2); min-width:280px; z-index:300;
  overflow:hidden; animation:dropIn 0.15s ease;
}
@keyframes dropIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
.dropdown-menu.open { display:block; }
.dropdown-menu a {
  display:flex; align-items:center; gap:0.75rem;
  padding:0.95rem 1.25rem; color:var(--navy); text-decoration:none;
  font-size:0.95rem; font-weight:600;
  border-bottom:1px solid rgba(13,31,60,0.06); transition:background 0.15s, color 0.15s;
}
.dropdown-menu a:last-child { border-bottom:none; }
.dropdown-menu a:hover { background:rgba(201,168,76,0.1); color:var(--navy); }
.dropdown-menu a.active { background:rgba(201,168,76,0.14); color:var(--navy); font-weight:700; }
/* ===== SVG ICONS ===== */
.ico-svg { display:inline-block; vertical-align:middle; flex-shrink:0; }
.ico-wrap { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.ico-wrap--info { color:#2a5298; }
.ico-wrap--warn { color:#c9a84c; }
.dm-icon {
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px; flex-shrink:0;
  background:rgba(13,31,60,0.06); border-radius:9px;
}
.dm-icon .ico-svg { stroke:var(--navy); }
.page-header h1.has-ico,
.page-header h1 {
  display:flex; align-items:center; justify-content:center; gap:0.7rem; flex-wrap:wrap;
}
.page-header h1 .ico-svg { stroke:var(--gold-light); flex-shrink:0; }
.header-nav > a.has-ico { display:inline-flex; align-items:center; gap:0.45rem; }
.header-nav > a.has-ico .ico-svg { stroke:var(--navy); }
.mobile-menu > a.has-ico { display:flex; align-items:center; gap:0.55rem; }
.mobile-menu > a.has-ico .ico-svg { stroke:var(--gold-light); }
.footer-logo.has-ico { display:inline-flex; align-items:center; justify-content:center; gap:0.5rem; }
.footer-logo .ico-svg { stroke:var(--gold-light); }
.hero-badge.has-ico { display:inline-flex; align-items:center; gap:0.5rem; }
.hero-badge .ico-svg { stroke:var(--gold-light); }
.info-box { align-items:center; }
.info-box .ico-wrap { margin-right:0.15rem; }
.stage-icon .ico-svg, .feature-icon .ico-svg { stroke:var(--navy); }
.author-avatar, .author-page-avatar {
  display:flex; align-items:center; justify-content:center;
}
.author-avatar .ico-svg, .author-page-avatar .ico-svg { stroke:var(--navy); }
.exercise-card h3.has-ico { display:flex; align-items:center; gap:0.5rem; }
.field label.has-ico { display:flex; align-items:center; gap:0.4rem; }
.dropdown > a .ico-svg { stroke:var(--gray); margin-left:2px; vertical-align:-2px; }

/* Author page */
.author-profile { max-width:860px; margin:0 auto; }
.author-profile-card {
  background:white; border-radius:24px; overflow:hidden;
  box-shadow:0 12px 40px rgba(13,31,60,0.1);
  border:1px solid rgba(201,168,76,0.22);
}
.author-profile-head {
  background:linear-gradient(135deg,var(--navy) 0%,#2a5298 100%);
  padding:2.5rem 2rem; display:flex; align-items:center; gap:2rem; flex-wrap:wrap;
}
.author-page-avatar {
  width:110px; height:110px; border-radius:22px;
  background:linear-gradient(145deg,var(--gold),var(--gold-light));
  box-shadow:0 0 0 6px rgba(201,168,76,0.25);
  flex-shrink:0;
}
.author-profile-name {
  font-family:'Playfair Display',serif; font-size:1.55rem; font-weight:900;
  color:white; margin-bottom:0.4rem;
}
.author-profile-title { color:var(--gold-light); font-weight:600; font-size:0.92rem; margin-bottom:0.75rem; }
.author-profile-tags { display:flex; flex-wrap:wrap; gap:0.5rem; }
.author-profile-tags span {
  background:rgba(255,255,255,0.12); color:rgba(255,255,255,0.9);
  font-size:0.75rem; font-weight:600; padding:0.3rem 0.75rem; border-radius:20px;
  border:1px solid rgba(255,255,255,0.15);
}
.author-profile-body { padding:2rem; }
.author-profile-stats {
  display:grid; grid-template-columns:repeat(3,1fr); gap:1rem; margin-bottom:2rem;
}
.author-profile-stat {
  background:var(--bg); border-radius:14px; padding:1.1rem; text-align:center;
  border:1px solid rgba(13,31,60,0.08); transition:transform 0.2s, box-shadow 0.2s;
}
.author-profile-stat:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(13,31,60,0.08); }
.author-profile-stat .num {
  font-family:'Playfair Display',serif; font-size:1.8rem; font-weight:900; color:var(--navy);
}
.author-profile-stat .lbl {
  font-size:0.72rem; color:var(--gray); font-weight:700; text-transform:uppercase;
  margin-top:4px; letter-spacing:0.04em;
}
.author-profile-bio { color:var(--text); font-size:0.94rem; line-height:1.75; margin-bottom:1rem; }

/* Hamburger */
.hamburger { display:none; flex-direction:column; gap:5px; cursor:pointer; padding:6px; }
.hamburger span { width:26px; height:2.5px; background:var(--navy); border-radius:2px; transition:0.3s; }

/* Mobile menu */
.mobile-menu {
  display:none; background:linear-gradient(180deg,var(--navy) 0%,#152a52 100%);
  padding:1rem 1.25rem 1.4rem; flex-direction:column; gap:0.35rem;
  max-height:calc(100vh - 88px); overflow-y:auto;
  border-top:1px solid rgba(201,168,76,0.25);
}
.mobile-menu.open { display:flex; }
.mobile-menu a {
  color:rgba(255,255,255,0.92); text-decoration:none;
  font-size:1.02rem; font-weight:600;
  padding:0.85rem 1.1rem; border-radius:10px;
  transition:background 0.15s; display:block;
}
.mobile-menu a:hover { background:rgba(255,255,255,0.08); }
.mobile-menu a.active {
  background:rgba(201,168,76,0.2); color:var(--gold-light);
  font-weight:800; box-shadow:inset 3px 0 0 var(--gold);
}
.mobile-section-label {
  font-size:0.72rem; color:rgba(232,201,122,0.55); font-weight:800;
  text-transform:uppercase; letter-spacing:0.14em;
  padding:1rem 1.1rem 0.35rem;
}
.mobile-user-block {
  display:flex; align-items:center; justify-content:space-between; gap:0.75rem;
  padding:0.85rem 1.1rem; margin-top:0.5rem;
  border-top:1px solid rgba(201,168,76,0.2);
  background:rgba(255,255,255,0.05); border-radius:12px;
}
.mobile-user-block .nav-user-name { color:var(--white); max-width:none; font-size:1rem; }
.mobile-user-block .nav-user-group { color:var(--gold-light); font-size:0.85rem; }

/* ===== BUTTONS ===== */
.btn-primary { background:linear-gradient(135deg,var(--gold),var(--gold-light)); color:var(--navy); padding:13px 30px; border-radius:8px; font-weight:700; font-size:0.95rem; border:none; cursor:pointer; transition:transform 0.2s,box-shadow 0.2s; font-family:'Raleway',sans-serif; display:inline-block; text-decoration:none; }
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 8px 25px rgba(201,168,76,0.45); }
.btn-secondary { background:transparent; color:var(--gold-light); padding:13px 30px; border-radius:8px; font-weight:600; font-size:0.95rem; border:1px solid rgba(201,168,76,0.5); cursor:pointer; transition:background 0.2s; font-family:'Raleway',sans-serif; text-decoration:none; display:inline-block; }
.btn-secondary:hover { background:rgba(201,168,76,0.1); }
.btn-submit { background:linear-gradient(135deg,var(--navy),var(--navy-light)); color:white; border:none; padding:13px 30px; border-radius:8px; font-size:0.95rem; font-weight:700; cursor:pointer; font-family:'Raleway',sans-serif; transition:opacity 0.2s; }
.btn-submit:hover { opacity:0.88; }

/* ===== SECTIONS ===== */
section { padding:5rem 2rem; }
.section-inner { max-width:1200px; margin:0 auto; }
.section-header { text-align:center; margin-bottom:3rem; }
.section-tag {
  display:inline-block; color:var(--gold); font-size:0.78rem;
  letter-spacing:0.14em; text-transform:uppercase; margin-bottom:1rem; font-weight:800;
  background:rgba(201,168,76,0.1); padding:0.4rem 1rem; border-radius:20px;
  border:1px solid rgba(201,168,76,0.22);
}
.section-title { font-family:'Playfair Display',serif; font-size:2.4rem; font-weight:700; margin-bottom:1rem; color:var(--navy); }
.section-desc { color:var(--gray); font-size:1rem; max-width:580px; margin:0 auto; line-height:1.7; }

/* ===== STAGE CARDS ===== */
.stages-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(300px,1fr)); gap:1.75rem; }
.stage-card {
  position:relative; overflow:hidden;
  background:linear-gradient(165deg,#fff 0%,#f8fafc 100%);
  border:1px solid rgba(13,31,60,0.07);
  border-radius:20px; padding:2rem 2rem 2.1rem;
  transition:transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
  box-shadow:0 4px 24px rgba(13,31,60,0.06);
}
.stage-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:4px;
  background:linear-gradient(90deg,var(--navy),var(--gold),var(--gold-light));
}
.stage-card:hover {
  transform:translateY(-6px);
  box-shadow:0 20px 48px rgba(13,31,60,0.12);
  border-color:rgba(201,168,76,0.35);
}
.stage-card-top {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:1.35rem;
}
.stage-num {
  width:48px; height:48px;
  background:linear-gradient(135deg,var(--navy),var(--navy-light));
  border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  font-family:'Playfair Display',serif; font-size:1.35rem; font-weight:700;
  color:var(--gold-light);
  box-shadow:0 6px 16px rgba(13,31,60,0.2);
}
.stage-icon, .feature-icon {
  width:52px; height:52px; border-radius:14px;
  background:linear-gradient(135deg,rgba(201,168,76,0.15),rgba(232,201,122,0.08));
  display:flex; align-items:center; justify-content:center;
  font-size:1.65rem;
}
.feature-icon { width:56px; height:56px; font-size:1.85rem; margin-bottom:1.25rem; }
.stage-card.feature-card { padding-top:2.2rem; }
.stage-card.feature-card::before { background:linear-gradient(90deg,var(--gold),var(--gold-light)); }
.stage-card h3 {
  font-size:1.15rem; font-weight:800; margin-bottom:0.75rem;
  color:var(--navy); line-height:1.35;
}
.stage-card p { color:var(--gray); font-size:0.94rem; line-height:1.65; }

/* ===== TOPIC CARDS ===== */
.topics-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1.15rem; }
.topic-card {
  position:relative; overflow:hidden;
  background:var(--white);
  border:1px solid rgba(13,31,60,0.08);
  border-radius:16px;
  padding:1.25rem 1.35rem 1.25rem 1.5rem;
  display:flex; align-items:center; gap:1.1rem;
  transition:transform 0.22s ease, box-shadow 0.22s, border-color 0.22s;
  cursor:pointer;
  box-shadow:0 2px 14px rgba(13,31,60,0.05);
}
.topic-card::after {
  content:'→'; position:absolute; right:1.1rem; top:50%; transform:translateY(-50%) translateX(6px);
  font-size:1.1rem; font-weight:800; color:var(--gold);
  opacity:0; transition:opacity 0.2s, transform 0.2s;
}
.topic-card:hover {
  border-color:rgba(201,168,76,0.45);
  box-shadow:0 12px 32px rgba(13,31,60,0.1);
  transform:translateY(-3px);
  padding-right:2.5rem;
}
.topic-card:hover::after { opacity:1; transform:translateY(-50%) translateX(0); }
.topic-card:has(> :last-child:not(.topic-info)):hover { padding-right:1.35rem; }
.topic-card:has(> :last-child:not(.topic-info))::after { display:none; }
.topic-num {
  width:44px; height:44px;
  background:linear-gradient(145deg,var(--navy) 0%,#243d72 100%);
  border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:0.95rem; font-weight:800; color:var(--gold-light);
  flex-shrink:0;
  box-shadow:0 4px 12px rgba(13,31,60,0.18);
}
.topic-info { flex:1; min-width:0; }
.topic-info h4 {
  font-size:0.92rem; font-weight:700; margin-bottom:0.45rem;
  color:var(--navy); line-height:1.4;
}
.topic-info p {
  display:inline-block; font-size:0.78rem; font-weight:700;
  color:#7a6520; background:rgba(201,168,76,0.14);
  padding:0.2rem 0.65rem; border-radius:20px;
}

/* ===== LEADERBOARD ===== */
.leaderboard-table {
  background:var(--white);
  border:1px solid rgba(13,31,60,0.08);
  border-radius:20px; overflow:hidden;
  box-shadow:0 8px 32px rgba(13,31,60,0.08);
}
.lb-header {
  display:grid; grid-template-columns:60px 1fr 120px 120px 100px;
  padding:1.1rem 1.5rem;
  background:linear-gradient(135deg,var(--navy) 0%,#1e3a6e 100%);
  font-size:0.8rem; color:var(--gold-light);
  font-weight:700; letter-spacing:0.08em; text-transform:uppercase;
}
.lb-row {
  display:grid; grid-template-columns:60px 1fr 120px 120px 100px;
  padding:1.05rem 1.5rem;
  border-bottom:1px solid rgba(13,31,60,0.06);
  align-items:center; transition:background 0.2s;
}
.lb-row:nth-child(even) { background:rgba(248,249,252,0.8); }
.lb-row:hover { background:rgba(201,168,76,0.08); }
.lb-row:last-child { border-bottom:none; }
.lb-empty { text-align:center; padding:3.5rem 2rem; color:var(--gray); font-size:0.95rem; }
.lb-rank { font-family:'Playfair Display',serif; font-size:1.25rem; font-weight:700; display:flex; align-items:center; justify-content:center; }
.lb-rank .ico-svg { stroke:currentColor; }
.rank-1 { color:#e6b800; } .rank-2 { color:#9aa3b8; } .rank-3 { color:#c47a2c; }
.lb-name { font-weight:700; color:var(--navy); font-size:0.95rem; }
.lb-group { color:var(--gray); font-size:0.88rem; }
.lb-score {
  color:var(--navy); font-weight:800; font-size:1rem;
  background:rgba(201,168,76,0.15); padding:0.25rem 0.65rem;
  border-radius:8px; display:inline-block; text-align:center;
}
.lb-tasks { color:var(--gray); font-size:0.88rem; }

/* ===== AUTHOR ===== */
.author-section {
  background:linear-gradient(160deg,#0a1830 0%,var(--navy) 45%,#1e3d72 100%);
  position:relative; overflow:hidden;
}
.author-section::before {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse 80% 60% at 90% 20%,rgba(201,168,76,0.12),transparent 55%),
              radial-gradient(ellipse 50% 40% at 10% 80%,rgba(255,255,255,0.04),transparent);
  pointer-events:none;
}
.author-section .section-inner { position:relative; z-index:1; }
.author-section .section-title { color:var(--white); }
.author-section .section-tag {
  background:rgba(201,168,76,0.15); padding:0.35rem 1rem; border-radius:20px;
  border:1px solid rgba(201,168,76,0.3);
}
.author-card {
  max-width:860px; margin:0 auto;
  background:rgba(255,255,255,0.06);
  backdrop-filter:blur(12px);
  border:1px solid rgba(201,168,76,0.25);
  border-radius:24px; padding:2.5rem 2.75rem;
  display:grid; grid-template-columns:auto 1fr; gap:2.25rem; align-items:start;
  box-shadow:0 24px 60px rgba(0,0,0,0.25);
}
.author-avatar {
  width:108px; height:108px;
  background:linear-gradient(145deg,var(--gold),var(--gold-light));
  border-radius:22px;
  display:flex; align-items:center; justify-content:center;
  font-size:2.75rem; flex-shrink:0;
  box-shadow:0 8px 24px rgba(201,168,76,0.35);
}
.author-name {
  font-family:'Playfair Display',serif; font-size:1.65rem; font-weight:700;
  margin-bottom:0.45rem; color:var(--white);
}
.author-title { color:var(--gold-light); font-size:0.92rem; font-weight:600; margin-bottom:1rem; }
.author-bio { color:rgba(255,255,255,0.78); font-size:0.94rem; line-height:1.75; margin-bottom:1.5rem; }
.author-stats { display:flex; gap:1rem; flex-wrap:wrap; }
.author-stat {
  flex:1; min-width:120px;
  background:rgba(255,255,255,0.07);
  border:1px solid rgba(201,168,76,0.2);
  border-radius:14px; padding:1rem 1.2rem;
  text-align:center; transition:background 0.2s, transform 0.2s;
}
.author-stat:hover { background:rgba(255,255,255,0.1); transform:translateY(-2px); }
.author-stat-num {
  font-family:'Playfair Display',serif; font-size:1.75rem; font-weight:700;
  color:var(--gold-light); line-height:1.2;
}
.author-stat-label { font-size:0.78rem; color:rgba(255,255,255,0.55); margin-top:0.35rem; font-weight:600; }

/* ===== PAGE HEADER ===== */
.page-header {
  background:linear-gradient(135deg,#1e3d72 0%,#2a5298 55%,#3d6eb5 100%);
  color:white; padding:3.2rem 1.5rem 2.8rem; text-align:center;
  position:relative; overflow:hidden;
}
.page-header::before {
  content:''; position:absolute; inset:0;
  background-image:linear-gradient(rgba(255,255,255,0.06) 1px,transparent 1px),
                    linear-gradient(90deg,rgba(255,255,255,0.06) 1px,transparent 1px);
  background-size:60px 60px;
}
.page-header::after {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse 70% 80% at 50% 120%,rgba(201,168,76,0.15),transparent 60%);
  pointer-events:none;
}
.page-header h1 {
  font-family:'Playfair Display',serif; font-size:clamp(1.75rem,3.8vw,2.5rem);
  font-weight:900; margin-bottom:0.55rem; position:relative;
  text-shadow:0 2px 12px rgba(0,0,0,0.15);
}
.page-header p { color:rgba(255,255,255,0.88); font-size:1.05rem; position:relative; font-weight:400; }

/* ===== MAIN ===== */
.main { max-width:1200px; margin:0 auto; padding:2rem 1.5rem; flex:1; width:100%; }

/* ===== INFO BOX ===== */
.info-box {
  border-radius:14px; padding:1rem 1.25rem; font-size:0.92rem;
  margin-bottom:1.5rem; display:flex; align-items:flex-start; gap:0.65rem;
  line-height:1.65; font-weight:500;
}
.info-box.blue {
  background:linear-gradient(135deg,#eef4fc,#e3edfa);
  border:1px solid rgba(42,82,152,0.2); color:#1a3a6b;
  box-shadow:0 2px 12px rgba(42,82,152,0.06);
}
.info-box.gold {
  background:linear-gradient(135deg,#fef9e7,#fdf3d4);
  border:1px solid rgba(201,168,76,0.35); color:#7d5608;
  box-shadow:0 2px 12px rgba(201,168,76,0.08);
}

/* ===== FILE LIST ===== */
.file-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1.15rem; }
.file-item {
  position:relative; overflow:hidden;
  background:linear-gradient(165deg,#fff 0%,#f8fafc 100%);
  border:1px solid rgba(13,31,60,0.08);
  border-radius:16px; padding:1.25rem 1.35rem;
  display:flex; align-items:center; gap:1.1rem;
  cursor:pointer; transition:transform 0.22s ease, box-shadow 0.22s, border-color 0.22s;
  box-shadow:0 2px 14px rgba(13,31,60,0.05);
}
.file-item::before {
  content:''; position:absolute; left:0; top:0; bottom:0; width:4px;
  background:linear-gradient(180deg,var(--navy),var(--gold));
  opacity:0; transition:opacity 0.22s;
}
.file-item:hover {
  border-color:rgba(201,168,76,0.4);
  transform:translateY(-4px);
  box-shadow:0 14px 36px rgba(13,31,60,0.1);
}
.file-item:hover::before { opacity:1; }
.file-num {
  width:46px; height:46px; border-radius:13px;
  display:flex; align-items:center; justify-content:center;
  font-weight:800; font-size:1rem; flex-shrink:0; color:white;
  box-shadow:0 4px 12px rgba(13,31,60,0.18);
}
.file-num.navy   { background:linear-gradient(145deg,var(--navy),#243d72); }
.file-num.gold   { background:linear-gradient(135deg,var(--gold),var(--gold-light)); color:var(--navy); box-shadow:0 4px 12px rgba(201,168,76,0.35); }
.file-num.teal   { background:linear-gradient(135deg,#138d75,#1abc9c); }
.file-num.purple { background:linear-gradient(135deg,#7d3c98,#9b59b6); }
.file-info { flex:1; min-width:0; }
.file-info h3 {
  font-size:0.95rem; font-weight:700; color:var(--navy);
  margin-bottom:0.4rem; line-height:1.35;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.file-info p { font-size:0.82rem; color:var(--gray); line-height:1.4; }
.file-actions { display:flex; gap:0.5rem; align-items:center; flex-shrink:0; }
.file-badge {
  font-size:0.76rem; font-weight:700; white-space:nowrap;
  color:#6b7a99; background:rgba(13,31,60,0.06);
  padding:0.28rem 0.7rem; border-radius:20px;
  border:1px solid rgba(13,31,60,0.08);
}
.file-badge.ready {
  color:#1e6b3a; background:rgba(40,167,69,0.1);
  border-color:rgba(40,167,69,0.25);
}
.btn-view { background:var(--navy); color:white; border:none; padding:0.38rem 0.8rem; border-radius:7px; font-size:0.8rem; font-weight:700; cursor:pointer; white-space:nowrap; font-family:'Raleway',sans-serif; transition:opacity 0.2s; }
.btn-view:hover { opacity:0.85; }
.btn-dl { background:transparent; color:var(--gold); border:1.5px solid var(--gold); padding:0.38rem 0.8rem; border-radius:7px; font-size:0.8rem; font-weight:700; cursor:pointer; text-decoration:none; transition:all 0.2s; white-space:nowrap; }
.btn-dl:hover { background:var(--gold); color:var(--navy); }

/* ===== EXERCISE ===== */
.exercise-card {
  position:relative; overflow:hidden;
  background:linear-gradient(165deg,#fff 0%,#fafbfc 100%);
  border:1px solid rgba(201,168,76,0.25);
  border-radius:20px; padding:2rem 2.25rem;
  margin-bottom:1.5rem;
  box-shadow:0 8px 32px rgba(13,31,60,0.07);
}
.exercise-card::before {
  content:''; position:absolute; top:0; left:0; right:0; height:4px;
  background:linear-gradient(90deg,var(--navy),var(--gold),var(--gold-light));
}
.exercise-card h3 {
  font-size:1.12rem; color:var(--navy); margin-bottom:0.65rem;
  font-weight:800; padding-top:0.25rem;
}
.exercise-hint { color:var(--gray); font-size:0.94rem; margin-bottom:1.2rem; line-height:1.6; }
.exercise-text { color:var(--text); font-size:0.93rem; line-height:1.75; margin-bottom:1.3rem; white-space:pre-wrap; background:var(--bg); padding:1.1rem; border-radius:10px; border-left:3px solid var(--gold); }
.exercise-input { width:100%; background:var(--bg); border:1.5px solid var(--border2); border-radius:10px; padding:13px 16px; color:var(--navy); font-family:'Raleway',sans-serif; font-size:0.95rem; resize:vertical; min-height:130px; outline:none; margin-bottom:1rem; transition:border-color 0.2s; }
.exercise-input:focus { border-color:var(--gold); }

/* ===== FILE UPLOAD ===== */
.file-upload {
  margin-bottom:1.25rem; padding:1.25rem 1.35rem;
  background:var(--bg); border:1.5px dashed rgba(13,31,60,0.15);
  border-radius:14px; transition:border-color 0.2s, background 0.2s;
}
.file-upload:has(.file-upload-input:focus),
.file-upload:hover { border-color:rgba(201,168,76,0.5); background:#fff; }
.file-upload-title {
  font-size:0.88rem; font-weight:700; color:var(--navy);
  margin-bottom:0.85rem;
}
.file-upload-input {
  position:absolute; width:0.1px; height:0.1px; opacity:0; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap;
}
.file-upload-btn {
  display:inline-block; cursor:pointer;
  background:linear-gradient(135deg,var(--navy),var(--navy-light));
  color:white; padding:0.65rem 1.25rem; border-radius:10px;
  font-size:0.9rem; font-weight:700; font-family:'Raleway',sans-serif;
  transition:opacity 0.2s, transform 0.2s;
  margin-right:0.75rem;
}
.file-upload-btn:hover { opacity:0.9; transform:translateY(-1px); }
.file-upload-name {
  font-size:0.85rem; color:var(--gray); font-weight:600;
  vertical-align:middle; word-break:break-all;
}
.file-upload-name.has-file { color:var(--navy); font-weight:700; }

/* ===== GRADE BADGE ===== */
.grade-badge { display:inline-flex; align-items:center; padding:5px 15px; border-radius:20px; font-size:0.85rem; font-weight:800; }
.grade-5 { background:rgba(40,167,69,0.1); color:#28a745; border:1px solid #28a745; }
.grade-4 { background:rgba(201,168,76,0.1); color:var(--gold); border:1px solid var(--gold); }
.grade-3 { background:rgba(255,193,7,0.1); color:#e6a800; border:1px solid #e6a800; }

/* ===== PDF MODAL ===== */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.85); z-index:1000; align-items:flex-start; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal { background:white; width:100%; max-width:920px; height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
.modal-head { background:var(--navy); color:white; padding:0.8rem 1.1rem; display:flex; justify-content:space-between; align-items:center; font-weight:700; font-size:0.87rem; gap:0.8rem; flex-shrink:0; }
.modal-head span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.modal-head-actions { display:flex; gap:0.4rem; align-items:center; flex-shrink:0; }
.modal-dl-btn { background:var(--gold); color:var(--navy); border:none; padding:0.32rem 0.75rem; border-radius:6px; font-size:0.8rem; font-weight:800; cursor:pointer; text-decoration:none; white-space:nowrap; }
.modal-close { background:rgba(255,255,255,0.12); border:none; color:white; width:33px; height:33px; border-radius:7px; cursor:pointer; font-size:1.1rem; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.modal-close:hover { background:rgba(255,255,255,0.22); }
.modal iframe { flex:1; border:none; display:block; width:100%; }

/* ===== SINGLE PDF ===== */
.single-pdf-wrap { background:var(--white); border-radius:14px; border:1.5px solid var(--border2); overflow:hidden; box-shadow:0 4px 20px rgba(0,0,0,0.08); }
.single-pdf-head { background:var(--navy); color:white; padding:0.95rem 1.3rem; display:flex; justify-content:space-between; align-items:center; font-weight:700; font-size:0.9rem; gap:0.8rem; }
.single-pdf-head span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.single-pdf-wrap iframe { width:100%; height:80vh; border:none; display:block; }

/* ===== TOAST ===== */
.toast { position:fixed; bottom:2rem; right:2rem; background:var(--navy); color:var(--white); border:1px solid var(--gold); border-radius:12px; padding:1rem 1.5rem; font-size:0.9rem; z-index:2000; display:none; box-shadow:0 8px 25px rgba(0,0,0,0.2); max-width:320px; }
.toast.show { display:block; animation:fadeUp 0.3s ease; }
.toast.success { border-color:#28a745; }
.toast.error { border-color:#dc3545; }
@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

/* ===== FOOTER ===== */
footer {
  background:var(--navy); border-top:2px solid rgba(201,168,76,0.2);
  padding:2rem max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  text-align:center; margin-top:auto;
}
.footer-logo { font-family:'Playfair Display',serif; font-size:1.3rem; color:var(--gold-light); margin-bottom:0.5rem; }
.footer-text { color:rgba(255,255,255,0.4); font-size:0.85rem; line-height:1.5; }
.footer-text a { color:var(--gold); text-decoration:none; }

/* ===== HERO (index) ===== */
.hero {
  min-height:calc(100vh - 88px); min-height:calc(100dvh - 88px);
  display:flex; align-items:center; position:relative; overflow:hidden;
  padding:clamp(2.5rem, 6vw, 4rem) clamp(1rem, 4vw, 2rem);
  background:linear-gradient(135deg,rgba(13,31,60,0.52) 0%,rgba(26,50,96,0.48) 100%),url("boshsahifa.jpg") center/cover no-repeat;
}
.hero-pattern {
  position:absolute; inset:0;
  background-image:linear-gradient(rgba(201,168,76,0.07) 1px,transparent 1px),linear-gradient(90deg,rgba(201,168,76,0.07) 1px,transparent 1px);
  background-size:60px 60px;
}
.hero-inner {
  max-width:1200px; width:100%; margin:0 auto;
  display:grid; grid-template-columns:1fr 1fr; gap:clamp(2rem, 5vw, 4rem);
  align-items:center; position:relative; z-index:1;
}
.hero-badge {
  display:inline-flex; align-items:center; gap:8px;
  background:rgba(201,168,76,0.15); border:1px solid rgba(201,168,76,0.4);
  border-radius:20px; padding:6px 16px; font-size:0.78rem; color:var(--gold-light);
  margin-bottom:1.5rem; letter-spacing:1.5px; text-transform:uppercase; font-weight:600;
}
.hero h1 {
  font-family:'Playfair Display',serif; font-size:clamp(1.85rem, 5vw, 3.2rem);
  font-weight:900; line-height:1.15; margin-bottom:1.5rem; color:var(--white);
  text-shadow:0 2px 12px rgba(0,0,0,0.35);
}
.hero h1 span { color:var(--gold-light); }
.hero p {
  font-size:clamp(0.95rem, 2.5vw, 1.05rem); color:rgba(255,255,255,0.88);
  line-height:1.8; margin-bottom:2rem; text-shadow:0 1px 8px rgba(0,0,0,0.3);
}
.hero-btns { display:flex; gap:0.75rem; flex-wrap:wrap; }
.hero-btns .btn-primary,
.hero-btns .btn-secondary { min-height:48px; display:inline-flex; align-items:center; justify-content:center; }
.hero-card {
  background:rgba(255,255,255,0.06); border:1px solid rgba(201,168,76,0.25);
  border-radius:20px; padding:clamp(1.25rem, 3vw, 2rem); backdrop-filter:blur(10px);
}
.hero-card h3 {
  font-family:'Playfair Display',serif; font-size:1.15rem; color:var(--gold-light);
  margin-bottom:1.25rem; text-align:center;
}
.stat-grid { display:grid; grid-template-columns:1fr 1fr; gap:0.75rem; margin-bottom:1.25rem; }
.stat-item {
  background:rgba(255,255,255,0.05); border:1px solid rgba(201,168,76,0.2);
  border-radius:12px; padding:0.85rem; text-align:center;
}
.stat-num { font-family:'Playfair Display',serif; font-size:clamp(1.4rem, 4vw, 2rem); font-weight:700; color:var(--gold-light); }
.stat-label { font-size:0.72rem; color:rgba(255,255,255,0.5); margin-top:4px; }
.topic-list { display:flex; flex-direction:column; gap:0.5rem; }
.topic-item {
  font-size:0.8rem; color:rgba(255,255,255,0.7); padding:8px 12px;
  background:rgba(255,255,255,0.05); border-radius:6px; border-left:2px solid var(--gold);
}

/* Touch-friendly controls */
.btn-primary, .btn-secondary, .btn-submit, .btn-login, .btn-nav-logout,
.file-upload-btn, .hamburger, .topic-card, .file-item {
  -webkit-tap-highlight-color:transparent;
}
.hamburger {
  padding:10px; min-width:44px; min-height:44px;
  align-items:center; justify-content:center;
}

/* ===== RESPONSIVE ===== */

/* Laptop / small desktop */
@media (max-width:1200px) {
  .header-nav > a, .header-nav > .dropdown > a { padding:0.5rem 0.75rem; font-size:0.92rem; }
  .nav-user-name { max-width:140px; }
  section { padding:4rem 1.5rem; }
}

/* Tablet landscape — mobile menu */
@media (max-width:1024px) {
  .header-nav { display:none; }
  .hamburger { display:flex; }
  #navUserBlock { flex-shrink:1; min-width:0; }
  .nav-user { padding:0.35rem 0.45rem; gap:0.5rem; }
  .nav-user-group { display:none; }
  .nav-user-name { max-width:120px; font-size:0.88rem; }
  .btn-nav-logout { padding:0.4rem 0.75rem; font-size:0.82rem; }
  .hero-inner { grid-template-columns:1fr; gap:2rem; }
  .hero-card { max-width:520px; margin:0 auto; width:100%; }
  .stages-grid { grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
  .topics-grid { grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
  .file-list { grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); }
  .dropdown-menu { min-width:260px; }
}

/* Tablet portrait */
@media (max-width:768px) {
  header {
    padding:0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  }
  .header-inner { height:80px; gap:0.5rem; }
  .logo img { width:60px; height:60px; }
  .logo-text { font-size:1.35rem; }
  .main { padding:1.25rem max(1rem, env(safe-area-inset-left)); }
  section { padding:3rem 1rem; }
  .section-title { font-size:clamp(1.6rem, 5vw, 2.2rem); }
  .section-desc { font-size:0.95rem; }
  .page-header { padding:2rem 1rem 1.75rem; }
  .page-header h1 { font-size:clamp(1.5rem, 5vw, 2rem); gap:0.5rem; }
  .hero { min-height:auto; padding:2.5rem 1rem 3rem; }
  .hero-card { display:none; }
  .hero h1 { margin-bottom:1rem; }
  .hero p { margin-bottom:1.5rem; }
  .hero-btns { flex-direction:column; width:100%; }
  .hero-btns .btn-primary, .hero-btns .btn-secondary { width:100%; text-align:center; }
  .stages-grid, .topics-grid, .file-list { grid-template-columns:1fr; gap:1rem; }
  .stage-card, .exercise-card { padding:1.5rem 1.25rem; }
  .topic-card { padding:1.1rem 2.25rem 1.1rem 1.15rem; }
  .topic-card:hover { padding-right:2.25rem; }
  .file-item {
    flex-wrap:wrap; align-items:flex-start;
    padding:1.1rem 1.15rem;
  }
  .file-actions {
    width:100%; margin-top:0.5rem; padding-top:0.5rem;
    border-top:1px solid rgba(13,31,60,0.06);
  }
  .file-badge { display:inline-block; }
  .leaderboard-table { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .lb-header, .lb-row {
    grid-template-columns:44px minmax(120px, 1fr) 72px;
    min-width:0; padding:0.9rem 1rem;
  }
  .lb-group, .lb-tasks { display:none; }
  .author-card { grid-template-columns:1fr; text-align:center; padding:2rem 1.5rem; }
  .author-stats { justify-content:center; }
  .author-profile-head { flex-direction:column; text-align:center; padding:2rem 1.25rem; }
  .author-profile-stats { grid-template-columns:1fr; }
  .author-profile-body { padding:1.5rem 1.25rem; }
  .modal { height:100dvh; border-radius:0; max-width:100%; }
  .single-pdf-wrap iframe { height:65dvh; }
  .toast {
    left:1rem; right:1rem; bottom:max(1rem, env(safe-area-inset-bottom));
    max-width:none;
  }
  .auth-wrap { padding:1rem; }
  .auth-card { padding:2rem 1.35rem; }
  .file-upload-btn { display:block; width:100%; text-align:center; margin:0 0 0.65rem; }
  .file-upload-name { display:block; }
  .nav-user { max-width:100%; }
  .btn-nav-logout { min-height:40px; }
}

/* Phone */
@media (max-width:480px) {
  .header-inner { height:72px; }
  .logo img { width:50px; height:50px; }
  .logo-sub { display:none; }
  .logo-text { font-size:1.1rem; }
  .logo { gap:10px; min-width:0; }
  .nav-user-avatar { width:36px; height:36px; font-size:0.85rem; }
  .nav-user-name { max-width:90px; font-size:0.8rem; }
  .btn-nav-logout { padding:0.35rem 0.6rem; font-size:0.78rem; }
  .nav-user { gap:0.4rem; border-radius:12px; }
  #navUserBlock .btn-login { padding:8px 14px !important; font-size:0.85rem !important; }
  .file-num { width:40px; height:40px; font-size:0.88rem; border-radius:11px; }
  .topic-num { width:40px; height:40px; font-size:0.88rem; }
  .topic-info h4 { font-size:0.88rem; }
  .btn-view, .btn-dl { font-size:0.75rem; padding:0.35rem 0.65rem; min-height:40px; }
  .stage-num { width:44px; height:44px; font-size:1.2rem; }
  .footer-logo { font-size:1.15rem; }
  .footer-text { font-size:0.8rem; padding:0 0.5rem; }
  .exercise-card { padding:1.35rem 1rem; border-radius:16px; }
  .exercise-input { font-size:16px; min-height:120px; }
  .field input { font-size:16px; }
  .author-page-avatar { width:88px; height:88px; border-radius:18px; }
  .author-profile-name { font-size:1.3rem; }
  .hero-badge { font-size:0.7rem; padding:5px 12px; }
}

/* Small phone */
@media (max-width:360px) {
  .logo-text { font-size:1rem; }
  .nav-user-name { display:none; }
  .nav-user { padding:0.3rem; }
  .hero h1 { font-size:1.65rem; }
  .section-tag { font-size:0.72rem; padding:0.35rem 0.75rem; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:0.01ms !important;
    transition-duration:0.01ms !important;
  }
  .hero, .stage-card, .topic-card, .file-item { scroll-behavior:auto; }
}
