/* ===== START OF FILE ===== */
/* 1. ÉP TẢI FONT TRỰC TIẾP TỪ GOOGLE (Dòng này bắt buộc phải ở dòng 1) */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:wght@300;400;500;600;700;800&display=swap");

/* 2. KHAI BÁO BIẾN MÀU (GIỮ NGUYÊN CẤU TRÚC CŨ) */
:root {
  --bg: #f5f8fc;
  --card: #fff;
  --ink: #0f172a;
  --muted: #667085;
  --primary: #7c3aed;
  --primary2: #8b5cf6;
  --green: #10b981;
  --outline: #0f172a;
  --ring: #e5e7eb;
  --shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
  --shadow-strong: 0 18px 36px rgba(16, 24, 40, 0.16);
  --red: #ef4444;
  --greenbg: #ecfdf5;
  --redbg: #fef2f2;
  --ease: cubic-bezier(0.22, 0.8, 0.25, 1);
  --pad-sm: 12px;
  --pad-md: 16px;
}

/* 3. LUẬT BẤT KHẢ XÂM PHẠM: ÉP MỌI THỨ DÙNG NOTO SANS (CƠ BẢN) */
* {
  box-sizing: border-box;
  font-family: "Noto Sans", sans-serif !important;
}

/* 4. CẤU HÌNH BODY (giữ 1 block duy nhất) */
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans", sans-serif !important;
  transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Các thành phần cơ bản */
button,
input,
textarea,
select,
.opt {
  font-family: "Noto Sans", sans-serif !important;
}

a {
  color: inherit;
  text-decoration: none;
}
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 20px 72px;
}
.view {
  display: none;
}
.view.active {
  display: block;
}

/* --- NAV & CONTROLS --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px dashed #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}
.brand h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
}
.stick {
  width: 6px;
  height: 36px;
  background: #3b82f6;
  border-radius: 3px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chip {
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.coinIcon {
  vertical-align: -3px;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.btn,
.btn-outline {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn {
  background: #0ea56b;
  color: #fff;
  border: none;
  box-shadow: 0 4px 10px rgba(14, 165, 107, 0.25);
}
.btn:hover {
  transform: scale(1.02);
}
.btn-outline {
  background: #fff;
  color: #111827;
  border: 2px solid #111827;
}

/* --- HOME PAGE --- */
#home .hero {
  text-align: center;
  margin: 8px 0 12px;
}
#home .hero h2 {
  font-size: 34px;
  margin: 0 0 6px;
  font-weight: 800;
}
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 800px;
  margin: 18px auto 0;
}

.card {
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.card:hover {
  transform: scale(1.012);
  box-shadow: var(--shadow-strong);
}
.card .badge {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: radial-gradient(
    circle at 35% 30%,
    var(--primary) 0%,
    #6d28d9 100%
  );
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 24px;
}
.card .title {
  font-weight: 800;
  font-size: 20px;
}
.card .desc {
  color: #667085;
  font-weight: 500;
  font-size: 13px;
}
.card .count {
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 12px;
}
.card .actions {
  display: flex;
  gap: 10px;
}

/* --- QUIZ PAGE --- */
#quiz .container {
  padding-top: 16px;
  max-width: 1000px;
}
.back {
  position: static;
  margin-bottom: 15px;
  display: inline-flex;
  gap: 8px;
  background: #fff;
  border: 2px solid #111827;
  border-radius: 14px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
}
.header {
  text-align: center;
  margin: 6px 0 18px;
}
.header h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
}
.header p {
  margin: 8px 0 0;
  color: var(--muted);
}

/* TABS */
.tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 18px;
}
.tab {
  border: 2px solid #111827;
  background: #fff;
  color: #111827;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.tab.active {
  background: #0ea56b;
  border-color: #0ea56b;
  color: #fff;
}

/* FLASHCARD */
.cardbox {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.card3d {
  width: min(820px, 96%);
  min-height: 240px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: var(--shadow);
  perspective: 1000px;
  position: relative;
  margin: 0 auto 15px;
  cursor: pointer;
}
.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  backface-visibility: hidden;
  border-radius: 18px;
  transition: transform 600ms var(--ease);
  font-size: 24px;
  text-align: center;
}
.face-front {
  transform: rotateY(0deg);
}
.face-back {
  transform: rotateY(180deg);
}
.card3d.flipped .face-front {
  transform: rotateY(-180deg);
}
.card3d.flipped .face-back {
  transform: rotateY(0deg);
}
.fc-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}
.btn-know {
  background: #10b981;
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
}
.btn-unknown {
  background: #fff;
  color: #111827;
  border: 2px solid #111827;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
}
.btn-next {
  background: #111827;
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
}

/* MCQ & INPUT */
#mcqQuestion {
  font-weight: normal;
  color: var(--ink);
  font-size: 15px;
  text-align: left;
  padding: 20px;
  margin-bottom: 25px;
  background-color: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  position: relative;
  line-height: 1.5;
}
.mcq-wrap {
  display: grid;
  gap: 12px;
}
.opt {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 15px 15px 15px 45px;
  background: #fff;
  color: var(--ink);
  font-weight: normal;
  font-size: 16px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  position: relative;
  min-height: 60px;
  display: block;
  align-items: center;
}
.opt:hover {
  transform: scale(1.01);
  border-color: var(--primary);
}

/* Badges */
.opt-key-badge {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  background: #eee;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-weight: bold;
  font-size: 12px;
  pointer-events: none;
  color: #333;
}
.wrong-count-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: var(--red);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Đúng Sai */
.opt.correct {
  border-color: #16a34a !important;
  background: #10b981 !important;
  color: #fff !important;
}
.opt.incorrect {
  border-color: #ef4444 !important;
  background: #ef4444 !important;
  color: #fff !important;
  opacity: 1;
}
#mcqOpts .opt.correct:not(.incorrect) {
  border-color: #16a34a !important;
  background: #10b981 !important;
  color: #fff !important;
}

/* Input Field */
#mcqInputWrap input {
  width: 100%;
  padding: 15px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 18px;
  margin-bottom: 10px;
}

/* Timer */
.live-timer-wrap {
  text-align: center;
  margin-bottom: 15px;
  font-size: 20px;
  font-weight: 800;
  color: var(--muted);
  opacity: 0.8;
}

/* =========================================
     2. MODALS (FIX CĂN GIỮA TUYỆT ĐỐI)
     ========================================= */
#topupModal,
#qeModal,
#resultModal,
#jsonModal,
#srOverlay {
  display: none; /* Mặc định ẩn */
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background-color: rgba(0, 0, 0, 0.7) !important;

  /* FLEXBOX CENTER */
  align-items: center !important;
  justify-content: center !important;
}

/* Khi JS bật modal (bất kể nó set display là gì), ép về flex */
#topupModal[style*="display: block"],
#topupModal[style*="display: grid"],
#topupModal[style*="display: flex"],
#qeModal[style*="display: block"],
#qeModal[style*="display: grid"],
#qeModal[style*="display: flex"],
#resultModal[style*="display: block"],
#resultModal[style*="display: grid"],
#resultModal[style*="display: flex"] {
  display: flex !important;
}
#topupModal[style*="display: none"] {
  display: none !important;
}

/* Nội dung bên trong Modal */
#topupModal > div,
#settingsCard,
#qeCard,
#resultCard {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  overflow-y: auto;
  color: #111827 !important;
  text-align: left;
  margin: auto !important;
  position: relative !important;
}

/* Lightbox */
.zoom-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
}
.zoom-modal-content {
  margin: auto;
  display: block;
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
}
.zoom-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

/* =========================================
     3. SETTINGS UI
     ========================================= */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}
