/* ============================================================
   MedPath — Stylesheet
   Theme: navy + mint accent · Sarabun font
   ============================================================ */

:root {
  --navy: #1F4E79;
  --navy2: #2E75B6;
  --navy3: #5B9BD5;
  --mint: #3FA796;
  --mint2: #7DCEA0;
  --mint-bg: #E8F5F1;
  --navy-bg: #EEF3F9;
  --warning: #ED7D31;
  --ink: #1B2A3A;
  --ink2: #475569;
  --ink3: #94A3B8;
  --line: #E2E8F0;
  --line2: #F1F5F9;
  --bg: #F8FAFC;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Sarabun', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select { font-family: inherit; }
a { text-decoration: none; color: inherit; cursor: pointer; }

/* ── Top Nav ───────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 64px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--navy), var(--mint));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(31, 78, 121, 0.3);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.brand-tag { font-size: 11px; color: var(--ink3); margin-left: 4px; }
.nav-items { display: flex; gap: 4px; }
.nav-item {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: var(--line2); }
.nav-item.active {
  font-weight: 600;
  color: var(--navy);
  background: var(--navy-bg);
}
.nav-cta { display: flex; gap: 8px; align-items: center; }
.nav-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border-radius: 10px;
  font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
}
.btn-sm { font-size: 13px; padding: 6px 12px; height: 30px; }
.btn-md { font-size: 14px; padding: 8px 16px; height: 38px; }
.btn-lg { font-size: 16px; padding: 12px 24px; height: 48px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: #173a5e; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--navy-bg); }
.btn-ghost { background: transparent; color: var(--ink2); }
.btn-ghost:hover { background: var(--line2); }
.btn-mint { background: var(--mint); color: #fff; }
.btn-mint:hover { background: #2D7D6E; }

/* ── Pills ────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; font-weight: 500;
  font-size: 11px; padding: 3px 9px;
}
.pill-navy { background: var(--navy-bg); color: var(--navy); }
.pill-mint { background: var(--mint-bg); color: #2D7D6E; }
.pill-warning { background: #FEF3E6; color: #B85C13; }
.pill-gray { background: var(--line2); color: var(--ink2); }
.pill-int { background: #F3E8FF; color: #7C3AED; }
.pill-success { background: #E6F4EA; color: #2D7A3F; }
.pill-md { font-size: 12px; padding: 4px 11px; }
.pill-on-hero { background: rgba(255,255,255,0.2); color: #fff; backdrop-filter: blur(8px); }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 20px;
  transition: all .15s;
}
.card-hover:hover {
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.12);
  border-color: var(--navy3);
}

/* ── Layout ───────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 64px; }
.page { min-height: 100vh; }

/* ── Hero ─────────────────────────────────────────────── */
.hero {
  position: relative;
  background:
    radial-gradient(ellipse at top right, rgba(63,167,150,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at bottom left, rgba(91,155,213,0.15) 0%, transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, #2A5F94 50%, #173E63 100%);
  color: #fff;
  padding: 72px 64px 56px;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
  opacity: 0.7;
}
.hero-blob1 {
  position: absolute; right: -100px; top: -80px;
  width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(63,167,150,0.28) 0%, transparent 70%);
  filter: blur(20px);
}
.hero-blob2 {
  position: absolute; right: 240px; bottom: -160px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,155,213,0.22) 0%, transparent 70%);
  filter: blur(20px);
}
.hero-content { position: relative; max-width: 760px; z-index: 1; }
.hero h1 {
  font-size: 58px; font-weight: 800; line-height: 1.25;
  margin: 22px 0 20px; letter-spacing: -0.02em;
  color: #fff;
  padding-top: 4px;
}
.hero p {
  font-size: 17px; line-height: 1.65;
  color: rgba(232,241,250,0.92); max-width: 580px; margin-bottom: 32px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn-mint {
  background: #fff; color: var(--navy); font-weight: 600;
  box-shadow: 0 6px 20px -4px rgba(0,0,0,0.3);
  transition: transform 0.18s, box-shadow 0.18s;
}
.hero-actions .btn-mint:hover { transform: translateY(-2px); box-shadow: 0 10px 28px -4px rgba(0,0,0,0.4); }
.hero-actions .btn-ghost {
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(8px);
  transition: all 0.18s;
}
.hero-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.55);
  transform: translateY(-2px);
}

