/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #40826D;
  --primary-light: #5a9c87;
  --primary-dark: #2a5a4b;
  --accent: #10B981;
  --accent-light: #D1FAE5;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #FAF7F0;
  --card: #FFFFFF;
  --text: #1F2A24;
  --text-secondary: #6B6459;
  --text-light: #9C9689;
  --border: #EAE4D6;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --nav-height: 64px;
  --top-bar-height: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 900px) {
  body {
    background:
      radial-gradient(ellipse 60vw 40vh at 50% 0%, rgba(64, 130, 109, 0.07), transparent 70%),
      radial-gradient(ellipse 50vw 30vh at 50% 100%, rgba(64, 130, 109, 0.05), transparent 70%),
      var(--bg);
    background-attachment: fixed;
  }
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 900px) {
  #app {
    max-width: 720px;
    background: var(--card);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
  }
}

/* === TOP BAR === */
#top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  height: var(--top-bar-height);
}

#top-bar h1 {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  min-width: 36px;
}

.icon-btn:active {
  background: rgba(255,255,255,0.15);
}

.icon-btn.hidden {
  visibility: hidden;
}

.xp-badge {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
}

/* === MAIN CONTENT === */
#main-content {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  overflow-y: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === DASHBOARD === */
.dashboard-hero {
  text-align: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-lg);
  color: white;
  margin-bottom: 20px;
}

.level-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,0.4);
}

.level-icon {
  font-size: 2rem;
}

.dashboard-hero h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.xp-bar-container {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  height: 10px;
  overflow: hidden;
  margin: 0 20px;
}

.xp-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease;
  width: 0%;
}

.xp-label {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
}

.section-header {
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.next-chapter-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.next-chapter-card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-md);
}

.next-chapter-card .ncc-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.next-chapter-card .ncc-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.next-chapter-card .ncc-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
}

.next-chapter-card .ncc-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.next-chapter-card .ncc-cta {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

.badge-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  text-align: center;
}