.theme-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid #eee;
  transition: transform 0.2s;
}
.theme-swatch:hover {
  transform: scale(1.1);
}
.theme-swatch.active {
  border-color: #10b981;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px #fff;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 34px;
  transition: 0.4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}
input:checked + .slider {
  background-color: var(--green);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Settings Colors */
[data-theme="light"] {
  background: #f5f8fc;
}
[data-theme="theme-kahoot-v1"] {
  background: #2c1e4a;
}

/* Editor */
#qeCard {
  width: min(880px, 96%);
  display: flex;
  flex-direction: column;
}
#qeBody {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.qe-row {
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.qe-field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}
.qe-field label {
  font-weight: 700;
  font-size: 12px;
  color: #6b7280;
}
.qe-field input,
.qe-field textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
}
.qe-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.tag-display {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  margin: 10px 0;
}

/* =========================================
     4. THEME KAHOOT (GRID 1x4 FIX)
     ========================================= */
body.theme-kahoot-v1 {
  background-color: #2c1e4a !important;
  background-image: radial-gradient(
    circle at 50% 0%,
    #4a3a70,
    #2c1e4a
  ) !important;
  color: #fff !important;
}
/* Mở rộng khung */
body.theme-kahoot-v1 #quiz .container {
  max-width: 1400px !important;
  width: 96% !important;
}

/* Nav & Text */
body.theme-kahoot-v1 .nav {
  background: rgba(44, 30, 74, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
body.theme-kahoot-v1 .brand h1,
body.theme-kahoot-v1 .chip {
  color: #fff !important;
}
body.theme-kahoot-v1 .back {
  background: transparent !important;
  color: #fff !important;
  border-color: #fff !important;
}

/* Khung quiz trong suốt */
body.theme-kahoot-v1 .cardbox {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
body.theme-kahoot-v1 #mcqQuestion {
  background: rgba(0, 0, 0, 0.4) !important;
  border: none !important;
  color: #fff !important;
  text-align: center !important;
  font-size: 26px !important;
  font-weight: 200 !important;
}

/* GRID 4 CỘT (desktop override preserved) */
body.theme-kahoot-v1 .mcq-wrap {
  display: grid !important;
  gap: 15px !important;
  grid-template-columns: repeat(4, 1fr) !important;
}

/* =================================================================
   THEME KAHOOT - CHUẨN THEO FILE GỐC INDEX.HTML
   ================================================================= */

/* 1. CẤU TRÚC LƯỚI (GRID) */
body.theme-kahoot-v1 .mcq-wrap {
  display: grid !important;
  gap: 10px !important;
  width: 100% !important;
  margin: 0 auto !important;
  justify-content: center !important;
  /* Mặc định Mobile là 1 cột (mobile handled later) */
  grid-template-columns: 1fr !important;
}

/* 2. STYLE NÚT ĐÁP ÁN (MOBILE FIRST) */
body.theme-kahoot-v1 .opt {
  background: linear-gradient(to bottom, #ff8c1a, #a63a00) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
  font-family: "Noto Sans", sans-serif !important;
  font-weight: normal !important;
  font-size: 1.15em !important;
  text-align: center !important;
  padding: 15px 14px !important;
  line-height: 1.35 !important;
  transition: transform 0.1s ease, box-shadow 0.1s ease !important;
}
body.theme-kahoot-v1 .opt:hover {
  transform: scale(1.03) !important;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3) !important;
  filter: brightness(1.1);
}

/* 3. MÀU ĐÚNG / SAI (Chuẩn file gốc) */
body.theme-kahoot-v1 .opt.correct {
  background: #10b981 !important;
  background-image: none !important;
  transform: scale(1.05) !important;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4) !important;
}
body.theme-kahoot-v1 .opt.incorrect {
  background: #ef4444 !important;
  background-image: none !important;
  opacity: 0.7 !important;
}
body.theme-kahoot-v1 .opt.correct:not(.incorrect) {
  background: #10b981 !important;
  background-image: none !important;
  opacity: 1 !important;
}

/* =================================================================
   4. GIAO DIỆN DESKTOP (PC) - QUAN TRỌNG NHẤT
   ================================================================= */
@media (min-width: 768px) {
  body.theme-kahoot-v1 .mcq-wrap {
    gap: 15px !important;
    grid-template-columns: repeat(4, 1fr) !important;
  }
  body.theme-kahoot-v1 .mcq-wrap.two-options {
    grid-template-columns: repeat(2, 1fr) !important;
    max-width: 600px !important;
  }
  body.theme-kahoot-v1 .opt {
    padding: 10px !important;
    aspect-ratio: 1 / 0.8 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.35em !important;
  }
}

/* Badge Kahoot */
body.theme-kahoot-v1 .opt-key-badge {
  position: absolute !important;
  top: 10px !important;
  left: 10px !important;
  transform: none !important;
  background: rgba(0, 0, 0, 0.3) !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
}

/* Các theme khác (Giữ nguyên) */
body.theme-forest-v1 {
  background: #064e3b !important;
  color: #fff;
}
body.theme-forest-v1 .cardbox {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
}
body.theme-ocean-v1 {
  background: #1e3a8a !important;
  color: #fff;
}
body.theme-ocean-v1 .cardbox {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
}
body.theme-sunset-v1 {
  background: #4a1e2c !important;
  color: #fff;
}

/* --- MOBILE FIX --- */
@media (max-width: 800px) {
  body.theme-kahoot-v1 .mcq-wrap {
    grid-template-columns: 1fr 1fr !important;
  }
  .grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  body.theme-kahoot-v1 .mcq-wrap {
    grid-template-columns: 1fr !important;
  }
  body.theme-kahoot-v1 .opt {
    min-height: 80px !important;
    aspect-ratio: auto !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding-left: 50px !important;
    font-size: 16px !important;
  }
  .card {
    flex-direction: column;
    align-items: flex-start;
  }
  .card .actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 10px;
  }
  .card .badge {
    display: none;
  }
}

/* =========================================
   FIX LỖI FONT & HIỂN THỊ (ĐẶT Ở CUỐI FILE)
   ========================================= */

/* 1) Targeted overrides to ensure .opt and interactive elements use Noto (high specificity, minimal global impact) */
body .mcq-wrap .opt,
body.theme-kahoot-v1 .mcq-wrap .opt,
button,
input,
textarea,
select,
.chip,
.opt-key-badge,
#deviceIdDisplay {
  font-family: "Noto Sans", Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* 2) MathJax SVG / CHTML allowance so surrounding text uses Noto (won't break math glyphs) */
svg,
.MathJax_SVG,
.mjx-svg-href,
.mjx-chtml,
.mjx-chtml .MathJax {
  font-family: "Noto Sans", "Times New Roman", serif !important;
}

/* 3) Ensure correct/incorrect states still use Noto and desired colors */
.opt.correct,
.opt.incorrect {
  font-family: "Noto Sans", Arial, sans-serif !important;
  font-weight: 800 !important;
}
.opt.correct {
  color: #fff !important;
}
.opt.incorrect {
  color: #fff !important;
}

/* 4) Last-resort "very specific" override only for .opt text if any rule still beats us */
.mcq-wrap .opt > * {
  font-family: "Noto Sans", Arial, sans-serif !important;
}

/* ===== END OF FILE ===== */
/* ===== TỐI ƯU: GIẢM NHẸ CỠ CHỮ CÂU HỎI (AN TOÀN, CHỈ OVERRIDE NHỎ) ===== */

/* Chuẩn cho phần câu hỏi (MCQ / Reading / Fill-in) */
#mcqQuestion {
  /* nhẹ nhàng nhỏ hơn so với 26px của theme-kahoot, nhưng không quá nhỏ */
  font-size: 22px !important;
  line-height: 1.7 !important;
  font-weight: 400 !important;
  text-align: center !important;
  /* không thay đổi padding / margins / background để tránh phá layout */
}