.quick-stats {
  position: relative;
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 1100px;
  z-index: 1;
}
.quick-stats-3 { grid-template-columns: repeat(3, 1fr); max-width: 880px; }
.quick-stat {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 18px 20px;
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  transition: all 0.2s;
}
.quick-stat:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
  transform: translateY(-2px);
}
.quick-stat-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(63,167,150,0.30), rgba(91,155,213,0.30));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border: 1px solid rgba(255,255,255,0.18);
}
.quick-stat-value { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; color: #fff; }
.quick-stat-label { font-size: 13px; color: rgba(255,255,255,0.95); margin-top: 6px; font-weight: 600; }
.quick-stat-sub { font-size: 11.5px; color: rgba(255,255,255,0.65); margin-top: 3px; line-height: 1.4; }

/* ── Section Headers ──────────────────────────────────── */
.section { padding: 64px; }
.section-eyebrow {
  font-size: 13px; color: var(--mint); font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 6px;
}
.section h2 {
  font-size: 32px; font-weight: 700; margin: 0;
  letter-spacing: -0.02em;
}
.section-desc { font-size: 15px; color: var(--ink2); margin-top: 6px; margin-bottom: 0; }
.section-head {
  display: flex; justify-content: space-between;
  align-items: flex-end; margin-bottom: 28px;
}
.section-head a {
  font-size: 14px; color: var(--navy); font-weight: 600;
}

/* ── Countdown ───────────────────────────────────────── */
.countdown-section { background: linear-gradient(180deg, transparent, var(--bg)); }
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.countdown-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}
.countdown-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -8px rgba(0,0,0,0.12); }
.countdown-number {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1024px) {
  .countdown-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .countdown-grid { grid-template-columns: 1fr; }
  .countdown-number { font-size: 42px; }
}

/* ── Animated count-up ───────────────────────────────── */
.quick-stat-value {
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s;
}

/* ── Track Grid ──────────────────────────────────────── */
.tracks-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}
.track-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all .15s;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.track-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.12);
}
.track-card-blob {
  position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px; border-radius: 50%;
}
.track-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.track-card-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.track-card-count { font-size: 11px; color: var(--ink3); margin-top: 2px; }

/* ── Timeline strip ──────────────────────────────────── */
.timeline-card {
  background: var(--mint-bg);
  border: none;
  padding: 32px;
  border-radius: 16px;
}
.timeline-row { display: flex; align-items: center; gap: 28px; }
.timeline-info { flex: 0 0 auto; max-width: 240px; }
.timeline-info h3 {
  font-size: 22px; font-weight: 700;
  margin: 8px 0 6px; letter-spacing: -0.01em;
}
.timeline-info p { font-size: 13px; color: var(--ink2); margin: 0; line-height: 1.5; }
.timeline-track {
  flex: 1; position: relative; height: 88px; padding-top: 8px;
}
.timeline-line {
  position: absolute; left: 6%; right: 6%; top: 28px; height: 3px;
  background: linear-gradient(90deg, var(--mint), var(--navy2));
  border-radius: 2px;
}
.timeline-point {
  position: absolute; transform: translateX(-50%);
  text-align: center; top: 0;
}
.timeline-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 3px solid var(--navy);
  margin: 24px auto 8px;
}
.timeline-month { font-size: 12px; color: var(--ink2); font-weight: 600; }
.timeline-label { font-size: 13px; font-weight: 700; color: var(--navy); margin-top: 1px; }
.timeline-sub { font-size: 10px; color: var(--ink3); }