.badge-item .badge-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.badge-item .badge-icon-circle.earned {
  background: linear-gradient(135deg, var(--warning), #F97316);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.badge-item .badge-icon-circle.locked {
  background: var(--border);
  filter: grayscale(100%);
  opacity: 0.5;
}

.badge-item .badge-name {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 72px;
}

.empty-state {
  color: var(--text-light);
  font-size: 0.85rem;
  font-style: italic;
  padding: 8px 0;
}

/* === CHAPTER LIST === */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chapter-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.chapter-card:active {
  transform: scale(0.98);
}

.chapter-card.completed {
  border-left: 4px solid var(--accent);
}

.chapter-card.current {
  border-left: 4px solid var(--primary);
}

.chapter-card .ch-icon {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.chapter-card .ch-info {
  flex: 1;
  min-width: 0;
}

.chapter-card .ch-num {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chapter-card .ch-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-card .ch-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chapter-card .ch-status {
  flex-shrink: 0;
  font-size: 1.2rem;
}

/* === CHAPTER CONTENT === */
.chapter-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.chapter-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--primary-dark);
}

.chapter-content p {
  margin-bottom: 12px;
  font-size: 0.92rem;
  line-height: 1.7;
}

.chapter-content ul, .chapter-content ol {
  margin: 8px 0 12px 20px;
  font-size: 0.9rem;
}

.chapter-content li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.info-card {
  background: #FBF9F3;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}

.info-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.key-terms {
  background: linear-gradient(135deg, #EEF5F1, #DCEAE2);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}

.key-terms h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--primary-dark);
}

.key-terms dl {
  font-size: 0.85rem;
}

.key-terms dt {
  font-weight: 700;
  color: var(--primary);
  margin-top: 8px;
}

.key-terms dd {
  color: var(--text-secondary);
  margin-left: 0;
  margin-bottom: 4px;
}

.content-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

/* === QUIZ === */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quiz-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.quiz-progress {
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.quiz-progress-bar-container {
  background: var(--border);
  border-radius: 6px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 24px;
}

.quiz-progress-bar {
  background: var(--primary);
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.quiz-question {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.quiz-option {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font-family: inherit;
  line-height: 1.5;
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: #EEF5F1;
}

.quiz-option.correct {
  border-color: var(--accent);
  background: var(--accent-light);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: #FEE2E2;
}

.quiz-option.disabled {
  pointer-events: none;
}

.quiz-feedback {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent);
  font-size: 0.88rem;
  line-height: 1.5;
}

.quiz-feedback.incorrect-fb {
  border-left-color: var(--danger);
}

.quiz-feedback.hidden {
  display: none;
}

/* === QUIZ RESULTS === */
.results-container {
  text-align: center;
  padding: 32px 16px;
}

.results-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.results-container h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.results-score {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.results-xp {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 20px;
}

.results-badges {
  margin-bottom: 24px;
}

.results-badge-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === CHECKLIST === */
#view-checklist h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.checklist-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.checklist-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.checklist-progress-bar-container {
  flex: 1;
  background: var(--border);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}

.checklist-progress-bar {
  background: var(--accent);
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

#checklist-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 36px;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.15s;
}

.checklist-item:active {
  transform: scale(0.98);
}

.checklist-item.checked {
  opacity: 0.7;
}

.checklist-item.checked .cl-text {
  text-decoration: line-through;
  color: var(--text-light);
}

.cl-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.2s;
  margin-top: 1px;
}

.checklist-item.checked .cl-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.cl-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* === BADGES VIEW === */
#view-badges h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
  text-align: center;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.badge-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}

.badge-card.earned {
  border: 2px solid var(--warning);
}

.badge-card.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.badge-card .bc-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.badge-card .bc-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.badge-card .bc-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* === BUTTONS === */
.btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-align: center;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-lg {
  padding: 16px 24px;
  font-size: 1rem;
}

/* === BOTTOM NAV === */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

@media (min-width: 900px) {
  #bottom-nav {
    max-width: 720px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.06);
  }
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.15s;
  font-family: inherit;
  padding: 0;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 1.4rem;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: all 0.3s;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* === PWA INSTALL BANNER === */
.install-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  width: calc(100% - 16px);
  max-width: 464px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.install-banner.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.install-banner.hidden {
  display: none;
}

.install-banner-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.install-banner-body {
  flex: 1;
  min-width: 0;
}

.install-banner-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 2px;
}

.install-banner-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.install-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.install-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.install-btn:active {
  transform: scale(0.97);
}

.install-btn-primary {
  background: var(--primary);
  color: white;
}

.install-btn-primary:hover {
  background: var(--primary-dark);
}

.install-btn-secondary {
  background: transparent;
  color: var(--text-secondary);
}

.install-btn-secondary:hover {
  color: var(--text);
}

@media (min-width: 900px) {
  .install-banner {
    max-width: 480px;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  }
}

/* === iOS INSTALL MODAL === */
.ios-install-modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 42, 36, 0.55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ios-install-modal.visible {
  opacity: 1;
}

.ios-install-modal.hidden {
  display: none;
}

.ios-install-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  max-width: 380px;
  width: 100%;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.ios-install-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.ios-install-close:hover {
  color: var(--text);
}

.ios-install-content h3 {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  padding-right: 24px;
}

.ios-install-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ios-install-steps li {
  margin-bottom: 8px;
}

.ios-install-steps strong {
  color: var(--text);
}
.hidden {
  display: none !important;
}

/* === TRACKER === */
.tracker-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.tracker-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.tracker-form select,
.tracker-form input[type=date] {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

.tracker-form select:focus,
.tracker-form input[type=date]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(64, 130, 109, 0.12);
}