/* Đảm bảo override theme-kahoot (nếu body.theme-kahoot-v1 đặt 26px !important) */
body.theme-kahoot-v1 #mcqQuestion {
  font-size: 22px !important;
  line-height: 1.7 !important;
  font-weight: 400 !important;
  text-align: center !important;
}

/* Nếu có cardbox wrapper (một số layout dùng .cardbox #mcqQuestion) */
.cardbox #mcqQuestion {
  font-size: 22px !important;
  line-height: 1.7 !important;
  font-weight: 400 !important;
  text-align: center !important;
}
/* ===== GIẢM NHẸ CỠ CHỮ ĐÁP ÁN (AN TOÀN, KHÔNG ẢNH HƯỞNG LOGIC) ===== */

.opt {
  font-size: 13px !important; /* giảm nhẹ từ 16px */
}

/* Kahoot theme (PC mode: đáp án vuông to) */
body.theme-kahoot-v1 .opt {
  font-size: 1.25em !important; /* giảm nhẹ từ 1.35em */
}
/* ---------- RESULT MODAL: Kahoot-like purple card (image 2) ---------- */
/* Applies to existing #resultModal > #resultCard structure in index.html */
/* Put this at the end of your style.css so it overrides earlier rules. */

#resultModal {
  /* keep overlay behavior from existing modal rules, ensure center */
  display: none;
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  background-color: rgba(0, 0, 0, 0.6) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
}

/* Main card */
#resultModal #resultCard {
  width: min(420px, 92%);
  max-width: 520px;
  border-radius: 18px;
  padding: 26px 22px;
  background: linear-gradient(180deg, #6b46ff 0%, #5b3def 60%);
  color: #ffffff;
  box-shadow: 0 30px 60px rgba(43, 20, 90, 0.55);
  text-align: center;
  font-family: "Noto Sans", sans-serif !important;
  transform: translateY(0);
}

/* Small emoji heading */
#resultModal #resultCard h2 {
  margin: 0 0 12px 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Subtitle line under title */
#resultModal #resultCard .result-sub {
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  font-weight: 600;
  opacity: 0.95;
}

/* Rows that show stats: make them pill/box-like */
#resultModal #resultCard .result-stat {
  display: block;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 10px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  font-weight: 800;
  font-size: 16px;
  text-align: center;
}

/* The label part (left) and the value part (right) - simpler: value bold */
#resultModal #resultCard .result-stat .label {
  display: block;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 14px;
  opacity: 0.95;
}
#resultModal #resultCard .result-stat .value {
  display: block;
  margin-top: 6px;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.6px;
}

/* Big green CTA button */
#resultModal #resultCard #resultBtn {
  margin-top: 16px;
  background: linear-gradient(180deg, #25c26a, #10b981);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(16, 185, 129, 0.28);
}
#resultModal #resultCard #resultBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.32);
}

/* Responsive: a little larger padding on very small screens */
@media (max-width: 420px) {
  #resultModal #resultCard {
    padding: 20px;
  }
  #resultModal #resultCard h2 {
    font-size: 22px;
  }
  #resultModal #resultCard .result-stat .value {
    font-size: 18px;
  }
}
/* ===== FIX: Flashcard - ensure high contrast text & white card background ===== */
/* Dán block này vào cuối style.css để override mọi rule trước đó */

#fcCard,
#fcCard .card-face {
  background: #ffffff !important; /* trắng rõ rệt */
  color: #0f172a !important; /* chữ màu đen đậm */
}

/* đảm bảo mọi nội dung bên trong cũng đòi màu đen */
#fcCard .card-face,
#fcCard .card-face * {
  color: #0f172a !important;
}

/* nếu trước đó có chữ mờ/opacity, reset lại */
#fcCard .card-face {
  opacity: 1 !important;
  filter: none !important;
}

/* padding / line-height / size cho đọc tốt */
#fcCard .card-face {
  padding: 24px !important;
  line-height: 1.45 !important;
  font-size: 20px !important; /* tăng/giảm tuỳ bạn */
  text-align: center !important;
  vertical-align: middle !important;
}

/* phần back/front có thể có icon hoặc small meta, giữ màu đậm cho chúng */
#fcCard .card-face .meta,
#fcCard .card-face small {
  color: rgba(15, 23, 42, 0.85) !important;
  font-weight: 700 !important;
}

/* small screens: giảm font */
@media (max-width: 640px) {
  #fcCard .card-face {
    font-size: 18px !important;
    padding: 18px !important;
  }
}
/* === MOBILE OPTIMIZATIONS (paste vào cuối style.css) === */

@media (max-width: 480px) {
  /* 1) No horizontal scroll */
  html,
  body {
    overflow-x: hidden !important;
  }

  /* 2) Reduce container padding in quiz */
  body.in-quiz .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* 3) Reduce cardbox padding inside quiz */
  body.in-quiz #quiz .cardbox {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* 4) Question / Flashcard responsive size */
  body.in-quiz #quiz #mcqQuestion,
  body.in-quiz #quiz #fcFrontContent,
  body.in-quiz #quiz #fcBackContent {
    padding: 12px 8px !important;
    font-size: clamp(17px, 5vw, 19px) !important;
    line-height: 1.6 !important;
    text-align: center !important;
  }

  /* 5) MCQ answers spacing + font */
  body.in-quiz #quiz .opt {
    padding: 12px 8px !important;
    font-size: clamp(15px, 4.2vw, 16px) !important;
    min-height: 48px !important; /* touch target */
    border-radius: 10px !important;
  }

  /* 6) Buttons in card actions wrap and enlarge */
  .card .actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }
  #home .card .actions .btn,
  #home .card .actions .btn-outline {
    padding: 8px 10px !important;
    min-height: 36px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    flex-grow: 1;
    text-align: center;
  }

  /* 7) Prevent iOS zoom when focusing small font inputs */
  #topupModal #inpCode,
  #mcqTextAnswer {
    font-size: 16px !important;
  }

  /* 8) Back button not sticky on mobile */
  .back {
    position: static !important;
    margin-bottom: 12px !important;
  }

  /* 9) Reduce large margins that push content off-screen */
  .hero,
  .header {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 10) Make media responsive */
  img,
  iframe,
  video {
    max-width: 100% !important;
    height: auto !important;
  }

  /* 11) Turn off heavy transitions for MCQ to avoid jank */
  #mcq,
  #mcq.mcq-fade-out,
  #mcq.mcq-visible {
    transition: none !important;
    opacity: 1 !important;
  }
}
/* === MOBILE OPTIMIZATIONS (paste vào cuối style.css) === */
@media (max-width: 480px) {
  /* 1) No horizontal scroll */
  html,
  body {
    overflow-x: hidden !important;
  }

  /* 2) Reduce container padding in quiz */
  body.in-quiz .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  /* 3) Reduce cardbox padding inside quiz */
  body.in-quiz #quiz .cardbox {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* 4) Question / Flashcard responsive size */
  body.in-quiz #quiz #mcqQuestion,
  body.in-quiz #quiz #fcFrontContent,
  body.in-quiz #quiz #fcBackContent {
    padding: 12px 8px !important;
    font-size: clamp(17px, 5vw, 19px) !important;
    line-height: 1.6 !important;
    text-align: center !important;
  }

  /* 5) MCQ answers spacing + font (touch targets) */
  body.in-quiz #quiz .opt {
    padding: 12px 8px !important;
    font-size: clamp(15px, 4.2vw, 16px) !important;
    min-height: 48px !important; /* target touch */
    border-radius: 10px !important;
  }

  /* 6) Buttons in home cards wrap and enlarge */
  #home .card .actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }
  #home .card .actions .btn,
  #home .card .actions .btn-outline {
    padding: 8px 10px !important;
    min-height: 36px !important;
    font-size: 14px !important;
    flex: 1 1 auto;
    text-align: center;
  }

  /* 7) Prevent iOS zoom when focusing small font inputs */
  #topupModal #inpCode,
  #mcqTextAnswer {
    font-size: 16px !important;
  }

  /* 8) Back button static (avoid sticky overlap) */
  .back {
    position: static !important;
    margin-bottom: 12px !important;
  }

  /* 9) Reduce large header margins so content not pushed off-screen */
  .hero,
  .header {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 10) Ensure coin/hint chip and controls stack on the right and don't overflow */
  .nav .controls {
    gap: 8px !important;
    flex-wrap: wrap !important;
    justify-content: flex-end;
  }
  .nav .controls .chip {
    flex-shrink: 0;
  }

  /* 11) Flashcard high-contrast ensures front/back white + black text for readability */
  #fcCard,
  #fcCard .card-face {
    background: #fff !important;
    color: #0f172a !important;
    opacity: 1 !important;
    filter: none !important;
    padding: 18px !important;
    font-size: 18px !important;
  }

  /* 12) Make quiz progress and small elements readable */
  #mcqProg {
    height: 6px !important;
    border-radius: 6px !important;
  }

  /* 13) Reduce modal sizes on very small screens */
  #resultModal #resultCard {
    width: min(360px, 92%) !important;
    padding: 18px !important;
  }
}
/* ====== MOBILE: hide top header when in quiz + card layout like image 3 ====== */
/* Dán nguyên block này vào cuối file /mnt/data/style.css */

