/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f9fa;
  --surface:   #ffffff;
  --surface2:  #f1f3f4;
  --border:    #dadce0;
  --border2:   #e8eaed;
  --text:      #202124;
  --text2:     #3c4043;
  --muted:     #5f6368;
  --blue:      #1a73e8;
  --blue-lt:   #e8f0fe;
  --green:     #1e8e3e;
  --green-lt:  #e6f4ea;
  --gold:      #f9ab00;
  --gold-lt:   #fef7e0;
  --red:       #d93025;
  --red-lt:    #fce8e6;
  --purple:    #7b5ea7;
  --purple-lt: #f3e8fd;
  --teal:      #007b83;
  --teal-lt:   #e4f7fb;
  --shadow-sm: 0 1px 3px rgba(60,64,67,0.15), 0 1px 2px rgba(60,64,67,0.10);
  --shadow-md: 0 2px 8px rgba(60,64,67,0.18), 0 2px 4px rgba(60,64,67,0.08);
  --shadow-lg: 0 8px 24px rgba(60,64,67,0.18), 0 4px 8px rgba(60,64,67,0.08);
  --radius:    12px;
  --radius-sm: 8px;

  /* ── Animation tokens ── */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* springy overshoot */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);      /* Material smooth     */
  --ease-out:    cubic-bezier(0.0, 0, 0.2, 1);       /* decelerate          */
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);         /* accelerate          */
  --dur-fast:    140ms;
  --dur-med:     240ms;
  --dur-slow:    380ms;

  --hero-bg:     linear-gradient(160deg, #e8f0fe 0%, #ffffff 50%, #e6f4ea 100%);
  --disc-header: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%);
}


/* ── Skeletons ────────────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
  color: transparent !important;
  display: inline-block;
  min-height: 1em;
  min-width: 40px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Scroll Reveal ────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

body { font-family: 'Roboto', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
a { color: var(--blue); }

/* ── Global smooth interactions ──────────────────────────────────────────── */
button, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Press / active scale — applied on all tappable elements */
.press-scale:active { transform: scale(0.96); transition: transform 80ms var(--ease-in); }

/* Ripple container for buttons */
.ripple-host { position: relative; overflow: hidden; }
@keyframes ripple-anim {
  from { transform: scale(0); opacity: 0.35; }
  to   { transform: scale(4); opacity: 0; }
}
.ripple-dot {
  position: absolute; border-radius: 50%;
  width: 80px; height: 80px;
  margin: -40px 0 0 -40px;
  background: rgba(255,255,255,0.55);
  animation: ripple-anim 500ms var(--ease-out) forwards;
  pointer-events: none;
}

/* ── NAV ──────────────────────────────────────────────────────────────────── */
.topnav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 200; }
.topnav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo-icon { font-size: 1.3rem; color: var(--blue); }
.nav-school { font-family: 'Google Sans', 'Roboto', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text); }
.nav-badge { font-size: 0.75rem; background: var(--blue-lt); color: var(--blue); padding: 4px 12px; border-radius: 50px; font-weight: 500; }