.tracker-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.tracker-phase {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.tracker-phase.completed {
  opacity: 0.62;
  background: #F7F4EC;
}

.tracker-phase.current {
  border: 2px solid var(--primary);
  background: linear-gradient(135deg, #EEF5F1, #FFFFFF);
  box-shadow: var(--shadow-md);
}

.tracker-phase.future {
  background: var(--card);
}

.tracker-phase-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--primary);
  font-size: 1.3rem;
  font-weight: 800;
}

.tracker-phase.completed .tracker-phase-icon {
  background: var(--accent-light);
  color: var(--accent);
}

.tracker-phase.current .tracker-phase-icon {
  background: var(--primary);
  color: white;
}

.tracker-phase-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.tracker-phase-date {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tracker-phase-note {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #FBF9F3;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.45;
}

.tracker-disclaimer {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #FEF3C7;
  color: #7C4A03;
  font-size: 0.82rem;
  line-height: 1.5;
}

.tracker-disclaimer a {
  color: var(--primary-dark);
  font-weight: 700;
}


/* ============ Serpentine phase chart ============ */
.serpentine-wrap {
  width: 100%;
  margin: 8px 0 16px;
  padding: 10px 10px 6px;
  background: #fff;
  border: 1px solid #e5dfd2;
  border-radius: 16px;
  box-shadow: 0 2px 6px rgba(64, 130, 109, 0.06);
}
.serpentine-mini-wrap {
  padding: 10px 12px 6px;
  margin: 4px 0 12px;
}
.serpentine-wrap.hidden { display: none; }
.serpentine {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* Connector segments */
.serp-seg {
  stroke-width: 1.6;
  stroke-linecap: round;
  fill: none;
}
.serpentine.mini .serp-seg { stroke-width: 1.4; }
.serp-seg-completed { stroke: var(--primary); }
.serp-seg-current   { stroke: #d69339; stroke-dasharray: 2 1.5; }
.serp-seg-future    { stroke: #d8d1c0; }

/* Nodes */
.serp-node {
  stroke-width: 1.4;
  transition: transform 0.15s ease;
}
.serp-node-completed {
  fill: var(--primary);
  stroke: var(--primary-dark);
}
.serp-node-current {
  fill: #e8a94a;
  stroke: #a76b18;
  filter: drop-shadow(0 0 3px rgba(232, 169, 74, 0.55));
  animation: serpPulse 1.8s ease-in-out infinite;
}
.serp-node-future {
  fill: #f5f0e2;
  stroke: #bfb8a5;
}
@keyframes serpPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); transform-origin: center; }
}
/* SVG scale animation needs transform-origin trick — override via CSS var */
.serp-node-current { transform-box: fill-box; transform-origin: center; }

/* Text inside / below nodes */
.serp-num, .serp-check {
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
  pointer-events: none;
}
.serp-num { font-size: 4.2px; }
.serp-num.mini { font-size: 3.4px; }
.serp-num-completed, .serp-num-current, .serp-check { fill: #fff; }
.serp-num-future { fill: #8a8371; }
.serp-check { font-size: 5px; }
.serp-check.mini { font-size: 4px; }

.serp-label {
  text-anchor: middle;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 3.1px;
  font-weight: 600;
  pointer-events: none;
}
.serp-label-completed { fill: var(--primary-dark); }
.serp-label-current   { fill: #7a4d0d; }
.serp-label-future    { fill: #9a927e; }

/* Tracker page: legend + hint */
.serpentine-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0 6px;
  font-size: 12px;
  color: #6b6551;
}
.serp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.serp-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  display: inline-block;
}
.serp-legend-dot.serp-node-completed { background: var(--primary); border-color: var(--primary-dark); }
.serp-legend-dot.serp-node-current   { background: #e8a94a; border-color: #a76b18; }
.serp-legend-dot.serp-node-future    { background: #f5f0e2; border-color: #bfb8a5; }
.serpentine-hint {
  text-align: center;
  font-size: 12px;
  color: #8a8371;
  margin: 2px 0 12px;
  font-style: italic;
}

@media (min-width: 900px) {
  .serpentine-wrap { padding: 18px; }
}


/* Snapshot card (dashboard) - serpentine as the full card body */
.snapshot-card {
  background: #fff;
  border: 1px solid #e5dfd2;
  border-radius: 20px;
  padding: 10px 14px 12px;
  margin-bottom: 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(64, 130, 109, 0.08);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.snapshot-card:hover {
  box-shadow: 0 4px 14px rgba(64, 130, 109, 0.16);
  transform: translateY(-1px);
}
.snapshot-serpentine {
  width: 100%;
  margin-bottom: 6px;
}
.snapshot-caption {
  text-align: center;
  color: #5c5644;
  font-size: 14px;
  margin: 4px 0 2px;
}
.snapshot-caption strong { color: var(--primary-dark); }
.snapshot-cta {
  display: block;
  text-align: center;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  margin-top: 4px;
}

@media (min-width: 900px) {
  .snapshot-card { padding: 14px 18px 14px; }
}


/* === Self-sponsorship readiness assessment === */
.assessment-form h3 { margin-top: 20px; font-size: 1.05rem; }
.assessment-form label {
  display: block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.assessment-form input[type="text"],
.assessment-form input[type="number"],
.assessment-form select,
.assessment-form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  resize: vertical;
}
.assessment-form textarea { min-height: 60px; }
.assessment-form textarea.assess-achievement { margin-bottom: 8px; }
.assessment-form .assess-help {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 4px 0 8px;
}
.assessment-form .assessment-lede {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.assessment-form .btn-add-achievement {
  margin-top: 4px;
  font-size: 0.85rem;
  padding: 6px 12px;
}
.assessment-disclaimer {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}
.assessment-loading {
  text-align: center;
  padding: 40px 20px;
}
.assessment-spinner {
  width: 44px; height: 44px;
  margin: 0 auto 16px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: pc-spin 0.9s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

.verdict-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  border-left: 4px solid var(--text-light);
  background: #fff;
  box-shadow: var(--shadow);
}
.verdict-banner.verdict-strong { border-left-color: var(--accent); background: var(--accent-light); }
.verdict-banner.verdict-medium { border-left-color: var(--warning); background: #FEF3C7; }
.verdict-banner.verdict-weak   { border-left-color: var(--danger);  background: #FEE2E2; }
.verdict-emoji { font-size: 1.8rem; line-height: 1; }
.verdict-label { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.verdict-summary { font-size: 0.9rem; color: var(--text); }

.assess-gates {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.assess-gate {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}
.assess-gate-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  background: var(--text-light);
}
.assess-gate-green .assess-gate-dot  { background: var(--accent); }
.assess-gate-yellow .assess-gate-dot { background: var(--warning); }
.assess-gate-red .assess-gate-dot    { background: var(--danger); }
.assess-gate-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.assess-gate-reason { font-size: 0.88rem; color: var(--text-secondary); }

.assess-criteria { list-style: none; padding: 0; margin: 0 0 18px; }
.assess-crit {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: #fff;
}
.assess-crit-documented { background: #F0FDF4; border-color: #A7F3D0; }
.assess-crit-partial    { background: #FFFBEB; border-color: #FDE68A; }
.assess-crit-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.assess-crit-icon { font-size: 1.05rem; }
.assess-crit-label { font-weight: 600; font-size: 0.92rem; }
.assess-crit-quote {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 4px 0 4px 10px;
  border-left: 2px solid var(--border);
  margin: 4px 0;
}
.assess-crit-gap { font-size: 0.85rem; color: var(--text-secondary); }

.assess-top-gaps { padding-left: 20px; }
.assess-top-gaps li { margin-bottom: 6px; font-size: 0.92rem; }

.assess-confidence {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 12px;
}


/* Letter-plan row: three numeric fields side-by-side on wide screens */
.assess-letters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.assess-letters-row label {
  margin-top: 0;
  font-size: 0.85rem;
}
@media (max-width: 520px) {
  .assess-letters-row { grid-template-columns: 1fr; }
}