@media (max-width: 768px) {
  /* Khi đang ở trang quiz, body có class in-quiz (file gốc đã set),
     dùng class đó để ẩn header/controls và tránh che nội dung. */
  body.in-quiz .nav {
    position: static !important; /* không fixed, để nó cuộn lên trên */
    background: transparent !important;
    box-shadow: none !important;
    padding-top: 8px !important;
    padding-bottom: 0 !important;
  }

  /* Ẩn toàn bộ controls (coin / hint / buttons) khi đang ở chế độ làm bài
     — vẫn giữ cấu trúc DOM để lúc về home nó hiện lại bình thường. */
  body.in-quiz .nav .controls {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Nếu logo/brand chiếm chỗ quá nhiều, giảm kích cỡ */
  body.in-quiz .nav .brand h1 {
    font-size: 20px !important;
    line-height: 1 !important;
  }

  /* ===== Quiz card layout (home list & quiz page card) =====
     Mô phỏng layout giống ảnh 3: tiêu đề top, số câu nhỏ, các nút ở bên phải (stacked).
  */
  /* Thẻ quiz trong trang home */
  #home .card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 18px !important;
  }
  #home .card .badge {
    min-width: 56px !important;
    min-height: 56px !important;
    border-radius: 999px !important;
    flex-shrink: 0;
  }
  #home .card .title {
    font-size: 18px !important;
    font-weight: 800 !important;
    flex: 1 1 auto !important;
    text-align: left !important;
  }
  #home .card .desc {
    color: #6b7280 !important;
    font-size: 13px !important;
    margin-top: 6px !important;
  }

  /* hành động (buttons) sắp xếp dạng cột phải giống ảnh 3 */
  #home .card .actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-end !important;
    justify-content: center !important;
    min-width: 120px !important;
  }
  #home .card .actions .btn,
  #home .card .actions .btn-outline {
    width: 120px !important;
    padding: 10px 12px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
  }

  /* small bubble showing number of questions (cái chấm đen 18 câu) */
  #home .card .count-bubble {
    display: inline-block;
    background: #0f172a !important;
    color: #fff !important;
    padding: 6px 10px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    margin-left: 8px;
  }

  /* ===== In-quiz screen: ensure header collapsed and content top aligns ===== */
  /* main quiz content push up to top under nav */
  body.in-quiz section#quiz .container {
    padding-top: 8px !important;
  }

  /* ===== MCQ: remove numbered badges on mobile ===== */
  /* hide the small number badge inside options */
  #mcq .opt .opt-key-badge,
  .opt-key-badge {
    display: none !important;
  }

  /* enlarge option box and center text */
  #mcq .opt {
    padding: 14px 14px !important;
    font-size: 18px !important;
    border-radius: 12px !important;
  }

  /* ensure flashcard front/back readable (white bg + black text) */
  #fcCard,
  #fcCard .card-face {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: none !important;
    padding: 18px !important;
  }

  /* result modal narrower on mobile */
  #resultCard {
    width: 94% !important;
    border-radius: 14px !important;
  }

  /* đảm bảo nút quay lại (back) không bị overlay */
  .back {
    position: static !important;
    margin: 8px 6px !important;
  }

  /* remove sticky/gimmick header visuals that che content */
  .nav.sticky,
  .nav.fixed {
    position: static !important;
  }
} /* end media mobile */
/* ===== MOBILE: unpin header + quiz-card layout like image 2 ===== */
@media (max-width: 768px) {
  /* --- Unpin header on mobile (do not hide) --- */
  /* If the header has fixed/sticky classes, force static so it scrolls away. */
  .nav,
  .nav.sticky,
  .nav.fixed {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  /* Ensure controls remain visible in DOM but do not overlay content (they will scroll with page) */
  .nav .controls {
    position: relative !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  /* --- Home card layout: title left, actions stacked on right (like your image 2) --- */
  #home .card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06) !important;
    background: #fff !important;
  }

  /* round avatar / badge on left */
  #home .card .badge {
    width: 56px !important;
    height: 56px !important;
    border-radius: 999px !important;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* title block on left (stack title + small desc) */
  #home .card .meta {
    flex: 1 1 auto !important;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  #home .card .title {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.05 !important;
    text-align: left !important;
  }
  #home .card .desc {
    color: #6b7280 !important;
    font-size: 13px !important;
  }

  /* actions column on right: stacked buttons like image */
  #home .card .actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-end !important;
    justify-content: center !important;
    min-width: 128px !important;
  }
  #home .card .actions .btn,
  #home .card .actions .btn-outline {
    width: 128px !important;
    padding: 10px 12px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
  }

  /* small bubble for question count (top-right) */
  #home .card .count-bubble {
    display: inline-block;
    background: #0f172a !important;
    color: #fff !important;
    padding: 6px 10px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    margin-left: 8px;
  }

  /* If card had a full-width "Chỉnh sửa" button - keep it full width under actions */
  #home .card .edit-row {
    width: 100%;
    margin-top: 8px;
    display: block;
  }
  #home .card .edit-row .btn {
    width: 100% !important;
    padding: 12px !important;
    border-radius: 12px !important;
  }

  /* --- In-quiz: ensure header scrolls away and quiz container top aligns --- */
  body.in-quiz .container {
    padding-top: 10px !important;
  }

  /* --- MCQ specific: hide numeric badges on mobile (remove 1,2,3) --- */
  .opt .opt-key-badge,
  .opt-key {
    display: none !important;
  }
  /* enlarge option box */
  .mcq-wrap .opt {
    padding: 14px !important;
    font-size: 18px !important;
    border-radius: 12px !important;
  }

  /* flashcard: white background + black text so visible on gradient bg */
  #fcCard,
  #fcCard .card-face {
    background: #fff !important;
    color: #0f172a !important;
    padding: 18px !important;
    border-radius: 12px !important;
  }
}
/* ===== MOBILE: Compact quiz card (ảnh 2 style) ===== */
@media (max-width: 640px) {
  /* Thay đổi lưới home: mỗi card nhỏ gọn */
  .grid {
    max-width: 100%;
    padding: 0 12px;
    gap: 10px;
  }

  .card {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.04) !important; /* nhẹ, tuỳ theme */
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  /* Avatar (badge) nhỏ gọn */
  .card .badge {
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
    flex-shrink: 0 !important;
  }

  /* Title block (2 dòng, đậm) */
  .card .title {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    max-width: 55% !important; /* giữ chỗ cho nút */
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .card .desc {
    font-size: 12px !important;
    color: rgba(255, 255, 255, 0.75) !important;
    margin-top: 2px !important;
  }

  /* Actions: gom vào 1 hàng, nút nhỏ */
  .card .actions {
    display: flex !important;
    gap: 8px !important;
    margin-left: auto !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }
  .card .actions .btn,
  .card .actions .btn-outline {
    height: 36px !important;
    padding: 6px 10px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    min-width: 0 !important;
  }

  /* Bắt đầu nổi bật màu xanh (ảnh 2) */
  .card .actions .btn.start {
    background: #10b981 !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.16) !important;
  }

  /* Ôn tập và sửa thành outline nhỏ */
  .card .actions .btn-outline.small {
    background: transparent !important;
    border: 2px solid rgba(0, 0, 0, 0.08) !important;
    color: inherit !important;
    padding: 6px 8px !important;
  }

  /* Xóa (icon) viền đỏ, nhỏ gọn */
  .card .actions .btn-delete {
    border: 2px solid #ef4444 !important;
    color: #ef4444 !important;
    background: transparent !important;
    padding: 6px 8px !important;
  }

  /* Khi dùng theme-kahoot-v1, điều chỉnh màu chữ/biểu nền */
  body.theme-kahoot-v1 .card {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
  }
  body.theme-kahoot-v1 .card .title,
  body.theme-kahoot-v1 .card .desc {
    color: #fff !important;
  }
}
/* ============================================================
   MOBILE HOME CARD REDESIGN (Target: Image 2 Style)
   ============================================================ */

/* Reset & Base Styles cho Card Info để dễ layout */
.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 10px;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  /* 1. Layout Card: Flex ngang (Icon - Info - Nothing) */
  /* Nút sẽ được đẩy xuống dòng bằng Grid hoặc Flex wrap */
  #home .card {
    display: grid !important;
    grid-template-columns: auto 1fr !important; /* Cột 1: Icon, Cột 2: Info */
    grid-template-rows: auto auto !important; /* Hàng 1: Icon+Info, Hàng 2: Actions */
    gap: 15px 10px !important;
    padding: 20px !important;
    align-items: center !important;
    position: relative !important;
  }

  /* 2. Icon tròn (Badge) */
  #home .card .badge {
    grid-column: 1 / 2 !important;
    grid-row: 1 / 2 !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 20px !important;
  }

  /* 3. Thông tin (Title + Count) */
  #home .card .card-info {
    grid-column: 2 / 3 !important;
    grid-row: 1 / 2 !important;
    display: flex !important;
    flex-direction: row !important; /* Xếp ngang title và count */
    align-items: center !important;
    justify-content: space-between !important; /* Title trái, Count phải */
    padding: 0 !important;
  }

  #home .card .title {
    font-size: 17px !important;
    line-height: 1.3 !important;
    max-width: 70% !important; /* Dành chỗ cho nút count */
  }

  #home .card .desc {
    margin: 0 !important;
  }

  /* Bubble số câu (Màu đen góc phải như ảnh) */
  #home .card .count-bubble {
    background: #111827 !important;
    color: #fff !important;
    padding: 4px 10px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
  }
  /* Ẩn chữ "câu hỏi" nếu cần cho gọn, chỉ hiện số */
  /* #home .card .desc { font-size: 0; } 
     #home .card .count-bubble { font-size: 12px; } */

  /* 4. Khu vực Actions (Các nút bấm) */
  #home .card .actions {
    grid-column: 1 / 3 !important; /* Chiếm hết chiều rộng */
    grid-row: 2 / 3 !important;
    display: grid !important;
    grid-template-columns: 1.2fr 1fr 46px !important; /* Bắt đầu (to) - Ôn tập - Xóa (nhỏ) */
    gap: 8px !important;
    width: 100% !important;
    margin-top: 5px !important;
  }

  /* Reset style chung cho nút trong card mobile */
  #home .card .actions .btn,
  #home .card .actions .btn-outline {
    width: 100% !important;
    height: 42px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    padding: 0 !important; /* Reset padding để căn giữa */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Nút Bắt đầu (Xanh) */
  #home .card .actions .btn-start {
    background: #10b981 !important; /* Xanh lá */
    border: none !important;
    color: white !important;
    grid-column: 1 / 2 !important;
    grid-row: 1 / 2 !important;
  }

  /* Nút Ôn tập (Trắng viền) */
  #home .card .actions .btn-review {
    grid-column: 2 / 3 !important;
    grid-row: 1 / 2 !important;
  }

  /* Nút Xóa (Thùng rác) */
  #home .card .actions .btn-delete {
    grid-column: 3 / 4 !important;
    grid-row: 1 / 2 !important;
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    font-size: 18px !important; /* Icon to hơn chút */
  }
  #home .card .actions .btn-delete .icon {
    display: inline-block; /* Hiện icon */
  }

  /* 5. Nút Chỉnh Sửa (Full width ở dòng dưới cùng) */
  #home .card .actions .btn-edit {
    grid-column: 1 / 4 !important; /* Chiếm hết 3 cột */
    grid-row: 2 / 3 !important; /* Xuống dòng thứ 2 của actions */
    border-color: #111827 !important;
    color: #111827 !important;
    font-weight: 700 !important;
    margin-top: 4px !important;
  }

  /* Xử lý hiển thị Text/Icon cho nút Edit */
  #home .card .actions .btn-edit .icon {
    display: none !important;
  } /* Ẩn icon bút chì */
  #home .card .actions .btn-edit .text {
    display: inline !important;
  } /* Hiện chữ "Chỉnh sửa" */

  /* Ẩn text "Chỉnh sửa" ở các nút khác (nếu có lỡ copy) */
  #home .card .actions .btn-start .text,
  #home .card .actions .btn-review .text,
  #home .card .actions .btn-delete .text {
    display: block;
  } /* Giữ nguyên text gốc */
}
/* ============================================================
   PART 6: EDITOR UI STYLES (Giao diện Chỉnh sửa Mới)
   ============================================================ */

