:root {
  --blue: #002395;
  --red: #ED2939;
  --white: #FAFAF8;
  --blue-light: #E8EBF8;
  --blue-mid: #3A52B4;
  --red-light: #FDEAEC;
  --red-mid: #C41F2E;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --surface: #ffffff;
  --bg: #f5f4f0;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}

/* TOP BAR */
.topbar {
  background: var(--surface);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--red);
}

.flag-stripe {
  display: flex;
  gap: 3px;
  align-items: center;
}

.flag-stripe div {
  width: 5px;
  height: 18px;
  border-radius: 2px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  letter-spacing: 0.5px;
  border: 2px solid var(--blue-mid);
  transition: transform 0.15s;
}

.avatar:hover { transform: scale(1.05); }

/* MAIN SCROLL */
.main {
  padding: 0 0 80px;
  overflow-y: auto;
}

/* HERO / PROGRESS SECTION */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
  padding: 24px 20px 28px;
  color: white;
}

.hero-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 6px;
}

.hero-title {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

.progress-wrap {
  background: rgba(255,255,255,0.15);
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, #ffffff 0%, #E8C4C8 100%);
  width: 0%;
  transition: width 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.8;
}

.progress-pct {
  font-weight: 600;
  font-size: 14px;
  opacity: 1;
}

/* SECTIONS */
.section {
  padding: 20px 20px 0;
}

.section-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* LESSONS */
.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-item {
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
  cursor: pointer;
}

.lesson-item:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.lesson-item.locked { opacity: 0.5; cursor: default; }
.lesson-item.locked:hover { transform: none; box-shadow: none; }

.lesson-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.lesson-icon.done { background: #E8F4EC; }
.lesson-icon.active { background: var(--blue-light); }
.lesson-icon.locked { background: #f3f4f6; }

.lesson-info { flex: 1; min-width: 0; }

.lesson-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lesson-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.lesson-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  flex-shrink: 0;
}

.badge-done { background: #E8F4EC; color: #166534; }
.badge-active { background: var(--blue-light); color: var(--blue); }
.badge-locked { background: #f3f4f6; color: var(--muted); }

/* HOMEWORK UPLOAD */
.upload-zone {
  border: 2px dashed var(--blue-mid);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  background: var(--blue-light);
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 12px;
}

.upload-zone:hover { background: #dce1f4; }

.upload-icon {
  font-size: 32px;
  margin-bottom: 10px;
}

.upload-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 4px;
}

.upload-sub {
  font-size: 12px;
  color: var(--blue-mid);
}

.submitted-file {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  width: 38px;
  height: 38px;
  background: var(--red-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.file-info { flex: 1; }

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.file-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.file-status {
  font-size: 11px;
  font-weight: 600;
  color: #166534;
  background: #E8F4EC;
  padding: 4px 10px;
  border-radius: 100px;
}

/* FEEDBACK */
.feedback-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.feedback-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.teacher-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0%, #c41f2e 100%);
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.teacher-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.teacher-role {
  font-size: 11px;
  color: var(--muted);
}

.feedback-timestamp {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.feedback-body {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.feedback-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.feedback-highlight {
  background: var(--blue-light);
  color: var(--blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.reply-area {
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.reply-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: var(--bg);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  min-height: 40px;
}

.reply-input:focus { border-color: var(--blue-mid); }

.reply-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
}

.reply-btn:hover { background: var(--blue-mid); }
.reply-btn:active { transform: scale(0.95); }

.reply-btn svg { width: 16px; height: 16px; fill: white; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 8px 0 12px;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 0;
  transition: transform 0.15s;
}

.nav-item:hover { transform: translateY(-1px); }

.nav-icon {
  font-size: 20px;
  transition: transform 0.2s;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.nav-item.active .nav-icon { filter: none; }
.nav-item.active .nav-label { color: var(--blue); font-weight: 600; }

.nav-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blue);
  position: absolute;
  bottom: 4px;
  display: none;
}

.nav-item.active .nav-dot { display: block; }

/* DIVIDER */
.divider { height: 20px; }

/* TOAST */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--text);
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 100px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}

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