:root {
  --bg: #f7fbff;
  --ink: #101828;
  --muted: #667085;
  --line: rgba(15, 23, 42, 0.1);
  --glass: rgba(255, 255, 255, 0.72);
  --blue: #2563eb;
  --cyan: #06b6d4;
  --violet: #7c3aed;
  --rose: #f43f5e;
  --green: #10b981;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: #ffffff;
}

#particleCanvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.58; }
.orb { position: fixed; border-radius: 999px; filter: blur(24px); opacity: 0.5; z-index: 0; }
.orb-a { width: 260px; height: 260px; background: #bae6fd; left: 6%; top: 18%; }
.orb-b { width: 320px; height: 320px; background: #ddd6fe; right: 7%; bottom: 8%; }
.app-shell { position: relative; z-index: 1; width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.glass-card { background: var(--glass); border: 1px solid rgba(255,255,255,0.82); border-radius: 28px; box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.hero { display: flex; justify-content: space-between; gap: 28px; align-items: center; padding: 34px; overflow: hidden; background: linear-gradient(135deg, rgba(254, 249, 195, .92), rgba(254, 243, 199, .82)); color: var(--ink); }
.brand-title { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand-logo { width: clamp(72px, 9vw, 116px); height: clamp(72px, 9vw, 116px); object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 14px 24px rgba(0,0,0,.22)); }
h1 { margin: 0; font-size: clamp(26px, 3.8vw, 46px); line-height: 1.02; letter-spacing: -0.045em; text-transform: uppercase; background: linear-gradient(135deg, #4c1d95, #7c3aed, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-subtitle { margin: 10px 0 0; color: #4c1d95; font-size: clamp(11px, 1.3vw, 14px); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
button, a { font: inherit; }
.primary-btn, .ghost-btn, .tab-btn, .close-btn { border: 0; cursor: pointer; text-decoration: none; border-radius: 999px; font-weight: 800; }
.primary-btn { color: white; padding: 14px 20px; background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 18px 35px rgba(37,99,235,.25); }
.ghost-btn { color: var(--ink); padding: 14px 20px; background: rgba(255,255,255,.78); border: 1px solid var(--line); }
.primary-btn, .ghost-btn, .tab-btn, .close-btn, .clickable-card, tr[data-card-type], tr[data-student-detail], tbody tr[data-id] { position: relative; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease; }
.primary-btn, .ghost-btn, .close-btn, .clickable-card, tr[data-card-type], tr[data-student-detail], tbody tr[data-id] {
  animation: greenGlow 1.9s ease-in-out infinite;
}
.primary-btn:hover, .ghost-btn:hover, .tab-btn:hover, .close-btn:hover, .clickable-card:hover, tr[data-card-type]:hover, tr[data-student-detail]:hover, tbody tr[data-id]:hover,
.primary-btn:focus-visible, .ghost-btn:focus-visible, .tab-btn:focus-visible, .close-btn:focus-visible, .clickable-card:focus-visible, tr[data-card-type]:focus-visible, tr[data-student-detail]:focus-visible, tbody tr[data-id]:focus-visible {
  box-shadow: 0 0 0 4px rgba(16, 185, 129, .18), 0 18px 46px rgba(16, 185, 129, .28);
  border-color: rgba(16, 185, 129, .46);
  outline: none;
}
.primary-btn:hover, .ghost-btn:hover, .tab-btn:hover, .close-btn:hover, .clickable-card:hover { transform: translateY(-2px); }
.status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-top: 18px; }
.card-grid, .insight-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 18px; }
.metric-card { padding: 22px; }
.metric-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.metric-card span, .input-wrap label { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.metric-card .metric-icon { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 16px; color: white; font-size: 20px; font-weight: 900; box-shadow: 0 14px 30px rgba(15, 23, 42, .12); }
.icon-blue { background: linear-gradient(135deg, #2563eb, #38bdf8); }
.icon-purple { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.icon-cyan { background: linear-gradient(135deg, #0891b2, #67e8f9); }
.icon-green { background: linear-gradient(135deg, #059669, #34d399); }
.icon-red { background: linear-gradient(135deg, #dc2626, #fb7185); }
.metric-card strong { display: block; margin: 10px 0 6px; font-size: 34px; letter-spacing: -0.04em; }
.metric-card small { color: var(--muted); }
.control-panel { display: grid; grid-template-columns: 2fr repeat(5, 1fr) auto; gap: 14px; margin-top: 18px; padding: 18px; background: linear-gradient(135deg, rgba(254, 249, 195, .9), rgba(255, 251, 235, .82)); color: var(--ink); }
.control-panel .input-wrap label { color: var(--muted); }
.input-wrap input, .input-wrap select { width: 100%; margin-top: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.84); border-radius: 18px; padding: 14px 15px; outline: none; color: var(--ink); }
.reset-wrap .ghost-btn { width: 100%; min-width: 104px; }
.tabs { display: flex; gap: 10px; margin-top: 18px; padding: 10px; overflow-x: auto; background: linear-gradient(135deg, rgba(254, 249, 195, .9), rgba(255, 251, 235, .82)); color: var(--ink); }
.tab-btn { padding: 13px 18px; background: transparent; color: var(--muted); white-space: nowrap; }
.tab-btn.active { color: white; background: linear-gradient(135deg, var(--blue), var(--cyan)); }
.tab-panel { display: none; margin-top: 22px; }
.tab-panel.active { display: block; }
.section-head { display: flex; justify-content: space-between; margin-bottom: 16px; }
h2, h3 { margin: 0; letter-spacing: -0.04em; }
.section-head p { color: var(--muted); margin: 8px 0 0; }
.summary-card { padding: 22px; position: relative; overflow: hidden; }
.summary-card:before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--blue), var(--cyan), var(--violet)); }
.summary-card .big { font-size: 30px; font-weight: 900; margin: 10px 0; }
.summary-card p { color: var(--muted); margin: 0; }
.summary-card .big { background: linear-gradient(135deg, #4c1d95, #7c3aed, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.clickable-card { cursor: pointer; }
.clickable-card:hover { transform: translateY(-3px); }
.table-card { padding: 22px; margin-top: 18px; }
.table-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.page-info { color: var(--muted); font-weight: 800; font-size: 13px; }
.table-scroll { overflow: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { cursor: pointer; transition: .2s ease; }
tbody tr:hover { background: rgba(16,185,129,.08); }
tr[data-card-type], tr[data-student-detail] { cursor: pointer; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; font-weight: 800; font-size: 12px; }
.pass { color: #047857; background: rgba(16,185,129,.13); }
.fail { color: #be123c; background: rgba(244,63,94,.13); }
.rank-list { display: grid; gap: 12px; margin-top: 14px; }
.rank-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 15px; border-radius: 20px; background: rgba(255,255,255,.65); border: 1px solid var(--line); }
.rank-item strong { display: block; }
.rank-item span { color: var(--muted); font-size: 13px; }
.progress { height: 9px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--rose), var(--violet)); border-radius: 99px; }
.split-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.student-progress-layout { grid-template-columns: minmax(320px, .8fr) minmax(0, 1.4fr); }
.progress-status { margin-top: 0; color: #4c1d95; font-weight: 800; background: rgba(254,249,195,.78); }
.selected-item { border-color: rgba(124, 58, 237, .48); background: rgba(237, 233, 254, .72); }
.muted-text { color: var(--muted); margin: 6px 0 0; }
.student-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.student-summary-grid div { padding: 15px; border-radius: 18px; background: rgba(255,255,255,.72); border: 1px solid var(--line); }
.student-summary-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.student-summary-grid strong { display: block; margin-top: 6px; font-size: 22px; }
.line-chart { margin: 18px 0; padding: 16px; border-radius: 22px; background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(245,243,255,.78)); border: 1px solid var(--line); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.74); border: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 900; }
.chart-legend-item i { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.line-chart svg { width: 100%; height: auto; display: block; }
.chart-axis { stroke: rgba(100,116,139,.28); stroke-width: 2; }
.chart-line { fill: none; stroke: #7c3aed; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 8px 14px rgba(124,58,237,.25)); }
.chart-point { fill: #10b981; stroke: white; stroke-width: 3; }
.chart-label { fill: #4c1d95; font-size: 14px; font-weight: 900; }
.chart-index { fill: var(--muted); font-size: 12px; font-weight: 800; }
.chart-note, .chart-empty { color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 8px; }
.drawer { position: fixed; inset: 0; z-index: 10; display: none; background: rgba(15,23,42,.25); padding: 24px; justify-content: center; align-items: center; }
.drawer.open { display: flex; }
.drawer-panel { width: min(1180px, 96vw); max-height: 90vh; padding: 30px; overflow: auto; }
#studentDrawer { z-index: 30; }
#studentDrawer .drawer-panel { width: min(1280px, 96vw); }
#detailDrawer { z-index: 20; }
.close-btn { float: right; padding: 10px 14px; background: rgba(15,23,42,.08); }
.answer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px; }
.answer-cell { padding: 10px; border-radius: 14px; background: white; border: 1px solid var(--line); font-size: 12px; }
.answer-cell.ok { border-color: rgba(16,185,129,.4); background: rgba(16,185,129,.09); }
.answer-cell.bad { border-color: rgba(244,63,94,.35); background: rgba(244,63,94,.08); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(90px); z-index: 20; padding: 13px 18px; border-radius: 999px; background: #0f172a; color: white; box-shadow: var(--shadow); transition: .3s ease; }
.toast.show { transform: translateX(-50%) translateY(0); }
.pagination { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.pagination button:disabled { opacity: .42; cursor: not-allowed; animation: none; box-shadow: none; }

@keyframes greenGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .14), 0 12px 34px rgba(16, 185, 129, .12); }
  50% { box-shadow: 0 0 0 5px rgba(16, 185, 129, .2), 0 20px 52px rgba(16, 185, 129, .32); }
}

@media (max-width: 980px) {
  .hero, .section-head { flex-direction: column; align-items: flex-start; }
  .status-grid, .card-grid, .insight-grid, .control-panel, .split-layout { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .hero, .table-card, .metric-card { border-radius: 22px; padding: 20px; }
  .status-grid, .card-grid, .insight-grid, .control-panel, .split-layout, .answer-grid { grid-template-columns: 1fr; }
  .hero-actions { width: 100%; }
  .brand-title { align-items: flex-start; gap: 14px; }
  .brand-logo { width: 68px; height: 68px; }
  .primary-btn, .ghost-btn { width: 100%; text-align: center; }
  .table-head, .pagination { align-items: stretch; flex-direction: column; }
}