/* 1. Khung chứa danh sách câu hỏi */
#qeBody {
  background-color: #f3f4f6; /* Màu nền xám nhẹ cho vùng làm việc */
  padding: 20px;
  gap: 20px;
  display: flex;
  flex-direction: column;
}

/* 2. Thẻ từng câu hỏi (Card) */
.qe-question-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: relative;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header của thẻ câu hỏi: Câu hỏi 1 + Dropdown loại */
.qe-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.qe-card-title {
  font-weight: 800;
  font-size: 16px;
  color: #111827;
}

/* Dropdown chọn loại câu hỏi (Trắc nghiệm / Tự luận) */
.qe-type-select {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background-color: #fff;
  cursor: pointer;
}

/* Nhãn (Label) */
.qe-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
  margin-top: 12px;
}

/* Input và Textarea chung */
.qe-input,
.qe-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s;
  font-family: inherit;
}
.qe-input:focus,
.qe-textarea:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.qe-textarea {
  min-height: 80px;
  resize: vertical;
}

/* 3. Khu vực Đáp án Trắc nghiệm (Grid 2x2) */
.qe-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 cột */
  gap: 12px;
  margin-bottom: 15px;
}
.qe-option-item {
  display: flex;
  flex-direction: column;
}
/* Nhãn A, B, C, D nhỏ bên trên input */
.qe-opt-label {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 4px;
}

