/* =========================================================
   ALMA ACADEMY · GUEST ENGLISH FLASHCARDS
   ========================================================= */
:root{
  --bg: #FAFAF7; --bg-deep: #F1F0EA; --surface: #FFFFFF;
  --ink: #191933; --ink-soft: #4B4B63; --muted: #8B8BA0; --line: #ECEAE2;
  --violet: #7C5CFC; --violet-soft: #EDE9FE;
  --cyan: #17B6D4; --cyan-soft: #DEF7FB;
  --mint: #1FAE7E; --mint-soft: #DEF7EC;
  --coral: #FF6B57; --coral-soft: #FFE9E3;
  --yellow: #E7A400; --yellow-soft: #FFF3D6;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius-card: 26px; --radius-lg: 20px; --radius-md: 14px; --radius-sm: 10px;
  --frame-w: 420px; --frame-h: 860px;
}

*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Ẩn overflow để không bao giờ bị cuộn trang, khóa khung cứng 100dvh */
html, body{ margin:0; padding:0; height:100%; overflow: hidden; background: var(--bg-deep); font-family: var(--font-body); color: var(--ink); overscroll-behavior: none; }
button{ font-family: inherit; border:none; background:none; cursor:pointer; }
svg{ width: 20px; height:20px; display:block; }

