/* ===========================================================
   Aven Design System
   =========================================================== */

:root{
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F1F8;
  --border: #E5E5EF;
  --text: #16161F;
  --text-muted: #63636F;
  --text-faint: #9494A0;

  --primary: #4338CA;
  --primary-dark: #362DA0;
  --primary-light: #EEF0FF;
  --accent: #0EA5A0;
  --accent-light: #E4F8F7;

  --success: #16A34A;
  --success-light: #EAF9EF;
  --warning: #D97706;
  --warning-light: #FEF3E2;
  --danger: #DC2626;
  --danger-light: #FDECEC;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20,20,40,0.06);
  --shadow: 0 4px 16px rgba(20,20,40,0.08);
  --shadow-lg: 0 12px 32px rgba(20,20,40,0.12);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"]{
  --bg: #0F0F16;
  --surface: #17171F;
  --surface-2: #1E1E29;
  --border: #2A2A38;
  --text: #F2F2F7;
  --text-muted: #A3A3B2;
  --text-faint: #6C6C7C;
  --primary-light: #211F3A;
  --accent-light: #10292A;
  --success-light: #10281A;
  --warning-light: #2B2110;
  --danger-light: #2B1414;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

*{ box-sizing: border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px;
}
@media (min-width: 900px){ body{ padding-bottom: 0; } }

.container{ max-width: 1120px; margin: 0 auto; padding: 0 20px; }
a{ color: inherit; text-decoration: none; }
h1,h2,h3,h4{ line-height:1.2; margin: 0 0 .5em; letter-spacing: -0.02em; }
p{ margin: 0 0 1em; color: var(--text-muted); }
::selection{ background: var(--primary); color:#fff; }

/* ---------- Header ---------- */
.site-header{
  position: sticky; top:0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner{ display:flex; align-items:center; justify-content:space-between; height: 64px; }
.brand{ display:flex; align-items:center; gap:8px; font-weight:700; font-size: 18px; }
.brand-mark{
  width: 32px; height:32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800;
}
.main-nav{ display:none; gap: 28px; }
.main-nav a{ color: var(--text-muted); font-size:14px; font-weight:500; }
.main-nav a:hover{ color: var(--text); }
@media (min-width: 900px){ .main-nav{ display:flex; } }
.header-actions{ display:flex; align-items:center; gap:10px; }
.user-chip{ font-size:13px; color: var(--text-muted); display:none; }
@media (min-width:640px){ .user-chip{ display:inline; } }

.icon-btn{
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  width: 36px; height:36px; cursor:pointer; font-size:15px;
}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 11px 20px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor:pointer; transition: all .15s ease;
}
.btn-primary{ background: var(--primary); color:#fff; }
.btn-primary:hover{ background: var(--primary-dark); }
.btn-ghost{ background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover{ background: var(--surface-2); }
.btn-sm{ padding: 7px 14px; font-size: 13px; }
.btn-lg{ padding: 14px 28px; font-size: 15px; border-radius: 12px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- Cards ---------- */
.card{
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
}
.card-soft{ background: var(--surface-2); border-radius: var(--radius); padding: 20px; }

/* ---------- Hero ---------- */
.hero{ padding: 80px 0 60px; text-align:center; }
.hero h1{ font-size: 42px; font-weight: 800; max-width: 720px; margin: 0 auto 16px; }
.hero h1 .accent{ background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip:text; color: transparent; }
.hero p.lead{ font-size: 17px; max-width: 560px; margin: 0 auto 32px; }
.hero-ctas{ display:flex; gap: 12px; justify-content:center; flex-wrap: wrap; }
@media (min-width: 700px){ .hero h1{ font-size: 54px; } }

/* ---------- Sections ---------- */
.section{ padding: 64px 0; }
.section-head{ text-align:center; max-width: 620px; margin: 0 auto 40px; }
.eyebrow{ text-transform: uppercase; font-size: 12px; letter-spacing: .08em; color: var(--primary); font-weight:700; }

.grid{ display:grid; gap: 20px; }
.grid-2{ grid-template-columns: 1fr; }
.grid-3{ grid-template-columns: 1fr; }
.grid-4{ grid-template-columns: repeat(2,1fr); }
@media (min-width: 700px){ .grid-2{ grid-template-columns: 1fr 1fr; } .grid-3{ grid-template-columns: repeat(3,1fr); } }
@media (min-width: 900px){ .grid-4{ grid-template-columns: repeat(4,1fr); } }

.feature-card{ padding: 24px; border-radius: var(--radius); background: var(--surface); border:1px solid var(--border); }
.feature-icon{ width:44px; height:44px; border-radius:12px; background: var(--primary-light); color: var(--primary); display:flex; align-items:center; justify-content:center; font-size:20px; margin-bottom: 14px; }
.feature-card h3{ font-size:16px; }
.feature-card p{ font-size: 14px; margin:0; }

/* ---------- Stats ---------- */
.stat-card{ padding: 20px; border-radius: var(--radius); background: var(--surface); border:1px solid var(--border); }
.stat-value{ font-size: 28px; font-weight: 800; }
.stat-label{ font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Forms ---------- */
.form-group{ margin-bottom: 18px; }
label{ display:block; font-size: 13px; font-weight:600; margin-bottom:6px; color: var(--text); }
.hint{ font-size:12px; color: var(--text-faint); margin-top:4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea{
  width:100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font); font-size: 14px;
}
textarea{ resize: vertical; min-height: 160px; line-height:1.6; }
input:focus, select:focus, textarea:focus{ outline: 2px solid var(--primary); outline-offset: 1px; }
.form-row{ display:grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width:600px){ .form-row-2{ grid-template-columns: 1fr 1fr; } }

.auth-shell{ max-width: 420px; margin: 60px auto; }
.auth-shell .card{ padding: 32px; }

.alert{ padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; }
.alert-error{ background: var(--danger-light); color: var(--danger); }
.alert-success{ background: var(--success-light); color: var(--success); }
.alert-info{ background: var(--primary-light); color: var(--primary); }

/* ---------- Choice tiles (evaluate flow) ---------- */
.choice-grid{ display:grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
@media (min-width:600px){ .choice-grid-4{ grid-template-columns: repeat(4,1fr); } }
.choice-tile{
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 16px;
  cursor:pointer; text-align:center; background: var(--surface); transition: all .15s;
}
.choice-tile:hover{ border-color: var(--primary); }
.choice-tile.selected{ border-color: var(--primary); background: var(--primary-light); }
.choice-tile .ct-title{ font-weight: 700; font-size: 14px; }
.choice-tile .ct-sub{ font-size: 12px; color: var(--text-faint); }

.step-indicator{ display:flex; gap:8px; margin-bottom: 28px; }
.step-dot{ flex:1; height:4px; border-radius: 4px; background: var(--border); }
.step-dot.active{ background: var(--primary); }

/* ---------- Score Hero ---------- */
.score-hero{ text-align:center; padding: 40px 20px; }
.score-ring{ width: 160px; height:160px; margin: 0 auto 20px; position:relative; }
.score-ring svg{ transform: rotate(-90deg); }
.score-ring .ring-bg{ stroke: var(--border); }
.score-ring .ring-fg{ stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 1s ease; }
.score-ring-label{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.score-ring-label .big{ font-size: 30px; font-weight: 800; }
.score-ring-label .small{ font-size: 12px; color: var(--text-faint); }

.badge{ display:inline-flex; align-items:center; gap:6px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight:700; }
.badge-success{ background: var(--success-light); color: var(--success); }
.badge-warning{ background: var(--warning-light); color: var(--warning); }
.badge-info{ background: var(--primary-light); color: var(--primary); }

/* ---------- Criterion rows ---------- */
.criterion{ border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow:hidden; background: var(--surface); }
.criterion-head{ display:flex; align-items:center; justify-content:space-between; padding: 16px 18px; cursor:pointer; }
.criterion-head .label{ font-weight:600; font-size:14px; }
.criterion-score{ font-weight: 800; color: var(--primary); }
.bar-track{ height:6px; background: var(--surface-2); border-radius: 4px; overflow:hidden; margin-top:8px; }
.bar-fill{ height:100%; background: var(--primary); border-radius:4px; }
.criterion-body{ padding: 0 18px 18px; display:none; font-size: 13.5px; }
.criterion-body.open{ display:block; }
.criterion-body .row{ margin-bottom: 10px; }
.criterion-body .row b{ display:block; font-size:12px; color: var(--text-faint); text-transform:uppercase; letter-spacing:.04em; margin-bottom:2px; }

/* ---------- Analysis sections ---------- */
.analysis-grid{ display:grid; grid-template-columns:1fr; gap:16px; }
@media (min-width:800px){ .analysis-grid{ grid-template-columns: 1fr 1fr; } }
.analysis-card{ border-radius: var(--radius); padding:20px; }
.analysis-card.good{ background: var(--success-light); }
.analysis-card.improve{ background: var(--warning-light); }
.analysis-card h4{ font-size:14px; margin-bottom:10px; }
.analysis-card ul{ margin:0; padding-left:18px; font-size:13.5px; }
.analysis-card li{ margin-bottom:6px; }

/* ---------- Corrections ---------- */
.correction{ border:1px solid var(--border); border-radius: var(--radius); padding:16px; margin-bottom:12px; background: var(--surface); }
.correction .tag{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color: var(--primary); }
.correction .orig{ color: var(--danger); text-decoration: line-through; font-size: 13.5px; margin: 8px 0 4px; }
.correction .better{ color: var(--success); font-weight:600; font-size: 13.5px; margin-bottom:6px; }
.correction .explain{ font-size:12.5px; color: var(--text-faint); margin:0; }
.correction-filters{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.filter-pill{ padding:6px 12px; border-radius:999px; border:1px solid var(--border); font-size:12px; cursor:pointer; background: var(--surface); }
.filter-pill.active{ background: var(--primary); color:#fff; border-color: var(--primary); }

/* ---------- Table ---------- */
table{ width:100%; border-collapse: collapse; font-size: 13.5px; }
th{ text-align:left; padding:10px 12px; color: var(--text-faint); font-size:11px; text-transform:uppercase; letter-spacing:.04em; border-bottom:1px solid var(--border); }
td{ padding: 12px; border-bottom: 1px solid var(--border); }
tr:last-child td{ border-bottom:none; }

/* ---------- Loading / AI processing ---------- */
.ai-steps{ display:flex; flex-direction:column; gap:10px; max-width:360px; margin: 24px auto; }
.ai-step{ display:flex; align-items:center; gap:10px; font-size:13.5px; color: var(--text-faint); }
.ai-step.done{ color: var(--success); }
.ai-step.active{ color: var(--primary); font-weight:600; }
.step-icon{ width:20px; text-align:center; }
.spinner{ width:36px;height:36px;border-radius:50%;border:3px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; margin: 0 auto 20px; }
@keyframes spin{ to{ transform: rotate(360deg); } }

/* ---------- Mobile bottom nav ---------- */
.mobile-nav{
  position:fixed; bottom:0; left:0; right:0; z-index:50;
  display:flex; background: var(--surface); border-top:1px solid var(--border);
  padding: 6px 2px calc(env(safe-area-inset-bottom) + 6px);
}
@media (min-width:900px){ .mobile-nav{ display:none; } }
.mnav-item{
  flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:3px; font-size:10.5px; line-height:1.15; color: var(--text-faint); padding:6px 1px;
  border-radius:10px; text-decoration:none; text-align:center;
}
.mnav-item .mnav-icon{ width:21px; height:21px; flex-shrink:0; }
.mnav-item .mnav-label{
  max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
button.mnav-item{ background:none; border:none; font-family:inherit; cursor:pointer; }

/* ---------- Update banner ---------- */
.update-banner{
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border:1px solid var(--border); box-shadow: var(--shadow-lg);
  border-radius: 14px; padding: 12px 16px; display:flex; align-items:center; gap:16px;
  font-size:13.5px; z-index: 60;
}
@media (min-width:900px){ .update-banner{ bottom: 24px; } }
.update-banner.hidden{ display:none; }

/* ---------- Footer ---------- */
.site-footer{ border-top:1px solid var(--border); padding: 28px 0; margin-top: 40px; }
.footer-inner{ display:flex; justify-content:space-between; font-size:12.5px; color: var(--text-faint); flex-wrap:wrap; gap:8px; }

/* ---------- Utility ---------- */
.text-center{ text-align:center; }
.mt-0{margin-top:0;} .mt-1{margin-top:8px;} .mt-2{margin-top:16px;} .mt-3{margin-top:24px;} .mt-4{margin-top:32px;}
.mb-0{margin-bottom:0;} .mb-1{margin-bottom:8px;} .mb-2{margin-bottom:16px;} .mb-3{margin-bottom:24px;}
.muted{ color: var(--text-faint); font-size: 13px; }
.flex{ display:flex; } .items-center{ align-items:center; } .justify-between{ justify-content:space-between; } .gap-2{ gap:8px; } .gap-3{ gap:16px; }
.hidden{ display:none !important; }
.skeleton{ background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer{ 0%{background-position:100% 50%;} 100%{background-position:0 50%;} }

/* ---------- Hard-word Hindi meaning (tap-to-translate) ---------- */
.hard-word{
  border-bottom: 1.5px dotted var(--primary); color: var(--primary); cursor:pointer;
  font-weight:600;
}
.hard-word:hover, .hard-word:focus{ background: var(--primary-light); outline:none; border-radius:3px; }
.hard-word-demo{ border-bottom: 1.5px dotted var(--primary); color: var(--primary); font-weight:600; }

#hard-word-backdrop{
  position:fixed; inset:0; background:rgba(15,15,20,0.45); z-index:118; display:none;
}
#hard-word-backdrop.show{ display:block; }

#hard-word-popup{
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
  z-index:119; width:min(320px, calc(100% - 40px)); background:var(--surface);
  border:1px solid var(--border); border-radius:16px; box-shadow:0 20px 50px rgba(0,0,0,0.3);
  padding:18px 18px 16px; font-size:14px; display:none;
}
#hard-word-popup.show{ display:block; }
#hard-word-popup .hw-en{ font-weight:700; font-size:16px; color:var(--text); margin-bottom:6px; padding-right:24px; }
#hard-word-popup .hw-hi{ color:var(--primary); font-weight:600; font-size:17px; line-height:1.5; min-height:24px; }
#hard-word-popup .hw-hi.hw-loading{ color:var(--text-faint); font-style:italic; font-weight:400; font-size:14px; }
#hard-word-popup .hw-close{
  position:absolute; top:10px; right:10px; background:var(--surface-2); border:none; cursor:pointer;
  color:var(--text-faint); font-size:13px; line-height:1; padding:6px 8px; border-radius:8px;
}
#hard-word-popup .hw-source{ font-size:11px; color:var(--text-faint); margin-top:10px; }