/* Khu vực chọn đáp án đúng */
.qe-correct-wrapper {
  background: #f0fdf4; /* Nền xanh lá nhạt */
  border: 1px dashed #16a34a;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.qe-correct-select {
  padding: 8px 12px;
  border: 1px solid #16a34a;
  border-radius: 6px;
  font-weight: 700;
  color: #15803d;
  background: #fff;
}

/* Nút xóa câu hỏi */
.qe-btn-delete {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  background: #fff;
  border: 1px solid #ef4444;
  color: #ef4444;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.qe-btn-delete:hover {
  background: #fef2f2;
}

/* Mobile: Chuyển grid đáp án thành 1 cột */
@media (max-width: 600px) {
  .qe-options-grid {
    grid-template-columns: 1fr;
  }
}
/* ============================================================
   PART 7: EDITOR POLISH (Nút bấm đẹp & Thanh tìm kiếm)
   ============================================================ */

/* 1. Footer chứa các nút: Căn phải, nền xám nhẹ */
#qeFoot {
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  padding: 15px 20px;
  display: flex;
  justify-content: flex-end; /* Căn phải */
  gap: 10px;
  flex-wrap: wrap;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
}

/* 2. Style chung cho các nút trong Editor */
.qe-btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Noto Sans", sans-serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Nút thường (Trắng viền đen): Đóng, Reset, Xuất */
.qe-btn {
  background: #ffffff;
  border: 2px solid #d1d5db;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.qe-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

/* Nút Primary (Lưu thay đổi): Màu xanh lá đậm đà */
.qe-btn.primary {
  background: #10b981;
  border: 2px solid #10b981;
  color: #ffffff;
  box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}
.qe-btn.primary:hover {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 6px 10px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

/* 3. Thanh tìm kiếm (Search Bar) */
.qe-search-box {
  position: relative;
  margin-bottom: 15px;
}
#qeSearchInput {
  width: 100%;
  padding: 12px 12px 12px 40px; /* Chừa chỗ cho icon */
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 15px;
  background-color: #fff;
  transition: border-color 0.2s;
}
#qeSearchInput:focus {
  border-color: #3b82f6;
  outline: none;
}
/* Icon kính lúp giả bằng CSS */
.qe-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.5;
  pointer-events: none;
}

/* Hiệu ứng khi lọc: Ẩn các câu không khớp */
.qe-question-card.hidden {
  display: none !important;
}
/* ============================================================
   PART 8: NEW SETTINGS UI (Giao diện Cài đặt Đẹp)
   ============================================================ */

/* 1. Cấu trúc Modal */
#settingsCard {
  width: min(450px, 94%) !important;
  border-radius: 20px !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#settingsHead {
  background: #fff;
  padding: 20px 24px;
  font-size: 20px;
  font-weight: 800;
  border-bottom: 1px solid #f1f5f9;
  color: #111827;
}

#settingsBody {
  padding: 20px 24px;
  background: #fff;
}

/* 2. Các hàng Setting (Rows) */
.st-group-label {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  transition: background 0.2s;
}

.st-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.st-icon {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.setting-row label {
  font-size: 16px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

/* 3. Nút Gạt (Switch) - Style iOS */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 30px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e2e8f0; /* Màu xám khi tắt */
  border-radius: 34px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
input:checked + .slider {
  background-color: #10b981; /* Màu xanh khi bật */
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Hiệu ứng khi chọn */
.theme-swatch.active {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px #10b981, 0 8px 15px rgba(16, 185, 129, 0.3);
}
/* Dấu tích khi chọn */
.theme-swatch.active::after {
  content: "✔";
  color: #fff;
  font-size: 18px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.theme-name {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}
.theme-swatch:hover {
  transform: translateY(-2px);
}

/* 5. Footer */
#settingsFoot {
  background: #fff;
  padding: 0 24px 24px;
  border: none;
}
/* ============================================================
   PART 9: RESULT MODAL REDESIGN (Giao diện Kết quả Đẹp)
   ============================================================ */

/* 1. Overlay nền tối */
#resultModal {
  background-color: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(5px); /* Làm mờ nền đằng sau */
}

/* 2. Thẻ Kết quả (Gradient Tím) */
#resultCard {
  background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%) !important;
  color: #fff !important;
  width: min(380px, 90%) !important;
  border-radius: 24px !important;
  padding: 30px 20px !important;
  box-shadow: 0 20px 50px rgba(91, 33, 182, 0.5) !important;
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  text-align: center !important;
  position: relative;
  overflow: hidden;
}

/* Hiệu ứng ánh sáng background */
#resultCard::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 60%
  );
  pointer-events: none;
}

/* 3. Tiêu đề & Quote */
#resultCard h2 {
  font-size: 28px !important;
  margin: 0 0 8px 0 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.result-sub {
  font-size: 16px;
  color: #e9d5ff; /* Tím nhạt */
  margin-bottom: 24px;
  font-weight: 600;
  font-style: italic;
}

/* 4. Hộp Thống kê */
.result-stats-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.result-stat:last-child {
  border-bottom: none;
}

.result-stat .label {
  font-size: 15px;
  color: #ddd;
  font-weight: 500;
}

.result-stat .value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 5. Nút Về trang chủ (Xanh lá nổi bật) */
#resultBtn {
  width: 100%;
  background: #22c55e !important;
  color: #fff !important;
  font-size: 18px !important;
  padding: 14px !important;
  border-radius: 16px !important;
  box-shadow: 0 6px 0 #15803d !important; /* Hiệu ứng 3D khối */
  transition: transform 0.1s, box-shadow 0.1s !important;
  margin-top: 10px !important;
  border: none !important;
}

#resultBtn:active {
  transform: translateY(6px) !important; /* Nhấn xuống */
  box-shadow: none !important;
}
/* ============================================================
   PART 9: RESULT MODAL (CẬP NHẬT 2 NÚT)
   ============================================================ */

/* ... (Giữ nguyên các style cũ của #resultModal, #resultCard...) ... */

/* Container chứa 2 nút */
.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* Style chung cho nút trong bảng kết quả */
.btn-retry,
.btn-home {
  flex: 1; /* Chia đều chiều rộng */
  padding: 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
  white-space: nowrap;
}

.btn-retry:active,
.btn-home:active {
  transform: translateY(2px);
}

/* Nút Làm lại (Màu Vàng cam nổi bật trên nền tím) */
.btn-retry {
  background: #ff4800;
  color: #fff;
  box-shadow: 0 4px 0 #b45309;
}

/* Nút Về trang chủ (Màu Xanh hoặc Trắng mờ) */
.btn-home {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Mobile: Xếp chồng 2 nút nếu màn hình nhỏ */
@media (max-width: 480px) {
  .result-actions {
    flex-direction: column;
  }
  .btn-retry,
  .btn-home {
    width: 100%;
    padding: 14px;
    font-size: 16px;
  }
}
/* =========================================
   MUSIC PLAYER INSIDE SETTINGS
   ========================================= */

.music-settings-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 15px;
  margin-top: 10px;
  text-align: center;
}

/* Thanh hiển thị tên bài hát */
.music-info-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 8px 12px;
  border-radius: 8px;
  color: #334155;
  font-weight: 600;
  font-size: 14px;
}

.marquee-wrap {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

/* Hiệu ứng chữ chạy nhẹ nhàng */
#songTitle {
  display: inline-block;
  /* Animation sẽ được JS kích hoạt nếu cần, hoặc để tĩnh */
}

