* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  line-height: 1.45;
}
.hidden { display: none !important; }

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.login-card {
  width: 100%;
  max-width: 430px;
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.badge-gold {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.login-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-sub { font-size: 13.5px; color: #475569; margin-bottom: 18px; }
#login-form label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
#login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
}
#login-form button {
  width: 100%;
  padding: 13px;
  background: #0f172a;
  color: #facc15;
  font-weight: 800;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#login-form button:disabled { opacity: 0.6; cursor: wait; }
.login-error {
  margin-top: 10px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.login-hint { margin-top: 14px; font-size: 12px; color: #64748b; text-align: center; }

/* TOPBAR */
.topbar {
  background: #0f172a;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.2);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.brand-kicker { font-size: 10px; font-weight: 800; color: #facc15; letter-spacing: 0.8px; }
.brand-title { font-size: 17px; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.progress-pill {
  background: rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.progress-pill span { color: #facc15; }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #e2e8f0;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}
.tabs {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 12px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.tab {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: none;
  padding: 8px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: #facc15; color: #0f172a; }

/* MAIN */
.container { max-width: 1120px; margin: 0 auto; padding: 18px 14px 48px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.controls { margin-bottom: 16px; display: flex; flex-direction: column; gap: 10px; }
#search-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }

/* DECK CARDS */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}
.deck-card {
  background: #fff;
  border-radius: 14px;
  border: 1.5px solid #cbd5e1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.deck-card.mastered { border-color: #10b981; box-shadow: 0 6px 20px rgba(16, 185, 129, 0.14); }
.card-head {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
}
.card-pillar { font-size: 11px; font-weight: 800; text-transform: uppercase; }
.card-num { font-size: 11px; font-weight: 800; color: #fff; padding: 2px 8px; border-radius: 999px; }
.card-title { font-size: 16px; font-weight: 800; padding: 10px 14px 8px; }
.card-front img { width: 100%; height: 185px; object-fit: cover; display: block; }
.phonetic-box {
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 14px;
  font-size: 12.5px;
}
.phonetic-tag {
  display: inline-block;
  background: #facc15;
  color: #0f172a;
  font-weight: 800;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  margin-bottom: 5px;
}
.card-back { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.side-box { padding: 9px 11px; border-radius: 8px; }
.side-box h4 { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.side-box ul { margin-left: 16px; }
.side-box li { margin-bottom: 3px; font-size: 12.5px; }
.trap-mini {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #7f1d1d;
}
.card-actions {
  margin-top: auto;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}
.btn-flip {
  flex: 1;
  background: #0f172a;
  color: #facc15;
  border: none;
  padding: 9px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.btn-master {
  background: #e2e8f0;
  color: #0f172a;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-master.on { background: #10b981; color: #fff; }

/* QUIZ */
.quiz-summary, .section-head {
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.score-box { background: #0f172a; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 14px; }
.score-box strong { color: #facc15; }
.quiz-list { display: flex; flex-direction: column; gap: 12px; }
.q-item { background: #fff; border: 1px solid #cbd5e1; border-radius: 12px; padding: 14px; }
.q-topic { font-size: 11px; font-weight: 800; color: #1d4ed8; text-transform: uppercase; margin-bottom: 4px; }
.q-stem { font-weight: 700; margin-bottom: 10px; font-size: 14.5px; }
.q-options { display: flex; flex-direction: column; gap: 6px; }
.q-btn {
  text-align: left;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}
.q-btn.correct { background: #dcfce7; border-color: #16a34a; color: #14532d; font-weight: 700; }
.q-btn.wrong { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.q-exp { margin-top: 9px; background: #ecfdf5; color: #065f46; padding: 8px 10px; border-radius: 8px; font-size: 13px; }

/* PLAN */
.plan-list { display: flex; flex-direction: column; gap: 8px; }
.plan-item {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.plan-item.done { background: #f0fdf4; border-color: #86efac; }
.plan-item input { width: 18px; height: 18px; accent-color: #16a34a; }

/* PDFS */
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.pdf-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
}
.pdf-tag {
  align-self: flex-start;
  background: #0f172a;
  color: #facc15;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.pdf-card h3 { font-size: 16px; margin-bottom: 6px; }
.pdf-card p { font-size: 13px; color: #475569; margin-bottom: 14px; }
.pdf-cta { margin-top: auto; font-weight: 800; color: #1d4ed8; font-size: 13.5px; }
