/* ============================================================
   CANB English — 성적 분석 리포트
   Design language: Apple-inspired tile rhythm, CANB magenta accent
   ============================================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap');

:root {
  /* Brand */
  --magenta: #b91170;
  --magenta-bright: #d11782;
  --magenta-deep: #8c0c54;
  --magenta-on-dark: #e84099;

  /* Surface */
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --tile-dark-1: #1a1a1c;
  --tile-dark-2: #1d1d20;
  --tile-dark-3: #161617;
  --black: #000000;

  /* Text */
  --ink: #1d1d1f;
  --ink-soft: #2f3440;
  --ink-mute: #4f5562;
  --ink-faint: #707783;
  --on-dark: #ffffff;
  --on-dark-mute: #cccccc;
  --on-dark-faint: #b6b8bf;

  /* Hairlines */
  --divider: rgba(0, 0, 0, 0.06);
  --hairline: #e0e0e0;
  --hairline-dark: rgba(255, 255, 255, 0.10);

  /* Shadow — single drop, product-photo style */
  --shadow-product: 3px 5px 30px rgba(0, 0, 0, 0.22);

  /* Type */
  --font-display: 'Instrument Serif', 'Pretendard', serif;
  --font-body: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-section: 96px;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-pill: 9999px;
}

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

html, body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.012em;
  color: var(--ink);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Nav — global slim black bar + subnav frosted parchment
   ============================================================ */
.global-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 44px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--divider);
}
.global-nav .gn-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.global-nav .gn-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
}
.global-nav .gn-brand img { height: 22px; width: auto; opacity: 1; }
.global-nav .gn-links {
  display: flex;
  gap: var(--space-7);
  font-size: 12px;
  color: var(--ink-mute);
}
.global-nav .gn-links a { color: var(--ink-mute); }
.global-nav .gn-links a:hover { color: var(--ink); text-decoration: none; }

.sub-nav {
  position: sticky;
  top: 44px;
  z-index: 90;
  height: 56px;
  background: rgba(245, 245, 247, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
}
.sub-nav .sn-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sub-nav .sn-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.sub-nav .sn-actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  font-size: 14px;
  color: var(--ink-mute);
}
.sub-nav .sn-actions a { color: var(--ink-mute); }
.sub-nav .sn-actions a:hover { color: var(--ink); text-decoration: none; }

/* Sub-nav contrast fixes */
.sub-nav .sn-actions .caption { color: var(--ink) !important; font-weight: 600; }
.sub-nav .sn-actions .btn-pill { color: #fff !important; }
.sub-nav .sn-actions .btn-pill:hover { color: #fff !important; }
.admin-switcher {
  align-items: center;
  gap: 8px;
}
.admin-switcher label {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 700;
}
.admin-switcher select {
  height: 32px;
  min-width: 116px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink);
  padding: 0 28px 0 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
}


/* ============================================================
   Tile sections — alternating light/parchment/dark, full bleed
   ============================================================ */
.tile {
  padding: var(--space-section) var(--space-6);
}
.tile-light    { background: var(--canvas); color: var(--ink); }
.tile-parchment{ background: var(--parchment); color: var(--ink); }
.tile-dark     { background: var(--tile-dark-1); color: var(--on-dark); }
.tile-dark-2   { background: var(--tile-dark-2); color: var(--on-dark); }

.tile-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.tile-inner-narrow { max-width: 760px; }
.tile-inner-wide   { max-width: 1200px; }

/* ============================================================
   Typography
   ============================================================ */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--magenta);
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.tile-dark .eyebrow { color: var(--magenta-on-dark); }

.eyebrow.section-only {
  font-size: clamp(26px, 3.6vw, 42px);
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--ink);
  margin-bottom: var(--space-6);
}
.tile-dark .eyebrow.section-only { color: var(--on-dark); }

.h-hero {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.h-hero em { font-style: italic; color: var(--magenta); }
.tile-dark .h-hero em { color: var(--magenta-on-dark); }

.h-display {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 52px);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.h-section {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.018em;
}
.h-card {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.014em;
}
.lead {
  font-size: 21px;
  font-weight: 400;
  line-height: 1.42;
  letter-spacing: -0.008em;
  color: var(--ink-soft);
}
.tile-dark .lead { color: var(--on-dark-mute); }
.caption {
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: -0.005em;
}
.tile-dark .caption { color: var(--on-dark-faint); }
.fine {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.42;
}
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ============================================================
   Buttons (pill + utility)
   ============================================================ */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--magenta);
  color: #fff;
  border: 0;
  padding: 12px 24px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn-pill:hover { background: var(--magenta-bright); text-decoration: none; }