/* Hàng nút bấm */
.music-controls-row {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.music-act-btn {
  width: 40px;
  height: 40px;
  font-size: 18px;
  padding: 0 !important;
  border-radius: 50% !important; /* Nút tròn */
}

.music-play-btn {
  width: 50px;
  height: 50px;
  font-size: 22px;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #10b981 !important; /* Màu xanh chủ đạo */
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3) !important;
}

.music-play-btn:hover {
  transform: scale(1.1);
  background: #059669 !important;
}

.music-play-btn.playing {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}
/* =========================================
   MUSIC VOLUME SLIDER
   ========================================= */
.music-vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 0 10px;
}

.vol-icon {
  font-size: 18px;
}

.vol-slider {
  flex: 1; /* Tự dãn hết chiều ngang */
  cursor: pointer;
  height: 6px;
  background: #cbd5e1;
  border-radius: 5px;
  appearance: none; /* Xóa style mặc định của trình duyệt */
  outline: none;
}

/* Style cho cái cục tròn để kéo (Thumb) */
.vol-slider::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: #10b981; /* Màu xanh lá */
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.vol-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.vol-text {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  width: 35px; /* Cố định chiều rộng để số nhảy không bị giật */
  text-align: right;
}
/* =========================================
   LOCKED SETTINGS OVERLAY (Fixed)
   ========================================= */

/* 2. Chọn TẤT CẢ nội dung bên trong... */
.settings-locked-wrapper > * {
  /* CŨ: filter: blur(4px); opacity: 0.4; -> Mờ quá */

  /* MỚI: Chỉ làm xám và mờ cực nhẹ (0.5px) để nhìn rõ chữ */
  filter: grayscale(100%) blur(0.5px);
  opacity: 0.7; /* Tăng độ rõ lên (từ 0.4 lên 0.7) */

  pointer-events: none; /* Vẫn chặn click */
  user-select: none;
  transition: all 0.3s;
}

/* 2. Lớp phủ chứa nút MỞ KHÓA */
.settings-lock-overlay {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999 !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(1px);
}

/* 3. Nút MỞ KHÓA */
.btn-unlock-premium {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  border: 2px solid #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer !important;
  pointer-events: auto !important;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
  animation: pulse-btn 2s infinite;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-unlock-premium:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 30px rgba(245, 158, 11, 0.6);
}

@keyframes pulse-btn {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* 4. Trạng thái đã mở khóa */
.settings-unlocked {
  pointer-events: auto !important;
  filter: none !important;
  opacity: 1 !important;
}

/* ================= GACHA STYLES (VIP PRO) ================= */

/* Nút mở Gacha ở menu */
.btn-gacha-trigger {
  border-color: #f59e0b !important;
  color: #f59e0b !important;
  font-weight: 900 !important;
  background: rgba(245, 158, 11, 0.1) !important;
}

/* Khung nền tối Modal */
#gachaModal {
  display: none; /* Mặc định ẩn */
  position: fixed;
  inset: 0;
  z-index: 12000; /* Cao hơn tất cả */
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

/* QUAN TRỌNG: Rule này ép nó hiện khi JS set style */
#gachaModal[style*="display: flex"] {
  display: flex !important;
}

/* Hộp máy quay Gacha */
.gacha-box {
  background: #18181b;
  width: 360px;
  max-width: 90%;
  padding: 30px;
  border-radius: 24px;
  text-align: center;
  border: 3px solid #f59e0b;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
  position: relative;
}

.gacha-header {
  color: #f59e0b;
  font-size: 24px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.gacha-subtitle {
  color: #a1a1aa;
  font-size: 14px;
  margin-bottom: 20px;
}

/* Màn hình hiển thị số */
.gacha-screen {
  background: #000;
  border: 2px solid #3f3f46;
  border-radius: 12px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

#gachaDisplay {
  font-family: monospace;
  font-size: 80px;
  font-weight: 900;
  color: #fff;
}

/* Animation rung */
.gacha-shaking #gachaDisplay {
  animation: shakeNumber 0.1s infinite;
}

@keyframes shakeNumber {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }
  50% {
    transform: translate(-1px, 2px) rotate(-1deg);
  }
  100% {
    transform: translate(1px, -2px) rotate(-1deg);
  }
}

#gachaResultText {
  height: 24px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
}

/* Các nút bấm */
.gacha-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
}

.btn-gacha-close {
  background: transparent;
  border: 2px solid #52525b;
  color: #a1a1aa;
  border-radius: 12px;
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-gacha-spin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: none;
  color: #fff;
  border-radius: 12px;
  padding: 12px;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b45309;
}
.btn-gacha-spin:active {
  transform: translateY(4px);
  box-shadow: none;
}
.btn-gacha-spin:disabled {
  filter: grayscale(1);
  cursor: not-allowed;
}
/* =========================================
   LOCKED SETTINGS OVERLAY (FIXED: Nút rõ nét)
   ========================================= */

/* 1. Cái khung bao ngoài: KHÔNG ĐƯỢC MỜ (để nút hiển thị rõ) */
.settings-locked-wrapper {
  position: relative !important;
  overflow: hidden !important; /* Để cái mờ không bị tràn ra ngoài */
}

/* 2. Chọn TẤT CẢ nội dung bên trong để làm mờ... */
.settings-locked-wrapper > * {
  filter: blur(4px);
  opacity: 0.4;
  pointer-events: none; /* Chặn click vào nội dung mờ */
  user-select: none;
  transition: all 0.3s;
}

/* 3. ...NGOẠI TRỪ cái lớp phủ chứa nút (Reset lại cho rõ nét) */
.settings-locked-wrapper > .settings-lock-overlay {
  filter: none !important; /* Không mờ */
  opacity: 1 !important; /* Rõ 100% */
  pointer-events: auto !important; /* Cho phép click */

  /* Căn chỉnh vị trí đè lên trên */
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05); /* Nền siêu mỏng để ko che mất nút */
}

/* 4. Style cho cái nút MỞ KHÓA (Giữ nguyên vẻ đẹp trai) */
.settings-lock-overlay::after {
  content: "🔒 MỞ KHÓA TÍNH NĂNG";
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  padding: 14px 28px;
  border-radius: 50px;
  font-weight: 900;
  font-size: 15px;
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.5);
  animation: pulse-btn 2s infinite;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

