/* ===== Quiz Styles ===== */

/* --- Quiz Container --- */
.quiz-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 100px;
}

.quiz-header {
  text-align: center;
  padding: 20px 0 24px;
}
.quiz-header .quiz-day {
  font-size: 13px; color: var(--gray);
  letter-spacing: 2px; margin-bottom: 4px;
}
.quiz-header .quiz-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px; font-weight: 700;
  margin-bottom: 12px;
}
.quiz-progress-dots {
  display: flex; justify-content: center; gap: 8px;
}
.quiz-dot {
  width: 10px; height: 10px;
  border-radius: 50%; background: var(--border);
  transition: all .3s ease;
}
.quiz-dot.answered { background: var(--accent-light); }
.quiz-dot.current { background: var(--accent); transform: scale(1.3); }

/* --- Question Card --- */
.question-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  margin: 20px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.question-num {
  font-size: 12px; font-weight: 700;
  color: var(--accent); letter-spacing: 2px;
  margin-bottom: 8px;
}
.question-text {
  font-size: 16px; font-weight: 500;
  line-height: 1.8; margin-bottom: 20px;
  color: var(--ink);
}

/* --- Options --- */
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
  text-align: left;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14.5px; line-height: 1.6;
  color: var(--ink);
}
.option-btn:hover { border-color: var(--accent-light); background: var(--accent-pale); }
.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-pale);
  font-weight: 600;
}
.option-letter {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--gray);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  transition: all .2s ease;
}
.option-btn.selected .option-letter {
  background: var(--accent); color: #fff;
}
.option-content { flex: 1; padding-top: 2px; }

