:root {
  --teal: #0d5c63;
  --teal-light: #1a8a94;
  --terracotta: #c45c3e;
  --cream: #faf7f2;
  --sand: #f0e8dc;
  --ink: #1e2a2e;
  --muted: #5c6b70;
  --white: #ffffff;
  --success: #2d8a5e;
  --shadow: 0 4px 20px rgba(13, 92, 99, 0.12);
  --radius: 12px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--terracotta); }

.site-header {
  background: linear-gradient(135deg, var(--teal) 0%, #0a4549 100%);
  color: var(--white);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
}

.site-header h1 { font-size: 1.6rem; font-weight: 700; }
.site-header p { opacity: 0.9; font-size: 0.95rem; margin-top: 0.25rem; }

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.header-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

.toggle-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}
.toggle-btn:hover, .toggle-btn.active { background: var(--terracotta); border-color: var(--terracotta); }

.semester-tabs { display: flex; gap: 0.5rem; margin-bottom: 2rem; flex-wrap: wrap; }

.tab-btn {
  padding: 0.6rem 1.2rem;
  border: 2px solid var(--sand);
  background: var(--white);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}
.tab-btn.active { background: var(--teal); border-color: var(--teal); color: var(--white); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.course-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
  cursor: pointer;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(13, 92, 99, 0.18); }
.course-card h3 { color: var(--teal); margin-bottom: 0.5rem; }
.course-card .code { font-size: 0.8rem; color: var(--terracotta); font-weight: 600; }
.course-card .meta { font-size: 0.85rem; color: var(--muted); margin: 0.75rem 0; }
.progress-bar { height: 6px; background: var(--sand); border-radius: 3px; overflow: hidden; margin-top: 0.75rem; }
.progress-fill { height: 100%; background: var(--teal-light); }

.lecture-list { display: flex; flex-direction: column; gap: 0.5rem; }

.lecture-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  cursor: pointer;
  border: 1px solid transparent;
}
.lecture-item:hover { border-color: var(--teal-light); }
.lecture-item.ready { border-left: 3px solid var(--success); }
.lecture-item.skeleton { opacity: 0.75; }
.lecture-num {
  background: var(--teal);
  color: var(--white);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.lecture-item.skeleton .lecture-num { background: var(--muted); }
.lecture-info { flex: 1; }
.lecture-info h4 { font-size: 0.95rem; }
.lecture-info .unit-tag { font-size: 0.75rem; color: var(--terracotta); font-weight: 600; }
.badge { font-size: 0.7rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-weight: 600; }
.badge-ready { background: #d4edda; color: var(--success); }
.badge-soon { background: var(--sand); color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-weight: 600; }

.lecture-header {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.lecture-header h2 { color: var(--teal); margin-bottom: 0.5rem; }
.lecture-header .objectives li { margin-left: 1.25rem; margin-bottom: 0.35rem; color: var(--muted); }

.timer-panel {
  background: var(--white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.timer-display { font-size: 2.5rem; font-weight: 700; color: var(--teal); text-align: center; margin: 1rem 0; }
.timer-segments { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.timer-seg {
  flex: 1; min-width: 100px; padding: 0.5rem; text-align: center;
  background: var(--sand); border-radius: 8px; font-size: 0.8rem; cursor: pointer;
  border: 2px solid transparent;
}
.timer-seg.active { border-color: var(--terracotta); background: #fff5f0; }
.timer-controls { display: flex; gap: 0.75rem; justify-content: center; }
.timer-controls button {
  padding: 0.6rem 1.5rem; border: none; border-radius: 8px;
  cursor: pointer; font-weight: 600;
}
.btn-primary { background: var(--teal); color: var(--white); }
.btn-secondary { background: var(--sand); color: var(--ink); }

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  background: var(--teal);
  color: var(--white);
  padding: 1rem 1.25rem;
  font-weight: 600;
}
.panel-body { padding: 1.25rem; }

.resource-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem; border-radius: 8px; margin-bottom: 0.5rem;
  background: var(--cream);
}
.resource-link:hover { background: var(--sand); }

.lecturer-only { display: none; }
body.lecturer-mode .lecturer-only { display: block; }

.speaker-notes {
  background: #fffef5;
  border: 1px solid #e8e0c8;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.speaker-notes h3 { color: var(--terracotta); margin-bottom: 1rem; }
.peaking-box {
  background: #fff5f0;
  border-left: 4px solid var(--terracotta);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 8px 8px 0;
}
.timeline-item {
  display: flex; gap: 1rem; padding: 0.75rem 0;
  border-bottom: 1px solid var(--sand);
}
.timeline-min { font-weight: 700; color: var(--teal); min-width: 50px; }
.timeline-seg { font-weight: 600; min-width: 140px; }
.timeline-notes { color: var(--muted); font-size: 0.9rem; }

.quiz-question { padding: 1.25rem; border-bottom: 1px solid var(--sand); }
.quiz-options label {
  display: block; padding: 0.6rem 0.75rem; margin: 0.35rem 0;
  border-radius: 8px; cursor: pointer; background: var(--cream);
}
.quiz-options label.correct { background: #d4edda; }
.quiz-options label.wrong { background: #f8d7da; }
.quiz-score { text-align: center; padding: 1.5rem; font-weight: 700; color: var(--teal); }

.assignment-box { background: var(--cream); padding: 1.25rem; border-radius: 8px; }
.copy-btn {
  margin-top: 0.75rem; padding: 0.5rem 1rem;
  background: var(--teal); color: var(--white); border: none;
  border-radius: 6px; cursor: pointer;
}

@media print {
  .site-header, .timer-panel, .header-actions, .back-link, .no-print { display: none !important; }
}