@keyframes pulse-btn {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* 5. Khi đã mở khóa: Trả lại nguyên trạng */
.settings-unlocked > * {
  filter: none !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}
/* Ẩn luôn overlay khi đã mở */
.settings-unlocked > .settings-lock-overlay {
  display: none !important;
}
/* =========================================
   GACHA FREE SPIN BUTTON (Nút Xanh Thần Thánh)
   ========================================= */

/* Trạng thái nút khi có lượt Free */
.btn-gacha-spin.free-mode {
  background: linear-gradient(
    135deg,
    #22c55e 0%,
    #16a34a 100%
  ) !important; /* Xanh lá */
  box-shadow: 0 4px 0 #15803d !important;
  color: #fff !important;
  animation: pulse-green 1.5s infinite; /* Nhấp nháy mời gọi */
  font-size: 15px;
}

.btn-gacha-spin.free-mode:active {
  transform: translateY(4px);
  box-shadow: none !important;
}

/* Hiệu ứng nhịp đập màu xanh */
@keyframes pulse-green {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}
/* ======================================================
   FIX MOBILE V4: TỐI ƯU MẬT ĐỘ CHỮ (NHIỀU CHỮ/DÒNG)
   ====================================================== */

@media (max-width: 768px) {
  /* 1. CÂU HỎI: Nhỏ gọn, tận dụng tối đa chiều ngang */
  #mcqQuestion,
  body.theme-kahoot-v1 #mcqQuestion {
    /* Cỡ chữ 14px: Nhỏ nhưng vẫn đọc tốt, chứa được nhiều chữ */
    font-size: 14px !important;

    /* Nét chữ thường (mỏng) để không tốn diện tích */
    font-weight: 400 !important;

    /* Mẹo: Thu hẹp khoảng cách giữa các ký tự một chút xíu */
    letter-spacing: -0.3px !important;

    /* Giãn dòng vừa đủ */
    line-height: 1.5 !important;

    /* Giảm lề 2 bên xuống còn 5px để chữ tràn ra sát mép */
    padding: 15px 5px !important;

    /* Căn trái tự nhiên */
    text-align: left !important;

    /* Ép khung rộng 100% */
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 2. KHUNG CONTAINER CHÍNH: Mở rộng sát lề màn hình */
  #quiz .container {
    padding-left: 5px !important;
    padding-right: 5px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 3. ĐÁP ÁN: Cũng thu nhỏ theo cho đồng bộ */
  .opt,
  body.theme-kahoot-v1 .opt {
    font-size: 14px !important;
    padding: 12px 8px !important; /* Lề nhỏ lại */
    letter-spacing: -0.2px !important;
  }
} /* =================================================================
   PART 10: TRUE/FALSE GROUP STYLE - CANVA DESIGN (THANH CAM)
   ================================================================= */

/* 1. Container chung */
/* 1. Container chung - CHỈ ÁP DỤNG KHI CÓ CLASS tf-mode */
#mcqOpts.tf-mode {
  display: flex !important;
  flex-direction: column !important;
  gap: 15px !important;
  grid-template-columns: none !important; /* Hủy bỏ grid cũ */
}

/* 2. Từng dòng câu hỏi (Row) */
/* Quan trọng: Background trong suốt, không viền, chỉ là khung layout */
.tf-row {
  display: flex !important;
  align-items: stretch !important; /* Kéo giãn để chiều cao bằng nhau */
  justify-content: space-between !important;
  gap: 12px !important; /* Khoảng cách giữa Thanh Cam và Nút */
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  min-height: 60px; /* Chiều cao tối thiểu */
}

/* 3. THANH NỘI DUNG (Bên trái) - Style màu CAM */
.tf-content {
  flex: 1; /* Chiếm hết chiều rộng còn lại */
  background-color: #ea8c28; /* Màu cam chuẩn Canva */
  color: #ffffff; /* Chữ trắng */
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 0 #c27120; /* Bóng 3D cam đậm */
  transition: background-color 0.3s, transform 0.2s;
  font-family: "Noto Sans", sans-serif;
}

/* Badge 1, 2, 3... */
.tf-badge {
  background: transparent !important; /* Trong suốt */
  color: #fff !important;
  font-weight: 800;
  font-size: 18px;
  padding: 0;
  min-width: auto;
  height: auto;
  box-shadow: none !important;
}

/* Nội dung text câu hỏi */
.tf-text {
  color: #fff !important;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}

/* 4. KHU VỰC NÚT BẤM (Bên phải) */
.tf-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0; /* Không bị co lại */
  align-items: center;
}

/* Nút bấm (Mặc định màu TRẮNG) */
.btn-tf {
  width: 70px; /* Chiều rộng cố định */
  height: 100%; /* Cao bằng thanh text bên cạnh */
  min-height: 50px;
  background: #ffffff;
  color: #111827; /* Chữ đen */
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d1d5db; /* Bóng xám */
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Sans", sans-serif;
}

/* Hiệu ứng nhấn nút */
.btn-tf:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* --- TRẠNG THÁI ĐANG CHỌN (SELECTED) --- */

/* Chọn ĐÚNG -> Nút biến thành Xanh */
.btn-tf[data-val="true"].selected {
  background: #3b82f6 !important; /* Xanh dương */
  color: #fff !important;
  box-shadow: 0 4px 0 #1d4ed8 !important;
}

/* Chọn SAI -> Nút biến thành Cam/Đỏ */
.btn-tf[data-val="false"].selected {
  background: #3b82f6 !important; /* Xanh dương */
  color: #fff !important;
  box-shadow: 0 4px 0 #1d4ed8 !important;
}

/* --- TRẠNG THÁI KẾT QUẢ (Sau khi nộp) --- */

/* ĐÚNG -> Thanh nội dung hoá XANH LÁ */
.tf-row.result-correct .tf-content {
  background-color: #22c55e !important;
  box-shadow: 0 4px 0 #15803d !important;
}

/* SAI -> Thanh nội dung hoá ĐỎ */
.tf-row.result-wrong .tf-content {
  background-color: #ef4444 !important;
  box-shadow: 0 4px 0 #b91c1c !important;
}

/* Khóa thao tác */
.tf-row.locked {
  pointer-events: none;
}
.tf-row.locked .btn-tf:not(.selected) {
  opacity: 0.5; /* Làm mờ nút không chọn */
  box-shadow: none;
  background: #e5e7eb;
}

/* 5. NÚT NỘP BÀI (Góc phải dưới, màu xanh lá) */
#tfSubmitBtn {
  margin-top: 20px;
  padding: 14px 30px;
  background: #10b981; /* Xanh lá */
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 0 #059669;
  cursor: pointer;
  text-transform: uppercase;

  /* Căn sang phải */
  align-self: flex-end;
  display: block;
  margin-left: auto;
  min-width: 150px;
}
#tfSubmitBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #059669;
}
#tfSubmitBtn:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 600px) {
  .tf-row {
    flex-direction: column !important; /* Dọc */
    align-items: stretch !important;
    gap: 8px !important;
  }

  /* Nút trên mobile dàn ngang đều nhau */
  .tf-actions {
    justify-content: space-between;
    width: 100%;
  }
  .btn-tf {
    flex: 1; /* Mỗi nút chiếm 50% */
    height: 44px; /* Cao vừa phải */
  }

  /* Nút nộp bài full chiều rộng cho dễ bấm */
  #tfSubmitBtn {
    width: 100%;
  }
}
/* === FLOATING BELL (CHUÔNG THÔNG BÁO XỊN) === */
#floatingBell {
  position: fixed;
  bottom: 30px;
  right: 30px; /* Góc phải dưới */
  z-index: 9000;
}

/* Nút chuông tròn */
.bell-icon {
  width: 60px;
  height: 60px;
  background: #1e293b;
  border: 2px solid #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.bell-icon:hover {
  transform: scale(1.1);
  background: #334155;
}

/* Chấm đỏ đếm số */
.bell-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  font-weight: 800;
  font-size: 12px;
  height: 24px;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
}
/* Hiệu ứng rung */
@keyframes bellPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}
.bell-badge.pulse {
  animation: bellPulse 2s infinite;
}

/* Menu xổ lên (Dropdown) */
.bell-menu {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 300px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 10px 0;
  display: none; /* Mặc định ẩn */
  border: 1px solid #e2e8f0;
  max-height: 400px;
  overflow-y: auto;
}
.bell-menu.show {
  display: block;
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Item trong menu */
.bell-header {
  padding: 8px 15px;
  font-size: 12px;
  font-weight: 800;
  color: #94a3b8;
  border-bottom: 1px solid #f1f5f9;
}
.bell-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #f8fafc;
  transition: background 0.2s;
}
.bell-item:hover {
  background: #f1f5f9;
}
.bell-info {
  flex: 1;
  cursor: pointer;
}
.bell-title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}
.bell-desc {
  font-size: 12px;
  color: #ef4444;
}
.bell-mute-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.3;
  padding: 5px;
}
.bell-mute-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}
.bell-empty {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

/* Mobile: Cho chuông nhỏ lại xíu */
@media (max-width: 480px) {
  #floatingBell {
    bottom: 20px;
    right: 20px;
  }
  .bell-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
}