.btn-pill:active { transform: scale(0.96); }
.btn-pill:disabled { background: var(--ink-faint); cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--magenta);
  border: 1px solid var(--magenta);
  padding: 11px 23px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: transform 0.12s ease;
}
.btn-ghost:hover { background: rgba(185, 17, 112, 0.08); text-decoration: none; }
.btn-ghost:active { transform: scale(0.96); }

/* ============================================================
   Stat tiles, cards
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-9);
}
@media (max-width: 720px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
.stat {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--space-7) var(--space-6);
}
.tile-dark .stat {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--hairline-dark);
}
.stat .stat-label {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
  margin-bottom: var(--space-3);
}
.tile-dark .stat .stat-label { color: var(--on-dark-faint); }
.stat .stat-value {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat .stat-suffix {
  font-size: 18px;
  color: var(--ink-mute);
  margin-left: var(--space-1);
  font-family: var(--font-body);
}
.tile-dark .stat .stat-suffix { color: var(--on-dark-faint); }
.stat .stat-foot {
  margin-top: var(--space-3);
  font-size: 13px;
  color: var(--ink-mute);
}
.tile-dark .stat .stat-foot { color: var(--on-dark-faint); }
.stat .stat-value.danger { color: #ef4444; }

.exam-intro-header {
  max-width: 760px;
}
.exam-title {
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0;
}
.exam-intro-lede {
  max-width: 640px;
  margin-top: var(--space-5);
  color: var(--on-dark-mute);
  font-size: 19px;
  line-height: 1.6;
  letter-spacing: -0.006em;
}
.exam-stat-row {
  grid-template-columns: repeat(2, 1fr);
}
.exam-chart-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--hairline-dark);
  color: var(--on-dark);
}
.tile-dark .chart-card.exam-chart-card { background: rgba(255, 255, 255, 0.04); }
.exam-chart-card .chart-title { color: var(--on-dark); }
.chart-caption {
  margin-top: var(--space-4);
  color: var(--on-dark-faint);
  font-size: 12px;
  line-height: 1.5;
}
.chart-caption.average-note {
  color: #7dd3fc;
}
.exam-chart-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -110%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.12s ease;
}
.exam-chart-tooltip.show { opacity: 1; }
.stat .stat-value.exam-stat-value {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.stat .stat-foot.danger { color: #ef4444; }

/* ============================================================
   Charts — SVG
   ============================================================ */
.chart-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--space-8);
  margin-top: var(--space-8);
}
.tile-dark .chart-card,
.tile-parchment .chart-card { background: var(--canvas); }

.chart-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin-bottom: var(--space-2);
  color: var(--ink);
}
.chart-sub {
  font-size: 14px;
  color: var(--ink-mute);
  margin-bottom: var(--space-7);
}
.chart-sub,
.listening-note {
  display: none;
}
.listening-note {
  margin-top: calc(var(--space-5) * -1);
  margin-bottom: var(--space-6);
}
.demo-help {
  margin-top: calc(var(--space-5) * -1);
  margin-bottom: var(--space-5);
  color: var(--ink-faint);
}
.tile-dark .demo-help { color: var(--on-dark-faint); }
.reading-summary {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--divider);
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
}
.reading-summary-value {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
}
.reading-summary-value.accent { color: var(--magenta); }

/* ============================================================
   Login form
   ============================================================ */
.login-card {
  background: var(--canvas);
  border-radius: var(--r-lg);
  padding: var(--space-9) var(--space-8);
  border: 1px solid var(--hairline);
  max-width: 480px;
  margin: var(--space-9) auto 0;
}
.tile-dark .login-card {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--hairline-dark);
}
.login-card h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin-bottom: var(--space-2);
}
.login-card p.help {
  font-size: 14px;
  color: var(--ink-mute);
  margin-bottom: var(--space-7);
}
.tile-dark .login-card p.help { color: var(--on-dark-mute); }