/* ── HERO ─────────────────────────────────────────────────────────────────── */
.hero { background: var(--hero-bg); border-bottom: 1px solid var(--border); padding: 56px 24px 48px; text-align: center; }
.hero-inner { max-width: 900px; margin: 0 auto; }
.hero-icon-wrap { width: 72px; height: 72px; background: var(--blue); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; box-shadow: 0 4px 16px rgba(26,115,232,0.3); }
.hero-icon { font-size: 2rem; color: #fff; }
.hero-title { font-family: 'Google Sans', 'Roboto', sans-serif; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.hero-subtitle { color: var(--muted); font-size: 1.05rem; margin: 8px 0 36px; }

.stats-strip { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 130px; box-shadow: var(--shadow-sm); transition: box-shadow var(--dur-med) var(--ease-smooth), transform var(--dur-med) var(--ease-spring); }
.stat-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-3px) scale(1.02); }
.stat-card:active { transform: translateY(0)    scale(0.97); transition-duration: 80ms; }
.stat-icon { font-size: 1.1rem; margin-bottom: 4px; color: var(--muted); }
.stat-icon.green  { color: var(--green); }
.stat-icon.blue   { color: var(--blue);  }
.stat-icon.gold   { color: var(--gold);  }
.stat-icon.purple { color: var(--purple);}
.stat-num { font-family: 'Google Sans', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── SEARCH ───────────────────────────────────────────────────────────────── */
.search-section { padding: 32px 24px 16px; }
.search-wrap { max-width: 640px; margin: 0 auto; position: relative; }
.search-box { display: flex; align-items: center; background: #ffffff; border: 1px solid #dfe1e5; border-radius: 24px; padding: 0 20px; gap: 12px; height: 48px; transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out; }
.search-box:focus-within, .search-box:hover { box-shadow: 0 1px 6px rgba(32,33,36,0.28); border-color: rgba(223,225,229,0); }
.search-icon { color: #9aa0a6; font-size: 1.1rem; }
#searchInput { flex: 1; background: none; border: none; outline: none; color: #202124; font-size: 1rem; padding: 12px 0; font-family: 'Roboto', sans-serif; }
#searchInput::placeholder { color: var(--muted); }
.clear-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; width: 28px; height: 28px; border-radius: 50%; display: none; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; }
.clear-btn:hover { background: var(--surface2); color: var(--text); }
.search-hint { font-size: 0.75rem; color: var(--muted); margin: 8px 20px 0; display: flex; align-items: center; gap: 6px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; z-index: 300; box-shadow: var(--shadow-lg); display: none; max-height: 420px; overflow-y: auto; }
.search-results.visible { display: block; }
.sr-item { padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 14px; transition: background 0.12s; border-bottom: 1px solid var(--border2); }
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: var(--blue-lt); }
.sr-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.82rem; flex-shrink: 0; }
.sr-info { flex: 1; }
.sr-name { font-weight: 500; font-size: 0.95rem; color: var(--text); }
.sr-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.sr-pct { font-family: 'Google Sans', sans-serif; font-weight: 700; font-size: 1rem; }
.no-results { padding: 20px; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ── MAIN ─────────────────────────────────────────────────────────────────── */
.main-content { max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; }

/* ── TABS ─────────────────────────────────────────────────────────────────── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 32px; flex-wrap: wrap; border-bottom: 2px solid var(--border2); padding-bottom: 0; }
.tab-btn { background: none; border: none; color: var(--muted); padding: 10px 20px; cursor: pointer; font-family: 'Roboto', sans-serif; font-size: 0.88rem; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px; border-radius: 4px 4px 0 0; transition: color var(--dur-fast) var(--ease-smooth), background var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth); display: flex; align-items: center; gap: 7px; }
.tab-btn:hover  { background: var(--blue-lt); color: var(--blue); }
.tab-btn:active { transform: scale(0.97); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: slideUp var(--dur-slow) var(--ease-spring); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── SECTION HEADER ───────────────────────────────────────────────────────── */
.section-header { margin-bottom: 24px; }
.section-header h2 { font-family: 'Google Sans', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.section-header h2 i { color: var(--blue); font-size: 1.1rem; }
.section-header p { color: var(--muted); margin-top: 6px; font-size: 0.9rem; }
.info-banner { margin-top: 12px; background: var(--blue-lt); border: 1px solid #c5d9f7; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.82rem; color: #1558b0; display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.info-banner i { margin-top: 2px; flex-shrink: 0; }

/* ── TOPPER CARDS ─────────────────────────────────────────────────────────── */
.toppers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.topper-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: box-shadow var(--dur-med) var(--ease-smooth), transform var(--dur-med) var(--ease-spring), border-color var(--dur-med) var(--ease-smooth); position: relative; }
.topper-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: #c5d9f7; }
.topper-card:active { transform: translateY(0) scale(0.98); transition-duration: 80ms; }
.topper-card.rank-1 { border-top: 3px solid var(--gold); }
.topper-card.rank-2 { border-top: 3px solid #9aa0a6; }
.topper-card.rank-3 { border-top: 3px solid #c77b30; }
.card-rank-badge { position: absolute; top: 14px; right: 14px; font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 50px; }
.rank-1 .card-rank-badge { background: var(--gold-lt); color: #b06f00; }
.rank-2 .card-rank-badge { background: var(--surface2); color: var(--muted); }
.rank-3 .card-rank-badge { background: #fbe9d0; color: #c77b30; }
.card-rank-default .card-rank-badge { background: var(--surface2); color: var(--muted); }
.card-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; margin-bottom: 12px; }
.card-name { font-weight: 600; font-size: 0.97rem; color: var(--text); margin-bottom: 2px; }
.card-roll { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; font-family: 'Roboto Mono', monospace; display: flex; align-items: center; gap: 5px; }
.card-stream-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; padding: 3px 10px; border-radius: 50px; margin-bottom: 14px; font-weight: 500; }
.card-pct { font-family: 'Google Sans', sans-serif; font-size: 2rem; font-weight: 700; line-height: 1; }
.card-pct small { font-size: 0.9rem; font-weight: 400; color: var(--muted); }
.card-marks { font-size: 0.75rem; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.pct-bar-bg { height: 4px; background: var(--border2); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.pct-bar { height: 100%; border-radius: 2px; }

/* ── STREAM TOPPERS ───────────────────────────────────────────────────────── */
.stream-section { margin-bottom: 40px; }
.stream-title-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border2); }
.stream-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.stream-title { font-family: 'Google Sans', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.stream-best { font-size: 0.78rem; color: var(--muted); margin-left: auto; background: var(--surface2); padding: 3px 10px; border-radius: 50px; }
.stream-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); gap: 14px; }

/* ── BOTTOM GRID ──────────────────────────────────────────────────────────── */
.bottom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.bottom-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #f28b82; border-radius: var(--radius); padding: 20px; cursor: pointer; transition: box-shadow var(--dur-med) var(--ease-smooth), transform var(--dur-med) var(--ease-spring); }
.bottom-card:hover  { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.bottom-card:active { transform: scale(0.98); transition-duration: 80ms; }

/* ── STATS ────────────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-bottom: 36px; }
.subject-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: box-shadow 0.2s; }
.subject-card:hover { box-shadow: var(--shadow-sm); }
.subj-name { font-weight: 500; font-size: 0.88rem; color: var(--text2); margin-bottom: 10px; }
.subj-avg { font-family: 'Google Sans', sans-serif; font-size: 1.8rem; font-weight: 700; color: var(--blue); }
.subj-avg small { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.subj-bar-bg { background: var(--border2); border-radius: 4px; height: 6px; margin: 10px 0 8px; overflow: hidden; }
.subj-bar { height: 100%; border-radius: 4px; }
.subj-meta { font-size: 0.75rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.subj-meta span { display: flex; align-items: center; gap: 4px; }

.dist-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 640px) { .dist-grid { grid-template-columns: 1fr; } }
.dist-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.dist-title { font-family: 'Google Sans', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.dist-bars { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; }
.dist-label { width: 72px; text-align: right; color: var(--muted); font-size: 0.75rem; flex-shrink: 0; }
.dist-bar-bg { flex: 1; background: var(--border2); border-radius: 4px; height: 22px; overflow: hidden; }
.dist-bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 8px; font-size: 0.72rem; font-weight: 600; color: #fff; min-width: 28px; transition: width 0.8s ease; }
.dist-val { width: 32px; color: var(--muted); font-size: 0.75rem; }

/* ── MODAL ────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(6px); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; padding: 0; opacity: 0; pointer-events: none; transition: opacity var(--dur-med) var(--ease-smooth); }
.modal-overlay.open { opacity: 1; pointer-events: all; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* Card: flex column, fills most of screen height, never overflows */
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  max-width: 580px;
  width: 100%;
  max-height: 92dvh;
  height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* card itself never scrolls */
  position: relative;
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-spring);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.14);
}
.modal-overlay.open .modal-card { transform: translateY(0); }

/* Close button: always visible, floats over the banner */
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.85); backdrop-filter: blur(4px); border: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast) var(--ease-spring); }
.modal-close:hover  { background: #fff; color: var(--text); }
.modal-close:active { transform: scale(0.88) rotate(90deg); }

/* MODAL CONTENT */
#modalContent { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.m-top-banner { background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%); padding: 22px 20px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.m-body { padding: 16px 16px 20px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.m-header { display: flex; align-items: center; gap: 18px; }
.m-avatar { width: 72px; height: 72px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.5rem; flex-shrink: 0; box-shadow: 0 4px 12px rgba(0,0,0,0.08); border: 2px solid #fff; }
.m-name { font-family: 'Google Sans', sans-serif; font-size: 1.45rem; font-weight: 700; color: var(--text); letter-spacing: -0.3px; line-height: 1.2; }
.m-roll { font-size: 0.8rem; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.m-parent { font-size: 0.8rem; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.m-stream-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; padding: 4px 12px; border-radius: 50px; font-weight: 600; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.m-score-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.m-score-box { background: var(--surface); border: 1px solid var(--border2); border-radius: 12px; padding: 10px 8px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.03); transition: transform 0.2s, box-shadow 0.2s; }
.m-score-box:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.m-score-val { font-family: 'Google Sans', sans-serif; font-size: 1.35rem; font-weight: 700; line-height: 1; }
.m-score-lbl { font-size: 0.62rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.m-achievement { font-size: 0.88rem; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--blue-lt); color: #1558b0; margin-bottom: 18px; text-align: center; font-weight: 500; border: 1px solid #c5d9f7; }
.m-compartment-warn { background: var(--gold-lt); border: 1px solid #f9c84088; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.82rem; color: #b06f00; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; }
.m-subjects-title { font-family: 'Google Sans', sans-serif; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* ── Swipe Handle ── */
.swipe-handle { width: 36px; height: 4px; background: #dadce0; border-radius: 99px; margin: 0 auto; flex-shrink: 0; padding: 14px 30px; background-clip: content-box; cursor: grab; touch-action: none; }

/* ── Rank Badges ── */
.m-rank-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.m-rank-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 50px; font-family: 'Google Sans', sans-serif; font-size: 0.8rem; font-weight: 700; }
.rank-overall { background: #e8f0fe; color: #1a73e8; }
.rank-stream  { background: #e6f4ea; color: #1e8e3e; }
.rank-pct     { background: #fce8e6; color: #d93025; }
.rank-icon    { font-size: 0.75rem; opacity: 0.8; }
.rank-sub     { font-weight: 400; opacity: 0.75; font-size: 0.72rem; }

/* ── Subject Topper Badge ── */
.m-subj-topper-badge { display: inline-flex; align-items: center; gap: 4px; background: #fff8e1; color: #e37400; font-family: 'Google Sans', sans-serif; font-size: 0.62rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; border: 1px solid #f9c84055; }
.m-subject-card.is-topper { border-color: #f9ab00; background: #fffbf0; }

/* ── Class Avg Marker ── */
.m-avg-marker { position: absolute; top: -3px; width: 2px; height: calc(100% + 6px); background: rgba(0,0,0,0.35); border-radius: 2px; transform: translateX(-50%); pointer-events: none; }
.m-avg-marker::after { content: '⌀'; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 9px; color: rgba(0,0,0,0.45); white-space: nowrap; }

/* ── Toast ── */
.toast { font-family: 'Google Sans', sans-serif; font-size: 0.85rem; font-weight: 500; padding: 10px 20px; border-radius: 50px; box-shadow: 0 4px 16px rgba(0,0,0,0.14); opacity: 0; transform: translateY(12px); transition: opacity 0.25s, transform 0.25s; white-space: nowrap; }
.toast-show { opacity: 1; transform: translateY(0); }
.toast-info  { background: #202124; color: #fff; }
.toast-warn  { background: #f9ab00; color: #202124; }
.toast-error { background: #d93025; color: #fff; }

/* ── Recent Searches ── */
.recent-searches { padding: 8px 0 4px; }
.recent-label { font-family: 'Google Sans', sans-serif; font-size: 0.68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 0 16px 6px; }
.recent-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; transition: background 0.15s; }
.recent-item:hover { background: var(--surface2); }
.recent-item i { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; }
.recent-item span { font-size: 0.88rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.m-subject-card { background: #fafafa; border: 1px solid #e8eaed; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.m-subj-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.m-subj-name { font-family: 'Google Sans', sans-serif; font-size: 0.82rem; color: #202124; font-weight: 600; line-height: 1.3; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-subj-grade { font-family: 'Google Sans', sans-serif; font-size: 0.65rem; font-weight: 700; color: #fff; padding: 2px 7px; border-radius: 20px; flex-shrink: 0; letter-spacing: 0.03em; }
.m-subj-grade.g-a1 { background: #137333; }
.m-subj-grade.g-a2 { background: #1e8e3e; }
.m-subj-grade.g-b1 { background: #188038; }
.m-subj-grade.g-b2 { background: #0d652d; }
.m-subj-grade.g-c1 { background: #e37400; }
.m-subj-grade.g-c2 { background: #b06000; }
.m-subj-grade.g-d1 { background: #c5221f; }
.m-subj-grade.g-d2 { background: #a50e0e; }
.m-subj-grade.g-e  { background: #696969; }
.m-subj-grade.g-def { background: #5f6368; }

/* Stats pill row */
.m-subj-stats-row { display: flex; align-items: stretch; gap: 5px; }
.m-stat { display: flex; flex-direction: column; align-items: center; padding: 4px 8px; border-radius: 7px; min-width: 40px; flex: 1; }
.m-stat .lbl { font-family: 'Google Sans', sans-serif; font-size: 0.55rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1px; }
.m-stat .val { font-family: 'Google Sans', sans-serif; font-size: 0.9rem; font-weight: 700; line-height: 1; }
.m-stat.th  { background: #e8f0fe; } .m-stat.th  .lbl { color: #1a73e8; } .m-stat.th  .val { color: #1a73e8; }
.m-stat.pr  { background: #e6f4ea; } .m-stat.pr  .lbl { color: #1e8e3e; } .m-stat.pr  .val { color: #1e8e3e; }
.m-stat.tot { background: #fce8e6; } .m-stat.tot .lbl { color: #d93025; } .m-stat.tot .val { color: #d93025; font-size: 1.05rem; }

/* Proportional split bar */
.m-bar-legend { display: flex; justify-content: space-between; font-family: 'Google Sans', sans-serif; font-size: 0.6rem; font-weight: 600; margin-bottom: 3px; }
.m-bar-legend .th-lbl { color: #1a73e8; }
.m-bar-legend .pr-lbl { color: #1e8e3e; }
.m-subj-bar-wrap { background: #e8eaed; border-radius: 99px; height: 10px; display: flex; overflow: hidden; width: 100%; }
.m-subj-bar-th  { background: linear-gradient(90deg, #4285F4, #1a73e8); height: 100%; transition: width 1.1s cubic-bezier(0.34, 1.3, 0.64, 1); }
.m-subj-bar-gap { background: transparent; width: 2px; flex-shrink: 0; }
.m-subj-bar-pr  { background: linear-gradient(90deg, #34A853, #1e8e3e); height: 100%; transition: width 1.1s cubic-bezier(0.34, 1.3, 0.64, 1); }
.m-subj-bar-tot { height: 100%; border-radius: 99px; transition: width 1.1s cubic-bezier(0.34, 1.3, 0.64, 1); }
.m-privacy-note { font-size: 0.72rem; color: var(--muted); margin-top: 16px; display: flex; align-items: center; gap: 5px; border-top: 1px solid var(--border2); padding-top: 12px; }

/* STATUS COLORS */
.status-pass   { color: var(--green);  }
.status-comp   { color: #d18b13;        }
.status-fail   { color: var(--red);    }

/* SHARE BUTTON */
.m-share-btn {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  margin-left: auto;
}
.m-share-btn:hover { background: #f8f9fa; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.m-share-btn:active { transform: scale(0.95); }

/* AVATAR PALETTE */
.av-blue    { background: var(--blue-lt);   color: var(--blue);   }
.av-green   { background: var(--green-lt);  color: var(--green);  }
.av-gold    { background: var(--gold-lt);   color: #b06f00;       }
.av-purple  { background: var(--purple-lt); color: var(--purple); }
.av-teal    { background: var(--teal-lt);   color: var(--teal);   }
.av-red     { background: var(--red-lt);    color: var(--red);    }

/* STREAM TAGS */
.tag-pcm       { background: var(--blue-lt);   color: var(--blue);   }
.tag-pcb       { background: var(--green-lt);  color: var(--green);  }
.tag-pcmb      { background: #fce8e6;          color: #c5221f;       }
.tag-commerce  { background: var(--gold-lt);   color: #b06f00;       }
.tag-humanities{ background: var(--purple-lt); color: var(--purple); }
.tag-other     { background: var(--surface2);  color: var(--muted);  }

/* BAR COLORS by performance */
.bar-ex  { background: #1e8e3e; }
.bar-vg  { background: var(--blue); }
.bar-gd  { background: var(--teal); }
.bar-ok  { background: var(--gold); }
.bar-lo  { background: var(--red);  }

/* ── FOOTER ───────────────────────────────────────────────────────────────── */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); text-align: center; padding: 28px 20px; color: var(--muted); font-size: 0.82rem; }
.site-footer p { display: flex; align-items: center; justify-content: center; gap: 6px; }
.footer-note { margin-top: 6px; font-size: 0.75rem; opacity: 0.75; }

/* ── DISCLAIMER OVERLAY ───────────────────────────────────────────────────── */
.disclaimer-overlay { position: fixed; inset: 0; background: rgba(32,33,36,0.72); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.disclaimer-overlay.hidden { display: none; }

.disclaimer-box {
  background: var(--surface);
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.1);
  overflow: hidden; /* clip gradient header */
}

/* Gradient header band */
.disc-header {
  background: var(--disc-header);
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.disc-header-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.18);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  flex-shrink: 0;
}
.disc-header-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.disc-title {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Body area */
.disc-intro {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.65;
  padding: 20px 24px 0;
}

/* Info rows */
.disc-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 20px;
}
.disc-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  border-radius: 12px;
  transition: background 0.15s;
}
.disc-row:hover { background: var(--surface2); }
.disc-row-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.disc-row-icon.blue   { background: var(--blue-lt);   color: var(--blue);   }
.disc-row-icon.green  { background: var(--green-lt);  color: var(--green);  }
.disc-row-icon.gold   { background: var(--gold-lt);   color: #b06f00;       }
.disc-row-icon.red    { background: var(--red-lt);    color: var(--red);    }
.disc-row-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  line-height: 1.55;
}
.disc-row-text strong { color: var(--text); font-weight: 600; }
.disc-row-text span   { color: var(--muted); }
.disc-row-text a      { color: var(--blue); }

/* Legal note */
.disc-legal {
  margin: 4px 20px 16px;
  background: #fef7e0;
  border: 1px solid #f9c84066;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.8rem;
  color: #7a5200;
  line-height: 1.6;
}
.disc-legal i { color: #b06f00; margin-top: 2px; flex-shrink: 0; font-size: 0.95rem; }

/* Close button */
.disc-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: calc(100% - 40px);
  margin: 0 20px 12px;
  padding: 14px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.97rem;
  font-weight: 600;
  font-family: 'Roboto', sans-serif;
  cursor: pointer;
  transition: background var(--dur-med) var(--ease-smooth),
              box-shadow var(--dur-med) var(--ease-smooth),
              transform var(--dur-fast) var(--ease-spring);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.disc-close-btn:hover  { background: #1558b0; box-shadow: 0 6px 20px rgba(26,115,232,0.4); }
.disc-close-btn:active { transform: scale(0.96); background: #0f4494; }

.disc-footer {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Disclaimer nav button */
.disc-link-btn { background: var(--gold-lt); border: 1px solid #f9c840aa; color: #7a5200; font-size: 0.75rem; font-weight: 600; padding: 5px 12px; border-radius: 50px; cursor: pointer; display: flex; align-items: center; gap: 5px; font-family: 'Roboto', sans-serif; transition: background 0.15s; }
.disc-link-btn:hover { background: #fde68a; }



/* ── REQUEST FORM TAB ─────────────────────────────────────────────────────── */
.request-disclaimer { background: var(--gold-lt); border: 1px solid #f9c840aa; border-radius: var(--radius-sm); padding: 14px 16px; font-size: 0.83rem; color: #7a5200; line-height: 1.6; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 28px; }
.request-disclaimer i { font-size: 1.1rem; margin-top: 2px; flex-shrink: 0; color: #b06f00; }
.request-disclaimer a { color: #7a5200; font-weight: 600; }
.request-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.82rem; font-weight: 500; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.form-label i { color: var(--blue); font-size: 0.8rem; }
.req { color: var(--red); }
.form-input { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem; font-family: 'Roboto', sans-serif; color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-consent { display: flex; gap: 12px; align-items: flex-start; margin: 20px 0 24px; font-size: 0.82rem; color: var(--text2); line-height: 1.55; background: var(--surface2); border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--border); }
.form-consent input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; accent-color: var(--blue); cursor: pointer; }
.form-submit-btn { background: var(--blue); color: #fff; border: none; border-radius: 50px; padding: 13px 32px; font-size: 0.95rem; font-weight: 600; font-family: 'Roboto', sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: background 0.2s, box-shadow 0.2s; }
.form-submit-btn:hover { background: #1558b0; box-shadow: 0 4px 16px rgba(26,115,232,0.3); }
.form-submit-btn:disabled { background: var(--border); color: var(--muted); cursor: not-allowed; box-shadow: none; }
.form-note { font-size: 0.78rem; color: var(--muted); margin-top: 14px; display: flex; align-items: center; gap: 6px; }
.request-success { background: var(--green-lt); border: 1px solid #1e8e3e44; border-radius: var(--radius); padding: 36px 24px; text-align: center; margin-top: 24px; }
.request-success i { font-size: 2.5rem; color: var(--green); margin-bottom: 12px; display: block; }
.request-success h3 { font-family: 'Google Sans', sans-serif; font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.request-success p { font-size: 0.88rem; color: var(--muted); }
.footer-disc-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 0.78rem; text-decoration: underline; padding: 0; font-family: 'Roboto', sans-serif; }

/* ── VIEW COUNTER ─────────────────────────────────────────────────────────── */
.view-counter { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,0.7); border: 1px solid var(--border); border-radius: 50px; padding: 6px 16px; font-size: 0.82rem; color: var(--muted); margin: 0 auto 24px; backdrop-filter: blur(4px); }
.view-counter i { color: var(--blue); }

/* ── CONTACT SECTION ─────────────────────────────────────────────────────── */
.contact-disclaimer { background: var(--gold-lt); border: 1px solid #f9c840aa; border-radius: var(--radius-sm); padding: 12px 16px; font-size: 0.83rem; color: #7a5200; line-height: 1.6; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 24px; }
.contact-disclaimer i { font-size: 1rem; margin-top: 2px; flex-shrink: 0; color: #b06f00; }
.contact-disclaimer a { color: #7a5200; font-weight: 600; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 28px; }
.contact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: box-shadow 0.2s, transform 0.2s; }
.contact-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.contact-card-icon { width: 44px; height: 44px; background: var(--blue-lt); color: var(--blue); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; margin-bottom: 12px; }
.contact-card-title { font-family: 'Google Sans', sans-serif; font-weight: 700; font-size: 0.97rem; color: var(--text); margin-bottom: 6px; }
.contact-card-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.55; }
.contact-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.contact-form-title { font-family: 'Google Sans', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.contact-form-title i { color: var(--blue); }

/* ── SCROLLBAR ────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bdc1c6; }

/* ── RESPONSIVE — tablet ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .toppers-grid, .stream-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .stats-grid                  { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .dist-grid                   { grid-template-columns: 1fr; }
  .m-subj-name                 { width: 130px; }
}

/* ── RESPONSIVE — mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Nav */
  .topnav-inner    { padding: 0 16px; height: 52px; }
  .nav-school      { font-size: 0.88rem; }
  .nav-badge       { display: none; }
  .disc-link-btn   { font-size: 0.7rem; padding: 4px 10px; }

  /* Hero */
  .hero            { padding: 36px 16px 32px; }
  .hero-icon-wrap  { width: 58px; height: 58px; border-radius: 16px; }
  .hero-icon       { font-size: 1.6rem; }
  .hero-title      { font-size: 1.55rem; letter-spacing: -0.3px; }
  .hero-subtitle   { font-size: 0.88rem; margin-bottom: 24px; }
  .stats-strip     { gap: 8px; }
  .stat-card       { padding: 12px 14px; min-width: 80px; flex: 1 1 80px; }
  .stat-num        { font-size: 1.2rem; }
  .stat-icon       { font-size: 0.95rem; }
  .stat-label      { font-size: 0.65rem; }

  /* Search */
  .search-section  { padding: 20px 12px 10px; }
  #searchInput     { font-size: 0.92rem; padding: 12px 0; }
  .search-results  { max-height: 320px; }
  .sr-item         { padding: 10px 14px; }
  .sr-avatar       { width: 34px; height: 34px; font-size: 0.72rem; }
  .sr-name         { font-size: 0.88rem; }
  .sr-pct          { font-size: 0.88rem; }

  /* Tabs */
  .main-content    { padding: 20px 12px 60px; }
  .tab-bar         { gap: 2px; margin-bottom: 20px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn         { padding: 8px 14px; font-size: 0.78rem; white-space: nowrap; flex-shrink: 0; }
  .section-header h2 { font-size: 1.15rem; }

  /* Topper cards */
  .toppers-grid, .stream-list, .bottom-grid, .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .topper-card, .bottom-card { padding: 16px; }
  .card-pct        { font-size: 1.7rem; }

  /* Modal — bottom sheet on mobile, already handled globally */
  .modal-card      { height: 92dvh; max-height: 92dvh; }
  .m-header        { gap: 12px; }
  .m-avatar        { width: 52px; height: 52px; font-size: 1.1rem; border-radius: 12px; }
  .m-name          { font-size: 1.1rem; }
  .m-score-row     { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .m-score-val     { font-size: 1.2rem; }
  .m-subj-marks    { font-size: 0.75rem; }

  /* Disclaimer */
  .disclaimer-box  { border-radius: 20px; max-height: 95vh; overflow-y: auto; }
  .disc-header     { padding: 22px 18px 18px; }
  .disc-header-icon{ width: 42px; height: 42px; font-size: 1.2rem; }
  .disc-title      { font-size: 1.15rem; }
  .disc-intro      { padding: 16px 16px 0; font-size: 0.83rem; }
  .disc-rows       { padding: 12px 12px; }
  .disc-row        { padding: 10px; gap: 10px; }
  .disc-row-icon   { width: 32px; height: 32px; font-size: 0.85rem; }
  .disc-legal      { margin: 4px 12px 12px; font-size: 0.76rem; }
  .disc-close-btn  { width: calc(100% - 24px); margin: 0 12px 10px; padding: 13px; }
  .disc-footer     { padding: 0 12px 14px; font-size: 0.67rem; }


  /* Form */
  .request-form-card { padding: 18px 14px; }
  .form-grid       { grid-template-columns: 1fr; gap: 14px; }
  .form-submit-btn { width: 100%; justify-content: center; }

  /* Stats dist */
  .dist-grid       { grid-template-columns: 1fr; gap: 16px; }
  .dist-label      { width: 56px; font-size: 0.7rem; }
}