.stage{ position: relative; width: 100%; height: 100dvh; display:flex; flex-direction:column; background: radial-gradient(760px 520px at 18% 8%, #EDE9FE 0%, transparent 60%), radial-gradient(720px 520px at 84% 92%, #DEF7FB 0%, transparent 55%), var(--bg-deep); }
@media (min-width: 640px){ .stage{ max-width: var(--frame-w); height: var(--frame-h); max-height: 90vh; margin: 40px auto; border-radius: 44px; box-shadow: 0 40px 90px -30px rgba(25,25,51,0.35), 0 0 0 10px #0e0e1a, 0 0 0 12px #2b2b3d; overflow: hidden; padding: 0; } }

.screen{ flex: 1; display:none; flex-direction: column; min-height: 0; position: relative; background: transparent; }
.screen.active{ display:flex; }

/* WELCOME SCREEN / ĐĂNG NHẬP */
.welcome-screen { 
  justify-content: flex-start; 
  align-items: center; 
  padding: 24px 16px 36px; 
  text-align: center; 
  overflow-y: auto;
}
@media (min-height: 720px) {
  .welcome-screen { justify-content: center; }
}

.welcome-content { 
  background: var(--surface); 
  padding: 28px 20px; 
  border-radius: var(--radius-lg); 
  box-shadow: 0 20px 40px -20px rgba(25,25,51,0.15); 
  width: 100%; 
  max-width: 360px; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}
.welcome-topbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(25, 25, 51, 0.06);
  transition: all 0.15s ease;
  user-select: none;
}
.lang-switch-btn:hover {
  background: var(--violet-soft);
  border-color: var(--violet);
  color: var(--violet);
}
.lang-switch-btn:active {
  transform: scale(0.93);
}
.lang-switch-btn .lang-icon {
  font-size: 13px;
  line-height: 1;
}
.lang-switch-btn .lang-code {
  letter-spacing: 0.06em;
}
.welcome-logo { 
  width: 58px; height: 58px; 
  border-radius: 18px; 
  background: linear-gradient(135deg, var(--violet), var(--cyan)); 
  color: #fff; 
  display: flex; align-items: center; justify-content: center; 
  margin-bottom: 14px; 
}
.welcome-logo svg { width: 32px; height: 32px; }
.welcome-title { font-family: var(--font-display); font-size: 23px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.welcome-sub { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 18px; }

/* THẺ THÔNG TIN ĐÃ ĐĂNG NHẬP */
.logged-user-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--violet-soft);
  border: 1px solid rgba(124, 92, 252, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  text-align: left;
}
.logged-user-info { display: flex; flex-direction: column; min-width: 0; }
.logged-user-name { font-size: 13.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logged-user-sub { font-family: var(--font-mono); font-size: 11px; color: var(--violet); }
.btn-text-change { font-size: 11.5px; font-weight: 600; color: var(--violet); text-decoration: underline; cursor: pointer; padding: 4px; }

/* FORM ĐĂNG NHẬP */
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 4px; }
.form-label .req { color: var(--coral); }
.form-input, .form-select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-input:focus, .form-select:focus {
  border-color: var(--violet);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--violet-soft);
}
.form-input::placeholder { color: var(--muted); font-size: 13px; }
.login-error {
  font-size: 12px;
  color: var(--coral);
  background: var(--coral-soft);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  display: none;
}

/* TOP BAR */
.topbar{ display:flex; align-items:center; justify-content:space-between; padding: 12px 16px 8px; flex-shrink: 0; }
.icon-btn{ width:38px; height:38px; border-radius:12px; display:flex; align-items:center; justify-content:center; color: var(--ink); background: var(--surface); box-shadow: 0 1px 0 rgba(25,25,51,0.05), 0 4px 10px -6px rgba(25,25,51,0.15); }
.icon-btn:active{ transform: scale(0.94); }
.topbar-title{ display:flex; flex-direction:column; align-items:center; }
.topbar-eyebrow{ font-family: var(--font-mono); font-size:10.5px; letter-spacing:0.08em; text-transform:uppercase; color: var(--muted); }
.topbar-name{ font-family: var(--font-display); font-weight:600; font-size:15px; color: var(--ink); margin-top:2px; }
.topbar-right{ display: flex; align-items: center; gap: 8px; }
.user-pill{ 
  display: flex; align-items: center; gap: 5px; 
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; 
  color: var(--ink-soft); background: var(--surface); 
  border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px;
  max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.progress-badge{ font-family: var(--font-mono); font-size:12.5px; font-weight:600; color: var(--violet); background: var(--violet-soft); padding: 7px 11px; border-radius: 12px; }

/* STACK & NAVIGATION TỐI ƯU 1 KHUNG MÀN HÌNH */
.stack-wrap{ flex:1; min-height: 0; display:flex; flex-direction:column; align-items:center; justify-content:center; padding: 10px 20px 24px; position: relative; }
.card-stack{ position: relative; width: 100%; max-width: 360px; flex: 1; min-height: 0; }

.card-controls { 
  display: flex; align-items: center; justify-content: space-between; 
  width: 100%; max-width: 360px; margin-top: 16px; flex-shrink: 0;
}
.nav-btn { width: 52px; height: 52px; border-radius: 50%; background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px -4px rgba(25,25,51,0.15); border: 2px solid var(--line); transition: transform 0.15s ease, border-color 0.15s ease; }
.nav-btn:active { transform: scale(0.92); border-color: var(--violet); color: var(--violet); }
.nav-btn.disabled { opacity: 0.4; pointer-events: none; }

.control-hint { 
  font-family: var(--font-body); font-size: 14px; font-weight: 600; 
  color: var(--muted); display:flex; align-items:center; gap:8px; 
}
.control-hint svg { width:18px; height:18px; opacity: 0.8; }

/* FLASHCARDS */
.flash-card{ position:absolute; inset:0; border-radius: var(--radius-card); touch-action: pan-y; cursor: grab; }
.flash-card:not(.flipped){ touch-action: none; }
.flash-card.top-card,
.flash-card.grabbing,
.flash-card.snapping,
.flash-card.exiting{ will-change: transform, opacity; }
.flash-card.grabbing{ cursor: grabbing; }
.flash-card.exiting{ transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .25s ease; }
.flash-card.snapping{ transition: transform .30s cubic-bezier(.34,1.56,.64,1); }
.card-flip{ position:relative; width:100%; height:100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.4,.2,.2,1); }
.flash-card.flipped .card-flip{ transform: rotateY(180deg); }

.card-face{
  position:absolute; inset:0; border-radius: var(--radius-card);
  background: var(--surface); backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 0 rgba(25,25,51,0.04), 0 16px 32px -12px rgba(25,25,51,0.22);
  display:flex; flex-direction:column; overflow:hidden;
  padding: 22px 22px; 
}
.card-back{
  transform: rotateY(180deg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 110, 140, 0.35) transparent;
}
.card-back::-webkit-scrollbar {
  width: 5px;
}
.card-back::-webkit-scrollbar-track {
  background: transparent;
}
.card-back::-webkit-scrollbar-thumb {
  background: rgba(100, 110, 140, 0.35);
  border-radius: 4px;
}

.card-tab{ position:absolute; top:0; left:24px; width: 56px; height: 8px; border-radius: 0 0 6px 6px; transform: translateY(-1px); }
.type-concept .card-tab{ background: var(--violet); } .type-image .card-tab{ background: var(--cyan); } .type-definition .card-tab{ background: var(--coral); } .type-recall .card-tab{ background: var(--yellow); } .type-example .card-tab{ background: var(--mint); } .type-comparison .card-tab{ background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.card-kicker{ display:flex; align-items:center; gap:8px; font-family: var(--font-mono); font-size:12px; letter-spacing:0.06em; text-transform:uppercase; font-weight:600; margin-bottom: 14px; flex-shrink: 0;}
.type-concept .card-kicker{ color: var(--violet); } .type-image .card-kicker{ color: var(--cyan); } .type-definition .card-kicker{ color: var(--coral); } .type-recall .card-kicker{ color: var(--yellow); } .type-example .card-kicker{ color: var(--mint); }
.card-kicker .dot{ width:6px; height:6px; border-radius:50%; background: currentColor; }

/* ẢNH TỰ RESIZE VÀ TRÀN LỀ HIỆU QUẢ */
.card-image{
  flex: 1 1 auto; 
  min-height: 0;  
  width: calc(100% + 44px); margin: 0 -22px 14px -22px;
  background: #f7f6f2;
  display:flex; align-items:center; justify-content:center;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
.card-image img{ 
  max-width: 100%; max-height: 100%; 
  width: auto; height: auto;
  display:block; object-fit: contain; 
}

/* NÚT PHÓNG TO ẢNH Ở GIỮA (TRÁNH ẤN NHẦM KHI VUỐT KÉO THẺ) */
.btn-zoom-image {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 18px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(18, 20, 36, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.btn-zoom-image svg {
  flex-shrink: 0;
  stroke: #48d1cc;
}
.btn-zoom-image:hover {
  background: rgba(18, 18, 38, 0.95);
  transform: translateX(-50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.btn-zoom-image:active {
  transform: translateX(-50%) scale(0.96);
}

/* CHỮ TỰ CĂN GIỮA NẾU KHÔNG CÓ HÌNH */
.card-body{ 
  flex: 0 0 auto; display:flex; flex-direction:column; margin-bottom: auto; 
}
.card-body.center-content {
  flex: 1; justify-content: center;
}
.card-body.back-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: visible;
  padding-right: 2px;
}

.card-question{ font-family: var(--font-display); font-weight:700; font-size: 22px; line-height:1.32; color: var(--ink); margin: 0; }
.card-question.compact{ font-size:18px; }
.card-para{ font-family: var(--font-body); font-size:15px; line-height:1.55; color: var(--ink-soft); margin: 0; }
.card-bullet{ display:flex; align-items:flex-start; gap:8px; font-size:14px; line-height:1.5; color: var(--ink-soft); }
.card-bullet .bullet-dot{ color: var(--violet); font-weight:700; flex-shrink: 0; }

.card-footer{ margin-top: 12px; flex-shrink: 0; display:flex; align-items:center; justify-content:space-between; padding-top: 12px; border-top: 1px solid var(--line); }
.card-source{ font-family: var(--font-mono); font-size:11px; color: var(--muted); }
.card-hint-flip{ font-family: var(--font-mono); font-size:10px; color: var(--muted); font-style: italic; }

/* SWIPE CUES */
.swipe-glow{ position:absolute; inset:0; border-radius: var(--radius-card); opacity:0; pointer-events:none; transition: opacity .12s ease; }
.swipe-glow.left{ box-shadow: inset 0 0 0 3px var(--coral); }
.swipe-glow.right{ box-shadow: inset 0 0 0 3px var(--mint); }

/* SCREENS & BUTTONS */
.complete-screen{ align-items:center; justify-content:center; padding: 28px 24px; background: var(--bg); overflow-y: auto; }
.complete-card{ width:100%; text-align:center; display:flex; flex-direction:column; align-items:center; max-width: 360px; margin: auto; }
.complete-badge{ width:72px; height:72px; border-radius:50%; background: var(--mint-soft); color: var(--mint); display:flex; align-items:center; justify-content:center; margin-bottom: 16px; animation: popIn .5s cubic-bezier(.34,1.56,.64,1); }
.complete-badge svg{ width:34px; height:34px; }
.done-badge{ background: var(--yellow-soft); color: var(--yellow); }
@keyframes popIn{ 0%{ transform: scale(0); opacity:0; } 60%{ transform: scale(1.12); opacity:1; } 100%{ transform: scale(1); } }
.complete-eyebrow{ font-family: var(--font-mono); font-size:12px; letter-spacing:0.06em; text-transform:uppercase; color: var(--muted); margin: 0 0 8px; }
.complete-title{ font-family: var(--font-display); font-size: 24px; font-weight:700; margin: 0 0 20px; color: var(--ink); }
.done-sub{ font-size:14px; color: var(--ink-soft); line-height:1.6; margin: -6px 0 24px; max-width: 320px; }
.complete-stats{ display:flex; gap: 12px; margin-bottom: 28px; width:100%; justify-content:center; }
.stat{ background: var(--surface); border-radius: var(--radius-md); padding: 14px 18px; box-shadow: 0 1px 0 rgba(25,25,51,0.04), 0 10px 24px -14px rgba(25,25,51,0.2); display:flex; flex-direction:column; gap:4px; min-width: 110px; }
.stat-num{ font-family: var(--font-display); font-size:20px; font-weight:700; color: var(--ink); }
.stat-label{ font-size:11px; color: var(--muted); }

.btn-primary{ display:flex; align-items:center; justify-content:center; gap:8px; background: var(--ink); color: #fff; padding: 16px 26px; border-radius: 999px; font-family: var(--font-display); font-weight:600; font-size:15px; box-shadow: 0 14px 28px -14px rgba(25,25,51,0.55); width:100%; max-width: 300px; transition: transform 0.15s ease; }
.btn-primary:active{ transform: scale(0.97); }
.btn-primary svg{ width:18px; height:18px; }
.btn-small{ padding: 12px 20px; font-size: 14px; }

.btn-secondary {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--ink);
  padding: 14px 26px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  border: 2px solid var(--line);
  box-shadow: 0 4px 12px -4px rgba(25,25,51,0.08);
  width: 100%; max-width: 300px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:active { transform: scale(0.97); border-color: var(--violet); }

/* QUIZ OVERLAY */
.quiz-overlay{ position: fixed; inset:0; z-index: 50; display:flex; align-items:flex-end; justify-content:center; background: rgba(25,25,51,0.38); opacity:0; pointer-events:none; transition: opacity .3s ease; }
.quiz-overlay.open{ opacity:1; pointer-events:auto; }
.quiz-sheet{ width:100%; max-width: var(--frame-w); background: var(--bg); border-radius: 28px 28px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .38s cubic-bezier(.22,.61,.36,1); box-shadow: 0 -20px 50px -20px rgba(25,25,51,0.4); max-height: 85vh; overflow-y: auto; }
.quiz-overlay.open .quiz-sheet{ transform: translateY(0); }
.quiz-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom: 12px; }
.quiz-eyebrow{ font-family: var(--font-mono); font-size:11px; letter-spacing:0.08em; text-transform:uppercase; color: var(--violet); font-weight:600; }
.quiz-progress{ font-family: var(--font-mono); font-size:12px; color: var(--muted); }
.quiz-question{ font-family: var(--font-display); font-size:18px; font-weight:600; margin: 0 0 18px; color: var(--ink); line-height:1.32; }
.quiz-options{ display:flex; flex-direction:column; gap:10px; }
.quiz-opt{ display:flex; align-items:center; gap:12px; text-align:left; padding: 14px 14px; border-radius: var(--radius-md); background: var(--surface); border: 2px solid var(--line); font-size: 14.5px; color: var(--ink); transition: border-color .15s ease, background .15s ease, transform .1s ease; }
.quiz-opt:active{ transform: scale(0.98); }
.quiz-opt .opt-letter{ width: 26px; height:26px; border-radius:8px; background: var(--bg-deep); color: var(--ink-soft); display:flex; align-items:center; justify-content:center; font-family: var(--font-mono); font-size:12px; font-weight:600; flex-shrink:0; }
.quiz-opt.selected{ border-color: var(--violet); background: var(--violet-soft); }
.quiz-opt.correct{ border-color: var(--mint); background: var(--mint-soft); }
.quiz-opt.correct .opt-letter{ background: var(--mint); color:#fff; }
.quiz-opt.incorrect{ border-color: var(--coral); background: var(--coral-soft); }
.quiz-opt.incorrect .opt-letter{ background: var(--coral); color:#fff; }
.quiz-opt.disabled{ pointer-events:none; }
.quiz-feedback{ max-height:0; overflow:hidden; opacity:0; transition: max-height .35s ease, opacity .35s ease, margin .35s ease; }
.quiz-feedback.show{ max-height: 260px; opacity:1; margin-top:16px; }
.feedback-verdict{ font-family: var(--font-display); font-weight:600; font-size:15px; margin: 0 0 4px; }
.feedback-verdict.good{ color: var(--mint); } .feedback-verdict.bad{ color: var(--coral); }
.feedback-explain{ font-size: 13.5px; color: var(--ink-soft); line-height:1.5; margin: 0 0 16px; }

/* FINAL EXAM SCREEN (KỲ THI 20 CÂU) */
.exam-screen { padding-bottom: 16px; }
.exam-bar-track {
  width: 100%; height: 5px; background: var(--line); position: relative; overflow: hidden; flex-shrink: 0;
}
.exam-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width 0.3s ease;
}
.exam-icon-badge {
  width: 38px; height: 38px; border-radius: 12px; background: var(--violet-soft); color: var(--violet);
  display: flex; align-items: center; justify-content: center;
}
.exam-card-wrap {
  flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 18px; overflow-y: auto;
}
.exam-card {
  background: var(--surface); border-radius: var(--radius-card); padding: 22px 18px;
  box-shadow: 0 10px 30px -10px rgba(25,25,51,0.12); display: flex; flex-direction: column; gap: 14px;
}
.exam-question {
  font-family: var(--font-display); font-size: 17.5px; font-weight: 700; color: var(--ink); line-height: 1.35; margin: 0;
}
.exam-options {
  display: flex; flex-direction: column; gap: 10px;
}
.exam-feedback {
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height 0.35s ease, opacity 0.35s ease, margin 0.35s ease;
}
.exam-feedback.show {
  max-height: 280px; opacity: 1; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line);
}
.exam-score-box {
  margin: 12px 0 20px; display: flex; justify-content: center;
}
.score-circle {
  width: 126px; height: 126px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-soft), var(--cyan-soft));
  border: 4px solid var(--surface); box-shadow: 0 12px 30px -8px rgba(124,92,252,0.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-val {
  font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--ink);
}
.score-pct {
  font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--violet); margin-top: 2px;
}
.exam-result-badge {
  background: var(--yellow-soft); color: var(--yellow);
}

/* ============ IMAGE LIGHTBOX MODAL (PINCH-TO-ZOOM & PAN) ============ */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(12, 12, 24, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 16px;
  touch-action: none;
}
.image-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10002;
  transition: transform 0.2s ease, background 0.2s ease;
  touch-action: manipulation;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.08);
}
.lightbox-close svg {
  width: 24px;
  height: 24px;
}

/* THANH ĐIỀU KHIỂN PHÓNG TO / THU NHỎ TIỆN LỢI */
.lightbox-zoom-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(24, 26, 44, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
  z-index: 10002;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.lb-ctrl-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  touch-action: manipulation;
}
.lb-ctrl-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.9);
}
.lb-ctrl-btn.lb-ctrl-reset {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  width: auto;
  min-width: 36px;
  padding: 0 6px;
  color: #48d1cc;
}

.lightbox-content {
  width: 100%;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: zoomLightbox 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes zoomLightbox {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-img-wrapper {
  width: 100%;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  touch-action: none;
  cursor: grab;
}
.lightbox-img-wrapper.is-panning {
  cursor: grabbing;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
}
.lightbox-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  padding: 0 8px;
  z-index: 10001;
}
.lightbox-caption {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #f1f2f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lightbox-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

/* ============ THÔNG TIN HỌC VIÊN TỔNG KẾT ============ */
.student-summary-card {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 10px 0 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  text-align: left;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}
.summary-label {
  color: var(--muted);
  font-weight: 500;
}
.summary-val {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}
.summary-val.font-mono {
  font-family: var(--font-mono);
  color: var(--violet);
}
.summary-quizzes {
  border-top: 1px dashed var(--line);
  padding-top: 6px;
  margin-top: 2px;
}

/* ============ SHEET SYNC CARD ============ */
.sheet-sync-card {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #fbfbfa;
  border: 1.5px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  transition: all 0.25s ease;
}
.sheet-sync-card.success {
  background: #f0fdf4;
  border-color: rgba(31, 174, 126, 0.35);
}
.sheet-sync-card.error {
  background: #fef2f2;
  border-color: rgba(255, 107, 87, 0.35);
}
.sync-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sync-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--violet-soft);
  color: var(--violet);
}
.sync-icon.spin {
  animation: syncSpin 1.1s linear infinite;
}
@keyframes syncSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.sheet-sync-card.success .sync-icon {
  background: var(--mint-soft);
  color: var(--mint);
}
.sheet-sync-card.error .sync-icon {
  background: var(--coral-soft);
  color: var(--coral);
}
.sync-text-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sync-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.sync-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 1px;
}
.sync-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.btn-sync-action {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 8px;
  background: var(--violet);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.btn-sync-action:active { transform: scale(0.96); }
