/* === 🎨 全域設定 === */
:root {
  --primary: #2A7EBB;
  --accent: #F3F9FD;
  --success: #3BB273;
  --error: #D9534F;
  --warning: #F0AD4E;
  --border: #E0E6EC;
  --text: #333;
  --text-light: #777;
  --bg: #FAFBFC;
}

* {
  box-sizing: border-box;
  font-family: "Noto Sans TC", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

/* === 🧭 頁首 Header === */
.header {
  background: #2b579a;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  white-space: nowrap;
  overflow-x: auto;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
}

.header a:hover {
  opacity: 0.9;
}

.header .logo {
  font-size: 18px;
  font-weight: 700;
}

.header .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header .exp-bar {
  width: 150px;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.header .exp-fill {
  height: 100%;
  background: linear-gradient(90deg, #6ee27f, #4caf50);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-right a {
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.header-right a:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* === 🧱 卡片 === */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 16px 20px;
  margin-bottom: 16px;
}

/* === 📂 摺疊清單 === */
details {
  background: var(--accent);
  border-radius: 8px;
  margin: 10px 0;
  padding: 10px 16px;
}
details[open] {
  background: #fff;
  border: 1px solid var(--border);
}
summary {
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}

/* === 🎓 課程列 === */
.course {
  padding: 8px 0 8px 12px;
  border-left: 3px solid var(--primary);
}
.course.locked {
  opacity: 0.5;
  border-left-color: #aaa;
  cursor: not-allowed;
}
.course a {
  color: var(--text);
  text-decoration: none;
}
.course a:hover {
  color: var(--primary);
}

/* === ❓ 題庫區 === */
.question {
  margin-bottom: 12px;
}
.question p {
  margin: 0 0 6px 0;
  font-weight: 500;
}
.question ul {
  list-style: none;
  padding: 0;
}
.question li {
  background: #f9f9f9;
  padding: 6px 10px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.question li:hover {
  background: #eef6fd;
}
.question li.correct {
  background: #e8f9f0;
  border-color: var(--success);
}
.question li.wrong {
  background: #fde8e8;
  border-color: var(--error);
}
.question li.user-choice {
  border-color: var(--primary);
}

/* === 📝 心得輸入區 === */
textarea.reflection {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  padding: 10px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.counter {
  color: var(--text-light);
  margin-top: 4px;
  text-align: right;
}

/* === 📱 響應式調整 === */
@media (max-width: 1024px) {
  .header {
    flex-wrap: wrap;
    white-space: normal;
    gap: 8px;
    justify-content: center;
  }
  .header-right {
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .header .user-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .header-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-right a {
    background: rgba(255, 255, 255, 0.25);
    padding: 6px 10px;
    border-radius: 4px;
  }
  .card {
    padding: 12px 14px;
  }
}
