
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:      #f8f9fb;
      --white:   #ffffff;
      --ink:     #0f172a;
      --muted:   #64748b;
      --border:  #e2e8f0;

      --bio:     #16a34a; --bio-bg:  #f0fdf4;
      --chem:    #2563eb; --chem-bg: #eff6ff;
      --phys:    #7c3aed; --phys-bg: #f5f3ff;
      --eng:     #d97706; --eng-bg:  #fffbeb;
      --log:     #0891b2; --log-bg:  #ecfeff;
      --math:    #e11d48; --math-bg: #fff1f2;
      --ibaeng:  #059669; --ibaeng-bg: #ecfdf5;

      --green:   #16a34a; --red:     #dc2626; --amber:   #d97706;
      --green-bg:#f0fdf4; --red-bg:  #fef2f2;
      --radius:  14px;
      --sans:    'DM Sans', sans-serif;
      --serif:   'Instrument Serif', Georgia, serif;
    }

    html, body { font-family: var(--sans); background: var(--bg); color: var(--ink); min-height: 100vh; line-height: 1.5; }
    a { text-decoration: none; color: inherit; }
    .is-hidden { display: none !important; }

    /* ── NAV */
    nav {
      display: flex; align-items: center; justify-content: space-between; gap: 24px;
      padding: 0 32px; min-height: 64px;
      border-bottom: 1px solid var(--border);
      background: rgba(255,255,255,0.96); 
      position: sticky; top: 0; z-index: 100;
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }
    .brand-block {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 2px;
      min-width: 0;
    }
    .brand-link { display: block; }
    .logo { font-family: var(--serif); font-size: 22px; color: var(--ink); letter-spacing: -0.3px; }
    .logo span { font-style: italic; }
    .tagline { font-size: 11px; color: var(--muted); font-weight: 500; }
    .nav-links {
      display: flex; align-items: center; gap: 28px;
      list-style: none; margin: 0; padding: 0; flex: 1; justify-content: center;
    }
    .nav-links a { font-size: 13px; color: var(--muted); transition: color 0.15s; }
    .nav-links a:hover { color: var(--ink); }
    .nav-links a.active { color: var(--ink); font-weight: 500; }
    .nav-cta {
      background: var(--ink); color: var(--white);
      padding: 9px 18px; border-radius: 8px;
      font-size: 13px; font-weight: 500;
      transition: opacity 0.2s;
      white-space: nowrap;
    }
    .nav-cta:hover { opacity: 0.84; }

    /* ── PAGE */
    .page { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }

    /* ── LOADING */
    .page-loading {
      display: flex; flex-direction: column; align-items: center; justify-content: center;
      min-height: 60vh; gap: 14px; color: var(--muted); font-size: 14px;
    }
    .spinner {
      width: 32px; height: 32px;
      border: 2.5px solid var(--border); border-top-color: var(--ink);
      border-radius: 50%; animation: spin 0.7s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    @keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

    /* ── HERO */
    .page-hero { margin-bottom: 32px; animation: fadeUp 0.4s ease both; }
    .hero-badge {
      display: inline-flex; align-items: center;
      background: #f1f5f9; border: 1px solid var(--border);
      border-radius: 99px; padding: 4px 12px;
      font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
      text-transform: uppercase; color: var(--muted); margin-bottom: 16px;
    }
    .hero-title { font-family: var(--serif); font-size: 36px; line-height: 1.1; margin-bottom: 6px; }
    .hero-title em { font-style: italic; }
    .hero-sub { font-size: 14px; color: var(--muted); }

    /* ── OVERALL STATS */
    .hero-stats {
      display: grid; grid-template-columns: repeat(4, 1fr);
      gap: 14px; margin-bottom: 32px; animation: fadeUp 0.4s 0.05s ease both;
    }
    .hstat {
      background: var(--white); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 20px 20px 16px;
      transition: box-shadow 0.2s, transform 0.2s;
    }
    .hstat:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.07); transform: translateY(-2px); }
    .hstat-value { font-family: var(--serif); font-size: 34px; line-height: 1; margin-bottom: 6px; }
    .hstat-value.blue  { color: #2563eb; }
    .hstat-value.green { color: var(--green); }
    .hstat-value.red   { color: var(--red); }
    .hstat-value.amber { color: var(--amber); }
    .hstat-label { font-size: 12px; color: var(--muted); }

    /* ── ACCURACY BAR */
    .accuracy-card {
      background: var(--white); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 20px 24px;
      margin-bottom: 32px; animation: fadeUp 0.4s 0.1s ease both;
    }
    .accuracy-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
    .accuracy-title { font-size: 13px; font-weight: 500; }
    .accuracy-pct { font-family: var(--serif); font-size: 22px; }
    .bar-track { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
    .bar-fill { height: 100%; border-radius: 99px; width: 0%; transition: width 1s cubic-bezier(0.4,0,0.2,1); }
    .bar-fill.high   { background: linear-gradient(90deg, #16a34a, #22c55e); }
    .bar-fill.medium { background: linear-gradient(90deg, #d97706, #f59e0b); }
    .bar-fill.low    { background: linear-gradient(90deg, #dc2626, #ef4444); }

    /* ── TABS */
    .tabs-row {
      display: flex; gap: 4px;
      background: #f1f5f9; border-radius: 12px; padding: 4px;
      margin-bottom: 28px; width: fit-content;
      animation: fadeUp 0.4s 0.12s ease both;
    }
    .tab-btn {
      padding: 8px 20px; border-radius: 9px; border: none;
      font-family: var(--sans); font-size: 13px; font-weight: 500;
      cursor: pointer; background: transparent; color: var(--muted);
      transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    }
    .tab-btn.active {
      background: var(--white); color: var(--ink);
      box-shadow: 0 1px 6px rgba(0,0,0,0.1);
    }
    .tab-btn:hover:not(.active) { color: var(--ink); }

    /* ── SECTION HEADING */
    .section-heading {
      font-size: 11px; font-weight: 600; letter-spacing: 0.09em;
      text-transform: uppercase; color: var(--muted); margin-bottom: 16px;
    }

    /* ── SUBJECT CARDS GRID */
    .subjects-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 16px; margin-bottom: 32px; animation: fadeUp 0.4s 0.15s ease both;
    }

    .subject-card {
      background: var(--white); border: 1px solid var(--border);
      border-radius: var(--radius); padding: 20px;
      cursor: pointer; transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
      position: relative;
    }
    .subject-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,0.09); transform: translateY(-2px); }
    .subject-card.active { box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }

    .sc-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
    .sc-icon {
      width: 42px; height: 42px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
      flex-shrink: 0; text-transform: uppercase;
    }
    .sc-info { flex: 1; min-width: 0; }
    .sc-name { font-size: 15px; font-weight: 600; }
    .sc-count { font-size: 12px; color: var(--muted); margin-top: 1px; }
    .sc-chevron {
      width: 28px; height: 28px; border-radius: 50%;
      background: #f8f9fb; border: 1px solid var(--border);
      display: flex; align-items: center; justify-content: center;
      transition: transform 0.25s; flex-shrink: 0;
    }
    .sc-chevron svg { transition: transform 0.25s; }
    .subject-card.active .sc-chevron svg { transform: rotate(90deg); }

    .sc-progress-row { display: flex; align-items: center; gap: 10px; }
    .sc-bar-track { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
    .sc-bar-fill { height: 100%; border-radius: 99px; width: 0%; transition: width 0.9s cubic-bezier(0.4,0,0.2,1); }
    .sc-pct { font-size: 12px; font-weight: 600; min-width: 36px; text-align: right; }
    .sc-mini-stats { display: flex; gap: 16px; margin-top: 10px; }
    .sc-ms { font-size: 11px; color: var(--muted); }
    .sc-ms strong { color: var(--ink); font-weight: 600; }

    /* ── TOPIC PANEL */
    .topic-panel {
      background: var(--white); border: 1px solid var(--border);
      border-radius: var(--radius); margin-top: 8px;
      overflow: hidden; display: none;
      grid-column: 1 / -1;
    }
    .topic-panel.open { display: block; animation: slideDown 0.25s ease both; }

    .topic-panel-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 14px 20px; border-bottom: 1px solid var(--border); background: #f8f9fb;
    }
    .tp-title { font-size: 13px; font-weight: 600; }
    .tp-legend { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
    .tp-legend span { display: flex; align-items: center; gap: 5px; }
    .dot { width: 8px; height: 8px; border-radius: 50%; }
    .dot.green { background: var(--green); }
    .dot.red   { background: var(--red); }

    /* ── TOPIC GRID inside panel */
    .topic-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 0;
    }

    .topic-row {
      display: flex; align-items: center;
      padding: 12px 20px; border-bottom: 1px solid var(--border);
      border-right: 1px solid var(--border);
      gap: 10px; transition: background 0.15s;
    }
    .topic-row:hover { background: #f8f9fb; }

    .tr-left { flex: 1; min-width: 0; }
    .tr-name {
      font-size: 13px; font-weight: 500; margin-bottom: 4px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .tr-bar { display: flex; align-items: center; gap: 8px; }
    .tr-bar-track { flex: 1; height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; }
    .tr-bar-fill { height: 100%; border-radius: 99px; width: 0%; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
    .tr-bar-fill.green { background: var(--green); }
    .tr-bar-fill.amber { background: var(--amber); }
    .tr-bar-fill.red   { background: var(--red); }
    .tr-score { font-size: 11px; color: var(--muted); white-space: nowrap; }

    .tr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .tr-cw { display: flex; gap: 5px; font-size: 11px; }
    .tr-correct { color: var(--green); font-weight: 600; }
    .tr-wrong   { color: var(--red);   font-weight: 600; }
    .tr-btn {
      display: inline-flex; align-items: center; gap: 4px;
      padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 500;
      background: var(--ink); color: var(--white);
      transition: opacity 0.15s, transform 0.15s; white-space: nowrap;
    }
    .tr-btn:hover { opacity: 0.82; transform: translateX(2px); }

    /* ── EMPTY / NO-ATTEMPTS state */
    .empty-state {
      padding: 40px 20px; text-align: center; color: var(--muted);
    }
    .empty-state p { font-size: 14px; margin-bottom: 6px; }
    .empty-state .empty-sub { font-size: 12px; }

    /* ── REALTIME BADGE */
    .live-badge {
      display: inline-flex; align-items: center; gap: 5px;
      font-size: 11px; color: var(--green); font-weight: 500;
      margin-top: 4px;
    }
    .live-dot {
      width: 7px; height: 7px; border-radius: 50%;
      background: var(--green); animation: pulse 1.8s ease infinite;
    }
    @keyframes pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50%       { opacity: 0.4; transform: scale(0.7); }
    }

    /* ── TAB CONTENT */
    .tab-content { display: none; }
    .tab-content.active { display: block; }

    /* ── RESPONSIVE */
    @media (max-width: 900px) {
      nav { flex-wrap: wrap; align-items: flex-start; padding: 16px 20px; }
      .nav-links { order: 3; width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 12px 18px; }
      .nav-cta { margin-left: auto; }
    }

    @media (max-width: 640px) {
      nav { gap: 12px; }
      .brand-block { flex: 1 1 auto; }
      .nav-links { gap: 10px 14px; }
      .nav-cta { width: 100%; text-align: center; margin-left: 0; }
      .page { padding: 28px 16px 60px; }
      .hero-title { font-size: 26px; }
      .hero-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
      .hstat { padding: 16px 16px 14px; }
      .hstat-value { font-size: 28px; }
      .subjects-grid { grid-template-columns: 1fr; }
      .tabs-row { width: 100%; }
      .tab-btn { flex: 1; }
      .tp-legend { display: none; }
      .topic-grid { grid-template-columns: 1fr; }
      .topic-row {
        flex-direction: column;
        align-items: stretch;
      }
      .tr-right {
        justify-content: space-between;
        width: 100%;
      }
      .tr-btn { display: none; }
    }
