* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  background: linear-gradient(180deg, #f6f8fb 0%, #ecf0f7 100%);
  color: #1f2937;
  line-height: 1.55;
}
#app {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─── */
header {
  background: #fff;
  border-bottom: 2px solid #e5e7eb;
  padding: 20px 28px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.header-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
header h1 { font-size: 22px; color: #0f172a; letter-spacing: -0.3px;}
header .subtitle { color: #64748b; font-size: 13px; margin-top: 4px;}

.subject-switcher {
  display: flex; align-items: center; gap: 8px;
}
.subject-switcher label { font-size: 13px; color: #475569;}
.subject-switcher select {
  padding: 8px 14px; border: 2px solid #1d4ed8; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: #1d4ed8;
  background: #fff; cursor: pointer;
}
.subject-switcher select:focus { outline: 2px solid #93c5fd; outline-offset: 1px;}

nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding-bottom: 0;
}
nav button {
  border: none; background: transparent;
  padding: 10px 14px;
  font-size: 14px; cursor: pointer;
  border-bottom: 3px solid transparent;
  color: #475569;
  transition: all 0.15s;
}
nav button:hover { color: #0f172a; background: #f1f5f9;}
nav button.active {
  color: #1d4ed8; font-weight: 600;
  border-bottom-color: #1d4ed8;
  background: #eff6ff;
}

/* ─── Main ─── */
main {
  flex: 1;
  padding: 24px 28px;
}

/* ─── Cards / Common ─── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin-bottom: 12px; color: #0f172a;}
.card h3 { font-size: 15px; margin: 12px 0 8px; color: #1f2937;}

.tag { display: inline-block; padding: 2px 8px; font-size: 12px; border-radius: 999px; margin-right: 4px;}
.tag.lec { background: #e0e7ff; color: #3730a3;}
.tag.w5 { background: #fef2f2; color: #991b1b;}
.tag.w4 { background: #fef3c7; color: #92400e;}
.tag.w3 { background: #d1fae5; color: #065f46;}
.tag.w2 { background: #dbeafe; color: #1e40af;}
.tag.w1 { background: #f1f5f9; color: #475569;}
.tag.empty { background: #f1f5f9; color: #94a3b8;}

.btn {
  display: inline-block; padding: 10px 18px;
  background: #1d4ed8; color: #fff;
  border: none; border-radius: 8px; font-size: 14px;
  cursor: pointer; transition: background 0.15s;
}
.btn:hover { background: #1e40af;}
.btn.secondary { background: #e5e7eb; color: #1f2937;}
.btn.secondary:hover { background: #d1d5db;}
.btn.danger { background: #dc2626;}
.btn.success { background: #059669;}

/* ─── Dashboard ─── */
.dash-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.dash-stat {
  background: #fff; padding: 18px; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.dash-stat .num { font-size: 28px; font-weight: 700; color: #1d4ed8;}
.dash-stat .label { color: #64748b; font-size: 13px; margin-top: 4px;}
.dash-tip {
  background: #fffbeb; border-left: 4px solid #f59e0b;
  padding: 14px 18px; border-radius: 6px; font-size: 14px;
  color: #78350f;
}

/* ─── Subject overview cards on dashboard ─── */
.subject-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-top: 14px;
}
.subject-card {
  background: #fff; padding: 16px; border-radius: 10px;
  border: 2px solid #e5e7eb; cursor: pointer;
  transition: all 0.15s;
}
.subject-card:hover { border-color: #93c5fd; transform: translateY(-2px);}
.subject-card.active { border-color: #1d4ed8; background: #eff6ff;}
.subject-card h4 { font-size: 15px; color: #0f172a; margin-bottom: 6px;}
.subject-card .stat { font-size: 12px; color: #64748b;}

/* ─── Question UI ─── */
.q-meta { color: #64748b; font-size: 13px; margin-bottom: 6px;}
.q-text { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #0f172a;}
.q-choices { display: flex; flex-direction: column; gap: 8px;}
.q-choice {
  padding: 12px 16px; border: 2px solid #e5e7eb; border-radius: 8px;
  cursor: pointer; transition: all 0.12s; background: #fff;
}
.q-choice:hover { border-color: #93c5fd; background: #f0f9ff;}
.q-choice.selected { border-color: #1d4ed8; background: #dbeafe;}
.q-choice.correct { border-color: #059669; background: #d1fae5; color: #065f46;}
.q-choice.wrong { border-color: #dc2626; background: #fee2e2; color: #991b1b;}
.q-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap;}
.q-explain {
  margin-top: 14px; padding: 12px 16px;
  background: #f0fdf4; border-left: 4px solid #059669;
  border-radius: 6px; font-size: 14px; color: #14532d;
}

/* ─── Confusion pairs ─── */
.pair-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px;
}
.pair-side {
  border: 2px solid #e5e7eb; border-radius: 10px; padding: 14px 18px;
  background: #fff;
}
.pair-side.a { border-color: #93c5fd; background: #eff6ff;}
.pair-side.b { border-color: #fca5a5; background: #fef2f2;}
.pair-side h4 { margin-bottom: 8px; color: #0f172a;}
.pair-side ul { padding-left: 18px;}
.pair-side li { margin: 4px 0; font-size: 14px;}

@media (max-width: 640px) {
  .pair-grid { grid-template-columns: 1fr;}
  main { padding: 16px;}
  header { padding: 16px 16px 0;}
  .header-top { flex-direction: column; align-items: stretch;}
}

/* ─── Plan ─── */
.plan-day {
  background: #fff; border-radius: 10px; padding: 16px 20px;
  margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border-left: 4px solid #e5e7eb;
}
.plan-day.done { border-left-color: #059669; background: #f0fdf4;}
.plan-day.today { border-left-color: #1d4ed8; background: #eff6ff;}
.plan-day-head { display: flex; justify-content: space-between; align-items: center;}
.plan-day-head h3 { margin: 0;}
.plan-meta { color: #64748b; font-size: 13px;}
.plan-body { margin-top: 8px;}
.plan-body p { font-size: 14px; color: #475569;}

/* ─── Concept cards ─── */
.concept-filter {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.concept-filter button {
  padding: 6px 12px; border: 1px solid #e5e7eb; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.concept-filter button.active {
  background: #1d4ed8; color: #fff; border-color: #1d4ed8;
}
.concept-list { display: grid; gap: 10px;}
.concept-item {
  background: #fff; padding: 14px 18px; border-radius: 8px;
  border-left: 4px solid #93c5fd;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.concept-key { font-weight: 600; color: #1d4ed8; margin-bottom: 4px;}
.concept-value { color: #1f2937; font-size: 14px;}

/* ─── Empty/placeholder ─── */
.empty-state {
  text-align: center; padding: 40px 20px;
  background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 12px;
}
.empty-state h3 { color: #475569; margin-bottom: 8px;}
.empty-state p { color: #64748b; font-size: 14px;}

/* ─── Footer ─── */
footer {
  padding: 16px 28px; background: #fff; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: #64748b; flex-wrap: wrap; gap: 8px;
}
footer button {
  background: #f1f5f9; border: 1px solid #e5e7eb;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px;
}
footer button:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5;}

/* ─── Progress bar ─── */
.progress {
  height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden;
  margin: 8px 0;
}
.progress > div { height: 100%; background: linear-gradient(90deg, #1d4ed8, #059669); transition: width 0.3s;}