.form-field { margin-bottom: var(--space-5); }
.form-field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: var(--space-2);
  font-weight: 500;
}
.tile-dark .form-field label { color: var(--on-dark-mute); }
.form-field input {
  width: 100%;
  font-family: inherit;
  font-size: 17px;
  padding: 14px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: -0.008em;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-field input:focus {
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 4px rgba(185, 17, 112, 0.12);
}
.form-field input.secure-text-input:not(:placeholder-shown) {
  -webkit-text-security: disc;
}

.form-action {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
}
.form-error {
  color: var(--magenta-deep);
  font-size: 13px;
  display: none;
}
.form-error.show { display: block; }

/* ============================================================
   Profile-page specific
   ============================================================ */
.profile-hero {
  text-align: left;
}
.profile-hero .student-label {
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-3);
}
.profile-hero .student-name {
  font-family: var(--font-display);
  font-size: clamp(56px, 9vw, 112px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.profile-hero .student-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-9);
  margin-top: var(--space-9);
}
.profile-hero .meta-item .meta-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: var(--space-2);
}
.profile-hero .meta-item .meta-value {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.018em;
}
.profile-hero .meta-item .meta-value .unit {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--ink-mute);
  margin-left: 4px;
}

/* Grade badge */
.grade-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--magenta);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-top: var(--space-5);
}
.grade-badge .gb-num {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}

.term-comment-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--space-7);
  margin-bottom: var(--space-8);
}
.term-comment-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-bottom: var(--space-5);
}
.term-comment-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}
.term-comment-item {
  min-width: 0;
}
.term-comment-label {
  font-size: 12px;
  color: var(--magenta);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.term-comment-item p {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.72;
  letter-spacing: -0.004em;
}

.floating-top-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.15s ease;
}
.floating-top-button:hover {
  background: var(--magenta);
}
.floating-top-button:active {
  transform: scale(0.94);
}

/* Question card */
.hard-question-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.q-card {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.q-card-expanded {
  align-self: start;
}
.q-summary {
  padding: 24px 24px 18px;
  background: var(--canvas);
}
.q-summary-grid {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 18px;
}
.q-summary > div:not(.q-summary-grid) {
  display: none;
}
.q-expanded-body {
  padding: 0 24px 24px;
}
.q-card .q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  background: var(--pearl);
}
.q-card .q-num {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.q-card .q-points {
  font-size: 13px;
  font-weight: 500;
  color: var(--magenta);
  background: rgba(185, 17, 112, 0.08);
  padding: 4px 12px;
  border-radius: var(--r-pill);
}
.q-card .q-image {
  padding: 14px;
  background: var(--pearl);
}
.q-card .q-image img {
  width: 100%;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-product);
}
.q-card .q-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--divider);
  margin-top: auto;
}
.q-card .q-answer-box {
  padding: 12px 16px;
}
.q-card .q-answer-box.your { background: rgba(140, 12, 84, 0.04); }
.q-card .q-answer-box.correct { background: rgba(0, 120, 60, 0.04); border-left: 1px solid var(--divider); }
.q-card .q-answer-box .qa-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: var(--space-3);
}
.q-card .q-answer-box .qa-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  color: var(--ink);
}
.q-card .q-answer-box.your .qa-value {
  background: rgba(185, 17, 112, 0.12);
  color: var(--magenta-deep);
}
.q-card .q-answer-box.correct .qa-value {
  background: rgba(0, 140, 70, 0.12);
  color: #006e3a;
}

@media (max-width: 640px) {
  .q-card .q-answers { grid-template-columns: 1fr; }
  .q-card .q-answer-box.correct { border-left: 0; border-top: 1px solid var(--divider); }
}
.q-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 760px) {
  .hard-question-grid,
  .q-grid { grid-template-columns: 1fr; }
  .q-summary {
    padding: 20px 18px 16px;
  }
  .q-summary-grid {
    grid-template-columns: auto repeat(3, minmax(58px, 1fr));
    gap: 14px;
  }
  .q-expanded-body {
    padding: 0 18px 20px;
  }
}