/* --- Quiz Nav --- */
.quiz-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 64px; background: #fff;
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  z-index: 100;
}
.quiz-nav-prev, .quiz-nav-next {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: var(--transition);
}
.quiz-nav-prev:hover, .quiz-nav-next:hover { background: var(--accent-pale); }
.quiz-nav-prev:disabled, .quiz-nav-next:disabled {
  color: var(--border); cursor: default;
}
.quiz-nav-prev:disabled:hover, .quiz-nav-next:disabled:hover { background: #fff; }
.quiz-nav-submit {
  flex: 1; padding: 12px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  letter-spacing: 2px;
}
.quiz-nav-submit:hover { background: var(--accent-light); }
.quiz-nav-submit:disabled { background: var(--border); cursor: default; }
.quiz-nav-counter {
  flex: 1; text-align: center;
  font-size: 13px; color: var(--gray);
}

/* ===== Quiz Result ===== */
.quiz-result-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.result-hero {
  text-align: center;
  padding: 32px 20px;
}
.result-icon {
  font-size: 64px;
  margin-bottom: 12px;
  animation: resultPop .5s ease;
}
@keyframes resultPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.result-score {
  font-family: 'Noto Serif SC', serif;
  font-size: 36px; font-weight: 900;
  color: var(--ink);
}
.result-label {
  font-size: 14px; color: var(--gray);
  margin-top: 4px;
}
.result-pass {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 14px; font-weight: 700;
  margin-top: 12px;
}
.result-pass.passed { background: #e8f5e9; color: var(--green); }
.result-pass.failed { background: #fef2f0; color: var(--red); }

/* Review list */
.review-list { margin: 24px 0; }
.review-item {
  background: #fff;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.review-item-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
}
.review-icon {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.review-icon.correct { background: var(--green); }
.review-icon.wrong { background: var(--red); }
.review-q {
  flex: 1; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.review-expand { color: var(--border); font-size: 14px; }
.review-detail {
  display: none;
  padding: 0 16px 14px;
  font-size: 13px; line-height: 1.7;
  color: var(--gray);
}
.review-detail.show { display: block; }
.review-detail .your-answer { color: var(--red); font-weight: 600; }
.review-detail .correct-answer { color: var(--green); font-weight: 600; }
.review-detail .explanation {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--accent-pale);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
}

/* Result actions */
.result-actions {
  display: flex; gap: 12px;
  margin-top: 24px;
}
.result-actions button {
  flex: 1; padding: 14px;
  border-radius: 10px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  border: none;
}
.btn-retry {
  background: var(--paper-deep); color: var(--accent);
  border: 1px solid var(--border) !important;
}
.btn-retry:hover { background: var(--accent-pale); }
.btn-continue {
  background: var(--accent); color: #fff;
}
.btn-continue:hover { background: var(--accent-light); }

/* ===== Settings ===== */
.settings-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.settings-section {
  margin-bottom: 28px;
}
.settings-section h3 {
  font-family: 'Noto Serif SC', serif;
  font-size: 17px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.mode-card {
  padding: 16px 18px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 14px;
}
.mode-card:hover { border-color: var(--accent-light); }
.mode-card.active {
  border-color: var(--accent);
  background: var(--accent-pale);
}
.mode-icon {
  font-size: 24px; flex-shrink: 0;
}
.mode-info h4 {
  font-size: 15px; font-weight: 700;
  margin-bottom: 2px;
}
.mode-info p {
  font-size: 12px; color: var(--gray);
  margin: 0;
}

/* Badges display */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.badge-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
}
.badge-card .badge-icon { font-size: 28px; margin-bottom: 6px; }
.badge-card .badge-count {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px; font-weight: 900;
  color: var(--accent);
}
.badge-card .badge-label {
  font-size: 11px; color: var(--gray);
}

/* Danger zone */
.danger-btn {
  display: block; width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid #e8a99a;
  border-radius: 8px;
  color: var(--red);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
  transition: var(--transition);
}
.danger-btn:hover { background: #fef2f0; }

/* ===== Day Item Enhancements ===== */
.day-item.locked {
  opacity: 0.5;
  cursor: default !important;
}
.day-item.locked:hover {
  border-color: transparent !important;
  background: #fff !important;
}
.quiz-star {
  color: #e0a030;
  font-size: 14px;
  margin-left: 4px;
}

/* Quiz prompt badge on lecture nav */
.nav-quiz {
  background: var(--accent) !important;
  color: #fff !important;
}
.nav-quiz:hover { background: var(--accent-light) !important; }
.nav-quiz.hidden { display: none !important; }

/* Badge popup */
.badge-popup {
  position: fixed; inset: 0;
  background: rgba(26,20,16,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.badge-popup-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
  animation: popIn .4s ease;
}
@keyframes popIn {
  0% { transform: scale(.8) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.badge-popup-icon { font-size: 56px; margin-bottom: 12px; }
.badge-popup-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px; font-weight: 700;
  margin-bottom: 8px;
}
.badge-popup-desc { font-size: 14px; color: var(--gray); margin-bottom: 20px; }
.badge-popup-close {
  padding: 10px 32px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}

/* Stats bar on home */
.home-badges {
  display: flex; justify-content: center; gap: 16px;
  padding: 0 20px 16px;
  font-size: 13px; color: var(--gray);
}
.home-badges span { display: flex; align-items: center; gap: 4px; }

/* Settings button in header */
.settings-btn {
  width: 36px; height: 36px;
  border: none; background: rgba(255,255,255,.1);
  color: var(--accent-light);
  border-radius: 8px; cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.settings-btn:hover { background: rgba(255,255,255,.2); }

/* ===== Paywall ===== */
.paywall-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px 28px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 12px 48px rgba(0,0,0,.3);
  animation: popIn .4s ease;
  position: relative;
}
.paywall-close {
  position: absolute; top: 12px; right: 16px;
  font-size: 24px; color: var(--gray);
  cursor: pointer; line-height: 1;
}
.paywall-close:hover { color: var(--ink); }
.paywall-icon { font-size: 48px; text-align: center; margin-bottom: 12px; }
.paywall-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 22px; font-weight: 700;
  text-align: center; margin-bottom: 8px;
}
.paywall-desc {
  font-size: 14px; color: var(--gray);
  text-align: center; line-height: 1.6;
  margin-bottom: 16px;
}
.paywall-price {
  text-align: center;
  margin-bottom: 16px;
  display: flex; align-items: baseline;
  justify-content: center; gap: 8px;
}
.paywall-original {
  font-size: 16px; color: var(--gray);
  text-decoration: line-through;
}
.paywall-current {
  font-family: 'Noto Serif SC', serif;
  font-size: 36px; font-weight: 900;
  color: var(--red);
}
.paywall-tag {
  font-size: 11px; font-weight: 700;
  color: #fff; background: var(--red);
  padding: 2px 8px; border-radius: 10px;
}
.paywall-features {
  background: var(--paper);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.paywall-feat {
  font-size: 14px; color: var(--green);
  padding: 3px 0;
}
.paywall-input-wrap {
  display: flex; gap: 8px;
  margin-bottom: 8px;
}
.paywall-input {
  flex: 1; padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px; text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  transition: border-color .2s;
}
.paywall-input:focus { border-color: var(--accent); }
.paywall-activate-btn {
  padding: 12px 20px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 8px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.paywall-activate-btn:hover { background: var(--accent-light); }
.paywall-msg {
  font-size: 13px; text-align: center;
  min-height: 20px; padding: 4px 0;
}
.paywall-msg.error { color: var(--red); }
.paywall-msg.success { color: var(--green); font-weight: 700; }
.paywall-msg.info { color: var(--accent); line-height: 1.6; }
.paywall-buy-hint {
  text-align: center;
  font-size: 13px; color: var(--gray);
  margin-top: 12px; line-height: 1.6;
}
.paywall-buy-link {
  color: var(--accent); font-weight: 600;
  text-decoration: none;
}
.paywall-buy-link:hover { text-decoration: underline; }

/* Paywall tabs */
.paywall-tabs {
  display: flex; gap: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}
.paywall-tab {
  flex: 1; padding: 10px;
  border: none; background: var(--paper);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--gray); cursor: pointer;
  transition: all .2s;
}
.paywall-tab.active {
  background: var(--accent); color: #fff;
}
.pay-tab-content { display: none; }
.pay-tab-content.active { display: block; }

/* Pay methods */
.pay-methods {
  display: flex; gap: 12px;
  margin-bottom: 14px;
}
.pay-method {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: all .2s;
}
.pay-method:hover { border-color: var(--accent-light); background: var(--accent-pale); }
.pay-method-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900;
  flex-shrink: 0;
}

/* Pay QR */
.pay-qr-card { text-align: center; }
.pay-qr-placeholder {
  width: 180px; height: 180px;
  border: 3px dashed var(--border);
  border-radius: 12px;
  margin: 0 auto 14px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--paper);
}
.pay-qr-text { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.pay-qr-hint { font-size: 11px; color: var(--gray); line-height: 1.5; }
.pay-qr-steps { text-align: left; margin: 0 auto; max-width: 280px; }
.pay-step {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--gray);
  padding: 4px 0; line-height: 1.5;
}
.step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0; margin-top: 1px;
}
.pay-qr-note {
  font-size: 12px; color: var(--green);
  margin-top: 10px; font-weight: 600;
}

/* Paywall lock icon in day list */
.day-item.locked .day-check { color: var(--gray); font-size: 12px; }

/* ===== Mode Selection Overlay ===== */
#mode-selection-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: linear-gradient(180deg, #1a1410 0%, #2d2117 40%, #3a2c1e 100%);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .5s ease;
}
.ms-container {
  text-align: center;
  padding: 32px 16px;
  max-width: 500px;
  width: 100%;
}
.ms-icon { margin-bottom: 16px; }
.ms-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 32px; font-weight: 900;
  color: #fff; letter-spacing: 8px;
  margin-bottom: 6px;
}
.ms-subtitle {
  font-size: 14px; color: #c4915e;
  margin-bottom: 0;
}
.ms-divider {
  width: 60px; height: 2px;
  background: #c4915e;
  margin: 24px auto;
  border-radius: 1px;
}
.ms-prompt {
  font-family: 'Noto Serif SC', serif;
  font-size: 20px; font-weight: 700;
  color: #f9f5ef;
  margin-bottom: 6px;
}
.ms-hint {
  font-size: 13px; color: #7a7268;
  margin-bottom: 24px;
}
.ms-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.ms-card {
  background: rgba(255,255,255,.06);
  border: 2px solid rgba(196,145,94,.25);
  border-radius: 14px;
  padding: 24px 20px 20px;
  cursor: pointer;
  transition: all .3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ms-card:hover {
  border-color: #c4915e;
  background: rgba(255,255,255,.1);
  transform: translateY(-3px);
}
.ms-card.ms-selected {
  border-color: #c4915e;
  background: rgba(196,145,94,.2);
  transform: scale(1.03);
}
.ms-card-icon {
  font-size: 40px;
  margin-bottom: 10px;
  height: 48px;
  display: flex; align-items: center; justify-content: center;
}
.ms-card-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 18px; font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  height: 28px;
  display: flex; align-items: center;
}
.ms-card-desc {
  font-size: 13px; color: #b8a99a;
  line-height: 1.6;
  margin-bottom: 12px;
  height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.ms-card-list {
  text-align: left;
  padding-left: 16px;
  margin: 0;
  font-size: 12px; color: #8a7e72;
  line-height: 1.9;
  width: 100%;
  flex: 1;
}
.ms-card-list li { margin-bottom: 2px; }

/* ===== Mobile Responsive ===== */
@media (max-width: 414px) {
  /* Quiz */
  .quiz-container { padding: 16px 14px 90px; }
  .quiz-header .quiz-title { font-size: 18px; }
  .quiz-progress-dots { gap: 5px; flex-wrap: wrap; }
  .quiz-dot { width: 8px; height: 8px; }
  .question-card { padding: 16px 14px; margin: 14px 0; }
  .question-text { font-size: 14px; line-height: 1.7; margin-bottom: 14px; }
  .option-btn { padding: 10px 12px; gap: 8px; font-size: 13px; line-height: 1.5; }
  .option-letter { width: 24px; height: 24px; font-size: 12px; }
  .quiz-nav { height: 56px; padding: 0 12px; gap: 8px; }
  .quiz-nav-prev, .quiz-nav-next { padding: 8px 12px; font-size: 13px; }
  .quiz-nav-submit { font-size: 14px; padding: 10px; }

  /* Quiz Result */
  .quiz-result-container { padding: 16px 14px 32px; }
  .result-hero { padding: 20px 14px; }
  .result-icon { font-size: 48px; }
  .result-score { font-size: 28px; }
  .review-item-header { padding: 10px 12px; }
  .review-q { font-size: 12px; }
  .review-detail { padding: 0 12px 10px; font-size: 12px; }
  .result-actions { gap: 8px; }
  .result-actions button { padding: 12px; font-size: 14px; }

  /* Settings */
  .settings-container { padding: 16px 14px 32px; }
  .settings-section h3 { font-size: 15px; }
  .mode-card { padding: 12px 14px; gap: 10px; }
  .mode-info h4 { font-size: 14px; }
  .mode-info p { font-size: 11px; }
  .badges-grid { gap: 8px; }
  .badge-card { padding: 12px 8px; }
  .badge-card .badge-count { font-size: 18px; }
  .badge-card .badge-label { font-size: 10px; }

  /* Paywall */
  .paywall-card { padding: 24px 16px 20px; border-radius: 16px; }
  .paywall-title { font-size: 18px; }
  .paywall-desc { font-size: 13px; }
  .paywall-current { font-size: 30px; }
  .paywall-features { padding: 10px 12px; }
  .paywall-feat { font-size: 13px; }
  .paywall-input { padding: 10px 12px; font-size: 14px; }
  .paywall-activate-btn { padding: 10px 16px; font-size: 14px; }
  .pay-qr-placeholder { width: 150px; height: 150px; }
  .pay-step { font-size: 12px; }

  /* Mode Selection */
  .ms-container { padding: 24px 12px; }
  .ms-title { font-size: 24px; letter-spacing: 4px; }
  .ms-subtitle { font-size: 12px; }
  .ms-divider { margin: 16px auto; }
  .ms-prompt { font-size: 17px; }
  .ms-hint { font-size: 12px; margin-bottom: 16px; }
  .ms-cards { gap: 10px; }
  .ms-card { padding: 16px 12px 14px; border-radius: 10px; }
  .ms-card-icon { font-size: 32px; height: 40px; margin-bottom: 6px; }
  .ms-card-title { font-size: 15px; height: auto; margin-bottom: 6px; }
  .ms-card-desc { font-size: 11px; height: auto; margin-bottom: 8px; }
  .ms-card-list { font-size: 11px; line-height: 1.7; padding-left: 14px; }

  /* Badge popup */
  .badge-popup-card { padding: 24px 20px; }
  .badge-popup-icon { font-size: 44px; }
  .badge-popup-title { font-size: 17px; }
}

@media (max-width: 380px) {
  .ms-cards { grid-template-columns: 1fr; gap: 10px; }
  .ms-title { font-size: 22px; letter-spacing: 3px; }
  .quiz-progress-dots { gap: 4px; }
  .quiz-dot { width: 6px; height: 6px; }
  .option-btn { font-size: 12px; padding: 8px 10px; }
  .paywall-current { font-size: 26px; }
}