/* ── Top scores ──────────────────────────────────────── */
.topscores-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.topscore-card { position: relative; padding: 18px; }
.topscore-rank {
  position: absolute; top: 14px; right: 14px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.topscore-rank-1 { background: var(--warning); }
.topscore-rank-2 { background: #FFD93D; color: var(--ink2); }
.topscore-rank-3 { background: #FFA94D; }
.topscore-rank-other { background: var(--line); color: var(--ink2); }
.topscore-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.topscore-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.topscore-uni { font-size: 11px; color: var(--ink2); margin-bottom: 12px; }
.topscore-value {
  font-size: 28px; font-weight: 700;
  color: var(--navy); letter-spacing: -0.02em; line-height: 1;
}
.topscore-sub { font-size: 10px; color: var(--ink3); margin-top: 2px; }

/* ── Browse page ──────────────────────────────────────── */
.page-header { padding: 32px 64px 0; }
.breadcrumb { font-size: 12px; color: var(--ink3); margin-bottom: 6px; }
.page-header h1 { font-size: 30px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.page-header p { font-size: 14px; color: var(--ink2); margin: 4px 0 0; }
.page-header-row {
  display: flex; justify-content: space-between;
  align-items: flex-end; margin-bottom: 20px;
}

.active-filters {
  padding: 0 64px 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.active-filters-label { font-size: 12px; color: var(--ink3); font-weight: 500; }
.filter-chip-active {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px 0 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--navy3);
  color: var(--navy);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
}
.filter-chip-active .x { font-size: 14px; line-height: 1; color: var(--ink3); }
.filter-clear-all {
  font-size: 12px; color: var(--warning); font-weight: 500;
  background: none; border: none; cursor: pointer;
  margin-left: 4px;
}

.browse-layout {
  padding: 8px 64px 64px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}
.sidebar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  align-self: flex-start;
  position: sticky;
  top: 80px;
}
.sidebar-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.filter-group {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line2);
}
.filter-group:last-child { border-bottom: none; padding-bottom: 0; }
.filter-group-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 10px;
}
.filter-chip {
  display: inline-block;
  padding: 6px 11px;
  margin: 0 6px 6px 0;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink2);
  cursor: pointer;
  transition: all .12s;
}
.filter-chip.active {
  border: 1.5px solid var(--navy);
  background: rgba(31, 78, 121, 0.08);
  color: var(--navy);
}
.uni-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 180px; overflow-y: auto;
}
.uni-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); cursor: pointer;
  padding: 4px 0;
}
.uni-item input { accent-color: var(--navy); width: 14px; height: 14px; }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); cursor: pointer;
}
.radio-item input { accent-color: var(--navy); width: 14px; height: 14px; }
.segmented {
  display: flex; background: var(--line2);
  border-radius: 8px; padding: 3px; gap: 2px;
}
.segmented button {
  flex: 1; height: 28px; border-radius: 6px; border: none;
  background: transparent; color: var(--ink2);
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.segmented button.active {
  background: #fff; color: var(--navy);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.result-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.result-count { font-size: 14px; color: var(--ink2); }
.result-count strong { color: var(--navy); font-size: 16px; }
.sort-control { display: flex; align-items: center; gap: 8px; }
.sort-control select {
  height: 32px; padding: 0 28px 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff;
  font-size: 13px; color: var(--ink); cursor: pointer;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.empty-state {
  padding: 48px; text-align: center;
}
.empty-state-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; color: var(--ink2); }

/* ── Faculty Card ────────────────────────────────────── */
.fac-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 18px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fac-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.12);
}
.fac-card-strip {
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.fac-card-header { display: flex; align-items: flex-start; gap: 10px; }
.fac-card-icon {
  width: 38px; height: 38px; border-radius: 10px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.fac-card-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  line-height: 1.25; letter-spacing: -0.01em;
}
.fac-card-uni { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.fac-card-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.fac-card-score {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 12px 14px;
  background: var(--navy-bg);
  border-radius: 12px;
  margin-top: 4px;
}
.fac-card-score-label {
  font-size: 10px; color: var(--ink2); font-weight: 500;
  letter-spacing: 0.03em;
}
.fac-card-score-value {
  font-size: 30px; font-weight: 700; color: var(--navy);
  line-height: 1; letter-spacing: -0.02em; margin-top: 2px;
}
.fac-card-score-sub { font-size: 10px; color: var(--ink3); }
.fac-card-footer {
  display: flex; justify-content: space-between;
  padding-top: 8px; border-top: 1px solid var(--line2);
}
.fac-card-footer-label { font-size: 10px; color: var(--ink3); font-weight: 500; }
.fac-card-footer-value { font-size: 14px; font-weight: 600; color: var(--ink); }
.fac-card-footer-unit { font-size: 10px; color: var(--ink3); font-weight: 400; }
.fac-card-footer-link {
  font-size: 12px; font-weight: 600; color: var(--navy);
  background: transparent; border: none; cursor: pointer;
}

/* ── Detail page ─────────────────────────────────────── */
.detail-hero {
  color: #fff;
  padding: 32px 64px 28px;
}
.detail-breadcrumb { font-size: 12px; color: rgba(255,255,255,0.8); margin-bottom: 12px; }
.detail-hero-row { display: flex; align-items: flex-start; gap: 20px; }
.detail-hero-icon {
  width: 64px; height: 64px; border-radius: 16px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.detail-hero h1 {
  font-size: 34px; font-weight: 700; margin: 0;
  letter-spacing: -0.02em; line-height: 1.15;
}
.detail-hero-uni { font-size: 17px; font-weight: 500; color: rgba(255,255,255,0.88); margin-top: 4px; }
.detail-hero-pills { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.detail-hero-pills .pill {
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-weight: 600;
}
.detail-actions { display: flex; gap: 8px; }
.detail-actions .btn {
  background: #fff;
  border: none;
}

.quickstrip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  margin: 0 64px;
  border-radius: 16px;
  padding: 16px 24px;
  box-shadow: 0 -8px 24px -16px rgba(0,0,0,0.12);
  position: relative;
  top: -16px;
  border: 1px solid var(--line);
}
.quickstrip-cell {
  padding: 0 20px;
  border-right: 1px solid var(--line);
}
.quickstrip-cell:first-child { padding-left: 0; }
.quickstrip-cell:last-child { border-right: none; padding-right: 0; }
.quickstrip-label { font-size: 11px; color: var(--ink3); font-weight: 500; }
.quickstrip-value {
  font-size: 24px; font-weight: 700;
  margin-top: 2px; letter-spacing: -0.02em;
}
.quickstrip-value-navy { color: var(--navy); }
.quickstrip-value-mint { color: var(--mint); }
.quickstrip-unit { font-size: 12px; color: var(--ink3); font-weight: 500; }

.detail-tabs {
  padding: 0 64px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.detail-tabs-row { display: flex; gap: 4px; }
.tab-btn {
  padding: 14px 18px;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--ink2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab-btn.active {
  font-weight: 600;
  border-bottom-color: var(--navy);
  color: var(--navy);
}

.tab-content { padding: 32px 64px 64px; }

.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; }
.two-col-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.two-col-detail { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.col { display: flex; flex-direction: column; gap: 20px; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 14px;
  column-gap: 32px;
}
.info-label { font-size: 11px; color: var(--ink3); font-weight: 500; margin-bottom: 2px; }
.info-value { font-size: 14px; font-weight: 600; color: var(--ink); }

.bullet-list { display: flex; flex-direction: column; gap: 10px; }
.bullet-row { display: flex; gap: 10px; align-items: flex-start; }
.bullet-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; }

.round-card { padding: 22px; }
.round-card-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 12px;
}
.round-num {
  font-size: 11px; color: var(--ink3);
  font-weight: 600; letter-spacing: 0.04em;
}
.round-name { font-size: 18px; font-weight: 700; margin-top: 2px; }
.round-desc { font-size: 12px; color: var(--ink2); margin-top: 4px; }
.round-stats {
  display: flex; justify-content: space-between;
  padding-top: 14px; border-top: 1px solid var(--line2);
}
.round-stat-label { font-size: 10px; color: var(--ink3); }
.round-stat-value { font-size: 13px; font-weight: 600; }

.score-card-dark {
  background: var(--navy);
  color: #fff;
  border: none;
}
.score-card-dark .label { font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 600; letter-spacing: 0.04em; }
.score-trio { display: flex; gap: 14px; margin-top: 14px; }
.score-trio-item { flex: 1; }
.score-trio-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.score-trio-label { font-size: 10px; color: rgba(255,255,255,0.7); }

.formula-bar {
  display: flex; height: 28px; border-radius: 8px;
  overflow: hidden; margin-bottom: 8px;
}
.formula-segment {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 600;
}
.formula-segment-tpat1 { background: var(--navy); }
.formula-segment-alevel { background: var(--mint); }
.formula-segment-empty { background: var(--line); color: var(--ink3); }
.formula-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink2);
}

.tip-card {
  background: #FEF3E6;
  border: none;
}
.tip-card .label { font-size: 12px; color: var(--warning); font-weight: 700; margin-bottom: 4px; }
.tip-card .text { font-size: 12.5px; color: var(--ink); line-height: 1.5; }

.tuition-list { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.tuition-row {
  display: flex; justify-content: space-between;
  padding: 10px 14px; font-size: 13px;
}
.tuition-row:nth-child(odd) { background: #fff; }
.tuition-row:nth-child(even) { background: var(--line2); }
.tuition-row .term { color: var(--ink2); }
.tuition-row .term .yr { color: var(--ink3); }
.tuition-total {
  display: flex; justify-content: space-between;
  padding: 14px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.misc-list { display: flex; flex-direction: column; gap: 10px; }
.misc-row {
  display: flex; justify-content: space-between;
  padding: 10px 14px;
  background: var(--line2);
  border-radius: 10px;
  font-size: 13px;
}

.career-salary {
  display: flex; align-items: baseline; gap: 8px;
}
.career-salary-main {
  font-size: 36px; font-weight: 700;
  color: var(--mint); letter-spacing: -0.02em;
}
.career-salary-range { font-size: 16px; color: var(--ink2); }
.career-bar-row { margin-bottom: 10px; }
.career-bar-row-head {
  display: flex; justify-content: space-between;
  font-size: 12px; margin-bottom: 4px;
}
.career-bar-row-value { font-weight: 600; color: var(--mint); }
.career-bar-bg {
  height: 6px; background: var(--line2);
  border-radius: 3px; overflow: hidden;
}
.career-bar-fill { height: 100%; background: var(--mint); border-radius: 3px; }

.stars-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.star {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.star-on { background: var(--warning); color: #fff; }
.star-off { background: var(--line); color: var(--ink3); }
.star-score { font-size: 24px; font-weight: 700; margin-left: 8px; }

.path-list { display: flex; flex-direction: column; gap: 8px; }
.path-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--line2);
  border-radius: 8px;
  font-size: 13px;
}
.path-dot { width: 6px; height: 6px; border-radius: 50%; }

/* ── Compare ─────────────────────────────────────────── */
.compare-table {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.compare-row {
  display: grid;
  grid-template-columns: 180px repeat(4, 1fr);
}
.compare-row.head { border-bottom: 1px solid var(--line); }
.compare-cell {
  padding: 14px 18px;
  font-size: 13px;
  border-left: 1px solid var(--line2);
}
.compare-cell:first-child { border-left: none; color: var(--ink2); font-weight: 500; }
.compare-row.head .compare-cell {
  border-left: 1px solid var(--line);
  position: relative;
  padding: 18px;
}
.compare-row.head .compare-cell:first-child {
  border-left: none;
  font-size: 11px;
  color: var(--ink3);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.compare-strip {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.compare-head-content { display: flex; align-items: flex-start; gap: 10px; }
.compare-head-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.compare-head-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.compare-head-uni { font-size: 11px; color: var(--ink2); }
.compare-cell-best {
  background: var(--mint-bg);
  position: relative;
  font-weight: 700;
  color: var(--mint);
}
.compare-cell-best::after {
  content: 'BEST';
  position: absolute; top: 8px; right: 10px;
  font-size: 9px; font-weight: 700;
  color: var(--mint); letter-spacing: 0.05em;
}
.compare-cell-value { font-weight: 600; color: var(--ink); }
.compare-cell-unit { font-size: 11px; color: var(--ink3); font-weight: 400; }
.compare-row.actions { background: var(--line2); }
.compare-row.actions .compare-cell { padding: 16px; }
.compare-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin-top: 24px;
}
.compare-summary-card { padding: 18px; }
.compare-summary-label {
  font-size: 11px; color: var(--ink3);
  font-weight: 600; letter-spacing: 0.04em;
}
.compare-summary-value { font-size: 14px; font-weight: 600; margin-top: 4px; }
.compare-summary-sub { font-size: 11px; color: var(--ink2); margin-top: 2px; }

/* ── Dashboard ───────────────────────────────────────── */
.dash-controls { display: flex; gap: 12px; }
.dash-control-label {
  font-size: 11px; color: var(--ink3); font-weight: 500;
  margin-bottom: 4px;
}
.dash-control select {
  height: 36px; padding: 0 28px 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff;
  font-size: 13px; color: var(--ink); cursor: pointer; min-width: 160px;
}
.dash-segmented { width: 200px; }
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card { padding: 18px; }
.kpi-label {
  font-size: 11px; color: var(--ink3);
  font-weight: 600; letter-spacing: 0.03em;
}
.kpi-value {
  font-size: 28px; font-weight: 700;
  margin-top: 6px; letter-spacing: -0.02em;
}
.kpi-sub { font-size: 11px; color: var(--ink2); margin-top: 2px; }
.charts-row {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.charts-row.row1 { grid-template-columns: 1.3fr 1fr; }
.charts-row.row2 { grid-template-columns: 1fr 1.2fr; }
.chart-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 14px;
}
.chart-head h3 { font-size: 16px; font-weight: 700; margin: 0; }
.chart-head .desc { font-size: 12px; color: var(--ink2); margin-top: 2px; }

.legend-row {
  display: flex; gap: 14px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--line2);
  flex-wrap: wrap;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink2);
}
.legend-swatch { width: 10px; height: 3px; border-radius: 2px; }

.donut-wrap {
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.donut-center {
  position: absolute; text-align: center;
}
.donut-center .label { font-size: 11px; color: var(--ink3); }
.donut-center .total {
  font-size: 26px; font-weight: 700; color: var(--navy);
  letter-spacing: -0.02em;
}
.donut-legend {
  display: flex; gap: 16px;
  margin-top: 14px; justify-content: center;
}
.donut-legend-item { display: flex; align-items: center; gap: 8px; }
.donut-legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.donut-legend-label { font-size: 13px; font-weight: 600; }
.donut-legend-pct { font-size: 11px; color: var(--ink2); }

/* ── Misc ────────────────────────────────────────────── */
.search-box {
  position: relative; width: 320px;
}
.search-box input {
  width: 100%; height: 42px;
  padding: 0 14px 0 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
  outline: none;
}
.search-box input:focus { border-color: var(--navy3); }
.search-box svg {
  position: absolute; left: 14px; top: 13px;
}

.bm-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.bm-btn.filled { background: #FEF3E6; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 1024px) {
  .container, .section, .topnav, .page-header, .active-filters, .browse-layout, .quickstrip, .detail-hero, .detail-tabs, .tab-content {
    padding-left: 24px; padding-right: 24px;
  }
  .quickstrip { margin-left: 24px; margin-right: 24px; }
  .topnav { padding: 16px 24px; }
  .browse-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .tracks-grid { grid-template-columns: repeat(4, 1fr); }
  .topscores-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-stats, .quick-stats-3 { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 40px 24px 32px; }
  .hero h1 { font-size: 40px; }
  .charts-row.row1, .charts-row.row2 { grid-template-columns: 1fr; }
  .two-col, .two-col-equal, .two-col-detail { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-items { display: none; }
  .result-grid { grid-template-columns: 1fr; }
  .tracks-grid { grid-template-columns: repeat(2, 1fr); }
  .topscores-grid { grid-template-columns: 1fr; }
  .quick-stats, .quick-stats-3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 32px; }
  .compare-row { grid-template-columns: 100px repeat(4, 1fr); font-size: 11px; }
  .quickstrip { grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 16px; }
  .quickstrip-cell { border-right: none; padding: 0; }
}

/* ============= Disclaimer Modal ============= */
.disclaimer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: dscFade .25s ease-out;
}
@keyframes dscFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes dscSlide { from { opacity: 0; transform: translateY(20px) scale(.95) } to { opacity: 1; transform: translateY(0) scale(1) } }
.disclaimer-card {
  background: #fff;
  border-radius: 20px;
  max-width: 540px;
  width: 100%;
  padding: 32px;
  box-shadow: 0 24px 64px -16px rgba(0,0,0,0.25);
  animation: dscSlide .35s cubic-bezier(0.16, 1, 0.3, 1);
}
.disclaimer-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #FEF3E6, #FFE4D2);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin-bottom: 20px;
}
.disclaimer-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.disclaimer-card p {
  font-size: 14.5px;
  color: var(--ink2);
  line-height: 1.7;
  margin: 0 0 12px;
}
.disclaimer-list {
  margin: 16px 0;
  padding: 14px 16px;
  background: var(--line2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.6;
}
.disclaimer-list strong { color: var(--ink); }
.disclaimer-actions {
  display: flex; gap: 10px;
  margin-top: 24px;
}
.disclaimer-actions .btn { flex: 1; }

/* ============= Responsive Improvements ============= */

/* ── Tablet (เพิ่มเติม) ── */
@media (max-width: 1024px) {
  .topscores-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .compare-summary { grid-template-columns: 1fr; }
  .hero-actions { flex-wrap: wrap; }
  .hero-actions .btn { flex: 1 1 auto; min-width: calc(50% - 6px); }
  .info-grid { grid-template-columns: 1fr; }
  .detail-tabs-row { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .detail-tabs-row::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }
  .detail-hero-row { flex-wrap: wrap; }
  .detail-actions { width: 100%; margin-top: 12px; }
}

/* ── Tablet กลาง (768-1024) ── */
@media (max-width: 900px) {
  .section { padding: 32px 24px; }
  .hero h1 { font-size: 36px; }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
  .timeline-row { flex-direction: column; }
  .timeline-info { max-width: 100%; }
  .timeline-track { width: 100%; height: auto; padding: 16px 0; }
}

/* ── Mobile ── */
@media (max-width: 640px) {
  body { font-size: 13px; }
  .topnav { padding: 12px 16px; gap: 8px; flex-wrap: wrap; }
  .brand-tag { display: none; }
  .nav-cta .btn { display: none; }
  .nav-cta .nav-icon-btn { display: flex; }
  .section { padding: 32px 16px; }
  .hero { padding: 32px 16px; }
  .hero h1 { font-size: 28px; line-height: 1.2; }
  .hero p { font-size: 15px; }
  .hero-actions { flex-direction: column; gap: 8px; }
  .hero-actions .btn { width: 100%; }
  .quick-stat-value { font-size: 24px; }
  .quick-stats { gap: 16px; margin-top: 32px; }
  .section h2 { font-size: 22px; }
  .section-desc { font-size: 13px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Detail page */
  .detail-hero { padding: 24px 16px; }
  .detail-hero h1 { font-size: 24px; }
  .detail-hero-uni { font-size: 14px; }
  .detail-hero-icon { width: 48px; height: 48px; }
  .quickstrip { margin-left: 16px; margin-right: 16px; padding: 14px; }
  .quickstrip-value { font-size: 18px; }
  .detail-tabs { padding: 0 16px; }
  .tab-btn { padding: 12px 14px; font-size: 13px; }
  .tab-content { padding: 24px 16px 48px; }

  /* Page header */
  .page-header { padding: 20px 16px 0; }
  .page-header h1 { font-size: 24px; }
  .page-header-row { flex-direction: column; gap: 12px; align-items: flex-start; }
  .browse-layout { padding: 8px 16px 32px; gap: 16px; }
  .active-filters { padding: 0 16px 12px; }

  /* Compare table */
  .compare-row { grid-template-columns: 80px repeat(4, minmax(80px, 1fr)); font-size: 10px; overflow-x: auto; }
  .compare-table { overflow-x: auto; }
  .compare-cell { padding: 10px 8px; }
  .compare-head-name { font-size: 11px; }

  /* Fit/Glossary pages — make 2-col grid stack to 1-col on mobile */
  .section > div[style*="grid-template-columns:1fr 1fr"],
  .section > div[style*="grid-template-columns: 1fr 1fr"],
  .section > div > div[style*="grid-template-columns:1fr 1fr"],
  .section > div > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .section > div[style*="grid-template-columns:repeat(3"],
  .section > div[style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Sticky nav bars (in glossary/fit pages) make wrap-friendly */
  div[style*="position:sticky"][style*="top:80px"] {
    top: 70px !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Disclaimer modal */
  .disclaimer-card { padding: 24px 20px; }
  .disclaimer-card h2 { font-size: 18px; }
  .disclaimer-actions { flex-direction: column; }

  /* Brand logo */
  .brand-name { font-size: 15px; }
  .brand-logo { width: 32px; height: 32px; }
}

/* ── เล็กมาก (Small phones) ── */
@media (max-width: 380px) {
  .hero h1 { font-size: 24px; }
  .quick-stats { grid-template-columns: 1fr; }
  .topscores-grid, .kpi-grid { grid-template-columns: 1fr; }
}

/* ── Touch optimization (no hover) ── */
@media (hover: none) and (pointer: coarse) {
  .card-hover:hover { transform: none; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
  .track-card:hover { transform: none; }
  .fac-card:hover { transform: none; }
}

/* ── เพิ่ม touch target ขนาดอย่างน้อย 44px (Apple HIG) ── */
@media (max-width: 640px) {
  .btn, .filter-chip, .nav-icon-btn, .bm-btn { min-height: 36px; }
  .filter-chip-active { min-height: 32px; }
}