/* Listening round breakdown */
.round-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-6);
}
.round-cell {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: var(--space-4);
  text-align: center;
}
.round-cell .rc-label {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}
.round-cell .rc-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
}
.round-cell .rc-detail {
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--ink-mute);
}
.round-cell.miss {
  background: rgba(140, 12, 84, 0.04);
  border-color: rgba(185, 17, 112, 0.18);
}
.round-cell.miss .rc-value { color: var(--magenta-deep); }
.round-cell.final-test {
  border: 3px solid var(--magenta);
  background: rgba(185, 17, 112, 0.05);
}

/* Reading heatmap */
.hm-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}
.hm-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--pearl);
  font-size: 12px;
  color: var(--ink-mute);
}
.hm-type-chip strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hm-type-chip small { color: var(--ink-faint); }
.hm-type-chip.weak {
  border-width: 2px;
  border-color: rgba(185, 17, 112, 0.55);
  background: rgba(185, 17, 112, 0.07);
}
.hm-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.hm-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  table-layout: fixed;
}
.hm-table th,
.hm-table td {
  border-right: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: 0;
  text-align: center;
  vertical-align: middle;
  background: var(--canvas);
}
.hm-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--pearl);
  color: var(--ink-mute);
  font-weight: 600;
  white-space: nowrap;
}
.hm-sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 1px 0 0 var(--divider);
}
.hm-table thead .hm-sticky-col { z-index: 4; }
.hm-q {
  width: 76px;
  color: var(--ink);
  padding: 7px 6px !important;
}
.hm-q span {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
}
.hm-q small {
  display: block;
  margin-top: 3px;
  color: var(--magenta-deep);
  font-size: 10px;
  font-weight: 700;
}
.hm-type {
  width: 92px;
  text-align: center !important;
  vertical-align: middle !important;
  padding: 7px 6px !important;
}
.hm-type strong {
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}
.hm-type.weak {
  border: 3px solid var(--ink) !important;
  background: rgba(0, 0, 0, 0.035) !important;
  color: var(--ink);
}
.hm-cell,
.hm-rate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 58px;
  min-height: 38px;
  border-radius: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.hm-rate {
  width: 100%;
  min-width: 76px;
  min-height: 42px;
  font-size: 15px;
}
.hm-table th.hm-term-col,
.hm-table td.hm-term-col {
  border-left: 3px solid var(--ink);
  border-right: 3px solid var(--ink);
}
.hm-table thead th.hm-term-col {
  border-top: 3px solid var(--ink);
  color: var(--ink);
}
.hm-table tbody tr:last-child td.hm-term-col {
  border-bottom: 3px solid var(--ink);
}
.hm-term-col small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-mute);
}
.hm-total-col {
  border-left: 14px solid var(--canvas) !important;
  min-width: 88px;
}
.hm-table thead .hm-total-col {
  color: var(--ink);
  font-size: 13px;
}
.hm-good { background: #9fd9b3; color: #14562f; }
.hm-watch { background: #d8eac7; color: #425f1e; }
.hm-risk { background: #f2c5b9; color: #7a2d1c; }
.hm-danger { background: #d9695d; color: #fff; }
.hm-empty { background: #f1f1f3; color: var(--ink-faint); }
.hm-missing {
  width: 100%;
  background: #eceef2;
  color: var(--ink-faint);
  font-size: 10px;
}
.hm-correct { background: #9fd9b3; color: #14562f; }
.hm-wrong-soft { background: #f3c8be; color: #7a2d1c; }
.hm-wrong-mid { background: #e89386; color: #6f1f14; }
.hm-wrong-strong { background: #cf5148; color: #fff; }
.hm-hard-row th,
.hm-hard-row td {
  background: #fff8e6;
}
.hm-hard-row .hm-sticky-col {
  border-left: 1px solid var(--divider);
}
/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--parchment);
  border-top: 1px solid var(--divider);
  padding: var(--space-9) var(--space-6) var(--space-7);
  text-align: center;
}
.footer .footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}
.footer .footer-brand img { height: 22px; opacity: 0.9; margin: 0 auto var(--space-4); }
.footer .footer-text {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

/* ============================================================
   Utility
   ============================================================ */
.row { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.col { flex: 1; min-width: 280px; }
.gap-y > * + * { margin-top: var(--space-5); }
.mt-section { margin-top: var(--space-section); }
.text-center { text-align: center; }
.divider-line {
  height: 1px;
  background: var(--divider);
  margin: var(--space-9) 0;
}
.tile-dark .divider-line { background: var(--hairline-dark); }

.hidden { display: none !important; }

/* Tags */
.tag {
  display: inline-block;
  background: rgba(185, 17, 112, 0.08);
  color: var(--magenta);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.tile-dark .tag {
  background: rgba(232, 64, 153, 0.12);
  color: var(--magenta-on-dark);
}

/* Small responsive niceties */
@media (max-width: 720px) {
  .tile { padding: 64px var(--space-5); }
  :root { --space-section: 64px; }
  .global-nav, .sub-nav { padding: 0 var(--space-5); }
  .global-nav .gn-links { gap: var(--space-5); }
  .sub-nav .sn-title { font-size: 17px; }
}


/* Mobile readability: keep charts large and scrollable instead of shrinking text */
@media (max-width: 720px) {
  html, body { font-size: 16px; }
  :root { --space-section: 56px; }
  .tile { padding: 56px 16px; }
  .tile-inner { max-width: 100%; }

  .global-nav {
    height: auto;
    min-height: 44px;
    padding: 0 14px;
  }
  .global-nav .gn-inner { gap: 14px; }
  .global-nav .gn-brand img { height: 20px; }
  .global-nav .gn-links {
    gap: 16px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .global-nav .gn-links::-webkit-scrollbar { display: none; }

  .sub-nav {
    top: 44px;
    height: auto;
    min-height: 58px;
    padding: 8px 16px;
  }
  .sub-nav .sn-inner {
    gap: 12px;
  }
  .sub-nav .sn-title {
    display: none;
  }
  .sub-nav .sn-actions {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }
  .admin-mode .sub-nav .sn-actions {
    gap: 8px;
  }
  .admin-mode .test-caption {
    flex: 0 0 auto;
  }
  .admin-mode .admin-switcher {
    flex: 0 1 auto;
    min-width: 0;
  }
  .admin-mode .admin-switcher label {
    display: none;
  }
  .admin-mode .admin-switcher select {
    min-width: 104px;
    max-width: 132px;
  }
  .sub-nav .sn-actions .caption {
    color: var(--ink) !important;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
  }
  .sub-nav .sn-actions .btn-pill {
    color: #fff !important;
    padding: 8px 18px !important;
    font-size: 14px !important;
    flex: 0 0 auto;
  }

  .h-hero { font-size: clamp(46px, 14vw, 72px); }
  .eyebrow.section-only { font-size: clamp(30px, 9vw, 40px); }
  .lead { font-size: 18px; }

  .stat-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .stat {
    padding: 22px 20px;
  }
  .stat .stat-value {
    font-size: 48px;
  }
  .exam-stat-row {
    grid-template-columns: 1fr;
  }
  .exam-intro-lede {
    font-size: 17px;
  }

  .chart-card {
    padding: 20px 14px;
    margin-left: -4px;
    margin-right: -4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .chart-title { font-size: 21px; }
  .chart-sub { font-size: 14px; margin-bottom: 20px; color: var(--ink-soft); }
  .chart-card [id^="chart-"] {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .chart-card [id^="chart-"] svg {
    width: 1100px !important;
    max-width: none !important;
  }
  #chart-distribution svg,
  #chart-class-position svg {
    width: 900px !important;
  }
  #chart-national svg,
  #chart-grades svg,
  #chart-grade1-trend svg,
  #chart-class-trend svg,
  #chart-trend svg {
    width: 1120px !important;
  }

  .profile-hero .student-name { font-size: clamp(64px, 22vw, 96px); }
  .profile-hero .student-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .profile-hero .meta-item .meta-value { font-size: 52px; }
  .term-comment-card {
    padding: 22px 18px;
    margin-bottom: 36px;
  }
  .term-comment-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .floating-top-button {
    right: 16px;
    bottom: 16px;
    width: 44px;
    height: 44px;
  }
  .round-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-card summary {
    padding: 20px !important;
    align-items: flex-start !important;
    gap: 16px;
  }
}

/* Page-load reveal animation (subtle, Apple-tight) */
@keyframes reveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal { animation: reveal 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.reveal-1 { animation-delay: 0.05s; }
.reveal-2 { animation-delay: 0.15s; }
.reveal-3 { animation-delay: 0.25s; }
.reveal-4 { animation-delay: 0.35s; }
