/* 
 * CLEANED ANKI LOL STYLES 
 * Merged & Deduplicated 
 */
/* =====================================================================
   STYLE MAP (KHÔNG Ð?I TH? T? RULE TR? KHI B?N HI?U RÕ CASCADE)
   M?c tiêu file này: gom chung CSS cho 2 ph?n:
   - [CARD] Th? h?c (korean-text, vietnamese-meaning, note-box, copy/play...)
   - [GAME] UI game (HUD, Top Bar, Boss, Inventory, Modal, PVP/TFT, Shop...)
   - [SHARED] Dùng chung cho c? 2 (reset, container, button/input base, ti?n ích...)

   M?O TÌM NHANH:
   - Ctrl+F: "SECTION:" d? nh?y theo t?ng c?m.
   - Ctrl+F: "[CARD]" / "[GAME]" / "[SHARED]" / "[THEME]" d? l?c dúng nhóm.
   ===================================================================== */



:root {
  --font-vietnamese: "Be Vietnam Pro", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-korean: "Noto Sans KR", "Malgun Gothic", sans-serif;
  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-soft: #F1F5F9;
  --bg-hover: #E2E8F0;

  --text-main: #0F172A;
  --text-soft: #475569;
  --text-muted: #94A3B8;

  --border-soft: rgba(15, 23, 42, 0.06);
  --border-strong: rgba(15, 23, 42, 0.10);

  --primary: #6366F1;
  --primary-soft: rgba(99, 102, 241, .08);

  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;

  --shadow-soft:
    0 4px 12px rgba(15, 23, 42, .04),
    0 8px 24px rgba(15, 23, 42, .06);
}

html.dark {
  color-scheme: dark !important;
  --bg-main: #0B0F19;
  --bg-surface: #111827;
  --bg-soft: #1E293B;
  --bg-hover: #334155;

  --text-main: #F8FAFC;
  --text-soft: #CBD5E1;
  --text-muted: #94A3B8;

  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --shadow-soft:
    0 4px 12px rgba(0, 0, 0, .3),
    0 8px 24px rgba(0, 0, 0, .4);
}

html {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  height: 100%;
}

html:not(.dark) {
  color-scheme: light !important;
}

/* [FIX GIẬT KHUNG] Override Anki PC webview.css:
   body { transition: opacity var(--transition-medium) ease-out }
   Đây là nguyên nhân chính khiến toàn bộ khung bị giật/nhảy khi lật thẻ */
html,
body {
  transition: none !important;
  -webkit-transition: none !important;
  animation: none !important;
  opacity: 1 !important;
}

body {
  font-family: var(--font-vietnamese);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body,
.hw-app-layout,
main,
section {
  background: var(--bg-main) !important;
  color: var(--text-main) !important;
}

/* [iOS FIX] Force touch events on ALL clickable elements */
* {
  cursor: pointer !important;
  -webkit-tap-highlight-color: transparent;
}

/* [VIRTUAL KEYBOARD ANTI-JITTER & iOS AUTO-ZOOM PREVENTION]
   Enforce font-size: 16px minimum on mobile devices.
   On iOS Safari / WebKit, any input with font-size < 16px triggers an automatic
   screen zoom that displaces the viewport, misaligns the cursor, and vibrates the screen on keystrokes. */
@media screen and (max-width: 768px) {

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="color"]):not([type="file"]),
  textarea,
  select {
    font-size: 16px !important;
    touch-action: manipulation;
  }
}

input,
textarea,
select {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: clip;
  min-height: 100%;
}

.card,
#content,
#qa,
#qa_box,
#qa_inner,
.flip-container,
.flip-inner,
.flip-face,
.flip-face.back,
.flip-face.front {
  font-family: var(--font-vietnamese);
  font-size: 20px;
  text-align: center;
  margin: 0;
  /* [FIX GIẬT KHUNG] Tắt 3D transform + transition từ Anki */
  transition: none !important;
  -webkit-transition: none !important;
  transform: none !important;
  -webkit-transform: none !important;
  transform-style: flat !important;
  -webkit-transform-style: flat !important;
  opacity: 1 !important;
}

/* Mode OFF: .card trở về sáng */
html.anki-mode-off .card {
  color: #333;
  background-color: #f0f2f5;
}

button {
  font-family: var(--font-vietnamese) !important;
}

select {
  font-family: var(--font-vietnamese) !important;
}

input {
  font-family: var(--font-vietnamese) !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
}

textarea {
  font-family: var(--font-vietnamese) !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
}

[contenteditable] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
  pointer-events: auto !important;
}

.container {
  /* [FIX CHỚP] Mặc định tối để tránh white flash khi load thẻ mới (back→front) */
  background-color: #091428;
  max-width: 600px;
  margin: 20px auto;
  padding: 30px 25px;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

/* Mode OFF: trở về giao diện sáng trắng gốc */
html.anki-mode-off .container {
  background-color: #ffffff;
}

@media (max-width: 640px) {
  .container {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 20px 15px;
    min-height: 100vh;
    border: none;
  }
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 15px auto;
  display: block;
  /* Anti-flicker cho ảnh */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  min-height: 1px;
}

b {
  color: #d32f2f;
  font-weight: 700;
}

strong {
  color: #d32f2f;
  font-weight: 700;
}


/* =====================================================================
   SECTION: [CARD] STUDY CARD CONTENT
   - Ch? Hàn, nghia Vi?t, ghi chú, copy button, play button.
   ===================================================================== */
.korean-text {
  font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  font-size: 2.6em;
  /* [FIX CHỚP] Mặc định tối (gold) - không cần chờ .skin-tutien */
  color: #c8aa6e;
  font-weight: 800;
  margin: 10px 0;
  line-height: 1.2;
}

html.anki-mode-off .korean-text {
  color: #1976D2;
}

.vietnamese-meaning {
  /* [FIX CHỚP] Mặc định tối */
  background: rgba(200, 170, 110, 0.05);
  color: #f0e6d2;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  margin: 15px 0;
  border-left: 3px solid #C8AA6E;
}

html.anki-mode-off .vietnamese-meaning {
  background-color: #e3f2fd;
  color: #0d47a1;
  border-left: 4px solid #2196F3;
}

.meaning-highlight {
  background-color: #e3f2fd;
  color: #0d47a1;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  display: inline-block;
  margin: 15px 0;
  border-left: 4px solid #2196F3;
}

.note-box {
  /* [FIX CHỚP] Mặc định tối */
  background: #05101e;
  color: #888;
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  text-align: left;
  font-size: 0.95em;
  border: 1px solid #444;
}

html.anki-mode-off .note-box {
  background-color: #f1f8e9;
  color: #33691e;
  border: none;
  border-left: 5px solid #8bc34a;
}

.copy-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0 10px 0;
  position: relative;
  height: 40px;
}

.copy-btn {
  background-color: #ffffff;
  border: 1px solid #cfd8dc;
  color: #546e7a;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: 0.2s;
}

.copy-btn:active {
  transform: scale(0.95);
  background-color: #eceff1;
}

button.btn-play {
  border: none;
  color: #ffffff !important;
  padding: 8px 16px;
  font-size: 15px;
  margin: 5px;
  cursor: pointer;
  border-radius: 25px;
  font-weight: 700;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}


/* =====================================================================
   SECTION: [SHARED] ANIMATIONS (KEYFRAMES)
   - Keyframes có th? du?c dùng ? c? th? h?c và game.
   ===================================================================== */
@keyframes fadeInDown {

  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }

}


/* =====================================================================
   SECTION: [GAME] HUD / RANK BADGE / EXP BAR
   - HUD chính, rank colors (.text-rank-*, .rank-lvl-*), exp bar, avatar.
   ===================================================================== */
.hud-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

@keyframes rotateLight {

  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }

}

.text-rank-0 {
  --rank-glow: #616161;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(97, 97, 97, 0.4);
}

.rank-lvl-0 #rank-badge {
  color: #9E9E9E;
  text-shadow: 1px 1px 0 #424242, 0 0 8px rgba(97, 97, 97, 0.6);
}

.text-rank-1 {
  --rank-glow: #CD7F32;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(205, 127, 50, 0.4);
}

.rank-lvl-1 #rank-badge {
  color: #CD7F32;
  text-shadow: 1px 1px 0 #5D4037, 0 0 8px rgba(205, 127, 50, 0.6);
}

.text-rank-2 {
  --rank-glow: #E0E0E0;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(224, 224, 224, 0.4);
}

.rank-lvl-2 #rank-badge {
  color: #EEEEEE;
  text-shadow: 1px 1px 0 #616161, 0 0 8px rgba(224, 224, 224, 0.6);
}

.text-rank-3 {
  --rank-glow: #FFD700;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(255, 215, 0, 0.4);
}

.rank-lvl-3 #rank-badge {
  color: #FFD700;
  text-shadow: 1px 1px 0 #BF360C, 0 0 8px rgba(255, 215, 0, 0.8);
}

.text-rank-4 {
  --rank-glow: #00BCD4;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(0, 188, 212, 0.4);
}

.rank-lvl-4 #rank-badge {
  color: #4DD0E1;
  text-shadow: 1px 1px 0 #006064, 0 0 8px rgba(0, 188, 212, 0.8);
}

.text-rank-5 {
  --rank-glow: #00E676;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(0, 230, 118, 0.4);
}

.rank-lvl-5 #rank-badge {
  color: #69F0AE;
  text-shadow: 1px 1px 0 #1B5E20, 0 0 8px rgba(0, 230, 118, 0.8);
}

.text-rank-6 {
  --rank-glow: #00E5FF;
  color: #00E5FF !important;
  text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

.rank-lvl-6 #rank-badge {
  color: #84FFFF;
  text-shadow: 1px 1px 0 #006064, 0 0 10px rgba(0, 229, 255, 0.8);
}

.text-rank-7 {
  --rank-glow: #D500F9;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(213, 0, 249, 0.4);
}

.rank-lvl-7 #rank-badge {
  color: #E040FB;
  text-shadow: 1px 1px 0 #4A148C, 0 0 8px rgba(213, 0, 249, 0.8);
}

.text-rank-8 {
  --rank-glow: #FF1744;
  color: var(--rank-glow) !important;
  text-shadow: 0 0 5px rgba(255, 23, 68, 0.4);
}

.rank-lvl-8 #rank-badge {
  color: #FF5252;
  text-shadow: 1px 1px 0 #B71C1C, 0 0 8px rgba(255, 23, 68, 0.8);
}

.text-rank-9 {
  --rank-glow: #F4C430;
  color: #FFD600 !important;
  text-shadow: 0 0 5px rgba(255, 214, 0, 0.6);
}

.rank-lvl-9 #rank-badge {
  color: #FFFF00;
  text-shadow: 1px 1px 0 #1A237E, 0 0 10px rgba(244, 196, 48, 1);
}

.exp-area {
  flex-grow: 1;
  text-align: left;
}

.cultivator-name {
  font-family: 'Tahoma', 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: normal;
  color: #37474F;
  margin-bottom: 4px;
}

.exp-bar-bg {
  height: 10px;
  background: #eceff1;
  border-radius: 5px;
  overflow: hidden;
}

.exp-bar-animate {
  transition: width 0.5s ease-out !important;
}

.exp-text {
  font-size: 11px;
  color: #78909c;
  margin-top: 4px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.mini-controls {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: center;
  border-top: 1px solid #f0f0f0;
  padding-top: 15px;
}

.mini-btn {
  background: #fff;
  border: 1px solid #cfd8dc;
  color: #78909c;
  border-radius: 8px;
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.mini-btn:hover {
  background: #f5f5f5;
  color: #455a64;
}

@keyframes popIn {

  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }

}


/* =====================================================================
   SECTION: [GAME] INVENTORY ITEMS + LOOT + TOAST
   - inv-item, equipped badge, loot icon, toast notification, animation loot.
   ===================================================================== */
.inv-item {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  background: #eee;
  border-radius: 6px;
  border: 2px solid #ccc;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s;
  overflow: hidden;
  box-sizing: border-box;
}

.inv-item:active {
  transform: scale(0.95);
}

.inv-item.tier-0 {
  border-color: #50c878;
  background: transparent;
}

.inv-item.tier-1 {
  border-color: #00BFFF;
  background: transparent;
}

.inv-item.tier-2 {
  border-color: #9b59b6;
  background: transparent;
}

.inv-item.tier-3 {
  border-color: #ff4444;
  background: transparent;
}

.inv-item.tier-4 {
  border-color: #FFD700;
  background: transparent;
  box-shadow: 0 0 5px #FFD700;
}

.inv-item img {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 0 !important;
  display: block;
}

#inv-actions .btn-action {
  width: auto !important;
  flex: 1;
  margin: 0 !important;
  font-size: 9px !important;
  padding: 6px 2px !important;
  white-space: normal;
  line-height: 1.1;
  min-width: 0;
}

.item-level {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 9px;
  padding: 1px 3px;
  border-top-left-radius: 4px;
}

#action-area .btn-action {
  padding: 6px 4px !important;
  font-size: 10px !important;
  margin: 0 !important;
  flex: 1;
  min-width: 60px;
  border-radius: 6px;
}

.detail-img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.detail-name {
  font-weight: bold;
  font-size: 18px;
  color: #333;
}

.detail-tier {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
  margin-bottom: 10px;
}

.btn-enhance {
  background: linear-gradient(135deg, #FFA000, #FF6F00);
  color: white;
}

.btn-sell {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef5350;
}

.btn-sac-all:active {
  transform: scale(0.95);
}

.btn-enhance-all:active {
  transform: scale(0.95);
}

.champ-role-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  margin-top: 4px;
  color: #fff;
}

.role-tank {
  background: #795548;
}

.role-fighter {
  background: #D84315;
}

.role-mage {
  background: #5E35B1;
}

.role-assassin {
  background: #C62828;
}

.role-marksman {
  background: #0277BD;
}

.role-support {
  background: #00897B;
}

.champ-lore {
  font-size: 11px;
  color: #666;
  margin: 8px 0;
  font-style: italic;
  line-height: 1.4;
}

.btn-equip {
  background: #2E7D32;
  color: white;
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  border-radius: 6px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.btn-equip:disabled {
  background: #ccc;
  cursor: default;
}

.inv-item.equipped::after {
  content: '?';
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* [REMOVED] .toast-msg.show → moved to game_core.js */

.modal-textarea {
  width: 100%;
  height: 100px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  background: #f9f9f9;
  color: #333;
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
}

.modal-textarea:focus {
  background: #fff;
  border-color: #2196F3;
  outline: none;
}

.hidden {
  display: none !important;
}

.pos-rel {
  position: relative !important;
}



input#typeans {
  font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  font-size: 20px;
  text-align: center;
  color: #1976D2;
  background-color: #f5faff;
  border: 2px solid #b3e5fc;
  border-radius: 12px;
  padding: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 15px 0;
  outline: none;
  transition: all 0.3s;
}

input#typeans:focus {
  border-color: #2196F3;
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.typeGood {
  background-color: #e8f5e9;
  color: #2e7d32;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
}

.typeBad {
  background-color: #ffebee;
  color: #c62828;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
}

.typeMissed {
  background-color: #eeeeee;
  color: #757575;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
}

code#typeans {
  font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  font-size: 20px;
  display: block;
  background: #fafafa;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  color: #333;
  border: 1px solid #eee;
  white-space: pre-wrap;
}

.hint-text {
  color: #78909c;
  font-style: italic;
  font-size: 0.9em;
  margin-top: 10px;
}

@media only screen and (max-width: 480px) {
  .btn-action {
    font-size: 14px;
    padding: 10px;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .btn-sac-all {
    width: 100%;
    margin: 5px 0 0 0;
  }
}

img[src=""] {
  display: none !important;
  visibility: hidden !important;
}

img:not([src]) {
  display: none !important;
  visibility: hidden !important;
}

@media (max-width: 480px) {

  /* =====================================================================
   SECTION: [GAME] MODAL SYSTEM (POPUP / OVERLAY)
   - Khung modal, header/footer, textarea… cho Cloud/Inventory/Chat/PVP.
   ===================================================================== */
  .modal-content {
    max-width: 95% !important;
    max-height: 85vh;
  }

  .modal-textarea {
    height: 120px;
    font-size: 14px;
  }

  #save-modal .btn-action {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  .card {
    background-color: #121212 !important;
    color: #e0e0e0 !important;
  }

  .container {
    background-color: #1e1e1e !important;
    border-color: #333 !important;
    box-shadow: none !important;
  }

  .korean-text {
    color: #90caf9 !important;
  }

  .vietnamese-meaning {
    background-color: #263238 !important;
    color: #81d4fa !important;
    border-left-color: #0277bd !important;
  }

  .meaning-highlight {
    background-color: #263238 !important;
    color: #81d4fa !important;
    border-left-color: #0277bd !important;
  }

  .note-box {
    background-color: #1b5e20 !important;
    color: #c8e6c9 !important;
    border-left-color: #43a047 !important;
  }

  input#typeans {
    background-color: #2c2c2c !important;
    color: #fff !important;
    border-color: #444 !important;
  }

  .modal-textarea {
    background-color: #2c2c2c !important;
    color: #fff !important;
    border-color: #444 !important;
  }

  code#typeans {
    background-color: #2c2c2c !important;
    color: #fff !important;
    border-color: #444 !important;
  }

  input#typeans:focus {
    border-color: #29b6f6 !important;
    background-color: #333 !important;
  }

  .modal-textarea:focus {
    border-color: #29b6f6 !important;
    background-color: #333 !important;
  }

  .copy-btn {
    background-color: #333 !important;
    color: #e0e0e0 !important;
    border-color: #555 !important;
  }

  .modal-content {
    background: #1e1e1e !important;
    color: #eee !important;
  }

  .modal-header {
    border-bottom-color: #333 !important;
    color: #90caf9 !important;
  }

  .inv-item {
    background: #333 !important;
    border-color: #444 !important;
  }

  .cultivator-name {
    color: #81c784 !important;
  }

  .filter-btn {
    background: #333 !important;
    border-color: #444 !important;
    color: #aaa !important;
  }

  .filter-btn.active {
    background: #0288d1 !important;
    color: white !important;
  }

}

@keyframes rankPulse {

  0% {
    box-shadow: 0 0 10px var(--rank-glow, #FFD700), inset 0 0 15px rgba(0, 0, 0, 0.8);
  }

  50% {
    box-shadow: 0 0 20px var(--rank-glow, #FFD700), inset 0 0 15px rgba(0, 0, 0, 0.8);
  }

  100% {
    box-shadow: 0 0 10px var(--rank-glow, #FFD700), inset 0 0 15px rgba(0, 0, 0, 0.8);
  }

}

.champ-level-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  background: rgba(0, 0, 0, 0.8);
  color: #00E676;
  font-size: 9px;
  padding: 1px 3px;
  border-radius: 6px;
  font-weight: 800;
  border: 1px solid #00E676;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  z-index: 99 !important;
  transition: all 0.3s;
}

.champ-lvl-blue {
  color: #29B6F6 !important;
  border-color: #29B6F6 !important;
  box-shadow: 0 0 5px rgba(41, 182, 246, 0.6) !important;
}

.champ-lvl-purple {
  color: #AA00FF !important;
  border-color: #AA00FF !important;
  background: rgba(40, 0, 60, 0.9) !important;
  box-shadow: 0 0 8px rgba(170, 0, 255, 0.7) !important;
}

.champ-lvl-red {
  color: #FFD700 !important;
  border-color: #FF3D00 !important;
  background: linear-gradient(45deg, #b71c1c, #bf360c) !important;
  text-shadow: 0 0 2px black;
  box-shadow: 0 0 10px rgba(255, 61, 0, 0.8) !important;
  animation: badgePulse 1.5s infinite alternate;
}

@keyframes badgePulse {

  from {
    transform: scale(1);
    box-shadow: 0 0 5px rgba(255, 61, 0, 0.5);
  }

  to {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    border-color: #FFD700;
  }

}

#rank-badge {
  font-size: 11px;
  font-weight: 900;
  color: #FFD700;
  text-transform: uppercase;
  text-shadow: 1px 1px 0px #d32f2f,
    0 0 8px rgba(255, 215, 0, 0.8);
  letter-spacing: 0.5px;
  z-index: 2;
  display: none !important;
}

.tier-text-0 {
  color: #50c878 !important;
  text-shadow: 0 0 5px rgba(80, 200, 120, 1);
}

.tier-fill-0 {
  background-color: #50c878 !important;
  box-shadow: 0 0 10px rgba(80, 200, 120, 1);
}

.tier-text-1 {
  color: #039BE5 !important;
  text-shadow: 0 0 5px rgba(3, 155, 229, 1);
}

.tier-fill-1 {
  background-color: #039BE5 !important;
  box-shadow: 0 0 10px rgba(3, 155, 229, 1);
}

.tier-text-2 {
  color: #9b59b6 !important;
  text-shadow: 0 0 5px rgba(178, 63, 228, 1);
}

.tier-fill-2 {
  background-color: #9b59b6 !important;
  box-shadow: 0 0 10px rgba(178, 63, 228, 1);
}

.tier-text-3 {
  color: #ff4444 !important;
  text-shadow: 0 0 5px rgba(255, 48, 48, 1);
}

.tier-fill-3 {
  background-color: #ff4444 !important;
  box-shadow: 0 0 10px rgba(255, 48, 48, 1);
}

.tier-text-4 {
  color: #FFD700 !important;
  text-shadow: 0 0 5px rgba(255, 251, 0, 1);
}

.tier-fill-4 {
  background-color: #FFD700 !important;
  box-shadow: 0 0 10px rgba(255, 251, 0, 1);
}

.tier-border-0 {
  border-color: #50c878 !important;
  box-shadow: 0 0 10px rgba(80, 200, 120, 1), inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.tier-border-1 {
  border-color: #039BE5 !important;
  box-shadow: 0 0 10px rgba(3, 155, 229, 1), inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.tier-border-2 {
  border-color: #9b59b6 !important;
  box-shadow: 0 0 10px rgba(178, 63, 228, 1), inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.tier-border-3 {
  border-color: #ff4444 !important;
  box-shadow: 0 0 10px rgba(255, 48, 48, 1), inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.tier-border-4 {
  border-color: #FFD700 !important;
  box-shadow: 0 0 10px rgba(255, 251, 0, 1), inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.tier-badge-0 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #50c878 !important;
  color: #50c878 !important;
}

.tier-badge-1 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #039BE5 !important;
  color: #039BE5 !important;
}

.tier-badge-2 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #9b59b6 !important;
  color: #9b59b6 !important;
}

.tier-badge-3 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #ff4444 !important;
  color: #ff4444 !important;
}

.tier-badge-4 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #FFD700 !important;
  color: #FFD700 !important;
}

div.exp-bar-fill.tier-fill-0 {
  background-color: #50c878 !important;
  box-shadow: 0 0 10px rgba(80, 200, 120, 0.6);
}

div.exp-bar-fill.tier-fill-1 {
  background-color: #039BE5 !important;
  box-shadow: 0 0 10px rgba(3, 155, 229, 0.6);
}

div.exp-bar-fill.tier-fill-2 {
  background-color: #9b59b6 !important;
  box-shadow: 0 0 10px rgba(178, 63, 228, 0.6);
}

div.exp-bar-fill.tier-fill-3 {
  background-color: #ff4444 !important;
  box-shadow: 0 0 10px rgba(255, 48, 48, 0.6);
}

div.exp-bar-fill.tier-fill-4 {
  background-color: #FFD700 !important;
  box-shadow: 0 0 10px rgba(255, 251, 0, 1);
}

.champ-level-badge.tier-badge-0 {
  animation: none !important;
}

.champ-level-badge.tier-badge-1 {
  animation: none !important;
}

.champ-level-badge.tier-badge-2 {
  animation: none !important;
}

.champ-level-badge.tier-badge-3 {
  animation: none !important;
}

.champ-level-badge.tier-badge-4 {
  animation: none !important;
}

.rank-lvl-0 {
  --rank-glow: #616161;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-1 {
  --rank-glow: #CD7F32;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-2 {
  --rank-glow: #E0E0E0;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-3 {
  --rank-glow: #FFD700;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-4 {
  --rank-glow: #00BCD4;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-5 {
  --rank-glow: #00E676;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-6 {
  --rank-glow: #00E5FF;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-7 {
  --rank-glow: #D500F9;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-8 {
  --rank-glow: #FF1744;
  border-color: transparent !important;
  box-shadow: none !important;
}

.rank-lvl-9 {
  --rank-glow: #F4C430;
  border-color: transparent !important;
  box-shadow: none !important;
}

#exp-bar-fill.tier-fill-0 {
  background-color: #50c878 !important;
  box-shadow: 0 0 10px rgba(80, 200, 120, 1) !important;
}

#exp-bar-fill.tier-fill-1 {
  background-color: #039BE5 !important;
  box-shadow: 0 0 10px rgba(3, 155, 229, 1) !important;
}

#exp-bar-fill.tier-fill-2 {
  background-color: #9b59b6 !important;
  box-shadow: 0 0 10px rgba(123, 31, 162, 1) !important;
}

#exp-bar-fill.tier-fill-3 {
  background-color: #ff4444 !important;
  box-shadow: 0 0 10px rgba(255, 48, 48, 1) !important;
}

#exp-bar-fill.tier-fill-4 {
  background-color: #FFD700 !important;
  box-shadow: 0 0 10px rgba(255, 251, 0, 1) !important;
}

div.champ-level-badge.tier-badge-0 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #50c878 !important;
  color: #50c878 !important;
  box-shadow: none !important;
  animation: none !important;
}

div.champ-level-badge.tier-badge-1 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #039BE5 !important;
  color: #039BE5 !important;
  text-shadow: 0 0 2px black !important;
  box-shadow: none !important;
  animation: none !important;
}

div.champ-level-badge.tier-badge-2 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #9b59b6 !important;
  color: #9b59b6 !important;
  text-shadow: 0 0 2px black !important;
  box-shadow: none !important;
  animation: none !important;
}

div.champ-level-badge.tier-badge-3 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #ff4444 !important;
  color: #ff4444 !important;
  text-shadow: 0 0 2px black !important;
  box-shadow: none !important;
  animation: none !important;
}

div.champ-level-badge.tier-badge-4 {
  background-color: rgba(0, 0, 0, 0.6) !important;
  border: 2px solid #FFD700 !important;
  color: #FFD700 !important;
  text-shadow: 0 0 2px black !important;
  box-shadow: none !important;
  animation: none !important;
}

.avatar-cultivation::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: none !important;
  animation: none !important;
  z-index: 1;
  display: none !important;
}

@keyframes fadeInScale {

  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

}

.ci-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.ci-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid;
  margin-right: 15px;
}

.ci-title {
  flex-grow: 1;
}

.ci-tier {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.ci-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.ci-skills {
  background: rgba(0, 0, 0, 0.05);
  padding: 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #555;
  margin-top: 5px;
}

.nightMode .champ-info-modal {
  background: rgba(20, 20, 20, 0.98);
  border-color: #444;
  color: #eee;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.night_mode .champ-info-modal {
  background: rgba(20, 20, 20, 0.98);
  border-color: #444;
  color: #eee;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.nightMode .ci-header {
  border-bottom-color: #444;
}

.night_mode .ci-header {
  border-bottom-color: #444;
}

.nightMode .ci-stat-item {
  background: rgba(255, 255, 255, 0.08);
}

.night_mode .ci-stat-item {
  background: rgba(255, 255, 255, 0.08);
}

.nightMode .ci-skills {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
}

.night_mode .ci-skills {
  background: rgba(255, 255, 255, 0.08);
  color: #ccc;
}

.nightMode .tutien-hud {
  background: #263238 !important;
  border: 1px solid #37474F !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.night_mode .tutien-hud {
  background: #263238 !important;
  border: 1px solid #37474F !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.nightMode .cultivator-name {
  color: #ECEFF1 !important;
}

.night_mode .cultivator-name {
  color: #ECEFF1 !important;
}

.nightMode .exp-text {
  color: #B0BEC5 !important;
}

.night_mode .exp-text {
  color: #B0BEC5 !important;
}

.nightMode .exp-bar-bg {
  background: #37474F !important;
}

.night_mode .exp-bar-bg {
  background: #37474F !important;
}

.nightMode .mini-btn {
  background: #37474F;
  border: 1px solid #455A64;
  color: #ECEFF1;
}

.night_mode .mini-btn {
  background: #37474F;
  border: 1px solid #455A64;
  color: #ECEFF1;
}

.nightMode .mini-btn:hover {
  background: #455A64;
  color: #FFF;
}

.night_mode .mini-btn:hover {
  background: #455A64;
  color: #FFF;
}

.nightMode .modal-content {
  background: #1e1e1e !important;
  color: #eee !important;
  border: 1px solid #333;
}

.night_mode .modal-content {
  background: #1e1e1e !important;
  color: #eee !important;
  border: 1px solid #333;
}

.nightMode .modal-header {
  border-bottom: 1px solid #333;
  color: #90CAF9;
}

.night_mode .modal-header {
  border-bottom: 1px solid #333;
  color: #90CAF9;
}


.night_mode .inv-item {
  background: #333 !important;
  border-color: #555 !important;
}


.night_mode .inv-item.tier-0 {
  background: transparent !important;
  border-color: #50c878 !important;
}

.night_mode .inv-item.tier-1 {
  background: transparent !important;
  border-color: #00BFFF !important;
}

.night_mode .inv-item.tier-2 {
  background: transparent !important;
  border-color: #9b59b6 !important;
}

.night_mode .inv-item.tier-3 {
  background: transparent !important;
  border-color: #ff4444 !important;
}

.night_mode .inv-item.tier-4 {
  background: transparent !important;
  border-color: #FFD700 !important;
}

.btn-sac-all {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid #FFCDD2;
  display: block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: 0.2s;
  background: #FFEBEE;
  color: #C62828;
  margin-left: 5px;
  width: auto;
  flex: 1;
  text-transform: uppercase;
  white-space: nowrap;
  min-width: 140px;
  text-align: center;
  margin: 0 !important;
}

.btn-sac-all:hover {
  background: #e57373;
  color: white;
  border-color: #e57373;
}

.btn-enhance-all {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  border: 1px solid #BBDEFB;
  display: block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: 0.2s;
  background: #E3F2FD;
  color: #1565C0;
  flex: 1;
  min-width: 140px;
  text-align: center;
  text-transform: uppercase;
  margin: 0 !important;
}

.btn-enhance-all:hover {
  background: #64B5F6;
  color: white;
  border-color: #64B5F6;
}

.nightMode .btn-sac-all {
  background: #5a1a1a;
  border-color: #d32f2f;
  color: #ffcdd2;
}

.night_mode .btn-sac-all {
  background: #5a1a1a;
  border-color: #d32f2f;
  color: #ffcdd2;
}

.nightMode .btn-sac-all:hover {
  background: #c62828;
  color: white;
}

.night_mode .btn-sac-all:hover {
  background: #c62828;
  color: white;
}

.nightMode .btn-enhance-all {
  background: #0d47a1;
  border-color: #1976d2;
  color: #bbdefb;
}

.night_mode .btn-enhance-all {
  color: #fff !important;
}

.explanation-box {
  background: #f0f0f0;
  padding: 10px;
  border-radius: 8px;
  color: #333;
}

.nightMode .explanation-box {
  background: #263238 !important;
  color: #ECEFF1 !important;
  border: 1px solid #37474F;
}

.night_mode .explanation-box {
  background: #263238 !important;
  color: #ECEFF1 !important;
  border: 1px solid #37474F;
}

.champ-info-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid #ccc;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 360px;
  z-index: 200 !important;
  color: #333;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  /* backdrop-filter: none; REMOVED to fix UI flicker */
  animation: none;
}

/* [REMOVED] .toast-msg → moved to game_core.js */

.lvl-badge {
  position: absolute;
  bottom: -2px;
  right: -5px;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 10;
  min-width: 14px;
  text-align: center;
  background: #333;
}

.ci-value {
  font-size: 14px !important;
  font-weight: 700 !important;
  margin-top: 2px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
}

.ci-label {
  font-size: 11px !important;
  color: #546e7a !important;
  text-transform: uppercase;
  font-family: 'Segoe UI', sans-serif !important;
  font-weight: 600 !important;
}

.ci-name {
  font-size: 18px;
  font-weight: 800 !important;
  color: #FFD700;
  font-family: 'Segoe UI', sans-serif !important;
  letter-spacing: 0.5px;
  -webkit-font-smoothing: antialiased;
}

.ci-stat-item {
  background: linear-gradient(to right, #091428, #0a1b33);
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #C8AA6E;
  margin-bottom: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ci-stat-item:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(200, 170, 110, 0.2);
  border-color: #F0E6D2;
}

.ci-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: #A09B8C;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ci-stat-value {
  font-size: 14px;
  font-weight: 800;
  color: #F0E6D2;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
  font-family: 'Segoe UI', Tahoma, sans-serif;
}

.ci-stat-value.val-gold {
  color: #FFD700;
}

.ci-stat-value.val-red {
  color: #FF5252;
}

.ci-stat-value.val-green {
  color: #69F0AE;
}

.ci-stat-value.val-blue {
  color: #40C4FF;
}

#champ-info-modal .modal-content {
  background: #010a13 !important;
  color: #cdbe91;
  border: 2px solid #C8AA6E;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

#champ-info-modal .modal-header {
  border-bottom: 1px solid #C8AA6E;
  color: #F0E6D2;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(9, 20, 40, 0.95);
}

.custom-modal {
  font-family: var(--font-vietnamese) !important;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 210 !important;
  justify-content: center;
  align-items: center;
  /* backdrop-filter: none; REMOVED to fix UI flicker */
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  padding: 0;
}

.filter-bar {
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: #fff;
  border-bottom: 1px solid #eee;
  align-items: center;
  flex-shrink: 0;
}

.action-bar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #fff;
  flex-wrap: wrap;
  justify-content: center;
  flex-shrink: 0;
}

.modal-header {
  padding: 10px;
  border-bottom: 2px solid #C8AA6E;
  font-weight: bold;
  font-size: 16px;
  color: #C8AA6E;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: #091428;
  text-align: center;
}

.item-detail-view {
  padding: 10px;
  text-align: center;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
  padding-bottom: 80px;
  min-height: 0;
}


/* --- MARQUEE SYSTEM (RESTORED) --- */
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  box-sizing: border-box;
}

/* --- THEME-AWARE MARQUEE STYLING --- */
.marquee-container,
.marquee-text,
#mq-single-run {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding-left: 100% !important;
  font-weight: 600 !important;
  will-change: transform;
}

/* Light Theme (Mặc định khi nền sáng hoặc data-theme="light") */
html:not(.dark):not([data-theme="dark"]) .marquee-container,
html:not(.dark):not([data-theme="dark"]) .marquee-text,
html:not(.dark):not([data-theme="dark"]) #mq-single-run,
html[data-theme="light"] .marquee-container,
html[data-theme="light"] .marquee-text,
html[data-theme="light"] #mq-single-run,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-container,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper #mq-single-run,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-container,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper #mq-single-run {
  color: #0f172a !important;
  /* Đen xám đậm, độ tương phản tuyệt đối trên nền sáng */
  text-shadow: none !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html[data-theme="light"] .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray) {
  font-weight: 700 !important;
  color: #0f172a !important;
  /* "phòng thủ thành công trước", "đánh bại" RÕ RÀNG 100%, KHÔNG BAO GIỜ BỊ MÀU TRẮNG TRÊN NỀN SÁNG */
}

.marquee-text b.mq-user,
.marquee-text b.mq-target {
  font-weight: 800 !important;
  letter-spacing: 0.2px !important;
}

/* Màu tên người chơi & đối thủ & sự kiện trên nền sáng */
html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-blue,
html[data-theme="light"] .marquee-text .mq-blue,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue {
  color: #0284c7 !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-green,
html[data-theme="light"] .marquee-text .mq-green,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green {
  color: #059669 !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-amber,
html[data-theme="light"] .marquee-text .mq-amber,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber {
  color: #d97706 !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-red,
html[data-theme="light"] .marquee-text .mq-red,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red {
  color: #dc2626 !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-purple,
html[data-theme="light"] .marquee-text .mq-purple,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple {
  color: #7c3aed !important;
}

html:not(.dark):not([data-theme="dark"]) .marquee-text .mq-gray,
html[data-theme="light"] .marquee-text .mq-gray,
html:not(.dark):not([data-theme="dark"]) body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray,
html[data-theme="light"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray {
  color: #475569 !important;
}

/* SVG icons */
.mq-svg-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  margin-right: 5px !important;
}

.mq-svg-wrap svg {
  width: 17px !important;
  height: 17px !important;
  vertical-align: -2px !important;
  display: inline-block !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)) !important;
}

html:not(.dark):not([data-theme="dark"]) .mq-svg-wrap.mq-blue svg,
html[data-theme="light"] .mq-svg-wrap.mq-blue svg {
  color: #0284c7 !important;
}

html:not(.dark):not([data-theme="dark"]) .mq-svg-wrap.mq-green svg,
html[data-theme="light"] .mq-svg-wrap.mq-green svg {
  color: #059669 !important;
}

html:not(.dark):not([data-theme="dark"]) .mq-svg-wrap.mq-amber svg,
html[data-theme="light"] .mq-svg-wrap.mq-amber svg {
  color: #d97706 !important;
}

html:not(.dark):not([data-theme="dark"]) .mq-svg-wrap.mq-red svg,
html[data-theme="light"] .mq-svg-wrap.mq-red svg {
  color: #dc2626 !important;
}

html:not(.dark):not([data-theme="dark"]) .mq-svg-wrap.mq-purple svg,
html[data-theme="light"] .mq-svg-wrap.mq-purple svg {
  color: #7c3aed !important;
}

/* Dark Theme overrides (TƯƠNG THÍCH HOÀN HẢO KHI BẬT GIAO DIỆN TỐI) */
html.dark .marquee-container,
html.dark .marquee-text,
html.dark #mq-single-run,
html[data-theme="dark"] .marquee-container,
html[data-theme="dark"] .marquee-text,
html[data-theme="dark"] #mq-single-run,
body.dark .marquee-container,
body.dark .marquee-text,
body.dark #mq-single-run,
body[data-theme="dark"] .marquee-container,
body[data-theme="dark"] .marquee-text,
body[data-theme="dark"] #mq-single-run,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-container,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text,
html.dark body #hw-app-layout #unified-hud-wrapper #mq-single-run,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-container,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper #mq-single-run,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-container,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text,
body.dark #hw-app-layout #unified-hud-wrapper #mq-single-run,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-container,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper #mq-single-run {
  color: #f1f5f9 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6) !important;
}

html.dark .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html[data-theme="dark"] .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
body.dark .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
body[data-theme="dark"] .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray),
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text span.mq-action:not(.mq-amber):not(.mq-red):not(.mq-green):not(.mq-blue):not(.mq-purple):not(.mq-gray) {
  font-weight: 700 !important;
  color: rgba(255, 255, 255, 0.95) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6) !important;
}

html.dark .marquee-text .mq-blue,
html[data-theme="dark"] .marquee-text .mq-blue,
body.dark .marquee-text .mq-blue,
body[data-theme="dark"] .marquee-text .mq-blue,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-blue {
  color: #38bdf8 !important;
  text-shadow: 0 0 6px rgba(56, 189, 248, 0.4) !important;
}

html.dark .marquee-text .mq-green,
html[data-theme="dark"] .marquee-text .mq-green,
body.dark .marquee-text .mq-green,
body[data-theme="dark"] .marquee-text .mq-green,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-green {
  color: #34d399 !important;
  text-shadow: 0 0 6px rgba(52, 211, 153, 0.4) !important;
}

html.dark .marquee-text .mq-amber,
html[data-theme="dark"] .marquee-text .mq-amber,
body.dark .marquee-text .mq-amber,
body[data-theme="dark"] .marquee-text .mq-amber,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-amber {
  color: #fbbf24 !important;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.45) !important;
}

html.dark .marquee-text .mq-red,
html[data-theme="dark"] .marquee-text .mq-red,
body.dark .marquee-text .mq-red,
body[data-theme="dark"] .marquee-text .mq-red,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-red {
  color: #f87171 !important;
  text-shadow: 0 0 6px rgba(248, 113, 113, 0.45) !important;
}

html.dark .marquee-text .mq-purple,
html[data-theme="dark"] .marquee-text .mq-purple,
body.dark .marquee-text .mq-purple,
body[data-theme="dark"] .marquee-text .mq-purple,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-purple {
  color: #c084fc !important;
  text-shadow: 0 0 6px rgba(192, 132, 252, 0.45) !important;
}

html.dark .marquee-text .mq-gray,
html[data-theme="dark"] .marquee-text .mq-gray,
body.dark .marquee-text .mq-gray,
body[data-theme="dark"] .marquee-text .mq-gray,
html.dark body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray,
html[data-theme="dark"] body #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray,
body.dark #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray,
body[data-theme="dark"] #hw-app-layout #unified-hud-wrapper .marquee-text .mq-gray {
  color: #94a3b8 !important;
}

html.dark .mq-svg-wrap svg,
html[data-theme="dark"] .mq-svg-wrap svg {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.45)) !important;
}

html.dark .mq-svg-wrap.mq-blue svg,
html[data-theme="dark"] .mq-svg-wrap.mq-blue svg {
  color: #38bdf8 !important;
}

html.dark .mq-svg-wrap.mq-green svg,
html[data-theme="dark"] .mq-svg-wrap.mq-green svg {
  color: #34d399 !important;
}

html.dark .mq-svg-wrap.mq-amber svg,
html[data-theme="dark"] .mq-svg-wrap.mq-amber svg {
  color: #fbbf24 !important;
}

html.dark .mq-svg-wrap.mq-red svg,
html[data-theme="dark"] .mq-svg-wrap.mq-red svg {
  color: #f87171 !important;
}

html.dark .mq-svg-wrap.mq-purple svg,
html[data-theme="dark"] .mq-svg-wrap.mq-purple svg {
  color: #c084fc !important;
}

@keyframes marquee {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(-100%, 0, 0);
  }
}

.challenge-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #091428;
  border: 2px solid #C8AA6E;
  z-index: 10000;
  padding: 20px;
  width: 280px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.9);
  text-align: center;
  color: #F0E6D2;
}

.btn-chall {
  background: #333;
  border: 1px solid #C8AA6E;
  color: #C8AA6E;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  margin-left: 5px;
  border-radius: 3px;
}

.btn-chall:hover {
  background: #C8AA6E;
  color: #000;
}

/* =====================================================================
   SECTION: [GAME] TOP BAR (TOP#1 / SEASON MSG)
   - Thanh Top #1 + marquee season-msg, thu?ng n?m trong #unified-hud-wrapper.
   ===================================================================== */
.rpg-top-bar {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

html.anki-mode-off .rpg-top-bar {
  display: none !important;
}

.tutien-hud {
  /* [FIX CHỚP] Mặc định hiện + tối - không cần chờ .skin-tutien */
  display: flex;
  margin-bottom: 8px;
  background: transparent;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  box-shadow: none;
  animation: none !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  margin-top: 0 !important;
  border-top: none !important;
}

html.anki-mode-off .tutien-hud {
  display: none;
  background: #fff;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ladder-trigger-icon {
  display: none !important;
}

.char-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #ddd;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  color: #333;
}

.char-icon-btn:hover {
  background: #f8f9fa;
  /* Removed transform: translateY to fix double-tap bug on iOS and click-miss on PC */
}

@media (prefers-color-scheme: dark) {
  .char-icon-btn {
    background: #333 !important;
    border-color: #555 !important;
    color: #fff !important;
  }
}

.night .char-icon-btn {
  background: #333 !important;
  border-color: #555 !important;
  color: #fff !important;
}

.dark-mode .char-icon-btn {
  background: #333 !important;
  border-color: #555 !important;
  color: #fff !important;
}

.rpg-top-bar {
  background: #091428 !important;
  color: #C8AA6E !important;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  font-size: 12px;
  border-bottom: 2px solid #C8AA6E !important;
  margin-bottom: 0px !important;
  height: 26px;
  box-sizing: border-box;
  width: 100%;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  z-index: 100;
  position: relative;
}

.rpg-top-bar .top-left {
  flex: 1;
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: #C8AA6E !important;
}

.rpg-top-bar #top1-name {
  color: #F0E6D2 !important;
  margin: 0 5px;
}

.rpg-top-bar #top1-points {
  color: #00FF00 !important;
}

.rpg-top-bar .top-right {
  flex: 1.5;
  overflow: hidden;
  margin-left: 10px;
  color: #A09B8C !important;
}

.equip-slots div {
  transition: all 0.2s;
}

.equip-slots div:hover {
  border-color: #ffd700;
  box-shadow: 0 0 5px gold;
  cursor: pointer;
}

.skill-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 8px 0;
  flex-wrap: nowrap;
}

.skill-box img {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  display: block;
  object-fit: cover;
  margin: 0;
  padding: 0;
}

.spell-box img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  margin: 0;
  padding: 0;
}

.role-tag {
  font-size: 10px;
  color: #ddd;
  border: 1px solid #555;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 5px;
  background: rgba(0, 0, 0, 0.5);
}

.top-left-text {
  font-size: 14px;
  margin-right: 5px;
}

.top-right-container {
  flex: 1.5;
  overflow: hidden;
  margin-left: 10px;
}

.hud-header-flex {
  display: flex;
  align-items: center;
  position: relative;
  padding-bottom: 1px;
}

.avatar-cultivation-margin {
  margin-right: 8px;
}

.exp-area-flex {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 5px;
}

.exp-bar-bg-style {
  width: 100%;
  height: 9px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2px;
}

.exp-bar-fill-style {
  height: 100%;
  width: 0%;
  background: #c8aa6e;
  position: relative;
  transition: none !important;
  animation: none !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  will-change: width;
}

/* [FIX CHỚP V4] Force tắt mọi transition/animation trên exp bar by ID */
#exp-bar-fill {
  transition: none !important;
  animation: none !important;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.hud-bot-row-style {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.exp-icon-style {
  font-size: 9px;
  margin-right: 2px;
}

.percent-text-style {
  margin-left: 3px;
  color: #4caf50;
  font-weight: bold;
}

.char-action-bar-style {
  display: flex !important;
  gap: 15px;
  justify-content: center;
  margin-top: 5px;
  width: 100%;
  z-index: 10;
}

.btn-chat-style {
  position: relative;
}

.chat-badge-style {
  position: absolute;
  top: -2px;
  right: -2px;
  background: red;
  color: white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
  font-size: 8px;
  display: none;
  justify-content: center;
  align-items: center;
}

.play-svg-style {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  fill: currentColor;
  margin-right: 5px;
}

.inv-actions-style {
  margin-top: 5px;
  display: flex;
  gap: 5px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-sac-style {
  display: none;
  font-size: 10px;
  padding: 3px 8px;
}

.detail-stats-style {
  font-size: 11px;
  color: #ccc;
  margin-bottom: 5px;
}

.action-area-style {
  width: 100%;
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-footer-text {
  font-size: 10px;
  color: #ff4444;
  text-align: center;
  margin-bottom: 2px;
  font-weight: bold;
}

.btn-close-style {
  background: #607D8B;
  color: #fff;
  border-radius: 20px;
  padding: 8px 0;
  width: 100%;
  border: none;
  font-weight: bold;
}

.ci-header-style {
  margin-bottom: 2px;
}

.ci-avatar-style {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #c8aa6e;
}

.ci-title-style {
  margin-left: 10px;
  text-align: left;
}

.ci-name-style {
  font-size: 18px;
  font-weight: bold;
  color: #F0E6D2;
}

.ci-tier-style {
  font-size: 12px;
}

.ci-body-flex {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
}

.ci-left-col-style {
  flex: 1;
  min-width: 120px;
}

.ci-stats-grid-style {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ci-stat-item-style {
  padding: 4px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ccc;
}

.ci-label-style {
  font-size: 10px;
  color: #555;
  font-weight: bold;
}

.ci-value-style {
  font-size: 12px;
  font-weight: bold;
}

.ci-text-orange {
  color: #f57f17;
}

.ci-text-red {
  color: #d32f2f;
}

.ci-text-green {
  color: #388e3c;
}

.ci-text-blue {
  color: #1976d2;
}

.ci-right-col-style {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ci-equip-header-style {
  margin-bottom: 3px;
  text-align: center;
  font-weight: bold;
  font-size: 11px;
  color: #c8aa6e;
}

.ci-actions-style {
  display: flex;
  gap: 5px;
  margin-top: 10px;
  border-top: 1px solid #444;
  padding-top: 10px;
}

.btn-unequip-style {
  flex: 1;
  padding: 8px 0;
  font-size: 10px;
  font-weight: bold;
}

.chall-header-style {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #ff4444;
}

.chall-msg-style {
  margin-bottom: 15px;
  font-size: 12px;
}

.chall-actions-style {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-chall-style {
  flex: 1;
}

.chat-btn-challenge {
  cursor: pointer;
  font-size: 14px;
  margin-left: 5px;
  opacity: 0.8;
  display: inline-block;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-btn-challenge:hover {
  opacity: 1;
  text-shadow: 0 0 8px #ff4444;
  transform: translateY(-2px) scale(1.3);
}

.chat-btn-challenge:active {
  transform: translateY(0) scale(0.95);
}

#challenge-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(9, 20, 40, 0.95);
  border: 2px solid #ff4444;
  padding: 20px;
  z-index: 999999 !important;
  display: none;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
  min-width: 250px;
}



.lol-theme-active #champ-info-modal {
  background: linear-gradient(135deg, #091428 0%, #0a1e3c 100%) !important;
  border: 2px solid #C8AA6E !important;
  border-radius: 8px !important;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 2px #C8AA6E !important;
}

.lol-theme-active .ci-header {
  background: transparent !important;
}

.lol-theme-active .ci-body-flex {
  background: transparent !important;
}

.lol-theme-active #champ-info-modal .ci-stat-item {
  background: rgba(10, 20, 30, 0.6) !important;
  border: 1px solid #444 !important;
  color: #f0e6d2 !important;
}

.lol-theme-active #champ-info-modal .ci-label {
  color: #888 !important;
  text-transform: uppercase;
  font-size: 9px;
}

.lol-theme-active #champ-info-modal .ci-value {
  color: #C8AA6E !important;
  font-weight: bold;
}

.ci-equips-flex {
  display: grid !important;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}

.lol-theme-active #champ-info-modal button {
  border: 1px solid #444 !important;
  background: #1e2328 !important;
  color: #C8AA6E !important;
  text-transform: uppercase;
  font-weight: bold;
}

/* [REMOVED] .skin-tutien .toast-msg → moved to game_core.js */


.custom-modal .modal-content {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  box-shadow: var(--game-shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.2)) !important;
  color: var(--game-text, #0f172a) !important;
}

#inv-filter {
  background: var(--game-surface-raised, #f8fafc) !important;
  border-bottom: 1px solid var(--game-border, #e2e8f0) !important;
  padding: 10px 14px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  justify-content: flex-start !important;
}

.filter-btn {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  color: var(--game-text-secondary, #475569) !important;
  border-radius: 8px !important;
  text-transform: none !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  flex: 1 0 auto !important;
  min-height: 32px !important;
  min-width: max-content !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  line-height: 1.2 !important;
}

.filter-btn.active {
  color: var(--game-button-text, #ffffff) !important;
  border-color: var(--game-primary, #0f766e) !important;
  background: var(--game-primary, #0f766e) !important;
  box-shadow: none !important;
}

.filter-btn:hover {
  color: var(--game-text, #0f172a) !important;
  border-color: var(--game-primary, #0f766e) !important;
  background: var(--game-surface-hover, #e2e8f0) !important;
  box-shadow: none !important;
}

#inv-actions {
  background: var(--game-surface, #ffffff) !important;
  padding: 8px 14px !important;
  border-bottom: 1px solid var(--game-border, #e2e8f0) !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  justify-content: flex-start !important;
  overflow-x: auto;
}

.btn-action {
  background: var(--game-primary, #0f766e) !important;
  border: 1px solid var(--game-primary, #0f766e) !important;
  color: var(--game-button-text, #ffffff) !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 7px 12px !important;
  cursor: pointer !important;
  margin: 1px !important;
  box-shadow: none !important;
  transition: all 0.2s !important;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform, box-shadow;
}

.btn-action:hover {
  background: var(--game-primary-hover, #115e59) !important;
  transform: translateY(-1px) !important;
}


/* =====================================================================
   SECTION: [SHARED] BUTTON PALETTE (COLOR VARIANTS)
   - btn-green / btn-red / btn-orange / btn-blue… dùng c? game l?n th? h?c.
   ===================================================================== */
.btn-green {
  border-color: #00E676 !important;
  color: #00E676 !important;
  background: linear-gradient(to bottom, #1b3a24, #0b1f12) !important;
  background-color: #4CAF50 !important;
  border: 1px solid #a5d6a7;
}

.btn-orange {
  border-color: #FFA000 !important;
  color: #FFA000 !important;
  background: linear-gradient(to bottom, #3a2a1b, #1f150b) !important;
}

.btn-red {
  border-color: #FF5252 !important;
  color: #FF5252 !important;
  background: linear-gradient(to bottom, #3a1b1b, #1f0b0b) !important;
}

.btn-blue {
  border-color: #2979FF !important;
  color: #2979FF !important;
  background: linear-gradient(to bottom, #1b2a3a, #0b151f) !important;
}


/* =====================================================================
   SECTION: [GAME] INVENTORY / SHOP / GRID LAYOUT
   - Lu?i item/tu?ng, layout kho, khung item, tooltip.
   ===================================================================== */
.inventory-grid {
  background: var(--game-surface, #ffffff) !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 12px 14px !important;
  border-radius: 0 !important;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.inv-slot {
  background: var(--game-surface-subtle, #f1f5f9) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  box-shadow: none !important;
}

.inv-slot img {
  border-radius: 0 !important;
}

#item-details {
  background: var(--game-surface-raised, #f8fafc) !important;
  border-top: 1px solid var(--game-border, #e2e8f0) !important;
  color: var(--game-text, #0f172a) !important;
}

#action-area {
  background: transparent !important;
  padding: 8px 0 0 !important;
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  min-width: 0 !important;
  max-width: 100% !important;
  box-shadow: none;
  z-index: 10;
  margin-top: auto !important;
  border-top: 1px solid var(--game-border, #e2e8f0);
  display: flex !important;
  flex-direction: row !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box !important;
}

.modal-footer {
  background: var(--game-surface-subtle, #f1f5f9) !important;
  border-top: 1px solid var(--game-border, #e2e8f0) !important;
  box-shadow: none !important;
  padding: 10px 14px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

#action-area button,
#action-area .btn-action {
  font-size: 11px !important;
  padding: 7px 10px !important;
  margin: 0 !important;
  min-height: 34px;
  line-height: 1.2;
}

#dt-name {
  color: var(--game-text, #0f172a) !important;
  font-family: var(--font-vietnamese) !important;
  letter-spacing: 0;
}

.btn-close {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  color: var(--game-text, #0f172a) !important;
  font-weight: 700 !important;
  text-transform: none !important;
  padding: 9px 24px !important;
  width: 100%;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.btn-close:hover {
  background: var(--game-surface-hover, #e2e8f0) !important;
  color: var(--game-text, #0f172a) !important;
}

#champ-info-modal {
  background: linear-gradient(135deg, #091428 0%, #0a1e3c 100%) !important;
  border: 2px solid #C8AA6E !important;
  border-radius: 8px !important;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), inset 0 0 2px #C8AA6E !important;
  padding: 10px !important;
  color: #f0e6d2 !important;
}

#champ-info-modal .ci-stat-item {
  background: rgba(10, 20, 30, 0.6) !important;
  border: 1px solid #444 !important;
  color: #f0e6d2 !important;
}

#champ-info-modal .ci-label {
  color: #888 !important;
  text-transform: uppercase;
  font-size: 9px !important;
}

#champ-info-modal .ci-value {
  color: #C8AA6E !important;
  font-weight: bold !important;
}

.skill-box {
  position: relative !important;
  width: 32px;
  height: 32px;
  background: #000;
  border: 1px solid #444;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.spell-box {
  position: relative !important;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--game-primary, #6366f1);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 5px var(--game-primary-soft, rgba(99, 102, 241, 0.4));
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

.skill-key {
  display: block !important;
  position: absolute !important;
  bottom: 0px !important;
  right: 0px !important;
  background: rgba(0, 0, 0, 0.8) !important;
  color: #fff !important;
  font-size: 8px !important;
  font-weight: bold !important;
  padding: 1px 3px !important;
  border-top-left-radius: 4px;
  z-index: 10 !important;
  line-height: 1 !important;
}

#ci-equips {
  display: grid !important;
  grid-template-columns: repeat(3, 34px) !important;
  grid-template-rows: repeat(2, 34px) !important;
  gap: 4px !important;
  justify-content: center !important;
  margin: 5px auto !important;
  width: fit-content !important;
}

#ci-equips div {
  box-sizing: border-box !important;
}

#champ-info-modal button {
  border: 1px solid #444 !important;
  background: #1e2328 !important;
  color: #C8AA6E !important;
  text-transform: uppercase;
  font-weight: bold !important;
}


/* =====================================================================
   SECTION: [THEME] SKIN / THEME OVERRIDES
   - Override n?n + màu cho c? HUD l?n th? h?c (ví d? .skin-tutien .korean-text).
   ===================================================================== */
.skin-tutien {
  background-color: #010a13 !important;
  background-image: linear-gradient(180deg, rgba(1, 10, 19, 0.8) 0%, rgba(1, 10, 19, 1) 100%), url('https://i.pinimg.com/1200x/82/73/b3/8273b39d5020a8f81eed1bfad219ea2e.jpg') !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  background-position: center top !important;
  color: #f0e6d2 !important;
  font-family: var(--font-vietnamese) !important;
  min-height: 100vh !important;
  height: 100% !important;
}

/* [FIX iOS] Mobile: bỏ fixed bg (iOS không hỗ trợ), giảm min-height HUD */
@media (max-width: 640px) {
  .skin-tutien {
    background-attachment: scroll !important;
  }
}

.skin-tutien #main-container {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 20px auto !important;
  padding: 20px !important;
  max-width: 600px !important;
}

/* [FIX] Mobile: HUD trải full màn hình, không còn khoảng trống 2 bên */
@media (max-width: 640px) {
  .skin-tutien #main-container {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 8px !important;
  }
}

.skin-tutien .korean-text {
  color: #c8aa6e !important;
  font-weight: bold;
}

.skin-tutien .vietnamese-meaning {
  background: rgba(200, 170, 110, 0.05) !important;
  border-left: 3px solid #C8AA6E !important;
  color: #f0e6d2 !important;
  padding: 10px !important;
}

.skin-tutien .note-box {
  background: #05101e !important;
  border: 1px solid #444 !important;
  color: #888 !important;
}

body:not(.hw-game-core-active) .skin-tutien button:not([class*="hw-"]) {
  background: #1e2328 !important;
  border: 1px solid #C8AA6E !important;
  color: #C8AA6E !important;
  font-weight: bold !important;
  text-transform: uppercase !important;
  letter-spacing: 1px;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

body:not(.hw-game-core-active) .skin-tutien button:not([class*="hw-"]):hover {
  background: #c8aa6e !important;
  color: #000 !important;
  box-shadow: 0 0 15px #c8aa6e;
}

.skin-tutien .custom-modal,
.skin-tutien .challenge-modal,
.skin-tutien #ladder-modal {
  background: var(--game-overlay, rgba(15, 23, 42, 0.6)) !important;
}

.skin-tutien .modal-content {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  box-shadow: var(--game-shadow-lg, 0 20px 50px rgba(0, 0, 0, 0.25)) !important;
  color: var(--game-text, #0f172a) !important;
}

#rpg-top-bar {
  background: var(--game-surface, rgba(9, 20, 40, 0.7)) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  border-radius: 8px !important;
  box-shadow: var(--game-shadow, 0 4px 12px rgba(0, 0, 0, 0.2)) !important;
  margin-bottom: 10px !important;
}

.skin-tutien .tutien-hud {
  background: var(--game-surface, rgba(9, 20, 40, 0.6)) !important;
  border-bottom: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  margin-bottom: 8px !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  border-radius: 12px !important;
  box-shadow: var(--game-shadow, 0 4px 12px rgba(0, 0, 0, 0.2)) !important;
  padding: 8px !important;
  display: block;
}

.rank-name-style {
  color: #C8AA6E !important;
  font-weight: bold !important;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.8) !important;
  margin-bottom: 4px !important;
  font-size: 12px;
}

.exp-text-style {
  color: #f0e6d2 !important;
  font-weight: bold !important;
  font-size: 10px;
  display: flex;
  align-items: center;
}

.exp-text-style span {
  color: #f0e6d2 !important;
}

#exp-num {
  color: #f0e6d2 !important;
}

.avatar-cultivation {
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8) !important;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid #FFD700;
  background: #121212;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: visible !important;
  /* [FIX] Allow badges to show outside */
  /* Fix tràn vi?n trên iOS */
  /* T?T ANIMATION N?NG N?U LAG, CH? GI? L?I TRÊN MÁY M?NH */
  /* animation: rankPulse 3s infinite; */
  border-style: solid !important;
  border-width: 2px !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 100 !important;
  /* IOS FIX: Giúp GPU x? lý mu?t hon */
  transform: translateZ(0);
  will-change: transform, opacity;
}

#unified-hud-wrapper {
  /* [FIX CHỚP] Mặc định visible + dark - không chờ .skin-tutien */
  display: block !important;
  visibility: visible !important;
  min-height: 109px !important;
  border: 1px solid #C8AA6E !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  background: rgba(9, 20, 40, 0.6) !important;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5) !important;
  margin-top: 0px !important;
  margin-bottom: 15px !important;
}

html.anki-mode-off #unified-hud-wrapper {
  display: none !important;
}

.skin-tutien #unified-hud-wrapper {
  /* Đảm bảo tương thích khi skin-tutien đã load */
  display: block !important;
  visibility: visible !important;
}

#unified-hud-wrapper #rpg-top-bar {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  padding: 8px 15px !important;
}

#unified-hud-wrapper .tutien-hud {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  padding: 10px !important;
}

/* [FIX iOS] Mobile: Thu gọn HUD để dành không gian cho nội dung từ vựng */
@media (max-width: 640px) {

  #unified-hud-wrapper,
  .skin-tutien #unified-hud-wrapper {
    min-height: auto !important;
    margin-bottom: 8px !important;
  }

  #unified-hud-wrapper #rpg-top-bar {
    padding: 4px 10px !important;
  }

  #unified-hud-wrapper .tutien-hud {
    padding: 6px 8px !important;
  }
}

.hex-btn-style {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  color: var(--game-text, #0f172a) !important;
  text-transform: none;
  font-weight: 700;
  box-shadow: none;
  transition: all 0.2s;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
}

.hex-btn-style:hover {
  background: var(--game-surface-hover, #e2e8f0) !important;
  color: var(--game-text, #0f172a) !important;
  border-color: var(--game-primary, #0f766e) !important;
  box-shadow: none;
}

.hex-btn-style.active {
  background: var(--game-primary, #0f766e) !important;
  color: var(--game-button-text, #ffffff) !important;
  border-color: var(--game-primary, #0f766e) !important;
  box-shadow: none;
}

/* [REMOVED] body:not(.skin-tutien) .toast-msg, #toast → moved to game_core.js */

body:not(.skin-tutien) #challenge-modal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body:not(.skin-tutien) .challenge-modal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body:not(.skin-tutien) #pvp-wait-modal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* [FIX 2026] Bảng chiến báo (#pvp-persistent-modal) đã được giải phóng để hiển thị toàn diện ngoài web */

.tier-text-0 {
  color: #50c878 !important;
}

.tier-text-1 {
  color: #00BFFF !important;
}

.tier-text-2 {
  color: #9b59b6 !important;
}

.tier-text-3 {
  color: #ff4444 !important;
}

.tier-text-4 {
  color: #FFD700 !important;
}

.new-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ff5252;
  color: white;
  font-size: 8px;
  padding: 1px 3px;
  border-radius: 4px;
  font-weight: bold;
  z-index: 10;
  animation: pulse-badge 1s infinite;
}

@keyframes pulse-badge {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

/* BOSS WIDGET CSS (COMPACT) */
/* FIX: Button Clickability & Z-Index (ANDROID FIX) */

.char-icon-btn {
  cursor: pointer !important;
  position: relative !important;
  z-index: 200000 !important;
  /* High Z-Index for Android */
  pointer-events: auto !important;
}


/* =====================================================================
   SECTION: [GAME] ACTION BAR (BOTTOM ICONS)
   - Thanh nút: Kho, PVP, TFT, Chat, Shop, Cloud, Toggle Mode.
   ===================================================================== */
.char-action-bar {
  position: relative;
  z-index: 200000 !important;
}

/* FIX: Modals must be higher than buttons (200000) */
.custom-modal,
.ladder-modal,
.champ-info-modal,
#unified-modal,
#update-modal,
.chat-modal,
#chat-modal {
  z-index: 200001 !important;
}

/* FIX: Challenge Modal Priority */
.challenge-modal {
  z-index: 220001 !important;
}


/* =====================================================================
   SECTION: [GAME] BOSS WIDGET INLINE ON AVATAR
   - Boss mini pill gắn vào avatar, gọn, dài, không chiếm top màn hình.
   ===================================================================== */

.avatar-cultivation {
  overflow: visible !important;
}

.boss-widget {
  position: absolute;
  left: auto;
  right: 6px;
  /* Sát khung bên phải của HUD */
  bottom: -6px;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);

  width: clamp(112px, 34vw, 148px);
  height: 22px;
  display: none;
  align-items: center;
  gap: 6px;

  padding: 3px 6px 3px 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(26, 7, 7, 0.98), rgba(62, 8, 8, 0.95));
  border: 1px solid rgba(255, 80, 80, 0.72);

  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(255, 0, 0, 0.24);

  z-index: 220000 !important;
  animation: none !important;

  pointer-events: auto !important;
  touch-action: manipulation;
  user-select: none;
  backdrop-filter: none;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.tribulation-widget {
  bottom: 39px !important;
  /* Đã đẩy lên trên 1 chút so với 24px */
  z-index: 220001 !important;
}

.tribulation-widget .boss-icon {
  border: 2px solid #a600ff !important;
}

.tribulation-widget .boss-hp-bg {
  background: rgba(80, 0, 100, 0.9) !important;
  /* Nền đặc hơn xíu để chống chớp */
  border: 1px solid #a600ff !important;
}

.tribulation-widget .boss-hp-bar {
  background: linear-gradient(90deg, #5e00ff, #d400ff) !important;
}

.tribulation-widget .boss-name {
  color: #eaafff !important;
  text-shadow: 0 0 5px #a600ff !important;
}

.boss-widget:active {
  transform: translateZ(0) scale(0.96);
  -webkit-transform: translateZ(0) scale(0.96);
  border-color: #ff6b6b;
}

.boss-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 110, 110, 0.85);
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.35);
  flex: 0 0 16px;
  display: block;
  margin: 0 !important;
}

.boss-inline-main {
  flex: 1;
  min-width: 0;
}

.boss-hp-bg {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(30, 0, 0, 0.92);
  border: 1px solid rgba(255, 90, 90, 0.25);
}

.boss-hp-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a30000 0%, #ff3b30 55%, #ff7a7a 100%);
  transition: width 0.35s ease, filter 0.25s ease, opacity 0.25s ease;
}

.boss-overlay-row {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
}

.boss-name,
.boss-hp-text,
.boss-timer {
  font-size: 8px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

.boss-name {
  color: #ffd6d6;
}

.boss-hp-text {
  position: static;
  width: auto;
  text-align: center;
  color: #ffffff;
}

.boss-timer {
  color: #ffe082;
}

.boss-widget[data-phase="warning"] .boss-hp-bar {
  background: linear-gradient(90deg, #c76a00 0%, #ff9800 55%, #ffd54f 100%);
}

.boss-widget[data-phase="danger"] .boss-hp-bar {
  background: linear-gradient(90deg, #7a0015 0%, #ff1744 60%, #ff8a80 100%);
  box-shadow: 0 0 8px rgba(255, 23, 68, 0.45);
}

.boss-shake {
  animation: boss-shake 0.42s;
}

@keyframes boss-shake {
  0% {
    transform: translateZ(0) translate(0, 0) rotate(0deg);
  }

  20% {
    transform: translateZ(0) translate(-1px, 0) rotate(-1deg);
  }

  40% {
    transform: translateZ(0) translate(2px, 0) rotate(1deg);
  }

  60% {
    transform: translateZ(0) translate(-2px, 1px) rotate(-1deg);
  }

  80% {
    transform: translateZ(0) translate(1px, -1px) rotate(1deg);
  }

  100% {
    transform: translateZ(0) translate(0, 0) rotate(0deg);
  }
}

@media (max-width: 480px) {
  .boss-widget {
    width: 108px;
    bottom: 4px;
    right: 4px;
    padding-right: 4px;
  }

  .boss-name {
    display: none;
  }

  .boss-overlay-row {
    grid-template-columns: 1fr auto;
  }

  .boss-hp-text {
    text-align: left;
  }
}

/* --- BOSS COMBAT EFFECTS (Moved from JS) --- */
@keyframes bossFloatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-50px) scale(1.2);
  }
}

.boss-float-text {
  position: fixed;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 1px 1px 2px #000;
  pointer-events: none;
  z-index: 2147483647 !important;
  animation: bossFloatUp 1s ease-out forwards;
}

.boss-float-dmg {
  color: #fff;
  font-size: 16px;
}

.boss-float-crit {
  color: #FFD700;
  font-size: 20px;
}

.boss-float-counter {
  color: #ff4444;
  font-size: 14px;
}

/* NEW BUTTON STYLES */
.btn-premium-gold {
  background: linear-gradient(180deg, #d4af37 0%, #a88626 100%);
  border: 1px solid #ffd700;
  color: #000;
  color: #000;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 4px;
  box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-premium-gold:active {
  transform: scale(0.95);
}

/* TFT ANIMATIONS */
@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }

  100% {
    transform: translateY(-30px);
    opacity: 0;
  }
}

.float-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: bold;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
  animation: floatUp 0.8s forwards;
  z-index: 100;
  font-size: 14px;
}

.float-dmg {
  color: #ff5252;
}

.float-heal {
  color: #00e676;
}

.float-crit {
  color: #ff9800;
  font-size: 18px !important;
}

.anim-die {
  filter: grayscale(100%);
  opacity: 0.3 !important;
  transition: all 0.5s;
  transform: scale(0.9);
}

.btn-danger-red {
  background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
  border: 1px solid #ff0000;
  color: #fff;
  color: #fff;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 4px;
  box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
  cursor: pointer;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-danger-red:active {
  transform: scale(0.95);
}



/* TIER BORDERS - SYNCED WITH GAMEDATA.JS */
.tier-border-0 {
  border: 2px solid #50c878 !important;
  box-shadow: 0 0 5px #50c878;
}

.tier-border-1 {
  border: 2px solid #00BFFF !important;
  box-shadow: 0 0 5px #00BFFF;
}

.tier-border-2 {
  border: 2px solid #9b59b6 !important;
  box-shadow: 0 0 8px #9b59b6;
}

.tier-border-3 {
  border: 2px solid #ff4444 !important;
  box-shadow: 0 0 10px #ff4444;
}

.tier-border-4 {
  border: 2px solid #FFD700 !important;
  box-shadow: 0 0 12px #FFD700;
}

.tier-border-5 {
  border: 2px solid #FFD700 !important;
  box-shadow: 0 0 15px #FFD700;
}

.tft-name-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 8px;
  text-align: center;
  padding: 1px 0;
  z-index: 5;
  border-top-left-radius: 4px;
  /* Slightly less than image if needed */
  border-top-right-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tft-stat-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: transparent;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9), -1px -1px 2px rgba(0, 0, 0, 0.9), 1px -1px 2px rgba(0, 0, 0, 0.9), -1px 1px 2px rgba(0, 0, 0, 0.9);
  color: #fff;
  font-size: 7px;
  padding: 1px 2px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.tft-champ-icon {
  width: 48px;
  /* Larger */
  height: 48px;
  border-radius: 6px;
  /* Rounded Square */
  object-fit: cover;
  /* Border is applied via class */
  box-sizing: border-box;
}

.hp-bar-mini {
  position: absolute;
  bottom: 12px;
  /* Above bottom text */
  left: 2px;
  right: 2px;
  width: calc(100% - 4px);
  height: 3px;
  background: #444;
  /* Background for bar */
  z-index: 8;
}

.hp-bar-fill {
  height: 100%;
  background: #0f0;
  width: 100%;
  transition: width 0.3s;
}

/* TFT ANIMATIONS (Restored & Updated for Card Layout) */
@keyframes tft-attack {
  0% {
    transform: scale(1);
    z-index: 100;
  }

  50% {
    transform: scale(1.15);
    z-index: 105;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
  }

  100% {
    transform: scale(1);
    z-index: 100;
  }
}

@keyframes tft-hit {
  0% {
    filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5);
  }

  100% {
    filter: brightness(1);
  }
}

/* Apply animation to the WHOLE CARD */
.tft-cell.anim-attack {
  animation: tft-attack 0.2s ease-out;
  z-index: 100 !important;
}

/* Apply hit effect */
.tft-cell.anim-hit .tft-champ-icon {
  animation: tft-hit 0.3s ease-out;
}

/* NEW TFT V3 EFFECTS - SKILL TYPE ANIMATIONS */

/* === DEFAULT SKILL HIT (Purple glow) === */
@keyframes skill-hit {
  0% {
    filter: brightness(3) hue-rotate(270deg) contrast(200%);
    transform: scale(1.2);
  }

  100% {
    filter: none;
    transform: scale(1);
  }
}

.anim-skill-hit .tft-champ-icon {
  animation: skill-hit 0.6s ease-out;
  border: 2px solid #a020f0 !important;
}

/* === AoE SKILL (Mage - Purple pulse explosion) === */
@keyframes fx-aoe {
  0% {
    box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.8);
    transform: scale(1);
  }

  40% {
    box-shadow: 0 0 20px 8px rgba(156, 39, 176, 0.6);
    transform: scale(1.15);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(156, 39, 176, 0);
    transform: scale(1);
  }
}

.anim-fx-aoe {
  animation: fx-aoe 0.6s ease-out !important;
  z-index: 50 !important;
}

.anim-fx-aoe .tft-champ-icon {
  filter: brightness(1.8) hue-rotate(270deg) saturate(2);
  transition: filter 0.3s;
}

/* === HEAL SKILL (Support - Green healing glow) === */
@keyframes fx-heal {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.9);
  }

  30% {
    box-shadow: 0 0 15px 6px rgba(76, 175, 80, 0.7);
  }

  60% {
    box-shadow: 0 0 25px 10px rgba(129, 199, 132, 0.5);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

.anim-fx-heal {
  animation: fx-heal 0.8s ease-out !important;
}

.anim-fx-heal .tft-champ-icon {
  filter: brightness(1.5) hue-rotate(90deg) saturate(1.5);
  border-color: #4caf50 !important;
  transition: filter 0.3s;
}

/* === DEFENSE SKILL (Tank - Gold shield barrier) === */
@keyframes fx-defense {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.9);
    transform: scale(1);
  }

  25% {
    box-shadow: 0 0 12px 4px rgba(255, 215, 0, 0.7), inset 0 0 8px rgba(255, 215, 0, 0.3);
    transform: scale(1.08);
  }

  50% {
    box-shadow: 0 0 20px 8px rgba(255, 193, 7, 0.5), inset 0 0 12px rgba(255, 215, 0, 0.5);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
    transform: scale(1);
  }
}

.anim-fx-defense {
  animation: fx-defense 0.7s ease-out !important;
}

.anim-fx-defense .tft-champ-icon {
  filter: brightness(1.4) sepia(0.5) saturate(2);
  border-color: #ffd700 !important;
  transition: filter 0.3s;
}

/* === EXECUTE SKILL (Assassin - Red death flash) === */
@keyframes fx-execute {
  0% {
    transform: scale(1);
    filter: none;
  }

  15% {
    transform: scale(0.9) rotate(-3deg);
  }

  35% {
    transform: scale(1.25) rotate(2deg);
    filter: brightness(2) sepia(1) hue-rotate(-50deg) saturate(5);
  }

  50% {
    box-shadow: 0 0 30px 10px rgba(255, 0, 0, 0.8);
  }

  100% {
    transform: scale(1) rotate(0deg);
    filter: none;
    box-shadow: none;
  }
}

.anim-fx-execute {
  animation: fx-execute 0.7s ease-out !important;
  z-index: 50 !important;
}

/* === PIERCE SKILL (Marksman - Cyan streak) === */
@keyframes fx-pierce {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.9);
    clip-path: inset(0);
  }

  30% {
    box-shadow: -8px 0 15px 3px rgba(0, 188, 212, 0.7), 8px 0 15px 3px rgba(0, 188, 212, 0.7);
  }

  60% {
    box-shadow: -15px 0 20px 5px rgba(0, 229, 255, 0.4), 15px 0 20px 5px rgba(0, 229, 255, 0.4);
  }

  100% {
    box-shadow: none;
  }
}

.anim-fx-pierce {
  animation: fx-pierce 0.5s ease-out !important;
}

.anim-fx-pierce .tft-champ-icon {
  filter: brightness(1.6) hue-rotate(180deg) saturate(2);
  border-color: #00bcd4 !important;
  transition: filter 0.2s;
}

/* === CLEAVE SKILL (Fighter - Orange slash wave) === */
@keyframes fx-cleave {
  0% {
    transform: scale(1) rotate(0deg);
  }

  20% {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 5px 0 15px rgba(255, 152, 0, 0.8);
  }

  50% {
    transform: scale(1.15) rotate(5deg);
    box-shadow: -5px 0 15px rgba(255, 152, 0, 0.6);
  }

  100% {
    transform: scale(1) rotate(0deg);
    box-shadow: none;
  }
}

.anim-fx-cleave {
  animation: fx-cleave 0.5s ease-out !important;
  z-index: 50 !important;
}

.anim-fx-cleave .tft-champ-icon {
  filter: brightness(1.5) sepia(0.3) saturate(2);
  border-color: #ff9800 !important;
  transition: filter 0.2s;
}

/* === FLOAT TEXT SKILL COLORS === */
.float-skill {
  color: #ce93d8;
}

.float-aoe {
  color: #ba68c8;
  font-size: 13px !important;
}

.float-execute {
  color: #ff1744;
  font-size: 16px !important;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.8), 1px 1px 0 #000;
}

.float-pierce {
  color: #00e5ff;
}

.float-cleave {
  color: #ff9800;
}

.float-defense {
  color: #ffd740;
}

.mana-bar-mini {
  position: absolute;
  bottom: 9px;
  left: 2px;
  right: 2px;
  height: 2px;
  background: #333;
  z-index: 8;
}

.mana-bar-fill {
  height: 100%;
  background: #00BFFF;
  width: 0%;
  transition: width 0.3s;
}


/* [REMOVED] [FIX] MISSING TOAST CSS → moved to game_core.js */

/* FIX FLICKER & GPU ACCELERATION */
.custom-modal,
.ladder-modal,
.chat-modal,
#unified-modal {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* transform: translateZ(0); REMOVED TO PREVENT ALIGNMENT BUG */
  will-change: transform, opacity;
}

.inventory-grid,
.ladder-list {
  contain: content;
}

/* [FIX] Responsive Modal trên màn hình nhỏ - không bị cắt chữ/nút */
@media (max-width: 480px) {
  .custom-modal {
    padding: 5px !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 95vh !important;
    border-radius: 8px !important;
    margin: 0 !important;
  }



  /* Inventory: Item detail không bị cắt */
  .detail-img {
    width: 60px !important;
    height: 60px !important;
  }

  .detail-name {
    font-size: 14px !important;
  }

  .detail-stats-style {
    font-size: 10px !important;
  }

  .detail-tier {
    font-size: 10px !important;
  }

  /* Modal header/footer compact */
  .modal-header {
    padding: 6px 10px !important;
    font-size: 13px !important;
  }

  .modal-footer {
    padding: 6px 8px !important;
  }

  /* Filter bar nhỏ hơn */
  .filter-bar {
    padding: 5px !important;
    gap: 3px !important;
    flex-wrap: wrap !important;
  }

  .filter-btn {
    font-size: 9px !important;
    padding: 3px 6px !important;
  }

  /* Action buttons không bị tràn */
  #inv-actions .btn-action,
  #action-area .btn-action {
    font-size: 8px !important;
    padding: 5px 2px !important;
  }


}

/* SHOP STYLES */
.shop-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #444;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-radius: 4px;
  min-width: 100px;
}


/* --- CONTAINER AVATAR --- */
.avatar-cultivation {
  position: relative;
  /* Quan tr?ng: Ð? Pet d?nh v? theo Avatar */
}

/* --- CSS CHO PET CHUY?N Ð?NG --- */
.pet-display {
  width: 40px;
  /* Kích thu?c v?a ph?i */
  height: 40px;

  /* Can ch?nh v? trí - Góc ph?i trên c?a Avatar */
  position: absolute;
  right: -35px;
  top: -10px;
  margin: 0;

  /* Hi?u ?ng */
  z-index: 100;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  pointer-events: auto !important;
  /* [FIX] Allow clicking on pet */
  cursor: pointer;
  /* Add pointer cursor */

  /* Tùy ch?n: N?u mu?n Pet nhún nh?y nh? thì gi? animation, không thì xóa di */
  animation: none;
}

/* ================================================= */
/* >>> Z-INDEX GOD TIER: KHÔNG BAO GI? B? CHE <<< */
/* ================================================= */

/* 1. Uu tiên TUY?T Ð?I: Debug, Chu?t (Toast moved to game_core.js) */
#debug-console,
.cursor-effect {
  z-index: 2147483647 !important;
  /* Max Int */
}

/* 3. Uu tiên R?T CAO: Các b?ng thông báo quan tr?ng (PvP, Update, Logout) */
.challenge-modal,
#challenge-modal,
#pvp-wait-modal,
#pvp-persistent-modal,
#force-logout-modal,
#update-modal,
#redeem-modal {
  z-index: 2147483645 !important;
}

/* 4. Uu tiên CAO: Các Modal ch?c nang (Kho, Shop, TFT, Chat) 
   Ph?i cao hon HUD và Boss Widget nhung th?p hon thông báo */
.custom-modal,
#inv-modal,

#tft-modal,
#champ-info-modal,
#ladder-modal,
.chat-modal,
#chat-modal,
#unified-modal {
  z-index: 2147483000 !important;
}

/* 5. S?a l?i hi?n th? n?i dung bên trong Modal 
   (Ð?m b?o dropdown/tooltip trong modal n?i lên trên) */
.modal-content {
  z-index: 2147483001 !important;
  position: relative !important;
}

/* 6. Fix l?i Widget Boss/HUD dè lên Modal cu */
.boss-widget {
  z-index: 200000 !important;
  /* Th?p hon Modal */
}

#unified-hud-wrapper,
.tutien-hud,
.rpg-top-bar {
  z-index: 1000 !important;
  /* Th?p h?n xu?ng */
}

/* --- FIX WAR REPORT Z-INDEX --- */
#tft-report-modal {
  z-index: 2147483647 !important;
  /* MAX SAFETY */
}

/* --- FIX CHALLENGE MODAL Z-INDEX (TOP PRIORITY) --- */
#challenge-modal {
  z-index: 2147483647 !important;
  /* Always On Top */
}

#ladder-modal {
  z-index: 200005 !important;
  /* Below Challenge */
}

/* --- COMBAT TEXT VISUALS (New) --- */
.float-skill {
  color: #b39ddb !important;
  font-size: 16px !important;
  text-shadow: 0 0 5px #673ab7;
  z-index: 99999;
}

.float-crit {
  color: #ffeb3b !important;
  font-size: 18px !important;
  font-weight: bold;
  text-shadow: 0 0 5px #f57f17;
  z-index: 99999;
}

/* --- EXPEDITION BADGE --- */
#btn-expedition {
  position: relative;
}

.exp-badge-style {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  background: #ff5252;
  color: #fff;
  border: 2px solid rgba(0, 0, 0, 0.65);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* --- iOS FLICKER FIX V2 (Visibility > Display) --- */

/* Override previous display:none which causes layout thrashing */
body.hide-ui .boss-widget {
  display: block !important;
  /* Keep in DOM layout */
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  max-height: 0 !important;
  /* Collapse height to avoid scrollbar issues */
  overflow: hidden !important;
}



/* Ensure Toggle Button remains interactable */
body.hide-ui #btn-toggle-mode {
  visibility: visible !important;
  opacity: 0.5 !important;
  pointer-events: auto !important;
}

/* Optimize Body for iOS */
body.iphone,
body.ipad {
  -webkit-font-smoothing: antialiased;
  -webkit-overflow-scrolling: touch;
}

/* Fix Card Flip rendering */
.card,
.front,
.back {
  /* Ensure no background leakage */
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

/* --- LADDER TABS (Clean Neutral Base) --- */
.ladder-tabs {
  display: flex;
  margin-bottom: 8px;
  gap: 4px;
}

.ladder-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
}

.ladder-tab:hover {
  opacity: 0.9;
}

.ladder-tab.active {
  font-weight: 800;
}

/* =====================================================================
   SECTION: [THEME] NIGHT MODE / GAME MODE OVERRIDES (CARD CONTENT)
   ===================================================================== */
.nightMode.container,
.skin-tutien.container,
.nightMode .container,
.skin-tutien .container,
.nightMode .card,
.skin-tutien .card,
.nightMode #qa,
.skin-tutien #qa {
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #f0e6d2 !important;
}

.nightMode .korean-text,
.skin-tutien .korean-text {
  color: #C8AA6E !important;
}

.nightMode .vietnamese-meaning,
.skin-tutien .vietnamese-meaning,
.nightMode .meaning-highlight,
.skin-tutien .meaning-highlight {
  background-color: transparent !important;
  color: #C8AA6E !important;
  border-left-color: #C8AA6E !important;
}

.nightMode .note-box,
.skin-tutien .note-box {
  background-color: transparent !important;
  color: #C8AA6E !important;
  border-left-color: #C8AA6E !important;
}

.nightMode b,
.nightMode strong,
body:not(.hw-game-core-active) .skin-tutien b,
body:not(.hw-game-core-active) .skin-tutien strong {
  color: #C8AA6E !important;
}

.nightMode a,
body:not(.hw-game-core-active) .skin-tutien a {
  color: #C8AA6E !important;
}

.nightMode span[style*="#e57373"],
body:not(.hw-game-core-active) .skin-tutien span[style*="#e57373"] {
  color: #C8AA6E !important;
}

.nightMode .copy-btn,
.skin-tutien .copy-btn {
  background-color: #1e2328 !important;
  border-color: #C8AA6E !important;
  color: #C8AA6E !important;
}

.nightMode hr,
.skin-tutien hr {
  border-top-color: #444 !important;
}

.nightMode input#typeans,
.skin-tutien input#typeans,
.nightMode code#typeans,
.skin-tutien code#typeans {
  background-color: transparent !important;
  color: #f0e6d2 !important;
  border-color: #C8AA6E !important;
  font-family: 'Malgun Gothic', 'Noto Sans KR', 'Segoe UI', sans-serif !important;
  font-size: 24px !important;
  font-weight: 700 !important;
}

/* === UI STABILITY HOTFIX (ladder jitter + modal flicker) === */
.ladder-row {
  transition: background-color 0.18s ease, border-left-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease !important;
  padding-left: 10px !important;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.ladder-row:hover,
.ladder-row:active {
  padding-left: 10px !important;
  /* transform: translateX(2px); REMOVED to fix jitter */
}

/* FIX FLICKER FOR MODALS WITHOUT BREAKING THEM */
.custom-modal,
.ladder-modal,
.champ-info-modal,
#unified-modal,
#update-modal,
.chat-modal,
#chat-modal,
#inv-modal,

#tft-modal,
#tft-report-modal,
#champ-info-modal,
#ladder-modal,
#redeem-modal,
#challenge-modal,
#pvp-wait-modal,
#pvp-persistent-modal {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* contain: paint; REMOVED because it hides fixed popups like chiến báo, đếm giây */
}

.modal-content,
.ladder-box,
.challenge-modal,
#unified-modal .modal-content {
  animation: none !important;
  will-change: opacity, transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.ladder-modal,
.custom-modal,
.chat-modal,
#chat-modal,
#unified-modal,
#inv-modal,

#tft-modal,
#champ-info-modal,
#ladder-modal,
#redeem-modal {
  animation: none !important;
}

/* =========================================================
   COUPLE PROFILE / LOVE LICENSE UI PATCH
   ========================================================= */
.hud-couple-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hud-couple-name-row #user-rank-name {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 4px !important;
  /* [FIX CHỚP V4] Tránh repaint khi thay đổi text */
  contain: layout style;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* [FIX CHỚP V4] Giữ ổn định các text element trong HUD khi lật thẻ */
#exp-num,
#hud-copper-num,
#rank-badge {
  contain: layout style;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* [REMOVED] couple ring styles - đã xóa icon nhẫn khỏi HUD */

.meridian-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px 3px #0ac8b9;
  transform: translate(-50%, -50%);
  animation: meridianPulse 1.5s infinite alternate ease-in-out;
}

@keyframes meridianPulse {
  0% {
    box-shadow: 0 0 5px 1px #0ac8b9;
    opacity: 0.7;
  }

  100% {
    box-shadow: 0 0 15px 5px #0bdccd;
    opacity: 1;
  }
}

@keyframes pulseGlow {
  0% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(0.9);
  }

  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }

  100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

.stat-box {
  background: rgba(5, 15, 30, 0.7);
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== CHATGPT BUTTON ===== */
.chatgpt-container {
  text-align: center;
  margin: 15px 0;
  display: flex;
  justify-content: center;
}

.chatgpt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #10a37f, #0d8a6a);
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(16, 163, 127, 0.4);
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.chatgpt-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 163, 127, 0.6);
  background: linear-gradient(135deg, #12b78e, #0e9674);
}

.chatgpt-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* =====================================================================
   CULTIVATION RANK EFFECTS (Kết Đan+)
   ===================================================================== */
/* Tier 3 (Kết Đan): Glow Pulse */
.rank-tier-3 {
  animation: rankGlowPulse 3.5s infinite alternate ease-in-out;
}

@keyframes rankGlowPulse {
  0% {
    box-shadow: 0 0 4px rgba(77, 182, 172, 0.4);
  }

  100% {
    box-shadow: 0 0 12px rgba(77, 182, 172, 1);
  }
}

/* Tier 4 (Nguyên Anh): Breathing Aura */
.rank-tier-4 {
  animation: rankBreathing 5s infinite ease-in-out;
  border-width: 2px !important;
}

@keyframes rankBreathing {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(79, 195, 247, 0.5);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(79, 195, 247, 1);
  }
}

/* Tier 5 (Hóa Thần): Shimmer Sweep */
.rank-tier-5 {
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(100, 181, 246, 0.9) !important;
}

.rank-tier-5::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
  animation: rankShimmer 4s infinite ease-in-out;
  transform: skewX(-20deg);
}

@keyframes rankShimmer {
  100% {
    left: 200%;
  }
}

/* Tier 6 (Luyện Hư): Ethereal Float */
.rank-tier-6 {
  animation: rankEthereal 6s infinite ease-in-out;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

@keyframes rankEthereal {

  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 0 10px rgba(121, 134, 203, 0.6);
    border-color: rgba(121, 134, 203, 0.6);
  }

  50% {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(121, 134, 203, 1);
    border-color: rgba(255, 255, 255, 1);
  }
}

/* Tier 7 (Hợp Thể): Mystic Gradient */
.rank-tier-7 {
  background: linear-gradient(45deg, rgba(0, 0, 0, 0.8), rgba(186, 104, 200, 0.6), rgba(0, 0, 0, 0.8)) !important;
  background-size: 200% 200% !important;
  animation: rankMystic 6s infinite ease;
  border-color: #e040fb !important;
}

@keyframes rankMystic {
  0% {
    background-position: 0% 50%;
    box-shadow: 0 0 10px #ba68c8;
  }

  50% {
    background-position: 100% 50%;
    box-shadow: 0 0 25px #e040fb;
  }

  100% {
    background-position: 0% 50%;
    box-shadow: 0 0 10px #ba68c8;
  }
}

/* Tier 8 (Đại Thừa): Burning Flame */
.rank-tier-8 {
  border-color: #ff4081 !important;
  color: #fff !important;
  text-shadow: 0 0 8px #f06292, 0 -2px 14px #ff1744;
  animation: rankFlame 3s infinite alternate;
}

@keyframes rankFlame {
  0% {
    box-shadow: 0 0 10px #f06292, inset 0 0 5px #e53935;
    text-shadow: 0 0 4px #fff, 0 -1px 8px #ff1744;
    background: rgba(0, 0, 0, 0.6);
  }

  100% {
    box-shadow: 0 0 30px #ff1744, inset 0 0 15px #f06292;
    text-shadow: 0 0 10px #fff, 0 -3px 18px #ff4081;
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff1744;
  }
}

/* Tier 9 (Độ Kiếp): Lightning Flash */
.rank-tier-9 {
  border-color: #ef5350 !important;
  animation: rankLightning 5s infinite;
}

@keyframes rankLightning {

  0%,
  9%,
  11%,
  19%,
  21%,
  100% {
    box-shadow: 0 0 10px rgba(229, 115, 115, 0.8);
    text-shadow: none;
    background: rgba(0, 0, 0, 0.6);
    color: #e57373;
  }

  10%,
  20% {
    box-shadow: 0 0 40px #fff, 0 0 20px #e57373;
    text-shadow: 0 0 10px #fff;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border-color: #fff;
  }
}

/* Tier 10+ (Chân Tiên+): Divine Gold */
.rank-tier-10,
.rank-tier-11,
.rank-tier-12,
.rank-tier-13,
.rank-tier-14,
.rank-tier-15 {
  border: 2px solid #ffca28 !important;
  background: linear-gradient(90deg, #ffb300, #fff8e1, #ffb300) !important;
  background-size: 200% auto !important;
  color: #000 !important;
  font-weight: 900 !important;
  text-shadow: 0 0 2px #fff !important;
  box-shadow: 0 0 25px rgba(255, 183, 77, 1), inset 0 0 10px #fff !important;
  animation: rankDivine 4s linear infinite;
}

@keyframes rankDivine {
  to {
    background-position: 200% center;
  }
}

/* === USER ORIGINAL CSS (kept last for priority) === */
.card {
  font-family: Arial;
  background-color: #f4f6f9 !important;
}

.test-container {
  max-width: 650px;
  margin: 0 auto;
  background-color: #ffffff !important;
  padding: 20px;
  border-radius: 8px;
  position: relative;
  color: #111111 !important;
}

.test-title {
  text-align: center;
  color: #1a73e8 !important;
  border-bottom: 2px solid #1a73e8;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

/* --- BẢNG ĐIỀU KHIỂN DÍNH --- */
#sticky-panel {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff !important;
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
  /* [FIX RUNG KHUNG IOS] */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform, top;
}

.panel-top-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

#timer-display {
  flex: 1;
  background-color: #fff3cd !important;
  color: #856404 !important;
  padding: 10px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  border: 1px solid #ffeeba !important;
  border-radius: 5px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.time-warning {
  background-color: #f8d7da !important;
  color: #721c24 !important;
  border-color: #f5c6cb !important;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
    transform: scale(0.98);
  }

  100% {
    opacity: 1;
  }
}

#submit-btn {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  width: auto;
  padding: 10px;
  background-color: #1a73e8 !important;
  color: #ffffff !important;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.3s;
  margin: 0;
  opacity: 1;
}

#submit-btn:hover {
  background-color: #1557b0 !important;
}

#result-area {
  margin-bottom: 10px;
  padding: 8px;
  text-align: center;
  background-color: #e8f0fe !important;
  border-radius: 5px;
  color: #1a73e8 !important;
  font-weight: bold;
  font-size: 18px;
}

/* --- BẢNG ĐIỀU HƯỚNG 40 CÂU --- */
#nav-area {
  padding: 5px;
  background-color: #f8f9fa !important;
  border: 1px solid #e9ecef !important;
  border-radius: 5px;
}

.nav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
}

.nav-item {
  width: 24px;
  height: 24px;
  background-color: #ffffff !important;
  border: 1px solid #ccc !important;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.nav-item span {
  font-size: 11px;
  font-weight: normal;
  color: #111111 !important;
  line-height: 1;
  margin: 0;
  padding: 0;
}

.nav-item:hover {
  background-color: #e2e6ea !important;
}

.nav-item.answered {
  background-color: #f1f3f4 !important;
  border-color: #e8eaed !important;
}

.nav-item.answered span {
  color: #888888 !important;
}

.nav-item.active {
  box-shadow: 0 0 0 2px #1a73e8 !important;
  border-color: #1a73e8 !important;
}

.nav-item.active span {
  font-weight: bold !important;
  color: #1a73e8 !important;
}

.nav-item.correct {
  background-color: #198754 !important;
  border-color: #198754 !important;
}

.nav-item.correct span {
  color: #ffffff !important;
  font-weight: bold !important;
}

.nav-item.incorrect {
  background-color: #dc3545 !important;
  border-color: #dc3545 !important;
}

.nav-item.incorrect span {
  color: #ffffff !important;
  font-weight: bold !important;
}

/* --- CÂU HỎI VÀ ĐÁP ÁN --- */
.question-box {
  background-color: #ffffff !important;
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #ddd !important;
  border-radius: 5px;
  text-align: left;
  scroll-margin-top: 260px;
  color: #111111 !important;
  transition: all 0.3s ease;
}

.question-box h3 {
  color: #1a73e8 !important;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
}

.question-box p {
  font-weight: bold;
  margin-top: 0;
  line-height: 1.5;
  font-size: 15px;
  color: #111111 !important;
}

.q-img {
  max-width: 100%;
  display: block;
  margin: 10px 0;
}

.q-audio {
  margin: 10px 0;
  transition: all 0.3s ease;
}

.opt-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 4px 0;
  border: 1px solid #eee !important;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  background-color: #ffffff !important;
  color: #111111 !important;
}

.opt-label:hover {
  background-color: #f1f3f4 !important;
}

.opt-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #333;
  background-color: transparent;
  color: #333 !important;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  transition: all 0.3s;
  flex-shrink: 0;
}

.opt-content {
  flex: 1;
  color: #111111 !important;
  font-size: 14px;
}

/* MÀU ĐÁP ÁN KHI NỘP BÀI */
.opt-num.opt-correct {
  background-color: #198754 !important;
  color: #ffffff !important;
  border-color: #198754 !important;
}

.opt-num.opt-wrong {
  background-color: #dc3545 !important;
  color: #ffffff !important;
  border-color: #dc3545 !important;
}

.opt-num.opt-unselected {
  background-color: #0dcaf0 !important;
  color: #ffffff !important;
  border-color: #0dcaf0 !important;
}

/* Grid 2x2 cho ảnh */
.options.image-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.options.image-grid .opt-label {
  flex-direction: column;
  text-align: center;
  justify-content: center;
  padding: 10px;
  gap: 6px;
}

.options.image-grid .opt-content img {
  max-height: 110px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #ccc !important;
  display: block;
  margin: 0 auto;
}

.options.hidden-text {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.options.hidden-text .opt-label {
  flex: 1;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 15px;
}

.options.hidden-text .opt-num {
  width: 34px;
  height: 34px;
  font-size: 20px;
  margin: 0;
}

.underline-text-option {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: bold;
  color: #d93025 !important;
}

/* --- KHÓA NÚT AUDIO ĐỂ KHÔNG NGHE LẠI --- */
.audio-locked {
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(100%);
}

/* LÀM MỜ VÀ KHÓA LUÔN ĐÁP ÁN KHI ĐÃ NGHE XONG (KHÔNG CHO CHỌN LẠI / ĐỔI LẠI) */
.question-locked .options {
  pointer-events: none !important;
  opacity: 0.6;
  filter: grayscale(80%);
}

/* --- NÚT CHUYỂN PHẦN VÀ CÁC CLASS ẨN --- */
.switch-section-btn {
  background-color: #fd7e14 !important;
  color: #ffffff !important;
  border: none;
  padding: 12px 25px;
  font-size: 16px;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.switch-section-btn:hover {
  background-color: #e8590c !important;
  transform: translateY(-2px);
}

.hidden-reading,
.hidden-listening {
  display: none !important;
}

/* =========================================================================
   [MODE OFF FIXES] Ensure no dark blue wrappers in light mode 
   ========================================================================= */
html.anki-mode-off body,
html.anki-mode-off .card,
html.anki-mode-off #content,
html.anki-mode-off #qa,
html.anki-mode-off #qa_box,
html.anki-mode-off #qa_inner,
html.anki-mode-off .flip-container,
html.anki-mode-off .flip-inner,
html.anki-mode-off .flip-face {
  background: transparent !important;
  background-color: transparent !important;
  color: #333 !important;
}

html.anki-mode-off {
  background-color: #f0f2f5 !important;
}

/* =========================================================================
   ANTIFLICKER PROTECTION (CHỐNG RUNG & CHỚP GIẬT MÀN HÌNH TRÊN PC/ANKI REVIEWER)
   ========================================================================= */
/* Triệt tiêu hoàn toàn GPU backdrop-filter compositing để phòng chống lỗi chớp màn hình */
* {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Tăng cường độ mờ và tính sang trọng của hình nền backdrop để bù đắp việc tắt blur */
div[style*="position:fixed"][style*="background:rgba(0,0,0,0.7)"],
div[style*="position: fixed"][style*="background: rgba(0, 0, 0, 0.7)"],
div[style*="background:rgba(0,0,0,0.7)"],
div[style*="background: rgba(0, 0, 0, 0.7)"],
div[style*="background:rgba(0,0,0,0.6)"],
div[style*="background: rgba(0, 0, 0, 0.6)"],
div[style*="background:rgba(10,12,16,0.92)"],
div[style*="background: rgba(10, 12, 16, 0.92)"] {
  background: rgba(10, 12, 16, 0.85) !important;
}

/* Làm cho các modal chính có màu nền sậm, đồng màu và cực kỳ cao cấp */
.custom-modal .modal-content,
.ladder-modal>div,
.champ-info-modal .modal-content,
.champ-info-modal>div,
#unified-modal>div>div,
#update-modal>div,
.chat-modal,
#chat-modal,
#inv-modal .modal-content,
#shop-modal .modal-content,
#tft-modal .modal-content,
#tft-report-modal .modal-content,
#tft-report-modal>div,
#champ-info-modal .modal-content,
#champ-info-modal>div,
#redeem-modal .modal-content,
#challenge-modal .modal-content,
#challenge-modal>div,
#pvp-wait-modal>div {
  background: var(--game-surface, rgba(15, 18, 24, 0.98)) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.15)) !important;
  box-shadow: var(--game-shadow, 0 12px 40px rgba(0, 0, 0, 0.5)) !important;
}

/* [GPU LAYER PROMOTION]
   Ép tất cả các Modals chính, Modal Content và lớp phủ Overlay hoạt động trên luồng GPU độc lập.
   Điều này ngăn chặn triệt để hiện tượng chớp nháy (compositing flicker) khi tương tác, 
   di chuột (hover) hoặc khi lật thẻ card-flip trong Anki. */
.custom-modal,
.ladder-modal,
#unified-modal,
#update-modal,
.chat-modal,
#chat-modal,
#inv-modal,
#shop-modal,
#tft-modal,
#tft-report-modal,
#ladder-modal,
#redeem-modal,
.modal-content,
#expedition-modal {
  transform: translate3d(0, 0, 0) !important;
  -webkit-transform: translate3d(0, 0, 0) !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
  will-change: transform, opacity !important;
  contain: layout style !important;
}

/* Thêm GPU acceleration cho các phần tử con có hiệu ứng hover hoặc ảnh động nặng bên trong modal */
.modal-content img,
.inv-slot,
.btn-action,
.btn-secondary,
.filter-btn,
#exp-squad-inv div {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}



/* Modern glass container style overrides for the web client */
html:not(.anki-mode-off) body {
  color: #e2e8f0 !important;
}

body {
  font-family: var(--font-vietnamese);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

html:not(.anki-mode-off) #main-container {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#main-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 15px;
  box-sizing: border-box;
}

/* CARD SIMULATOR STYLING */
html:not(.anki-mode-off) .card-simulator {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.card-simulator {
  padding: 0 !important;
  margin: 20px 0 !important;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

html:not(.anki-mode-off) .card-simulator:hover {
  border-color: transparent !important;
  box-shadow: none !important;
}

html:not(.anki-mode-off) .korean-text {
  font-size: 3.8rem !important;
  font-weight: 800 !important;
  color: #c8aa6e !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 15px rgba(200, 170, 110, 0.3) !important;
}

.korean-text {
  font-family: var(--font-korean);
  margin: 30px 0 !important;
  line-height: 1.2 !important;
}

html:not(.anki-mode-off) .vietnamese-meaning {
  background: rgba(200, 170, 110, 0.05) !important;
  border-left: 3px solid #c8aa6e !important;
  color: #f0e6d2 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8) !important;
}

.vietnamese-meaning {
  padding: 12px 24px !important;
  border-radius: 8px !important;
  font-size: 1.3rem !important;
  font-weight: 700 !important;
  margin-top: 10px !important;
  display: inline-block !important;
}

html:not(.anki-mode-off) .note-box {
  background: #05101e !important;
  border: 1px solid #444 !important;
  color: #888 !important;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5) !important;
}

.note-box {
  padding: 12px 24px !important;
  border-radius: 8px !important;
  font-size: 1.05rem !important;
  line-height: 1.5 !important;
  margin-top: 15px !important;
  text-align: left !important;
}

/* CUSTOM GLASS BUTTONS */
.btn-play {
  font-family: var(--font-vietnamese);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-play:hover {
  transform: translateY(-2px);
}

.btn-play:active {
  transform: translateY(0);
}

.btn-orange {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: white;
  border-color: #d97706;
}

.btn-orange:hover {
  box-shadow: 0 0 15px rgba(217, 119, 6, 0.4);
}

/* --- PREMIUM ANKI LOL BUTTONS --- */
.hw-btn-premium {
  background: var(--bg-surface, #ffffff) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
  color: var(--text-main) !important;
  transition: transform 0.2s, opacity 0.2s, background-color 0.2s !important;
  box-shadow: var(--shadow-soft) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  user-select: none !important;
  will-change: transform;
}

.hw-btn-premium:hover {
  transform: translateY(-2px) !important;
  border-color: var(--border-strong) !important;
  background-color: var(--bg-hover) !important;
}

.hw-btn-premium:active {
  transform: scale(0.97) !important;
}

html.dark .hw-btn-premium:not(.hw-btn-primary):not(.hw-btn-danger):not(.hw-btn-success):not(.hw-btn-warning):not(.hw-btn-inventory):not(.hw-btn-tft):not(.hw-btn-pet) {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

html.dark .hw-btn-premium:not(.hw-btn-primary):not(.hw-btn-danger):not(.hw-btn-success):not(.hw-btn-warning):not(.hw-btn-inventory):not(.hw-btn-tft):not(.hw-btn-pet):hover {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #ffffff !important;
}

/* Variant buttons styles */
.hw-btn-premium.hw-btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}

.hw-btn-premium.hw-btn-primary:hover {
  background-color: #4f46e5 !important;
  border-color: #4f46e5 !important;
}

.hw-btn-premium.hw-btn-inventory {
  background: var(--primary-soft) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
  color: var(--primary) !important;
}

.hw-btn-premium.hw-btn-inventory:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  color: var(--primary) !important;
}

.hw-btn-premium.hw-btn-tft {
  background: rgba(6, 182, 212, 0.08) !important;
  border-color: rgba(6, 182, 212, 0.2) !important;
  color: #0891b2 !important;
}

.hw-btn-premium.hw-btn-tft:hover {
  background: rgba(6, 182, 212, 0.15) !important;
}

.hw-btn-premium.hw-btn-pet {
  background: rgba(139, 92, 246, 0.08) !important;
  border-color: rgba(139, 92, 246, 0.2) !important;
  color: #7c3aed !important;
}

.hw-btn-premium.hw-btn-pet:hover {
  background: rgba(139, 92, 246, 0.15) !important;
}

.hw-btn-premium.hw-btn-danger {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.16) !important;
  color: var(--danger) !important;
}

.hw-btn-premium.hw-btn-danger:hover {
  background: rgba(239, 68, 68, 0.14) !important;
}

.hw-btn-premium.hw-btn-success {
  background: rgba(16, 185, 129, 0.08) !important;
  border-color: rgba(16, 185, 129, 0.16) !important;
  color: var(--success) !important;
}

.hw-btn-premium.hw-btn-success:hover {
  background: rgba(16, 185, 129, 0.14) !important;
}

.hw-btn-premium.hw-btn-warning {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.16) !important;
  color: var(--warning) !important;
}

.hw-btn-premium.hw-btn-warning:hover {
  background: rgba(245, 158, 11, 0.14) !important;
}

/* 1. Community Buttons */
.hw-btn-community {
  height: 44px !important;
  font-size: 13px !important;
  gap: 8px !important;
  width: 100% !important;
}

/* 2. Review Hero Buttons */
.hw-btn-hero {
  width: 100% !important;
  font-size: 14px !important;
  letter-spacing: 0.05em !important;
  border-radius: 9999px !important;
  min-height: 48px !important;
}

/* 3. Audio Buttons */
.hw-btn-audio {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  padding: 0 !important;
}

.hw-btn-audio i {
  font-size: 18px !important;
}

.hw-btn-audio:hover {
  border-color: rgba(99, 102, 241, 0.45) !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.28) !important;
}

@keyframes hw-mic-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
    border-color: rgba(239, 68, 68, 0.6);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    border-color: rgba(239, 68, 68, 0.8);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    border-color: rgba(239, 68, 68, 0.4);
  }
}

.hw-btn-audio.hw-mic-active {
  animation: hw-mic-pulse 1.5s infinite !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #ef4444 !important;
}

/* 4. Rating Buttons */
.hw-btn-rating {
  border-radius: 9999px !important;
  flex-direction: column !important;
  gap: 2px !important;
  height: auto !important;
  min-height: 44px !important;
  padding: 6px 12px !important;
  flex: 1 !important;
}

/* 5. Adventure Card Buttons */
.hw-btn-adventure-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  padding: 16px !important;
  text-align: center !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-main) !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
  will-change: transform;
}

.hw-btn-adventure-card i {
  font-size: 26px !important;
  transition: transform 0.25s ease !important;
}

.hw-btn-adventure-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
  border-color: var(--border-strong) !important;
  color: var(--primary) !important;
}

.hw-btn-adventure-card:hover i {
  transform: scale(1.1) !important;
}

#tab-btn-rpg,
#mobile-tab-btn-rpg {
  position: relative !important;
}

.hw-vip-feature-badge {
  min-width: 28px;
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  border-radius: 999px;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1;
}

.hw-rpg-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.hw-rpg-tabs::-webkit-scrollbar {
  display: none;
}

.hw-rpg-tab {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.hw-rpg-tab:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

.hw-rpg-tab.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.hw-rpg-panel {
  width: 100%;
}

@media (max-width: 760px) {
  .hw-rpg-tabs {
    display: flex;
    width: 100%;
  }

  .hw-rpg-tab {
    flex: 1 1 0;
    padding: 0 10px;
    font-size: 12px;
  }
}

/* 6. Special Marriage Button */
.hw-btn-marriage-special {
  background: rgba(236, 72, 153, 0.06) !important;
  border: 1px solid rgba(236, 72, 153, 0.16) !important;
  color: #db2777 !important;
  border-radius: 14px !important;
  padding: 10px 14px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s !important;
}

.hw-btn-marriage-special:hover {
  background: rgba(236, 72, 153, 0.12) !important;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.1) !important;
}

/* =========================================================================
           [MODE LIGHT / INTUITIVE] Master Override Classes
           ========================================================================= */

/* 1. HUD & Top Bar Visibility */
#unified-hud-wrapper {
  display: block !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#unified-hud-wrapper .rpg-top-bar {
  display: flex !important;
  background: var(--bg-surface) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  color: var(--text-soft) !important;
}

#unified-hud-wrapper .tutien-hud {
  display: flex !important;
  background: var(--bg-surface) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-main) !important;
  border-radius: 0 0 20px 20px !important;
  margin-bottom: 16px !important;
}

#unified-hud-wrapper .top-left,
#unified-hud-wrapper .top-left-text,
#unified-hud-wrapper #top1-name,
#unified-hud-wrapper #top1-points,
#unified-hud-wrapper .exp-text,
#unified-hud-wrapper .cultivator-name,
#unified-hud-wrapper #user-rank-name,
#unified-hud-wrapper .rank-name-style,
#unified-hud-wrapper .marquee-text {
  color: var(--text-main) !important;
  text-shadow: none !important;
}

#unified-hud-wrapper .exp-bar-bg {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-soft) !important;
}

/* 2. Glassmorphism Card Style overrides in Light Mode */
.hw-glass {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
  border-radius: 20px !important;
  padding: 20px !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 3. Text contrast modifications */
.hw-text-slate-100 {
  color: var(--text-main) !important;
}

.hw-text-slate-200 {
  color: var(--text-main) !important;
}

.hw-text-slate-300 {
  color: var(--text-soft) !important;
}

.hw-text-slate-350 {
  color: var(--text-soft) !important;
}

.hw-text-slate-400 {
  color: var(--text-soft) !important;
}

.hw-text-slate-500 {
  color: var(--text-muted) !important;
}

.hw-text-indigo-400 {
  color: var(--primary) !important;
}

.hw-text-indigo-300 {
  color: var(--primary) !important;
}

/* 4. Background, Border & Status Badge modifications */
.hw-bg-slate-900\/50,
[class*="hw-bg-slate-900/50"],
.hw-bg-slate-900\/60,
[class*="hw-bg-slate-900/60"],
.hw-bg-slate-900\/30,
[class*="hw-bg-slate-900/30"] {
  background-color: var(--bg-soft) !important;
  border-color: var(--border-soft) !important;
}

.hw-bg-slate-950,
[class*="hw-bg-slate-950"] {
  background-color: var(--bg-main) !important;
  border-color: var(--border-soft) !important;
}

.hw-border-slate-800\/40,
[class*="hw-border-slate-800/40"],
.hw-border-slate-800,
[class*="hw-border-slate-800"] {
  border-color: var(--border-soft) !important;
}

.hw-bg-indigo-950,
[class*="hw-bg-indigo-950"] {
  background-color: var(--primary-soft) !important;
  color: var(--primary) !important;
}

.hw-bg-rose-950 {
  background-color: rgba(239, 68, 68, 0.08) !important;
  color: var(--danger) !important;
}

.hw-bg-emerald-950 {
  background-color: rgba(16, 185, 129, 0.08) !important;
  color: var(--success) !important;
}

/* Welcome Banner gradient adjust */
#hw-welcome-banner {
  background: linear-gradient(to right, var(--primary-soft), var(--bg-soft)) !important;
  border-color: var(--border-soft) !important;
}

#hw-welcome-banner h2 {
  color: var(--text-main) !important;
}

#hw-welcome-banner p {
  color: var(--text-soft) !important;
}

/* Sub-cards and nested wrappers background adjust */
.hw-glass .hw-bg-slate-950\/40 {
  background-color: var(--bg-soft) !important;
  border-color: var(--border-soft) !important;
}

/* 4. Keep sidebar and mobile bottom nav styling clean, light and legible */
aside {
  background-color: var(--bg-surface) !important;
  border-right: 1px solid var(--border-soft) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

aside .hw-tab-btn {
  color: var(--text-soft) !important;
  transition: transform 0.2s, background-color 0.2s !important;
  will-change: transform;
}

aside .hw-tab-btn:hover {
  color: var(--text-main) !important;
  background-color: var(--bg-soft) !important;
}

aside .hw-tab-btn.hw-active,
aside .hw-tab-btn.active {
  color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
  border-left: 3px solid var(--primary) !important;
}

#hw-avatar-wrapper {
  background-color: var(--primary-soft) !important;
  border: 1px solid var(--border-soft) !important;
}

#hw-rank-badge {
  color: var(--primary) !important;
}

#hw-user-rank-name {
  color: var(--text-main) !important;
}

aside p {
  color: var(--text-soft) !important;
}

aside button[class*="hw-text-slate-500"] {
  color: var(--text-soft) !important;
}

aside button[class*="hw-text-slate-500"]:hover {
  color: var(--text-main) !important;
}

/* Mobile bottom navigation bar override */
nav[class*="hw-bottom-0"],
#hw-app-layout>nav {
  background-color: var(--bg-surface) !important;
  border-top: 1px solid var(--border-soft) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  height: calc(64px + env(safe-area-inset-bottom)) !important;
}

nav[class*="hw-bottom-0"] .hw-tab-btn,
#hw-app-layout>nav .hw-tab-btn {
  color: var(--text-soft) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  transition: transform 0.2s !important;
  will-change: transform;
}

nav[class*="hw-bottom-0"] .hw-tab-btn.active,
#hw-app-layout>nav .hw-tab-btn.active {
  color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
  border: 1px solid var(--border-soft) !important;
}

/* 3D Flashcard Faces (Front & Back) styling */
.hw-card-face {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
}

#hw-flashcard .hw-card-front,
#hw-flashcard .hw-card-back {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
}

#hw-card-word {
  color: var(--text-main) !important;
}

#hw-card-back-word {
  color: var(--primary) !important;
}

#hw-card-meaning {
  color: var(--text-main) !important;
}

#hw-card-hints {
  color: var(--text-soft) !important;
}

#hw-speech-feedback {
  color: var(--text-soft) !important;
}

/* 6. Form control elements styling */
.user-content-area select,
.user-content-area input,
.user-content-area textarea,
input#typeans,
textarea#typeans,
#hw-deck-search {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-main) !important;
}

.user-content-area select::placeholder,
.user-content-area input::placeholder,
.user-content-area textarea::placeholder,
input#typeans::placeholder,
#hw-deck-search::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.8 !important;
}

/* Rose/danger action buttons in settings */
button[class*="hw-bg-rose-950"] {
  background-color: rgba(239, 68, 68, 0.08) !important;
  border: 1px solid rgba(239, 68, 68, 0.16) !important;
  color: var(--danger) !important;
}

button[class*="hw-bg-rose-950"]:hover {
  background-color: rgba(239, 68, 68, 0.14) !important;
}

/* Cloud backup button in Profile tab */
.hw-btn-cloud-profile {
  background-color: var(--primary-soft) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
  color: var(--primary) !important;
}

.hw-btn-cloud-profile:hover {
  background-color: rgba(99, 102, 241, 0.15) !important;
}

/* Logout button in Profile tab */
.hw-btn-logout-profile {
  background-color: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.2) !important;
  color: var(--danger) !important;
}

.hw-btn-logout-profile:hover {
  background-color: rgba(239, 68, 68, 0.15) !important;
}

/* Drag & Drop zone */
#hw-drop-zone {
  background-color: var(--bg-soft) !important;
  border: 2px dashed var(--border-strong) !important;
}

#hw-drop-zone:hover {
  border-color: var(--primary) !important;
}

#hw-drop-zone p {
  color: var(--text-soft) !important;
}

#hw-drop-zone p[class*="hw-text-slate-500"] {
  color: var(--text-muted) !important;
}

#hw-drop-zone i {
  color: var(--primary) !important;
}

/* Table borders */
.hw-glass table,
.hw-glass tr,
.hw-glass th,
.hw-glass td {
  border-color: var(--border-soft) !important;
}

/* 7. Overriding body.hide-ui visibility */
body.hide-ui #unified-hud-wrapper {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.hide-ui #unified-hud-wrapper .tutien-hud {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

body.hide-ui #unified-hud-wrapper .rpg-top-bar {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}



/* Modal layout normalization */
.modal-content,
#inv-modal .modal-content,
#shop-modal .modal-content,
#tft-modal .modal-content,
#ladder-modal .modal-content,
#meridian-modal .modal-content,
#expedition-modal .modal-content,
#chat-modal .modal-content,
#challenge-modal .modal-content {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 20px !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-main) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Modal buttons formatting */
html.anki-mode-off #chat-modal button:not(.hw-btn-premium):not(.fbtn):not(.inv-tu-btn):not(.group-quiz-action-btn):not([style*="background"]):not([class*="chat"]),
html.anki-mode-off #challenge-modal button:not(.hw-btn-premium):not(.fbtn):not(.inv-tu-btn):not(.group-quiz-action-btn):not([style*="background"]) {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-soft) !important;
  color: var(--text-main) !important;
  border-radius: 12px !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
}

html.anki-mode-off #chat-modal button:not(.hw-btn-premium):not(.fbtn):not(.inv-tu-btn):not(.group-quiz-action-btn):not([style*="background"]):not([class*="chat"]):hover,
html.anki-mode-off #challenge-modal button:not(.hw-btn-premium):not(.fbtn):not(.inv-tu-btn):not(.group-quiz-action-btn):not([style*="background"]):hover {
  background: var(--bg-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text-main) !important;
  transform: translateY(-1px) !important;
}

/* Inventory Item styles */
.inv-item {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-soft) !important;
  color: var(--text-main) !important;
}

.inv-item.tier-0 {
  background: var(--game-surface-subtle, #f1f5f9) !important;
  border-color: var(--game-border-strong, #cbd5e1) !important;
}

.inv-item.tier-1 {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: #10b981 !important;
}

.inv-item.tier-2 {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: #3b82f6 !important;
}

.inv-item.tier-3 {
  background: rgba(168, 85, 247, 0.1) !important;
  border-color: #a855f7 !important;
}

.inv-item.tier-4 {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: #f59e0b !important;
}

/* Autofill fixes */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-main) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--bg-surface) inset !important;
  transition: background-color 5000s ease-in-out 0s !important;
}

/* Typography styles */
html,
body,
button,
select,
input,
textarea,
optgroup,
option,
label,
.hw-app-layout,
.hw-font-sans,
.font-sans {
  font-family: var(--font-vietnamese) !important;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6,
.hw-font-display,
.font-display {
  font-family: var(--font-vietnamese) !important;
}

.korean-text,
.korean,
[lang="ko"],
.ko-text {
  font-family: var(--font-korean) !important;
}

[style*="Outfit"],
[style*="Inter"] {
  font-family: var(--font-vietnamese) !important;
}

h1,
h2,
h3,
h4 {
  font-weight: 700 !important;
  color: var(--text-main) !important;
}

p,
span,
div,
li,
td,
th {
  font-weight: 500;
}

.text-secondary,
.hw-text-slate-400,
.hw-text-slate-500,
.hw-text-slate-600 {
  font-size: 14px !important;
  color: var(--text-soft) !important;
}

/* Legacy Overrides for Tutien and main interfaces */
.container {
  background-color: var(--bg-main) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
}

.card-simulator {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 20px !important;
  color: var(--text-main) !important;
}

.korean-text {
  color: var(--text-main) !important;
}

.vietnamese-meaning,
.meaning-highlight {
  background: var(--bg-soft) !important;
  color: var(--text-main) !important;
  border-left: 4px solid var(--primary) !important;
}

.note-box {
  background: var(--bg-soft) !important;
  color: var(--text-soft) !important;
  border: 1px solid var(--border-soft) !important;
}

.tutien-hud {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-main) !important;
}

.char-action-bar {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
}

.action-btn {
  background: white !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-soft) !important;
}

.char-action-bar button {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  color: var(--text-main) !important;
}

/* Animations and Transitions optimizations */
*,
*::before,
*::after {
  transition-property: transform, opacity, background-color !important;
}

/* Automatic HUD stretching and light theme formatting on desktop and mobile */
html.anki-mode-off body #hw-app-layout #unified-hud-wrapper,
body #hw-app-layout #unified-hud-wrapper,
html.anki-mode-off #unified-hud-wrapper,
#unified-hud-wrapper {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 0 12px 0 !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-soft) !important;
  overflow: hidden !important;
}

html.anki-mode-off body #hw-app-layout #unified-hud-wrapper .tutien-hud,
body #hw-app-layout #unified-hud-wrapper .tutien-hud,
html.anki-mode-off #unified-hud-wrapper .tutien-hud,
#unified-hud-wrapper .tutien-hud {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  padding: 10px 14px !important;
  margin: 0 !important;
}

html.anki-mode-off body #hw-app-layout #unified-hud-wrapper .rpg-top-bar,
body #hw-app-layout #unified-hud-wrapper .rpg-top-bar,
html.anki-mode-off #unified-hud-wrapper .rpg-top-bar,
#unified-hud-wrapper .rpg-top-bar {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  background: var(--bg-soft) !important;
  border: none !important;
  border-bottom: 1px solid var(--border-soft) !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  padding: 6px 14px !important;
  margin: 0 !important;
}

html.anki-mode-off body #hw-app-layout #unified-hud-wrapper .hud-header-flex,
body #hw-app-layout #unified-hud-wrapper .hud-header-flex,
html.anki-mode-off #unified-hud-wrapper .hud-header-flex,
#unified-hud-wrapper .hud-header-flex {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Force dark text and clean fonts inside HUD */
#unified-hud-wrapper #user-rank-name,
#unified-hud-wrapper .cultivator-name,
#unified-hud-wrapper .rank-name-style {
  color: var(--text-main) !important;
  font-weight: 700 !important;
  text-shadow: none !important;
}

#unified-hud-wrapper .exp-text,
#unified-hud-wrapper #exp-num {
  color: var(--text-soft) !important;
  text-shadow: none !important;
  font-weight: 600 !important;
}

#unified-hud-wrapper #exp-num span {
  color: var(--text-main) !important;
}

#unified-hud-wrapper #exp-num .ladder-trigger-icon {
  color: var(--primary) !important;
  font-weight: bold !important;
}

#unified-hud-wrapper #exp-num span[style*="81c784"] {
  color: #15803d !important;
  /* Darker green for legibility on light background */
  font-weight: bold !important;
}

#unified-hud-wrapper .gold-stats-group,
#unified-hud-wrapper #hud-copper-num {
  color: #b45309 !important;
  /* Darker bronze/amber for copper coins */
  font-weight: bold !important;
}

#unified-hud-wrapper .top-left,
#unified-hud-wrapper .top-left-text,
#unified-hud-wrapper #top1-name,
#unified-hud-wrapper #top1-points {
  color: var(--text-soft) !important;
  text-shadow: none !important;
}

/* Light theme seamless top bar (no background/borders) and high-contrast ranking texts */
html.anki-mode-off #unified-hud-wrapper .rpg-top-bar {
  background: transparent !important;
  border: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

html.anki-mode-off #unified-hud-wrapper .rpg-top-bar .top-left {
  color: var(--text-soft) !important;
  text-shadow: none !important;
}

html.anki-mode-off #unified-hud-wrapper .rpg-top-bar .top-left svg {
  fill: #b45309 !important;
  filter: none !important;
}

html.anki-mode-off #unified-hud-wrapper .rpg-top-bar .top-left span[style*="cd7f32"] {
  color: #b45309 !important;
  /* Darker bronze/amber for top ranking names */
  font-weight: bold !important;
}

html.anki-mode-off #unified-hud-wrapper .rpg-top-bar .top-left span[style*="e57373"] {
  color: #dc2626 !important;
  /* Darker red for points */
  font-weight: bold !important;
}

/* Sidebar and Mobile navigation buttons light theme override */
aside .hw-tab-btn,
#hw-app-layout>nav .hw-tab-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-soft) !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
}

aside .hw-tab-btn:hover {
  background-color: var(--bg-soft) !important;
  color: var(--text-main) !important;
}

aside .hw-tab-btn.active {
  color: var(--primary) !important;
  background-color: var(--primary-soft) !important;
  border-left: 3px solid var(--primary) !important;
}

#hw-app-layout>nav .hw-tab-btn {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-soft) !important;
  color: var(--text-secondary) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
}

#hw-app-layout>nav .hw-tab-btn.active {
  background: var(--primary-soft) !important;
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
  color: var(--primary) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
}

/* Soft background styling for deck selection buttons to make them easy on the eyes */
#hw-decks-grid .hw-btn-primary,
#view-decks button[onclick*="selectStudyChapter"] {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
  box-shadow: none !important;
}

#hw-decks-grid .hw-btn-primary:hover,
#view-decks button[onclick*="selectStudyChapter"]:hover {
  background: var(--primary) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2) !important;
}

/* Hide the "Hiện đáp án" button since clicking the card directly flips it */
#hw-btn-show-answer {
  display: none !important;
}

/* Light Theme overrides for Marriage System Modal */
html.anki-mode-off #marriage-system-modal {
  background: rgba(15, 23, 42, 0.3) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

html.anki-mode-off #marriage-system-modal>div {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: 20px !important;
  box-shadow: var(--shadow-soft) !important;
  color: var(--text-main) !important;
  padding: 24px !important;
}

html.anki-mode-off #marriage-system-modal h3 {
  color: var(--primary) !important;
  font-weight: 750 !important;
  text-shadow: none !important;
}

html.anki-mode-off #marriage-system-modal p {
  color: var(--text-soft) !important;
}

html.anki-mode-off #marriage-system-modal b {
  color: var(--text-main) !important;
}

html.anki-mode-off #marriage-system-modal button {
  border-radius: 8px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
  padding: 8px 16px !important;
}

/* "Kho Chung" Button */
html.anki-mode-off #marriage-system-modal button[onclick*="filterInv"] {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
}

html.anki-mode-off #marriage-system-modal button[onclick*="filterInv"]:hover {
  background: var(--primary) !important;
  color: white !important;
}

/* "Ly Hôn" Button */
html.anki-mode-off #marriage-system-modal button[onclick*="divorce"] {
  background: rgba(239, 68, 68, 0.08) !important;
  color: var(--danger) !important;
  border: 1px solid rgba(239, 68, 68, 0.16) !important;
}

html.anki-mode-off #marriage-system-modal button[onclick*="divorce"]:hover {
  background: var(--danger) !important;
  color: white !important;
}

/* "Đóng" Button */
html.anki-mode-off #marriage-system-modal button[onclick*="remove"] {
  background: var(--bg-soft) !important;
  color: var(--text-soft) !important;
  border: 1px solid var(--border-soft) !important;
  margin-top: 15px !important;
}

html.anki-mode-off #marriage-system-modal button[onclick*="remove"]:hover {
  background: var(--bg-hover) !important;
  color: var(--text-main) !important;
}

/* Pet Thought Bubble Z-Index & Contrast styling */
#pet-thought-bubble-v1 {
  z-index: 2000 !important;
  /* Higher than HUD (1000) to prevent being covered */
}

/* Keep simulated exams free of non-test overlays, including delayed pet timers. */
body.hw-pet-thoughts-blocked #pet-thought-bubble-v1 {
  display: none !important;
}

/* Light Theme Styling for Pet Thought Bubble */
html.anki-mode-off #pet-thought-bubble-v1 {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-soft) !important;
}

/* Profile Modal Username Style Override */
#unified-modal h2 {
  color: #c8aa6e !important;
  /* High contrast gold/bronze color on dark card background */
  text-shadow: none !important;
  /* Remove the blurry glow effect */
}

/* Scrollbar removal utility for horizontal tab menus */
.scrollbar-none::-webkit-scrollbar {
  display: none !important;
}

.scrollbar-none {
  -ms-overflow-style: none !important;
  /* IE and Edge */
  scrollbar-width: none !important;
  /* Firefox */
}

/* Tab button layout utilities */
.v2-sub-btn {
  white-space: nowrap;
}

/* Custom buttons for Vòng 2 */
.v2-btn-primary {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  border: 1px solid #4f46e5 !important;
}

.v2-btn-primary:hover {
  background-color: #4338ca !important;
  border-color: #4338ca !important;
}

.v2-btn-danger {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border: 1px solid #ef4444 !important;
}

.v2-btn-danger:hover {
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
}

.v2-btn-secondary {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

.v2-btn-secondary:hover {
  background-color: #e2e8f0 !important;
}

/* For dark mode compatibility of inactive buttons */
html.anki-mode-on .v2-btn-secondary,
.dark .v2-btn-secondary {
  background-color: #1e293b !important;
  color: #cbd5e1 !important;
  border: 1px solid #334155 !important;
}

html.anki-mode-on .v2-btn-secondary:hover,
.dark .v2-btn-secondary:hover {
  background-color: #334155 !important;
}

/* Custom styles for self-introduction template buttons */
.v2-template-btn-active {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  border: 1px solid #4f46e5 !important;
}

.v2-template-btn-inactive {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.v2-template-btn-inactive:hover {
  background-color: #f1f5f9 !important;
}

html.anki-mode-on .v2-template-btn-inactive,
.dark .v2-template-btn-inactive {
  background-color: #0f172a !important;
  color: #94a3b8 !important;
  border: 1px solid #1e293b !important;
}

html.anki-mode-on .v2-template-btn-inactive:hover,
.dark .v2-template-btn-inactive:hover {
  background-color: #1e293b !important;
}

/* Interview category buttons */
.v2-cat-btn-active {
  background-color: #e0e7ff !important;
  color: #4338ca !important;
  border: 1px solid #818cf8 !important;
}

.v2-cat-btn-inactive {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.v2-cat-btn-inactive:hover {
  background-color: #f1f5f9 !important;
}

/* Dark mode overrides for interview category buttons */
html.anki-mode-on .v2-cat-btn-active,
.dark .v2-cat-btn-active {
  background-color: #1e1b4b !important;
  color: #e0e7ff !important;
  border: 1px solid #4f46e5 !important;
}

html.anki-mode-on .v2-cat-btn-inactive,
.dark .v2-cat-btn-inactive {
  background-color: #0f172a !important;
  color: #94a3b8 !important;
  border: 1px solid #1e293b !important;
}

html.anki-mode-on .v2-cat-btn-inactive:hover,
.dark .v2-cat-btn-inactive:hover {
  background-color: #1e293b !important;
}

/* Custom alerts for Vòng 2 */
.v2-alert-success {
  background-color: #d1fae5 !important;
  color: #065f46 !important;
  border: 1px solid #10b981 !important;
}

.v2-alert-success b,
.v2-alert-success span,
.v2-alert-success p {
  color: #065f46 !important;
}

.v2-alert-danger {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #ef4444 !important;
}

.v2-alert-danger b,
.v2-alert-danger span,
.v2-alert-danger p {
  color: #991b1b !important;
}

/* Dark mode overrides for custom alerts */
html.anki-mode-on .v2-alert-success,
.dark .v2-alert-success {
  background-color: #064e3b !important;
  color: #a7f3d0 !important;
  border: 1px solid #059669 !important;
}

html.anki-mode-on .v2-alert-success b,
html.anki-mode-on .v2-alert-success span,
html.anki-mode-on .v2-alert-success p,
.dark .v2-alert-success b,
.dark .v2-alert-success span,
.dark .v2-alert-success p {
  color: #a7f3d0 !important;
}

html.anki-mode-on .v2-alert-danger,
.dark .v2-alert-danger {
  background-color: #7f1d1d !important;
  vertical-align: middle;
  box-sizing: border-box;
}

/* Responsive badge text sizes */
@media (min-width: 1024px) {
  .vip-ui-badge {
    font-size: 10px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .vip-ui-badge {
    font-size: 9px;
  }
}

@media (max-width: 767px) {
  .vip-ui-badge {
    font-size: 8px;
  }
}

.vip-ui-badge .vip-ui-days {
  color: #78350f;
  /* Elegant dark amber for high readability */
  font-size: 8px;
  font-weight: 600;
  text-transform: none;
  margin-left: 2px;
}

.vip-ui-gradient {
  background: transparent !important;
  background-color: transparent !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: currentColor !important;
  color: #ffd700 !important;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5) !important;
}

.vip-ui-crown-svg {
  display: inline-block;
  vertical-align: middle;
  width: 13px !important;
  height: 13px !important;
  margin-left: 1px;
  filter: drop-shadow(0 0 2px rgba(230, 164, 0, 0.3));
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {

  .vip-ui-badge::before,
  .vip-ui-modal-crown,
  .vip-ui-button-upgrade {
    animation: none;
    transform: none;
    transition: none;
  }
}

/* Locked items wrapper & overlay */
.vip-ui-locked-wrapper {
  grid-column: 1 / -1;
  width: 100%;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px dashed rgba(230, 164, 0, 0.35);
  padding: 8px;
  background: rgba(20, 24, 38, 0.25);
}

.vip-ui-locked-items {
  filter: blur(4px) grayscale(40%);
  opacity: 0.45;
  pointer-events: none;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.vip-ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 22, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: block;
  z-index: 10;
  padding: 20px 10px;
  box-sizing: border-box;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

@supports not (backdrop-filter: blur(2px)) {
  .vip-ui-overlay {
    background: rgba(10, 12, 22, 0.8);
  }
}

.vip-ui-lock-content {
  background: #ffffff !important;
  border: 1px solid rgba(230, 164, 0, 0.25) !important;
  border-radius: 20px !important;
  padding: 24px !important;
  max-width: 380px !important;
  width: 100% !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 12px !important;
  text-align: center !important;
  position: sticky !important;
  top: 80px !important;
  margin: 0 auto !important;
}

.vip-ui-lock-crown-svg {
  width: 40px !important;
  height: 40px !important;
  filter: drop-shadow(0 2px 6px rgba(230, 164, 0, 0.2)) !important;
}

.vip-ui-lock-title {
  font-size: 14px !important;
  font-weight: bold !important;
  color: #1e293b !important;
  margin: 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.vip-ui-lock-benefits {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 11px !important;
  color: #475569 !important;
  text-align: left !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.vip-ui-lock-benefits li {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  color: #475569 !important;
}

.vip-ui-lock-buttons {
  display: flex !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 6px !important;
}

.vip-ui-button-upgrade {
  flex: 1.2 !important;
  padding: 8px 12px !important;
  background: linear-gradient(135deg, #ffb020 0%, #ff8c00 100%) !important;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: bold !important;
  font-size: 11px !important;
  cursor: pointer !important;
  transition: transform 0.2s ease !important;
  box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2) !important;
}

.vip-ui-button-upgrade:hover {
  transform: scale(1.03) !important;
}

.vip-ui-button-cancel {
  flex: 1 !important;
  padding: 8px 12px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  font-weight: bold !important;
  font-size: 11px !important;
  cursor: pointer !important;
  transition: background 0.2s ease !important;
}

.vip-ui-button-cancel:hover {
  background: #e2e8f0 !important;
}

/* VIP UI Dark Mode Overrides (Image 3) */
html.dark .vip-ui-overlay {
  background: rgba(11, 15, 25, 0.85) !important;
}

html.dark .vip-ui-lock-content {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
  color: #f8fafc !important;
}

html.dark .vip-ui-lock-title {
  color: #f8fafc !important;
}

html.dark .vip-ui-lock-benefits,
html.dark .vip-ui-lock-benefits li {
  color: #cbd5e1 !important;
}

html.dark .vip-ui-button-cancel {
  background: #1e293b !important;
  background-color: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

html.dark .vip-ui-button-cancel:hover {
  background: #334155 !important;
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* Active transitions when unlocking */
.vip-ui-locked-wrapper.vip-ui-unlocking .vip-ui-overlay {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.vip-ui-locked-wrapper.vip-ui-unlocking .vip-ui-locked-items {
  filter: none;
  opacity: 1;
}

/* MODAL DIALOG STYLE (CLEAN LIGHT MODERN & COMPACT) */
.vip-ui-modal-overlay,
.hw-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.48) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  z-index: 2147483647 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  animation: hwModalFadeIn 0.22s ease-out forwards !important;
}

@supports not (backdrop-filter: blur(10px)) {

  .vip-ui-modal-overlay,
  .hw-modal-overlay {
    background: rgba(15, 23, 42, 0.85) !important;
  }
}

.vip-ui-modal-content,
.hw-modal-card {
  background: #ffffff !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 20px !important;
  padding: 22px 18px 18px !important;
  max-width: 360px !important;
  width: 100% !important;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.04) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 13px !important;
  text-align: center !important;
  position: relative !important;
  font-family: var(--font-vietnamese, 'Segoe UI', system-ui, -apple-system, sans-serif) !important;
  box-sizing: border-box !important;
  transform: scale(0.95);
  animation: hwModalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes hwModalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes hwModalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.hw-modal-close-btn {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #64748b !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  z-index: 10 !important;
}

.hw-modal-close-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  transform: scale(1.06) !important;
}

.hw-success-icon-badge {
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
  border: 1.5px solid #a7f3d0 !important;
  box-shadow: 0 8px 18px -4px rgba(16, 185, 129, 0.25) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 2px !important;
}

.hw-success-icon-badge .hw-check-main {
  font-size: 24px !important;
  color: #10b981 !important;
}

.hw-upgrade-icon-badge {
  width: 54px !important;
  height: 54px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 8px 18px -4px rgba(245, 158, 11, 0.25) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 2px !important;
}

.hw-upgrade-icon-badge .hw-crown-main {
  font-size: 24px !important;
  color: #d97706 !important;
}

.vip-ui-modal-crown-svg {
  width: 48px !important;
  height: 48px !important;
  filter: drop-shadow(0 4px 10px rgba(230, 164, 0, 0.25)) !important;
}

.vip-ui-modal-title,
.hw-modal-title {
  font-size: 17px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin: 0 !important;
  letter-spacing: -0.01em !important;
  line-height: 1.3 !important;
}

.vip-ui-modal-desc,
.hw-modal-desc {
  font-size: 13px !important;
  color: #475569 !important;
  margin: 0 !important;
  line-height: 1.5 !important;
}

.hw-vip-badge-text {
  color: #b45309 !important;
  font-weight: 800 !important;
  background: #fef3c7 !important;
  padding: 1px 6px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  display: inline-block !important;
}

.hw-modal-note-box {
  background: #f8fafc !important;
  border: 1px solid #f1f5f9 !important;
  border-radius: 12px !important;
  padding: 9px 12px !important;
  font-size: 11.5px !important;
  color: #64748b !important;
  line-height: 1.45 !important;
  text-align: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.vip-ui-modal-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 12px 14px !important;
  width: 100% !important;
  text-align: left !important;
  box-sizing: border-box !important;
}

.vip-ui-modal-box-title {
  font-size: 11.5px !important;
  font-weight: 800 !important;
  color: #b45309 !important;
  margin-bottom: 7px !important;
  margin-top: 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.vip-ui-modal-list {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

.vip-ui-modal-list li {
  font-size: 12px !important;
  color: #334155 !important;
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  line-height: 1.35 !important;
}

.vip-ui-modal-footer {
  display: flex !important;
  width: 100% !important;
  gap: 10px !important;
  box-sizing: border-box !important;
  margin-top: 2px !important;
}

.vip-ui-modal-btn-upgrade,
.hw-modal-btn-gold {
  flex: 1.5 !important;
  padding: 10.5px 14px !important;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
  border-radius: 12px !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28) !important;
  transition: transform 0.2s, box-shadow 0.2s !important;
}

.vip-ui-modal-btn-upgrade:hover,
.hw-modal-btn-gold:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.38) !important;
}

.hw-modal-btn-primary {
  width: 100% !important;
  padding: 10.5px 16px !important;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.28) !important;
  transition: all 0.2s ease !important;
}

.hw-modal-btn-primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.38) !important;
}

.vip-ui-modal-btn-cancel,
.hw-modal-btn-secondary {
  flex: 1 !important;
  padding: 10.5px 12px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}

.vip-ui-modal-btn-cancel:hover,
.hw-modal-btn-secondary:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

.vip-ui-fade-out-badge {
  opacity: 0;
  transform: scale(0.9);
}

#user-rank-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
}

/* Fix select option color white on white background */
select option {
  color: #111827 !important;
  background-color: #ffffff !important;
}

/* ==========================================
   ANKI LOL SMART VOCABULARY LEARNING STYLES
   ========================================== */

/* Mode Switcher */
#hw-mode-btn-smart,
#hw-mode-btn-anki {
  background-color: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
}

#hw-mode-btn-smart.active,
#hw-mode-btn-anki.active {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25) !important;
}

/* 4-Step Progress Indicator */
#hw-smart-progress-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hw-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.hw-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  background-color: var(--bg-soft);
  color: var(--text-muted);
  border: 2px solid var(--border-strong);
  transition: all 0.3s ease;
}

.hw-step-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.hw-step-item.active .hw-step-number {
  background-color: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4) !important;
  transform: scale(1.1);
}

.hw-step-item.active .hw-step-label {
  color: var(--primary) !important;
}

.hw-step-item.completed .hw-step-number {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

.hw-step-item.completed .hw-step-label {
  color: #10b981 !important;
}

.hw-step-line {
  flex: 1;
  height: 3px;
  background-color: var(--border-soft);
  margin: 0 12px;
  position: relative;
  top: -12px;
  transition: all 0.3s ease;
}

.hw-step-line.active {
  background-color: var(--primary) !important;
}

.hw-step-line.completed {
  background-color: #10b981 !important;
}

/* AI Smart Lookup Overlays */
.hw-btn-smart-tab {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-soft) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  padding: 8px 4px !important;
  border-radius: 12px !important;
  transition: all 0.25s ease !important;
  cursor: pointer !important;
}

.hw-btn-smart-tab:hover {
  background: rgba(99, 102, 241, 0.1) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.hw-btn-smart-tab.active {
  background: var(--primary-soft) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
  box-shadow: 0 0 10px var(--primary-soft) !important;
}

.hw-smart-overlay-box {
  background: var(--bg-soft) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 16px !important;
  padding: 14px !important;
  color: var(--text-main) !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
  animation: slideDownFade 0.3s ease;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
}

.hw-language-analysis {
  display: grid;
  gap: 7px;
}

.hw-language-analysis>strong {
  color: var(--text-main);
  font-size: 12px;
}

.hw-smart-result-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  background: rgba(99, 102, 241, 0.06);
  border-left: 2px solid var(--primary);
  border-radius: 7px;
  color: var(--text-main);
  line-height: 1.45;
}

.hw-smart-result-item small {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 9px;
  white-space: nowrap;
}

.hw-smart-result-item.hw-smart-empty-state {
  display: block;
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-soft);
  font-size: 11px;
}

.hw-btn-smart-audio {
  background: transparent !important;
  border: none !important;
  color: var(--primary) !important;
  font-size: 11px !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  flex: 0 0 auto;
}

.hw-btn-smart-audio:hover {
  color: #6366f1 !important;
  background: rgba(99, 102, 241, 0.15) !important;
  opacity: 1;
  transform: scale(1.1);
}

.hw-btn-smart-audio:active {
  transform: scale(0.95);
}

.hw-btn-v2-audio {
  background: rgba(99, 102, 241, 0.05) !important;
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
  color: var(--primary) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  padding: 3px 8px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.25s ease !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hw-btn-v2-audio i {
  font-size: 10px !important;
}

.hw-btn-v2-audio:hover {
  background: rgba(99, 102, 241, 0.15) !important;
  border-color: var(--primary) !important;
  color: #6366f1 !important;
  transform: translateY(-0.5px);
}

.hw-btn-v2-audio:active {
  transform: translateY(0.5px);
}

.hw-smart-source {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .hw-smart-overlay-box {
    max-height: 210px;
    padding: 10px !important;
    font-size: 12px !important;
  }

  .hw-smart-result-item {
    padding: 7px;
    gap: 6px;
  }
}

/* HUD IDENTITY STABILITY: companion rarity + VIP status */
#user-rank-name {
  color: var(--hw-hud-player-name-color, var(--hw-hud-rank-color, #f7d68a)) !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

#user-rank-name .hud-player-name-text {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}

#user-rank-name .vip-ui-badge,
#user-rank-name .vip-badge-custom,
#user-rank-name .quiz-lang-badge {
  flex: 0 0 auto !important;
}

.avatar-cultivation .champ-name-badge {
  display: none !important;
}

/* EPS review and attempt history. These blocks are only shown after submission. */
.eps-review-explanation {
  display: flex;
  max-height: min(380px, 42vh);
  flex-direction: column;
  overflow: hidden;
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid #c5d9e5;
  border-radius: 5px;
  color: #304c5c;
  background: #f7fbfd;
  text-align: left;
  font-size: 12px;
  line-height: 1.65;
}

.eps-review-explanation.is-correct {
  border-color: #8bc8a6;
  background: #effaf3;
}

.eps-review-explanation.is-wrong {
  border-color: #e5b0a7;
  background: #fff6f4;
}

.eps-review-explanation>header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(87, 122, 141, .22);
}

.eps-review-explanation>header strong {
  color: #187a4b;
}

.eps-review-explanation.is-wrong>header strong {
  color: #b34535;
}

.eps-review-explanation>header span {
  color: #5f7480;
  font-size: 11px;
}

.eps-review-explanation>header b {
  color: #254d65;
}

.eps-review-answer-text {
  flex: 0 0 auto;
  margin: 9px 0 4px;
  color: #31566b;
}

.eps-review-copy {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin-top: 7px;
  padding: 3px 9px 3px 0;
  white-space: normal;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.eps-review-copy::-webkit-scrollbar {
  width: 7px;
}

.eps-review-copy::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: #9ab7c7;
}

.eps-review-copy::-webkit-scrollbar-track {
  background: rgba(213, 229, 237, .5);
}

.eps-review-copy code {
  padding: 1px 4px;
  border-radius: 3px;
  color: #234d70;
  background: #e6f0f7;
  font-family: ui-monospace, monospace;
}

.eps-review-back {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-top: 10px;
  padding: 6px 9px;
  border: 1px solid #a9c7d7;
  border-radius: 3px;
  color: #27638b;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

/* EPS Review Sound Bar (Audio review bar with strict anti-download) */
.eps-review-soundbar {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #bce1f3;
  border-radius: 8px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e6f4fe 100%);
  box-shadow: 0 3px 10px rgba(12, 74, 110, 0.06);
  user-select: none;
  -webkit-user-select: none;
}

.eps-sb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
}

.eps-sb-header i {
  margin-right: 5px;
}

.eps-sb-badge-nodl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.12);
  color: #0284c7;
  font-size: 10px;
  font-weight: 600;
}

.eps-sb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.eps-sb-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.eps-sb-play-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
}

.eps-sb-play-btn:active {
  transform: scale(0.96);
}

.eps-sb-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 9px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  background: #fff;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.eps-sb-step-btn:hover {
  background: #e0f2fe;
}

.eps-sb-timeline {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 140px;
}

.eps-sb-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
}

.eps-sb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #0284c7;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease;
}

.eps-sb-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.eps-sb-time {
  color: #475569;
  font-size: 10px;
  font-family: ui-monospace, monospace;
  font-weight: 600;
  text-align: right;
}

.eps-sb-speed-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  color: #0369a1;
  font-size: 11px;
}

.eps-sb-speed-select {
  padding: 4px 6px;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  background: #fff;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.eps-review-soundbar-empty {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed #7dd3fc;
  border-radius: 6px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 11px;
}

/* EPS Review Sound Bar (Compact Ultra-Sleek Single Line) */
.eps-review-soundbar.eps-sb-compact {
  margin-top: 10px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  background: #f0f9ff;
  box-shadow: 0 1px 4px rgba(2, 132, 199, 0.05);
  user-select: none;
  -webkit-user-select: none;
}

.eps-sb-compact .eps-sb-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.eps-sb-compact .eps-sb-play-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #0284c7;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
  transition: transform 0.1s ease, background 0.15s ease;
}

.eps-sb-compact .eps-sb-play-btn:hover {
  transform: scale(1.08);
  background: #0369a1;
}

.eps-sb-compact .eps-sb-step-btn {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0369a1;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.eps-sb-compact .eps-sb-step-btn:hover {
  background: #e0f2fe;
}

.eps-sb-compact .eps-sb-title {
  flex: 0 0 auto;
  color: #0369a1;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.eps-sb-compact .eps-sb-timeline {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-width: 60px;
}

.eps-sb-compact .eps-sb-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #cbd5e1;
  outline: none;
  cursor: pointer;
}

.eps-sb-compact .eps-sb-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #0284c7;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.eps-sb-compact .eps-sb-time {
  flex: 0 0 auto;
  color: #475569;
  font-size: 10px;
  font-family: ui-monospace, monospace;
  font-weight: 600;
  white-space: nowrap;
}

.eps-sb-compact .eps-sb-speed-select {
  flex: 0 0 auto;
  padding: 2px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0369a1;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}

.eps-sb-compact .eps-sb-lock-ic {
  flex: 0 0 auto;
  color: #0284c7;
  font-size: 10px;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .eps-sb-compact .eps-sb-controls {
    flex-wrap: wrap;
    gap: 4px;
  }

  .eps-sb-compact .eps-sb-timeline {
    order: 1;
    flex: 1 1 100%;
    margin-top: 4px;
  }
}

.eps-history-panel {
  margin-top: 27px;
  padding-top: 20px;
  border-top: 1px solid #d8e2e8;
  text-align: left;
}

.eps-history-panel>header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.eps-history-panel h2 {
  margin: 0 0 3px;
  color: #2b4859;
  font-size: 17px;
}

.eps-history-panel>header p {
  margin: 0;
  color: #71828d;
  font-size: 10px;
}

.eps-history-panel>header>span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 12px;
  color: #28749b;
  background: #e7f4fb;
  font-size: 10px;
  font-weight: 800;
}

.eps-history-entry {
  display: grid;
  grid-template-columns: minmax(105px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  padding: 10px;
  border: 1px solid #d7e2e8;
  border-radius: 4px;
  background: #fbfdfe;
}

.eps-history-entry.is-latest {
  border-color: #9acbe4;
  background: #f0f9fd;
}

.eps-history-entry strong,
.eps-history-entry small,
.eps-history-score b,
.eps-history-score span {
  display: block;
}

.eps-history-entry strong {
  color: #355365;
  font-size: 11px;
}

.eps-history-entry small {
  margin-top: 3px;
  color: #80909a;
  font-size: 9px;
}

.eps-history-score {
  text-align: right;
}

.eps-history-score b {
  color: #2782ae;
  font-size: 15px;
}

.eps-history-score span {
  margin-top: 2px;
  color: #788992;
  font-size: 9px;
}

.eps-history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.eps-history-actions button,
.eps-history-compare header button {
  padding: 6px 8px;
  border: 1px solid #b7d0dd;
  border-radius: 3px;
  color: #286b8f;
  background: #fff;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
}

.eps-history-actions button:hover,
.eps-history-compare header button:hover,
.eps-review-back:hover {
  background: #edf7fb;
}

.eps-history-none {
  margin: 7px 0 0;
  color: #82929c;
  font-size: 11px;
}

.eps-history-compare {
  margin-top: 15px;
  padding: 14px;
  border: 1px solid #c4d9e4;
  border-radius: 5px;
  background: #f9fcfe;
  text-align: left;
}

.eps-history-compare>header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.eps-history-compare h2 {
  margin: 0 0 3px;
  color: #2b4859;
  font-size: 15px;
}

.eps-history-compare p {
  margin: 0;
  color: #738590;
  font-size: 10px;
}

.eps-history-table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

.eps-history-compare table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.eps-history-compare th,
.eps-history-compare td {
  padding: 6px 7px;
  border: 1px solid #d8e4eb;
  text-align: center;
  white-space: nowrap;
}

.eps-history-compare th {
  color: #506875;
  background: #edf5f8;
  font-weight: 800;
}

.eps-history-compare td:first-child {
  color: #375566;
  font-weight: 800;
}

.eps-history-right {
  color: #16844d;
  font-weight: 800;
}

.eps-history-wrong {
  color: #b54a3b;
  font-weight: 800;
}

.eps-history-empty {
  color: #9aa9b0;
}

@media (max-width: 640px) {
  .eps-history-entry {
    grid-template-columns: 1fr auto;
  }

  .eps-history-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .eps-history-actions button {
    flex: 1;
    min-height: 32px;
  }

  .eps-review-explanation {
    max-height: 50vh;
    padding: 11px;
    font-size: 11px;
  }

  .eps-review-explanation>header {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

/* EPS CBT answer/navigation rules */
.eps-answer span:empty {
  display: none;
}

.eps-nav-number {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1 !important;
}

.eps-nav-number.is-answered {
  color: #111;
  background: #fff;
  font-weight: 400 !important;
}

.eps-nav-number.is-current {
  color: #0b6da3;
  background: #f2fbff;
  box-shadow: inset 0 0 0 1px #389fd7;
}

.eps-nav-number:hover:not(:disabled) {
  background: #f2fbff;
}

.eps-nav-number:disabled {
  cursor: default;
}

.eps-nav-dot {
  position: absolute;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #111;
}

@media (max-width: 640px) {
  .eps-nav-dot {
    right: 9px;
    width: 7px;
    height: 7px;
  }
}

/* ========================================================================== */
/* EPS-TOPIK CBT — independent real-exam simulator                            */
/* ========================================================================== */
:is(#view-eps-exam, .eps-cbt-scope) {
  position: relative;
  z-index: auto;
  min-height: 100%;
  overflow: visible;
  padding: 0 !important;
  color: #111827;
  background: #f5f5f5;
  font-family: Arial, "Noto Sans KR", sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope).eps-exam-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  min-height: 0;
  overflow: hidden;
}

:is(#view-eps-exam, .eps-cbt-scope) *,
:is(#view-eps-exam, .eps-cbt-scope) *::before,
:is(#view-eps-exam, .eps-cbt-scope) *::after {
  box-sizing: border-box;
}

:is(#eps-exam-app, .eps-exam-app) {
  width: 100%;
  min-height: 100%;
}

:is(#view-eps-exam, .eps-cbt-scope).eps-exam-fullscreen :is(#eps-exam-app, .eps-exam-app) {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

:is(#view-eps-exam, .eps-cbt-scope) button,
:is(#view-eps-exam, .eps-cbt-scope) input,
:is(#view-eps-exam, .eps-cbt-scope) select {
  font: inherit;
}

:is(#view-eps-exam, .eps-cbt-scope) button {
  border: 0;
  cursor: pointer;
}

:is(#view-eps-exam, .eps-cbt-scope) button:focus-visible,
:is(#view-eps-exam, .eps-cbt-scope) input:focus-visible {
  outline: 3px solid rgba(35, 132, 205, .34);
  outline-offset: 2px;
}

:is(#view-eps-exam, .eps-cbt-scope) button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.eps-cbt-loading,
.eps-cbt-error {
  display: grid;
  min-height: 100%;
  place-content: center;
  justify-items: center;
  gap: 13px;
  color: #253b57;
  background: #f4f6f8;
  text-align: center;
}

.eps-cbt-loading i {
  color: #329bd5;
  font-size: 30px;
}

.eps-cbt-loading strong {
  font-size: 15px;
}

.eps-cbt-error i {
  color: #d35c5c;
  font-size: 32px;
}

.eps-cbt-error h2 {
  margin: 0;
  font: 700 25px Georgia, serif;
}

.eps-cbt-error p {
  max-width: 520px;
  margin: 0;
  color: #64748b;
}

.eps-cbt-error button {
  padding: 10px 18px;
  border-radius: 4px;
  color: white;
  background: #329ed8;
  font-weight: 700;
}

.eps-library {
  min-height: 100%;
  padding: clamp(16px, 3vw, 40px);
  container-type: inline-size;
  background: linear-gradient(160deg, #eef4f8, #fff 42%, #edf5fa);
}

.eps-library-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, .7fr) minmax(280px, 1.55fr) auto;
  align-items: center;
  gap: clamp(16px, 2.5vw, 32px);
  overflow: hidden;
  max-width: 1360px;
  min-height: 128px;
  margin: 0 auto 22px;
  padding: 22px clamp(22px, 3vw, 38px);
  border: 1px solid #1e5e7e;
  border-radius: 15px;
  color: #f8fbff;
  background: linear-gradient(118deg, #102d46 0%, #164d6d 54%, #1695cf 125%);
  box-shadow: 0 16px 36px rgba(18, 63, 90, .18);
}

.eps-library-hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -80px;
  top: -170px;
  border: 42px solid rgba(198, 239, 255, .12);
  border-radius: 50%;
}

.eps-library-hero::after {
  content: "";
  position: absolute;
  width: 170px;
  height: 170px;
  left: 31%;
  bottom: -142px;
  border: 28px solid rgba(255, 255, 255, .055);
  border-radius: 50%;
}

.eps-klt-logo {
  flex: 0 0 auto;
  color: #202327;
  font: 800 27px/1 Arial, sans-serif;
  letter-spacing: -.035em;
  white-space: nowrap;
}

.eps-klt-logo span {
  margin-left: 4px;
  color: #90c215;
  font-weight: 400;
}

.eps-library-hero .eps-klt-logo {
  color: #f8fbff !important;
  font-size: clamp(20px, 2vw, 25px);
}

.eps-library-hero .eps-klt-logo span {
  color: #b7eb63 !important;
}

.eps-library-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.eps-library-brand-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(204, 239, 255, .36);
  border-radius: 9px;
  color: #d9f4ff;
  background: rgba(255, 255, 255, .11);
  font-size: 13px;
}

.eps-library-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.eps-library-hero-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #a9e4fb !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
}

.eps-library-hero-copy small i {
  font-size: 6px;
  color: #9edf5b;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library-hero .eps-library-hero-copy h1 {
  margin: 6px 0 3px;
  color: #f8fbff !important;
  font: 750 clamp(25px, 3.1vw, 35px)/1.12 Arial, sans-serif !important;
  letter-spacing: -.035em;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library-hero .eps-library-hero-copy p {
  max-width: 570px;
  margin: 0;
  color: #d6edf8 !important;
  font-size: 12px;
  line-height: 1.5;
}

.eps-library-count {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  min-width: 78px;
  padding: 8px 10px;
  border: 1px solid rgba(214, 243, 255, .38);
  border-radius: 10px;
  color: #eaf8ff;
  background: rgba(7, 38, 61, .2);
  line-height: 1.05;
  white-space: nowrap;
}

.eps-library-count b {
  color: #fff;
  font-size: 21px;
}

.eps-library-count span {
  margin-top: 3px;
  color: #c0e9fb;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.eps-exit-app {
  position: absolute;
  z-index: 2;
  top: 11px;
  right: 11px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, .2);
}

.eps-library-group {
  max-width: 1360px;
  margin: 0 auto 27px;
}

.eps-library-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 12px;
}

.eps-library-heading small {
  color: #628299;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
}

.eps-library-heading h2 {
  margin: 3px 0 0;
  color: #1e3445;
  font: 700 22px Georgia, serif;
}

.eps-library-heading>span {
  color: #527086;
  font-size: 11px;
  font-weight: 700;
}

.eps-library-heading>span i {
  margin-right: 5px;
  color: #2695cf;
}

.eps-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 13px;
}

.eps-library-card {
  position: relative;
  padding: 17px;
  border: 1px solid #c8d5de;
  border-top: 4px solid #329bd5;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 5px 15px rgba(31, 59, 78, .07);
}

.exam-vip-crown {
  position: absolute;
  top: -4px;
  right: -1px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px 4px 8px;
  border-radius: 0 7px 0 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(217, 119, 6, .35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .15);
}

.exam-vip-crown i {
  font-size: 11px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2));
}

.eps-library-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.eps-library-card-top>span {
  padding: 4px 7px;
  border-radius: 3px;
  color: #0f5680;
  background: #dff3ff;
  font-size: 10px;
  font-weight: 800;
}

.eps-library-card-top em {
  color: #33835d;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.eps-library-card h2 {
  margin: 13px 0 3px;
  color: #10283d;
  font-size: 19px;
}

.eps-library-card>p {
  margin: 0;
  color: #516a7c;
  font-size: 10px;
}

.eps-library-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 13px 0 10px;
  border: 1px solid #d9e2e8;
  border-radius: 4px;
}

.eps-library-stats span {
  padding: 9px 3px;
  border-right: 1px solid #d9e2e8;
  text-align: center;
}

.eps-library-stats span:last-child {
  border: 0;
}

.eps-library-stats b {
  display: block;
  color: #244a65;
  font-size: 17px;
}

.eps-library-stats small {
  display: block;
  margin-top: 1px;
  color: #8a98a2;
  font-size: 7px;
  font-weight: 800;
}

.eps-audio-type {
  min-height: 30px;
  margin-bottom: 10px;
  padding: 7px 8px;
  border-radius: 3px;
  color: #516978;
  background: #f0f5f8;
  font-size: 9px;
  font-weight: 700;
}

.eps-audio-type i {
  width: 16px;
  color: #2e98d2;
}

.eps-library-last-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 8px;
  min-height: 38px;
  margin: -2px 0 10px;
  padding: 6px 8px;
  border: 1px solid #dbe5ea;
  border-radius: 4px;
  font-size: 9px;
  line-height: 1.2;
}

.eps-library-last-result>span {
  min-width: 0;
  color: #657783;
  font-weight: 800;
}

.eps-library-last-result>span i {
  margin-right: 4px;
}

.eps-library-last-result>b {
  color: #1f6b91;
  font-size: 10px;
  white-space: nowrap;
}

.eps-library-last-result>small {
  grid-column: 1 / -1;
  color: #80929d;
  font-size: 8px;
  font-weight: 700;
}

.eps-library-last-result.is-new {
  background: #fbfcfd;
}

.eps-library-last-result.is-new>span {
  color: #71818b;
}

.eps-library-last-result.is-complete {
  border-color: #b9ddca;
  background: #f2fbf6;
}

.eps-library-last-result.is-complete>span {
  color: #16814f;
}

.eps-library-last-result.is-complete>b {
  color: #16764a;
}

.eps-library-card>button {
  display: flex;
  width: 100%;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(#58b4e6, #3198d2);
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px rgba(0, 0, 0, .18);
}

.eps-cbt-page {
  min-height: 100%;
  background: #f7f7f7;
}

.eps-cbt-header {
  position: relative;
  display: grid;
  grid-template-columns: 280px 1fr 400px;
  align-items: center;
  min-height: 76px;
  padding: 0 34px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.eps-cbt-header h1 {
  margin: 0;
  color: #111;
  font: 400 23px Georgia, serif;
  text-align: center;
}

.eps-candidate-strip {
  display: flex;
  justify-self: end;
  min-width: 398px;
  min-height: 33px;
  align-items: center;
  gap: 15px;
  padding: 5px 8px;
  background: linear-gradient(100deg, #dce6f3, #f5f7fa, #d8e4f2);
  font: 12px Georgia, serif;
}

.eps-candidate-strip span {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.eps-candidate-strip b {
  padding: 6px 13px;
  border-radius: 3px;
  color: #fff;
  background: #6e83a0;
  font: 700 10px Arial, sans-serif;
}

.eps-header-close {
  position: absolute;
  z-index: 3;
  right: 5px;
  top: 5px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #64748b;
  background: transparent;
}

.eps-version-bar {
  display: flex;
  min-height: 32px;
  align-items: center;
  padding: 0 60px;
  background: #e8edf7;
  font: 10px Georgia, serif;
}

.eps-version-bar small {
  color: #27364b;
}

.eps-registration-backdrop {
  display: grid;
  min-height: calc(100vh - 76px);
  place-items: start center;
  padding: 62px 18px;
  background: rgba(37, 42, 45, .55);
}

.eps-registration-modal {
  overflow: hidden;
  width: min(800px, 100%);
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .28);
}

.eps-registration-modal>header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
  font-size: 13px;
}

.eps-registration-modal>header button {
  width: 32px;
  height: 32px;
  color: #777;
  background: transparent;
}

.eps-registration-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 54px;
  align-items: center;
  min-height: 360px;
  padding: 35px 25px;
}

.eps-avatar-placeholder,
.eps-applicant-photo {
  display: grid;
  place-items: center;
  color: #8c8c8c;
  background: #f2f2f2;
}

.eps-avatar-placeholder {
  width: 235px;
  height: 245px;
  justify-self: center;
  font-size: 170px;
}

.eps-avatar-placeholder i {
  transform: translateY(8px);
}

.eps-registration-fields {
  display: grid;
  gap: 13px;
}

.eps-registration-fields label span {
  display: block;
  margin-bottom: 5px;
  color: #4b5563;
  font-size: 10px;
}

.eps-registration-fields input {
  width: 100%;
  height: 33px;
  padding: 0 10px;
  border: 1px solid #dde2e8;
  border-radius: 3px;
  color: #1f2937;
  background: #fff;
  font-size: 11px;
}

.eps-registration-fields input:focus {
  border-color: #3154df;
}

.eps-registration-modal>footer {
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: flex-end;
  padding: 0 25px;
  border-top: 1px solid #eef0f2;
}

.eps-registration-modal>footer button {
  min-height: 31px;
  padding: 0 14px;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(90deg, #6156dd, #3499ef);
  font-size: 10px;
  font-weight: 700;
}

.eps-preflight {
  width: min(1298px, calc(100% - 32px));
  margin: 34px auto;
  text-align: center;
}

.eps-preflight>h2 {
  margin: 0;
  padding: 13px 18px;
  border-bottom: 1px solid #fff;
  color: #fff;
  background: linear-gradient(#65b9e7, #349bd3);
  font: 400 30px Georgia, serif;
}

.eps-preflight-audio {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: #fff;
  background: #233348;
  font: 15px Georgia, serif;
}

.eps-preflight-audio i {
  font-size: 36px;
}

.eps-applicant-card {
  display: grid;
  grid-template-columns: 34% 210px 1fr;
  align-items: center;
  min-height: 305px;
  margin-top: 11px;
  padding: 29px 30px;
  border: 1px solid #d9dfe4;
  background: #fff;
  box-shadow: 0 8px 19px rgba(0, 0, 0, .05);
}

.eps-seat-number {
  align-self: stretch;
  display: grid;
  place-content: start center;
  padding-top: 5px;
  border-right: 1px solid #e5e7eb;
  color: #4c5260;
  font: 17px Georgia, serif;
}

.eps-seat-number b {
  display: block;
  margin-top: 16px;
  color: inherit !important;
  font-size: 74px;
  font-weight: 400;
}

.eps-applicant-photo {
  width: 155px;
  height: 203px;
  justify-self: center;
  border: 1px solid #dfe3e7;
  font-size: 115px;
}

.eps-applicant-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.eps-applicant-card dl>div {
  display: grid;
  grid-template-columns: 130px 1fr;
  min-height: 39px;
  align-items: center;
  border: 1px solid #e1e5e9;
  border-radius: 21px;
  overflow: hidden;
}

.eps-applicant-card dt {
  align-self: stretch;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(#6bc1eb, #319cd7);
  font-size: 11px;
  font-weight: 700;
}

.eps-applicant-card dd {
  overflow: hidden;
  margin: 0;
  padding: 0 15px;
  color: #334155;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eps-confirm-button {
  min-width: 96px;
  min-height: 54px;
  margin: 18px auto 0;
  border-radius: 2px;
  color: #fff;
  background: linear-gradient(#63b8e6, #329bd5);
  font: 700 15px Georgia, serif !important;
}

.eps-notice-list {
  min-height: 220px;
  padding: 26px 34px;
  border: 1px solid #d9dfe4;
  background: #fff;
  text-align: left;
}

.eps-notice-list p {
  display: flex;
  gap: 6px;
  margin: 7px 0;
  color: #28313d;
  font: 12px/1.35 Georgia, serif;
}

.eps-notice-list i {
  color: #38a0d8;
  font-size: 14px;
}

.eps-notice-list .eps-notice-1,
.eps-notice-list .eps-notice-4,
.eps-notice-list .eps-notice-5 {
  font-weight: 700;
}

.eps-soundcheck {
  width: min(1092px, calc(100% - 36px));
  min-height: 550px;
  margin: 112px auto 40px;
  padding: 30px;
  border: 1px solid #d8d8d8;
  background: #fff;
  text-align: center;
}

.eps-soundcheck h2 {
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #777;
  color: #4d5361;
  font: 700 28px Georgia, serif;
}

.eps-soundcheck>i {
  margin: 75px 0 55px;
  color: #1680b8;
  font-size: 120px;
}

.eps-soundcheck>div:not(.eps-sound-actions) {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 9px 16px;
  border: 1px solid #ddd;
  color: #4d5361;
  font: 19px/1.45 Georgia, serif;
}

.eps-soundcheck p {
  margin: 0;
}

.eps-sound-state {
  margin: 14px 0 0 !important;
  color: #50758a;
  font: 12px Arial, sans-serif !important;
}

.eps-sound-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 20px;
}

.eps-sound-actions button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.eps-sound-test {
  background: #64748b;
}

.eps-start-real {
  background: linear-gradient(#5bb5e5, #3099d3);
}

.eps-runtime-page {
  height: 100%;
  min-height: 720px;
  overflow: hidden;
}

.eps-runtime-bar {
  justify-content: space-between;
  padding-left: 75px;
  padding-right: 16%;
}

.eps-runtime-bar>span {
  min-width: 148px;
  align-self: stretch;
  display: grid;
  place-items: center;
  border-left: 1px solid #fff;
  border-right: 1px solid #fff;
  background: #fff;
  font: 18px Georgia, serif;
}

.eps-runtime-bar i {
  color: #3157e9;
}

.eps-runtime-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  height: calc(100vh - 108px);
  min-height: 612px;
  background: #acacac;
}

.eps-question-area {
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(35px, 7vh, 112px) 24px 40px;
}

.eps-paper {
  width: min(1092px, 100%);
  min-height: 500px;
  padding: 30px 34px 25px;
  border: 1px solid #dedede;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}

.eps-paper-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 9px;
  border-bottom: 1px solid #a7a7a7;
  color: #4d5361;
  font: 700 25px Georgia, serif;
}

.eps-paper-heading b {
  font-size: 15px;
  font-weight: 400;
}

.eps-question-text {
  margin: 18px 0 10px;
  color: #3f4652;
  font: 20px/1.5 Georgia, serif;
}

.eps-question-image {
  display: block;
  max-width: 100%;
  max-height: 355px;
  margin: 18px auto;
  cursor: zoom-in;
  object-fit: contain;
}

.eps-question-image.is-missing {
  display: none;
}

.eps-answer-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.eps-answer {
  display: flex;
  min-height: 49px;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #aeb8c1 !important;
  border-radius: 3px;
  color: #35414b;
  background: #fff;
  text-align: left;
}

.eps-answer:hover:not(:disabled) {
  border-color: #2f9bd5 !important;
  background: #eef8fd;
}

.eps-answer b {
  color: #327fad;
  font: 700 20px Georgia, serif;
}

.eps-answer span {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.eps-answer span img {
  display: block;
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
}

.eps-answer.is-selected {
  border-color: #168dcc !important;
  color: #0a5a87;
  background: #dff3ff;
  box-shadow: inset 0 0 0 1px #168dcc;
}

.eps-answer.is-correct {
  border-color: #2c9f65 !important;
  background: #e6f8ee;
}

.eps-answer.is-wrong {
  border-color: #d95454 !important;
  background: #ffeded;
}

.eps-answer:disabled {
  opacity: 1 !important;
}

.eps-paper-tip {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 11px;
  color: #587080;
  background: #edf4f7;
  font-size: 10px;
}

.eps-paper-tip>span {
  flex: 1;
}

.eps-paper-tip button {
  padding: 6px 9px;
  border-radius: 3px;
  color: #fff;
  background: #409ed0;
  font-size: 10px;
}

.eps-paper-tip button:disabled {
  display: none;
}

.eps-runtime-mobile-actions {
  display: none;
}

.eps-question-nav {
  overflow: auto;
  padding: 26px 14px 18px;
  background: #dcebf6;
}

.eps-submit-answer {
  width: 100%;
  min-height: 52px;
  margin-bottom: 12px;
  border: 1px solid #fff !important;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(#6db9e7, #398fd0);
  box-shadow: inset 0 0 7px rgba(255, 255, 255, .45);
  font-size: 20px !important;
  font-weight: 800 !important;
  text-shadow: 1px 2px 2px #555;
}

.eps-nav-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 2px solid #56aee0;
  border-bottom: 0;
  background: #84cef4;
}

.eps-nav-head>div {
  border-right: 2px solid #56aee0;
  text-align: center;
}

.eps-nav-head>div:last-child {
  border: 0;
}

.eps-nav-head b {
  display: block;
  min-height: 25px;
  padding: 5px 1px;
  color: #111;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.eps-nav-head span {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #e8f2fb;
}

.eps-nav-head em {
  padding: 6px 10px;
  border-radius: 3px;
  color: #fff;
  background: #6b82a2;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.eps-nav-head strong {
  font: 400 15px Georgia, serif;
}

.eps-nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 465px;
  background: #fff;
}

.eps-nav-grid>div {
  display: grid;
  align-content: start;
  border-right: 2px solid #e9e9e9;
}

.eps-nav-grid>div:last-child {
  border: 0;
}

.eps-nav-number {
  height: 23px;
  border-bottom: 1px solid #ededed !important;
  color: #111;
  background: #fff;
  font: 14px Georgia, serif !important;
}

.eps-nav-number:hover:not(:disabled) {
  background: #eaf5fc;
}

.eps-nav-number.is-answered {
  color: #0b6da3;
  background: #e4f3fc;
  font-weight: 700 !important;
}

.eps-nav-number.is-current {
  color: #fff;
  background: #389fd7;
}

.eps-question-nav>footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 22px;
}

.eps-question-nav>footer button,
.eps-runtime-mobile-actions button {
  min-height: 32px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(#6fc2ed, #389bd5);
  font-size: 13px;
  text-shadow: 0 1px #457;
}

.eps-result-page {
  display: grid;
  place-items: center;
  padding: 100px 18px 35px;
  background: linear-gradient(145deg, #eef3f7, #fff);
}

.eps-result-page .eps-cbt-header {
  position: absolute;
  inset: 0 0 auto;
}

.eps-result-card {
  width: min(680px, 100%);
  padding: 36px;
  border: 1px solid #c8d8e2;
  border-top: 5px solid #329cd5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 55px rgba(29, 59, 78, .13);
  text-align: center;
}

.eps-result-seal {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(#66bee9, #3299d2);
  font-size: 28px;
}

.eps-result-card>small {
  color: #718693;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
}

.eps-result-card h1 {
  margin: 7px 0 4px;
  color: #263b49;
  font: 700 31px Georgia, serif;
}

.eps-result-card>p {
  margin: 0;
  color: #6d7d87;
  font-size: 12px;
}

.eps-result-score {
  margin: 25px 0 18px;
  color: #277eaf;
}

.eps-result-score b {
  font: 700 68px Georgia, serif;
}

.eps-result-score span {
  color: #768793;
  font-size: 16px;
}

.eps-result-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid #d7e1e7;
  border-radius: 4px;
}

.eps-result-breakdown>div {
  padding: 13px 6px;
  border-right: 1px solid #d7e1e7;
}

.eps-result-breakdown>div:last-child {
  border: 0;
}

.eps-result-breakdown small,
.eps-result-breakdown b,
.eps-result-breakdown span {
  display: block;
}

.eps-result-breakdown small {
  color: #7c8c95;
  font-size: 8px;
  font-weight: 800;
}

.eps-result-breakdown b {
  margin: 4px 0 2px;
  color: #2d4c5f;
  font-size: 20px;
}

.eps-result-breakdown span {
  color: #6f8999;
  font-size: 9px;
}

.eps-result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.eps-result-actions button {
  min-height: 39px;
  padding: 0 13px;
  border-radius: 3px;
  color: #fff;
  background: #3b9dd3;
  font-size: 11px;
  font-weight: 700;
}

.eps-result-actions button:nth-child(3) {
  color: #476071;
  background: #edf2f5;
}

.eps-dialog-layer {
  position: fixed;
  z-index: 2147483600;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 31, 45, .58);
}

.eps-dialog {
  width: min(410px, 100%);
  padding: 25px;
  border-radius: 6px;
  color: #243746;
  background: #fff;
  box-shadow: 0 25px 70px rgba(0, 0, 0, .32);
  text-align: center;
}

.eps-dialog>i {
  color: #e2a92c;
  font-size: 35px;
}

.eps-dialog h2 {
  margin: 12px 0 7px;
  font: 700 23px Georgia, serif;
}

.eps-dialog p {
  margin: 0;
  color: #647582;
  font-size: 12px;
  line-height: 1.55;
}

.eps-dialog>div {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 8px;
  margin-top: 19px;
}

.eps-dialog button {
  min-height: 39px;
  border-radius: 3px;
  color: #476071;
  background: #edf2f5;
  font-size: 11px;
  font-weight: 700;
}

.eps-dialog button:last-child {
  color: #fff;
  background: #349bd3;
}

.eps-image-viewer {
  position: fixed;
  z-index: 2147483640;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 15px;
  color: #fff;
  background: rgba(8, 17, 25, .94);
}

.eps-image-viewer>button {
  justify-self: end;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .13);
  font-size: 20px;
}

.eps-image-viewer>div {
  overflow: auto;
  display: flex;
  align-items: center;
  padding: 12px;
  touch-action: pan-x pan-y pinch-zoom;
}

.eps-image-viewer img {
  display: block;
  width: auto;
  min-width: min(900px, 92vw);
  max-width: none;
  max-height: 82vh;
  margin: auto;
  object-fit: contain;
}

.eps-image-viewer>p {
  margin: 4px 0 0;
  color: #cad5dd;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 980px) {
  .eps-cbt-header {
    grid-template-columns: auto 1fr;
    min-height: 66px;
    padding: 0 20px;
  }

  .eps-cbt-header h1 {
    font-size: 18px;
  }

  .eps-candidate-strip {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: center;
    min-width: 0;
    min-height: 31px;
    margin: 0 -20px;
  }

  .eps-version-bar {
    padding-left: 20px;
  }

  .eps-runtime-page {
    overflow: auto;
  }

  .eps-runtime-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 129px);
  }

  .eps-question-area {
    min-height: 540px;
    padding: 26px 16px;
  }

  .eps-question-nav {
    padding: 14px;
  }

  .eps-nav-grid {
    min-height: 0;
  }

  .eps-nav-grid>div {
    grid-template-columns: repeat(10, 1fr);
  }

  .eps-nav-number {
    height: 35px;
    border-right: 1px solid #eee !important;
  }

  .eps-question-nav>footer {
    display: none;
  }

  .eps-runtime-mobile-actions {
    display: grid;
    width: min(1092px, 100%);
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
  }

  .eps-applicant-card {
    grid-template-columns: 1fr 160px;
  }

  .eps-applicant-card dl {
    grid-column: 1 / -1;
    margin-top: 20px;
  }

  .eps-seat-number {
    border: 0;
  }

  .eps-registration-body {
    grid-template-columns: 260px 1fr;
    gap: 25px;
  }
}

/* Account for the actual content column, which becomes much narrower when
   the persistent desktop sidebar is open. */
@container (max-width: 900px) {
  .eps-library-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 0;
    padding: 20px 19px;
  }

  .eps-library-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .eps-library-hero-copy {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .eps-library-count {
    grid-column: 2;
    grid-row: 1;
    min-width: 70px;
  }

  .eps-library-hero .eps-library-hero-copy h1 {
    font-size: 28px !important;
  }
}

@media (max-width: 760px) {
  .eps-library-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 0;
    padding: 20px 19px;
  }

  .eps-library-hero-copy {
    grid-column: 1 / -1;
  }

  .eps-library-count {
    min-width: 70px;
  }

  .eps-library-hero .eps-library-hero-copy h1 {
    font-size: 28px !important;
  }
}

@media (max-width: 640px) {
  #hw-mobile-bottom-nav {
    justify-content: space-between !important;
    gap: 4px;
    overflow: visible !important;
    scrollbar-width: none;
  }

  .hw-tab-btn[id^="mobile-tab-btn-"] {
    min-width: 0;
    flex: 1 1 0;
  }

  #hw-mobile-bottom-nav>.hw-tab-btn {
    min-width: 0 !important;
    max-width: none;
    flex: 1 1 0 !important;
  }

  #hw-mobile-bottom-nav>.hw-tab-btn .hw-tab-icon-wrap {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 26px !important;
    height: 20px !important;
    min-height: 20px !important;
    position: relative;
  }

  #hw-mobile-bottom-nav>.hw-tab-btn .hw-tab-icon-wrap i {
    font-size: 18px !important;
  }

  #hw-mobile-bottom-nav>.hw-tab-btn span.hw-tab-label,
  #hw-mobile-bottom-nav>.hw-tab-btn>span:not(.hw-tab-icon-wrap) {
    display: block !important;
    min-height: 10px;
    max-width: 100%;
    overflow: visible;
    color: inherit !important;
    font-size: 9px !important;
    line-height: 1.1;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
  }

  .eps-library {
    padding: 10px;
  }

  .eps-library-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 17px 15px;
    border-radius: 13px;
  }

  .eps-library-brand {
    gap: 8px;
  }

  .eps-library-brand-icon {
    width: 28px;
    height: 28px;
  }

  .eps-library-hero .eps-klt-logo {
    font-size: 19px;
  }

  .eps-library-hero-copy {
    grid-column: 1 / -1;
  }

  .eps-library-hero .eps-library-hero-copy h1 {
    margin-top: 5px;
    font-size: 24px !important;
  }

  .eps-library-hero .eps-library-hero-copy p {
    padding-right: 0;
    font-size: 11px;
  }

  .eps-library-count {
    min-width: 65px;
    padding: 7px 8px;
  }

  .eps-library-count b {
    font-size: 19px;
  }

  .eps-library-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .eps-library-grid {
    grid-template-columns: 1fr;
  }

  .eps-cbt-header {
    position: sticky;
    top: 0;
    z-index: 10;
    grid-template-columns: 1fr auto;
    gap: 7px;
    min-height: 50px;
    padding: 0 12px;
  }

  .eps-cbt-header .eps-klt-logo {
    font-size: 18px;
  }

  .eps-cbt-header h1 {
    display: none;
  }

  .eps-candidate-strip {
    grid-column: auto;
    justify-self: end;
    align-self: stretch;
    min-height: 0;
    margin: 0;
    background: transparent;
  }

  .eps-candidate-strip span:first-child {
    display: none;
  }

  .eps-candidate-strip span {
    gap: 4px;
    font-size: 10px;
  }

  .eps-candidate-strip b {
    padding: 4px 6px;
    font-size: 8px;
  }

  .eps-header-close {
    right: 2px;
    top: 50px;
    color: #445;
  }

  .eps-version-bar {
    min-height: 27px;
    padding: 0 12px;
  }

  .eps-runtime-bar {
    padding: 0 12px;
  }

  .eps-runtime-bar>span {
    min-width: 92px;
    font-size: 15px;
  }

  .eps-registration-backdrop {
    min-height: calc(100vh - 50px);
    padding: 15px 8px;
  }

  .eps-registration-modal>header {
    min-height: 50px;
    padding: 0 14px;
  }

  .eps-registration-body {
    grid-template-columns: 1fr;
    gap: 15px;
    min-height: 0;
    padding: 18px 14px;
  }

  .eps-avatar-placeholder {
    width: 100px;
    height: 105px;
    font-size: 75px;
  }

  .eps-registration-fields {
    gap: 8px;
  }

  .eps-registration-modal>footer {
    min-height: 64px;
    padding: 0 14px;
  }

  .eps-registration-modal>footer button {
    width: 100%;
    min-height: 39px;
  }

  .eps-preflight {
    width: calc(100% - 12px);
    margin: 14px auto;
  }

  .eps-preflight>h2 {
    padding: 10px;
    font-size: 21px;
  }

  .eps-preflight-audio {
    min-height: 63px;
    padding: 9px;
    font-size: 11px;
  }

  .eps-preflight-audio i {
    font-size: 27px;
  }

  .eps-applicant-card {
    grid-template-columns: 1fr 105px;
    gap: 5px;
    min-height: 0;
    padding: 17px 10px;
  }

  .eps-seat-number {
    padding: 0;
    font-size: 13px;
  }

  .eps-seat-number b {
    margin-top: 7px;
    font-size: 48px;
  }

  .eps-applicant-photo {
    width: 86px;
    height: 110px;
    font-size: 65px;
  }

  .eps-applicant-card dl {
    gap: 5px;
    margin-top: 13px;
  }

  .eps-applicant-card dl>div {
    grid-template-columns: 107px 1fr;
    min-height: 34px;
  }

  .eps-applicant-card dt {
    font-size: 9px;
  }

  .eps-applicant-card dd {
    padding: 0 9px;
    font-size: 10px;
  }

  .eps-notice-list {
    min-height: 0;
    padding: 15px 12px;
  }

  .eps-notice-list p {
    font-size: 11px;
  }

  .eps-confirm-button {
    min-height: 44px;
    margin-top: 12px;
  }

  .eps-soundcheck {
    width: calc(100% - 14px);
    min-height: 0;
    margin: 17px auto;
    padding: 20px 12px;
  }

  .eps-soundcheck h2 {
    font-size: 22px;
  }

  .eps-soundcheck>i {
    margin: 45px 0 35px;
    font-size: 90px;
  }

  .eps-soundcheck>div:not(.eps-sound-actions) {
    padding: 10px;
    font-size: 14px;
  }

  .eps-sound-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .eps-runtime-layout {
    min-height: calc(100vh - 77px);
  }

  .eps-question-area {
    min-height: 0;
    padding: 17px 7px 14px;
  }

  .eps-paper {
    min-height: 390px;
    padding: 17px 11px 13px;
  }

  .eps-paper-heading {
    font-size: 20px;
  }

  .eps-question-text {
    margin-top: 12px;
    font-size: 15px;
  }

  .eps-question-image {
    max-height: 45vh;
    margin: 11px auto;
  }

  .eps-answer-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 11px;
  }

  .eps-answer {
    min-height: 45px;
    padding: 6px 8px;
  }

  .eps-answer b {
    font-size: 18px;
  }

  .eps-paper-tip {
    align-items: flex-start;
    margin-top: 11px;
    font-size: 9px;
  }

  .eps-runtime-mobile-actions {
    gap: 8px;
    margin-top: 9px;
  }

  .eps-question-nav {
    padding: 9px 7px 18px;
  }

  .eps-submit-answer {
    min-height: 45px;
    font-size: 17px !important;
  }

  .eps-nav-head b {
    font-size: 11px;
  }

  .eps-nav-head span {
    gap: 5px;
  }

  .eps-nav-head em {
    padding: 5px;
    font-size: 8px;
  }

  .eps-nav-head strong {
    font-size: 12px;
  }

  .eps-nav-grid>div {
    grid-template-columns: repeat(5, 1fr);
  }

  .eps-nav-number {
    height: 34px;
  }

  .eps-result-page {
    padding-top: 70px;
  }

  .eps-result-card {
    padding: 22px 12px;
  }

  .eps-result-card h1 {
    font-size: 25px;
  }

  .eps-result-score {
    margin: 18px 0 13px;
  }

  .eps-result-score b {
    font-size: 51px;
  }

  .eps-result-breakdown b {
    font-size: 17px;
  }

  .eps-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .eps-result-actions button:last-child {
    grid-column: 1 / -1;
  }
}

/* EPS-TOPIK CBT: compact reference-style exam room (HRD Korea visual language). */
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-page {
  min-height: 100%;
  color: #10263a;
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-header {
  position: relative;
  z-index: 2;
  grid-template-columns: 220px minmax(260px, 1fr) 420px;
  min-height: 50px;
  padding: 0 18px;
  border-top: 5px solid #e7f0ff;
  border-bottom: 1px solid #71849e;
  background: linear-gradient(180deg, #e8f0fb 0%, #b6c8e3 100%);
  box-shadow: inset 0 -1px rgba(255, 255, 255, .85);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #070c14;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -.065em;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, .72);
  white-space: nowrap;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-brand-k {
  position: relative;
  display: inline-block;
  margin-left: .01em;
  color: #070c14;
}

/* The green detail follows the lower arm of K as a small curved leaf, rather
   than looking like a straight highlight across the letter. */
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-brand-k::after {
  position: absolute;
  right: -3px;
  bottom: -1px;
  width: 8px;
  height: 14px;
  border-radius: 100% 0 100% 0;
  content: '';
  background: linear-gradient(135deg, #d5ed39 0%, #a7ce2b 52%, #80a91d 100%);
  box-shadow: 0 1px 1px rgba(62, 89, 7, .2);
  transform: rotate(-37deg);
  transform-origin: 50% 100%;
  pointer-events: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-brand-k::before {
  position: absolute;
  z-index: 1;
  right: -4px;
  bottom: 1px;
  width: 10px;
  height: 4px;
  border: 1.5px solid #9abd27;
  border-top: 0;
  border-left: 0;
  border-radius: 0 0 100% 0;
  content: '';
  transform: rotate(24deg);
  pointer-events: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-header h1 {
  margin: 0;
  color: #1b2735;
  font-family: "Segoe UI", Tahoma, Arial, Helvetica, sans-serif !important;
  font-size: 22px !important;
  font-weight: 400 !important;
  letter-spacing: -.42px;
  line-height: 1.12;
  text-shadow: 0 1px #fff;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-candidate-strip {
  justify-content: flex-end;
  min-width: 0;
  min-height: 0;
  gap: 16px;
  padding: 0;
  background: transparent;
  font: 11px/1 Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-candidate-strip span {
  gap: 5px;
}

.eps-candidate-strip b {
  padding: 5px 9px;
  border: 1px solid #6b7d97;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(#8394ad, #596c87);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
}

.eps-candidate-strip em {
  color: #14243a;
  font-style: normal;
  font-weight: 700;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-header-close {
  z-index: 5;
  right: 6px;
  top: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(75, 97, 122, .35);
  border-radius: 50%;
  color: #334c67;
  background: rgba(255, 255, 255, .4);
  font-size: 13px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-version-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 18px;
  border-bottom: 1px solid #c9d7e8;
  color: #233c59;
  background: linear-gradient(180deg, #f5f8ff, #dae5f4);
  font: 11px Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-version-bar::after {
  content: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #172f48;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>button {
  display: grid;
  width: 47px;
  height: 21px;
  place-items: center;
  border: 1px solid #2c82b7;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(#7dcef3, #278dcc);
  box-shadow: inset 0 1px rgba(255, 255, 255, .7);
  font: 700 11px Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>button:hover,
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>button:focus-visible {
  border-color: #cc6200;
  color: #fff;
  background: linear-gradient(#ffc34e, #f08000);
  box-shadow: inset 0 1px rgba(255, 255, 255, .75), 0 1px 2px rgba(155, 77, 0, .28);
  outline: 0;
}

.eps-cbt-controls>button:active {
  transform: translateY(1px);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>span {
  margin-left: 7px;
  color: #17293d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.eps-cbt-controls .eps-volume-step {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  padding: 0;
  border: 1px solid #5d84b0 !important;
  border-radius: 50% !important;
  color: #183f74;
  background: linear-gradient(#eef7ff, #a6c8e8) !important;
  box-shadow: inset 0 1px rgba(255, 255, 255, .96), 0 1px 1px rgba(41, 75, 112, .25);
  font-size: 7px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"] {
  width: 76px;
  height: 12px;
  margin: 0 -2px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.eps-cbt-controls input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border: 1px solid #2a7eae;
  border-radius: 99px;
  background: linear-gradient(90deg, #54b8e9, #2b89c4);
}

.eps-cbt-controls input[type="range"]::-webkit-slider-thumb {
  width: 9px;
  height: 9px;
  margin-top: -4px;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #2a6999;
  border-radius: 50%;
  background: linear-gradient(#f5fbff, #91c9ed);
  box-shadow: 0 1px 1px rgba(18, 70, 105, .28);
}

.eps-cbt-controls input[type="range"]::-moz-range-track {
  height: 3px;
  border: 1px solid #2a7eae;
  border-radius: 99px;
  background: linear-gradient(90deg, #54b8e9, #2b89c4);
}

.eps-cbt-controls input[type="range"]::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 1px solid #2a6999;
  border-radius: 50%;
  background: linear-gradient(#f5fbff, #91c9ed);
  box-shadow: 0 1px 1px rgba(18, 70, 105, .28);
}

.eps-cbt-controls input[type="range"]:hover::-webkit-slider-runnable-track,
.eps-cbt-controls input[type="range"]:focus-visible::-webkit-slider-runnable-track {
  border-color: #cc6200;
  background: linear-gradient(90deg, #ffc34e, #f08000);
}

.eps-cbt-controls input[type="range"]:hover::-webkit-slider-thumb,
.eps-cbt-controls input[type="range"]:focus-visible::-webkit-slider-thumb {
  border-color: #cc6200;
  background: linear-gradient(#ffe3a1, #f28a08);
}

.eps-cbt-controls input[type="range"]:hover::-moz-range-track,
.eps-cbt-controls input[type="range"]:focus-visible::-moz-range-track {
  border-color: #cc6200;
  background: linear-gradient(90deg, #ffc34e, #f08000);
}

.eps-cbt-controls input[type="range"]:hover::-moz-range-thumb,
.eps-cbt-controls input[type="range"]:focus-visible::-moz-range-thumb {
  border-color: #cc6200;
  background: linear-gradient(#ffe3a1, #f28a08);
}

.eps-cbt-controls output {
  display: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]::-webkit-slider-runnable-track {
  border-color: #2a7eae;
  background: linear-gradient(90deg, #2b89c4 0 var(--eps-volume-progress), #b9c1ca var(--eps-volume-progress) 100%);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]::-moz-range-track {
  border-color: #8795a4;
  background: #b9c1ca;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]::-moz-range-progress {
  height: 3px;
  border: 1px solid #2a7eae;
  border-radius: 99px;
  background: #2b89c4;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:hover::-webkit-slider-runnable-track,
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:focus-visible::-webkit-slider-runnable-track {
  border-color: #cc6200;
  background: linear-gradient(90deg, #f08000 0 var(--eps-volume-progress), #b9c1ca var(--eps-volume-progress) 100%);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:hover::-moz-range-track,
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:focus-visible::-moz-range-track {
  border-color: #a86712;
  background: #b9c1ca;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:hover::-moz-range-progress,
:is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"]:focus-visible::-moz-range-progress {
  border-color: #cc6200;
  background: #f08000;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-bar {
  padding-right: 16px;
}

.eps-runtime-bar>i {
  display: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight {
  width: min(770px, calc(100% - 32px));
  margin: clamp(42px, 7vh, 78px) auto 40px;
  border: 1px solid #9eb1c4;
  background: #fff;
  text-align: center;
  box-shadow: 0 1px 2px rgba(33, 62, 94, .09);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-flow {
  width: min(770px, calc(100% - 32px));
  margin: clamp(42px, 7vh, 78px) auto 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-flow>.eps-preflight {
  width: 100%;
  margin: 0;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 46px auto 0;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-confirm-button,
:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-sound-test,
:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-start-real {
  min-width: 135px;
  min-height: 39px;
  margin: 0;
  border: 1px solid #1474aa;
  border-radius: 2px;
  color: #fff;
  background: linear-gradient(#70c3ed, #2795d1);
  box-shadow: inset 0 1px rgba(255, 255, 255, .55);
  font: 700 16px Arial, Helvetica, sans-serif;
  text-shadow: 0 1px rgba(0, 0, 0, .3);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-start-real {
  border-color: #d76700;
  background: linear-gradient(#ffa938, #ff7500);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight>h2 {
  min-height: 44px;
  margin: 0;
  padding: 10px 20px;
  border: 1px solid #1672ac;
  border-width: 1px 0;
  color: #fff;
  background: linear-gradient(#70c1ef, #2895d0);
  font: 700 20px/1.1 Arial, Helvetica, sans-serif;
  text-shadow: 0 1px rgba(0, 0, 0, .22);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-audio {
  min-height: 86px;
  justify-content: flex-start;
  gap: 16px;
  padding: 0 84px;
  color: #fff;
  background-color: #3d4658;
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 4px);
  font: 700 14px/1.45 Arial, Helvetica, sans-serif;
  text-align: left;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-audio i {
  flex: 0 0 auto;
  font-size: 34px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card {
  grid-template-columns: 210px 130px minmax(0, 1fr);
  gap: 28px;
  min-height: 326px;
  margin: 4px;
  padding: 28px 42px;
  border: 1px solid #d4d9df;
  background: #fbfbfb;
  box-shadow: none;
  text-align: left;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-seat-number {
  place-content: start center;
  padding: 30px 0 0;
  border-right: 1px solid #edf0f3;
  color: #3e4247;
  font: 17px Arial, Helvetica, sans-serif;
  text-align: center;
}

.eps-seat-number b {
  margin-top: 22px;
  color: #090a0c !important;
  font: 700 96px/1 Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-photo {
  width: 116px;
  height: 144px;
  border: 1px solid #c9cfd5;
  color: #b4b5b6;
  background: #ececec;
  font-size: 82px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card dl {
  align-content: center;
  gap: 10px;
}

.eps-applicant-card dl>div {
  grid-template-columns: 114px minmax(0, 1fr);
  min-height: 29px;
  border: 1px solid #d8dce0;
  border-radius: 18px;
  background: #fff;
}

.eps-applicant-card dt {
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(#74c1ee, #2f91ca);
  font-size: 9px;
}

.eps-applicant-card dd {
  color: #111be6;
  font: 11px Arial, Helvetica, sans-serif;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-confirm-button {
  min-width: 135px;
  min-height: 39px;
  margin: 46px auto 0;
  border: 1px solid #1474aa;
  border-radius: 2px;
  color: #fff;
  background: linear-gradient(#70c3ed, #2795d1);
  box-shadow: inset 0 1px rgba(255, 255, 255, .55);
  font: 700 16px Arial, Helvetica, sans-serif !important;
  text-shadow: 0 1px rgba(0, 0, 0, .3);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-notice-list,
:is(#view-eps-exam, .eps-cbt-scope) .eps-practice-list {
  min-height: 326px;
  margin: 4px;
  padding: 25px 66px;
  border: 1px solid #d4d9df;
  background: #fff;
  text-align: left;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-notice-list p {
  gap: 10px;
  margin: 8px 0;
  color: #121820;
  font: 13px/1.38 Arial, Helvetica, sans-serif;
}

.eps-notice-list i {
  color: #1d9bdc;
  font-size: 12px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-practice-list {
  display: grid;
  align-content: start;
  gap: 17px;
}

.eps-practice-list p {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  color: #111;
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}

.eps-practice-list b {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  min-height: 21px;
  place-items: center;
  clip-path: polygon(0 0, 82% 0, 100% 50%, 82% 100%, 0 100%);
  color: #fff;
  background: #4a5568;
  font-size: 12px;
}

.eps-practice-list strong {
  padding: 3px 8px;
  border: 1px solid #70bde9;
  border-radius: 2px;
  color: #fff;
  background: linear-gradient(#8bd0f5, #389ad1);
  font-size: 11px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-practice .eps-sound-state {
  min-height: 0;
  margin: 12px 25px 0 !important;
  color: #496477;
  font: 12px Arial, Helvetica, sans-serif !important;
}

.eps-practice .eps-sound-actions {
  margin: 16px auto 0;
}

.eps-practice .eps-sound-actions button {
  min-width: 134px;
  min-height: 39px;
  border: 1px solid #1474aa;
  border-radius: 2px;
  font-size: 14px;
}

.eps-practice .eps-sound-test {
  background: linear-gradient(#70c3ed, #2795d1);
}

.eps-practice .eps-start-real {
  border-color: #d76700;
  background: linear-gradient(#ffa938, #ff7500);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

.eps-runtime-page .eps-cbt-header {
  min-height: 50px;
}

.eps-runtime-layout {
  grid-template-columns: minmax(0, 1fr) 270px;
  height: calc(100dvh - 84px);
  min-height: 540px;
  background: #aaa;
}

.eps-question-area {
  align-items: center;
  padding: clamp(32px, 5vh, 58px) clamp(26px, 5vw, 86px);
  background: #aaa;
}

.eps-paper {
  width: min(var(--eps-paper-width), 100%);
  min-height: calc(100dvh - 205px);
  padding: 42px 40px 32px;
  border: 0;
  background: #fff;
  box-shadow: none;
}

.eps-paper-heading {
  justify-content: flex-start;
  gap: 12px;
  padding: 0;
  border: 0;
  color: #27374c;
  font: 400 14px Arial, Helvetica, sans-serif;
}

.eps-paper-heading span {
  display: none;
}

.eps-paper-heading b {
  color: #263647;
  font: 400 14px Arial, Helvetica, sans-serif;
}

.eps-question-text {
  max-width: 630px;
  margin: 15px 0 18px;
  color: #101d2c;
  font: 17px/1.6 Arial, Helvetica, sans-serif;
}

.eps-question-image {
  display: block;
  width: min(var(--eps-question-image-width), 100%);
  max-width: 100%;
  max-height: none;
  height: auto;
  margin: 10px 0 18px;
  object-position: left center;
  image-rendering: auto;
}

.eps-answer-row {
  width: min(490px, 100%);
  grid-template-columns: 1fr;
  gap: 2px;
  margin-top: 12px;
}

.eps-answer {
  min-height: 31px;
  gap: 7px;
  padding: 3px 0;
  border: 0 !important;
  border-radius: 0;
  color: #131a20;
  background: transparent;
  font: 14px/1.35 Arial, Helvetica, sans-serif;
}

.eps-answer:hover:not(:disabled),
.eps-answer:focus-visible:not(:disabled) {
  border: 0 !important;
  color: #131a20;
  background: transparent !important;
  outline: 0;
}

.eps-answer b {
  min-width: 27px;
  color: #1b2632;
  font: 400 15px Arial, Helvetica, sans-serif;
}

.eps-answer span {
  white-space: normal;
}

.eps-answer.is-selected {
  border: 0 !important;
  color: #075b9e;
  background: #e7f5ff;
  box-shadow: inset 3px 0 #1c9cdc;
}

.eps-answer.is-correct {
  background: #e8f8ed;
}

.eps-answer.is-wrong {
  background: #fff0f0;
}

.eps-paper-tip {
  width: min(520px, 100%);
  min-height: 0;
  margin-top: 22px;
  padding: 7px 0;
  color: #5b6c7a;
  background: transparent;
  font-size: 10px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav {
  padding: 25px 10px 15px;
  background: #d9e7f6;
}

.eps-submit-answer {
  min-height: 40px;
  margin: 0 0 16px;
  border: 1px solid #126ea9 !important;
  border-radius: 4px;
  background: linear-gradient(#6fc1ef, #2e90cb);
  box-shadow: inset 0 1px rgba(255, 255, 255, .75);
  font-size: 17px !important;
  text-shadow: 0 1px rgba(0, 0, 0, .32);
}

.eps-nav-head {
  border: 1px solid #228bc6;
  border-bottom: 0;
  background: #fff;
}

.eps-nav-head>div {
  border-right: 1px solid #228bc6;
}

.eps-nav-head b {
  min-height: 22px;
  padding: 4px 1px;
  color: #17364e;
  background: #75bee9;
  font: 700 10px Arial, Helvetica, sans-serif;
}

.eps-nav-head span {
  min-height: 43px;
  gap: 6px;
  background: #eff7ff;
}

.eps-nav-head em {
  padding: 4px 6px;
  border-radius: 2px;
  background: #677b97;
  font-size: 8px;
}

.eps-nav-head strong {
  color: #14202b;
  font: 700 11px Arial, Helvetica, sans-serif;
}

.eps-nav-grid {
  min-height: calc(100dvh - 255px);
  border: 1px solid #c4d6e7;
  border-top: 0;
}

.eps-nav-grid>div {
  border-right: 1px solid #d4dfeb;
}

.eps-nav-number {
  position: relative;
  height: 20px;
  border-bottom: 1px solid #e8edf2 !important;
  color: #34414d;
  font: 11px Arial, Helvetica, sans-serif !important;
}

.eps-nav-number.is-answered {
  color: #1c72a5;
  background: #e7f4fc;
}

.eps-nav-number.is-current {
  color: #fff;
  background: #318fc7;
}

.eps-nav-dot {
  width: 4px;
  height: 4px;
  background: currentColor;
}

.eps-question-nav>footer {
  gap: 22px;
  margin-top: 17px;
}

.eps-question-nav>footer button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #2b7fad;
  border-radius: 14px;
  background: linear-gradient(#6fc5ef, #278ec9);
  font-size: 10px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-submit-answer:hover:not(:disabled),
:is(#view-eps-exam, .eps-cbt-scope) .eps-submit-answer:focus-visible {
  border-color: #c85c00 !important;
  color: #fff;
  background: linear-gradient(#ffc14a, #ef7600);
  box-shadow: inset 0 1px rgba(255, 255, 255, .76), 0 2px 4px rgba(170, 80, 0, .25);
  outline: 0;
}

@media (max-width: 980px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-header {
    grid-template-columns: 170px 1fr;
    min-height: 52px;
  }

  .eps-candidate-strip {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 27px;
    padding-right: 8px !important;
  }

  .eps-cbt-header h1 {
    font-size: 18px;
  }

  .eps-version-bar {
    min-height: 30px;
  }

  .eps-runtime-page {
    height: auto;
    overflow: auto;
  }

  .eps-runtime-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .eps-question-area {
    min-height: 490px;
  }

  .eps-question-nav {
    min-height: 0;
  }

  .eps-nav-grid {
    min-height: 220px;
  }

  .eps-nav-grid>div {
    grid-template-columns: repeat(10, 1fr);
  }

  .eps-nav-number {
    height: 32px;
    border-right: 1px solid #e8edf2 !important;
  }

  .eps-question-nav>footer {
    display: none;
  }
}

@media (max-width: 640px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-header {
    grid-template-columns: 1fr auto;
    min-height: 48px;
    padding: 0 11px;
  }

  .eps-cbt-brand {
    font-size: 19px;
  }

  .eps-cbt-header h1 {
    display: none;
  }

  .eps-candidate-strip {
    grid-column: auto;
    grid-row: auto;
    justify-self: end;
    padding-right: 28px !important;
  }

  .eps-candidate-strip span:first-child {
    display: none;
  }

  .eps-candidate-strip em {
    font-size: 10px;
  }

  .eps-version-bar::after {
    content: 'A+   A−';
  }

  .eps-preflight {
    width: calc(100% - 18px);
    margin: 18px auto;
  }

  .eps-preflight>h2 {
    min-height: 0;
    padding: 10px;
    font-size: 16px;
  }

  .eps-preflight-audio {
    min-height: 67px;
    padding: 12px;
    gap: 10px;
    font-size: 11px;
  }

  .eps-preflight-audio i {
    font-size: 25px;
  }

  .eps-applicant-card {
    grid-template-columns: 1fr 100px;
    gap: 9px;
    min-height: 0;
    padding: 16px;
  }

  .eps-seat-number {
    padding: 0;
  }

  .eps-seat-number b {
    margin-top: 8px;
    font-size: 58px;
  }

  .eps-applicant-photo {
    width: 90px;
    height: 112px;
    font-size: 63px;
  }

  .eps-applicant-card dl {
    grid-column: 1 / -1;
    gap: 6px;
  }

  .eps-applicant-card dl>div {
    grid-template-columns: 102px minmax(0, 1fr);
  }

  .eps-notice-list,
  .eps-practice-list {
    min-height: 0;
    padding: 17px 14px;
  }

  .eps-notice-list p,
  .eps-practice-list p {
    font-size: 11px;
  }

  .eps-confirm-button {
    min-height: 40px;
    margin: 18px auto 0;
  }

  .eps-practice .eps-sound-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: calc(100% - 28px);
  }

  .eps-practice .eps-sound-actions button {
    width: 100%;
  }

  .eps-runtime-page .eps-candidate-strip {
    display: none;
  }

  .eps-runtime-layout {
    min-height: calc(100dvh - 78px);
  }

  .eps-question-area {
    min-height: 0;
    padding: 17px 7px;
  }

  .eps-paper {
    min-height: 420px;
    padding: 22px 16px;
  }

  .eps-question-text {
    font-size: 15px;
  }

  .eps-question-image {
    max-width: 100%;
    max-height: none;
  }

  .eps-answer-row {
    width: 100%;
  }

  .eps-answer {
    min-height: 40px;
    font-size: 13px;
  }

  .eps-question-nav {
    padding: 11px 7px 17px;
  }

  .eps-submit-answer {
    min-height: 42px;
    margin-bottom: 10px;
    font-size: 15px !important;
  }

  .eps-nav-grid {
    min-height: 0;
  }

  .eps-nav-grid>div {
    grid-template-columns: repeat(5, 1fr);
  }

  .eps-nav-number {
    height: 31px;
  }
}

/* Keep the paper-and-navigator layout on compact desktop/laptop screens.
   The navigator becomes a second row only on actual phone widths. */
@media (min-width: 761px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-question-nav {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .eps-runtime-page .eps-nav-grid {
    flex: 1 1 auto;
    min-height: 0;
  }

  .eps-runtime-page .eps-question-nav>footer {
    flex: 0 0 auto;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page {
    height: 100dvh;
    overflow: hidden;
  }

  .eps-runtime-page .eps-cbt-header {
    min-height: 52px;
  }

  .eps-runtime-layout {
    grid-template-columns: minmax(0, 1fr) 270px;
    height: calc(100dvh - 113px);
    min-height: 0;
  }

  .eps-question-area {
    min-height: 0;
    padding: 32px 34px;
  }

  .eps-paper {
    min-height: calc(100dvh - 185px);
  }

  .eps-question-nav {
    min-height: 0;
    padding: 16px 10px 13px;
  }

  .eps-nav-grid {
    min-height: calc(100dvh - 230px);
  }

  .eps-nav-grid>div {
    grid-template-columns: 1fr;
  }

  .eps-nav-number {
    height: 20px;
    border-right: 0 !important;
  }

  .eps-question-nav>footer {
    display: grid;
  }

  .eps-runtime-mobile-actions {
    display: none;
  }
}

/* Interactive CBT controls, answer check mark, and the ruled 40-question grid. */
:is(#eps-exam-app, .eps-exam-app) {
  --eps-font-scale: 1;
  --eps-question-image-scale: 1;
  --eps-question-image-width: 740px;
  --eps-paper-width: 820px;
  --eps-volume-progress: 100%;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-preflight>h2 {
  font-size: calc(20px * var(--eps-font-scale));
}

.eps-preflight-audio {
  font-size: calc(14px * var(--eps-font-scale));
}

.eps-notice-list p,
.eps-practice-list p {
  font-size: calc(13px * var(--eps-font-scale));
}

.eps-seat-number {
  font-size: calc(17px * var(--eps-font-scale));
}

.eps-applicant-card dd {
  font-size: calc(11px * var(--eps-font-scale));
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-question-text {
  font-size: calc(17px * var(--eps-font-scale));
}

.eps-answer {
  position: relative;
  font-size: calc(14px * var(--eps-font-scale));
}

.eps-paper-tip {
  font-size: calc(10px * var(--eps-font-scale));
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong),
:is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong):hover:not(:disabled) {
  border: 0 !important;
  color: #131a20;
  background: transparent !important;
  box-shadow: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong)::after {
  display: none;
  content: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-answer b {
  position: relative;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after {
  content: '✓';
  position: absolute;
  left: -7px;
  top: 50%;
  color: #0878d1;
  font: 800 calc(17px * var(--eps-font-scale))/1 Arial, Helvetica, sans-serif;
  pointer-events: none;
  transform: translateY(-54%) rotate(-10deg);
  text-shadow: 0 1px #fff;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b {
  color: #1b2632;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head,
:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid {
  box-sizing: border-box;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid {
  display: grid;
  grid-template-columns: 14% calc(50% - 14%) 14% calc(50% - 14%);
  grid-auto-rows: 20px;
  align-content: start;
  overflow: hidden;
  background-color: #fff;
  background-image: repeating-linear-gradient(to bottom, transparent 0 19px, #e6edf4 19px 20px);
}

.eps-nav-number,
.eps-nav-answer,
.eps-nav-empty {
  display: grid;
  box-sizing: border-box;
  width: 100%;
  height: 20px;
  min-width: 0;
  place-items: center;
  border-right: 1px solid #e6edf4 !important;
  border-bottom: 1px solid #e6edf4 !important;
  background: transparent;
}

.eps-nav-answer:nth-child(4n + 2) {
  border-right-color: #d8e4ed !important;
}

.eps-nav-number:nth-child(4n),
.eps-nav-answer:nth-child(4n),
.eps-nav-empty:nth-child(4n) {
  border-right: 0 !important;
}

.eps-nav-number {
  color: #34414d;
  background: #fbfdff;
  font-size: 10px !important;
}

.eps-nav-answer {
  position: relative;
  color: #34414d;
}

.eps-nav-answer .eps-nav-dot {
  position: static;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3f4751;
}

.eps-nav-number.is-current,
.eps-nav-answer.is-current {
  color: #34414d;
  background: #fff;
  box-shadow: none;
}

.eps-nav-number.is-answered,
.eps-nav-answer.is-answered {
  color: #34414d;
  background: #fff;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head,
:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid {
  position: relative;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head>div:first-child,
:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-answer:nth-child(4n + 2) {
  border-right-color: transparent !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head::after,
:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid::after {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  content: '';
  pointer-events: none;
  transform: translateX(-1px);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head::after {
  background: #228bc6;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head {
  border-bottom: 1px solid #228bc6;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid::after {
  background: #d8e4ed;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav>footer {
  gap: 22px;
  margin-top: 8px;
}

@media (min-width: 761px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-nav-grid {
    flex: 0 0 auto;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls {
    width: 100%;
    justify-content: space-between;
    gap: 5px;
  }

  .eps-cbt-controls>button {
    width: 42px;
    height: 23px;
    font-size: 11px;
  }

  .eps-cbt-controls>span {
    margin-left: 0;
    font-size: 10px;
  }

  .eps-cbt-controls input[type="range"] {
    width: min(24vw, 82px);
  }

  .eps-cbt-controls output {
    min-width: 27px;
    font-size: 8px;
  }

  .eps-version-bar {
    align-items: center;
    gap: 5px;
  }

  .eps-version-bar>small {
    display: none;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .eps-runtime-layout {
    min-height: 0;
  }

  .eps-question-area {
    min-height: 0;
    padding: 10px 6px 0;
  }

  .eps-paper {
    min-height: 0;
    padding: 16px 14px 8px;
  }

  .eps-question-image {
    margin: 8px 0 12px;
  }

  .eps-answer-row {
    gap: 0;
    margin-top: 7px;
  }

  .eps-answer {
    min-height: 28px;
  }

  .eps-paper-tip {
    margin-top: 10px;
  }

  .eps-runtime-mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    width: 100%;
    gap: 8px;
    margin: 0;
    padding: 6px 7px;
    background: linear-gradient(to bottom, rgba(248, 251, 255, .85), #f8fbff 28%);
    box-shadow: 0 -6px 12px rgba(53, 85, 116, .07);
  }

  .eps-runtime-mobile-actions button {
    min-height: 42px;
  }

  .eps-question-nav {
    margin-top: 0;
    padding: 12px 8px 16px;
    border-top: 1px solid #c9d9e8;
    background: #f7fbff;
  }

  .eps-submit-answer,
  .eps-nav-head,
  .eps-nav-grid {
    width: min(100%, 360px);
    margin-right: auto;
    margin-left: auto;
  }

  .eps-submit-answer {
    min-height: 42px;
    margin-bottom: 9px;
  }

  .eps-nav-head b {
    min-height: 21px;
    padding: 3px 1px;
    font-size: 10px;
  }

  .eps-nav-head span {
    min-height: 38px;
    gap: 5px;
  }

  .eps-nav-head em {
    padding: 4px 5px;
    font-size: 8px;
  }

  .eps-nav-head strong {
    font-size: 11px;
  }

  .eps-nav-grid {
    grid-template-columns: 7% 43% 7% 43%;
    grid-auto-rows: 22px;
    max-height: none;
    min-height: 0;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .eps-nav-number,
  .eps-nav-answer,
  .eps-nav-empty {
    height: 22px;
  }

  .eps-nav-number {
    font-size: 10px !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after {
    left: -6px;
    font-size: calc(15px * var(--eps-font-scale));
  }
}

/* Final mobile geometry: explicit view scoping keeps these rules ahead of the
   desktop CBT sheet rules, which also use :is(#view-eps-exam, .eps-cbt-scope) selectors. */
@media (max-width: 640px) {

  /* Keep the toolbar as one compact control group instead of distributing its
     children across the entire phone width. */
  /* The candidate confirmation sheet used desktop selectors with higher
     specificity, causing its three-column card to overflow narrow iPhones. */
  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-page {
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-x: clip;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight {
    box-sizing: border-box;
    width: min(calc(100% - 16px), 420px);
    max-width: calc(100% - 16px);
    margin: 12px auto 20px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-flow {
    box-sizing: border-box;
    width: min(calc(100% - 16px), 420px);
    max-width: calc(100% - 16px);
    margin: 12px auto 20px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-flow>.eps-preflight {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action {
    margin-top: 16px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action {
    gap: 8px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-confirm-button,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-sound-test,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-action .eps-start-real {
    min-width: 118px;
    min-height: 40px;
    font-size: 14px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight>h2 {
    min-height: 0;
    padding: 10px 12px;
    font-size: calc(16px * var(--eps-font-scale));
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-audio {
    min-height: 64px;
    gap: 10px;
    padding: 10px 12px;
    font-size: calc(11px * var(--eps-font-scale));
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-preflight-audio i {
    font-size: 25px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 10px;
    min-height: 0;
    margin: 4px;
    padding: 14px 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-seat-number {
    padding: 0;
    font-size: calc(13px * var(--eps-font-scale));
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-seat-number b {
    margin-top: 7px;
    font-size: 54px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-photo {
    width: 82px;
    height: 104px;
    font-size: 58px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card dl {
    grid-column: 1 / -1;
    gap: 5px;
    margin-top: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card dl>div {
    grid-template-columns: 94px minmax(0, 1fr);
    min-height: 32px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card dt {
    font-size: 8px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-applicant-card dd {
    padding: 0 8px;
    font-size: calc(10px * var(--eps-font-scale));
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-confirm-button {
    min-width: 118px;
    min-height: 40px;
    margin: 16px auto 0;
    font-size: 14px !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-version-bar {
    justify-content: center;
    min-height: 34px;
    padding: 0 8px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls {
    width: auto;
    max-width: 100%;
    justify-content: center;
    gap: 6px;
    margin: 0 auto;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>button {
    width: 42px;
    height: 22px;
    flex: 0 0 auto;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls>span {
    margin-left: 0;
    font-size: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls .eps-volume-step {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-cbt-controls input[type="range"] {
    width: 70px;
    margin: 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-layout {
    min-height: 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-question-area {
    min-height: 0;
    padding: 10px 6px 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper {
    min-height: 0;
    padding: 16px 14px 8px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-question-image {
    margin: 8px 0 12px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-answer-row {
    gap: 0;
    margin-top: 7px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-answer {
    min-height: 28px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper-tip {
    margin-top: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-mobile-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    box-sizing: border-box;
    width: min(calc(100% - 16px), 360px);
    gap: 8px;
    margin: 0 auto;
    padding: 6px 0;
    background: linear-gradient(to bottom, rgba(248, 251, 255, .85), #f8fbff 28%);
    box-shadow: 0 -6px 12px rgba(53, 85, 116, .07);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-mobile-actions button {
    min-height: 38px;
    padding: 0 9px;
    font-size: 13px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav {
    margin-top: 0;
    padding: 12px 8px 16px;
    border-top: 1px solid #c9d9e8;
    background: #f7fbff;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-submit-answer,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid {
    width: min(calc(100% - 16px), 360px);
    margin-right: auto;
    margin-left: auto;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-submit-answer {
    display: block;
    box-sizing: border-box;
    min-height: 40px;
    margin: 0 auto 9px !important;
    font-size: 15px !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head b {
    min-height: 21px;
    padding: 3px 1px;
    font-size: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head span {
    min-height: 38px;
    gap: 5px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head em {
    padding: 4px 5px;
    font-size: 8px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head strong {
    font-size: 11px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-grid {
    grid-template-columns: 7% calc(50% - 7%) 7% calc(50% - 7%);
    grid-auto-rows: 22px;
    max-height: none;
    min-height: 0;
    overflow: visible;
    background-image: none;
    scrollbar-gutter: auto;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-number,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-answer,
  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-empty {
    height: 22px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-number {
    font-size: 10px !important;
  }
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Multiple Choice Buttons */
.hw-quiz-btn {
  width: 100% !important;
  text-align: left !important;
  padding: 14px 18px !important;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 16px !important;
  color: var(--text-main) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}

.hw-quiz-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: var(--primary) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
}

.hw-quiz-btn.correct {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15) !important;
}

.hw-quiz-btn.incorrect {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15) !important;
}

.hw-quiz-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-soft);
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}

.hw-quiz-btn.correct .hw-quiz-badge {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
}

.hw-quiz-btn.incorrect .hw-quiz-badge {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

/* Spelling / Writing Practice styling */
#hw-write-input-ko {
  transition: all 0.3s ease;
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border-color: var(--border-strong) !important;
  caret-color: var(--primary) !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

#hw-write-input-ko::placeholder {
  color: var(--text-soft) !important;
  opacity: 1 !important;
}

#hw-write-input-ko::-webkit-input-placeholder {
  color: var(--text-soft) !important;
  opacity: 1 !important;
}

#hw-write-input-ko:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14) !important;
}

#hw-write-input-ko.correct {
  border-color: #10b981 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25) !important;
  background: rgba(16, 185, 129, 0.05) !important;
  color: var(--text-main) !important;
}

#hw-write-input-ko.incorrect {
  border-color: #ef4444 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25) !important;
  background: rgba(239, 68, 68, 0.05) !important;
  color: var(--text-main) !important;
}

/* ============================== */
/* DECK CARD PROGRESS TRACKING    */
/* ============================== */

.hw-deck-card {
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  position: relative;
  overflow: hidden;
}

.hw-deck-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

/* Header: Title + Ring side-by-side */
.hw-deck-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hw-deck-card-info {
  flex: 1;
  min-width: 0;
}

.hw-deck-card-info h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* SVG Progress Ring */
.hw-deck-progress-ring {
  position: relative;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  cursor: default;
}

.hw-deck-progress-ring svg {
  display: block;
}

.hw-deck-progress-ring svg circle:last-child {
  filter: none !important;
}

.hw-deck-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 900;
  color: var(--text-main, #e2e8f0);
  letter-spacing: -0.5px;
  line-height: 1;
}

/* Progress Details Section */
.hw-deck-progress-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Linear Progress Bar */
.hw-deck-progress-bar-wrap {
  width: 100%;
}

.hw-deck-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.hw-deck-progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  position: relative;
}

.hw-deck-progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
  animation: hw-progress-shimmer 2s infinite;
}

@keyframes hw-progress-shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(200%);
  }
}

/* Progress bar color variants */
.hw-deck-progress-bar-fill.hw-progress-low {
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.hw-deck-progress-bar-fill.hw-progress-mid {
  background: linear-gradient(90deg, #6366f1, #818cf8);
}

.hw-deck-progress-bar-fill.hw-progress-high {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.hw-deck-progress-bar-fill.hw-progress-complete {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* Stats Line */
.hw-deck-progress-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.hw-deck-stat {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-soft, #94a3b8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.hw-deck-stat i {
  font-size: 9px;
  color: #6366f1;
}

.hw-deck-stat-mastered i {
  color: #f59e0b;
}

.hw-deck-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.hw-deck-action-card {
  min-width: 0;
  min-height: 44px;
  padding: 7px 8px 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.hw-deck-action-card:hover {
  transform: translateY(-1px);
}

.hw-deck-action-card:active {
  transform: translateY(0);
}

.hw-deck-action-count {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.hw-deck-action-label {
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.hw-deck-action-new {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #2563eb;
}

.hw-deck-action-new:hover {
  background: #bfdbfe;
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.14);
}

.hw-deck-action-review {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #ea580c;
}

.hw-deck-action-review:hover {
  background: #ffedd5;
  box-shadow: 0 5px 12px rgba(234, 88, 12, 0.14);
}

@media (max-width: 360px) {
  .hw-deck-action-card {
    padding-left: 6px;
    padding-right: 6px;
  }

  .hw-deck-action-count {
    font-size: 18px;
  }

  .hw-deck-action-label {
    font-size: 9px;
  }
}

/* Status Badge */
.hw-deck-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  width: fit-content;
  letter-spacing: 0.3px;
  background: #f8fafc;
  color: var(--text-soft, #475569);
  border: 1px solid #cbd5e1;
}

.hw-deck-status-badge.hw-progress-low {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.hw-deck-status-badge.hw-progress-mid {
  background: #eef2ff;
  color: #4f46e5;
  border-color: #c7d2fe;
}

.hw-deck-status-badge.hw-progress-high {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.hw-deck-status-badge.hw-progress-complete {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
  animation: none;
  box-shadow: none;
}

@keyframes hw-complete-glow {
  0% {
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.1);
  }

  100% {
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  }
}

/* Deck card complete celebration border */
.hw-deck-card:has(.hw-progress-complete) {
  border-color: rgba(16, 185, 129, 0.25) !important;
}

.hw-deck-card:has(.hw-progress-high) {
  border-color: rgba(245, 158, 11, 0.15) !important;
}

/* ============================== */
/* DECK CARD LEGIBILITY & RING FIX */
/* ============================== */
/* The global light-theme compatibility rules turn the former dark tab shell
   white.  Give this compact control its own explicit light palette so every
   label remains readable, including after the tab is switched by JavaScript. */
#view-decks .hw-deck-card .hw-deck-card-info h3 {
  color: #0f172a !important;
}

#view-decks .hw-deck-card .hw-deck-tabs {
  background: #f8fafc !important;
  border-color: #dbe3f0 !important;
}

#view-decks .hw-deck-card .hw-deck-tabs button {
  min-height: 30px;
  color: #475569 !important;
  background: transparent !important;
  text-shadow: none !important;
}

#view-decks .hw-deck-card .hw-deck-tabs button:hover:not(.hw-bg-indigo-600) {
  background: #eef2ff !important;
  color: #3730a3 !important;
}

#view-decks .hw-deck-card .hw-deck-tabs button.hw-bg-indigo-600 {
  background: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.22);
}

#view-decks .hw-deck-card .hw-deck-stat {
  color: #64748b !important;
}

/* The two-tab cards used a 44px SVG inside a 54px wrapper while the label was
   centred in the wrapper.  Scale the SVG to the same box and use a full-size
   grid overlay so 0–100% never drifts down/right at any breakpoint. */
#view-decks .hw-deck-progress-ring {
  display: grid;
  place-items: center;
  isolation: isolate;
}

#view-decks .hw-deck-progress-ring svg {
  width: 100% !important;
  height: 100% !important;
}

#view-decks .hw-deck-progress-ring .hw-deck-ring-text {
  inset: 0 !important;
  display: grid;
  place-items: center;
  transform: none !important;
  margin: 0;
  color: #0f172a !important;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 1;
}


html.anki-mode-off body #hw-app-layout #unified-hud-wrapper.hud-hidden,
body #hw-app-layout #unified-hud-wrapper.hud-hidden,
html.anki-mode-off #unified-hud-wrapper.hud-hidden,
#unified-hud-wrapper.hud-hidden {
  display: none !important;
}

/* Custom CSS for VIP Crown (Vector SVG Mask - Zero Tofu, Perfect Rendering Đồng bộ Ảnh 2) */
.vip-ui-crown {
  display: inline-block !important;
  vertical-align: middle !important;
  width: 14px !important;
  height: 12px !important;
  margin-right: 3px !important;
  margin-left: 2px !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath fill='%23000' d='M309 106c11.4-7 19-19.7 19-34c0-22.1-17.9-40-40-40s-40 17.9-40 40c0 14.4 7.6 27 19 34L209.7 220.6 96.5 137.8c7.5-6.8 12.2-16.6 12.2-27.4c0-20.3-16.5-36.8-36.8-36.8S35.2 90.1 35.2 110.4c0 12.8 6.5 24 16.4 30.6L76.1 329.4c3.4 17.1 18.4 29.5 35.8 29.5l352.2 0c17.5 0 32.4-12.4 35.8-29.5l24.5-188.4c9.9-6.6 16.4-17.8 16.4-30.6c0-20.3-16.5-36.8-36.8-36.8s-36.8 16.5-36.8 36.8c0 10.9 4.7 20.6 12.2 27.4L402.3 220.6 345 106h-36zM91.7 416c-15.3 0-27.7 12.4-27.7 27.7c0 15.3 12.4 27.7 27.7 27.7l392.7 0c15.3 0 27.7-12.4 27.7-27.7c0-15.3-12.4-27.7-27.7-27.7L91.7 416z'/%3E%3C/svg%3E") no-repeat center / contain !important;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'%3E%3Cpath fill='%23000' d='M309 106c11.4-7 19-19.7 19-34c0-22.1-17.9-40-40-40s-40 17.9-40 40c0 14.4 7.6 27 19 34L209.7 220.6 96.5 137.8c7.5-6.8 12.2-16.6 12.2-27.4c0-20.3-16.5-36.8-36.8-36.8S35.2 90.1 35.2 110.4c0 12.8 6.5 24 16.4 30.6L76.1 329.4c3.4 17.1 18.4 29.5 35.8 29.5l352.2 0c17.5 0 32.4-12.4 35.8-29.5l24.5-188.4c9.9-6.6 16.4-17.8 16.4-30.6c0-20.3-16.5-36.8-36.8-36.8s-36.8 16.5-36.8 36.8c0 10.9 4.7 20.6 12.2 27.4L402.3 220.6 345 106h-36zM91.7 416c-15.3 0-27.7 12.4-27.7 27.7c0 15.3 12.4 27.7 27.7 27.7l392.7 0c15.3 0 27.7-12.4 27.7-27.7c0-15.3-12.4-27.7-27.7-27.7L91.7 416z'/%3E%3C/svg%3E") no-repeat center / contain !important;
}

.vip-ui-crown::before {
  content: "" !important;
  display: none !important;
}

.vip-ui-crown:not(.vip-ui-crown-lifetime) {
  background: linear-gradient(135deg, #FFD86B 0%, #E6A400 100%) !important;
  background-color: #E6A400 !important;
  color: #E6A400 !important;
  filter: drop-shadow(0 0 3px rgba(230, 164, 0, 0.75)) !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
}

/* VIP Trọn Đời (Lifetime VIP) - Màu xanh dương quý tộc Sapphire / Blue rõ nét */
.vip-ui-crown.vip-ui-crown-lifetime,
.vip-ui-badge-lifetime .vip-ui-crown {
  background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 35%, #2563eb 80%, #1d4ed8 100%) !important;
  background-color: #38bdf8 !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: #38bdf8 !important;
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.75)) !important;
  text-shadow: none !important;
}

.vip-ui-badge.vip-ui-badge-lifetime {
  color: #38bdf8 !important;
  text-shadow: none !important;
  filter: none !important;
}

.vip-ui-lock-crown {
  display: inline-block !important;
  vertical-align: middle !important;
  background: linear-gradient(135deg, #FFD86B 0%, #E6A400 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: #E6A400 !important;
  filter: drop-shadow(0 0 3px rgba(230, 164, 0, 0.5)) !important;
  font-size: 36px !important;
  margin-bottom: 12px !important;
  flex-shrink: 0 !important;
}

.vip-ui-modal-crown {
  display: inline-block !important;
  vertical-align: middle !important;
  background: linear-gradient(135deg, #FFD86B 0%, #E6A400 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: #E6A400 !important;
  filter: drop-shadow(0 0 4px rgba(230, 164, 0, 0.6)) !important;
  font-size: 48px !important;
  margin-bottom: 16px !important;
  flex-shrink: 0 !important;
}

/* Light theme overrides for Vòng 2 (Skills Test) */
html:not(.dark).anki-mode-off #view-rpg [class*="hw-bg-slate-900"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-bg-slate-950"],
html:not(.dark).anki-mode-off #view-rpg div.hw-glass[class*="hw-rounded-"] {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html:not(.dark).anki-mode-off #view-rpg [class*="hw-border-slate-800"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-border-slate-850"],
html:not(.dark).anki-mode-off #view-rpg .hw-border-soft {
  border-color: #e2e8f0 !important;
}

/* Inputs and textareas */
html:not(.dark).anki-mode-off #view-rpg input[class*="hw-bg-slate-950"],
html:not(.dark).anki-mode-off #view-rpg select[class*="hw-bg-slate-950"],
html:not(.dark).anki-mode-off #view-rpg .hw-bg-slate-950 {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

/* Prompter Full Text View specifically */
html:not(.dark).anki-mode-off #view-rpg #prompter-full-text-view,
html:not(.dark) #v2-view-interview #prompter-full-text-view {
  background-color: #ffffff !important;
  border-color: #d1fae5 !important;
  color: #334155 !important;
}

html:not(.dark) #v2-view-interview [class*="hw-bg-slate-900"],
html:not(.dark) #v2-view-interview [class*="hw-bg-slate-950"] {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html:not(.dark) #v2-view-interview [class*="hw-border-slate-800"],
html:not(.dark) #v2-view-interview [class*="hw-border-slate-850"] {
  border-color: #e2e8f0 !important;
}

html:not(.dark) #v2-view-interview .hw-glass {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* Text colors in light mode */
html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-100"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-200"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-300"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-350"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-100"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-200"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-300"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-350"] {
  color: #1e293b !important;
}

html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-400"],
html:not(.dark).anki-mode-off #view-rpg [class*="hw-text-slate-500"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-400"],
html:not(.dark) #v2-view-interview [class*="hw-text-slate-500"] {
  color: #64748b !important;
}

/* Buttons like copy button and copyPrompterText */
html:not(.dark).anki-mode-off #view-rpg button[class*="hw-bg-slate-850"],
html:not(.dark).anki-mode-off #view-rpg button.v2-btn-secondary {
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

html:not(.dark).anki-mode-off #view-rpg button[class*="hw-bg-slate-850"]:hover,
html:not(.dark).anki-mode-off #view-rpg button.v2-btn-secondary:hover {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}

html:not(.dark) #v2-view-interview .interview-copy-btn,
html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"] {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #bbf7d0 !important;
  color: #047857 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

html:not(.dark) #v2-view-interview .interview-copy-btn:hover,
html:not(.dark) #v2-view-interview .interview-copy-btn:focus-visible,
html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:hover,
html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:focus-visible {
  background: #ecfdf5 !important;
  background-color: #ecfdf5 !important;
  border-color: #86efac !important;
  color: #065f46 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12) !important;
}

html:not(.dark) #v2-view-interview .interview-copy-btn:active,
html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"]:active {
  background: #d1fae5 !important;
  background-color: #d1fae5 !important;
}

html:not(.dark) #v2-view-interview .interview-copy-btn *,
html:not(.dark) #v2-view-interview button[onclick="copyPrompterText()"] * {
  color: inherit !important;
}

/* =====================================================================
   ROUND 2 INTERVIEW (PHỎNG VẤN VÒNG 2) - HIGH CONTRAST DARK MODE (Ảnh 1 & 2)
   ===================================================================== */
html.dark #v2-view-interview .hw-glass,
html.dark #v2-view-interview div.hw-glass {
  background-color: #0f172a !important;
  background: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

html.dark #v2-view-interview .hw-bg-white,
html.dark #v2-view-interview [class*="hw-bg-white"] {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-view-interview [class*="hw-bg-slate-950"],
html.dark #v2-view-interview [class*="hw-bg-slate-900"] {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-view-interview .hw-bg-surface {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
}

html.dark #v2-view-interview [class*="hw-border-emerald-100"],
html.dark #v2-view-interview [class*="hw-border-emerald-200"],
html.dark #v2-view-interview [class*="hw-border-soft"],
html.dark #v2-view-interview [class*="hw-border-slate-800"],
html.dark #v2-view-interview [class*="hw-border-slate-100"],
html.dark #v2-view-interview [class*="hw-border-slate-200"] {
  border-color: #1e293b !important;
}

html.dark #v2-view-interview .v2-template-btn-active {
  background-color: #312e81 !important;
  border-color: #6366f1 !important;
  color: #e0e7ff !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35) !important;
}

html.dark #v2-view-interview .v2-template-btn-inactive {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html.dark #v2-view-interview .v2-template-btn-inactive:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark #v2-view-interview input[data-intro-key],
html.dark #v2-view-interview input[type="text"].hw-bg-white,
html.dark #v2-view-interview input.hw-bg-white {
  background-color: #0b0f19 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark #v2-view-interview input[data-intro-key]:focus,
html.dark #v2-view-interview input[type="text"].hw-bg-white:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25) !important;
}

html.dark #v2-view-interview label {
  color: #94a3b8 !important;
}

html.dark #v2-view-interview #self-intro-ai-feedback {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #6ee7b7 !important;
}

html.dark #v2-view-interview #prompter-speech-panel {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

html.dark #v2-view-interview #prompter-speech-panel .hw-bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}

html.dark #v2-view-interview #prompter-speech-panel .hw-bg-slate-50 {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
}

html.dark #v2-view-interview #prompter-score-value {
  color: #34d399 !important;
}

html.dark #v2-view-interview #prompter-score-label {
  color: #94a3b8 !important;
}

html.dark #v2-view-interview #prompter-record-status {
  color: #f1f5f9 !important;
}

html.dark #v2-view-interview #prompter-transcript-preview {
  color: #94a3b8 !important;
}

html.dark #v2-view-interview #prompter-replay-btn {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

html.dark #v2-view-interview #prompter-rescore-btn {
  background-color: rgba(99, 102, 241, 0.2) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  color: #a5b4fc !important;
}

html.dark #v2-view-interview #prompter-full-text-view {
  background-color: #0b0f19 !important;
  background: #0b0f19 !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6) !important;
}

html.dark #v2-view-interview .self-intro-sentence-row {
  border-color: transparent !important;
  color: #f8fafc !important;
}

html.dark #v2-view-interview .self-intro-sentence-row:hover {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}

html.dark #v2-view-interview .self-intro-sentence-row.hw-bg-emerald-100\/90 {
  background-color: rgba(16, 185, 129, 0.25) !important;
  border-color: #10b981 !important;
}

html.dark #v2-view-interview .self-intro-sentence-content {
  color: #f8fafc !important;
}

html.dark #v2-view-interview .self-intro-sentence-row span.hw-rounded-full {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html.dark #v2-view-interview .self-intro-sentence-speaker {
  background-color: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #6ee7b7 !important;
}

html.dark #v2-view-interview .self-intro-sentence-speaker:hover {
  background-color: #059669 !important;
  color: #ffffff !important;
}

html.dark #v2-view-interview .interview-copy-btn,
html.dark #v2-view-interview button[onclick="copyPrompterText()"] {
  background: #1e293b !important;
  background-color: #1e293b !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #6ee7b7 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

html.dark #v2-view-interview .interview-copy-btn:hover,
html.dark #v2-view-interview button[onclick="copyPrompterText()"]:hover {
  background: rgba(16, 185, 129, 0.2) !important;
  background-color: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #a7f3d0 !important;
}

html.dark #v2-view-interview h4[id$="-q-korean"],
html.dark #v2-view-interview .v2-question-text,
html.dark #basic-player-q-korean,
html.dark #commands-player-q-korean,
html.dark #units-player-q-korean,
html.dark #scenarios-player-q-korean,
html.dark #rules-player-q-korean,
html.dark #action-instructions-player-q-korean,
html.dark #calc-player-q-korean {
  color: #38bdf8 !important;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

html.dark #v2-view-interview p[id$="-q-viet"],
html.dark #v2-view-interview .v2-vietnamese-text,
html.dark #basic-player-q-viet,
html.dark #commands-player-q-viet,
html.dark #units-player-q-viet,
html.dark #scenarios-player-q-viet,
html.dark #rules-player-q-viet,
html.dark #action-instructions-player-q-viet,
html.dark #calc-player-q-viet {
  color: #94a3b8 !important;
}

html.dark #v2-view-interview p[id$="-a-korean"],
html.dark #v2-view-interview .v2-answer-ko-text,
html.dark #basic-player-a-korean,
html.dark #commands-player-a-korean,
html.dark #units-player-a-korean,
html.dark #scenarios-player-a-korean,
html.dark #rules-player-a-korean,
html.dark #action-instructions-player-a-korean,
html.dark #calc-player-a-korean {
  color: #e0e7ff !important;
}

html.dark #v2-view-interview p[id$="-a-viet"],
html.dark #v2-view-interview .v2-answer-vi-text,
html.dark #basic-player-a-viet,
html.dark #commands-player-a-viet,
html.dark #units-player-a-viet,
html.dark #scenarios-player-a-viet,
html.dark #rules-player-a-viet,
html.dark #action-instructions-player-a-viet,
html.dark #calc-player-a-viet {
  color: #cbd5e1 !important;
}

html.dark #v2-view-interview .v2-player-control-btn,
html.dark #v2-view-interview button.hw-bg-white {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #v2-view-interview .v2-player-control-btn:hover,
html.dark #v2-view-interview button.hw-bg-white:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* ==========================================================================
   V2 SEGMENTED ANSWER TABS (Compact, Balanced, Crystal-clean Light & Dark)
   ========================================================================== */

.v2-answer-tab-bar {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  padding: 3px !important;
  background-color: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  scrollbar-width: none;
}

.v2-answer-tab-bar::-webkit-scrollbar {
  display: none;
}

html.dark .v2-answer-tab-bar,
html[data-theme="dark"] .v2-answer-tab-bar,
.dark .v2-answer-tab-bar,
html.dark #v2-view-interview .v2-answer-tab-bar,
html[data-theme="dark"] #v2-view-interview .v2-answer-tab-bar,
.dark #v2-view-interview .v2-answer-tab-bar {
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

.v2-answer-tab-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 4px 9px !important;
  height: 30px !important;
  min-height: 30px !important;
  border-radius: 7px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  border: 1px solid transparent !important;
  background-color: transparent !important;
  color: #475569 !important;
  cursor: pointer !important;
  transition: all 0.15s ease-in-out !important;
  flex-shrink: 0 !important;
  user-select: none !important;
  box-shadow: none !important;
}

.v2-answer-tab-btn:hover {
  color: #0f172a !important;
  background-color: rgba(255, 255, 255, 0.7) !important;
}

html.dark .v2-answer-tab-btn,
html[data-theme="dark"] .v2-answer-tab-btn,
.dark .v2-answer-tab-btn {
  color: #94a3b8 !important;
}

html.dark .v2-answer-tab-btn:hover,
html[data-theme="dark"] .v2-answer-tab-btn:hover,
.dark .v2-answer-tab-btn:hover {
  color: #f8fafc !important;
  background-color: rgba(30, 41, 59, 0.7) !important;
}

/* Active State */
.v2-answer-tab-btn.is-active {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.v2-answer-tab-btn.is-active.accent-emerald {
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}

.v2-answer-tab-btn.is-active.accent-indigo {
  color: #4338ca !important;
  border-color: #c7d2fe !important;
}

html.dark .v2-answer-tab-btn.is-active,
html[data-theme="dark"] .v2-answer-tab-btn.is-active,
.dark .v2-answer-tab-btn.is-active {
  background-color: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

html.dark .v2-answer-tab-btn.is-active.accent-emerald,
html[data-theme="dark"] .v2-answer-tab-btn.is-active.accent-emerald,
.dark .v2-answer-tab-btn.is-active.accent-emerald {
  color: #34d399 !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
}

html.dark .v2-answer-tab-btn.is-active.accent-indigo,
html[data-theme="dark"] .v2-answer-tab-btn.is-active.accent-indigo,
.dark .v2-answer-tab-btn.is-active.accent-indigo {
  color: #a5b4fc !important;
  border-color: rgba(165, 180, 252, 0.4) !important;
}

/* Badges inside Tab Buttons */
.v2-answer-tab-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 1.5px 5.5px !important;
  border-radius: 4px !important;
  font-size: 9px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  white-space: nowrap !important;
  letter-spacing: -0.2px !important;
}

.v2-answer-tab-badge.badge-emerald {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

html.dark .v2-answer-tab-badge.badge-emerald,
html[data-theme="dark"] .v2-answer-tab-badge.badge-emerald,
.dark .v2-answer-tab-badge.badge-emerald {
  background-color: rgba(16, 185, 129, 0.2) !important;
  color: #6ee7b7 !important;
  border-color: rgba(110, 231, 183, 0.35) !important;
}

.v2-answer-tab-badge.badge-amber {
  background-color: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

html.dark .v2-answer-tab-badge.badge-amber,
html[data-theme="dark"] .v2-answer-tab-badge.badge-amber,
.dark .v2-answer-tab-badge.badge-amber {
  background-color: rgba(245, 158, 11, 0.2) !important;
  color: #fde047 !important;
  border-color: rgba(253, 224, 71, 0.35) !important;
}

.v2-answer-tab-badge.badge-sky {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
}

html.dark .v2-answer-tab-badge.badge-sky,
html[data-theme="dark"] .v2-answer-tab-badge.badge-sky,
.dark .v2-answer-tab-badge.badge-sky {
  background-color: rgba(14, 165, 233, 0.2) !important;
  color: #7dd3fc !important;
  border-color: rgba(125, 211, 252, 0.35) !important;
}

.v2-answer-info-card {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

html.dark .v2-answer-tag,
html[data-theme="dark"] .v2-answer-tag,
.dark .v2-answer-tag,
html.anki-mode-on .v2-answer-tag,
html.dark #v2-view-interview .v2-answer-tag {
  background-color: rgba(99, 102, 241, 0.16) !important;
  border: 1px solid rgba(129, 140, 248, 0.35) !important;
  color: #a5b4fc !important;
}

/* ==========================================================================
   V2 SIMULATION & SMART LIST MODAL (Dark Mode Support)
   ========================================================================== */
html.dark #v2-view-simulation .hw-bg-white,
html[data-theme="dark"] #v2-view-simulation .hw-bg-white,
html.anki-mode-on #v2-view-simulation .hw-bg-white,
.dark #v2-view-simulation .hw-bg-white,
html.dark #v2-view-simulation [class*="hw-bg-white"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-bg-white"],
html.anki-mode-on #v2-view-simulation [class*="hw-bg-white"],
.dark #v2-view-simulation [class*="hw-bg-white"],
html.dark #v2-view-simulation [class*="hw-bg-slate-50"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-bg-slate-50"],
html.anki-mode-on #v2-view-simulation [class*="hw-bg-slate-50"],
.dark #v2-view-simulation [class*="hw-bg-slate-50"],
html.dark #v2-sim-smart-list-modal .hw-bg-white,
html[data-theme="dark"] #v2-sim-smart-list-modal .hw-bg-white,
html.anki-mode-on #v2-sim-smart-list-modal .hw-bg-white,
.dark #v2-sim-smart-list-modal .hw-bg-white,
html.dark #v2-sim-smart-list-modal [class*="hw-bg-white"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-white"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-bg-white"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-white"],
html.dark #v2-sim-smart-list-modal [class*="hw-bg-slate-50"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-bg-slate-50"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-bg-slate-50"],
.dark #v2-sim-smart-list-modal [class*="hw-bg-slate-50"],
html.dark .v2-smart-modal-box,
html[data-theme="dark"] .v2-smart-modal-box,
html.anki-mode-on .v2-smart-modal-box,
.dark .v2-smart-modal-box {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-view-simulation .v2-smart-modal-box,
html[data-theme="dark"] #v2-view-simulation .v2-smart-modal-box,
html.anki-mode-on #v2-view-simulation .v2-smart-modal-box,
.dark #v2-view-simulation .v2-smart-modal-box,
html.dark #v2-sim-smart-list-modal .v2-smart-modal-box,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-smart-modal-box,
html.anki-mode-on #v2-sim-smart-list-modal .v2-smart-modal-box,
.dark #v2-sim-smart-list-modal .v2-smart-modal-box {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .v2-smart-modal-header,
html[data-theme="dark"] .v2-smart-modal-header,
html.anki-mode-on .v2-smart-modal-header,
.dark .v2-smart-modal-header,
html.dark .v2-smart-modal-search-area,
html[data-theme="dark"] .v2-smart-modal-search-area,
html.anki-mode-on .v2-smart-modal-search-area,
.dark .v2-smart-modal-search-area,
html.dark .v2-smart-modal-footer,
html[data-theme="dark"] .v2-smart-modal-footer,
html.anki-mode-on .v2-smart-modal-footer,
.dark .v2-smart-modal-footer {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-sim-smart-list-modal .v2-smart-list-scroll,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-smart-list-scroll,
html.anki-mode-on #v2-sim-smart-list-modal .v2-smart-list-scroll,
.dark #v2-sim-smart-list-modal .v2-smart-list-scroll {
  background-color: #020617 !important;
}

html.dark #v2-sim-smart-list-modal .v2-sim-smart-item,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item,
html.anki-mode-on #v2-sim-smart-list-modal .v2-sim-smart-item,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-sim-smart-list-modal .v2-sim-smart-item:hover,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item:hover,
html.anki-mode-on #v2-sim-smart-list-modal .v2-sim-smart-item:hover,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item:hover {
  background-color: #1e293b !important;
  border-color: #8b5cf6 !important;
}

html.dark #v2-sim-smart-list-modal .v2-sim-smart-item-active,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-sim-smart-item-active,
html.anki-mode-on #v2-sim-smart-list-modal .v2-sim-smart-item-active,
.dark #v2-sim-smart-list-modal .v2-sim-smart-item-active {
  background-color: rgba(109, 40, 217, 0.25) !important;
  border-color: #8b5cf6 !important;
}

html.dark #v2-sim-smart-list-modal input#v2-sim-smart-search-input,
html[data-theme="dark"] #v2-sim-smart-list-modal input#v2-sim-smart-search-input,
html.anki-mode-on #v2-sim-smart-list-modal input#v2-sim-smart-search-input,
.dark #v2-sim-smart-list-modal input#v2-sim-smart-search-input {
  background-color: #020617 !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .v2-smart-filter-pill:not(.hw-bg-violet-600),
html[data-theme="dark"] .v2-smart-filter-pill:not(.hw-bg-violet-600),
html.anki-mode-on .v2-smart-filter-pill:not(.hw-bg-violet-600),
.dark .v2-smart-filter-pill:not(.hw-bg-violet-600) {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #v2-sim-smart-list-modal .v2-thumb-multi,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-thumb-multi,
html.anki-mode-on #v2-sim-smart-list-modal .v2-thumb-multi,
.dark #v2-sim-smart-list-modal .v2-thumb-multi,
html.dark #v2-sim-smart-list-modal .v2-thumb-single,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-thumb-single,
html.anki-mode-on #v2-sim-smart-list-modal .v2-thumb-single,
.dark #v2-sim-smart-list-modal .v2-thumb-single {
  background-color: #020617 !important;
  border-color: #334155 !important;
}

html.dark #v2-sim-smart-list-modal span.hw-bg-slate-100,
html[data-theme="dark"] #v2-sim-smart-list-modal span.hw-bg-slate-100,
html.anki-mode-on #v2-sim-smart-list-modal span.hw-bg-slate-100,
.dark #v2-sim-smart-list-modal span.hw-bg-slate-100 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html.dark #v2-sim-smart-list-modal span.hw-bg-sky-50,
html[data-theme="dark"] #v2-sim-smart-list-modal span.hw-bg-sky-50,
html.anki-mode-on #v2-sim-smart-list-modal span.hw-bg-sky-50,
.dark #v2-sim-smart-list-modal span.hw-bg-sky-50 {
  background-color: rgba(14, 165, 233, 0.15) !important;
  border-color: rgba(14, 165, 233, 0.3) !important;
  color: #38bdf8 !important;
}

html.dark #v2-sim-smart-list-modal span.hw-bg-amber-50,
html[data-theme="dark"] #v2-sim-smart-list-modal span.hw-bg-amber-50,
html.anki-mode-on #v2-sim-smart-list-modal span.hw-bg-amber-50,
.dark #v2-sim-smart-list-modal span.hw-bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}

html.dark #v2-sim-smart-list-modal span.hw-bg-violet-50,
html[data-theme="dark"] #v2-sim-smart-list-modal span.hw-bg-violet-50,
html.anki-mode-on #v2-sim-smart-list-modal span.hw-bg-violet-50,
.dark #v2-sim-smart-list-modal span.hw-bg-violet-50 {
  background-color: rgba(139, 92, 246, 0.15) !important;
  border-color: rgba(139, 92, 246, 0.3) !important;
  color: #c084fc !important;
}

html.dark #v2-sim-smart-list-modal .v2-smart-preview-btn,
html[data-theme="dark"] #v2-sim-smart-list-modal .v2-smart-preview-btn,
html.anki-mode-on #v2-sim-smart-list-modal .v2-smart-preview-btn,
.dark #v2-sim-smart-list-modal .v2-smart-preview-btn {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}

html.dark #v2-view-simulation [class*="hw-border-slate-200"],
html.dark #v2-view-simulation [class*="hw-border-slate-300"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-border-slate-200"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-border-slate-300"],
html.anki-mode-on #v2-view-simulation [class*="hw-border-slate-200"],
html.anki-mode-on #v2-view-simulation [class*="hw-border-slate-300"],
.dark #v2-view-simulation [class*="hw-border-slate-200"],
.dark #v2-view-simulation [class*="hw-border-slate-300"],
html.dark #v2-sim-smart-list-modal [class*="hw-border-slate-200"],
html.dark #v2-sim-smart-list-modal [class*="hw-border-slate-300"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-border-slate-200"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-border-slate-300"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-border-slate-200"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-border-slate-300"],
.dark #v2-sim-smart-list-modal [class*="hw-border-slate-200"],
.dark #v2-sim-smart-list-modal [class*="hw-border-slate-300"] {
  border-color: #1e293b !important;
}

html.dark #v2-view-simulation [class*="hw-text-slate-900"],
html.dark #v2-view-simulation [class*="hw-text-slate-800"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-text-slate-900"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-text-slate-800"],
html.anki-mode-on #v2-view-simulation [class*="hw-text-slate-900"],
html.anki-mode-on #v2-view-simulation [class*="hw-text-slate-800"],
.dark #v2-view-simulation [class*="hw-text-slate-900"],
.dark #v2-view-simulation [class*="hw-text-slate-800"],
html.dark #v2-sim-smart-list-modal [class*="hw-text-slate-900"],
html.dark #v2-sim-smart-list-modal [class*="hw-text-slate-800"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-text-slate-900"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-text-slate-800"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-text-slate-900"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-text-slate-800"],
.dark #v2-sim-smart-list-modal [class*="hw-text-slate-900"],
.dark #v2-sim-smart-list-modal [class*="hw-text-slate-800"] {
  color: #f8fafc !important;
}

html.dark #v2-view-simulation [class*="hw-text-slate-700"],
html.dark #v2-view-simulation [class*="hw-text-slate-600"],
html.dark #v2-view-simulation [class*="hw-text-slate-500"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-text-slate-700"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-text-slate-600"],
html[data-theme="dark"] #v2-view-simulation [class*="hw-text-slate-500"],
html.anki-mode-on #v2-view-simulation [class*="hw-text-slate-700"],
html.anki-mode-on #v2-view-simulation [class*="hw-text-slate-600"],
html.anki-mode-on #v2-view-simulation [class*="hw-text-slate-500"],
.dark #v2-view-simulation [class*="hw-text-slate-700"],
.dark #v2-view-simulation [class*="hw-text-slate-600"],
.dark #v2-view-simulation [class*="hw-text-slate-500"],
html.dark #v2-sim-smart-list-modal [class*="hw-text-slate-700"],
html.dark #v2-sim-smart-list-modal [class*="hw-text-slate-600"],
html.dark #v2-sim-smart-list-modal [class*="hw-text-slate-500"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-text-slate-700"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-text-slate-600"],
html[data-theme="dark"] #v2-sim-smart-list-modal [class*="hw-text-slate-500"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-text-slate-700"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-text-slate-600"],
html.anki-mode-on #v2-sim-smart-list-modal [class*="hw-text-slate-500"],
.dark #v2-sim-smart-list-modal [class*="hw-text-slate-700"],
.dark #v2-sim-smart-list-modal [class*="hw-text-slate-600"],
.dark #v2-sim-smart-list-modal [class*="hw-text-slate-500"] {
  color: #94a3b8 !important;
}

html.dark #v2-view-simulation button.hw-bg-white,
html.dark #v2-view-simulation button.hw-bg-slate-50,
html[data-theme="dark"] #v2-view-simulation button.hw-bg-white,
html[data-theme="dark"] #v2-view-simulation button.hw-bg-slate-50,
html.anki-mode-on #v2-view-simulation button.hw-bg-white,
html.anki-mode-on #v2-view-simulation button.hw-bg-slate-50,
.dark #v2-view-simulation button.hw-bg-white,
.dark #v2-view-simulation button.hw-bg-slate-50,
html.dark #v2-sim-smart-list-modal button.hw-bg-white,
html.dark #v2-sim-smart-list-modal button.hw-bg-slate-50,
html[data-theme="dark"] #v2-sim-smart-list-modal button.hw-bg-white,
html[data-theme="dark"] #v2-sim-smart-list-modal button.hw-bg-slate-50,
html.anki-mode-on #v2-sim-smart-list-modal button.hw-bg-white,
html.anki-mode-on #v2-sim-smart-list-modal button.hw-bg-slate-50,
.dark #v2-sim-smart-list-modal button.hw-bg-white,
.dark #v2-sim-smart-list-modal button.hw-bg-slate-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #v2-view-simulation button.hw-bg-white:hover,
html.dark #v2-view-simulation button.hw-bg-slate-50:hover,
html[data-theme="dark"] #v2-view-simulation button.hw-bg-white:hover,
html[data-theme="dark"] #v2-view-simulation button.hw-bg-slate-50:hover,
html.anki-mode-on #v2-view-simulation button.hw-bg-white:hover,
html.anki-mode-on #v2-view-simulation button.hw-bg-slate-50:hover,
.dark #v2-view-simulation button.hw-bg-white:hover,
.dark #v2-view-simulation button.hw-bg-slate-50:hover,
html.dark #v2-sim-smart-list-modal button.hw-bg-white:hover,
html.dark #v2-sim-smart-list-modal button.hw-bg-slate-50:hover,
html[data-theme="dark"] #v2-sim-smart-list-modal button.hw-bg-white:hover,
html[data-theme="dark"] #v2-sim-smart-list-modal button.hw-bg-slate-50:hover,
html.anki-mode-on #v2-sim-smart-list-modal button.hw-bg-white:hover,
html.anki-mode-on #v2-sim-smart-list-modal button.hw-bg-slate-50:hover,
.dark #v2-sim-smart-list-modal button.hw-bg-white:hover,
.dark #v2-sim-smart-list-modal button.hw-bg-slate-50:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* ============================================================
   EPS TOPIK ROUND 2: EXAM WORKBENCH 6-SLOT TRAY (VÙNG THAO TÁC 6 Ô CỐ ĐỊNH)
   ============================================================ */
.v2-sim-desk-tray {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, 1.2vw, 10px);
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 2px 0;
  box-sizing: border-box;
}

.v2-sim-desk-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1.12;
  min-height: 52px;
  max-height: 96px;
  border-radius: 12px;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

/* Slot trống (Empty Slot) */
.v2-sim-desk-slot.is-empty {
  border: 2px dashed rgba(186, 230, 253, 0.65);
  background-color: rgba(12, 74, 110, 0.35);
  color: #e0f2fe;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.v2-sim-desk-slot.is-empty:hover {
  border-color: rgba(224, 242, 254, 0.95);
  background-color: rgba(12, 74, 110, 0.55);
  transform: translateY(-1px);
}

.v2-sim-desk-slot.is-empty:active {
  transform: scale(0.96);
}

/* Slot đang kích hoạt / chọn (Active Slot) */
.v2-sim-desk-slot.is-active {
  border-color: #facc15 !important;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.5), inset 0 0 8px rgba(234, 179, 8, 0.25) !important;
  background-color: rgba(113, 63, 18, 0.5) !important;
}

/* Slot đã đặt vật phẩm (Filled Slot) */
.v2-sim-desk-slot.is-filled {
  border: 2px solid #7dd3fc;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -2px rgba(0, 0, 0, 0.15);
  padding: 3px;
}

.v2-sim-desk-slot.is-filled:hover {
  transform: scale(1.04);
}

.v2-sim-desk-slot.is-filled:active {
  transform: scale(0.96);
}

html.dark .v2-sim-desk-slot.is-filled,
html[data-theme="dark"] .v2-sim-desk-slot.is-filled,
html.anki-mode-on .v2-sim-desk-slot.is-filled,
.dark .v2-sim-desk-slot.is-filled {
  background-color: rgba(15, 23, 42, 0.95) !important;
  border-color: #0284c7 !important;
}

/* Badge số thứ tự 1..6 */
.v2-sim-desk-slot-badge {
  position: absolute;
  top: -6px;
  left: -4px;
  width: 17px;
  height: 17px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 800;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

@media (min-width: 640px) {
  .v2-sim-desk-slot-badge {
    top: -7px;
    left: -5px;
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
}

/* Nút gỡ vật phẩm (X) */
.v2-sim-desk-slot-remove {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 17px;
  height: 17px;
  border-radius: 9999px;
  background-color: #ef4444;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 900;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  z-index: 20;
  transition: all 0.15s ease;
}

.v2-sim-desk-slot-remove:hover {
  background-color: #dc2626;
  transform: scale(1.1);
}

.v2-sim-desk-slot-remove:active {
  transform: scale(0.9);
}

@media (min-width: 640px) {
  .v2-sim-desk-slot-remove {
    top: -7px;
    right: -5px;
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
}

/* Ảnh vật phẩm trong slot */
.v2-sim-desk-slot-img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}


html.dark .v2-panel-custom-badge,
html[data-theme="dark"] .v2-panel-custom-badge,
.dark .v2-panel-custom-badge,
html.anki-mode-on .v2-panel-custom-badge {
  background-color: rgba(16, 185, 129, 0.16) !important;
  border: 1px solid rgba(52, 211, 153, 0.35) !important;
  color: #34d399 !important;
}

/* Round 2 Action Buttons in Answer Panel */
html.dark .v2-header-icon-btn.hw-bg-rose-50,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-rose-50,
.dark .v2-header-icon-btn.hw-bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.15) !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
  color: #fb7185 !important;
}

html.dark .v2-header-icon-btn.hw-bg-rose-50:hover,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-rose-50:hover,
.dark .v2-header-icon-btn.hw-bg-rose-50:hover {
  background-color: rgba(244, 63, 94, 0.28) !important;
}

html.dark .v2-header-icon-btn.hw-bg-sky-50,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-sky-50,
.dark .v2-header-icon-btn.hw-bg-sky-50 {
  background-color: rgba(14, 165, 233, 0.15) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #38bdf8 !important;
}

html.dark .v2-header-icon-btn.hw-bg-sky-50:hover,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-sky-50:hover,
.dark .v2-header-icon-btn.hw-bg-sky-50:hover {
  background-color: rgba(14, 165, 233, 0.28) !important;
}

html.dark .v2-header-icon-btn.hw-bg-teal-50,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-teal-50,
.dark .v2-header-icon-btn.hw-bg-teal-50 {
  background-color: rgba(20, 184, 166, 0.15) !important;
  border-color: rgba(45, 212, 191, 0.35) !important;
  color: #2dd4bf !important;
}

html.dark .v2-header-icon-btn.hw-bg-teal-50:hover,
html[data-theme="dark"] .v2-header-icon-btn.hw-bg-teal-50:hover,
.dark .v2-header-icon-btn.hw-bg-teal-50:hover {
  background-color: rgba(20, 184, 166, 0.28) !important;
}

html.dark .v2-header-pill-btn.hw-bg-emerald-50,
html[data-theme="dark"] .v2-header-pill-btn.hw-bg-emerald-50,
.dark .v2-header-pill-btn.hw-bg-emerald-50 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
  color: #34d399 !important;
}

html.dark .v2-header-pill-btn.hw-bg-emerald-50:hover,
html[data-theme="dark"] .v2-header-pill-btn.hw-bg-emerald-50:hover,
.dark .v2-header-pill-btn.hw-bg-emerald-50:hover {
  background-color: rgba(16, 185, 129, 0.28) !important;
}

html.dark .v2-header-pill-btn.hw-bg-indigo-50,
html[data-theme="dark"] .v2-header-pill-btn.hw-bg-indigo-50,
.dark .v2-header-pill-btn.hw-bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(129, 140, 248, 0.35) !important;
  color: #a5b4fc !important;
}

html.dark .v2-header-pill-btn.hw-bg-indigo-50:hover,
html[data-theme="dark"] .v2-header-pill-btn.hw-bg-indigo-50:hover,
.dark .v2-header-pill-btn.hw-bg-indigo-50:hover {
  background-color: rgba(99, 102, 241, 0.28) !important;
}

/* Mic Button Dark Mode */
html.dark .v2-mic-pill-btn,
html[data-theme="dark"] .v2-mic-pill-btn,
.dark .v2-mic-pill-btn,
html.anki-mode-on .v2-mic-pill-btn {
  background-color: rgba(244, 63, 94, 0.15) !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
  color: #fb7185 !important;
}

html.dark .v2-mic-pill-btn:hover,
html[data-theme="dark"] .v2-mic-pill-btn:hover,
.dark .v2-mic-pill-btn:hover,
html.anki-mode-on .v2-mic-pill-btn:hover {
  background-color: rgba(244, 63, 94, 0.25) !important;
  border-color: rgba(244, 63, 94, 0.5) !important;
  color: #fda4af !important;
}

html.dark .v2-mic-pill-btn.hw-bg-indigo-50,
html[data-theme="dark"] .v2-mic-pill-btn.hw-bg-indigo-50,
.dark .v2-mic-pill-btn.hw-bg-indigo-50,
html.anki-mode-on .v2-mic-pill-btn.hw-bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(129, 140, 248, 0.35) !important;
  color: #a5b4fc !important;
}

html.dark div[id$="-player-mic-feedback"],
html[data-theme="dark"] div[id$="-player-mic-feedback"],
.dark div[id$="-player-mic-feedback"],
html.anki-mode-on div[id$="-player-mic-feedback"] {
  color: #94a3b8 !important;
}

/* Answer Divider Dark Mode */
.v2-answer-action-divider {
  border-top: 1px solid #f1f5f9;
}

html.dark .v2-answer-action-divider,
html[data-theme="dark"] .v2-answer-action-divider,
.dark .v2-answer-action-divider,
html.anki-mode-on .v2-answer-action-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Soft Border and Background Dark Tokens */
.hw-border-soft {
  border-color: #e2e8f0;
}

.hw-bg-soft {
  background-color: #f8fafc;
}

.hw-bg-surface {
  background-color: #ffffff;
}

:hover.hw-bg-hover,
.hover\:hw-bg-hover:hover {
  background-color: #f1f5f9;
}

html.dark .hw-border-soft,
html[data-theme="dark"] .hw-border-soft,
.dark .hw-border-soft,
html.anki-mode-on .hw-border-soft,
html.dark .hw-border-slate-100,
html[data-theme="dark"] .hw-border-slate-100,
.dark .hw-border-slate-100,
html.anki-mode-on .hw-border-slate-100,
html.dark .hw-border-slate-200,
html[data-theme="dark"] .hw-border-slate-200,
.dark .hw-border-slate-200,
html.anki-mode-on .hw-border-slate-200,
html.dark .v2-answer-action-divider,
html[data-theme="dark"] .v2-answer-action-divider,
.dark .v2-answer-action-divider,
html.anki-mode-on .v2-answer-action-divider {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .hw-bg-soft,
html[data-theme="dark"] .hw-bg-soft,
.dark .hw-bg-soft,
html.anki-mode-on .hw-bg-soft {
  background-color: rgba(15, 23, 42, 0.6) !important;
}

html.dark .hw-bg-surface,
html[data-theme="dark"] .hw-bg-surface,
.dark .hw-bg-surface,
html.anki-mode-on .hw-bg-surface {
  background-color: rgba(11, 15, 25, 0.8) !important;
}

html.dark :hover.hw-bg-hover,
html.dark .hover\:hw-bg-hover:hover,
html[data-theme="dark"] :hover.hw-bg-hover,
html[data-theme="dark"] .hover\:hw-bg-hover:hover,
.dark :hover.hw-bg-hover,
.dark .hover\:hw-bg-hover:hover,
html.anki-mode-on :hover.hw-bg-hover,
html.anki-mode-on .hover\:hw-bg-hover:hover {
  background-color: rgba(30, 41, 59, 0.8) !important;
}

/* Global Slate Border Dark Overrides */
html.dark .hw-border-slate-100,
html[data-theme="dark"] .hw-border-slate-100,
.dark .hw-border-slate-100,
html.anki-mode-on .hw-border-slate-100 {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .hw-border-slate-200,
html[data-theme="dark"] .hw-border-slate-200,
.dark .hw-border-slate-200,
html.anki-mode-on .hw-border-slate-200 {
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark .hw-border-slate-300,
html[data-theme="dark"] .hw-border-slate-300,
.dark .hw-border-slate-300,
html.anki-mode-on .hw-border-slate-300 {
  border-color: rgba(255, 255, 255, 0.16) !important;
}

/* Category buttons in compact strip */
html.dark .v2-cat-btn-compact.v2-cat-btn-inactive,
html[data-theme="dark"] .v2-cat-btn-compact.v2-cat-btn-inactive,
.dark .v2-cat-btn-compact.v2-cat-btn-inactive,
html.anki-mode-on .v2-cat-btn-compact.v2-cat-btn-inactive {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark .v2-cat-btn-compact.v2-cat-btn-inactive:hover,
html[data-theme="dark"] .v2-cat-btn-compact.v2-cat-btn-inactive:hover,
.dark .v2-cat-btn-compact.v2-cat-btn-inactive:hover,
html.anki-mode-on .v2-cat-btn-compact.v2-cat-btn-inactive:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .v2-cat-btn-compact.v2-cat-btn-active,
html[data-theme="dark"] .v2-cat-btn-compact.v2-cat-btn-active,
.dark .v2-cat-btn-compact.v2-cat-btn-active,
html.anki-mode-on .v2-cat-btn-compact.v2-cat-btn-active {
  background-color: #312e81 !important;
  border-color: #6366f1 !important;
  color: #e0e7ff !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35) !important;
}


html.dark #v2-view-interview .v2-player-q-item {
  background-color: #111827 !important;
  border-color: #1e293b !important;
  color: #cbd5e1 !important;
}

html.dark #v2-view-interview .v2-player-q-item:hover {
  background-color: #1e293b !important;
}

html.dark #v2-view-interview .v2-q-idx-badge {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}

html.dark #v2-view-interview .v2-ko-text {
  color: #f8fafc !important;
}

html.dark #v2-view-interview .v2-vi-text {
  color: #94a3b8 !important;
}

/* Tools, Signs, Safety Flashcard Answer Panels (Image 1) */
html.dark #v2-tools-answer-panel,
html.dark #v2-signs-answer-panel,
html.dark #v2-safety-answer-panel {
  background-color: #131b2e !important;
  background: #131b2e !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark #v2-tools-answer-panel .hw-bg-white,
html.dark #v2-signs-answer-panel .hw-bg-white,
html.dark #v2-safety-answer-panel .hw-bg-white {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
}

html.dark #v2-tools-answer-panel .hw-bg-slate-50,
html.dark #v2-signs-answer-panel .hw-bg-slate-50,
html.dark #v2-safety-answer-panel .hw-bg-slate-50 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark #v2-tools-answer-panel .hw-bg-indigo-50,
html.dark #v2-signs-answer-panel .hw-bg-indigo-50,
html.dark #v2-safety-answer-panel .hw-bg-indigo-50 {
  background-color: rgba(99, 102, 241, 0.2) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-rose-50,
html.dark #v2-signs-answer-panel .hw-bg-rose-50,
html.dark #v2-safety-answer-panel .hw-bg-rose-50 {
  background-color: rgba(244, 63, 94, 0.2) !important;
  color: #fda4af !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-emerald-50\/50,
html.dark #v2-signs-answer-panel .hw-bg-emerald-50\/50,
html.dark #v2-safety-answer-panel .hw-bg-emerald-50\/50 {
  background-color: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-tools-answer-panel .hw-bg-blue-50\/50,
html.dark #v2-signs-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-signs-answer-panel .hw-bg-blue-50\/50,
html.dark #v2-safety-answer-panel .hw-bg-blue-50\/40,
html.dark #v2-safety-answer-panel .hw-bg-blue-50\/50 {
  background-color: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
}

html.dark #v2-tools-answer-panel .hw-bg-purple-50\/40,
html.dark #v2-signs-answer-panel .hw-bg-purple-50\/40,
html.dark #v2-safety-answer-panel .hw-bg-purple-50\/40 {
  background-color: rgba(168, 85, 247, 0.12) !important;
  border-color: rgba(168, 85, 247, 0.25) !important;
}

html.dark #tools-smart-subpills,
html.dark #signs-smart-subpills,
html.dark #safety-smart-subpills {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark #tools-smart-subpills button,
html.dark #signs-smart-subpills button,
html.dark #safety-smart-subpills button {
  color: #94a3b8 !important;
}

html.dark #tools-smart-subpills button.hw-bg-white,
html.dark #signs-smart-subpills button.hw-bg-white,
html.dark #safety-smart-subpills button.hw-bg-white {
  background-color: #312e81 !important;
  color: #e0e7ff !important;
  border-color: #6366f1 !important;
}

/* Subtabs in Tools, Signs, Safety (Image 1 & 2 subtabs) */
html.dark button[onclick*="switchToolsSubTab"],
html.dark button[onclick*="switchSignsSubTab"],
html.dark button[onclick*="switchSafetySubTab"] {
  border-color: #1e293b !important;
  color: #94a3b8 !important;
}

html.dark button[onclick*="switchToolsSubTab"]:hover,
html.dark button[onclick*="switchSignsSubTab"]:hover,
html.dark button[onclick*="switchSafetySubTab"]:hover {
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark button[onclick*="switchToolsSubTab"].hw-bg-amber-100,
html.dark button[onclick*="switchSignsSubTab"].hw-bg-amber-100,
html.dark button[onclick*="switchSafetySubTab"].hw-bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.2) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
}

/* Play Mode Selector in Tools, Signs, Safety (Chế độ lưới vs Chế độ thẻ lớn) */
html.dark button[onclick*="switchToolsPlayMode"].hw-text-amber-700,
html.dark button[onclick*="switchSignsPlayMode"].hw-text-amber-700,
html.dark button[onclick*="switchSafetyPlayMode"].hw-text-amber-700 {
  color: #fbbf24 !important;
}

/* Layout Switchers in Tools, Signs, Safety (Image 2) */
html.dark #v2-view-interview .hw-bg-slate-100,
html.dark .hw-bg-slate-100.hw-rounded-xl {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button,
html.dark .hw-bg-slate-100.hw-rounded-xl button {
  color: #94a3b8 !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button:hover,
html.dark .hw-bg-slate-100.hw-rounded-xl button:hover {
  color: #f8fafc !important;
}

html.dark #v2-view-interview .hw-bg-slate-100 button.hw-bg-white,
html.dark .hw-bg-slate-100.hw-rounded-xl button.hw-bg-white {
  background-color: #312e81 !important;
  color: #e0e7ff !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3) !important;
}

html.dark button[onclick*="toggleSignsLayoutMode"],
html.dark button[onclick*="toggleSafetyLayoutMode"],
html.dark button[onclick*="toggleToolsLayoutMode"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

/* Grid Cards (Công cụ, Biển báo, An toàn) */
html.dark .v2-tool-grid-item,
html.dark .v2-sign-grid-item,
html.dark .v2-safety-grid-item {
  background-color: #111827 !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

html.dark .v2-tool-grid-item .hw-bg-white,
html.dark .v2-sign-grid-item .hw-bg-white,
html.dark .v2-safety-grid-item .hw-bg-white {
  background-color: #0b0f19 !important;
  border-color: #1e293b !important;
}

html.dark .v2-tool-grid-item.v2-grid-item-active,
html.dark .v2-sign-grid-item.v2-grid-item-active,
html.dark .v2-safety-grid-item.v2-grid-item-active {
  border-color: #6366f1 !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4) !important;
  background-color: #1e1e38 !important;
}

/* =====================================================================
   HUD Aurora Refresh - clean light surface, SVG icons, no dirty gray text
   ===================================================================== */
body #hw-app-layout #unified-hud-wrapper,
html.anki-mode-off body #hw-app-layout #unified-hud-wrapper,
body.skin-tutien #hw-app-layout #unified-hud-wrapper {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-height: 0 !important;
  margin: 0 0 14px 0 !important;
  border: 1px solid rgba(99, 102, 241, 0.16) !important;
  border-radius: 0 0 22px 22px !important;
  background:
    radial-gradient(circle at 8% 0%, rgba(99, 102, 241, 0.16), transparent 34%),
    radial-gradient(circle at 92% 12%, rgba(245, 158, 11, 0.16), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%) !important;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  overflow: hidden !important;
  isolation: isolate !important;
}

body #hw-app-layout #unified-hud-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12), transparent 28%, transparent 72%, rgba(245, 158, 11, 0.12));
  opacity: 0.9;
}

body #hw-app-layout #unified-hud-wrapper .rpg-top-bar,
html.anki-mode-off body #hw-app-layout #unified-hud-wrapper .rpg-top-bar,
body.skin-tutien #hw-app-layout #unified-hud-wrapper .rpg-top-bar {
  position: relative !important;
  z-index: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  width: 100% !important;
  height: 30px !important;
  min-height: 30px !important;
  margin: 0 !important;
  padding: 5px 14px !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(99, 102, 241, 0.13) !important;
  border-radius: 0 !important;
  background: linear-gradient(90deg, rgba(238, 242, 255, 0.98), rgba(255, 251, 235, 0.94)) !important;
  box-shadow: none !important;
  color: #334155 !important;
  font-size: 11px !important;
  font-weight: 850 !important;
  letter-spacing: 0 !important;
}

body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-left,
body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-right {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  color: #475569 !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-left {
  flex: 0 1 auto !important;
  max-width: 58% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-right {
  flex: 1 1 auto !important;
  justify-content: flex-end !important;
  margin-left: 0 !important;
  overflow: hidden !important;
  color: #64748b !important;
}

body #hw-app-layout #unified-hud-wrapper #top1-name {
  color: #d97706 !important;
  font-weight: 950 !important;
  margin: 0 4px !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper #top1-points {
  color: #ef4444 !important;
  font-weight: 950 !important;
  margin: 0 3px !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .tutien-hud,
html.anki-mode-off body #hw-app-layout #unified-hud-wrapper .tutien-hud,
body.skin-tutien #hw-app-layout #unified-hud-wrapper .tutien-hud {
  position: relative !important;
  z-index: 1 !important;
  display: block !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 11px 14px 13px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .hud-header-flex {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  padding: 0 !important;
  min-width: 0 !important;
}

body #hw-app-layout #unified-hud-wrapper .avatar-cultivation {
  width: 58px !important;
  height: 58px !important;
  margin: 0 !important;
  flex: 0 0 58px !important;
  border: 1px solid var(--hw-hud-rank-border, #a19d94) !important;
  border-radius: 9999px !important;
  background-color: #ffffff !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12) !important;
  color: #4f46e5 !important;
  overflow: visible !important;
}

body #hw-app-layout #unified-hud-wrapper .avatar-cultivation::after {
  display: none !important;
}

body #hw-app-layout #unified-hud-wrapper .avatar-cultivation>img:not(#my-pet-display) {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 9999px !important;
  background: transparent !important;
}

body #hw-app-layout #unified-hud-wrapper #my-pet-display {
  position: absolute !important;
  top: -8px !important;
  right: -23px !important;
  width: 34px !important;
  height: 34px !important;
  object-fit: contain !important;
  border-radius: 9999px !important;
  background: transparent !important;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.32)) !important;
  z-index: 25 !important;
}

body .avatar-cultivation .avatar-country-flag,
body #hw-app-layout #unified-hud-wrapper .avatar-cultivation .avatar-country-flag {
  display: block !important;
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  min-height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  bottom: -1px !important;
  left: -1px !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 50% !important;
  filter: none !important;
  opacity: 1 !important;
  image-rendering: auto !important;
  box-shadow: none !important;
  z-index: 32 !important;
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

#chat-modal .avatar-country-flag,
.friend-card .avatar-country-flag,
.friend-avatar-circle .avatar-country-flag,
.friend-request-row-v2 .avatar-country-flag,
.search-result-card .avatar-country-flag {
  display: block !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  bottom: -1px !important;
  left: -1px !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5) !important;
  z-index: 12 !important;
}

.pvp-spec-avatar .avatar-country-flag {
  display: block !important;
  width: 10px !important;
  height: 10px !important;
  min-width: 10px !important;
  min-height: 10px !important;
  max-width: 10px !important;
  max-height: 10px !important;
  bottom: -1px !important;
  left: -1px !important;
}

body #hw-app-layout #unified-hud-wrapper #rank-badge {
  color: #4f46e5 !important;
  font-size: 1.35rem !important;
  font-weight: 950 !important;
  text-shadow: none !important;
  background: transparent !important;
}

body #hw-app-layout #unified-hud-wrapper .exp-area-flex {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  margin-left: 0 !important;
  gap: 6px !important;
}

body #hw-app-layout #unified-hud-wrapper .hud-couple-name-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}

body #hw-app-layout #unified-hud-wrapper #user-rank-name,
body #hw-app-layout #unified-hud-wrapper .cultivator-name,
body #hw-app-layout #unified-hud-wrapper .rank-name-style {
  max-width: 100% !important;
  margin: 0 !important;
  color: var(--hw-hud-player-name-color, var(--hw-hud-rank-color, currentColor));
  font-size: 13px !important;
  font-weight: 950 !important;
  line-height: 1.15 !important;
  text-shadow: none !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body #hw-app-layout #unified-hud-wrapper .vip-ui-badge {
  background: transparent !important;
  color: #ffd700 !important;
  border: 0 !important;
  box-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .vip-ui-badge.vip-ui-badge-lifetime {
  color: #38bdf8 !important;
  text-shadow: none !important;
  filter: none !important;
}

body #hw-app-layout #unified-hud-wrapper .vip-ui-crown.vip-ui-crown-lifetime,
body #hw-app-layout #unified-hud-wrapper .vip-ui-badge-lifetime .vip-ui-crown {
  color: #38bdf8 !important;
  background: linear-gradient(135deg, #7dd3fc 0%, #38bdf8 35%, #2563eb 80%, #1d4ed8 100%) !important;
  background-color: #38bdf8 !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  filter: drop-shadow(0 0 3px rgba(56, 189, 248, 0.75)) !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .exp-bar-bg,
body #hw-app-layout #unified-hud-wrapper .exp-bar-bg-style {
  width: 100% !important;
  height: 9px !important;
  margin: 0 !important;
  border: 1px solid rgba(99, 102, 241, 0.12) !important;
  border-radius: 9999px !important;
  background: #e8eef8 !important;
  overflow: hidden !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08) !important;
}

body #hw-app-layout #unified-hud-wrapper #exp-bar-fill,
body #hw-app-layout #unified-hud-wrapper .exp-bar-fill,
body #hw-app-layout #unified-hud-wrapper .exp-bar-fill-style {
  height: 100% !important;
  border-radius: inherit !important;
  background: linear-gradient(90deg, #6366f1 0%, #22c55e 55%, #f59e0b 100%) !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.26) !important;
}

body #hw-app-layout #unified-hud-wrapper .hud-bot-row-style,
body #hw-app-layout #unified-hud-wrapper .exp-text-style,
body #hw-app-layout #unified-hud-wrapper .exp-text {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  color: #475569 !important;
  font-size: 11px !important;
  font-weight: 850 !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper .exp-stats-group,
body #hw-app-layout #unified-hud-wrapper .gold-stats-group {
  min-width: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 7px !important;
  border: 1px solid rgba(99, 102, 241, 0.12) !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.76) !important;
  color: #334155 !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04) !important;
}

body #hw-app-layout #unified-hud-wrapper .gold-stats-group,
body #hw-app-layout #unified-hud-wrapper #hud-copper-num {
  color: #b45309 !important;
  font-weight: 950 !important;
}

body #hw-app-layout #unified-hud-wrapper #exp-num {
  color: #334155 !important;
  font-weight: 950 !important;
  text-shadow: none !important;
}

body #hw-app-layout #unified-hud-wrapper #exp-num span {
  color: inherit !important;
}

body #hw-app-layout #unified-hud-wrapper .hw-hud-svg-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: inherit !important;
  background: transparent !important;
  filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.12)) !important;
}

body #hw-app-layout #unified-hud-wrapper .hw-hud-svg-icon svg {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  overflow: visible !important;
  background: transparent !important;
  color: inherit !important;
}

body #hw-app-layout #unified-hud-wrapper .hw-hud-svg-icon svg path {
  stroke: none !important;
}

body #hw-app-layout #unified-hud-wrapper .marquee-container,
body #hw-app-layout #unified-hud-wrapper .marquee-text {
  color: #475569 !important;
  text-shadow: none !important;
  font-weight: 800 !important;
}

@media (max-width: 640px) {

  body #hw-app-layout #unified-hud-wrapper,
  html.anki-mode-off body #hw-app-layout #unified-hud-wrapper,
  body.skin-tutien #hw-app-layout #unified-hud-wrapper {
    width: min(calc(100% - 20px), 1320px) !important;
    max-width: min(calc(100% - 20px), 1320px) !important;
    margin: 8px auto 12px !important;
    margin-inline: auto !important;
    align-self: center !important;
    box-sizing: border-box !important;
    border-radius: 18px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar {
    height: 30px !important;
    min-height: 28px !important;
    padding: 3px 8px !important;
    font-size: 10.5px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-left {
    flex: 0 0 auto !important;
    max-width: 42% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 10px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-right {
    display: flex !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar #season-msg {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .marquee-text,
  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar #mq-single-run {
    font-size: 10px !important;
    gap: 4px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .tutien-hud {
    padding: 9px 10px 11px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .hud-header-flex {
    gap: 10px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .avatar-cultivation {
    width: 56px !important;
    height: 56px !important;
    flex-basis: 56px !important;
    border-radius: 9999px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .avatar-cultivation>img:not(#my-pet-display) {
    border-radius: 9999px !important;
  }

  body #hw-app-layout #unified-hud-wrapper #my-pet-display {
    top: -7px !important;
    right: -20px !important;
    width: 30px !important;
    height: 30px !important;
  }

  body #hw-app-layout #unified-hud-wrapper #user-rank-name,
  body #hw-app-layout #unified-hud-wrapper .cultivator-name,
  body #hw-app-layout #unified-hud-wrapper .rank-name-style {
    font-size: 12px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .hud-bot-row-style,
  body #hw-app-layout #unified-hud-wrapper .exp-text-style,
  body #hw-app-layout #unified-hud-wrapper .exp-text {
    gap: 5px !important;
    font-size: 10px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .exp-stats-group,
  body #hw-app-layout #unified-hud-wrapper .gold-stats-group {
    padding: 2px 6px !important;
  }

  body #hw-app-layout #unified-hud-wrapper .hw-hud-svg-icon {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
  }
}

/* =========================================================
   CULTIVATION ITEM CATALOG (UNIFIED WEB LIGHT/DARK)
   ========================================================= */
.cultivation-data-active #inv-modal .modal-content {
  background: var(--game-surface, #ffffff) !important;
  border: 1px solid var(--game-border-strong, #cbd5e1) !important;
  box-shadow: var(--game-shadow-lg, 0 24px 60px rgba(0, 0, 0, 0.2)) !important;
  color: var(--game-text, #0f172a) !important;
}

.cultivation-data-active #inv-modal .inv-header-title {
  color: var(--game-text, #0f172a) !important;
  text-shadow: none !important;
}

.cultivation-data-active #inv-filter,
.cultivation-data-active #inv-actions {
  padding: 8px 14px !important;
  border-color: var(--game-border, #e2e8f0) !important;
  border-radius: 0 !important;
  background: var(--game-surface-raised, #f8fafc) !important;
  box-sizing: border-box;
}

.cultivation-data-active #inv-filter .inv-tu-btn {
  border-color: var(--game-border-strong, #cbd5e1) !important;
  color: var(--game-text-secondary, #475569) !important;
  background: var(--game-surface, #ffffff) !important;
  box-shadow: none !important;
}

.cultivation-data-active #inv-actions .inv-tu-btn {
  border-color: var(--game-border-strong, #cbd5e1) !important;
  color: var(--game-text, #0f172a) !important;
  background: var(--game-surface-subtle, #f1f5f9) !important;
  box-shadow: none !important;
}

.cultivation-data-active #inv-actions .inv-tu-btn.danger {
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: var(--game-danger-text, #dc2626) !important;
  background: var(--game-danger-soft, #fef2f2) !important;
}

.cultivation-data-active #inv-actions .inv-tu-btn.warning {
  border-color: var(--game-primary, #0f766e) !important;
  color: var(--game-accent-text, #0f766e) !important;
  background: var(--game-primary-soft, #f0fdfa) !important;
}

.cultivation-data-active #inv-filter .inv-tu-btn.active {
  border-color: var(--game-primary, #0f766e) !important;
  color: var(--game-button-text, #ffffff) !important;
  background: var(--game-primary, #0f766e) !important;
}

.cultivation-data-active #inv-filter .inv-tu-btn:hover,
.cultivation-data-active #inv-actions .inv-tu-btn:hover {
  border-color: var(--game-primary, #0f766e) !important;
  color: var(--game-text, #0f172a) !important;
  background: var(--game-surface-hover, #e2e8f0) !important;
}

.cultivation-data-active #inv-filter .inv-tu-btn.active:hover {
  color: var(--game-button-text, #ffffff) !important;
  background: var(--game-primary-hover, #115e59) !important;
}

.cultivation-data-active #inv-grid.inventory-grid {
  gap: 8px !important;
  padding: 12px 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--game-surface, #ffffff) !important;
}

.cultivation-data-active #inv-grid .cultivation-item {
  border-width: 1.5px !important;
  border-radius: 10px !important;
  background: var(--game-surface-subtle, #f1f5f9) !important;
  box-shadow: var(--game-shadow) !important;
  isolation: isolate;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease !important;
}

.cultivation-data-active #inv-grid .cultivation-item:hover {
  z-index: 3;
  transform: translateY(-2px) scale(1.025);
  filter: none;
}

.cultivation-data-active #inv-grid .cultivation-item>img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  image-rendering: auto !important;
}

.cultivation-data-active #inv-grid .cultivation-item::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(15, 23, 42, .42) 0%, transparent 32%, transparent 66%, rgba(15, 23, 42, .45) 100%);
  content: "";
  pointer-events: none;
}

.cultivation-data-active #inv-grid .category-damage {
  --cultivation-cat: #ef4444;
}

.cultivation-data-active #inv-grid .category-defense {
  --cultivation-cat: #0f766e;
}

.cultivation-data-active #inv-grid .category-magic {
  --cultivation-cat: #6366f1;
}

.cultivation-data-active #inv-grid .category-movement {
  --cultivation-cat: #0ea5e9;
}

.cultivation-data-active #inv-grid .category-consumable {
  --cultivation-cat: #10b981;
}

.cultivation-data-active #inv-grid .cultivation-item[data-item-category] {
  border-bottom-color: var(--cultivation-cat, var(--game-border-strong)) !important;
}

.cultivation-data-active #item-details {
  box-sizing: border-box !important;
  width: calc(100% - 28px) !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  border: 1px solid var(--game-border, #e2e8f0) !important;
  border-radius: 12px !important;
  background: var(--game-surface-raised, #f8fafc) !important;
}

.cultivation-data-active #item-details #dt-stats,
.cultivation-data-active #item-details .cultivator-detail-top {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.cultivation-data-active #item-details #dt-stats {
  overflow-x: hidden !important;
}

.cultivation-data-active #item-details .cultivator-detail-left {
  min-width: 0 !important;
  overflow: hidden !important;
}

.cultivation-data-active #item-details .cultivator-detail-center {
  width: 84px !important;
  min-width: 84px !important;
  max-width: 84px !important;
}

.cultivation-data-active #item-details .cultivator-detail-traits {
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cultivation-data-active #item-details .cultivator-detail-equipment {
  width: 118px !important;
  min-width: 118px !important;
  max-width: 118px !important;
}

.cultivation-data-active #item-details .cultivator-detail-skills {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.cultivation-data-active #item-details .cultivator-detail-skills .skill-container {
  min-width: max-content;
}

@media (max-width: 480px) {
  .cultivation-data-active #inv-grid.inventory-grid {
    gap: 5px !important;
    padding: 6px !important;
  }

  .cultivation-data-active #item-details .cultivator-detail-top {
    gap: 5px !important;
  }

  .cultivation-data-active #item-details .cultivator-detail-center {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
  }

  .cultivation-data-active #item-details .cultivator-detail-center img {
    width: 68px !important;
    height: 119px !important;
  }

  .cultivation-data-active #item-details .cultivator-detail-equipment {
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
  }
}

/* Mobile keyboard viewport guard */
html.hw-keyboard-open,
body.hw-keyboard-open {
  overscroll-behavior: contain !important;
}

body.hw-keyboard-open #hw-app-layout main,
body.hw-keyboard-open main {
  min-height: var(--hw-visual-vh, 100dvh) !important;
  padding-bottom: calc(var(--hw-keyboard-height, 0px) + 18px) !important;
  scroll-padding-bottom: calc(var(--hw-keyboard-height, 0px) + 24px) !important;
}

body.hw-keyboard-open nav[class*="hw-bottom-0"],
body.hw-keyboard-open #hw-app-layout>nav {
  transform: translateY(110%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.hw-keyboard-open input:focus,
body.hw-keyboard-open textarea:focus,
body.hw-keyboard-open select:focus {
  scroll-margin-bottom: calc(var(--hw-keyboard-height, 0px) + 28px) !important;
}

/* Exempt inputs inside modals, overlays, and live rooms from aggressive scroll-margins to prevent viewport displacement */
body.hw-keyboard-open #live-room-chat-input,
body.hw-keyboard-open #pvp-live-room input,
body.hw-keyboard-open #v2-smart-modal input,
body.hw-keyboard-open #v2-smart-modal textarea,
body.hw-keyboard-open #v2-modal-overlay input,
body.hw-keyboard-open #v2-modal-overlay textarea,
body.hw-keyboard-open #unified-modal input,
body.hw-keyboard-open #unified-modal textarea,
body.hw-keyboard-open .auth-modal input,
body.hw-keyboard-open .auth-modal textarea,
body.hw-keyboard-open [role="dialog"] input,
body.hw-keyboard-open [role="dialog"] textarea,
body.hw-keyboard-open .modal input,
body.hw-keyboard-open .modal textarea {
  scroll-margin: 0 !important;
  scroll-margin-bottom: 8px !important;
  scroll-padding: 0 !important;
}

/* Modal Anti-Jitter Top-Anchoring:
   When soft keyboard opens, prevent modal from constantly bouncing up and down
   due to flex vertical centering recalculating on every suggestion bar height flutter. */
#v2-smart-modal {
  z-index: 2147483646 !important;
}

#v2-smart-modal,
#unified-modal,
.auth-modal {
  touch-action: pan-y;
  overscroll-behavior: contain;
}

body.hw-keyboard-open #v2-smart-modal,
#v2-smart-modal.v2-modal-keyboard-active {
  align-items: flex-start !important;
  padding-top: max(8px, env(safe-area-inset-top, 8px)) !important;
  padding-bottom: 8px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

body.hw-keyboard-open #v2-smart-modal>div,
#v2-smart-modal.v2-modal-keyboard-active>div {
  max-height: calc(var(--hw-visual-vh, 100dvh) - 16px) !important;
  margin-top: 0 !important;
  margin-bottom: auto !important;
}

body.hw-keyboard-open #unified-modal .auth-card,
body.hw-keyboard-open .auth-modal .auth-card {
  max-height: calc(var(--hw-visual-vh, 100dvh) - 16px) !important;
  margin-top: 0 !important;
  margin-bottom: auto !important;
}


/* =========================================================
   LOOT POPUP V2 — một giao diện thống nhất cho web + mobile
   ========================================================= */
#loot-popup.loot-popup {
  --loot-accent: #c8aa6e;
  --loot-duration: 3200ms;
  display: none !important;
  position: fixed !important;
  top: max(88px, calc(env(safe-area-inset-top, 0px) + 18px)) !important;
  right: max(18px, env(safe-area-inset-right, 0px)) !important;
  bottom: auto !important;
  left: auto !important;
  width: min(360px, calc(100vw - 32px)) !important;
  min-height: 92px !important;
  box-sizing: border-box !important;
  grid-template-columns: 68px minmax(0, 1fr) 30px !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 13px !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: #f8fafc !important;
  background:
    radial-gradient(circle at 10% 10%, color-mix(in srgb, var(--loot-accent) 22%, transparent), transparent 42%),
    linear-gradient(145deg, rgba(10, 18, 34, .98), rgba(5, 10, 22, .98)) !important;
  border: 1px solid var(--loot-accent) !important;
  border: 1px solid color-mix(in srgb, var(--loot-accent) 78%, #fff 8%) !important;
  border-left: 4px solid var(--loot-accent) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48) !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48), 0 0 22px color-mix(in srgb, var(--loot-accent) 20%, transparent) !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate3d(28px, 0, 0) scale(.97) !important;
  transform-origin: right center !important;
  transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1), visibility .22s !important;
  pointer-events: none !important;
  z-index: 2147483200 !important;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
}

#loot-popup.loot-popup.is-visible {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
}

#loot-popup.loot-popup.is-entering {
  opacity: 0 !important;
  transform: translate3d(28px, 0, 0) scale(.97) !important;
}

#loot-popup.loot-popup.is-leaving {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translate3d(18px, 0, 0) scale(.98) !important;
}

#loot-popup .loot-art {
  width: 66px !important;
  height: 66px !important;
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  flex: none !important;
}

#loot-popup.loot-popup .loot-icon {
  display: block !important;
  width: 58px !important;
  height: 58px !important;
  margin: 0 !important;
  object-fit: contain !important;
  box-sizing: border-box !important;
  padding: 4px !important;
  border: 2px solid var(--loot-accent) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, .06) !important;
  box-shadow: 0 0 16px color-mix(in srgb, var(--loot-accent) 28%, transparent) !important;
}

#loot-popup .loot-tier {
  position: absolute !important;
  right: -2px !important;
  bottom: -3px !important;
  max-width: 70px !important;
  padding: 2px 5px !important;
  overflow: hidden !important;
  color: #07101f !important;
  background: var(--loot-accent) !important;
  border: 1px solid rgba(255, 255, 255, .55) !important;
  border-radius: 999px !important;
  font-size: 8px !important;
  line-height: 1.2 !important;
  font-weight: 900 !important;
  letter-spacing: .35px !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

#loot-popup.loot-popup .loot-info {
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 3px !important;
}

#loot-popup.loot-popup .loot-title {
  margin: 0 !important;
  color: var(--loot-accent) !important;
  color: color-mix(in srgb, var(--loot-accent) 88%, #fff 12%) !important;
  font-size: 9px !important;
  line-height: 1.2 !important;
  font-weight: 850 !important;
  letter-spacing: 1.1px !important;
  text-transform: uppercase !important;
}

#loot-popup.loot-popup .loot-name {
  width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: #fff !important;
  font-size: 15px !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .7) !important;
}

#loot-popup .loot-stats {
  width: 100% !important;
  overflow: hidden !important;
  color: #cbd5e1 !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

#loot-popup .loot-meta {
  width: 100% !important;
  overflow: hidden !important;
  color: #7dd3fc !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

#loot-popup .loot-saved {
  width: 24px !important;
  height: 24px !important;
  display: grid !important;
  place-items: center !important;
  align-self: start !important;
  color: #052e16 !important;
  background: #86efac !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  box-shadow: 0 0 12px rgba(134, 239, 172, .28) !important;
}

#loot-popup .loot-timer {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  height: 3px !important;
  background: var(--loot-accent) !important;
  transform-origin: left center !important;
}

#loot-popup.is-visible .loot-timer {
  animation: lootTimerV2 var(--loot-duration) linear forwards !important;
}

@keyframes lootTimerV2 {
  from {
    transform: scaleX(1);
    opacity: .95;
  }

  to {
    transform: scaleX(0);
    opacity: .35;
  }
}

@media (max-width: 640px) {
  #loot-popup.loot-popup {
    top: auto !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 8px)) !important;
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    width: auto !important;
    min-height: 82px !important;
    grid-template-columns: 58px minmax(0, 1fr) 26px !important;
    gap: 9px !important;
    padding: 10px 11px !important;
    border-radius: 13px !important;
    transform: translate3d(0, 18px, 0) scale(.98) !important;
    transform-origin: center bottom !important;
  }

  #loot-popup.loot-popup.is-visible {
    transform: translate3d(0, 0, 0) scale(1) !important;
  }

  #loot-popup.loot-popup.is-entering,
  #loot-popup.loot-popup.is-leaving {
    transform: translate3d(0, 18px, 0) scale(.98) !important;
  }

  #loot-popup .loot-art {
    width: 56px !important;
    height: 56px !important;
  }

  #loot-popup.loot-popup .loot-icon {
    width: 52px !important;
    height: 52px !important;
  }

  #loot-popup.loot-popup .loot-name {
    font-size: 14px !important;
  }

  #loot-popup .loot-meta {
    font-size: 9px !important;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  #loot-popup.loot-popup {
    top: 12px !important;
    right: 12px !important;
    bottom: auto !important;
    left: auto !important;
    width: min(320px, calc(100vw - 24px)) !important;
    min-height: 70px !important;
    grid-template-columns: 50px minmax(0, 1fr) 24px !important;
    padding: 8px 10px !important;
  }

  #loot-popup .loot-art,
  #loot-popup.loot-popup .loot-icon {
    width: 48px !important;
    height: 48px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loot-popup.loot-popup {
    transition: opacity .12s linear !important;
    transform: none !important;
  }

  #loot-popup .loot-timer {
    animation: none !important;
  }
}

/* =========================================================
   LOOT POPUP V3 - chi con icon, ten va mau pham chat
   ========================================================= */
#loot-popup.loot-popup {
  --loot-duration: 1500ms;
  width: min(270px, calc(100vw - 32px)) !important;
  min-height: 62px !important;
  grid-template-columns: 46px minmax(0, 1fr) !important;
  gap: 10px !important;
  padding: 8px 11px 8px 9px !important;
  isolation: isolate !important;
  border-radius: 12px !important;
  transform: translate3d(20px, 0, 0) scale(.98) !important;
  transition: opacity .16s ease, transform .2s ease, visibility .16s !important;
  z-index: 2147483647 !important;
}

#loot-popup.loot-popup.is-visible {
  display: grid !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
}

#loot-popup.loot-popup.is-entering,
#loot-popup.loot-popup.is-leaving {
  transform: translate3d(16px, 0, 0) scale(.98) !important;
}

#loot-popup .loot-art {
  width: 46px !important;
  height: 46px !important;
}

#loot-popup.loot-popup .loot-icon {
  width: 44px !important;
  height: 44px !important;
  padding: 3px !important;
  border-radius: 10px !important;
}

#loot-popup.loot-popup .loot-info {
  min-width: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#loot-popup.loot-popup .loot-name {
  color: var(--loot-accent) !important;
  font-size: 14px !important;
  font-weight: 850 !important;
}

#loot-popup .loot-tier,
#loot-popup .loot-title,
#loot-popup .loot-stats,
#loot-popup .loot-meta,
#loot-popup .loot-saved,
#loot-popup .loot-timer {
  display: none !important;
}

@media (max-width: 640px) {
  #loot-popup.loot-popup {
    min-height: 58px !important;
    grid-template-columns: 46px minmax(0, 1fr) !important;
    gap: 10px !important;
    padding: 8px 11px 8px 9px !important;
    transform: translate3d(0, 14px, 0) scale(.98) !important;
  }

  #loot-popup.loot-popup.is-visible {
    transform: translate3d(0, 0, 0) scale(1) !important;
  }

  #loot-popup.loot-popup.is-entering,
  #loot-popup.loot-popup.is-leaving {
    transform: translate3d(0, 14px, 0) scale(.98) !important;
  }

  #loot-popup .loot-art,
  #loot-popup.loot-popup .loot-icon {
    width: 44px !important;
    height: 44px !important;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  #loot-popup.loot-popup {
    width: min(270px, calc(100vw - 20px)) !important;
    min-height: 58px !important;
    grid-template-columns: 44px minmax(0, 1fr) !important;
    padding: 7px 9px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #loot-popup.loot-popup {
    transition: opacity .1s linear !important;
    transform: none !important;
  }
}

/* ========================================================
   ROUND 2 CHẾ ĐỘ TỰ LUYỆN (ẨN/HIỆN CHỮ)
   ======================================================== */

/* Đảm bảo toàn bộ thanh điều khiển và checkbox không bao giờ bị làm mờ */
#v2-view-interview input[type="checkbox"],
#v2-view-interview label,
#v2-view-interview .hw-player-ctrl,
#v2-view-interview button {
  filter: none !important;
  opacity: 1 !important;
}

/* Ẩn tiếng Hàn: Làm mờ các phần tử nội dung tiếng Hàn */
#v2-view-interview.v2-hide-korean .v2-ko-text,
#v2-view-interview.v2-hide-korean [id$="-korean"]:not(input):not(button):not(label),
#v2-view-interview.v2-hide-korean [id$="-q-korean"],
#v2-view-interview.v2-hide-korean [id$="-a-korean"],
#v2-view-interview.v2-hide-korean #prompter-scroll-div,
#v2-view-interview.v2-hide-korean #prompter-full-text-view,
#v2-view-interview.v2-hide-korean #prompter-compiled-plain {
  filter: blur(5px) opacity(0.35) !important;
  transition: filter 0.2s ease, opacity 0.2s ease !important;
  cursor: pointer !important;
}

#v2-view-interview.v2-hide-korean .v2-ko-text:hover,
#v2-view-interview.v2-hide-korean [id$="-korean"]:not(input):not(button):not(label):hover,
#v2-view-interview.v2-hide-korean [id$="-q-korean"]:hover,
#v2-view-interview.v2-hide-korean [id$="-a-korean"]:hover,
#v2-view-interview.v2-hide-korean #prompter-scroll-div:hover,
#v2-view-interview.v2-hide-korean #prompter-full-text-view:hover {
  filter: none !important;
  opacity: 1 !important;
}

/* Ẩn tiếng Việt: Làm mờ các phần tử nội dung tiếng Việt & hành động */
#v2-view-interview.v2-hide-vietnamese .v2-vi-text,
#v2-view-interview.v2-hide-vietnamese [id$="-viet"]:not(input):not(button):not(label),
#v2-view-interview.v2-hide-vietnamese [id$="-q-viet"],
#v2-view-interview.v2-hide-vietnamese [id$="-a-viet"],
#v2-view-interview.v2-hide-vietnamese [id$="-action"]:not(input):not(button):not(label),
#v2-view-interview.v2-hide-vietnamese [id$="-player-action"] {
  filter: blur(5px) opacity(0.35) !important;
  transition: filter 0.2s ease, opacity 0.2s ease !important;
  cursor: pointer !important;
}

#v2-view-interview.v2-hide-vietnamese .v2-vi-text:hover,
#v2-view-interview.v2-hide-vietnamese [id$="-viet"]:not(input):not(button):not(label):hover,
#v2-view-interview.v2-hide-vietnamese [id$="-q-viet"]:hover,
#v2-view-interview.v2-hide-vietnamese [id$="-a-viet"]:hover,
#v2-view-interview.v2-hide-vietnamese [id$="-action"]:not(input):not(button):not(label):hover,
#v2-view-interview.v2-hide-vietnamese [id$="-player-action"]:hover {
  filter: none !important;
  opacity: 1 !important;
}

/* Ép hiển thị rõ khi đã được click/tap reveal */
#v2-view-interview .v2-ko-text.v2-revealed,
#v2-view-interview [id$="-korean"].v2-revealed,
#v2-view-interview [id$="-q-korean"].v2-revealed,
#v2-view-interview [id$="-a-korean"].v2-revealed,
#v2-view-interview #prompter-scroll-div.v2-revealed,
#v2-view-interview #prompter-full-text-view.v2-revealed,
#v2-view-interview .v2-vi-text.v2-revealed,
#v2-view-interview [id$="-viet"].v2-revealed,
#v2-view-interview [id$="-q-viet"].v2-revealed,
#v2-view-interview [id$="-a-viet"].v2-revealed,
#v2-view-interview [id$="-action"].v2-revealed,
#v2-view-interview [id$="-player-action"].v2-revealed {
  filter: none !important;
  opacity: 1 !important;
}

/* ========================================================
   ROUND 2 — SMART RECALL CONTROLS & MEMORY STATES
   ======================================================== */
.v2-svg-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: -0.12em;
}

.v2-memory-heading-icon {
  width: 1.05em;
  height: 1.05em;
}

.v2-study-mode-button,
.v2-memory-action,
.v2-quick-memory-action,
.v2-reveal-answer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  border: 1px solid transparent;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.v2-study-mode-button:hover,
.v2-memory-action:hover,
.v2-quick-memory-action:hover,
.v2-reveal-answer-button:hover {
  transform: translateY(-1px);
}

.v2-study-mode-bar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 1rem !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

.v2-study-segmented-dock {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  padding: 2.5px;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  gap: 2px;
}

.v2-study-mode-button {
  min-height: 28px;
  height: 28px;
  padding: 0 0.55rem;
  border-radius: 0.55rem;
  background: transparent;
  border: 1px solid transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  cursor: pointer;
  white-space: nowrap;
}

.v2-study-mode-button:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.v2-study-mode-button.is-active {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25) !important;
  color: #ffffff !important;
}

.v2-study-mode-button.is-active * {
  color: #ffffff !important;
}

.v2-study-tool-btn {
  height: 27px;
  min-height: 27px;
  padding: 0 0.55rem;
  border-radius: 0.5rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

.v2-study-tool-btn i {
  font-size: 10px;
}

.v2-study-tool-btn:hover {
  transform: translateY(-0.5px);
  filter: brightness(0.97);
}

.v2-setting-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.38rem;
  border-radius: 0.45rem;
  font-size: 9.5px;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}

.v2-setting-chip i {
  font-size: 9px;
}

.v2-setting-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

html:not(.dark):not([data-theme="dark"]) .v2-setting-chip:has(input:checked) {
  background: #eef2ff !important;
  border-color: #c7d2fe !important;
  color: #4338ca !important;
}

html:not(.dark):not([data-theme="dark"]) .v2-setting-chip:has(input#v2-toggle-wakelock:checked) {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #b45309 !important;
}

.v2-setting-chip input {
  width: 11px;
  height: 11px;
  margin: 0;
  cursor: pointer;
  accent-color: #6366f1;
}

.v2-setting-chip input#v2-toggle-wakelock {
  accent-color: #f59e0b;
}

/* Round 2 Calculations Compact Toolbar & Chip Dock */
.v2-calc-toolbar {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 1rem !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

.v2-calc-chip-dock {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.v2-calc-chip-dock::-webkit-scrollbar {
  display: none;
}

.v2-calc-op-pill {
  height: 29px;
  min-height: 29px;
  padding: 0 0.65rem;
  border-radius: 0.65rem;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  box-sizing: border-box;
}

.v2-calc-op-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-0.5px);
}

.v2-calc-op-pill.is-active {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
  border-color: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25) !important;
}

.v2-calc-op-pill.is-active * {
  color: #ffffff !important;
}

.v2-calc-odd-pill {
  height: 29px;
  min-height: 29px;
  padding: 0 0.65rem;
  border-radius: 0.65rem;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  box-sizing: border-box;
}

.v2-calc-odd-pill:hover {
  background: #ffedd5;
  border-color: #fdba74;
}

.v2-calc-odd-pill.is-active {
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%) !important;
  border-color: #ea580c !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3) !important;
}

.v2-calc-odd-pill.is-active * {
  color: #ffffff !important;
}

.v2-calc-reroll-pill {
  height: 29px;
  min-height: 29px;
  padding: 0 0.65rem;
  border-radius: 0.65rem;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid #fde68a;
  background: #fefce8;
  color: #b45309;
  box-sizing: border-box;
}

.v2-calc-reroll-pill:hover {
  background: #fef08a;
  border-color: #f59e0b;
}

.v2-calc-reroll-pill:active i {
  transform: rotate(180deg);
  transition: transform 0.25s ease;
}

.v2-calc-mode-pill {
  height: 29px;
  min-height: 29px;
  padding: 0 0.65rem;
  border-radius: 0.65rem;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
}

html.anki-mode-on .v2-calc-reroll-pill,
.dark .v2-calc-reroll-pill {
  background: rgba(120, 53, 15, 0.2);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

html.anki-mode-on .v2-calc-reroll-pill:hover,
.dark .v2-calc-reroll-pill:hover {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(245, 158, 11, 0.5);
}

html.anki-mode-on .v2-calc-toolbar,
.dark .v2-calc-toolbar {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html.anki-mode-on .v2-calc-op-pill,
.dark .v2-calc-op-pill {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

html.anki-mode-on .v2-calc-op-pill:hover,
.dark .v2-calc-op-pill:hover {
  background: #1e293b;
  color: #f8fafc;
}

.v2-cat-btn-compact {
  padding: 0.45rem 0.55rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  text-align: left;
  cursor: pointer;
  min-height: 36px;
  box-sizing: border-box;
}

.v2-cat-btn-compact i {
  font-size: 12px;
  flex-shrink: 0;
}

.v2-cat-btn-compact span {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

@media (min-width: 640px) {
  .v2-cat-btn-compact {
    padding: 0.55rem 0.75rem;
    min-height: 40px;
    gap: 0.45rem;
  }

  .v2-cat-btn-compact i {
    font-size: 13px;
  }

  .v2-cat-btn-compact span {
    font-size: 11.5px;
  }
}

html.anki-mode-on .v2-study-mode-bar,
.dark .v2-study-mode-bar {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

html.anki-mode-on .v2-study-segmented-dock,
.dark .v2-study-segmented-dock {
  background: #1e293b !important;
  border-color: #334155 !important;
}

html.anki-mode-on .v2-study-mode-button,
.dark .v2-study-mode-button {
  background: transparent !important;
  border-color: transparent !important;
  color: #cbd5e1 !important;
}

html.anki-mode-on .v2-study-mode-button:hover,
.dark .v2-study-mode-button:hover {
  background: rgba(51, 65, 85, 0.85) !important;
  color: #f8fafc !important;
}

html.dark .v2-setting-chip,
html[data-theme="dark"] .v2-setting-chip,
html.anki-mode-on .v2-setting-chip,
.dark .v2-setting-chip {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html.dark .v2-setting-chip:hover,
html[data-theme="dark"] .v2-setting-chip:hover,
html.anki-mode-on .v2-setting-chip:hover,
.dark .v2-setting-chip:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .v2-setting-chip:has(input:checked),
html[data-theme="dark"] .v2-setting-chip:has(input:checked),
html.anki-mode-on .v2-setting-chip:has(input:checked),
.dark .v2-setting-chip:has(input:checked) {
  background: rgba(79, 70, 229, 0.25) !important;
  background-color: rgba(79, 70, 229, 0.25) !important;
  border-color: #6366f1 !important;
  color: #e0e7ff !important;
}

html.dark .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
html[data-theme="dark"] .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
.dark .v2-setting-chip:has(input#v2-toggle-wakelock:checked),
html.anki-mode-on .v2-setting-chip:has(input#v2-toggle-wakelock:checked) {
  background: rgba(245, 158, 11, 0.22) !important;
  background-color: rgba(245, 158, 11, 0.22) !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fde68a !important;
}


html.anki-mode-on .v2-study-mode-button.is-active,
.dark .v2-study-mode-button.is-active {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
  border-color: #818cf8 !important;
  color: #ffffff !important;
}

.v2-study-mode-button .v2-svg-icon {
  width: 14px;
  height: 14px;
}

.v2-memory-actionbar {
  position: relative;
  width: 100%;
}

.v2-memory-actionbar {
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  transition: border-color 0.2s ease;
}

html.dark .v2-memory-actionbar,
html[data-theme="dark"] .v2-memory-actionbar,
.dark .v2-memory-actionbar,
[data-theme="dark"] .v2-memory-actionbar,
html.anki-mode-on .v2-memory-actionbar {
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .v2-memory-heading,
html[data-theme="dark"] .v2-memory-heading,
.dark .v2-memory-heading,
[data-theme="dark"] .v2-memory-heading,
html.anki-mode-on .v2-memory-heading {
  color: #94a3b8 !important;
}

.v2-memory-segmented-bar {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  background: #f1f5f9;
  border-radius: 0.55rem;
  border: 1px solid #e2e8f0;
  gap: 2px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

html.dark .v2-memory-segmented-bar,
html[data-theme="dark"] .v2-memory-segmented-bar,
.dark .v2-memory-segmented-bar,
[data-theme="dark"] .v2-memory-segmented-bar,
html.anki-mode-on .v2-memory-segmented-bar {
  background: #0f172a !important;
  background-color: #0f172a !important;
  border: 1px solid #1e293b !important;
  border-color: #1e293b !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

.v2-memory-action {
  min-height: 24px;
  height: 24px;
  padding: .12rem .35rem;
  border-radius: .38rem;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  color: #64748b;
  background: transparent;
  transition: all .16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .v2-memory-action {
    min-height: 26px;
    height: 26px;
    padding: .18rem .48rem;
    border-radius: .42rem;
    font-size: 10.5px;
    gap: .35rem;
  }
}

html.dark .v2-memory-action,
html[data-theme="dark"] .v2-memory-action,
.dark .v2-memory-action,
[data-theme="dark"] .v2-memory-action,
html.anki-mode-on .v2-memory-action {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  border-color: transparent;
}

.v2-memory-action .v2-svg-icon,
.v2-quick-memory-action .v2-svg-icon {
  width: 10.5px;
  height: 10.5px;
  flex-shrink: 0;
}

@media (min-width: 640px) {

  .v2-memory-action .v2-svg-icon,
  .v2-quick-memory-action .v2-svg-icon {
    width: 12px;
    height: 12px;
  }
}

.v2-memory-action-rose,
.v2-quick-memory-action-rose {
  color: #e11d48;
  background: #fff1f2;
  border-color: #fecdd3;
}

.v2-memory-action-amber,
.v2-quick-memory-action-amber {
  color: #d97706;
  background: #fffbeb;
  border-color: #fde68a;
}

.v2-memory-action-emerald,
.v2-quick-memory-action-emerald {
  color: #059669;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

/* Inactive button tone styling in dark mode (no dirty white/grey pastel background) */
html.dark .v2-memory-action-rose,
html[data-theme="dark"] .v2-memory-action-rose,
.dark .v2-memory-action-rose,
[data-theme="dark"] .v2-memory-action-rose,
html.anki-mode-on .v2-memory-action-rose,
html.dark .v2-quick-memory-action-rose,
html[data-theme="dark"] .v2-quick-memory-action-rose,
.dark .v2-quick-memory-action-rose,
[data-theme="dark"] .v2-quick-memory-action-rose {
  color: #fb7185 !important;
  background: rgba(225, 29, 72, 0.12) !important;
  border: 1px solid rgba(225, 29, 72, 0.28) !important;
}

html.dark .v2-memory-action-amber,
html[data-theme="dark"] .v2-memory-action-amber,
.dark .v2-memory-action-amber,
[data-theme="dark"] .v2-memory-action-amber,
html.anki-mode-on .v2-memory-action-amber,
html.dark .v2-quick-memory-action-amber,
html[data-theme="dark"] .v2-quick-memory-action-amber,
.dark .v2-quick-memory-action-amber,
[data-theme="dark"] .v2-quick-memory-action-amber {
  color: #fbbf24 !important;
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.28) !important;
}

html.dark .v2-memory-action-emerald,
html[data-theme="dark"] .v2-memory-action-emerald,
.dark .v2-memory-action-emerald,
[data-theme="dark"] .v2-memory-action-emerald,
html.anki-mode-on .v2-memory-action-emerald,
html.dark .v2-quick-memory-action-emerald,
html[data-theme="dark"] .v2-quick-memory-action-emerald,
.dark .v2-quick-memory-action-emerald,
[data-theme="dark"] .v2-quick-memory-action-emerald {
  color: #34d399 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
}

.v2-memory-action-rose:hover,
.v2-quick-memory-action-rose:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.v2-memory-action-amber:hover,
.v2-quick-memory-action-amber:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

.v2-memory-action-emerald:hover,
.v2-quick-memory-action-emerald:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

/* Hover in dark mode */
html.dark .v2-memory-action-rose:hover,
html[data-theme="dark"] .v2-memory-action-rose:hover,
.dark .v2-memory-action-rose:hover,
[data-theme="dark"] .v2-memory-action-rose:hover,
html.anki-mode-on .v2-memory-action-rose:hover {
  background: rgba(225, 29, 72, 0.24) !important;
  border-color: rgba(225, 29, 72, 0.45) !important;
}

html.dark .v2-memory-action-amber:hover,
html[data-theme="dark"] .v2-memory-action-amber:hover,
.dark .v2-memory-action-amber:hover,
[data-theme="dark"] .v2-memory-action-amber:hover,
html.anki-mode-on .v2-memory-action-amber:hover {
  background: rgba(245, 158, 11, 0.24) !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

html.dark .v2-memory-action-emerald:hover,
html[data-theme="dark"] .v2-memory-action-emerald:hover,
.dark .v2-memory-action-emerald:hover,
[data-theme="dark"] .v2-memory-action-emerald:hover,
html.anki-mode-on .v2-memory-action-emerald:hover {
  background: rgba(16, 185, 129, 0.24) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
}

/* Active buttons in light mode */
.v2-memory-action-rose.is-active,
.v2-quick-memory-action-rose.is-active {
  color: #fff !important;
  background: #e11d48 !important;
  border-color: #e11d48 !important;
  box-shadow: 0 4px 12px rgba(225, 29, 72, .28);
}

.v2-memory-action-amber.is-active,
.v2-quick-memory-action-amber.is-active {
  color: #fff !important;
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, .28);
}

.v2-memory-action-emerald.is-active,
.v2-quick-memory-action-emerald.is-active {
  color: #fff !important;
  background: #10b981 !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, .28);
}

/* Active buttons in dark mode */
html.dark .v2-memory-action-rose.is-active,
html[data-theme="dark"] .v2-memory-action-rose.is-active,
.dark .v2-memory-action-rose.is-active,
[data-theme="dark"] .v2-memory-action-rose.is-active,
html.anki-mode-on .v2-memory-action-rose.is-active {
  color: #fff !important;
  background: #e11d48 !important;
  background-color: #e11d48 !important;
  border-color: #e11d48 !important;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.45) !important;
}

html.dark .v2-memory-action-amber.is-active,
html[data-theme="dark"] .v2-memory-action-amber.is-active,
.dark .v2-memory-action-amber.is-active,
[data-theme="dark"] .v2-memory-action-amber.is-active,
html.anki-mode-on .v2-memory-action-amber.is-active {
  color: #fff !important;
  background: #d97706 !important;
  background-color: #d97706 !important;
  border-color: #d97706 !important;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.45) !important;
}

html.dark .v2-memory-action-emerald.is-active,
html[data-theme="dark"] .v2-memory-action-emerald.is-active,
.dark .v2-memory-action-emerald.is-active,
[data-theme="dark"] .v2-memory-action-emerald.is-active,
html.anki-mode-on .v2-memory-action-emerald.is-active {
  color: #fff !important;
  background: #059669 !important;
  background-color: #059669 !important;
  border-color: #059669 !important;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.45) !important;
}

/* Guess countdown placeholder card in dark mode */
html.dark .v2-card-guess-placeholder,
html[data-theme="dark"] .v2-card-guess-placeholder,
.dark .v2-card-guess-placeholder,
[data-theme="dark"] .v2-card-guess-placeholder,
html.anki-mode-on .v2-card-guess-placeholder {
  background: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

html.dark .v2-card-guess-placeholder:hover,
html[data-theme="dark"] .v2-card-guess-placeholder:hover,
.dark .v2-card-guess-placeholder:hover,
[data-theme="dark"] .v2-card-guess-placeholder:hover,
html.anki-mode-on .v2-card-guess-placeholder:hover {
  background: rgba(30, 41, 59, 0.6) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
}

html.dark .v2-card-guess-placeholder p,
html[data-theme="dark"] .v2-card-guess-placeholder p,
.dark .v2-card-guess-placeholder p,
[data-theme="dark"] .v2-card-guess-placeholder p,
html.anki-mode-on .v2-card-guess-placeholder p {
  color: #94a3b8 !important;
}

html.dark .v2-card-guess-placeholder b,
html[data-theme="dark"] .v2-card-guess-placeholder b,
.dark .v2-card-guess-placeholder b,
[data-theme="dark"] .v2-card-guess-placeholder b,
html.anki-mode-on .v2-card-guess-placeholder b {
  color: #818cf8 !important;
}

/* Revealed answer card in dark mode (tools, signs, safety) */
html.dark .v2-card-answer-revealed,
html[data-theme="dark"] .v2-card-answer-revealed,
.dark .v2-card-answer-revealed,
[data-theme="dark"] .v2-card-answer-revealed,
html.anki-mode-on .v2-card-answer-revealed {
  background: #131b2e !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

html.dark .v2-card-answer-revealed .v2-ko-text,
html[data-theme="dark"] .v2-card-answer-revealed .v2-ko-text,
.dark .v2-card-answer-revealed .v2-ko-text,
[data-theme="dark"] .v2-card-answer-revealed .v2-ko-text,
html.anki-mode-on .v2-card-answer-revealed .v2-ko-text {
  color: #f1f5f9 !important;
}

html.dark .v2-card-answer-revealed .v2-vi-text,
html[data-theme="dark"] .v2-card-answer-revealed .v2-vi-text,
.dark .v2-card-answer-revealed .v2-vi-text,
[data-theme="dark"] .v2-card-answer-revealed .v2-vi-text,
html.anki-mode-on .v2-card-answer-revealed .v2-vi-text {
  color: #fbbf24 !important;
}

/* Print Guide Modal Dark Mode */
html.dark #v2-study-print-modal .v2-print-dialog,
html[data-theme="dark"] #v2-study-print-modal .v2-print-dialog,
.dark #v2-study-print-modal .v2-print-dialog,
[data-theme="dark"] #v2-study-print-modal .v2-print-dialog,
html.anki-mode-on #v2-study-print-modal .v2-print-dialog {
  background: #0f172a !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.68) !important;
}

html.dark #v2-study-print-modal .v2-print-head,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head,
.dark #v2-study-print-modal .v2-print-head,
[data-theme="dark"] #v2-study-print-modal .v2-print-head,
html.anki-mode-on #v2-study-print-modal .v2-print-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html.dark #v2-study-print-modal .v2-print-head h3,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head h3,
.dark #v2-study-print-modal .v2-print-head h3,
[data-theme="dark"] #v2-study-print-modal .v2-print-head h3,
html.anki-mode-on #v2-study-print-modal .v2-print-head h3 {
  color: #f8fafc !important;
}

html.dark #v2-study-print-modal .v2-print-head p,
html[data-theme="dark"] #v2-study-print-modal .v2-print-head p,
.dark #v2-study-print-modal .v2-print-head p,
[data-theme="dark"] #v2-study-print-modal .v2-print-head p,
html.anki-mode-on #v2-study-print-modal .v2-print-head p {
  color: #94a3b8 !important;
}

html.dark #v2-study-print-modal .v2-print-close,
html[data-theme="dark"] #v2-study-print-modal .v2-print-close,
.dark #v2-study-print-modal .v2-print-close,
[data-theme="dark"] #v2-study-print-modal .v2-print-close,
html.anki-mode-on #v2-study-print-modal .v2-print-close {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

html.dark #v2-study-print-modal .v2-print-close:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-close:hover,
.dark #v2-study-print-modal .v2-print-close:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-close:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-close:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}

html.dark #v2-study-print-modal .v2-print-option,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option,
.dark #v2-study-print-modal .v2-print-option,
[data-theme="dark"] #v2-study-print-modal .v2-print-option,
html.anki-mode-on #v2-study-print-modal .v2-print-option {
  background: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #f1f5f9 !important;
}

html.dark #v2-study-print-modal .v2-print-option:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option:hover,
.dark #v2-study-print-modal .v2-print-option:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-option:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-option:hover {
  background: #25334d !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
}

html.dark #v2-study-print-modal .v2-print-option strong,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option strong,
.dark #v2-study-print-modal .v2-print-option strong,
[data-theme="dark"] #v2-study-print-modal .v2-print-option strong,
html.anki-mode-on #v2-study-print-modal .v2-print-option strong {
  color: #f8fafc !important;
}

html.dark #v2-study-print-modal .v2-print-option small,
html[data-theme="dark"] #v2-study-print-modal .v2-print-option small,
.dark #v2-study-print-modal .v2-print-option small,
[data-theme="dark"] #v2-study-print-modal .v2-print-option small,
html.anki-mode-on #v2-study-print-modal .v2-print-option small {
  color: #94a3b8 !important;
}

html.dark #v2-study-print-modal .v2-print-check,
html[data-theme="dark"] #v2-study-print-modal .v2-print-check,
.dark #v2-study-print-modal .v2-print-check,
[data-theme="dark"] #v2-study-print-modal .v2-print-check,
html.anki-mode-on #v2-study-print-modal .v2-print-check {
  background: #0f172a !important;
  border-color: #475569 !important;
}

html.dark #v2-study-print-modal input:checked+.v2-print-check,
html[data-theme="dark"] #v2-study-print-modal input:checked+.v2-print-check,
.dark #v2-study-print-modal input:checked+.v2-print-check,
[data-theme="dark"] #v2-study-print-modal input:checked+.v2-print-check,
html.anki-mode-on #v2-study-print-modal input:checked+.v2-print-check {
  border-color: #6366f1 !important;
  background: #6366f1 !important;
}

html.dark #v2-study-print-modal .v2-print-info,
html[data-theme="dark"] #v2-study-print-modal .v2-print-info,
.dark #v2-study-print-modal .v2-print-info,
[data-theme="dark"] #v2-study-print-modal .v2-print-info,
html.anki-mode-on #v2-study-print-modal .v2-print-info {
  color: #93c5fd !important;
  background: rgba(30, 58, 138, 0.25) !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

html.dark #v2-study-print-modal .v2-print-footer,
html[data-theme="dark"] #v2-study-print-modal .v2-print-footer,
.dark #v2-study-print-modal .v2-print-footer,
[data-theme="dark"] #v2-study-print-modal .v2-print-footer,
html.anki-mode-on #v2-study-print-modal .v2-print-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html.dark #v2-study-print-modal [data-v2-print-summary],
html[data-theme="dark"] #v2-study-print-modal [data-v2-print-summary],
.dark #v2-study-print-modal [data-v2-print-summary],
[data-theme="dark"] #v2-study-print-modal [data-v2-print-summary],
html.anki-mode-on #v2-study-print-modal [data-v2-print-summary] {
  color: #94a3b8 !important;
}

html.dark #v2-study-print-modal .v2-print-open,
html[data-theme="dark"] #v2-study-print-modal .v2-print-open,
.dark #v2-study-print-modal .v2-print-open,
[data-theme="dark"] #v2-study-print-modal .v2-print-open,
html.anki-mode-on #v2-study-print-modal .v2-print-open {
  background: #6366f1 !important;
}

html.dark #v2-study-print-modal .v2-print-open:hover,
html[data-theme="dark"] #v2-study-print-modal .v2-print-open:hover,
.dark #v2-study-print-modal .v2-print-open:hover,
[data-theme="dark"] #v2-study-print-modal .v2-print-open:hover,
html.anki-mode-on #v2-study-print-modal .v2-print-open:hover {
  background: #4f46e5 !important;
}

.v2-player-control-btn,
.v2-player-filter-btn {
  min-height: 28px;
  height: 28px;
  font-size: 10.5px;
  line-height: 1;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.v2-player-control-btn i,
.v2-player-filter-btn i {
  font-size: 11px;
  line-height: 1;
  flex-shrink: 0;
}

/* ==========================================================================
   V2 MODERN COMPACT EDTECH DESIGN SYSTEM (Player Card, Answer Card & Question List)
   ========================================================================== */

.v2-answer-info-card {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 1rem !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.v2-answer-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 10.5px;
  font-weight: 700;
  color: #4338ca;
  background-color: #eef2ff;
  border: 1px solid #e0e7ff;
  border-radius: 0.375rem;
  padding: 0.18rem 0.42rem;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

@media (min-width: 640px) {
  .v2-answer-tag {
    gap: 0.35rem;
    font-size: 11px;
    padding: 0.2rem 0.5rem;
  }
}

.v2-panel-custom-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 10px;
  font-weight: 700;
  color: #047857;
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 0.375rem;
  padding: 0.15rem 0.4rem;
  line-height: 1.2;
  white-space: nowrap;
}

.v2-header-icon-btn {
  height: 26px;
  min-height: 26px;
  width: 26px;
  min-width: 26px;
  padding: 0;
  border-radius: 0.45rem;
  border-width: 1px;
  border-style: solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .v2-header-icon-btn {
    height: 28px;
    min-height: 28px;
    width: 28px;
    min-width: 28px;
    border-radius: 0.5rem;
    font-size: 11px;
  }
}

.v2-header-icon-btn:active {
  transform: scale(0.95);
}

.v2-header-pill-btn {
  height: 26px;
  min-height: 26px;
  padding: 0 0.45rem;
  border-radius: 0.45rem;
  border-width: 1px;
  border-style: solid;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .v2-header-pill-btn {
    height: 28px;
    min-height: 28px;
    padding: 0 0.65rem;
    border-radius: 0.5rem;
    gap: 0.35rem;
    font-size: 11px;
  }
}

.v2-header-pill-btn:active {
  transform: scale(0.95);
}

.v2-answer-ko-text {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b !important;
  line-height: 1.45;
  letter-spacing: -0.01em;
  word-break: break-word;
}

@media (min-width: 640px) {
  .v2-answer-ko-text {
    font-size: 16px;
  }
}

.v2-answer-vi-text {
  font-size: 12.5px;
  font-weight: 500;
  color: #475569 !important;
  line-height: 1.5;
  word-break: break-word;
}

@media (min-width: 640px) {
  .v2-answer-vi-text {
    font-size: 13.5px;
  }
}

.v2-mic-pill-btn {
  height: 32px;
  min-height: 32px;
  padding: 0 0.75rem;
  border-radius: 0.625rem;
  background-color: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.v2-mic-pill-btn:hover {
  background-color: #ffe4e6;
}

.v2-mic-pill-btn:active {
  transform: scale(0.96);
}

/* =========================================================
   SMART SCREEN ORIENTATION GUARD (SAMSUNG INTERNET & MOBILE)
   ========================================================= */
@keyframes hw-phone-rotate-hint {

  0%,
  15% {
    transform: rotate(0deg);
  }

  45%,
  65% {
    transform: rotate(-90deg);
  }

  90%,
  100% {
    transform: rotate(0deg);
  }
}

.hw-rotate-hint-icon {
  display: inline-block;
  animation: hw-phone-rotate-hint 2.2s ease-in-out infinite;
  transform-origin: center center;
}

.hw-smart-orientation-guard {
  padding-left: max(16px, env(safe-area-inset-left, 16px)) !important;
  padding-right: max(16px, env(safe-area-inset-right, 16px)) !important;
  top: max(8px, env(safe-area-inset-top, 8px)) !important;
  animation: hw-modal-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (orientation: landscape) and (max-height: 600px) {
  body {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

#units-q-list,
#basic-q-list,
#commands-q-list,
#scenarios-q-list,
#labor-safety-q-list,
#action-instructions-q-list,
#calc-q-list {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: content;
  will-change: scroll-position;
  -webkit-overflow-scrolling: touch;
}

html:not(.dark) .v2-player-q-item {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.75rem !important;
  padding: 0.625rem 0.75rem !important;
  display: flex !important;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  contain: layout style;
  box-sizing: border-box;
}

html.dark .v2-player-q-item {
  background-color: #111827 !important;
  border: 1px solid #1e293b !important;
  border-radius: 0.75rem !important;
  padding: 0.625rem 0.75rem !important;
  display: flex !important;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  contain: layout style;
  box-sizing: border-box;
  color: #f8fafc !important;
}

html:not(.dark) .v2-player-q-item:hover {
  border-color: #c7d2fe !important;
  background-color: #f8faff !important;
}

html.dark .v2-player-q-item:hover {
  border-color: #4f46e5 !important;
  background-color: #1e293b !important;
}

html:not(.dark) .v2-player-q-item.basic-q-active,
html:not(.dark) .v2-player-q-item.commands-q-active,
html:not(.dark) .v2-player-q-item.units-q-active,
html:not(.dark) .v2-player-q-item.calc-q-active,
html:not(.dark) .calc-q-active,
html:not(.dark) .v2-player-q-item.scenarios-q-active,
html:not(.dark) .v2-player-q-item.rules-q-active,
html:not(.dark) .v2-player-q-item.action-instructions-q-active {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdfa 100%) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.18) !important;
}

html.dark .v2-player-q-item.basic-q-active,
html.dark .v2-player-q-item.commands-q-active,
html.dark .v2-player-q-item.units-q-active,
html.dark .v2-player-q-item.calc-q-active,
html.dark .calc-q-active,
html.dark .v2-player-q-item.scenarios-q-active,
html.dark .v2-player-q-item.rules-q-active,
html.dark .v2-player-q-item.action-instructions-q-active {
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.55) 0%, rgba(30, 27, 75, 0.75) 100%) !important;
  border-color: #6366f1 !important;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35) !important;
}

.v2-q-idx-badge {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 0.5rem;
  background-color: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

html.dark .v2-q-idx-badge {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}

.basic-q-active .v2-q-idx-badge,
.commands-q-active .v2-q-idx-badge,
.units-q-active .v2-q-idx-badge,
.calc-q-active .v2-q-idx-badge,
.scenarios-q-active .v2-q-idx-badge,
.rules-q-active .v2-q-idx-badge,
.action-instructions-q-active .v2-q-idx-badge {
  background-color: #4f46e5 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3) !important;
}

html:not(.dark) .v2-player-q-item .v2-ko-text {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b !important;
  line-height: 1.35;
}

html.dark .v2-player-q-item .v2-ko-text {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc !important;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .v2-player-q-item .v2-ko-text {
    font-size: 13.5px;
  }
}

html:not(.dark) .v2-player-q-item .v2-vi-text {
  font-size: 11px;
  font-weight: 500;
  color: #64748b !important;
  line-height: 1.3;
}

html.dark .v2-player-q-item .v2-vi-text {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8 !important;
  line-height: 1.3;
}

/* Action Instructions Player Panel Dark Mode (Image 4) */
html.dark #action-instructions-player-info-panel {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
}

html.dark #action-instructions-player-info-panel .hw-bg-slate-50\/80 {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

html.dark #action-instructions-player-action {
  color: #f8fafc !important;
}

html.dark #action-instructions-player-info-panel .v2-answer-tag {
  background-color: rgba(245, 158, 11, 0.18) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

html.dark #action-instructions-player-mic-btn {
  background-color: rgba(245, 158, 11, 0.18) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

html.dark #action-instructions-player-mic-btn:hover {
  background-color: rgba(245, 158, 11, 0.28) !important;
  color: #fef08a !important;
}

html.dark #action-instructions-player-mic-feedback {
  color: #94a3b8 !important;
}

.v2-mem-badge {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  margin-left: auto;
  flex-shrink: 0;
}

.v2-custom-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
}

.v2-mem-badge~.v2-custom-badge,
.v2-custom-badge~.v2-mem-badge {
  margin-left: 6px !important;
}

.v2-mem-badge .v2-svg-icon {
  width: 13px;
  height: 13px;
}

.v2-mem-badge-rose {
  color: #e11d48;
  background: #ffe4e6;
  border-color: #fecdd3;
}

.v2-mem-badge-amber {
  color: #d97706;
  background: #fef3c7;
  border-color: #fde68a;
}

.v2-mem-badge-emerald {
  color: #059669;
  background: #d1fae5;
  border-color: #a7f3d0;
}

.v2-tool-grid-item,
.v2-sign-grid-item,
.v2-safety-grid-item {
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.v2-tool-grid-item.v2-grid-item-active,
.v2-sign-grid-item.v2-grid-item-active,
.v2-safety-grid-item.v2-grid-item-active {
  border: 1.5px solid #6366f1 !important;
  background-color: #f8faff !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.16) !important;
  z-index: 2;
}

.v2-tool-grid-item .v2-mem-badge,
.v2-sign-grid-item .v2-mem-badge,
.v2-safety-grid-item .v2-mem-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  margin-left: 0;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.v2-keyword-token {
  display: inline;
  margin: 0 .1em;
  padding: .1em .35em;
  border-radius: .35em;
  background: #fef08a !important;
  /* Bright crisp gold highlight */
  border: 1px solid #fde047 !important;
  box-shadow: inset 0 -2px 0 rgba(234, 179, 8, 0.6) !important;
  color: #854d0e !important;
  /* Bold high-contrast dark amber text (crystal clear readable) */
  font-weight: 850;
  letter-spacing: .01em;
}

html.anki-mode-on .v2-keyword-token,
.dark .v2-keyword-token {
  background: rgba(234, 179, 8, 0.28) !important;
  border-color: rgba(250, 204, 21, 0.5) !important;
  color: #fef08a !important;
  box-shadow: inset 0 -1px 0 rgba(250, 204, 21, 0.75) !important;
}

#v2-view-interview.v2-mode-keyword .v2-answer-recall {
  border-left: 3px solid #eab308;
  padding-left: .62rem;
}

#v2-view-interview.v2-mode-hidden .v2-answer-recall:not(.v2-revealed) {
  position: relative;
  min-height: 1.65em;
  color: transparent !important;
  text-shadow: none !important;
  user-select: none;
  cursor: pointer;
  border-radius: .55rem;
  background: repeating-linear-gradient(-45deg, rgba(226, 232, 240, .7) 0 5px, rgba(203, 213, 225, .85) 5px 10px);
  border: 1px dashed #94a3b8;
}

#v2-view-interview.v2-mode-hidden .v2-answer-recall:not(.v2-revealed) .v2-keyword-token {
  color: transparent !important;
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

#v2-view-interview.v2-mode-hidden .v2-answer-recall:not(.v2-revealed)::after {
  content: "Bấm để mở đáp án";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .015em;
  pointer-events: none;
}

#v2-view-interview.v2-mode-hidden .v2-answer-recall.v2-revealed {
  animation: v2-reveal-answer .18s ease-out;
}

@keyframes v2-reveal-answer {
  from {
    opacity: .25;
    transform: translateY(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.v2-quick-memory-action {
  min-height: 42px;
  padding: .5rem .25rem;
  border-radius: .72rem;
  background: #fff;
  font-size: 11px;
}

.v2-quick-memory-action-rose:hover {
  background: #fff1f2;
}

.v2-quick-memory-action-amber:hover {
  background: #fffbeb;
}

.v2-quick-memory-action-emerald:hover {
  background: #ecfdf5;
}

.v2-reveal-answer-button {
  min-height: 44px;
  padding: .7rem 1rem;
  border-radius: .75rem;
  color: #fff;
  background: #4f46e5;
  border-color: #6366f1;
  font-size: 12px;
}

.v2-reveal-answer-button:hover {
  background: #4338ca;
}

@media (max-width: 640px) {
  .v2-study-mode-button span {
    display: none;
  }

  .v2-study-mode-button {
    min-width: 31px;
    padding: .42rem;
  }

  .v2-memory-action {
    min-height: 25px;
    height: 25px;
    padding: .15rem .38rem;
    font-size: 10px;
    gap: .25rem;
  }

  .v2-memory-action .v2-svg-icon {
    width: 11px;
    height: 11px;
  }

  .v2-player-control-btn,
  .v2-player-filter-btn {
    min-height: 26px;
    height: 26px;
    font-size: 10px;
    padding: .15rem .25rem;
    box-sizing: border-box;
  }

  .v2-player-control-btn i,
  .v2-player-filter-btn i {
    font-size: 10px;
    line-height: 1;
  }
}

@media (max-width: 360px) {
  .v2-memory-action {
    padding: .12rem .28rem;
    font-size: 9.5px;
  }

  .v2-player-control-btn,
  .v2-player-filter-btn {
    font-size: 9px;
    padding: .12rem .2rem;
    min-height: 24px;
    height: 24px;
  }

  .v2-player-control-btn i,
  .v2-player-filter-btn i {
    font-size: 9px;
  }
}

/* ==========================================================================
   SHADOWING WORKSPACE
   A light, readable listening-and-speaking surface that works without
   external services. All selectors are scoped to the Shadowing tab.
   ========================================================================== */
#view-shadowing {
  color: #172033 !important;
  font-family: var(--font-vietnamese, Inter, system-ui, sans-serif);
}

#view-shadowing *,
#view-shadowing *::before,
#view-shadowing *::after {
  box-sizing: border-box;
}

#view-shadowing button,
#view-shadowing input,
#view-shadowing select,
#view-shadowing textarea {
  font: inherit;
}

.shadowing-shell {
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 2px 0 36px;
}

#shadowing-library[hidden],
#shadowing-workspace[hidden] {
  display: none !important;
}

.shadowing-library {
  display: grid;
  gap: 14px;
}

.shadowing-library-hero {
  padding: 16px 20px;
  border: 1px solid #c4b5fd;
  border-radius: 18px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(122deg, #22105f, #4f36d5 62%, #7658ef);
  box-shadow: 0 10px 22px rgba(76, 57, 194, 0.14);
}

.shadowing-library-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shadowing-library-icon {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 13px;
  color: #312e81;
  background: #fff;
  font-size: 19px;
}

.shadowing-library-hero .shadowing-eyebrow,
.shadowing-library-hero h2,
.shadowing-library-hero p {
  color: #fff !important;
}

.shadowing-library-hero h2 {
  margin: 2px 0;
  font-size: clamp(22px, 2.3vw, 28px);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.shadowing-library-hero p {
  max-width: 700px;
  margin: 0;
  color: #e9e5ff !important;
  font-size: 13px;
  line-height: 1.42;
}

.shadowing-library-add,
.shadowing-library-group {
  padding: 22px;
  border: 1px solid #dbe4f0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.shadowing-library-add {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.2fr);
  align-items: center;
  gap: 8px 18px;
  padding: 16px 20px;
  border-radius: 18px;
}

.shadowing-library-add h3,
.shadowing-library-group h3 {
  margin: 2px 0;
  color: #172033;
  font-size: 18px;
  font-weight: 900;
}

.shadowing-library-add p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.42;
}

.shadowing-library-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.shadowing-library-add-form input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #172033;
  background: #fff;
  outline: none;
}

.shadowing-library-add-form input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.shadowing-library-message {
  grid-column: 1 / -1;
  min-height: 0;
  color: #64748b;
  font-size: 12px;
}

.shadowing-library-message:empty {
  display: none;
}

.shadowing-library-message.is-warning {
  color: #b45309;
}

.shadowing-library-message.is-success {
  color: #047857;
}

.shadowing-library-group-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.shadowing-lesson-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-color: #c4b5fd transparent;
}

.shadowing-lesson-card {
  display: flex;
  flex: 0 0 clamp(250px, 23vw, 310px);
  min-width: 250px;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0 !important;
  border-radius: 16px;
  color: #172033;
  background: #fff;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.shadowing-lesson-card:hover,
.shadowing-lesson-card:focus-visible {
  transform: translateY(-3px);
  border-color: #cbd5e1 !important;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  outline: none;
}

.shadowing-lesson-art {
  position: relative;
  display: flex;
  min-height: 146px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  padding: 13px;
  overflow: hidden;
  color: #fff;
  background: #0f172a;
}

.shadowing-lesson-art::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.04) 26%, rgba(15, 23, 42, 0.78) 100%);
  content: '';
}

.shadowing-lesson-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  object-fit: cover;
  display: block;
}

.shadowing-lesson-art img.is-fallback-icon {
  object-fit: contain;
  padding: 28px;
  background: #1e293b;
}

.shadowing-lesson-art span,
.shadowing-lesson-art strong,
.shadowing-lesson-art em {
  position: relative;
  z-index: 1;
}

.shadowing-lesson-art span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #312e81;
  background: #fef3c7;
  font-size: 10px;
  font-weight: 900;
}

.shadowing-lesson-art strong {
  max-width: 86%;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(15, 23, 42, 0.72);
}

.shadowing-lesson-art em {
  position: absolute;
  right: 10px;
  bottom: 9px;
  padding: 4px 7px;
  border-radius: 8px;
  color: #fff;
  background: rgba(15, 23, 42, 0.78);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.shadowing-lesson-copy {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.shadowing-lesson-copy h4 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #172033;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  -webkit-line-clamp: 2;
}

.shadowing-lesson-copy p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.shadowing-lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-lesson-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.shadowing-lesson-card.create-card {
  justify-content: center;
  min-height: 273px;
  padding: 20px;
  border-style: dashed !important;
  color: #4f46e5;
  background: linear-gradient(145deg, #fafaff, #f1f5ff);
}

.shadowing-lesson-card.create-card>i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 13px;
  color: #fff;
  background: #6d4ce8;
}

.shadowing-lesson-card.create-card h4 {
  margin: 0 0 5px;
  color: #312e81;
}

.shadowing-lesson-card.create-card p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.shadowing-library-empty {
  padding: 28px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #64748b;
  text-align: center;
}

.shadowing-back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.36) !important;
  border-radius: 9px;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1) !important;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-back-button:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.shadowing-hero {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex: 0 0 auto;
  min-height: 0;
  gap: 14px;
  padding: 16px 20px;
  margin-bottom: 12px;
  color: #f8fafc;
  border: 1px solid rgba(196, 181, 253, 0.3);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 0%, rgba(167, 139, 250, 0.38), transparent 36%),
    linear-gradient(125deg, #24135a 0%, #3730a3 54%, #4f46e5 100%);
  box-shadow: 0 10px 24px rgba(55, 48, 163, 0.15);
}

/* The workspace must never inherit a stretched flex/grid row from the app shell.
   A compact grid keeps the title and controls together at every viewport width. */
#shadowing-workspace {
  display: block;
  min-height: 0;
}

#shadowing-workspace>.shadowing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  align-items: start;
  align-content: start;
  justify-content: initial;
  align-self: start !important;
  height: fit-content !important;
  min-height: 0 !important;
}

/* Session controls live beside the player instead of using a large page hero. */
.shadowing-session-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
}

.shadowing-session-bar .shadowing-back-button {
  flex: 0 0 auto;
  margin: 0;
  color: #475569 !important;
  border-color: #cbd5e1 !important;
  background: #fff !important;
}

.shadowing-session-bar .shadowing-back-button:hover {
  background: #eef2ff !important;
}

.shadowing-session-bar .shadowing-title-field {
  min-width: 0;
  gap: 0;
}

.shadowing-session-bar .shadowing-title-field>span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.shadowing-session-bar .shadowing-title-field input {
  min-height: 36px;
  padding: 6px 9px;
  border-color: #cbd5e1;
}

.shadowing-session-bar .shadowing-keyboard-tip {
  color: #64748b;
  font-size: 10px;
}

.shadowing-eyebrow,
.shadowing-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shadowing-eyebrow {
  color: #ddd6fe;
}

.shadowing-hero h2 {
  margin: 3px 0;
  color: #fff !important;
  font-size: clamp(21px, 2.4vw, 27px);
  line-height: 1.18;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.shadowing-hero p {
  max-width: 710px;
  margin: 0;
  color: #ddd6fe !important;
  font-size: 13px;
  line-height: 1.42;
}

.shadowing-hero-actions {
  flex: 0 1 300px;
  min-width: 240px;
  display: grid;
  gap: 6px;
}

.shadowing-title-field {
  display: grid;
  gap: 3px;
  color: #ede9fe;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-title-field input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  color: #172033 !important;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 11px;
  outline: none;
  background: #fff !important;
}

.shadowing-title-field input:focus {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.35);
}

.shadowing-keyboard-tip {
  color: #ede9fe;
  font-size: 10px;
  white-space: nowrap;
}

.shadowing-keyboard-tip kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  padding: 2px 5px;
  margin: 0 2px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.24);
  font-size: 10px;
  font-family: inherit;
  font-weight: 800;
}

.shadowing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(340px, 0.86fr);
  grid-template-areas:
    "player transcript"
    "player coach";
  align-items: start;
  gap: 18px;
}

.shadowing-player-card {
  grid-area: player;
  align-self: start;
  position: sticky;
  top: 16px;
  z-index: 10;
}

.shadowing-coach-card {
  grid-area: coach;
}

.shadowing-transcript-card {
  grid-area: transcript;
}

.shadowing-player-card,
.shadowing-coach-card,
.shadowing-transcript-card {
  min-width: 0;
  border: 1px solid #dbe4f0 !important;
  border-radius: 20px;
  background: #fff !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
  padding: 18px;
}

.shadowing-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}

.shadowing-section-kicker {
  color: #6d28d9;
}

.shadowing-card-heading h3 {
  margin: 6px 0 0;
  color: #172033 !important;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.shadowing-status {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  padding: 7px 9px;
  color: #475569;
  border-radius: 8px;
  background: #f1f5f9;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 650;
}

.shadowing-status.success {
  color: #047857;
  background: #ecfdf5;
}

.shadowing-status.warning {
  color: #b45309;
  background: #fffbeb;
}

.shadowing-status.recording {
  color: #be123c;
  background: #fff1f2;
}

.shadowing-media-stage {
  position: relative;
  display: grid;
  min-height: 236px;
  overflow: hidden;
  border: 1px dashed #c7d2fe;
  border-radius: 16px;
  background:
    radial-gradient(circle at 82% 12%, rgba(196, 181, 253, 0.36), transparent 28%),
    linear-gradient(145deg, #f8faff 0%, #eef2ff 100%);
}

.shadowing-media-stage.has-media,
.shadowing-media-stage.has-youtube {
  min-height: 0;
  aspect-ratio: 16 / 9;
  border-style: solid;
  border-color: #cbd5e1;
  background: #0f172a;
}

.shadowing-media-empty {
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.shadowing-media-empty i {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #5b21b6;
  border-radius: 50%;
  background: #e9e4ff;
  font-size: 22px;
}

.shadowing-media-empty strong {
  color: #312e81;
  font-size: 14px;
}

.shadowing-media-empty span {
  color: #64748b;
  font-size: 12px;
}

.shadowing-media-stage video {
  display: none;
  width: 100%;
  max-height: 380px;
  align-self: center;
  object-fit: contain;
  background: #0f172a;
}

.shadowing-media-stage.has-media video {
  display: block;
}

.shadowing-youtube-host {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 236px;
  background: #0f172a;
}

.shadowing-media-stage.has-youtube .shadowing-youtube-host {
  display: block;
}

.shadowing-youtube-host iframe,
.shadowing-youtube-host>div {
  width: 100% !important;
  height: 100% !important;
  min-height: 236px;
  border: 0;
}

.shadowing-media-import {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

.shadowing-local-media-hint {
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.shadowing-local-media-hint i {
  color: #7c3aed;
}

.shadowing-url-input {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
}

.shadowing-url-input input,
#view-shadowing textarea,
.shadowing-select-label select {
  min-width: 0;
  color: #172033 !important;
  border: 1px solid #cbd5e1 !important;
  outline: none;
  background: #fff !important;
}

.shadowing-url-input input {
  flex: 1;
  min-height: 39px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.shadowing-url-input input:focus,
#view-shadowing textarea:focus,
.shadowing-select-label select:focus {
  border-color: #7c3aed !important;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.shadowing-builtin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.shadowing-builtin-row .shadowing-text-button {
  padding: 3px 0;
  color: #5b21b6;
}

.shadowing-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 14px;
  margin-top: 9px;
}

.shadowing-transport-deck {
  margin-top: 9px;
  padding: 8px 0 0;
  border-top: 1px solid #edf0f6;
}

.shadowing-button,
.shadowing-icon-button,
.shadowing-play-button,
.shadowing-text-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.shadowing-button:focus-visible,
.shadowing-icon-button:focus-visible,
.shadowing-play-button:focus-visible,
.shadowing-text-button:focus-visible,
.shadowing-segment:focus-visible,
.shadowing-mode-switch button:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.28);
  outline-offset: 2px;
}

.shadowing-button:hover:not(:disabled),
.shadowing-icon-button:hover:not(:disabled),
.shadowing-play-button:hover:not(:disabled),
.shadowing-text-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.shadowing-button:disabled,
.shadowing-icon-button:disabled,
.shadowing-play-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shadowing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 39px;
  padding: 8px 12px;
  color: #312e81;
  border: 1px solid #c7d2fe !important;
  border-radius: 10px;
  background: #eef2ff !important;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.shadowing-button.primary {
  color: #fff;
  border-color: #6d28d9 !important;
  background: #6d28d9 !important;
  box-shadow: 0 6px 14px rgba(109, 40, 217, 0.18);
}

.shadowing-button.secondary {
  color: #334155;
  border-color: #cbd5e1 !important;
  background: #fff !important;
}

.shadowing-button.ghost {
  color: #475569;
  border-color: #d8dee9 !important;
  background: #f8fafc !important;
}

.shadowing-button.loop {
  color: #5b21b6;
  border-color: #ddd6fe !important;
  background: #f5f3ff !important;
}

.shadowing-button.loop.is-on {
  color: #fff;
  border-color: #7c3aed !important;
  background: #7c3aed !important;
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.22);
}

.shadowing-button.complete {
  width: 100%;
  color: #047857;
  border-color: #a7f3d0 !important;
  background: #ecfdf5 !important;
}

.shadowing-button.record {
  color: #fff;
  border-color: #e11d48 !important;
  background: #e11d48 !important;
}

.shadowing-timeline-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  color: #64748b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

#shadowing-timeline {
  width: 100%;
  height: 5px;
  appearance: none;
  cursor: pointer;
  border-radius: 999px;
  background: #dbe4f0;
  accent-color: #7c3aed;
}

#shadowing-timeline::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #7c3aed;
  box-shadow: 0 1px 4px rgba(76, 29, 149, 0.3);
}

.shadowing-controls,
.shadowing-practice-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shadowing-controls {
  justify-content: center;
}

.shadowing-practice-controls {
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e7edf5;
}

.shadowing-icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #475569;
  border: 1px solid #dbe4f0 !important;
  border-radius: 50%;
  background: #fff !important;
}

.shadowing-play-button {
  min-width: 128px;
  min-height: 42px;
  padding: 9px 16px;
  color: #fff;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d28d9, #4f46e5) !important;
  box-shadow: 0 7px 15px rgba(79, 70, 229, 0.2);
  font-size: 13px;
  font-weight: 850;
}

.shadowing-select-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.shadowing-select-label select {
  height: 34px;
  padding: 4px 26px 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-speed-label {
  min-width: 36px;
  color: #5b21b6;
  font-size: 11px;
}

.shadowing-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.shadowing-check input {
  width: 15px;
  height: 15px;
  accent-color: #7c3aed;
}

.shadowing-media-note {
  margin: 10px 0 0;
  padding: 9px 10px;
  color: #92400e !important;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb;
  font-size: 11px;
  line-height: 1.45;
  font-weight: 700;
}

#view-shadowing button:disabled,
#view-shadowing select:disabled,
#view-shadowing input:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.shadowing-coach-card {
  display: flex;
  flex-direction: column;
}

.shadowing-current-time,
.shadowing-segment-count {
  display: inline-flex;
  padding: 5px 8px;
  color: #5b21b6;
  border-radius: 7px;
  background: #f5f3ff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  white-space: nowrap;
}

.shadowing-current-sentence {
  min-height: 132px;
  padding: 17px;
  margin-bottom: 13px;
  border: 1px solid #e0e7ff;
  border-radius: 14px;
  background: linear-gradient(145deg, #fafaff, #f5f3ff);
}

.shadowing-current-sentence p {
  margin: 0 0 10px;
  color: #1e1b4b !important;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.5;
  font-weight: 800;
  word-break: keep-all;
}

.shadowing-karaoke-line {
  display: flex;
  min-height: 94px;
  align-items: center;
  justify-content: center;
  align-content: center;
  flex-wrap: wrap;
  gap: 12px 10px;
  padding: 8px 2px 12px;
  text-align: center;
}

.shadowing-karaoke-token {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  border-radius: 8px;
  transition: color 0.12s ease, background-color 0.12s ease, transform 0.12s ease;
}

.shadowing-karaoke-reading {
  min-height: 14px;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 9px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.shadowing-karaoke-word {
  color: #111827;
  border-bottom: 3px solid transparent;
  font-size: clamp(22px, 2.15vw, 31px);
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: -0.035em;
  word-break: keep-all;
}

.shadowing-karaoke-token.is-active {
  transform: translateY(-1px);
}

.shadowing-karaoke-token.is-active .shadowing-karaoke-reading {
  color: #2563eb;
}

.shadowing-karaoke-token.is-active .shadowing-karaoke-word {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

.shadowing-karaoke-token.is-past .shadowing-karaoke-word {
  color: #334155;
}

.shadowing-current-reading {
  display: block;
  margin: -2px 0 8px;
  color: #2563eb;
  font-size: 11px;
  line-height: 1.5;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.shadowing-current-sentence small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

/* The learning line belongs directly under the video, where the learner can
   read it before playing, looping, or recording. */
.shadowing-inline-sentence {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #ddd6fe;
  border-radius: 14px;
  background: linear-gradient(135deg, #fbfaff, #f5f3ff);
}

.shadowing-inline-sentence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.shadowing-inline-sentence .shadowing-current-sentence {
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.shadowing-inline-sentence .shadowing-current-sentence p {
  margin: 0 0 5px;
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.36;
}

.shadowing-inline-sentence .shadowing-karaoke-line {
  min-height: 64px;
  gap: 8px;
  padding: 3px 0 6px;
}

.shadowing-inline-sentence .shadowing-karaoke-word {
  font-size: clamp(21px, 2vw, 28px);
}

.shadowing-inline-sentence .shadowing-current-reading {
  margin: 0 0 4px;
}

.shadowing-inline-sentence .shadowing-current-sentence small {
  font-size: 11px;
  line-height: 1.35;
}

.shadowing-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #f8fafc;
}

.shadowing-mode-switch button {
  min-height: 34px;
  color: #64748b;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.shadowing-mode-switch button.is-selected {
  color: #5b21b6;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.09);
}

.shadowing-recorder {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #fde2e7;
  border-radius: 13px;
  background: #fffafb;
}

.shadowing-recorder-heading,
.shadowing-recorder-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}

.shadowing-recorder-heading>span {
  color: #9f1239;
  font-size: 12px;
  font-weight: 850;
}

.shadowing-recorder-heading em {
  color: #e11d48;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.shadowing-recorder-heading em i {
  margin-right: 3px;
  font-size: 8px;
  animation: shadowing-pulse 1s infinite;
}

@keyframes shadowing-pulse {
  50% {
    opacity: 0.25;
  }
}

.shadowing-recorder-actions {
  justify-content: flex-start;
  margin-top: 8px;
}

.shadowing-recorder-actions .shadowing-button {
  min-height: 32px;
  padding: 5px 9px;
}

.shadowing-recorder-actions strong {
  margin-left: auto;
  color: #9f1239;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#shadowing-recording-output {
  margin-top: 8px;
}

#shadowing-recording-player {
  width: 100%;
  height: 32px;
}

.shadowing-recorder>p {
  margin: 7px 0 0;
  color: #7c6470 !important;
  font-size: 10px;
  line-height: 1.4;
}

.shadowing-progress-card {
  margin-top: auto;
  padding-top: 11px;
}

.shadowing-progress-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
}

.shadowing-progress-head strong {
  color: #5b21b6;
  font-weight: 900;
}

.shadowing-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e7ff;
}

.shadowing-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #6366f1);
  transition: width 0.3s ease;
}

.shadowing-progress-card dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 9px 0 0;
}

.shadowing-progress-card dl div {
  min-width: 0;
  padding: 6px 5px;
  text-align: center;
  border: 1px solid #e7edf5;
  border-radius: 9px;
  background: #fbfdff;
}

.shadowing-progress-card dt {
  color: #64748b;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 700;
}

.shadowing-progress-card dd {
  margin: 3px 0 0;
  color: #312e81;
  font-size: 15px;
  font-weight: 900;
}

.shadowing-transcript-card {
  grid-area: transcript;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  padding: 18px;
}

.shadowing-transcript-editor {
  flex: 0 0 auto;
  margin-top: 10px;
}

.shadowing-transcript-editor summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.shadowing-transcript-editor summary::-webkit-details-marker {
  display: none;
}

.shadowing-transcript-editor[open] summary {
  margin-bottom: 12px;
}

.shadowing-transcript-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

#view-shadowing textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 136px;
  padding: 12px 13px;
  border-radius: 12px;
  line-height: 1.55;
  font-size: 13px;
}

.shadowing-segment-list {
  display: grid;
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 380px;
  gap: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  margin-top: 14px;
  padding-right: 3px;
}

.shadowing-segment {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 11px;
  text-align: left;
  color: #1e293b;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px;
  background: #fff !important;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.shadowing-segment:hover {
  transform: translateX(2px);
  border-color: #c4b5fd !important;
  background: #fafaff !important;
}

.shadowing-segment.is-active {
  border-color: #8b5cf6 !important;
  background: #f5f3ff !important;
  box-shadow: 0 5px 14px rgba(124, 58, 237, 0.1);
}

.shadowing-segment.is-complete .shadowing-segment-number {
  color: #fff;
  background: #059669;
}

.shadowing-segment-number {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #5b21b6;
  border-radius: 8px;
  background: #ede9fe;
  font-size: 11px;
  font-weight: 900;
}

.shadowing-segment-copy {
  min-width: 0;
}

.shadowing-segment-copy b {
  display: block;
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shadowing-segment-copy small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shadowing-segment-time {
  padding-top: 4px;
  color: #64748b;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.shadowing-empty-list {
  display: grid;
  min-height: 118px;
  place-items: center;
  align-content: center;
  gap: 9px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 12px;
  text-align: center;
}

.shadowing-empty-list i {
  color: #7c3aed;
  font-size: 20px;
}

.shadowing-empty-list p {
  margin: 0;
}

.shadowing-transcript-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.shadowing-transcript-footer>div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shadowing-text-button {
  padding: 5px 6px;
  color: #5b21b6;
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-text-button.danger {
  color: #be123c;
}

@media (max-width: 980px) {
  .shadowing-library-add {
    grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  }

  .shadowing-hero {
    align-items: stretch;
    flex-direction: column;
  }

  #shadowing-workspace>.shadowing-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .shadowing-hero-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    max-width: 620px;
  }

  .shadowing-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "player"
      "coach"
      "transcript";
  }

  .shadowing-transcript-card {
    position: static;
    max-height: none;
  }

  .shadowing-segment-list {
    flex: initial;
    max-height: 440px;
  }

  .shadowing-coach-card {
    min-height: 0;
  }

  .shadowing-progress-card {
    margin-top: 17px;
  }
}

/* 3-Tab Platform Layout Additions & Compact Session Nav */
.shadowing-top-nav,
.shadowing-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
  margin-bottom: 12px;
  padding: 6px 10px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.shadowing-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shadowing-top-left .shadowing-back-button,
.shadowing-session-bar .shadowing-back-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px;
  color: #334155 !important;
  background: #fff !important;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.shadowing-top-left .shadowing-back-button:hover,
.shadowing-session-bar .shadowing-back-button:hover {
  background: #eef2ff !important;
  border-color: #818cf8 !important;
  color: #4338ca !important;
}

.shadowing-mode-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1.5px solid #0f172a;
  border-radius: 10px;
  background: #fff;
  box-shadow: 2px 2px 0 #0f172a;
}

.shadowing-tab-btn {
  padding: 5px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.shadowing-tab-btn:hover:not(.is-active) {
  background: #f1f5f9;
  color: #0f172a;
}

.shadowing-tab-btn.is-active {
  background: #22c55e;
  color: #fff;
}

.shadowing-top-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shadowing-top-tools .mini-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #d8dee9 !important;
  border-radius: 8px;
  background: #fff !important;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.shadowing-top-tools .mini-tool:hover {
  background: #f1f5f9 !important;
  color: #0f172a;
}

.shadowing-tab-panels-wrap {
  display: grid;
}

.shadowing-dictation-card {
  min-width: 0;
  border: 1px solid #dbe4f0 !important;
  border-radius: 20px;
  background: #fff !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
  padding: 18px;
}

.shadowing-dictation-box {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.shadowing-dictation-label {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

#shadowing-dictation-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  resize: vertical;
}

#shadowing-dictation-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.shadowing-dictation-hints-wrap {
  margin: 6px 0;
}

.shadowing-hints-title {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.shadowing-dictation-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.shadowing-hint-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.shadowing-hint-token.is-revealed {
  background: #fef9c3;
  border-color: #facc15;
  color: #854d0e;
}

.shadowing-dictation-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.shadowing-dictation-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.shadowing-stat-card {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.shadowing-stat-card.wide {
  grid-column: 1 / -1;
}

.shadowing-stat-card .stat-head {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
}

.shadowing-stat-card strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.shadowing-stat-card p {
  margin: 3px 0 0;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

.shadowing-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.shadowing-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
}

.shadowing-modal-box {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 16px 18px;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
}

.shadowing-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.shadowing-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.shadowing-modal-content .shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  color: #334155;
  border-bottom: 1px dashed #f1f5f9;
}

@media (max-width: 980px) {

  .shadowing-top-nav,
  .shadowing-session-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .shadowing-top-nav .shadowing-mode-tabs {
    width: 100%;
    justify-content: space-around;
  }

  .shadowing-top-left,
  .shadowing-top-tools {
    justify-content: space-between;
  }
}

@media (max-width: 767px) {
  .shadowing-library {
    gap: 13px;
  }

  .shadowing-library-hero,
  .shadowing-library-group {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .shadowing-library-hero {
    padding: 14px 16px;
  }

  .shadowing-library-add {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 16px;
  }

  .shadowing-library-title {
    align-items: flex-start;
    gap: 11px;
  }

  .shadowing-library-icon {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 16px;
  }

  .shadowing-library-hero h2 {
    font-size: 22px;
  }

  .shadowing-library-hero p,
  .shadowing-library-add p {
    font-size: 12px;
  }

  .shadowing-library-hero p,
  .shadowing-library-add>div>p {
    display: -webkit-box;
    max-height: 2.84em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    -webkit-line-clamp: 2;
  }

  .shadowing-library-add-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .shadowing-library-add-form .shadowing-button {
    justify-content: center;
    min-height: 40px;
    padding-inline: 11px;
  }

  .shadowing-library-group-heading {
    align-items: center;
  }

  .shadowing-lesson-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    overflow: visible;
    margin: 0;
    padding: 0;
    scroll-snap-type: none;
  }

  .shadowing-lesson-card {
    width: 100%;
    min-width: 0;
    flex-basis: auto;
  }

  #view-shadowing {
    width: 100%;
    min-width: 0;
    margin: 0;
    overflow-x: clip;
  }

  .shadowing-shell {
    width: 100%;
    min-width: 0;
    padding-bottom: 74px;
  }

  .shadowing-hero,
  .shadowing-player-card,
  .shadowing-coach-card,
  .shadowing-transcript-card {
    border-radius: 16px;
  }

  .shadowing-hero {
    gap: 9px;
    padding: 14px 16px;
    margin-bottom: 12px;
  }

  .shadowing-session-bar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 7px;
    margin-top: 8px;
    padding: 7px 8px;
  }

  .shadowing-session-bar .shadowing-keyboard-tip {
    grid-column: 1 / -1;
    max-width: none;
    padding: 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shadowing-hero h2 {
    font-size: 21px;
  }

  .shadowing-hero p {
    font-size: 12px;
    display: -webkit-box;
    max-height: 2.84em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    -webkit-line-clamp: 2;
  }

  .shadowing-hero-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    min-width: 0;
    gap: 8px;
  }

  .shadowing-title-field {
    gap: 0;
  }

  .shadowing-title-field>span {
    display: none;
  }

  .shadowing-title-field input {
    min-height: 37px;
  }

  .shadowing-keyboard-tip {
    max-width: 146px;
    padding-bottom: 10px;
  }

  .shadowing-keyboard-tip {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shadowing-layout {
    gap: 12px;
  }

  .shadowing-player-card,
  .shadowing-coach-card,
  .shadowing-transcript-card {
    padding: 12px;
  }

  .shadowing-card-heading {
    gap: 8px;
    margin-bottom: 12px;
  }

  .shadowing-card-heading h3 {
    font-size: 16px;
  }

  .shadowing-status {
    max-width: 142px;
    padding: 5px 7px;
    font-size: 9px;
  }

  .shadowing-media-stage {
    min-height: 175px;
    border-radius: 13px;
  }

  .shadowing-media-stage.has-media,
  .shadowing-media-stage.has-youtube {
    min-height: 0;
  }

  .shadowing-youtube-host,
  .shadowing-youtube-host iframe,
  .shadowing-youtube-host>div {
    min-height: 175px;
  }

  .shadowing-media-import {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    margin-top: 0;
  }

  .shadowing-source-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    margin-top: 8px;
  }

  .shadowing-local-media-hint {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shadowing-builtin-row {
    align-items: center;
    flex-direction: row;
    gap: 5px;
    min-width: 0;
  }

  .shadowing-builtin-row span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .shadowing-transport-deck {
    margin-top: 8px;
    padding-top: 7px;
  }

  .shadowing-url-input {
    width: 100%;
  }

  .shadowing-url-input input {
    min-width: 0;
  }

  .shadowing-controls {
    display: grid;
    grid-template-columns: 36px minmax(96px, 1fr) 36px 36px auto;
    gap: 6px;
    align-items: center;
  }

  .shadowing-play-button {
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
  }

  .shadowing-controls .shadowing-select-label {
    grid-column: auto;
    gap: 4px;
    white-space: nowrap;
  }

  .shadowing-controls .shadowing-select-label select {
    width: 57px;
    height: 32px;
    padding: 3px 18px 3px 6px;
  }

  .shadowing-speed-label {
    display: none;
  }

  .shadowing-practice-controls {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .shadowing-current-sentence {
    min-height: 112px;
    padding: 13px;
  }

  .shadowing-inline-sentence {
    margin-top: 8px;
    padding: 9px 10px;
  }

  .shadowing-inline-sentence-head {
    margin-bottom: 3px;
  }

  .shadowing-inline-sentence .shadowing-current-sentence {
    min-height: 0;
    padding: 0;
  }

  .shadowing-inline-sentence .shadowing-karaoke-line {
    min-height: 58px;
    gap: 7px;
    padding-bottom: 4px;
  }

  .shadowing-inline-sentence .shadowing-karaoke-word {
    font-size: clamp(19px, 6.2vw, 26px);
  }

  .shadowing-current-sentence p {
    font-size: 17px;
  }

  .shadowing-karaoke-line {
    min-height: 76px;
    gap: 9px 7px;
    padding: 5px 0 9px;
  }

  .shadowing-karaoke-word {
    font-size: clamp(19px, 6.7vw, 27px);
  }

  .shadowing-karaoke-reading {
    font-size: 8px;
  }

  .shadowing-transcript-tools .shadowing-button {
    flex: 1 1 auto;
  }

  #view-shadowing textarea {
    min-height: 128px;
    font-size: 12px;
  }

  .shadowing-segment {
    grid-template-columns: 27px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 9px;
  }

  .shadowing-segment-number {
    width: 25px;
    height: 25px;
  }

  .shadowing-segment-copy b {
    font-size: 12px;
  }

  .shadowing-transcript-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  #hw-app-layout>nav.md\:hw-hidden .hw-tab-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  #hw-app-layout>nav.md\:hw-hidden .hw-tab-btn span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .shadowing-controls {
    grid-template-columns: 36px minmax(0, 1fr) 36px 36px;
  }

  .shadowing-controls .shadowing-select-label {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

@media (max-width: 390px) {
  .shadowing-hero {
    padding: 13px 14px;
  }

  .shadowing-player-card,
  .shadowing-coach-card,
  .shadowing-transcript-card {
    padding: 11px;
  }

  .shadowing-status {
    display: none;
  }

  .shadowing-progress-card dl div {
    padding: 7px 3px;
  }
}

/* Compact, read-only indicator for the automatic flashcard source. */
.hw-review-profile-scope {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 148px;
  padding: 4px 8px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #c7d2fe;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hw-review-profile-scope.is-manual {
  border-color: rgba(16, 185, 129, 0.34);
  background: rgba(16, 185, 129, 0.1);
  color: #a7f3d0;
}

@media (max-width: 760px) {
  .hw-review-profile-scope {
    display: none;
  }
}

/* -------------------------------------------------------------------------
   Flashcard controls: compact controls for the classic Anki flip mode.
   Navigation is intentionally separate from SRS ratings, so a learner can
   inspect the previous/next card without silently changing review progress.
   ------------------------------------------------------------------------- */
#view-review .hw-flashcard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  margin: -4px 0 10px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg-surface);
  box-shadow: none;
}

#view-review .hw-flashcard-toolbar.hw-hidden,
#view-review .hw-flashcard-navigation.hw-hidden {
  display: none !important;
}

#view-review .hw-flashcard-toolbar-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#view-review .hw-flashcard-toolbar-actions::-webkit-scrollbar {
  display: none;
}

#view-review .hw-flashcard-tool,
#view-review .hw-flashcard-nav-button,
#view-review .hw-flashcard-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

#view-review .hw-flashcard-tool {
  padding: 6px 9px;
}

#view-review .hw-flashcard-tool:hover,
#view-review .hw-flashcard-nav-button:hover,
#view-review .hw-flashcard-bookmark:hover {
  border-color: rgba(99, 102, 241, .4);
  color: var(--primary);
  background: var(--primary-soft);
}

#view-review .hw-flashcard-tool:active,
#view-review .hw-flashcard-nav-button:active,
#view-review .hw-flashcard-bookmark:active {
  transform: scale(.97);
}

#view-review .hw-flashcard-tool.is-active {
  border-color: rgba(99, 102, 241, .36);
  color: var(--primary);
  background: var(--primary-soft);
}

#view-review .hw-flashcard-position {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 5px 8px;
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

#view-review .hw-flashcard-bookmark {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

#view-review .hw-flashcard-bookmark.is-saved {
  border-color: rgba(245, 158, 11, .42);
  background: rgba(245, 158, 11, .11);
  color: #d97706;
}

#view-review .hw-flashcard-tool:disabled,
#view-review .hw-flashcard-nav-button:disabled,
#view-review .hw-flashcard-bookmark:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

#view-review .hw-card-reading {
  margin: -8px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  font-style: italic;
  font-weight: 650;
  letter-spacing: .02em;
  line-height: 1.25;
}

#view-review .hw-card-back .hw-card-reading {
  margin: -9px 0 2px;
  color: var(--text-muted);
  font-size: 12px;
}

#view-review .hw-flashcard-navigation {
  display: grid;
  grid-template-columns: minmax(92px, .7fr) minmax(0, 1fr) minmax(92px, .7fr);
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: var(--bg-surface);
}

#view-review .hw-flashcard-nav-button {
  min-height: 34px;
  padding: 7px 11px;
}

#view-review .hw-flashcard-navigation-label {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  #view-review .hw-flashcard-toolbar {
    align-items: flex-start;
    margin-bottom: 8px;
    padding: 6px;
  }

  #view-review .hw-flashcard-toolbar-actions {
    gap: 5px;
  }

  #view-review .hw-flashcard-tool {
    min-height: 29px;
    padding: 6px 8px;
    font-size: 10px;
  }

  #view-review .hw-flashcard-position {
    min-width: 44px;
    padding: 5px 6px;
    font-size: 10px;
  }

  #view-review .hw-flashcard-navigation {
    grid-template-columns: 78px minmax(0, 1fr) 78px;
    gap: 6px;
    margin-top: 9px;
    padding: 5px 6px;
  }

  #view-review .hw-flashcard-nav-button {
    min-height: 32px;
    padding: 7px 8px;
    font-size: 10px;
  }

  #view-review .hw-flashcard-navigation-label {
    font-size: 9px;
  }

  #view-review .hw-card-reading {
    font-size: 12px;
  }
}

/* Individual review modes replace the old forced Smart four-step sequence. */
#view-review #hw-smart-progress-indicator,
#view-review #hw-flashcard-rating-row.hw-hidden {
  display: none !important;
}

#view-review .hw-review-mode-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--bg-surface);
}

#view-review .hw-review-mode-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 0 2px;
}

#view-review .hw-practice-mode-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

#view-review .hw-practice-mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

#view-review .hw-practice-mode-button:hover {
  border-color: rgba(99, 102, 241, .38);
  color: var(--primary);
  background: var(--primary-soft);
}

#view-review .hw-practice-mode-button.active {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, .2);
}

#view-review .hw-practice-sentence-card,
#view-review .hw-practice-listening-card {
  min-height: 320px !important;
  height: auto !important;
}

#view-review .hw-practice-source-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

#view-review .hw-practice-sentence-ko {
  white-space: pre-line;
  max-width: 760px;
  margin: 0 auto;
  color: var(--text-main);
  font-size: clamp(23px, 3.6vw, 38px);
  font-weight: 800;
  line-height: 1.45;
  word-break: keep-all;
}

#view-review .hw-practice-audio-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(99, 102, 241, .3);
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

#view-review .hw-practice-audio-button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

#view-review .hw-practice-translation {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(16, 185, 129, .24);
  border-radius: 12px;
  background: rgba(16, 185, 129, .08);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.45;
}

#view-review .hw-practice-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#view-review .hw-practice-action-row .hw-btn-hero {
  min-height: 40px;
  padding: 8px;
  font-size: 11px;
}

#view-review .hw-practice-listening-topline,
#view-review .hw-practice-listening-instruction,
#view-review .hw-practice-listening-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#view-review .hw-practice-listening-body {
  display: grid;
  gap: 14px;
  flex: 1 1 auto;
  padding: 15px 0;
}

#view-review .hw-practice-listening-instruction {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

#view-review .hw-listening-difficulty {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

#view-review .hw-listening-difficulty button {
  min-height: 28px;
  padding: 5px 8px;
  border: 0;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-primary);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 750;
}

#view-review .hw-listening-difficulty button:last-child {
  border-right: 0;
}

#view-review .hw-listening-difficulty button.active {
  background: var(--primary);
  color: #ffffff;
}

#view-review .hw-listening-answer-slots,
#view-review .hw-listening-token-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

#view-review .hw-listening-answer-slots {
  align-content: center;
  padding: 10px;
  border: 1px dashed rgba(79, 70, 229, .45);
  border-radius: 12px;
  background: var(--bg-soft);
}

#view-review .hw-listening-slot,
#view-review .hw-listening-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 750;
}

#view-review .hw-listening-token:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

#view-review .hw-listening-token:disabled {
  cursor: default;
  opacity: .45;
}

#view-review .hw-listening-slot-placeholder {
  align-self: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
}

#view-review .hw-listening-type-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

#view-review .hw-practice-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

#view-review .hw-practice-listening-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 750;
}

#view-review .hw-practice-action-row-tight {
  display: flex;
  grid-template-columns: none;
}

/* The AI helper stays a single compact control until analysis is requested.
   Result text expands below the row only when it has useful content. */
#view-review #hw-ai-explanation-assistant {
  min-height: 36px;
}

#view-review #hw-ai-explanation-assistant>.hw-flex {
  min-height: 32px;
  gap: 8px;
}

#view-review #hw-ai-explanation-content:empty {
  display: none;
}

#view-review #hw-ai-explanation-content:not(:empty) {
  max-height: 180px;
  margin-top: 8px;
  padding-top: 8px;
  overflow-y: auto;
  border-top: 1px solid var(--border-soft);
}

/* Compact card states leave the chapter title and learning controls readable. */
#view-review .hw-card-state-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  padding: 3px 7px !important;
  border-radius: 9px !important;
  font-size: 9px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

#view-review #hw-card-answer-state i {
  font-size: 8px;
}

#view-review #hw-card-chapter,
#view-review #hw-card-back-chapter {
  min-width: 0;
  max-width: 62%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auto-play settings modal. */
#hw-flashcard-auto-modal {
  position: fixed;
  inset: 0;
  z-index: 2147482500;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, .54);
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#hw-flashcard-auto-modal.hw-hidden {
  display: none !important;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-dialog {
  width: min(520px, 100%);
  max-height: calc(100vh - 24px);
  max-height: min(760px, calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 20px 48px rgba(15, 23, 42, .24);
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .09em;
}

#hw-flashcard-auto-modal h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 850;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-status {
  flex: 0 0 auto;
  max-width: 170px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--border-strong));
  border-radius: 999px;
  background: #f5f3ff;
  background: color-mix(in srgb, var(--primary) 8%, var(--bg-surface));
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-flow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  padding: 9px 10px;
  overflow-x: auto;
  border: 1px solid var(--border-default);
  border-radius: 11px;
  background: var(--bg-primary);
  scrollbar-width: none;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-flow::-webkit-scrollbar {
  display: none;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-flow span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-main);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-flow>i {
  color: var(--text-muted);
  font-size: 8px;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 58px;
  margin-top: 10px;
}

#hw-flashcard-auto-modal strong,
#hw-flashcard-auto-modal small {
  display: block;
}

#hw-flashcard-auto-modal strong {
  color: var(--text-main);
  font-size: 13px;
}

#hw-flashcard-auto-modal small {
  margin-top: 4px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.35;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-stepper button,
#hw-flashcard-auto-modal output {
  display: inline-grid;
  width: 42px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 800;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-stepper button:disabled {
  opacity: .36;
  cursor: not-allowed;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-stepper button:not(:disabled):active {
  transform: translateY(1px);
}

#hw-flashcard-auto-modal output {
  width: 52px;
  background: var(--bg-surface);
  font-size: 14px;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-stepper span {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-divider {
  height: 1px;
  margin: 12px 0 4px;
  background: var(--border-default);
}

#hw-flashcard-auto-modal .hw-flashcard-auto-switch {
  position: relative;
  width: 50px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-switch::before {
  content: '';
  position: absolute;
  inset: 8px 2px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-primary);
}

#hw-flashcard-auto-modal .hw-flashcard-auto-switch span {
  position: absolute;
  top: 12px;
  left: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
  transition: transform 150ms ease;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-switch.is-on::before {
  border-color: #16a34a;
  background: #22c55e;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-switch.is-on span {
  transform: translateX(18px);
}

#hw-flashcard-auto-modal button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-note {
  margin: 14px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: #f4fbf6;
  background: color-mix(in srgb, #22c55e 7%, var(--bg-surface));
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-note i {
  margin-right: 5px;
  color: #16a34a;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 4px;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-actions button {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 800;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-actions .is-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

#hw-flashcard-auto-modal .hw-flashcard-auto-actions .is-stop {
  margin-right: auto;
  color: #b42318;
  background: #fff5f4;
  border-color: #fecaca;
}

@media (max-width: 760px) {

  /* One stable five-button row: a learner can switch mode without scrolling
     the page or a nested control area. Full desktop labels become short,
     still-accessible labels on small screens. */
  #view-review .hw-review-mode-panel {
    gap: 6px;
    margin-bottom: 7px;
    padding: 8px;
  }

  #view-review .hw-review-mode-heading {
    min-height: 16px;
  }

  #view-review .hw-review-profile-scope {
    display: none;
  }

  #view-review .hw-practice-mode-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-rows: 50px;
    gap: 5px;
    min-width: 0;
    overflow: visible;
  }

  #view-review .hw-practice-mode-button {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    padding: 5px 2px;
    border-radius: 9px;
    font-size: 13px;
    line-height: 1;
    white-space: normal;
  }

  #view-review .hw-practice-mode-button>span {
    font-size: 0;
    line-height: 1;
  }

  #view-review .hw-practice-mode-button>span::after {
    content: attr(data-mobile-label);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
  }

  #view-review .hw-practice-listening-topline,
  #view-review .hw-practice-listening-instruction,
  #view-review .hw-practice-listening-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  #view-review .hw-practice-action-row-tight {
    width: 100%;
  }

  #view-review .hw-practice-action-row-tight button {
    flex: 1 1 0;
  }
}

@media (max-width: 420px) {
  #view-review .hw-practice-mode-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  #view-review .hw-practice-mode-button {
    min-height: 48px;
    padding-inline: 1px;
  }

  #view-review .hw-practice-mode-button>span::after {
    font-size: 8px;
  }

  #view-review .hw-practice-sentence-card,
  #view-review .hw-practice-listening-card {
    padding: 14px !important;
  }

  #hw-flashcard-auto-modal {
    padding: max(7px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left));
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-dialog {
    max-height: calc(100vh - 14px);
    max-height: calc(100dvh - 14px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 16px;
    border-radius: 14px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-heading {
    display: block;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-status {
    display: inline-block;
    max-width: none;
    margin-top: 8px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-setting {
    gap: 8px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-stepper {
    gap: 4px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-stepper button {
    width: 40px;
    height: 44px;
  }

  #hw-flashcard-auto-modal output {
    width: 42px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-actions {
    position: sticky;
    bottom: -16px;
    margin-inline: -16px;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-default);
    background: var(--bg-surface);
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-actions button {
    padding-inline: 11px;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  #hw-flashcard-auto-modal {
    place-items: start center;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-dialog {
    max-height: calc(100dvh - 16px);
    padding-block: 14px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-flow {
    margin-top: 10px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-setting {
    min-height: 50px;
    margin-top: 5px;
  }

  #hw-flashcard-auto-modal .hw-flashcard-auto-divider {
    margin-top: 7px;
  }
}

/* -------------------------------------------------------------------------
   TOPIK II OFFLINE EXAM
   Kept independent from the EPS Vong 2 mock-exam styles above.
   ------------------------------------------------------------------------- */
#view-topik-exam {
  --topik-ink: #13213d;
  --topik-muted: #62718a;
  --topik-line: #d9e3f0;
  --topik-soft: #f6f9fe;
  --topik-blue: #3d82f7;
  --topik-blue-dark: #2563d8;
  --topik-mint: #dff8e9;
  --topik-violet: #efe9ff;
  color: var(--topik-ink);
}

/* Runtime TOPIK covers the surrounding app shell, mirroring EPS CBT. */
#view-topik-exam.topik-exam-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  min-height: 0;
  overflow: hidden;
  background: #f7faff;
}

#view-topik-exam.topik-exam-fullscreen #topik-exam-app {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

#view-topik-exam *,
#view-topik-exam *::before,
#view-topik-exam *::after {
  box-sizing: border-box;
}

#view-topik-exam button,
#view-topik-exam textarea,
#view-topik-exam select {
  font: inherit;
}

.topik-exam-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  color: var(--topik-ink);
  font-family: inherit;
}

.topik-loading,
.topik-error {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  border: 1px solid var(--topik-line);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(32, 59, 110, .08);
}

.topik-loading>i,
.topik-error>i {
  font-size: 30px;
  color: var(--topik-blue);
}

.topik-error>i {
  color: #e25151;
}

.topik-loading strong,
.topik-error h2 {
  display: block;
  margin: 0 0 5px;
  font-size: 18px;
  font-weight: 800;
  color: var(--topik-ink);
}

.topik-loading p,
.topik-error p {
  margin: 0;
  color: var(--topik-muted);
  font-size: 14px;
  line-height: 1.55;
}

.topik-error .topik-muted {
  margin: 10px 0 16px;
  font-size: 12px;
}

.topik-library {
  display: grid;
  gap: 18px;
}

.topik-library-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 142px;
  overflow: hidden;
  padding: 24px 28px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(118deg, #183982 0%, #347eea 57%, #65a8ff 100%);
  box-shadow: 0 15px 38px rgba(42, 104, 211, .24);
}

.topik-library-hero::after {
  content: '';
  position: absolute;
  width: 225px;
  height: 225px;
  border: 36px solid rgba(255, 255, 255, .09);
  border-radius: 50%;
  right: -92px;
  top: -126px;
  pointer-events: none;
}

.topik-library-icon,
.topik-result-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 16px;
  color: var(--topik-blue-dark);
  background: #fff;
  font-size: 23px;
  box-shadow: 0 8px 18px rgba(9, 32, 83, .15);
}

.topik-library-hero>div:nth-child(2) {
  position: relative;
  z-index: 1;
}

.topik-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: inherit;
  opacity: .85;
}

.topik-library-hero h1 {
  margin: 3px 0 5px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: -.03em;
}

.topik-library-hero p {
  max-width: 650px;
  margin: 0;
  color: rgba(255, 255, 255, .9);
  font-size: 13px;
  line-height: 1.5;
}

.topik-library-asset {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 10px;
  color: #fff;
  background: rgba(13, 47, 123, .18);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.topik-library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topik-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.topik-filter,
.topik-history-chip,
.topik-btn,
.topik-choice,
.topik-number,
.topik-runtime-brand,
.topik-icon-btn,
.topik-play-audio,
.topik-nav-close,
.topik-back-link {
  border: 0;
  cursor: pointer;
}

.topik-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--topik-line);
  border-radius: 10px;
  color: #536177;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.topik-filter b {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 5px;
  color: inherit;
  background: #edf2fb;
  font-size: 10px;
}

.topik-filter:disabled {
  cursor: default;
  opacity: .75;
}

.topik-filter-active {
  border-color: #1e4a9b;
  color: #fff;
  background: #2e72dc;
  opacity: 1 !important;
}

.topik-filter-active b {
  color: #1955ae;
  background: #fff;
}

.topik-history-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: #27538f;
  background: #eaf3ff;
  font-size: 12px;
  font-weight: 800;
}

.topik-history-static {
  color: #277856;
  background: #e7faf1;
  cursor: default;
}

.topik-exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 20px;
}

.topik-exam-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border: 1px solid var(--topik-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(26, 58, 107, .07);
}

.topik-exam-card .exam-vip-crown {
  border-radius: 0 20px 0 10px;
}

.topik-exam-card-featured {
  border-top: 4px solid var(--topik-blue);
}

.topik-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topik-level-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid #0f3e8d;
  border-radius: 6px;
  color: #fff;
  background: #2f79ea;
  font-size: 10px;
  font-weight: 850;
}

.topik-local-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #12935d;
  font-size: 11px;
  font-weight: 800;
}

.topik-exam-card h2 {
  margin: 18px 0 4px;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -.03em;
}

.topik-exam-card h2 span {
  display: inline-grid;
  min-width: 33px;
  height: 31px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: #4a8bf4;
  font-size: 19px;
  vertical-align: 2px;
}

.topik-exam-card>p {
  margin: 0;
  color: var(--topik-muted);
  font-size: 12px;
}

.topik-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 18px 0;
}

.topik-card-stats>div,
.topik-detail-stats>div {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 76px;
  padding: 8px;
  border: 1px solid var(--topik-line);
  border-radius: 10px;
  background: #fbfdff;
}

.topik-card-stats i,
.topik-detail-stats i {
  color: #66768e;
  font-size: 12px;
}

.topik-card-stats small,
.topik-detail-stats small {
  margin-top: 3px;
  color: #718098;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .05em;
}

.topik-card-stats b,
.topik-detail-stats b {
  margin-top: 2px;
  color: var(--topik-ink);
  font-size: 16px;
  font-weight: 850;
}

.topik-card-last-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 9px;
  min-height: 42px;
  margin: -5px 0 14px;
  padding: 7px 9px;
  border: 1px solid var(--topik-line);
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.2;
}

.topik-card-last-result>span {
  min-width: 0;
  color: #64748b;
  font-weight: 850;
}

.topik-card-last-result>span i {
  margin-right: 4px;
}

.topik-card-last-result>b {
  color: #235896;
  font-size: 11px;
  white-space: nowrap;
}

.topik-card-last-result>small {
  grid-column: 1 / -1;
  color: #7c8da5;
  font-size: 9px;
  font-weight: 750;
}

.topik-card-last-result.is-new {
  background: #fbfdff;
}

.topik-card-last-result.is-complete {
  border-color: #b7dfc7;
  background: #f2fbf6;
}

.topik-card-last-result.is-complete>span,
.topik-card-last-result.is-complete>b {
  color: #14784b;
}

.topik-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.topik-btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.topik-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.topik-btn:focus-visible,
.topik-choice:focus-visible,
.topik-number:focus-visible,
.topik-icon-btn:focus-visible,
.topik-play-audio:focus-visible {
  outline: 3px solid rgba(59, 130, 246, .32);
  outline-offset: 2px;
}

.topik-btn:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.topik-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #347ef2, #2867d7);
  box-shadow: 0 5px 12px rgba(43, 105, 220, .22);
}

.topik-btn-secondary {
  border-color: var(--topik-line);
  color: #31455f;
  background: #fff;
}

.topik-library-note {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
}

.topik-library-note i {
  color: #3c8a67;
}

.topik-library-note code {
  color: #35567d;
  font-family: ui-monospace, monospace;
}

.topik-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px 4px;
  padding: 4px 0;
  color: #536780;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.topik-detail-card {
  overflow: hidden;
  border: 1px solid #1b3467;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(18, 46, 95, .12);
}

.topik-detail-banner {
  padding: 27px 28px;
  color: #fff;
  background: linear-gradient(125deg, #3f82ef, #5598ff);
}

.topik-detail-banner .topik-level-badge {
  border-color: #253f12;
  color: #303619;
  background: #ffea6d;
}

.topik-detail-banner h1 {
  margin: 10px 0 5px;
  font-size: clamp(25px, 4vw, 37px);
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -.04em;
}

.topik-detail-banner h1 strong {
  font-weight: 850;
  white-space: nowrap;
}

.topik-detail-banner p {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  opacity: .91;
}

.topik-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #18233b;
}

.topik-detail-stats>div {
  min-height: 80px;
  border: 0;
  border-right: 1px solid #18233b;
  border-radius: 0;
  background: #fff;
}

.topik-detail-stats>div:last-child {
  border-right: 0;
}

.topik-detail-body {
  padding: 25px;
}

.topik-detail-body h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 850;
}

.topik-section-list {
  display: grid;
  gap: 9px;
}

.topik-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid #1e2d48;
  border-radius: 7px;
  font-size: 14px;
}

.topik-section-row>span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topik-section-row>div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.topik-section-row em {
  padding: 4px 8px;
  border: 1px solid #18233b;
  border-radius: 5px;
  color: #253552;
  background: rgba(255, 255, 255, .78);
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.topik-section-blue {
  background: #e8f2ff;
}

.topik-section-mint {
  background: #e6faed;
}

.topik-section-violet {
  background: #fbedf7;
}

.topik-guidance {
  display: flex;
  gap: 10px;
  margin-top: 17px;
  padding: 13px 15px;
  border: 1px solid #f0d56c;
  border-radius: 8px;
  color: #665816;
  background: #fff8c8;
  font-size: 12px;
  line-height: 1.55;
}

.topik-guidance>i {
  margin-top: 2px;
  color: #bb8d00;
}

.topik-guidance b {
  color: #493b00;
}

.topik-guidance p {
  margin: 0;
}

.topik-guidance ul {
  margin: 5px 0 0;
  padding-left: 17px;
}

.topik-start-btn {
  margin-top: 17px;
  min-width: 183px;
}

.topik-runtime {
  width: min(1240px, 100%);
}

.topik-runtime-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  margin-bottom: 14px;
  padding: 9px 4px;
  border-bottom: 1px solid #cbd5e1;
  background: rgba(248, 251, 255, .97);
  backdrop-filter: blur(12px);
}

.topik-runtime-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 0;
  color: var(--topik-ink);
  background: transparent;
  text-align: left;
}

.topik-runtime-brand>i {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #152a4d;
  border-radius: 8px;
  color: #184e9d;
  background: #d9ebff;
  font-size: 16px;
}

.topik-runtime-brand span {
  min-width: 0;
}

.topik-runtime-brand small {
  display: block;
  overflow: hidden;
  color: #6680a0;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topik-runtime-brand b {
  display: block;
  overflow: hidden;
  color: var(--topik-ink);
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topik-runtime-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topik-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #a88908;
  border-radius: 7px;
  color: #4c4109;
  background: #fff5b8;
  font-size: 13px;
}

.topik-timer-warning {
  color: #a52b2b;
  border-color: #e49a9a;
  background: #fff0f0;
}

.topik-submit-btn {
  min-height: 36px;
  padding: 0 12px;
}

.topik-runtime-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 16px;
}

.topik-question-stage {
  min-width: 0;
}

.topik-question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  color: #697a92;
  font-size: 11px;
  font-weight: 750;
}

.topik-section-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  color: #1450aa;
  background: #e5f0ff;
}

.topik-section-chip.topik-section-mint {
  color: #17744d;
  background: #e0f8eb;
}

.topik-section-chip.topik-section-violet {
  color: #7843aa;
  background: #f1e8ff;
}

.topik-audio-panel {
  margin-bottom: 10px;
  padding: 13px;
  border: 1px solid #2765bc;
  border-radius: 10px;
  background: #e6f1ff;
}

.topik-audio-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  color: #1e4f93;
  font-size: 12px;
  font-weight: 850;
}

.topik-audio-heading small {
  color: #577294;
  font-size: 10px;
  font-weight: 700;
}

.topik-audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.topik-icon-btn {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #8fb2e5;
  border-radius: 8px;
  color: #24599e;
  background: #fff;
}

.topik-play-audio {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border-radius: 8px;
  color: #fff;
  background: #347ef2;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 4px 10px rgba(47, 116, 224, .2);
}

.topik-speed-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: #536f92;
  font-size: 10px;
  font-weight: 750;
}

.topik-speed-label select {
  height: 30px;
  padding: 0 5px;
  border: 1px solid #a4bce2;
  border-radius: 6px;
  color: #244a80;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.topik-question-card {
  overflow: hidden;
  border: 1px solid #192943;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(28, 55, 100, .07);
}

.topik-question-prompt {
  padding: 18px 20px;
  border-bottom: 1px solid #dbe5f0;
}

.topik-question-prompt>span {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  color: #664b00;
  background: #fff1a8;
  font-size: 10px;
  font-weight: 850;
}

.topik-question-prompt h1 {
  margin: 9px 0 0;
  color: #17223a;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.65;
  font-weight: 750;
  white-space: normal;
}

.topik-passage-box {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1.5px solid #334155;
  border-radius: 8px;
  background: #f8fafc;
  color: #1e293b;
  font-size: clamp(14.5px, 1.7vw, 16px);
  line-height: 1.8;
  font-weight: 450;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

.topik-sub-question {
  margin: 12px 0 0;
  color: #0f172a;
  font-size: clamp(15px, 1.8vw, 17px);
  line-height: 1.6;
  font-weight: 700;
}

.topik-underline {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
}

.topik-image-wrap {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 16px 16px 7px;
}

.topik-question-image {
  display: block;
  max-width: min(100%, 600px);
  max-height: 410px;
  border: 1px solid #cbd8e7;
  border-radius: 6px;
  object-fit: contain;
}

.topik-image-wrap>span {
  color: #8391a5;
  font-size: 10px;
}

.topik-image-wrap.topik-image-missing {
  display: none;
}

.topik-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 16px;
}

.topik-choice {
  display: flex;
  min-height: 54px;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #aebdce;
  border-radius: 8px;
  color: #263650;
  background: #fff;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  transition: border .15s ease, background .15s ease, transform .15s ease;
}

.topik-choice:hover:not(:disabled) {
  border-color: #4b8cf2;
  background: #f2f7ff;
}

.topik-choice b {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #58708e;
  background: #eef3f8;
  font-size: 11px;
}

.topik-choice.is-selected {
  border-color: #397cf2;
  background: #eaf3ff;
  box-shadow: inset 0 0 0 1px #397cf2;
}

.topik-choice.is-selected b {
  color: #fff;
  background: #397cf2;
}

.topik-choice.is-right {
  border-color: #39a76e;
  background: #e8faef;
}

.topik-choice.is-wrong {
  border-color: #e15e5e;
  background: #fff0f0;
}

.topik-choice:disabled {
  cursor: default;
  opacity: 1;
}

.topik-writing-answer {
  padding: 16px;
}

.topik-writing-answer label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: #485e7d;
  font-size: 12px;
  font-weight: 850;
}

.topik-writing-answer textarea {
  display: block;
  width: 100%;
  resize: vertical;
  padding: 12px;
  border: 1px solid #b7c7db;
  border-radius: 8px;
  color: #17223a;
  background: #fbfdff;
  font-size: 14px;
  line-height: 1.65;
}

.topik-writing-answer textarea:focus {
  border-color: #4588ed;
  outline: 3px solid rgba(69, 136, 237, .14);
}

.topik-writing-answer textarea:disabled {
  color: #344765;
  background: #f4f7fa;
}

.topik-review-box {
  margin: 0 16px 16px;
  padding: 12px 13px;
  border: 1px solid #8ed3ae;
  border-radius: 8px;
  color: #24593d;
  background: #ebfbf1;
  font-size: 12px;
  line-height: 1.6;
}

.topik-review-box b {
  display: block;
}

.topik-review-box p {
  margin: 5px 0 0;
  white-space: normal;
}

.topik-question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.topik-question-footer>span {
  color: #6b7d96;
  font-size: 11px;
  font-weight: 750;
}

.topik-question-nav {
  position: sticky;
  top: 83px;
  overflow: hidden;
  max-height: calc(100vh - 110px);
  border: 1px solid #1c2d49;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 22px rgba(23, 52, 101, .08);
}

.topik-question-nav>header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #d9e5f1;
}

.topik-question-nav h2 {
  margin: 0;
  color: #1d2b46;
  font-size: 14px;
  font-weight: 850;
}

.topik-question-nav header p {
  margin: 2px 0 0;
  color: #72839a;
  font-size: 10px;
  font-weight: 700;
}

.topik-nav-close {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: #50657f;
  background: #eff4fa;
}

.topik-nav-body {
  overflow-y: auto;
  max-height: calc(100vh - 205px);
  padding: 10px 11px;
}

.topik-nav-group+.topik-nav-group {
  margin-top: 12px;
}

.topik-nav-group h3 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 7px;
  color: #344860;
  font-size: 11px;
  font-weight: 850;
}

.topik-nav-group h3 span {
  margin-left: auto;
  color: #8493a7;
  font-size: 9px;
}

.topik-number-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.topik-number {
  display: grid;
  min-width: 0;
  height: 29px;
  place-items: center;
  border: 1px solid #aebdce;
  border-radius: 5px;
  color: #34445e;
  background: #fff;
  font-size: 10px;
  font-weight: 800;
}

.topik-number.answered {
  border-color: #78aaf6;
  color: #154eae;
  background: #e7f0ff;
}

.topik-number.current {
  border-color: #1559c7;
  color: #fff;
  background: #3c80eb;
  box-shadow: 0 2px 5px rgba(29, 94, 196, .25);
}

.topik-number.correct {
  border-color: #5ca97f;
  color: #1c7648;
  background: #e8f8ee;
}

.topik-number.wrong {
  border-color: #e17a7a;
  color: #a63d3d;
  background: #ffeded;
}

.topik-question-nav footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 11px;
  border-top: 1px solid #d9e5f1;
  color: #718197;
  font-size: 9px;
  font-weight: 700;
}

.topik-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 3px;
  border: 1px solid #aebdce;
  border-radius: 50%;
  background: #fff;
}

.topik-dot-answered {
  border-color: #78aaf6;
  background: #dceaff;
}

.topik-dot-correct {
  border-color: #62aa81;
  background: #dff5e7;
}

.topik-result-card {
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid #c8d9ee;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(33, 75, 142, .1);
}

.topik-result-card>header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topik-result-icon {
  color: #fff;
  background: linear-gradient(135deg, #2d7df2, #784eee);
}

.topik-result-card h1 {
  margin: 4px 0 4px;
  color: var(--topik-ink);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 850;
  letter-spacing: -.035em;
}

.topik-result-card header p {
  margin: 0;
  color: var(--topik-muted);
  font-size: 12px;
  line-height: 1.55;
}

.topik-result-card .topik-eyebrow {
  color: #4b75ab;
}

.topik-result-score {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 25px 0 14px;
}

.topik-result-score>div {
  padding: 16px 10px;
  border: 1px solid #d5e0ed;
  border-radius: 11px;
  background: #f8fbff;
  text-align: center;
}

.topik-result-score small {
  display: block;
  color: #6e7f96;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
}

.topik-result-score b {
  display: block;
  margin-top: 5px;
  color: #17498f;
  font-size: 25px;
  font-weight: 850;
}

.topik-result-score em {
  margin-left: 2px;
  color: #71849e;
  font-size: 13px;
  font-style: normal;
}

.topik-result-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid #edcf75;
  border-radius: 9px;
  color: #705d18;
  background: #fff8cf;
  font-size: 12px;
  line-height: 1.5;
}

.topik-result-note p {
  margin: 0;
}

.topik-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

/* App-owned confirmation: native window.confirm can be hidden behind the desktop shell. */
.topik-confirm-layer {
  position: fixed;
  z-index: 2147483600;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 30, 54, .52);
  backdrop-filter: blur(3px);
}

.topik-confirm-card {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid #b9cce6;
  border-radius: 18px;
  color: var(--topik-ink);
  background: #fff;
  box-shadow: 0 24px 70px rgba(6, 22, 48, .32);
  text-align: center;
}

.topik-confirm-icon {
  display: inline-grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #367fee, #6752df);
  font-size: 18px;
}

.topik-confirm-card h2 {
  margin: 13px 0 7px;
  font-size: 20px;
  font-weight: 850;
}

.topik-confirm-card p {
  margin: 0;
  color: #5f718a;
  font-size: 13px;
  line-height: 1.55;
}

.topik-confirm-card p b {
  color: #244e96;
}

.topik-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 9px;
  margin-top: 20px;
}

.topik-confirm-actions .topik-btn {
  width: 100%;
}

@media (max-width: 900px) {
  .topik-runtime-layout {
    grid-template-columns: 1fr;
  }

  .topik-question-nav {
    position: static;
    max-height: none;
  }

  .topik-nav-body {
    max-height: none;
  }

  .topik-number-grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }

  .topik-question-nav.is-collapsed .topik-nav-body,
  .topik-question-nav.is-collapsed footer {
    display: none;
  }

  .topik-nav-close {
    display: grid;
    place-items: center;
  }

  .topik-question-nav.is-collapsed .topik-nav-close {
    transform: rotate(180deg);
  }
}

@media (max-width: 640px) {
  #view-topik-exam {
    margin-left: -4px;
    margin-right: -4px;
  }

  .topik-library {
    gap: 12px;
  }

  .topik-library-hero {
    align-items: flex-start;
    min-height: 0;
    gap: 11px;
    padding: 18px 16px;
    border-radius: 17px;
  }

  .topik-library-hero::after {
    width: 155px;
    height: 155px;
    right: -87px;
    top: -88px;
    border-width: 28px;
  }

  .topik-library-icon {
    width: 41px;
    height: 41px;
    border-radius: 12px;
    font-size: 18px;
  }

  .topik-library-hero h1 {
    margin-top: 2px;
    font-size: 22px;
  }

  .topik-library-hero p {
    font-size: 11px;
  }

  .topik-library-asset {
    display: none;
  }

  .topik-library-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .topik-filter-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .topik-filter {
    justify-content: center;
    padding: 0 6px;
    font-size: 10px;
  }

  .topik-history-chip {
    width: 100%;
    justify-content: center;
  }

  .topik-exam-card {
    padding: 15px;
    border-radius: 15px;
  }

  .topik-exam-card h2 {
    margin-top: 13px;
    font-size: 20px;
  }

  .topik-card-stats {
    gap: 6px;
    margin: 13px 0;
  }

  .topik-card-stats>div {
    min-height: 60px;
  }

  .topik-card-stats b {
    font-size: 14px;
  }

  .topik-card-stats small {
    font-size: 8px;
  }

  .topik-card-actions {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
  }

  .topik-btn {
    min-height: 38px;
    padding: 0 11px;
    font-size: 12px;
  }

  .topik-detail-card {
    border-radius: 13px;
  }

  .topik-detail-banner {
    padding: 19px 16px;
  }

  .topik-detail-banner h1 {
    font-size: 24px;
  }

  .topik-detail-banner p {
    font-size: 10px;
  }

  .topik-detail-stats>div {
    min-height: 67px;
    padding: 6px 3px;
  }

  .topik-detail-stats b {
    font-size: 13px;
  }

  .topik-detail-body {
    padding: 16px;
  }

  .topik-detail-body h2 {
    font-size: 15px;
  }

  .topik-section-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 10px;
    font-size: 13px;
  }

  .topik-section-row>div {
    justify-content: flex-start;
  }

  .topik-guidance {
    padding: 10px;
    font-size: 11px;
  }

  .topik-start-btn {
    width: 100%;
  }

  .topik-runtime-header {
    position: static;
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 10px;
    padding: 1px 0 10px;
    background: transparent;
    backdrop-filter: none;
  }

  .topik-runtime-brand {
    width: 100%;
  }

  .topik-runtime-brand>i {
    width: 32px;
    height: 32px;
  }

  .topik-runtime-brand b {
    font-size: 12px;
  }

  .topik-runtime-brand small {
    font-size: 8px;
  }

  .topik-runtime-actions {
    width: 100%;
    justify-content: space-between;
  }

  .topik-timer {
    min-height: 33px;
    font-size: 12px;
  }

  .topik-submit-btn {
    min-height: 33px;
    flex: 1;
  }

  .topik-question-meta {
    font-size: 10px;
  }

  .topik-audio-panel {
    padding: 10px;
  }

  .topik-audio-heading {
    font-size: 11px;
  }

  .topik-audio-heading small {
    max-width: 125px;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topik-audio-controls {
    gap: 5px;
  }

  .topik-icon-btn {
    width: 31px;
    height: 31px;
  }

  .topik-play-audio {
    min-height: 31px;
    flex: 1;
    padding: 0 9px;
  }

  .topik-speed-label {
    margin-left: 0;
  }

  .topik-speed-label select {
    width: 52px;
    height: 28px;
  }

  .topik-question-prompt {
    padding: 14px;
  }

  .topik-question-prompt h1 {
    font-size: 15px;
    line-height: 1.58;
  }

  .topik-image-wrap {
    padding: 12px 8px 4px;
  }

  .topik-question-image {
    max-height: 300px;
  }

  .topik-choices {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 12px;
  }

  .topik-choice {
    min-height: 48px;
    padding: 10px;
    font-size: 12px;
  }

  .topik-writing-answer {
    padding: 12px;
  }

  .topik-writing-answer textarea {
    font-size: 13px;
  }

  .topik-question-footer {
    gap: 6px;
  }

  .topik-question-footer .topik-btn {
    min-width: 0;
    padding: 0 10px;
  }

  .topik-question-footer>span {
    display: none;
  }

  .topik-question-nav>header {
    padding: 10px;
  }

  .topik-nav-body {
    padding: 9px;
  }

  .topik-number-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
  }

  .topik-number {
    height: 31px;
    font-size: 10px;
  }

  .topik-nav-group h3 {
    font-size: 10px;
  }

  .topik-result-card {
    padding: 18px 14px;
    border-radius: 15px;
  }

  .topik-result-card>header {
    align-items: flex-start;
    gap: 10px;
  }

  .topik-result-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 18px;
  }

  .topik-result-card h1 {
    font-size: 21px;
  }

  .topik-result-card header p {
    font-size: 11px;
  }

  .topik-result-score {
    gap: 6px;
    margin: 17px 0 10px;
  }

  .topik-result-score>div {
    padding: 11px 4px;
  }

  .topik-result-score b {
    font-size: 20px;
  }

  .topik-result-score em {
    font-size: 10px;
  }

  .topik-result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topik-result-note {
    font-size: 11px;
  }

  #hw-app-layout>nav .hw-tab-btn {
    min-width: 0;
    flex: 1 1 0;
  }

  .topik-library-note {
    font-size: 10px;
  }
}

/* The navigator is a four-row layout on every desktop width.  The 40-question
   grid is the only scrollable row, so its intrinsic 20-row height can never
   push Previous/Next below a short laptop viewport.  Phone layout is kept in
   the max-width:640px rules above. */
@media (min-width: 761px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-layout {
    min-height: 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-question-nav {
    display: grid;
    box-sizing: border-box;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    padding: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-submit-answer {
    grid-row: 1;
    margin-bottom: 10px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-nav-head {
    grid-row: 2;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-nav-grid {
    grid-row: 3;
    align-self: stretch;
    flex: none;
    min-width: 0;
    min-height: 0 !important;
    height: auto !important;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-runtime-page .eps-question-nav>footer {
    display: grid;
    grid-row: 4;
    margin-top: 10px;
  }
}

/* Only tall question images consume enough vertical space to need a compact answer row. */
:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer-row {
  width: min(100%, 740px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer {
  min-width: 0;
  justify-content: center;
  gap: 4px;
  padding: 4px 3px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer span {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer.is-selected:not(.is-correct):not(.is-wrong)::after {
  display: none;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer b {
  position: relative;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after {
  position: absolute;
  left: -7px;
  top: 50%;
  content: '\2713';
  color: #0878d1;
  font: 800 calc(17px * var(--eps-font-scale))/1 Arial, Helvetica, sans-serif;
  pointer-events: none;
  transform: translateY(-54%) rotate(-10deg);
  text-shadow: 0 1px #fff;
}

@media (max-width: 640px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after {
    left: -6px;
    font-size: calc(15px * var(--eps-font-scale));
  }
}

@media (max-width: 480px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer-row {
    gap: 3px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer {
    gap: 1px;
    padding: 3px 0;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer b {
    min-width: auto;
    font-size: 13px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer span {
    font-size: 10px;
  }
}

/* Desktop result sheet: keep the CBT masthead and score report in one visual
   unit, instead of leaving a detached header above a narrow floating card. */
@media (min-width: 641px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-page {
    display: grid;
    min-height: calc(100dvh - 86px);
    align-content: start;
    justify-items: center;
    padding: clamp(24px, 4vh, 46px) 24px 64px;
    background:
      radial-gradient(circle at 50% -16%, rgba(81, 174, 224, .16), transparent 42%),
      linear-gradient(145deg, #edf4f9, #f8fbfd 46%, #e8f1f7);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-page .eps-cbt-header {
    position: static;
    box-sizing: border-box;
    width: min(900px, 100%);
    margin: 0;
    border: 1px solid #7e9bbd;
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 12px 28px rgba(44, 78, 110, .11);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-card {
    box-sizing: border-box;
    width: min(900px, 100%);
    margin: 0;
    padding: 30px clamp(26px, 5vw, 54px) 34px;
    border: 1px solid #b7cce0;
    border-top: 4px solid #329cd5;
    border-radius: 0 0 16px 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
    box-shadow: 0 22px 42px rgba(38, 68, 96, .14);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-seal {
    width: 58px;
    height: 58px;
    margin-bottom: 10px;
    font-size: 23px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-card h1 {
    margin-top: 6px;
    color: #16293d;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 31px;
    letter-spacing: -.035em;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-score {
    margin: 19px 0 17px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-score b {
    color: #cf2d39;
    font-size: 62px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-breakdown {
    width: min(640px, 100%);
    margin-inline: auto;
    overflow: hidden;
    border-color: #cddce8;
    border-radius: 9px;
    background: #fff;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-breakdown>div {
    min-height: 84px;
    display: grid;
    align-content: center;
    padding: 11px 8px;
    border-color: #d9e4ed;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-actions {
    margin-top: 17px;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-actions button {
    min-height: 38px;
    border: 1px solid #238bc5;
    border-radius: 5px;
    box-shadow: inset 0 1px rgba(255, 255, 255, .5);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-result-actions button:nth-child(3) {
    border-color: #d4e0e8;
    color: #415c70;
    background: #f3f7fa;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-history-panel {
    margin-top: 27px;
    padding: 20px;
    border: 1px solid #d5e2ec;
    border-radius: 11px;
    background: rgba(255, 255, 255, .72);
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-history-entry {
    min-height: 58px;
    padding: 10px 12px;
    border-radius: 7px;
  }
}

/* TOPIK catalogue: stable hierarchy and a consistent card rhythm. */
#view-topik-exam .topik-library {
  width: min(1180px, 100%);
  gap: 16px;
}

#view-topik-exam .topik-library-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 126px;
  gap: 16px;
  padding: 22px 26px;
  border-radius: 20px;
}

#view-topik-exam .topik-library-hero h1 {
  color: #ffffff !important;
  font-family: Arial, "Noto Sans KR", sans-serif;
  font-size: clamp(25px, 2.6vw, 32px);
  font-weight: 850;
  letter-spacing: -.035em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}

#view-topik-exam .topik-library-hero p {
  max-width: 610px;
  color: rgba(255, 255, 255, .93);
}

#view-topik-exam .topik-library-toolbar {
  min-height: 38px;
  gap: 14px;
}

#view-topik-exam .topik-filter-group {
  min-width: 0;
}

#view-topik-exam .topik-exam-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

#view-topik-exam .topik-exam-card {
  min-width: 0;
  min-height: 292px;
  padding: 20px 22px;
  border-radius: 18px;
}

html:not(.dark) #view-topik-exam .topik-exam-card h2 {
  min-height: 31px;
  margin-top: 15px;
  color: #080808;
  font-family: Arial, "Noto Sans KR", sans-serif;
  font-size: clamp(21px, 2vw, 25px);
}

#view-topik-exam .topik-exam-card>p {
  min-height: 18px;
}

#view-topik-exam .topik-card-stats {
  margin: 16px 0;
}

#view-topik-exam .topik-card-stats>div {
  min-width: 0;
}

#view-topik-exam .topik-card-actions {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.22fr);
  width: min(346px, 100%);
}

#view-topik-exam .topik-card-actions .topik-btn {
  min-width: 0;
  padding-inline: 10px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  #view-topik-exam .topik-library-hero {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #view-topik-exam .topik-library-asset {
    display: none;
  }

  #view-topik-exam .topik-exam-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  #view-topik-exam .topik-library {
    gap: 11px;
  }

  #view-topik-exam .topik-library-hero {
    grid-template-columns: 41px minmax(0, 1fr);
    gap: 11px;
    padding: 18px 16px;
  }

  #view-topik-exam .topik-library-hero h1 {
    margin-top: 2px;
    font-size: 23px;
    line-height: 1.1;
  }

  #view-topik-exam .topik-library-toolbar {
    align-items: stretch;
    gap: 8px;
  }

  #view-topik-exam .topik-filter-group {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #view-topik-exam .topik-exam-grid {
    gap: 12px;
  }

  #view-topik-exam .topik-exam-card {
    min-height: 0;
    padding: 15px;
  }

  #view-topik-exam .topik-exam-card h2 {
    min-height: 0;
    margin-top: 13px;
    font-size: 20px;
  }

  #view-topik-exam .topik-card-actions {
    width: 100%;
  }
}

/* =====================================================================
   TOPIK II Offline Exam - Dark Mode Overrides (Image 5)
   ===================================================================== */
html.dark #view-topik-exam {
  --topik-ink: #f8fafc;
  --topik-muted: #94a3b8;
  --topik-line: #1e293b;
  --topik-soft: #131b2e;
  --topik-blue: #3b82f6;
  --topik-blue-dark: #60a5fa;
  --topik-mint: #064e3b;
  --topik-violet: #3b0764;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-library-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #172554 100%) !important;
  border: 1px solid #1e40af !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

html.dark #view-topik-exam .topik-library-hero p {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* Toolbar & Filters */
html.dark #view-topik-exam .topik-filter {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-filter:hover:not(:disabled) {
  background: #334155 !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

html.dark #view-topik-exam .topik-filter b {
  background: #0f172a !important;
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-filter-active {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

html.dark #view-topik-exam .topik-filter-active b {
  background: #1e40af !important;
  color: #ffffff !important;
}

html.dark #view-topik-exam .topik-history-chip {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #38bdf8 !important;
}

html.dark #view-topik-exam .topik-history-static {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  color: #34d399 !important;
}

/* Exam Cards */
html.dark #view-topik-exam .topik-exam-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-exam-card-featured {
  border-top: 4px solid #3b82f6 !important;
}

html.dark #view-topik-exam .topik-exam-card h2 {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-exam-card>p {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-stats>div,
html.dark #view-topik-exam .topik-detail-stats>div {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-card-stats b,
html.dark #view-topik-exam .topik-detail-stats b {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-card-stats small,
html.dark #view-topik-exam .topik-detail-stats small {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-stats i,
html.dark #view-topik-exam .topik-detail-stats i {
  color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-card-last-result {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-card-last-result>span {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-card-last-result>b {
  color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-card-last-result>small {
  color: #64748b !important;
}

html.dark #view-topik-exam .topik-card-last-result.is-complete {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

html.dark #view-topik-exam .topik-card-last-result.is-complete>span,
html.dark #view-topik-exam .topik-card-last-result.is-complete>b {
  color: #34d399 !important;
}

/* Buttons */
html.dark #view-topik-exam .topik-btn-secondary {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-btn-secondary:hover:not(:disabled) {
  background: #334155 !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

html.dark #view-topik-exam .topik-back-link {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-back-link:hover {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-library-note {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-library-note code {
  color: #60a5fa !important;
}

/* Detail Card & Dialog */
html.dark #view-topik-exam .topik-detail-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-detail-stats {
  border-bottom: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-detail-stats>div {
  border-right: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-detail-body h2 {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-section-row {
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-section-blue {
  background: rgba(59, 130, 246, 0.15) !important;
}

html.dark #view-topik-exam .topik-section-mint {
  background: rgba(16, 185, 129, 0.15) !important;
}

html.dark #view-topik-exam .topik-section-violet {
  background: rgba(168, 85, 247, 0.15) !important;
}

html.dark #view-topik-exam .topik-section-row em {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-guidance {
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}

html.dark #view-topik-exam .topik-guidance b {
  color: #fef08a !important;
}

/* Runtime Player & Fullscreen Mode */
html.dark #view-topik-exam.topik-exam-fullscreen {
  background: #0b0f19 !important;
}

html.dark #view-topik-exam .topik-runtime-header {
  background: rgba(15, 23, 42, 0.95) !important;
  border-bottom: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-runtime-brand b {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-runtime-brand small {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-runtime-brand>i {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-timer {
  background: rgba(245, 158, 11, 0.15) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}

html.dark #view-topik-exam .topik-audio-panel {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-audio-heading {
  color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-audio-heading small {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-icon-btn {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-speed-label {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-speed-label select {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-question-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

html.dark #view-topik-exam .topik-question-prompt {
  border-bottom: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-question-prompt h1 {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-passage-box {
  background: #131b2e !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}

html.dark #view-topik-exam .topik-sub-question {
  color: #f1f5f9 !important;
}

html.dark #view-topik-exam .topik-question-image {
  border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-choice {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-choice b {
  background: #1e293b !important;
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-choice:hover:not(:disabled) {
  background: #1e293b !important;
  border-color: #3b82f6 !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-choice.is-selected {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
  box-shadow: inset 0 0 0 1px #3b82f6 !important;
}

html.dark #view-topik-exam .topik-choice.is-selected b {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

html.dark #view-topik-exam .topik-choice.is-right {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}

html.dark #view-topik-exam .topik-choice.is-wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

html.dark #view-topik-exam .topik-writing-answer textarea {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-writing-answer textarea:focus {
  border-color: #3b82f6 !important;
  outline-color: rgba(59, 130, 246, 0.25) !important;
}

html.dark #view-topik-exam .topik-writing-answer textarea:disabled {
  background: #0b0f19 !important;
  border-color: #1e293b !important;
  color: #64748b !important;
}

html.dark #view-topik-exam .topik-review-box {
  background: rgba(16, 185, 129, 0.12) !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  color: #34d399 !important;
}

html.dark #view-topik-exam .topik-question-nav {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}

html.dark #view-topik-exam .topik-question-nav>header {
  border-bottom: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-question-nav h2 {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-question-nav header p {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-nav-group h3 {
  color: #cbd5e1 !important;
}

html.dark #view-topik-exam .topik-number {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-number.answered {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
}

html.dark #view-topik-exam .topik-number.current {
  background: #2563eb !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}

html.dark #view-topik-exam .topik-number.correct {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
}

html.dark #view-topik-exam .topik-number.wrong {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

html.dark #view-topik-exam .topik-question-nav footer {
  border-top: 1px solid #1e293b !important;
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-dot {
  background: #131b2e !important;
  border: 1px solid #334155 !important;
}

/* Results & Modals */
html.dark #view-topik-exam .topik-result-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-result-card h1 {
  color: #f8fafc !important;
}

html.dark #view-topik-exam .topik-result-score>div {
  background: #131b2e !important;
  border: 1px solid #1e293b !important;
}

html.dark #view-topik-exam .topik-result-score b {
  color: #60a5fa !important;
}

html.dark #view-topik-exam .topik-result-score small {
  color: #94a3b8 !important;
}

html.dark #view-topik-exam .topik-result-note {
  background: rgba(245, 158, 11, 0.12) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}

html.dark #view-topik-exam .topik-confirm-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7) !important;
}

html.dark #view-topik-exam .topik-loading,
html.dark #view-topik-exam .topik-error {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

/* EPS mock papers (dethithu): keep every option readable on its own row. */
:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer-row {
  width: min(540px, 100%);
  grid-template-columns: 1fr;
  justify-items: stretch;
  gap: 2px;
  margin: 8px 0 0 !important;
}

:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer {
  min-height: 34px;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 7px;
  padding: 2px 5px;
  font-size: calc(15px * var(--eps-font-scale));
  line-height: 1.4;
  text-align: left;
}

:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer b {
  min-width: 27px;
  font-size: calc(17px * var(--eps-font-scale));
  line-height: 1.35;
}

:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer span {
  overflow: visible;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
  text-overflow: clip;
}

:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer span img {
  max-height: 90px;
}

:is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-question-image {
  width: min(540px, 100%);
  max-height: 46vh;
  margin: 8px 0 9px;
  object-fit: contain;
  object-position: left center;
}

:is(#eps-exam-app, .eps-exam-app) .eps-option-underline {
  text-decoration-line: underline;
  text-decoration-thickness: .1em;
  text-underline-offset: .16em;
  text-decoration-skip-ink: none;
}

@media (max-width: 640px) {
  :is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer {
    min-height: 32px;
    font-size: calc(14px * var(--eps-font-scale));
  }

  :is(#eps-exam-app, .eps-exam-app)[data-eps-mock-exam="true"] .eps-paper .eps-answer b {
    min-width: 25px;
    font-size: calc(16px * var(--eps-font-scale));
  }
}

/* ==========================================================================
   AUDITION VOCAB PVP BATTLE STYLES (ĐẤU TRÍ VŨ ĐIỆU TRỰC TUYẾN)
   ========================================================================== */
.au-pvp-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

.au-pvp-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
}

.au-pvp-song-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.au-pvp-song-title {
  font-weight: 800;
  color: #f1f5f9;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.au-pvp-song-title i {
  color: #ec4899;
}

.au-pvp-song-bpm {
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.au-pvp-progress-badge {
  font-size: 10.5px;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 2px 7px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.au-pvp-timer-widget {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 750;
}

.au-pvp-timer-icon {
  color: #38bdf8;
}

.au-pvp-timer-text {
  font-variant-numeric: tabular-nums;
  color: #fde047;
  font-weight: 800;
}

.au-pvp-stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #ffffff;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.au-pvp-stop-btn:hover {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

/* TOP BEAT BAR (KHUNG BI AUDITION) */
.au-pvp-khung-bi-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  min-height: 22px;
  margin: 1px 0;
}

.au-pvp-khung-bi {
  position: relative;
  width: 276px;
  max-width: 88%;
  height: 20px;
  box-sizing: border-box;
  background: linear-gradient(180deg, #11141a 0%, #06080b 45%, #0c0f14 55%, #181d26 100%);
  border: 1.5px solid #5a4228;
  border-top: 1.5px solid #8c6f4a;
  border-bottom: 1.5px solid #362615;
  border-radius: 9999px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.95), inset 0 -1px 1px rgba(255, 200, 150, 0.1), 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 1px #000;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.au-pvp-track {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
  border-radius: 2px;
}

.au-pvp-bi-target {
  position: absolute;
  left: calc(10px + 0.75 * (100% - 20px));
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  width: 60px;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 15%, rgba(255, 255, 255, 0.35) 35%, rgba(255, 255, 255, 0.85) 50%, rgba(255, 255, 255, 0.35) 65%, rgba(255, 255, 255, 0.06) 85%, transparent 100%);
  pointer-events: none;
  z-index: 5;
}

.au-pvp-bi-node,
.au-pvp-ball {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 17px;
  height: 17px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: radial-gradient(circle at center, #ffffff 0%, #ffedd5 18%, #f87171 40%, #e11d48 65%, #881337 92%);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.95), 0 0 14px rgba(225, 29, 72, 0.7);
  z-index: 10;
  pointer-events: none;
  will-change: left, transform;
}

/* JUDGEMENT OVERLAY */
.au-pvp-judgement-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: 'Nunito', 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 2px;
  z-index: 25;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
}

.au-pvp-judgement-overlay.show {
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
}

.au-pvp-judgement-overlay.judge-perfect {
  color: #f472b6;
  text-shadow: 0 0 25px #ec4899, 0 0 45px #f43f5e, 0 3px 0 #831843;
}

.au-pvp-judgement-overlay.judge-great {
  color: #34d399;
  text-shadow: 0 0 20px #10b981, 0 3px 0 #064e3b;
}

.au-pvp-judgement-overlay.judge-cool {
  color: #facc15;
  text-shadow: 0 0 20px #eab308, 0 3px 0 #713f12;
}

.au-pvp-judgement-overlay.judge-bad {
  color: #fb923c;
  text-shadow: 0 0 16px #ea580c, 0 3px 0 #7c2d12;
}

.au-pvp-judgement-overlay.judge-miss {
  color: #94a3b8;
  text-shadow: 0 0 12px #475569, 0 3px 0 #0f172a;
}

/* MAIN CONTROL BOARD */
.au-pvp-board {
  position: relative;
  background: linear-gradient(180deg, rgba(29, 24, 54, 0.98) 0%, rgba(13, 10, 26, 0.99) 100%);
  border: 2px solid #6366f1;
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.35), inset 0 0 14px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.au-pvp-question-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.au-pvp-q-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #10b981, #047857);
  border: 1.5px solid #6ee7b7;
  padding: 3px 9px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 11px;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0.4px;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.au-pvp-q-badge.ready {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-color: #93c5fd;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.au-pvp-q-badge.miss {
  background: linear-gradient(135deg, #ef4444, #991b1b);
  border-color: #fca5a5;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.au-pvp-q-badge.streak {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fde68a;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.au-pvp-q-text {
  font-size: 15px;
  font-weight: 850;
  color: #fde047;
  text-shadow: 0 0 8px rgba(253, 224, 71, 0.45);
  flex: 1;
  line-height: 1.25;
}

/* ARROW KEYS ROW */
.au-pvp-keys-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 0;
}

.au-pvp-key-node {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 2px solid #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #94a3b8;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.au-pvp-key-node.completed {
  border-color: #22c55e;
  background: linear-gradient(135deg, #15803d, #166534);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
  transform: scale(1.05);
}

.au-pvp-key-node.active {
  border-color: #38bdf8;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.85);
  animation: auKeyPulse 0.8s infinite alternate ease-in-out;
}

@keyframes auKeyPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  }

  100% {
    transform: scale(1.12);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.95);
  }
}

/* 4 ANSWER CHOICES GRID */
.au-pvp-ans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
}

.au-pvp-ans-btn {
  background: linear-gradient(180deg, #2a254d, #16132e);
  border: 1.5px solid #64748b;
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  min-width: 0;
  text-align: left;
  outline: none;
}

.au-pvp-ans-btn:hover {
  transform: translateY(-1px);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

.au-pvp-ans-key {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #475569, #1e293b);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #94a3b8;
  flex-shrink: 0;
}

.au-pvp-ans-label {
  font-size: 12px;
  font-weight: 800;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  flex: 1;
}

.au-pvp-ans-btn.selected {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  border-color: #38bdf8 !important;
  transform: scale(1.03);
  box-shadow: 0 0 16px #38bdf8, inset 0 0 8px rgba(255, 255, 255, 0.35) !important;
}

.au-pvp-ans-btn.selected .au-pvp-ans-key {
  background: #fde047;
  color: #0f172a;
  border-color: #ffffff;
  font-weight: 900;
}

.au-pvp-ans-btn.selected .au-pvp-ans-label {
  color: #ffffff;
  text-shadow: 0 0 6px #ffffff;
}

.au-pvp-ans-btn.correct-flash {
  background: linear-gradient(135deg, #10b981, #047857) !important;
  border-color: #6ee7b7 !important;
  box-shadow: 0 0 20px #10b981 !important;
}

.au-pvp-ans-btn.wrong-flash {
  background: linear-gradient(135deg, #ef4444, #991b1b) !important;
  border-color: #fca5a5 !important;
  box-shadow: 0 0 20px #ef4444 !important;
}

/* SPACE STRIKE BUTTON */
.au-pvp-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  border: 2px solid #fef08a;
  border-radius: 10px;
  padding: 5px 12px;
  color: #ffffff;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.7);
  white-space: nowrap;
  transition: transform 0.1s ease;
}

.au-pvp-ctrl-btn:active {
  transform: scale(0.94);
}

/* FINISH BANNER */
.au-pvp-finish-banner {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 2px solid #818cf8;
  border-radius: 12px;
  padding: 14px 18px;
  text-align: center;
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.4);
}

@media (max-width: 640px) {
  .au-pvp-ans-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .au-pvp-key-node {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .au-pvp-khung-bi {
    width: clamp(210px, 68vw, 240px);
    height: 18px;
  }

  .au-pvp-q-text {
    font-size: 13.5px;
  }
}

/* =========================================================
   V2 CUSTOM ANSWERS MANAGER & MODAL BANNER STYLES
   Fix white-on-white text & missing tailwind opacity classes
   ========================================================= */

.v2-custom-answers-banner {
  background: linear-gradient(135deg, #3730a3 0%, #1e1b4b 100%) !important;
  border: 1px solid #4338ca !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(49, 46, 129, 0.25) !important;
}

.v2-custom-answers-banner h4 {
  color: #ffffff !important;
}

.v2-custom-answers-banner p {
  color: #c7d2fe !important;
}

.v2-btn-banner-export {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.v2-btn-banner-export:hover {
  background: rgba(255, 255, 255, 0.26) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.v2-btn-banner-import {
  background: #ffffff !important;
  color: #312e81 !important;
  border: 1px solid #e0e7ff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12) !important;
}

.v2-btn-banner-import:hover {
  background: #eef2ff !important;
  color: #1e1b4b !important;
}

.v2-btn-banner-clear {
  background: #e11d48 !important;
  color: #ffffff !important;
  border: 1px solid #fb7185 !important;
  box-shadow: 0 2px 6px rgba(225, 29, 72, 0.35) !important;
}

.v2-btn-banner-clear:hover {
  background: #be123c !important;
  color: #ffffff !important;
  border-color: #f43f5e !important;
}

/* Missing Tailwind Utilities Polyfill */
.hw-to-teal-600 {
  --tw-gradient-to: #0d9488 var(--tw-gradient-to-position) !important;
}

.hw-to-amber-600 {
  --tw-gradient-to: #d97706 var(--tw-gradient-to-position) !important;
}

.hw-bg-white\/20 {
  background-color: rgba(255, 255, 255, 0.2) !important;
}

.hw-bg-white\/30 {
  background-color: rgba(255, 255, 255, 0.3) !important;
}

.hw-bg-rose-500\/80 {
  background-color: rgba(244, 63, 94, 0.85) !important;
}

.hover\:hw-bg-white\/30:hover {
  background-color: rgba(255, 255, 255, 0.35) !important;
}

.hover\:hw-bg-rose-600:hover {
  background-color: #e11d48 !important;
}

/* PVP Round 2 Smart Question & Answer Mask Controls - Hidden per user request */
.pvp-mask-control-bar {
  display: none !important;
}

.pvp-mask-btn {
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid #334155 !important;
  color: #94a3b8 !important;
  border-radius: 14px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 3px 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  touch-action: manipulation !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  box-sizing: border-box !important;
}

.pvp-mask-btn:hover {
  background: rgba(51, 65, 85, 0.9) !important;
  color: #f1f5f9 !important;
  border-color: #64748b !important;
}

.pvp-mask-btn.pvp-mask-active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(79, 70, 229, 0.35)) !important;
  border-color: #a78bfa !important;
  color: #e9d5ff !important;
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.3) !important;
}

.pvp-mask-btn .mask-icon {
  font-size: 12px !important;
  pointer-events: none !important;
}

.pvp-mask-btn .mask-text {
  pointer-events: none !important;
  letter-spacing: 0.2px !important;
}

.pvp-v2-masked-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 6px 14px !important;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(99, 102, 241, 0.15)) !important;
  border: 1px dashed rgba(56, 189, 248, 0.45) !important;
  border-radius: 10px !important;
  color: #38bdf8 !important;
  font-size: 13px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  margin: 3px auto !important;
  transition: all 0.2s ease !important;
  user-select: none !important;
  animation: pvpMaskBadgeGlow 2.5s infinite ease-in-out !important;
}

.pvp-v2-masked-badge:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  border-color: #38bdf8 !important;
  transform: scale(1.02) !important;
}

@keyframes pvpMaskBadgeGlow {

  0%,
  100% {
    box-shadow: 0 0 5px rgba(56, 189, 248, 0.2);
  }

  50% {
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
  }
}

.pvp-audio-pulse {
  animation: pvpAudioPulse 1.8s infinite ease-in-out !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5) !important;
}

@keyframes pvpAudioPulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
  }

  50% {
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.7);
  }
}

/* Force hide Vietnamese question translation when mask is active */
.pvp-v2-q-vi.pvp-masked-vi,
.pvp-mask-vi-active .pvp-v2-q-vi,
#live-room-quiz-area.pvp-mask-vi-active .pvp-v2-q-vi,
#pvp-live-room.pvp-mask-vi-active .pvp-v2-q-vi {
  display: none !important;
}

/* =====================================================================
   DARK MODE: V2 SMART MODAL (Ảnh 2 - modal white background fix)
   ===================================================================== */
html.dark #v2-smart-modal>div {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

/* Modal header bar */
html.dark #v2-smart-modal [class*="hw-bg-slate-50"],
html.dark #v2-smart-modal [class*="hw-border-slate-200"] {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

/* Modal title text */
html.dark #v2-smart-modal [class*="hw-text-slate-800"] {
  color: #f8fafc !important;
}

/* Modal body text */
html.dark #v2-smart-modal [class*="hw-text-slate-600"],
html.dark #v2-smart-modal [class*="hw-text-slate-500"],
html.dark #v2-smart-modal [class*="hw-text-slate-700"] {
  color: #94a3b8 !important;
}

/* Modal close button */
html.dark #v2-smart-modal [class*="hw-bg-slate-100"] {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
}

html.dark #v2-smart-modal [class*="hw-bg-slate-100"]:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* Modal body content area */
html.dark #v2-smart-modal .hw-bg-white {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Modal labels */
html.dark #v2-smart-modal label[class*="hw-text-slate-800"] {
  color: #f1f5f9 !important;
}

/* Modal info panels (amber info box) */
html.dark #v2-smart-modal [class*="hw-bg-amber-50"] {
  background-color: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
}

html.dark #v2-smart-modal [class*="hw-text-amber-900"],
html.dark #v2-smart-modal [class*="hw-text-amber-600"] {
  color: #fbbf24 !important;
}

/* Modal info panels (slate info box) */
html.dark #v2-smart-modal [class*="hw-bg-slate-50"][class*="hw-border-slate-200"] {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

/* Autoread delay/repeat pill buttons (inactive) */
html.dark #v2-smart-modal .v2-delay-pill-btn[class*="hw-bg-slate-100"],
html.dark #v2-smart-modal .v2-repeat-pill-btn[class*="hw-bg-slate-100"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

html.dark #v2-smart-modal .v2-delay-pill-btn[class*="hw-bg-slate-100"]:hover,
html.dark #v2-smart-modal .v2-repeat-pill-btn[class*="hw-bg-slate-100"]:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* Autoread delay display badge */
html.dark #v2-smart-modal [class*="hw-bg-indigo-50"] {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
  color: #818cf8 !important;
}

/* Modal border dividers */
html.dark #v2-smart-modal [class*="hw-border-slate-100"] {
  border-color: #1e293b !important;
}

/* Modal slider text */
html.dark #v2-smart-modal [class*="hw-text-slate-400"] {
  color: #64748b !important;
}

/* Vietnamese Autoread Header Card & Pills in Settings Modal */
.v2-autoread-vi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.v2-autoread-vi-card .v2-card-title {
  color: #1e293b;
}

.v2-autoread-vi-card .v2-card-subtitle {
  color: #64748b;
}

html.dark #v2-smart-modal .v2-autoread-vi-card {
  background: #131d31 !important;
  border: 1px solid #233554 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

html.dark #v2-smart-modal .v2-autoread-vi-card .v2-card-title {
  color: #f1f5f9 !important;
}

html.dark #v2-smart-modal .v2-autoread-vi-card .v2-card-subtitle {
  color: #94a3b8 !important;
}

/* Vietnamese Mode & Voice Pills in Dark Mode */
html.dark #v2-smart-modal .v2-vi-mode-btn[class*="hw-bg-slate-50"],
html.dark #v2-smart-modal .v2-vi-voice-btn[class*="hw-bg-slate-50"],
html.dark #v2-smart-modal .v2-vi-pause-pill-btn[class*="hw-bg-slate-100"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}

html.dark #v2-smart-modal .v2-vi-mode-btn[class*="hw-bg-slate-50"]:hover,
html.dark #v2-smart-modal .v2-vi-voice-btn[class*="hw-bg-slate-50"]:hover,
html.dark #v2-smart-modal .v2-vi-pause-pill-btn[class*="hw-bg-slate-100"]:hover {
  background-color: #334155 !important;
  color: #f8fafc !important;
}

/* Vietnamese Test Button in Dark Mode */
html.dark #v2-smart-modal #v2-test-vi-voice-btn {
  background-color: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
  color: #a5b4fc !important;
}

html.dark #v2-smart-modal #v2-test-vi-voice-btn:hover {
  background-color: rgba(99, 102, 241, 0.25) !important;
  color: #c7d2fe !important;
}

/* Vietnamese Autoread Sub-boxes in Settings Modal (Dịch câu hỏi / Dịch đáp án) */
html.dark #v2-smart-modal .v2-autoread-vi-card [class*="hw-bg-white"] {
  background-color: #1a2642 !important;
  border-color: #2e4369 !important;
}

/* Question Vietnamese Translation Speaking Visual Cue */
.v2-vi-question-speaking {
  color: #4f46e5 !important;
  font-weight: 700 !important;
  transition: all 0.2s ease-in-out;
}

html.dark .v2-vi-question-speaking {
  color: #818cf8 !important;
  text-shadow: 0 0 12px rgba(129, 140, 248, 0.4);
}

/* =====================================================================
   FACEBOOK-STYLE SOCIAL PROFILE & FEED STYLES (ẢNH 1, 2, 3)
   ===================================================================== */
.fb-note-bubble {
  position: relative;
}

.fb-note-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #ffffff;
}

html.dark .fb-note-bubble::after {
  border-top-color: #1e293b;
}

.fb-profile-card,
.fb-post-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

html.dark #view-profile,
html.dark #view-community {
  color: #f8fafc;
}

html.dark #view-profile .fb-profile-card,
html.dark #view-profile .fb-post-card,
html.dark #view-community .fb-post-card,
html.dark #view-profile #hw-profile-info-card,
html.dark #view-profile [class*="hw-bg-white"],
html.dark #view-community [class*="hw-bg-white"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark #view-profile [class*="hw-text-slate-900"],
html.dark #view-community [class*="hw-text-slate-900"] {
  color: #f8fafc !important;
}

html.dark #view-profile [class*="hw-text-slate-800"],
html.dark #view-community [class*="hw-text-slate-800"] {
  color: #f1f5f9 !important;
}

html.dark #view-profile [class*="hw-text-slate-700"],
html.dark #view-community [class*="hw-text-slate-700"] {
  color: #cbd5e1 !important;
}

html.dark #view-profile [class*="hw-text-slate-600"],
html.dark #view-community [class*="hw-text-slate-600"] {
  color: #94a3b8 !important;
}

html.dark #view-profile [class*="hw-text-slate-500"],
html.dark #view-community [class*="hw-text-slate-500"] {
  color: #94a3b8 !important;
}

html.dark #view-profile [class*="hw-bg-slate-50"],
html.dark #view-community [class*="hw-bg-slate-50"] {
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

html.dark #view-profile [class*="hw-border-slate-100"],
html.dark #view-profile [class*="hw-border-slate-200"],
html.dark #view-profile [class*="hw-border-emerald-100"],
html.dark #view-community [class*="hw-border-slate-100"],
html.dark #view-community [class*="hw-border-slate-200"] {
  border-color: #334155 !important;
}

html.dark #view-profile input,
html.dark #view-profile textarea,
html.dark #view-profile select,
html.dark #view-community input,
html.dark #view-community textarea,
html.dark #view-community select {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark #view-profile input::placeholder,
html.dark #view-profile textarea::placeholder,
html.dark #view-community input::placeholder,
html.dark #view-community textarea::placeholder {
  color: #64748b !important;
}

/* Modal Dark Mode & Light Mode Facebook Standard Styling */
html.dark #fb-post-create-modal>div,
html.dark #fb-profile-edit-modal>div,
html.dark #fb-comments-modal>div {
  background-color: #242526 !important;
  border-color: #393a3b !important;
  color: #e4e6eb !important;
  box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.45), 0 2px 4px 0 rgba(0, 0, 0, 0.2) !important;
}

html:not(.dark) #fb-post-create-modal>div,
html:not(.dark) #fb-profile-edit-modal>div {
  background-color: #ffffff !important;
  border-color: #ced0d4 !important;
  color: #050505 !important;
  box-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.2), 0 2px 4px 0 rgba(0, 0, 0, 0.1) !important;
}

html.dark #fb-profile-edit-modal input::placeholder,
html.dark #fb-post-create-modal textarea::placeholder,
html.dark #fb-profile-edit-modal textarea::placeholder {
  color: #8a8d91 !important;
}

/* =========================================================================
   FACEBOOK DARK MODE HOVER FIXES (Eliminates jarring white background)
   ========================================================================= */
html.dark [class*="hover:hw-bg-slate-100"]:hover,
html.dark [class*="dark:hover:hw-bg-[#3a3b3c]"]:hover,
html.dark .hover\:hw-bg-slate-100:hover,
html.dark .fb-nav-tab:not(.active):hover,
html.dark .fb-composer-tool-btn:hover,
html.dark .fb-audience-row:hover,
html.dark .fb-feed-action-btn:hover {
  background-color: #3a3b3c !important;
  color: #e4e6eb !important;
}

/* Active tab style consistency on hover */
html.dark .fb-nav-tab.active:hover {
  background-color: rgba(45, 136, 255, 0.25) !important;
  color: #2d88ff !important;
}

html:not(.dark) .fb-nav-tab.active:hover {
  background-color: #eff6ff !important;
  color: #1877f2 !important;
}

html:not(.dark) .fb-nav-tab:not(.active):hover {
  background-color: #f0f2f5 !important;
  color: #050505 !important;
}

/* =========================================================================
   COMMUNITY UNREAD NOTIFICATION BADGE (REALTIME & ZERO LAYOUT SHIFT)
   ========================================================================= */
.hw-tab-icon-wrap {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 24px !important;
  height: 24px !important;
  flex-shrink: 0 !important;
}

.hw-community-badge-dot {
  position: absolute !important;
  top: -3px !important;
  right: -3px !important;
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  min-height: 8px !important;
  max-width: 8px !important;
  max-height: 8px !important;
  border-radius: 50% !important;
  background-color: #ef4444 !important;
  /* Authentic FB Notification Red */
  border: 1.5px solid #ffffff !important;
  box-shadow: 0 0 5px rgba(239, 68, 68, 0.75) !important;
  pointer-events: none !important;
  z-index: 30 !important;
  display: block !important;
  line-height: 0 !important;
  font-size: 0 !important;
  box-sizing: border-box !important;
  animation: hwFbBadgePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
}

html.dark .hw-community-badge-dot {
  border-color: #0f172a !important;
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.85) !important;
}

.hw-community-badge-dot.hw-hidden,
#desktop-community-unread-dot.hw-hidden,
#mobile-community-unread-dot.hw-hidden {
  display: none !important;
}

@keyframes hwFbBadgePulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.85;
  }
}


/* Cover Photo Full Width & Fill Fixes (Triệt tiêu hoàn toàn viền đen/xanh & chống mất góc trên desktop) */
#fb-cover-photo-container {
  width: 100% !important;
  position: relative !important;
  overflow: hidden !important;
  background-color: transparent !important;
  background-image: none !important;
  border-top-left-radius: inherit !important;
  border-top-right-radius: inherit !important;
  border: none !important;
}

html:not(.dark) #fb-cover-photo-container {
  background-color: #f1f5f9 !important;
}

html.dark #fb-cover-photo-container {
  background-color: #0f172a !important;
}

/* Default framing fallback: object-position: center 25% */
#fb-cover-photo-img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
  border: none !important;
}

/* Circular Avatar Full Fill & No Gaps (Avatar tròn tràn viền 100% tuyệt đối - Ảnh 2) */
.fb-avatar-wrapper {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 9999px !important;
  aspect-ratio: 1 / 1 !important;
  flex-shrink: 0 !important;
  background-color: #f1f5f9 !important;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
}

html.dark .fb-avatar-wrapper {
  background-color: #1e293b !important;
}

.fb-avatar-wrapper img,
.fb-avatar-wrapper #fb-profile-avatar-img,
#fb-profile-avatar-img {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  -o-object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

#fb-composer-avatar-img {
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  max-width: 2.5rem !important;
  max-height: 2.5rem !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  object-position: center !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* Interactive Avatar & Cover Photo Facebook-Style Framing & Zoom Controls */
#fb-edit-avatar-viewport {
  position: relative !important;
  overflow: hidden !important;
  border-radius: 9999px !important;
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: none !important;
}

#fb-edit-avatar-viewport.is-dragging {
  cursor: grabbing !important;
}

#fb-edit-avatar-preview {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  pointer-events: none !important;
  transform-origin: center center !important;
}

#fb-edit-cover-viewport {
  position: relative !important;
  overflow: hidden !important;
  cursor: grab !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  touch-action: none !important;
}

#fb-edit-cover-viewport.is-dragging {
  cursor: grabbing !important;
}

#fb-edit-cover-preview {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block !important;
  pointer-events: none !important;
  transform-origin: center center !important;
}

#fb-cover-zoom-range,
#fb-avatar-zoom-range {
  -webkit-appearance: none !important;
  appearance: none !important;
  height: 6px !important;
  border-radius: 9999px !important;
  outline: none !important;
}

#fb-cover-zoom-range::-webkit-slider-thumb,
#fb-avatar-zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 9999px !important;
  background: #2563eb !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

#fb-cover-zoom-range::-moz-range-thumb,
#fb-avatar-zoom-range::-moz-range-thumb {
  width: 16px !important;
  height: 16px !important;
  border-radius: 9999px !important;
  background: #2563eb !important;
  cursor: pointer !important;
  border: none !important;
}

#fb-post-create-author-avatar {
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  max-width: 2.5rem !important;
  max-height: 2.5rem !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  object-position: center !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* Camera Button on Avatar (Ảnh 1 & Ảnh 5 - Khắc phục triệt để icon bị mờ ở giao diện sáng) */
.fb-avatar-camera-btn,
button.fb-avatar-camera-btn {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
  border: 2.5px solid #ffffff !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  z-index: 20 !important;
}

.fb-avatar-camera-btn i,
.fb-avatar-camera-btn svg {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.fb-avatar-camera-btn:hover {
  background-color: #cbd5e1 !important;
  transform: scale(1.1) !important;
}

html.dark .fb-avatar-camera-btn,
html.dark button.fb-avatar-camera-btn {
  background-color: #334155 !important;
  color: #f8fafc !important;
  border: 2.5px solid #0f172a !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4) !important;
}

html.dark .fb-avatar-camera-btn i,
html.dark .fb-avatar-camera-btn svg {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
}

html.dark .fb-avatar-camera-btn:hover {
  background-color: #475569 !important;
}

/* Camera Button on Cover Photo - Khắc phục triệt để icon bị mờ ở giao diện sáng (Ảnh 1) */
html:not(.dark) .fb-cover-camera-btn,
html:not(.dark) button.fb-cover-camera-btn,
.fb-cover-camera-btn,
button.fb-cover-camera-btn {
  background-color: rgba(15, 23, 42, 0.85) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

html:not(.dark) .fb-cover-camera-btn i,
html:not(.dark) .fb-cover-camera-btn span,
.fb-cover-camera-btn i,
.fb-cover-camera-btn span {
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-weight: 700 !important;
}

html:not(.dark) .fb-cover-camera-btn:hover,
.fb-cover-camera-btn:hover {
  background-color: rgba(15, 23, 42, 0.96) !important;
  color: #ffffff !important;
}

/* Post Creation Image Upload Preview (Ảnh 3 - Phủ tràn full 100% không bị khuyết) */
#fb-post-image-previews .fb-preview-item,
#fb-post-image-previews>div {
  width: 6rem !important;
  height: 6rem !important;
  aspect-ratio: 1 / 1 !important;
  position: relative !important;
  overflow: hidden !important;
  border-radius: 0.75rem !important;
  border: 1px solid #cbd5e1 !important;
  flex-shrink: 0 !important;
}

html.dark #fb-post-image-previews .fb-preview-item,
html.dark #fb-post-image-previews>div {
  border-color: #334155 !important;
}

#fb-post-image-previews img {
  position: absolute !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  -o-object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

/* =====================================================================
   FACEBOOK COMPOSER & AUDIENCE SELECTOR MODAL (MẪU ẢNH 1 & ẢNH 2 CHUẨN)
   ===================================================================== */
.fb-composer-modal-box {
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.25), 0 4px 16px -2px rgba(0, 0, 0, 0.1) !important;
}

.fb-composer-tool-btn {
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease !important;
}

.fb-composer-tool-btn:hover {
  transform: scale(1.1) !important;
}

.fb-composer-tool-btn:active {
  transform: scale(0.95) !important;
}

.fb-audience-row {
  transition: background-color 0.15s ease, transform 0.1s ease !important;
}

.fb-audience-row:active {
  transform: scale(0.99) !important;
}

#fb-composer-editor-box textarea {
  transition: min-height 0.2s ease, font-size 0.2s ease !important;
}

#fb-composer-editor-box textarea::placeholder {
  color: #94a3b8;
}

html.dark #fb-composer-editor-box textarea::placeholder {
  color: #64748b;
}

#fb-composer-editor-box textarea[data-bg-preset]::placeholder {
  color: rgba(255, 255, 255, 0.85) !important;
}


/* Note Bubble on Top of Avatar */
#fb-avatar-note-bubble {
  z-index: 25 !important;
}

/* Friends Carousel Scrollbar Fix */
#fb-friends-carousel-container {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

#fb-friends-carousel-container::-webkit-scrollbar {
  display: none !important;
}

/* Friends Carousel Avatar Full Fill & No Gaps (Ảnh 3) */
#fb-friends-carousel-container .fb-friend-avatar-wrap,
#fb-friends-carousel-container .hw-rounded-full {
  aspect-ratio: 1 / 1 !important;
  border-radius: 9999px !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
}

#fb-friends-carousel-container img,
#fb-friends-carousel-container .fb-friend-avatar-img {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  -o-object-fit: cover !important;
  object-position: center !important;
  display: block !important;
}

/* Full-width Edge-to-Edge Profile Card across All Screens (matching Facebook App & Web UI - Phủ full khung triệt để sát kịch trần nóc web) */
#view-profile {
  margin-left: -1rem !important;
  margin-right: -1rem !important;
  margin-top: -1rem !important;
  padding-top: 0 !important;
  width: auto !important;
}

@media (min-width: 768px) {
  #view-profile {
    margin-left: -1.5rem !important;
    margin-right: -1.5rem !important;
    margin-top: -1.5rem !important;
    padding-top: 0 !important;
  }
}

#view-profile .fb-profile-card {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
}

#view-profile #fb-profile-sticky-tab-bar {
  width: 100% !important;
  border-radius: 1rem !important;
}

@media (min-width: 1024px) {
  #fb-profile-left-col {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 4.5rem !important;
    align-self: flex-start !important;
    max-height: calc(100vh - 5.5rem) !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  #fb-profile-left-col::-webkit-scrollbar {
    display: none !important;
  }
}

#view-profile #fb-cover-photo-container {
  width: 100% !important;
  position: relative !important;
  overflow: hidden !important;
}

@media (min-width: 1024px) {
  #view-profile #fb-cover-photo-container {
    height: 380px !important;
  }
}

@media (min-width: 1280px) {
  #view-profile #fb-cover-photo-container {
    height: 420px !important;
  }
}

#view-profile #fb-profile-tab-feed,
#view-profile #fb-profile-tab-photos,
#view-profile #fb-profile-tab-settings {
  padding-left: 0 !important;
  padding-right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

@media (min-width: 768px) {

  #view-profile #fb-profile-tab-feed,
  #view-profile #fb-profile-tab-photos,
  #view-profile #fb-profile-tab-settings {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}

/* Facebook Grid View Mode for Posts (Ảnh 5) */
#fb-profile-posts-container.is-grid-view {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
}

@media (min-width: 1024px) {
  #fb-profile-posts-container.is-grid-view {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
  }
}

.fb-post-grid-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

html.dark .fb-post-grid-card {
  background-color: #1e293b;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.fb-post-grid-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.fb-post-grid-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #0f172a;
}

.fb-post-grid-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.fb-post-grid-card:hover .fb-post-grid-media img {
  transform: scale(1.04);
}

.fb-post-grid-footer {
  padding: 0.5rem 0.65rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  background-color: inherit;
}

html.dark .fb-post-grid-footer {
  border-top-color: #334155;
}

/* Facebook-style Tab Pill Active Indicator */
.fb-nav-tab {
  position: relative;
  transition: all 0.15s ease-in-out;
}

.fb-nav-tab.active {
  color: #2563eb !important;
}

.fb-nav-tab.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: #2563eb;
  border-radius: 3px 3px 0 0;
}

html.dark .fb-nav-tab.active {
  color: #3b82f6 !important;
}

html.dark .fb-nav-tab.active::after {
  background-color: #3b82f6;
}

/* 3x3 Friends Grid item */
.fb-friend-grid-card {
  transition: transform 0.15s ease;
}

.fb-friend-grid-card:hover {
  transform: scale(1.02);
}

/* 3x3 Photo Grid thumbnail */
.fb-photo-grid-thumb {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  border-radius: 10px !important;
  cursor: pointer;
  background-color: #e2e8f0;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

html.dark .fb-photo-grid-thumb {
  background-color: #1e293b;
}

.fb-photo-grid-thumb:hover {
  opacity: 0.92;
  transform: scale(1.02);
}

.fb-photo-grid-thumb img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
}

/* 3x3 Friends Grid thumbnail - circular frame & full-background avatar */
.fb-friend-grid-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  transition: transform 0.15s ease !important;
}

.fb-friend-grid-card:hover {
  transform: scale(1.02) !important;
}

.fb-friend-grid-card .fb-friend-avatar-wrap {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.fb-friend-grid-card .fb-friend-avatar-wrap img {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover !important;
  object-position: center center !important;
  display: block !important;
  border-radius: 50% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.fb-friend-grid-card .fb-friend-card-info {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  margin-top: 6px !important;
  gap: 2px !important;
}

.fb-friend-grid-card .fb-friend-name {
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
  width: 100% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
}

.fb-friend-grid-card .fb-friend-status {
  font-size: 10px !important;
  line-height: 1.3 !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  white-space: nowrap !important;
}

/* Green online status badge & dot (6px perfectly round, never stretched to ellipse) */
.fb-friend-grid-card .fb-friend-online-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  color: #059669 !important;
}

html.dark .fb-friend-grid-card .fb-friend-online-badge {
  color: #34d399 !important;
}

.fb-friend-grid-card .fb-friend-online-dot {
  width: 6px !important;
  height: 6px !important;
  min-width: 6px !important;
  min-height: 6px !important;
  max-width: 6px !important;
  max-height: 6px !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  background-color: #10b981 !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

/* Aspect square general helper */
.hw-aspect-square {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  overflow: hidden !important;
}


/* Profile header avatar and friend carousel avatar */
.fb-avatar-wrapper img,
#fb-profile-avatar-img,
.fb-friend-avatar-img {
  object-fit: cover !important;
  object-position: center center !important;
}


/* Post Media Image Lightbox & Responsive */
.fb-post-media-wrapper img {
  border-radius: 12px;
  max-height: 480px;
  width: 100%;
  object-fit: cover;
}

/* =====================================================================
   INLINE FACEBOOK COMMENTS & INPUT (Ảnh 4 chuẩn - Không mở modal)
   ===================================================================== */
.fb-comment-input-pill {
  background-color: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  transition: all 0.2s ease !important;
}

.fb-comment-input-pill:focus-within {
  background-color: #ffffff !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15) !important;
}

html.dark .fb-comment-input-pill {
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

html.dark .fb-comment-input-pill:focus-within {
  background-color: #0f172a !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2) !important;
}

.fb-comment-bubble {
  background-color: #f0f2f5 !important;
  color: #050505 !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px 12px !important;
  border-radius: 18px !important;
  transition: background-color 0.15s ease;
}

.fb-comment-bubble:hover {
  background-color: #e4e6eb !important;
}

html.dark .fb-comment-bubble {
  background-color: #3a3b3c !important;
  color: #e4e6eb !important;
  border: none !important;
  box-shadow: none !important;
}

html.dark .fb-comment-bubble:hover {
  background-color: #4e4f50 !important;
}

/* =====================================================================
   FACEBOOK COMMENT & REPLY AVATARS (Khắc phục triệt để lỗi phóng to ảnh)
   ===================================================================== */
.fb-comment-avatar,
.fb-comment-item>img,
.fb-comment-item>img[class*="fb-user-avatar"] {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.fb-comment-reply-avatar,
.fb-comment-reply-item>img,
.fb-comment-reply-item>img[class*="fb-user-avatar"] {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  border-radius: 9999px !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
  display: block !important;
}

/* =====================================================================
   HIDE SCROLLBARS (Ẩn triệt để thanh cuộn ngang & dọc)
   ===================================================================== */
.hw-no-scrollbar::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar,
#fb-profile-tabs-scroll::-webkit-scrollbar,
#fb-profile-left-col::-webkit-scrollbar,
#fb-friends-carousel-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.hw-no-scrollbar,
.no-scrollbar,
#fb-profile-tabs-scroll,
#fb-profile-left-col,
#fb-friends-carousel-container {
  -ms-overflow-style: none !important;
  /* IE and Edge */
  scrollbar-width: none !important;
  /* Firefox */
}

/* Social Feed Image Lightbox */
#fb-lightbox-modal {
  z-index: 2147483647 !important;
}

.fb-lightbox-bottom-close:hover {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  transform: translateX(-50%) scale(1.1) !important;
}

/* Realtime Likes Inspector Modal (Ảnh 1 & 2) */
#fb-post-likes-modal {
  background-color: rgba(0, 0, 0, 0.6) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
}

.fb-likes-modal-card {
  background-color: #ffffff !important;
  border: 1px solid #e4e6eb !important;
  color: #050505 !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.2), 0 4px 16px -2px rgba(0, 0, 0, 0.08) !important;
}

html.dark .fb-likes-modal-card {
  background-color: #242526 !important;
  border: 1px solid #393a3b !important;
  color: #e4e6eb !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.6) !important;
}

.fb-likes-modal-header {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e4e6eb !important;
}

html.dark .fb-likes-modal-header {
  background-color: #242526 !important;
  border-bottom: 1px solid #393a3b !important;
}

.fb-likes-modal-tab {
  background-color: #ebf5ff !important;
  color: #1877f2 !important;
}

html.dark .fb-likes-modal-tab {
  background-color: #263951 !important;
  color: #2d88ff !important;
}

.fb-likes-modal-close-btn {
  background-color: #e4e6eb !important;
  color: #050505 !important;
}

.fb-likes-modal-close-btn:hover {
  background-color: #d8dadf !important;
}

html.dark .fb-likes-modal-close-btn {
  background-color: #3a3b3c !important;
  color: #e4e6eb !important;
}

html.dark .fb-likes-modal-close-btn:hover {
  background-color: #4e4f50 !important;
}

.fb-likes-modal-body {
  background-color: #ffffff !important;
}

html.dark .fb-likes-modal-body {
  background-color: #242526 !important;
}

.fb-likes-user-row:hover {
  background-color: #f2f2f2 !important;
}

html.dark .fb-likes-user-row:hover {
  background-color: #303031 !important;
}

.fb-likes-user-name {
  color: #050505 !important;
}

html.dark .fb-likes-user-name {
  color: #e4e6eb !important;
}

.fb-likes-user-handle {
  color: #65676b !important;
}

html.dark .fb-likes-user-handle {
  color: #b0b3b8 !important;
}

.fb-likes-action-btn {
  background-color: #e4e6eb !important;
  color: #050505 !important;
}

.fb-likes-action-btn:hover {
  background-color: #d8dadf !important;
}

html.dark .fb-likes-action-btn {
  background-color: #3a3b3c !important;
  color: #e4e6eb !important;
}

html.dark .fb-likes-action-btn:hover {
  background-color: #4e4f50 !important;
}

html.dark .fb-likes-modal-card .hw-divide-y>*+* {
  border-top-color: #393a3b !important;
}

/* Post Actions Bar Buttons (Ảnh 1 chuẩn Facebook) */
.fb-action-btn {
  background-color: transparent !important;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease !important;
}

.fb-action-btn:hover {
  background-color: rgba(0, 0, 0, 0.05) !important;
}

html.dark .fb-action-btn:hover {
  background-color: #3a3b3c !important;
}

.fb-action-btn.is-liked {
  color: #1877f2 !important;
}

html.dark .fb-action-btn.is-liked {
  color: #2d88ff !important;
}

.fb-action-btn.is-liked:hover {
  background-color: rgba(24, 119, 242, 0.08) !important;
}

html.dark .fb-action-btn.is-liked:hover {
  background-color: rgba(45, 136, 255, 0.12) !important;
}

/* Facebook Composer & Feed Cards (Ảnh 1, 2, 3) */
.fb-composer-trigger-pill {
  background-color: #f0f2f5 !important;
  color: #65676b !important;
  border: 1px solid transparent !important;
}

.fb-composer-trigger-pill:hover {
  background-color: #e4e6e9 !important;
}

html.dark .fb-composer-trigger-pill {
  background-color: #3a3b3c !important;
  color: #b0b3b8 !important;
  border: 1px solid transparent !important;
}

html.dark .fb-composer-trigger-pill:hover {
  background-color: #4e4f50 !important;
}

/* Feed Filter & Management Pills ("Bộ lọc", "Quản lý bài viết") (Ảnh 3) */
.fb-filter-pill {
  background-color: #f0f2f5 !important;
  color: #050505 !important;
  border: 1px solid transparent !important;
}

.fb-filter-pill:hover {
  background-color: #e4e6e9 !important;
}

html.dark .fb-filter-pill {
  background-color: #3a3b3c !important;
  color: #e4e6eb !important;
  border: 1px solid transparent !important;
}

html.dark .fb-filter-pill:hover {
  background-color: #4e4f50 !important;
}

/* Facebook Clean Card Background for Profile Page (Ảnh 1, 2, 3) */
html.dark .fb-post-card,
html.dark #fb-profile-posts-container>article,
html.dark .fb-profile-card,
html.dark .fb-composer-card,
html.dark .fb-feed-header-card,
html.dark #fb-intro-card,
html.dark .fb-inline-comments-section {
  background-color: #242526 !important;
  border-color: #393a3b !important;
}

/* Facebook Comment Input Pill (Ảnh 1 & 2) */
.fb-comment-input-pill {
  background-color: #f0f2f5 !important;
  border: 1px solid transparent !important;
}

html.dark .fb-comment-input-pill {
  background-color: #3a3b3c !important;
  border: 1px solid transparent !important;
}

/* Scoped Facebook Comments Modal (Ảnh 2) */
#fb-comments-modal .fb-comments-modal-box {
  background-color: #ffffff;
  color: #0f172a;
}

html.dark #fb-comments-modal .fb-comments-modal-box {
  background-color: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

#fb-comments-modal textarea::placeholder {
  color: #94a3b8;
}

html.dark #fb-comments-modal textarea::placeholder {
  color: #64748b;
}

/* Accessory Icons in Comment Input Bar (Ảnh 2) */
.fb-comment-accessory-btn {
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 9999px;
  transition: all 0.15s ease;
}

.fb-comment-accessory-btn:hover {
  color: #1877f2;
  background-color: rgba(24, 119, 242, 0.1);
  transform: scale(1.08);
}

html.dark .fb-comment-accessory-btn {
  color: #94a3b8;
}

html.dark .fb-comment-accessory-btn:hover {
  color: #60a5fa;
  background-color: rgba(96, 165, 250, 0.15);
}


/* =====================================================================
   DARK MODE: MEMORY ACTION BUTTONS (Ảnh 1 - Chưa thuộc/Tạm nhớ/Đã thuộc)
   ===================================================================== */
html.dark .v2-memory-action-rose,
html.dark .v2-quick-memory-action-rose {
  color: #fb7185 !important;
  background: rgba(225, 29, 72, 0.15) !important;
  border-color: rgba(225, 29, 72, 0.35) !important;
}

html.dark .v2-memory-action-rose:hover,
html.dark .v2-quick-memory-action-rose:hover {
  background: rgba(225, 29, 72, 0.25) !important;
  border-color: rgba(225, 29, 72, 0.5) !important;
}

html.dark .v2-memory-action-amber,
html.dark .v2-quick-memory-action-amber {
  color: #fbbf24 !important;
  background: rgba(217, 119, 6, 0.15) !important;
  border-color: rgba(217, 119, 6, 0.35) !important;
}

html.dark .v2-memory-action-amber:hover,
html.dark .v2-quick-memory-action-amber:hover {
  background: rgba(217, 119, 6, 0.25) !important;
  border-color: rgba(217, 119, 6, 0.5) !important;
}

html.dark .v2-memory-action-emerald,
html.dark .v2-quick-memory-action-emerald {
  color: #34d399 !important;
  background: rgba(5, 150, 105, 0.15) !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
}

html.dark .v2-memory-action-emerald:hover,
html.dark .v2-quick-memory-action-emerald:hover {
  background: rgba(5, 150, 105, 0.25) !important;
  border-color: rgba(5, 150, 105, 0.5) !important;
}

/* Active memory buttons - keep white text on colored bg */
html.dark .v2-memory-action-rose.is-active,
html.dark .v2-quick-memory-action-rose.is-active {
  color: #fff !important;
  background: #e11d48 !important;
  border-color: #e11d48 !important;
}

html.dark .v2-memory-action-amber.is-active,
html.dark .v2-quick-memory-action-amber.is-active {
  color: #fff !important;
  background: #d97706 !important;
  border-color: #d97706 !important;
}

html.dark .v2-memory-action-emerald.is-active,
html.dark .v2-quick-memory-action-emerald.is-active {
  color: #fff !important;
  background: #059669 !important;
  border-color: #059669 !important;
}

/* =====================================================================
   DARK MODE: MOCK EXAM SCREEN (Ảnh 3 & 4 - Thi thử)
   ===================================================================== */

/* Main container .hw-glass inside mock exam */
html.dark #mock-exam-screen .hw-glass {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
  color: #f8fafc !important;
}

/* Mock exam title */
html.dark #mock-exam-screen [class*="hw-text-slate-800"] {
  color: #f1f5f9 !important;
}

/* Mock exam subtitle/description */
html.dark #mock-exam-screen [class*="hw-text-slate-500"] {
  color: #64748b !important;
}

html.dark #mock-exam-screen [class*="hw-text-slate-600"] {
  color: #94a3b8 !important;
}

/* Mode toggle buttons (Tự động / Thủ công) - inactive state */
html.dark #mock-exam-screen [class*="hw-bg-slate-100"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

/* Mode toggle buttons - active state (amber) */
html.dark #mock-exam-screen [class*="hw-bg-amber-500\\/10"] {
  background-color: rgba(245, 158, 11, 0.15) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}

/* Category cards */
html.dark #mock-exam-screen [id^="mock-cat-card-"] {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

/* Category card text */
html.dark #mock-exam-screen [id^="mock-cat-card-"] [class*="hw-text-slate-800"] {
  color: #f1f5f9 !important;
}

html.dark #mock-exam-screen [id^="mock-cat-card-"] [class*="hw-text-slate-400"] {
  color: #64748b !important;
}

/* Category card count badge */
html.dark #mock-exam-screen [id^="mock-cat-card-"] [class*="hw-text-amber-600"] {
  color: #fbbf24 !important;
}

/* Category card sub-list items */
html.dark #mock-exam-screen [id^="mock-sublist-"] [class*="hw-bg-white"] {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
}

html.dark #mock-exam-screen [id^="mock-sublist-"] [class*="hw-bg-white"]:hover {
  background-color: #1e293b !important;
}

/* Category card sub-list text */
html.dark #mock-exam-screen [id^="mock-sublist-"] [class*="hw-text-slate-700"] {
  color: #e2e8f0 !important;
}

/* Category card borders */
html.dark #mock-exam-screen [id^="mock-cat-card-"] [class*="hw-border-slate-200"] {
  border-color: #1e293b !important;
}

/* Select dropdowns in manual mode */
html.dark #mock-exam-screen select[class*="hw-bg-white"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Chọn tất cả / Bỏ chọn hết links */
html.dark #mock-exam-screen [class*="hw-text-indigo-600"] {
  color: #818cf8 !important;
}

html.dark #mock-exam-screen [class*="hw-text-slate-300"] {
  color: #475569 !important;
}

/* BẮT ĐẦU THI button - keep it vibrant */
html.dark #mock-exam-screen [class*="hw-bg-indigo-600"] {
  background-color: #4f46e5 !important;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3) !important;
}

html.dark #mock-exam-screen [class*="hw-bg-indigo-600"]:hover {
  background-color: #6366f1 !important;
}

/* Checkbox styling in dark mode */
html.dark #mock-exam-screen input[type="checkbox"] {
  accent-color: #f59e0b !important;
}

/* =====================================================================
   DARK MODE: EPS-TOPIK LIBRARY CARDS (Ảnh 1 - /epstopik)
   ===================================================================== */
html.dark .eps-library-card {
  background: #0f172a !important;
  border-color: #1e293b !important;
  border-top-color: #2563eb !important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
}

html.dark .eps-library-card h2 {
  color: #f1f5f9 !important;
}

html.dark .eps-library-card>p {
  color: #94a3b8 !important;
}

html.dark .eps-library-card-top>span {
  background: rgba(37, 99, 235, 0.15) !important;
  color: #60a5fa !important;
}

html.dark .eps-library-card-top em {
  color: #34d399 !important;
}

html.dark .eps-library-stats {
  border-color: #1e293b !important;
}

html.dark .eps-library-stats span {
  border-right-color: #1e293b !important;
}

html.dark .eps-library-stats b {
  color: #e2e8f0 !important;
}

html.dark .eps-library-stats small {
  color: #64748b !important;
}

html.dark .eps-audio-type {
  background: #131b2e !important;
  color: #94a3b8 !important;
}

html.dark .eps-audio-type i {
  color: #60a5fa !important;
}

html.dark .eps-library-last-result {
  border-color: #1e293b !important;
  background: #131b2e !important;
}

html.dark .eps-library-last-result>span {
  color: #94a3b8 !important;
}

html.dark .eps-library-last-result>b {
  color: #60a5fa !important;
}

html.dark .eps-library-last-result>small {
  color: #64748b !important;
}

html.dark .eps-library-last-result.is-new {
  background: #131b2e !important;
}

html.dark .eps-library-last-result.is-new>span {
  color: #94a3b8 !important;
}

html.dark .eps-library-last-result.is-complete {
  background: rgba(5, 150, 105, 0.1) !important;
  border-color: rgba(5, 150, 105, 0.3) !important;
}

html.dark .eps-library-last-result.is-complete>span {
  color: #34d399 !important;
}

html.dark .eps-library-last-result.is-complete>b {
  color: #34d399 !important;
}

html.dark .eps-library-card>button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
}

/* EPS Library header */
html.dark .eps-library-heading>span,
html.dark .eps-library-heading b {
  color: #f1f5f9 !important;
}

html.dark .eps-library-heading small {
  color: #64748b !important;
}

/* EPS Library status badge */
html.dark .eps-library-status b {
  color: #f1f5f9 !important;
}

html.dark .eps-library-status small {
  color: #94a3b8 !important;
}

/* =====================================================================
   DARK MODE: LIBRARY HOME QUEST ITEMS (Ảnh 2 - /library dashboard)
   ===================================================================== */
html.dark .hw-library-quest-list>div[class*="hw-bg-white"] {
  background-color: #131b2e !important;
  border-color: #1e293b !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-800"] {
  color: #f1f5f9 !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-500"] {
  color: #94a3b8 !important;
}

html.dark .hw-library-quest-list [class*="hw-text-slate-700"] {
  color: #cbd5e1 !important;
}

/* Quest icon circle */
html.dark .hw-library-quest-list [class*="hw-bg-amber-50"] {
  background-color: rgba(245, 158, 11, 0.15) !important;
}

/* Quest button unclaimed/inactive state */
html.dark .hw-library-quest-list button[class*="hw-bg-slate-100"] {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

/* Quest button claimed state */
html.dark .hw-library-quest-list button[class*="hw-bg-emerald-50"] {
  background-color: rgba(5, 150, 105, 0.15) !important;
  border-color: rgba(5, 150, 105, 0.3) !important;
  color: #34d399 !important;
}

.hw-library-quest-track {
  background-color: #e2e8f0;
  transition: background-color 0.2s ease;
}

html.dark .hw-library-quest-track,
html[data-theme="dark"] .hw-library-quest-track,
.dark .hw-library-quest-track {
  background-color: #1e293b !important;
}

.hw-library-quest-progress {
  background: linear-gradient(90deg, #f59e0b 0%, #8b5cf6 100%);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
  min-width: 0;
}

/* Library card kicker text */
html.dark .hw-library-card-kicker {
  color: #818cf8 !important;
}

/* Library reward pill */
html.dark .hw-library-reward-pill {
  color: #fbbf24 !important;
}

/* Library card heading text */
html.dark .hw-library-card-heading h3 {
  color: #f8fafc !important;
}

/* Library section kicker */
html.dark .hw-library-section-kicker {
  color: #818cf8 !important;
}

/* Library text link */
html.dark .hw-library-text-link {
  color: #818cf8 !important;
}

/* =====================================================================
   DARK MODE: LIBRARY SHORTCUT ICONS (Ảnh 3 - icon backgrounds)
   ===================================================================== */
html.dark .hw-library-shortcut-icon {
  background: rgba(255, 255, 255, 0.06) !important;
}

html.dark .hw-library-shortcut-tag {
  background: rgba(255, 255, 255, 0.08) !important;
}

html.dark .hw-library-shortcut-arrow {
  color: #475569 !important;
}

/* The ::after circle decoration in dark mode */
html.dark .hw-library-shortcut::after {
  background: rgba(255, 255, 255, 0.03) !important;
  opacity: 0.5 !important;
}

/* =====================================================================
   DARK MODE: LIBRARY WEAKER WORDS SECTION
   ===================================================================== */
html.dark .hw-weaker-list-smart li {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .hw-weaker-practice-pill {
  background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35) !important;
}

/* =====================================================================
   DARK MODE: FLASHCARD TOOLBAR (Ảnh 5 - /practice)
   ===================================================================== */
html.dark #view-review .hw-flashcard-toolbar {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

html.dark #view-review .hw-flashcard-tool,
html.dark #view-review .hw-flashcard-nav-button,
html.dark #view-review .hw-flashcard-bookmark {
  background: #131b2e !important;
  border-color: #1e293b !important;
  color: #94a3b8 !important;
}

html.dark #view-review .hw-flashcard-tool:hover,
html.dark #view-review .hw-flashcard-nav-button:hover,
html.dark #view-review .hw-flashcard-bookmark:hover {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* Flashcard navigation */
html.dark #view-review .hw-flashcard-navigation {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

/* Flashcard position indicator */
html.dark #view-review .hw-flashcard-position {
  color: #94a3b8 !important;
}

/* ============================================================
   V2 ROUND 2: REAL-TIME DYNAMIC WIDGETS & OPTIMIZED NAV LAYOUT
   ============================================================ */

/* Live pulse dot animation */
@keyframes v2PulseDot {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.4);
    opacity: 0.5;
  }
}

.v2-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: v2PulseDot 1.4s infinite ease-in-out;
}

.v2-live-pulse-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #dc2626;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html.dark .v2-live-pulse-badge {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Real-time Banner Card */
.v2-realtime-banner {
  background: linear-gradient(135deg, rgba(238, 242, 255, 0.85) 0%, rgba(224, 242, 254, 0.85) 100%);
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px -2px rgba(99, 102, 241, 0.12);
}

html.dark .v2-realtime-banner {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.5) 0%, rgba(12, 74, 110, 0.4) 100%);
  border-color: #3730a3;
  box-shadow: 0 4px 14px -3px rgba(0, 0, 0, 0.45);
}

/* Real-time badge in question list */
.v2-realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #0891b2;
  white-space: nowrap;
}

html.dark .v2-realtime-badge {
  background: rgba(8, 145, 178, 0.18);
  border-color: rgba(34, 211, 238, 0.35);
  color: #67e8f9;
}

/* Smart Category Navigation Group Tabs */
.v2-cat-group-pill {
  padding: 4px 11px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.v2-cat-group-pill:hover {
  transform: translateY(-1px);
}

.v2-cat-group-pill.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4338ca;
  box-shadow: 0 2px 6px -1px rgba(79, 70, 229, 0.4);
}

.v2-cat-group-pill:not(.active) {
  background: #f1f5f9;
  color: #64748b;
  border-color: #e2e8f0;
}

html.dark .v2-cat-group-pill.active {
  background: #6366f1;
  color: #ffffff;
  border-color: #818cf8;
  box-shadow: 0 2px 8px -1px rgba(99, 102, 241, 0.5);
}

html.dark .v2-cat-group-pill:not(.active) {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

/* Category item compact modern card */
.v2-cat-card-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
}

.v2-cat-card-item:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  transform: translateY(-1px);
}

.v2-cat-card-item.active {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  border-color: #6366f1;
  color: #ffffff;
  box-shadow: 0 3px 10px -2px rgba(79, 70, 229, 0.45);
}

html.dark .v2-cat-card-item {
  background: #131b2e;
  border-color: #1e293b;
  color: #cbd5e1;
}

html.dark .v2-cat-card-item:hover {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

html.dark .v2-cat-card-item.active {
  background: linear-gradient(135deg, #4f46e5 0%, #312e81 100%);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.5);
}

/* Facebook-Style Post & Comment Options Dropdown Menus (Ảnh 1 & Ảnh 2) */
.fb-post-menu-dropdown,
.fb-comment-menu-dropdown {
  z-index: 50 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.15) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  backdrop-filter: blur(12px) !important;
  animation: fbMenuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes fbMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Touch-optimized button targets for mobile (Android / iOS / WebApp) */
[data-post-menu-btn],
[data-comment-menu-btn] {
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

[data-post-menu-btn] i,
[data-comment-menu-btn] i {
  pointer-events: none !important;
}

html.dark .fb-comment-menu-dropdown,
html.dark .fb-post-menu-dropdown {
  background-color: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

html.dark .fb-comment-menu-dropdown button,
html.dark .fb-post-menu-dropdown button {
  color: #e2e8f0 !important;
}

html.dark .fb-comment-menu-dropdown button:hover,
html.dark .fb-post-menu-dropdown button:hover {
  background-color: rgba(51, 65, 85, 0.7) !important;
}

/* Branching Threaded Comments & Branch Curves (Ảnh 1 & Ảnh 2 chuẩn Facebook) */
.fb-comment-thread {
  position: relative;
}

.fb-comment-replies-wrapper {
  position: relative;
  transition: all 0.25s ease;
}

.fb-branch-curve {
  position: absolute;
  border-bottom-left-radius: 12px;
  pointer-events: none;
}

/* Elegant Comment Like Button & Reaction Badge (Ảnh 1 & Ảnh 2) */
.fb-cmt-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.fb-cmt-like-btn i {
  font-size: 11px;
  pointer-events: none;
  transition: transform 0.15s ease;
}

.fb-cmt-like-btn:hover i {
  transform: scale(1.15);
}

.fb-cmt-like-btn.is-liked i {
  color: #1877f2 !important;
}

.fb-cmt-reaction-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3.5px !important;
  padding: 0 !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
  transition: transform 0.15s ease;
}

.fb-cmt-reaction-badge svg {
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.fb-cmt-reaction-badge:hover {
  transform: scale(1.1);
  background-color: transparent !important;
}

html.dark .fb-cmt-reaction-badge {
  background-color: transparent !important;
  border: none !important;
}

html.dark .fb-cmt-reaction-badge:hover {
  background-color: transparent !important;
}

/* Nested Reply Composer Box */
.fb-reply-box {
  animation: fbReplyFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fbReplyFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Social Toast Notification (Ảnh 2) */
#fb-social-toast {
  position: fixed !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translate(-50%, 0);
  background-color: #0f172a !important;
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: #ffffff !important;
  padding: 8px 18px !important;
  border-radius: 9999px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  z-index: 99999 !important;
  transition: opacity 0.25s ease, transform 0.25s ease !important;
  pointer-events: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  white-space: nowrap !important;
}

html.dark #fb-social-toast {
  background-color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.95) !important;
  color: #0f172a !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Cover Drag Guide Banner (Ảnh 1) */
#fb-cover-drag-guide {
  position: absolute !important;
  top: 12px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background-color: #0f172a !important;
  background-color: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 5px 14px !important;
  border-radius: 9999px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35) !important;
  pointer-events: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: opacity 0.2s ease !important;
  z-index: 30 !important;
  white-space: nowrap !important;
}

/* Reaction Badge on Avatar in Likes Modal (Ảnh 4) */
.fb-modal-reaction-badge {
  background-color: #1877f2 !important;
  color: #ffffff !important;
  width: 16px !important;
  height: 16px !important;
  border-radius: 9999px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 0 0 1.5px #ffffff !important;
}

html.dark .fb-modal-reaction-badge {
  box-shadow: 0 0 0 1.5px #0f172a !important;
}

.fb-modal-reaction-badge i {
  color: #ffffff !important;
  font-size: 8px !important;
  line-height: 1 !important;
}

/* ===== PVP MODERN CHALLENGE & QUIZ THEME (DARK & LIGHT) ===== */
.pvp-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  transform: none !important;
  margin: 0 !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

html.dark .pvp-challenge-card,
html.dark .pvp-quiz-dialog {
  background: var(--game-surface, #0f172a) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75), 0 0 25px rgba(56, 189, 248, 0.15) !important;
  color: #f8fafc !important;
}

html:not(.dark) .pvp-challenge-card,
html.light .pvp-challenge-card,
html:not(.dark) .pvp-quiz-dialog,
html.light .pvp-quiz-dialog {
  background: #ffffff !important;
  border: 1px solid var(--game-border, #e2e8f0) !important;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}

/* PVP Quiz Result & Dialog Theme System */
html.dark .pvp-res-header,
html[data-theme="dark"] .pvp-res-header,
body.dark .pvp-res-header {
  background: rgba(0, 0, 0, 0.35) !important;
  border-bottom: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  color: var(--game-text, #f8fafc) !important;
}

html.light .pvp-res-header,
html[data-theme="light"] .pvp-res-header,
html:not(.dark):not([data-theme="dark"]) .pvp-res-header {
  background: var(--game-surface-raised, #f8fafc) !important;
  border-bottom: 1px solid var(--game-border, #e2e8f0) !important;
  color: var(--game-text, #0f172a) !important;
}

html.dark .pvp-res-summary-box,
html[data-theme="dark"] .pvp-res-summary-box,
body.dark .pvp-res-summary-box {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  color: #f1f5f9 !important;
}

html.light .pvp-res-summary-box,
html[data-theme="light"] .pvp-res-summary-box,
html:not(.dark):not([data-theme="dark"]) .pvp-res-summary-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

html.dark .pvp-res-q-card,
html[data-theme="dark"] .pvp-res-q-card,
body.dark .pvp-res-q-card {
  background: rgba(125, 125, 125, 0.08) !important;
  border: 1px solid rgba(125, 125, 125, 0.15) !important;
}

html.light .pvp-res-q-card,
html[data-theme="light"] .pvp-res-q-card,
html:not(.dark):not([data-theme="dark"]) .pvp-res-q-card {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

html.dark .pvp-res-q-text,
html[data-theme="dark"] .pvp-res-q-text,
body.dark .pvp-res-q-text {
  color: #f0e6d2 !important;
}

html.light .pvp-res-q-text,
html[data-theme="light"] .pvp-res-q-text,
html:not(.dark):not([data-theme="dark"]) .pvp-res-q-text {
  color: #0f172a !important;
}

html.dark .pvp-res-q-vi,
html[data-theme="dark"] .pvp-res-q-vi,
body.dark .pvp-res-q-vi {
  color: #c8aa6e !important;
}

html.light .pvp-res-q-vi,
html[data-theme="light"] .pvp-res-q-vi,
html:not(.dark):not([data-theme="dark"]) .pvp-res-q-vi {
  color: #b45309 !important;
}

html.dark .pvp-audio-replay-btn,
html[data-theme="dark"] .pvp-audio-replay-btn,
body.dark .pvp-audio-replay-btn {
  background: var(--game-surface-raised, rgba(99, 102, 241, 0.15)) !important;
  border: 1px solid var(--game-primary, #6366f1) !important;
  color: var(--game-primary, #6366f1) !important;
}

html.light .pvp-audio-replay-btn,
html[data-theme="light"] .pvp-audio-replay-btn,
html:not(.dark):not([data-theme="dark"]) .pvp-audio-replay-btn {
  background: var(--game-surface-raised, #e0e7ff) !important;
  border: 1px solid var(--game-primary, #6366f1) !important;
  color: var(--game-primary, #4338ca) !important;
}

html.dark .quiz-q-img,
html[data-theme="dark"] .quiz-q-img,
body.dark .quiz-q-img {
  background: #0a0a0c !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
}

html.light .quiz-q-img,
html[data-theme="light"] .quiz-q-img,
html:not(.dark):not([data-theme="dark"]) .quiz-q-img {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

html.dark .pvp-res-ans-box,
html[data-theme="dark"] .pvp-res-ans-box,
body.dark .pvp-res-ans-box {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  color: #f1f5f9 !important;
}

html.light .pvp-res-ans-box,
html[data-theme="light"] .pvp-res-ans-box,
html:not(.dark):not([data-theme="dark"]) .pvp-res-ans-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

html.dark .pvp-res-explain-box,
html[data-theme="dark"] .pvp-res-explain-box,
body.dark .pvp-res-explain-box {
  background: var(--game-surface-raised, rgba(255, 255, 255, 0.04)) !important;
  border-left: 3.5px solid var(--game-primary, #6366f1) !important;
  border-top: 1px solid var(--game-border, rgba(255, 255, 255, 0.08)) !important;
  border-right: 1px solid var(--game-border, rgba(255, 255, 255, 0.08)) !important;
  border-bottom: 1px solid var(--game-border, rgba(255, 255, 255, 0.08)) !important;
  color: var(--game-text, #e2e8f0) !important;
}

html.light .pvp-res-explain-box,
html[data-theme="light"] .pvp-res-explain-box,
html:not(.dark):not([data-theme="dark"]) .pvp-res-explain-box {
  background: #fffbeb !important;
  border-left: 4px solid #d97706 !important;
  border-top: 1px solid #fde68a !important;
  border-right: 1px solid #fde68a !important;
  border-bottom: 1px solid #fde68a !important;
  color: #1e293b !important;
}

html.dark .pvp-res-explain-title,
html[data-theme="dark"] .pvp-res-explain-title,
body.dark .pvp-res-explain-title {
  color: #c8aa6e !important;
}

html.light .pvp-res-explain-title,
html:not(.dark) .pvp-res-explain-title {
  color: #b45309 !important;
}

html:not(.dark) .pvp-challenge-card .pvp-header-title,
html.light .pvp-challenge-card .pvp-header-title {
  color: #0f172a !important;
}

html:not(.dark) .pvp-challenge-card .pvp-header-sub,
html.light .pvp-challenge-card .pvp-header-sub {
  color: #475569 !important;
}

html:not(.dark) .pvp-challenge-card .pvp-close-btn,
html.light .pvp-challenge-card .pvp-close-btn {
  color: #64748b !important;
  border-radius: 8px !important;
}

html:not(.dark) .pvp-challenge-card .pvp-close-btn:hover,
html.light .pvp-challenge-card .pvp-close-btn:hover {
  color: #0f172a !important;
  background: #f1f5f9 !important;
}

html:not(.dark) .pvp-challenge-card .pvp-footer,
html.light .pvp-challenge-card .pvp-footer {
  border-top: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

html:not(.dark) .pvp-challenge-card .pvp-reward-highlight,
html.light .pvp-challenge-card .pvp-reward-highlight {
  color: #0284c7 !important;
}

.pvp-scope-container {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 9999px;
  margin-bottom: 14px;
}

html.dark .pvp-scope-container {
  background: #1e293b;
  border: 1px solid #334155;
}

html:not(.dark) .pvp-scope-container {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}

.pvp-scope-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

html.dark .pvp-scope-btn {
  color: #94a3b8;
  background: transparent;
}

html:not(.dark) .pvp-scope-btn {
  color: #64748b;
  background: transparent;
}

.pvp-scope-btn.active {
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pvp-scope-btn.active.scope-eps {
  background: linear-gradient(135deg, #059669, #10b981) !important;
}

.pvp-scope-btn.active.scope-topik {
  background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
}

.pvp-scope-btn.active.scope-both {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
}

.pvp-cat-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  box-sizing: border-box;
}

html.dark .pvp-cat-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
}

html.dark .pvp-cat-btn:hover {
  background: #273549;
  border-color: #64748b;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

html:not(.dark) .pvp-cat-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

html:not(.dark) .pvp-cat-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1.5px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.pvp-v2-container {
  max-height: 240px;
  overflow-y: auto;
  border-radius: 12px;
  padding: 8px;
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (max-width: 480px) {
  .pvp-v2-container {
    grid-template-columns: 1fr;
  }
}

html.dark .pvp-v2-container {
  background: #090e17;
  border: 1px solid #1e293b;
}

html:not(.dark) .pvp-v2-container {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.pvp-v2-sub-btn {
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

html.dark .pvp-v2-sub-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
}

html.dark .pvp-v2-sub-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #a855f7;
  transform: translateY(-1px);
}

html:not(.dark) .pvp-v2-sub-btn {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html:not(.dark) .pvp-v2-sub-btn:hover {
  background: #f1f5f9;
  border-color: #8b5cf6;
  transform: translateY(-1px);
}

/* ==========================================================================
   [UPGRADE 2026] MODERN PVP QUIZ RESULT & BATTLE REPORT SYSTEM
   Full Dark/Light Adaptive, High Contrast, Anti-Muddiness, Crisp SVG Icons
   ========================================================================== */

#pvp-persistent-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.72) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  pointer-events: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

#quiz-pvp-modal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  transform: none !important;
  margin: 0 !important;
  z-index: 2147483647 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  pointer-events: auto !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.pvp-quiz-dialog,
.pvp-br-dialog {
  width: min(450px, 94vw);
  max-height: min(90vh, 740px);
  max-height: calc(100dvh - 32px);
  margin: auto !important;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  animation: pvpModalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.pvp-quiz-dialog > div:nth-child(2),
.pvp-br-dialog > div:nth-child(2) {
  min-height: 0 !important;
}

@keyframes pvpModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- DARK MODE --- */
/* --- DARK MODE --- */
html.dark .pvp-quiz-dialog,
html.dark .pvp-br-dialog,
html[data-theme="dark"] .pvp-quiz-dialog,
html[data-theme="dark"] .pvp-br-dialog,
body.dark .pvp-quiz-dialog,
body.dark .pvp-br-dialog {
  background: var(--game-surface, #0f131a) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  color: var(--game-text, #f1f5f9) !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05) !important;
}

html.dark .pvp-card-header,
html[data-theme="dark"] .pvp-card-header,
body.dark .pvp-card-header {
  background: rgba(0, 0, 0, 0.35) !important;
  border-bottom: 1px solid var(--game-border, rgba(255, 255, 255, 0.12)) !important;
  color: var(--game-text, #f8fafc) !important;
}

html.dark .pvp-res-hero,
html[data-theme="dark"] .pvp-res-hero,
body.dark .pvp-res-hero {
  background: rgba(255, 255, 255, 0.035) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

html.dark .pvp-res-qbox,
html[data-theme="dark"] .pvp-res-qbox,
body.dark .pvp-res-qbox {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.1)) !important;
}

html.dark .pvp-res-qtext,
html[data-theme="dark"] .pvp-res-qtext,
body.dark .pvp-res-qtext {
  color: #f8fafc !important;
}

html.dark .pvp-res-trans,
html[data-theme="dark"] .pvp-res-trans,
body.dark .pvp-res-trans {
  background: var(--game-surface-raised, rgba(255, 255, 255, 0.05)) !important;
  border-left: 3px solid var(--game-primary, #6366f1) !important;
  color: var(--game-text, #f8fafc) !important;
}

html.dark .pvp-res-explain,
html[data-theme="dark"] .pvp-res-explain,
body.dark .pvp-res-explain {
  background: rgba(30, 41, 59, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

html.dark .pvp-res-ansbox,
html[data-theme="dark"] .pvp-res-ansbox,
body.dark .pvp-res-ansbox {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
}

html.dark .pvp-br-row,
html[data-theme="dark"] .pvp-br-row,
body.dark .pvp-br-row {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.1)) !important;
  color: #e2e8f0 !important;
}

html.dark .pvp-br-row:hover,
html[data-theme="dark"] .pvp-br-row:hover,
body.dark .pvp-br-row:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--game-primary, #6366f1) !important;
}

html.dark .pvp-footer-bar,
html[data-theme="dark"] .pvp-footer-bar,
body.dark .pvp-footer-bar {
  background: rgba(0, 0, 0, 0.3) !important;
  border-top: 1px solid var(--game-border, rgba(255, 255, 255, 0.1)) !important;
}

html.dark .pvp-close-btn,
html[data-theme="dark"] .pvp-close-btn,
body.dark .pvp-close-btn {
  color: rgba(255, 255, 255, 0.5) !important;
}

html.dark .pvp-close-btn:hover,
html[data-theme="dark"] .pvp-close-btn:hover,
body.dark .pvp-close-btn:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

/* --- LIGHT MODE (PRISTINE, HIGH CONTRAST, ZERO MUDDY GRAYS) --- */
html.light .pvp-quiz-dialog,
html.light .pvp-br-dialog,
html:not(.dark) .pvp-quiz-dialog,
html:not(.dark) .pvp-br-dialog {
  background: #ffffff !important;
  border: 1.5px solid rgba(180, 140, 70, 0.4) !important;
  color: #0f172a !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
}

html.light .pvp-card-header,
html:not(.dark) .pvp-card-header {
  background: linear-gradient(180deg, #fdfaf3 0%, #f7f1e5 100%) !important;
  border-bottom: 1.5px solid rgba(180, 140, 70, 0.3) !important;
  color: #854d0e !important;
}

html.light .pvp-res-hero,
html:not(.dark) .pvp-res-hero {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

html.light .pvp-res-qbox,
html:not(.dark) .pvp-res-qbox {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

html.light .pvp-res-qtext,
html:not(.dark) .pvp-res-qtext {
  color: #0f172a !important;
  /* CRITICAL: High contrast bold text, absolutely no invisible white/cream */
}

html.light .pvp-res-trans,
html:not(.dark) .pvp-res-trans {
  background: #fefce8 !important;
  border-left: 3px solid #d97706 !important;
  color: #78350f !important;
}

html.light .pvp-res-explain,
html:not(.dark) .pvp-res-explain {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  /* High contrast slate for complete readability */
}

html.light .pvp-res-ansbox,
html:not(.dark) .pvp-res-ansbox {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
}

html.light .pvp-br-row,
html:not(.dark) .pvp-br-row {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03) !important;
}

html.light .pvp-br-row:hover,
html:not(.dark) .pvp-br-row:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html.light .pvp-footer-bar,
html:not(.dark) .pvp-footer-bar {
  background: #f8fafc !important;
  border-top: 1.5px solid rgba(180, 140, 70, 0.25) !important;
}

html.light .pvp-close-btn,
html:not(.dark) .pvp-close-btn {
  color: #64748b !important;
}

html.light .pvp-close-btn:hover,
html:not(.dark) .pvp-close-btn:hover {
  color: #0f172a !important;
  background: rgba(0, 0, 0, 0.06) !important;
}

/* --- BUTTON & VECTOR UTILITIES --- */
.pvp-btn-gold {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  padding: 10px 32px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.pvp-btn-gold:hover {
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45) !important;
  filter: brightness(1.08) !important;
}

.pvp-btn-gold:active {
  transform: translateY(1px) scale(0.99) !important;
}

/* --- QUESTION BOX & AUDIO BUTTON (LIGHT & DARK THEMES) --- */
.quiz-q-box {
  border-radius: 16px !important;
  padding: 16px !important;
  margin-bottom: 16px !important;
  transition: all 0.25s ease !important;
}

html.light .quiz-q-box,
html:not(.dark) .quiz-q-box {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

html.dark .quiz-q-box,
html[data-theme="dark"] .quiz-q-box,
body.dark .quiz-q-box {
  background: rgba(255, 255, 255, 0.035) !important;
  border: 1px solid var(--game-border, rgba(255, 255, 255, 0.1)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* NÚT NGHE LẠI ÂM THANH: ĐẸP, RỰC RỠ, CHUYÊN NGHIỆP TRÊN CẢ 2 NỀN */
.pvp-btn-audio {
  padding: 10px 24px !important;
  border-radius: 9999px !important;
  font-size: 13.5px !important;
  font-weight: 750 !important;
  letter-spacing: 0.3px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Giao diện Sáng (Light Theme): Nền vàng hổ phách ấm áp, viền sắc nét, chữ nâu đậm tương phản hoàn hảo */
html.light .pvp-btn-audio,
html[data-theme="light"] .pvp-btn-audio,
html:not(.dark):not([data-theme="dark"]) .pvp-btn-audio {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
  border: 1.5px solid #d97706 !important;
  color: #92400e !important;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

html.light .pvp-btn-audio svg,
html[data-theme="light"] .pvp-btn-audio svg,
html:not(.dark):not([data-theme="dark"]) .pvp-btn-audio svg {
  color: #d97706 !important;
}

html.light .pvp-btn-audio:hover,
html[data-theme="light"] .pvp-btn-audio:hover,
html:not(.dark):not([data-theme="dark"]) .pvp-btn-audio:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  border-color: #b45309 !important;
  color: #78350f !important;
  transform: translateY(-1px) scale(1.03) !important;
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.28) !important;
}

html.light .pvp-btn-audio:active,
html[data-theme="light"] .pvp-btn-audio:active,
html:not(.dark):not([data-theme="dark"]) .pvp-btn-audio:active {
  transform: translateY(1px) scale(0.98) !important;
  box-shadow: 0 2px 5px rgba(217, 119, 6, 0.15) !important;
}

/* Giao diện Tối (Dark Theme): Nền kính hoàng kim phát sáng lung linh, chữ vàng ngọc nổi bật */
html.dark .pvp-btn-audio,
html[data-theme="dark"] .pvp-btn-audio,
body.dark .pvp-btn-audio {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.22) 0%, rgba(180, 83, 9, 0.38) 100%) !important;
  border: 1.5px solid rgba(245, 158, 11, 0.65) !important;
  color: #fde68a !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 12px rgba(245, 158, 11, 0.2) !important;
}

html.dark .pvp-btn-audio svg,
html[data-theme="dark"] .pvp-btn-audio svg,
body.dark .pvp-btn-audio svg {
  color: #fbbf24 !important;
}

html.dark .pvp-btn-audio:hover,
html[data-theme="dark"] .pvp-btn-audio:hover,
body.dark .pvp-btn-audio:hover {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.35) 0%, rgba(180, 83, 9, 0.52) 100%) !important;
  border-color: #fbbf24 !important;
  color: #ffffff !important;
  transform: translateY(-1px) scale(1.03) !important;
  box-shadow: 0 6px 22px rgba(245, 158, 11, 0.35), 0 0 16px rgba(245, 158, 11, 0.3) !important;
}

html.dark .pvp-btn-audio:active,
html[data-theme="dark"] .pvp-btn-audio:active,
body.dark .pvp-btn-audio:active {
  transform: translateY(1px) scale(0.98) !important;
}

/* Đảm bảo hiển thị chữ chạy trên Web App PWA / Webmanifest (iOS Standalone & Android PWA) */
@media all and (display-mode: standalone) {
  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar .top-right {
    display: flex !important;
    flex: 1 1 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  body #hw-app-layout #unified-hud-wrapper .rpg-top-bar #season-msg {
    display: block !important;
    width: 100% !important;
  }
}

.pvp-svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   ROUND 2 DICTATION / LISTEN & TYPE ANSWER STYLES (ĐẤU TRÍ VÒNG 2)
   ========================================================================== */

/* Bố cục tối ưu cho Phòng Đấu Trí khi đang thi Nghe & Gõ Vòng 2 */
#pvp-live-room.v2-dictation-active #live-room-slots-container,
#pvp-live-room:has(.v2-dictation-wrapper) #live-room-slots-container {
  display: none !important;
  /* Ẩn hàng ghế 8 slot để dành không gian cho đề thi + chat */
}

#pvp-live-room.v2-dictation-active #live-room-quiz-area,
#pvp-live-room:has(.v2-dictation-wrapper) #live-room-quiz-area {
  max-height: 62vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: 4px 6px 12px !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

#pvp-live-room.v2-dictation-active #live-room-quiz-area::-webkit-scrollbar,
#pvp-live-room:has(.v2-dictation-wrapper) #live-room-quiz-area::-webkit-scrollbar {
  width: 6px;
}

#pvp-live-room.v2-dictation-active #live-room-quiz-area::-webkit-scrollbar-thumb,
#pvp-live-room:has(.v2-dictation-wrapper) #live-room-quiz-area::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 4px;
}

.group-quiz-switch-dictation {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #fff !important;
  border: 1px solid #10b981 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.group-quiz-switch-dictation:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border-color: #34d399 !important;
  transform: translateY(-1px);
}

.group-quiz-toolbar-dictation {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.45), rgba(15, 23, 42, 0.85)) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

/* Nút Chọn câu trên thanh công cụ Gõ V2 */
.group-quiz-dict-pick-btn {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #fff !important;
  border: 1px solid #34d399 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
  font-weight: 800 !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  position: relative !important;
  flex-shrink: 0 !important;
  touch-action: manipulation !important;
}

.group-quiz-dict-pick-btn:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5) !important;
  transform: translateY(-1px);
}

.group-quiz-dict-pick-btn:active {
  transform: translateY(0);
}

#group-quiz-dict-pick-badge {
  background: #f59e0b !important;
  color: #000 !important;
  font-weight: 900 !important;
  font-size: 10px !important;
  border-radius: 10px !important;
  padding: 1px 6px !important;
  margin-left: 2px !important;
}

/* Huy hiệu số thứ tự câu gốc trong bài thi */
.v2-dict-orig-badge {
  display: inline-block;
  font-size: 11px;
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 5px;
  font-weight: 800;
  vertical-align: middle;
}

/* ==========================================================================
   MODAL CHỌN CÂU HỎI NGHE & GÕ V2 (SMART QUESTION PICKER MODAL)
   ========================================================================== */
.v2-dict-picker-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  animation: v2FadeIn 0.2s ease-out;
}

@keyframes v2FadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes v2ModalPop {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.v2-dict-picker-modal-card {
  width: 96%;
  max-width: 820px;
  height: 94vh;
  max-height: min(94vh, calc(100dvh - 16px));
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 18px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(16, 185, 129, 0.2);
  overflow: hidden;
  animation: v2ModalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f1f5f9;
  font-family: inherit;
  margin: auto;
}

/* Header */
.v2-dict-picker-header {
  padding: 10px 16px;
  background: linear-gradient(135deg, #131f37, #0f172a);
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.v2-dict-picker-header-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.v2-dict-picker-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.v2-dict-picker-title-group {
  min-width: 0;
}

.v2-dict-picker-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-dict-picker-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-dict-picker-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.v2-dict-picker-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

/* Tabs */
.v2-dict-picker-tabs {
  display: flex;
  gap: 8px;
  padding: 6px 14px;
  background: #0b1120;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.v2-dict-picker-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12px;
  transition: all 0.2s ease;
  touch-action: manipulation;
  min-width: 0;
}

.v2-dict-tab-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-dict-picker-tab:hover {
  background: #253349;
  color: #fff;
}

.v2-dict-picker-tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(6, 78, 59, 0.45));
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.v2-dict-picker-tab-badge {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  flex-shrink: 0;
  margin-left: 6px;
}

.v2-dict-picker-tab.active .v2-dict-picker-tab-badge {
  background: #10b981;
  color: #000;
}

/* Unified Scrollable Body */
.v2-dict-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  background: #090e1a;
}

.v2-dict-picker-body::-webkit-scrollbar {
  width: 6px;
}

.v2-dict-picker-body::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* Toolbar search & filters */
.v2-dict-picker-toolbar {
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}

.v2-dict-picker-search-wrap {
  position: relative;
  width: 100%;
}

.v2-dict-picker-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 12px;
  pointer-events: none;
}

.v2-dict-picker-search-input {
  width: 100%;
  box-sizing: border-box;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #fff;
  padding: 6px 28px 6px 28px;
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.v2-dict-picker-search-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
  background: #1a2538;
}

.v2-dict-picker-clear-search {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  padding: 3px;
}

.v2-dict-picker-filter-pills {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.v2-dict-pill-btn {
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  transition: all 0.15s ease;
  touch-action: manipulation;
  white-space: nowrap;
  flex-shrink: 0;
}

.v2-dict-pill-btn:hover {
  background: #253349;
  color: #fff;
}

.v2-dict-pill-btn.active {
  background: #10b981;
  color: #fff;
  border-color: #34d399;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Control Bar: View Switcher + Range & Presets */
.v2-dict-picker-control-bar {
  padding: 8px 14px;
  background: #0b1120;
  border-bottom: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.v2-dict-view-switcher {
  display: flex;
  background: #131d2e;
  border: 1px solid #24344d;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.v2-dict-view-btn {
  flex: 1;
  text-align: center;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.v2-dict-view-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.v2-dict-view-btn.active {
  background: #059669;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 1px 6px rgba(5, 150, 105, 0.4);
}

/* Range & Presets */
.v2-dict-picker-range-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.v2-dict-picker-range-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
}

.v2-dict-range-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
}

.v2-dict-range-num {
  width: 44px;
  text-align: center;
  background: #1e293b;
  border: 1px solid #334155;
  color: #fff;
  font-weight: 800;
  border-radius: 6px;
  padding: 2px 4px;
  font-size: 11.5px;
}

.v2-dict-range-dash {
  color: #64748b;
  font-weight: 800;
}

.v2-dict-range-apply-btn {
  background: #059669;
  color: #fff;
  border: 1px solid #10b981;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.v2-dict-range-apply-btn:hover {
  background: #10b981;
}

.v2-dict-picker-presets {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.v2-dict-preset-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.v2-dict-preset-btn:hover {
  background: #253349;
  color: #fff;
  border-color: #10b981;
}

.v2-dict-preset-btn.is-action {
  background: rgba(255, 255, 255, 0.06);
}

.v2-dict-preset-btn.is-edited-btn {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.v2-dict-preset-btn.is-edited-btn:hover {
  background: #f59e0b;
  color: #000;
}

/* Number Grid Matrix Section */
.v2-dict-picker-matrix-section {
  display: flex;
  flex-direction: column;
  background: #090e1a;
  border-bottom: 1px solid #1e293b;
}

.v2-dict-picker-matrix-header {
  padding: 7px 14px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.v2-dict-matrix-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.v2-dict-matrix-title {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-dict-matrix-tip {
  font-size: 10px;
  color: #64748b;
  font-style: italic;
}

.v2-dict-matrix-toggle-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.v2-dict-matrix-toggle-btn:hover {
  background: #253349;
  color: #7dd3fc;
}

.v2-dict-picker-chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 5px;
  padding: 6px 14px 12px;
  background: #090e1a;
  box-sizing: border-box;
}

.v2-dict-picker-chips-grid.is-collapsed {
  display: none !important;
}

.v2-dict-chip {
  height: 32px;
  border-radius: 7px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.v2-dict-chip:hover {
  border-color: #10b981;
  color: #fff;
  transform: scale(1.05);
}

.v2-dict-chip.is-selected {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #34d399;
  color: #fff;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.v2-dict-chip.is-edited .v2-dict-chip-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  font-size: 8px;
}

/* Question Cards Section */
.v2-dict-picker-cards-section {
  display: flex;
  flex-direction: column;
  background: #0f172a;
}

.v2-dict-picker-cards-header {
  padding: 8px 14px 4px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v2-dict-cards-title {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.v2-dict-picker-cards-container {
  padding: 6px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #0f172a;
  box-sizing: border-box;
}

.v2-dict-card-item {
  background: #1a2436;
  border: 1px solid #29384d;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: all 0.2s ease;
}

.v2-dict-card-item:hover {
  border-color: #38bdf8;
  background: #1e2b40;
}

.v2-dict-card-item.is-selected {
  border-color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1), rgba(26, 36, 54, 0.95));
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
}

.v2-dict-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.v2-dict-card-select-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
}

.v2-dict-card-checkbox {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: #10b981;
}

.v2-dict-card-idx-badge {
  font-size: 12px;
  font-weight: 900;
  color: #f1f5f9;
}

.v2-dict-card-badges {
  display: flex;
  gap: 5px;
  flex: 1;
}

.v2-dict-badge-edited {
  font-size: 9.5px;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 1px 5px;
  border-radius: 5px;
}

.v2-dict-badge-orig {
  font-size: 9.5px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 1px 5px;
  border-radius: 5px;
}

.v2-dict-card-btn-single {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.v2-dict-card-btn-single:hover {
  background: linear-gradient(135deg, #10b981, #34d399);
  transform: translateY(-1px);
}

.v2-dict-card-btn-edit {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.v2-dict-card-btn-edit:hover {
  background: linear-gradient(135deg, #6366f1, #818cf8);
  transform: translateY(-1px);
}

.v2-edit-q-btn {
  background: rgba(99, 102, 241, 0.2) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(129, 140, 248, 0.4) !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  transition: all 0.15s !important;
}

.v2-edit-q-btn:hover {
  background: rgba(99, 102, 241, 0.4) !important;
  color: #ffffff !important;
  border-color: #818cf8 !important;
}

.v2-dict-card-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  border-radius: 7px;
}

.v2-dict-card-section.is-question {
  background: rgba(15, 23, 42, 0.6);
  border-left: 3px solid #38bdf8;
}

.v2-dict-card-section.is-answer {
  background: rgba(6, 78, 59, 0.2);
  border-left: 3px solid #10b981;
}

.v2-dict-card-sec-label {
  font-size: 9.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
}

.v2-dict-card-text-kr {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.35;
}

.v2-dict-card-text-kr.text-answer {
  color: #34d399;
}

.v2-dict-card-text-vi {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}

.v2-dict-preview-audio-btn {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.v2-dict-preview-audio-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
}

.v2-dict-preview-audio-btn.is-answer-btn {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.v2-dict-preview-audio-btn.is-answer-btn:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
}

.v2-dict-preview-audio-btn.is-previewing {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5) !important;
}

/* Empty State */
.v2-dict-empty-state {
  text-align: center;
  padding: 24px 14px;
  color: #94a3b8;
}

.v2-dict-empty-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.v2-dict-empty-text {
  font-size: 12.5px;
  margin-bottom: 10px;
}

.v2-dict-empty-reset-btn {
  background: #1e293b;
  color: #fff;
  border: 1px solid #334155;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

/* Balanced Sticky Footer */
.v2-dict-picker-footer {
  padding: 8px 14px;
  background: linear-gradient(135deg, #131f37, #0f172a);
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.v2-dict-picker-footer-stats {
  font-size: 11px;
  color: #cbd5e1;
  font-weight: 600;
}

.v2-dict-picker-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.v2-dict-footer-btn {
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.v2-dict-btn-all {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

.v2-dict-btn-all:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.v2-dict-btn-apply {
  flex: 1;
  background: #1e293b;
  border: 1px solid #3b82f6;
  color: #60a5fa;
}

.v2-dict-btn-apply:hover {
  background: #3b82f6;
  color: #fff;
}

.v2-dict-btn-start {
  flex: 1.5;
  background: linear-gradient(135deg, #059669, #10b981);
  border: 1px solid #34d399;
  color: #fff;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4);
}

.v2-dict-btn-start:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.6);
  transform: translateY(-1px);
}

.v2-dict-btn-start:active {
  transform: translateY(0);
}

/* Mobile & Portrait Responsive Adjustments */
@media (max-width: 640px) {
  .v2-dict-picker-modal-card {
    width: 98%;
    height: 96vh;
    max-height: calc(100dvh - 12px);
    border-radius: 14px;
    margin: 6px auto;
  }

  .v2-dict-picker-header,
  .v2-dict-picker-tabs,
  .v2-dict-picker-toolbar,
  .v2-dict-picker-control-bar,
  .v2-dict-picker-matrix-header,
  .v2-dict-picker-chips-grid,
  .v2-dict-picker-cards-header,
  .v2-dict-picker-cards-container,
  .v2-dict-picker-footer {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .v2-dict-picker-filter-pills {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .v2-dict-pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 10px;
    padding: 3px 7px;
  }

  .v2-dict-picker-presets {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .v2-dict-preset-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 10px;
    padding: 3px 6px;
  }

  .v2-dict-picker-chips-grid {
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 3px;
  }

  .v2-dict-chip {
    height: 28px;
    font-size: 10.5px;
  }

  .v2-dict-picker-footer-actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .v2-dict-footer-btn {
    padding: 7px 4px;
    font-size: 10.5px;
    flex: 1 1 calc(50% - 4px);
  }

  .v2-dict-btn-start {
    flex: 1 1 100% !important;
  }
}


.v2-dictation-wrapper {
  max-width: 620px;
  width: 100%;
  margin: 0 auto 10px;
  background: linear-gradient(165deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98)) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  border-radius: 14px !important;
  padding: 10px 12px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 16px rgba(16, 185, 129, 0.1) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  color: #f1f5f9 !important;
  text-align: left !important;
  box-sizing: border-box !important;
}

/* 1. Header Bar */
.v2-dict-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.7);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.v2-dict-cat-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.v2-dict-cat-title {
  font-weight: 700;
  font-size: 12.5px;
  color: #34d399;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-q-counter {
  font-size: 10.5px;
  padding: 1px 7px;
  background: rgba(51, 65, 85, 0.75);
  border-radius: 10px;
  color: #cbd5e1;
  font-weight: 600;
}

.v2-dict-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.v2-badge-edited {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.v2-badge-native {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
}

.v2-dict-timer-box {
  display: flex;
  align-items: center;
  gap: 5px;
}

.v2-dict-timer {
  font-size: 12px;
  font-weight: 700;
  color: #facc15;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.v2-dict-ctrl-btn {
  background: #334155;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10.5px;
  cursor: pointer;
  transition: 0.2s;
}

.v2-dict-ctrl-btn:hover {
  background: #475569;
  color: #fff;
}

.v2-stop-btn {
  background: rgba(220, 38, 38, 0.3);
  border-color: #ef4444;
  color: #fca5a5;
}

.v2-stop-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* 2. Mini Scoreboard */
.v2-dict-scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.v2-dict-sb-item {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 10px;
  white-space: nowrap;
}

.v2-dict-sb-name {
  color: #cbd5e1;
  font-weight: 600;
}

/* 3. Question Prompt Card */
.v2-dict-q-card {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.85));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.v2-dict-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  flex-wrap: wrap;
  gap: 5px;
}

.v2-dict-q-badge {
  font-size: 10px;
  font-weight: 700;
  color: #818cf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-q-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-dict-mask-toggle-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-mask-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  color: #fff;
}

.v2-dict-mini-audio-btn {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 10.5px;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-mini-audio-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #fff;
}

.v2-dict-mini-audio-btn.is-playing {
  background: #6366f1 !important;
  color: #fff !important;
  border-color: #818cf8 !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  animation: v2PulseBtn 1.2s infinite;
}

@keyframes v2PulseBtn {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

/* Question Korean Masking */
.v2-dict-q-korean-wrap {
  cursor: pointer;
  margin-bottom: 4px;
}

.v2-dict-q-kr-masked,
.v2-dict-q-kr-box {
  border-radius: 6px;
  transition: all 0.2s ease;
}

.v2-dict-q-mask-notice,
.v2-dict-mask-hint {
  display: none;
  background: rgba(30, 41, 59, 0.85);
  border: 1px dashed rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.v2-dict-q-mask-notice:hover,
.v2-dict-mask-hint:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #fde047;
}

.v2-dict-q-korean-text,
.v2-dict-q-kr-text {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.35;
  letter-spacing: 0.2px;
}

.v2-dict-q-kr-masked.is-masked .v2-dict-q-mask-notice,
.v2-dict-q-kr-box.is-masked .v2-dict-mask-hint,
.v2-dict-q-kr-masked.is-masked .v2-dict-mask-hint,
.v2-dict-q-kr-box.is-masked .v2-dict-q-mask-notice {
  display: block !important;
}

.v2-dict-q-kr-masked.is-masked .v2-dict-q-korean-text,
.v2-dict-q-kr-box.is-masked .v2-dict-q-kr-text,
.v2-dict-q-kr-masked.is-masked .v2-dict-q-kr-text,
.v2-dict-q-kr-box.is-masked .v2-dict-q-korean-text {
  display: none !important;
}

.v2-dict-tool-btn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-tool-btn.v2-dict-btn-audio {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.v2-dict-q-vietnamese,
.v2-dict-q-vi-box {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.35;
  font-style: italic;
  margin-top: 4px;
}

/* 4. Audio Control Card */
.v2-dict-audio-card {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.35), rgba(15, 23, 42, 0.75));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
}

.v2-dict-audio-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 6px;
  flex-wrap: wrap;
}

.v2-dict-audio-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.v2-dict-play-btn,
.v2-dict-btn-play {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
  transition: 0.15s;
}

.v2-dict-play-btn:hover,
.v2-dict-btn-play:hover {
  background: linear-gradient(135deg, #34d399, #059669);
  transform: translateY(-1px);
}

.v2-dict-play-btn:active,
.v2-dict-btn-play:active {
  transform: translateY(0);
}

.v2-dict-replay-btn,
.v2-dict-btn-replay {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: 0.15s;
}

.v2-dict-replay-btn:hover,
.v2-dict-btn-replay:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #34d399;
}

/* Equalizer animation */
.v2-dict-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 16px;
  padding: 0 2px;
}

.v2-eq-bar {
  width: 3px;
  height: 3px;
  background: #34d399;
  border-radius: 2px;
  transition: height 0.2s ease;
}

.v2-dict-equalizer.is-playing .bar-1,
.v2-dict-equalizer.is-playing span:nth-child(1) {
  animation: v2EqAnim 0.6s ease-in-out infinite alternate;
}

.v2-dict-equalizer.is-playing .bar-2,
.v2-dict-equalizer.is-playing span:nth-child(2) {
  animation: v2EqAnim 0.45s ease-in-out infinite alternate 0.15s;
}

.v2-dict-equalizer.is-playing .bar-3,
.v2-dict-equalizer.is-playing span:nth-child(3) {
  animation: v2EqAnim 0.75s ease-in-out infinite alternate 0.3s;
}

.v2-dict-equalizer.is-playing .bar-4,
.v2-dict-equalizer.is-playing span:nth-child(4) {
  animation: v2EqAnim 0.5s ease-in-out infinite alternate 0.2s;
}

@keyframes v2EqAnim {
  0% {
    height: 3px;
    opacity: 0.5;
  }

  100% {
    height: 16px;
    opacity: 1;
  }
}

.v2-dict-audio-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.v2-dict-speed-selector {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 6px;
  padding: 1px 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-speed-label {
  font-size: 10px;
  color: #94a3b8;
  margin-right: 2px;
}

.v2-dict-speed-btn,
.v2-dict-speed-chip {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
}

.v2-dict-speed-btn:hover,
.v2-dict-speed-chip:hover {
  color: #fff;
}

.v2-dict-speed-btn.active,
.v2-dict-speed-chip.active {
  background: #10b981;
  color: #fff;
  font-weight: 700;
}

.v2-dict-play-count-badge {
  font-size: 10.5px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 5. Tokens Card */
.v2-dict-tokens-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 6px 10px;
}

.v2-dict-tokens-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.v2-dict-tokens-title {
  font-size: 10.5px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-hints-badge {
  font-size: 10px;
  color: #fbbf24;
  font-weight: 600;
}

.v2-hints-badge.is-exhausted {
  color: #ef4444;
}

.v2-dict-hint-first-btn {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  font-size: 10px;
  padding: 2px 6px;
  cursor: pointer;
  transition: 0.15s;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.v2-dict-hint-first-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #fff;
}

.v2-dict-tokens-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.v2-dict-token-chip {
  display: inline-flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.85);
  border: 1px dashed rgba(148, 163, 184, 0.35);
  color: #64748b;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.15s ease;
  user-select: none;
}

.v2-dict-token-chip:hover {
  border-color: #34d399;
  color: #cbd5e1;
  transform: translateY(-1px);
}

.v2-dict-token-chip.revealed {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 78, 59, 0.3));
  border: 1px solid #10b981;
  color: #a7f3d0;
  font-weight: 700;
  cursor: default;
}

.v2-dict-tokens-tip {
  font-size: 10px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 6. Input Area & Live Vietnamese Translation */
.v2-dict-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-dict-input-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v2-dict-input-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.v2-dict-input-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.v2-dict-input-meta {
  font-size: 10px;
  color: #64748b;
}

.v2-dict-clear-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 4px;
  font-size: 10px;
  padding: 1px 5px;
  cursor: pointer;
  transition: 0.15s;
}

.v2-dict-clear-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

.v2-dict-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  border: 1.5px solid rgba(59, 130, 246, 0.35);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 15px;
  /* iOS zoom safe */
  line-height: 1.4;
  font-family: inherit;
  resize: vertical;
  min-height: 52px;
  height: 56px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.v2-dict-textarea:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

/* Live Vietnamese Translation Box */
.v2-dict-trans-box {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(6, 78, 59, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 1px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.v2-dict-trans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.v2-dict-trans-badge {
  font-size: 9.5px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.v2-dict-trans-content {
  font-size: 12.5px;
  line-height: 1.35;
  min-height: 18px;
}

.v2-dict-trans-placeholder {
  color: #64748b;
  font-size: 11px;
  font-style: italic;
}

.v2-dict-trans-match {
  color: #6ee7b7;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.v2-dict-trans-result {
  color: #fde047;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 7. Diff Box */
.v2-dict-diff-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 10px;
  animation: v2DiffFade 0.25s ease-out;
}

@keyframes v2DiffFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.v2-diff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.v2-diff-status-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.v2-status-perfect {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
}

.v2-status-good {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid #f59e0b;
}

.v2-status-needwork {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid #ef4444;
}

.v2-diff-stats {
  display: flex;
  gap: 8px;
  font-size: 10.5px;
  color: #94a3b8;
}

.v2-diff-sentence-box {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 4px;
}

.v2-diff-chip {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.v2-diff-correct {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.v2-diff-wrong {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.v2-diff-expected {
  font-size: 10.5px;
  color: #fde047;
  margin-left: 2px;
  font-style: italic;
}

.v2-diff-missing {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px dashed rgba(245, 158, 11, 0.4);
  font-size: 11px;
}

.v2-diff-desc {
  font-size: 11px;
  line-height: 1.35;
}

/* 8. Action Buttons */
.v2-dict-actions-bar {
  display: flex;
  gap: 8px;
  margin-top: 2px;
  padding-bottom: 4px;
}

.v2-dict-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: 0.15s ease;
  touch-action: manipulation;
  min-height: 38px;
}

.v2-dict-btn-check {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.35);
}

.v2-dict-btn-check:hover {
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  transform: translateY(-1px);
}

.v2-dict-btn-submit {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.35);
}

.v2-dict-btn-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399, #059669);
  transform: translateY(-1px);
}

.v2-dict-btn-submit.v2-submitted,
.v2-dict-btn-submit:disabled {
  background: #334155 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  transform: none !important;
}

/* ==========================================================================
   ĐỒNG BỘ FONT & GIAO DIỆN CHUẨN ĐẸP ĐỀU CHO THANH CÔNG CỤ & DANH SÁCH XỔ XUỐNG
   ========================================================================== */
.group-quiz-toolbar-container select,
.group-quiz-cat-select,
.group-quiz-time-select,
#group-quiz-cat-sel,
#group-quiz-time-sel,
#group-quiz-song-sel,
#group-quiz-dance-type-sel,
.chap-sel-native,
#group-quiz-chap-sel {
  font-family: 'Be Vietnam Pro', 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  background-color: var(--pvp-select-bg, #ffffff) !important;
  color: var(--pvp-select-text, #0f172a) !important;
  border: 1px solid var(--pvp-select-border, #cbd5e1) !important;
  border-radius: 7px !important;
  outline: none !important;
  letter-spacing: -0.1px !important;
}

.chap-sel-native,
#group-quiz-chap-sel {
  font-size: 12px !important;
}

.chap-sel-text {
  font-family: 'Be Vietnam Pro', 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: var(--pvp-select-text, #0f172a) !important;
  letter-spacing: -0.15px !important;
}

/* Từng option trong danh sách xổ xuống - Light & Dark sync */
.group-quiz-toolbar-container select option,
.group-quiz-cat-select option,
.group-quiz-time-select option,
#group-quiz-cat-sel option,
#group-quiz-time-sel option,
#group-quiz-song-sel option,
#group-quiz-dance-type-sel option,
.chap-sel-native option,
#group-quiz-chap-sel option {
  font-family: 'Be Vietnam Pro', 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  padding: 7px 12px !important;
  background-color: var(--pvp-select-bg, #ffffff) !important;
  color: var(--pvp-select-text, #0f172a) !important;
  letter-spacing: 0.15px !important;
}

.group-quiz-toolbar-container select optgroup,
.group-quiz-cat-select optgroup,
.chap-sel-native optgroup,
#group-quiz-chap-sel optgroup,
#group-quiz-cat-sel optgroup {
  font-family: 'Be Vietnam Pro', 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  color: #0284c7 !important;
  background-color: var(--pvp-bg-subtle, #f1f5f9) !important;
  padding: 8px 10px 4px 10px !important;
  letter-spacing: 0.5px !important;
}

.group-quiz-toolbar-container select option:checked,
.chap-sel-native option:checked,
#group-quiz-chap-sel option:checked,
#group-quiz-cat-sel option:checked {
  background-color: #059669 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* ========================================================================= */
/* 8. CHẾ ĐỘ TRẮC NGHIỆM THƯỜNG VÒNG 2 + NGHE & GÕ LIGHT/DARK SYNC           */
/* ========================================================================= */

.v2-normal-choices-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
  margin-top: 6px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 520px) {
  .v2-normal-choices-grid {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
}

.v2-normal-choice-card {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  border: 1px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  text-align: left !important;
  cursor: pointer !important;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06) !important;
  user-select: none !important;
  outline: none !important;
}
html.dark .v2-normal-choice-card,
body.dark .v2-normal-choice-card {
  border-color: rgba(255, 255, 255, 0.12) !important;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96)) !important;
  color: #f8fafc !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25) !important;
}

.v2-normal-choice-card:hover:not(:disabled) {
  background: #f1f5f9 !important;
  border-color: #3b82f6 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 5px 12px rgba(59, 130, 246, 0.16) !important;
}
html.dark .v2-normal-choice-card:hover:not(:disabled),
body.dark .v2-normal-choice-card:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.95), rgba(30, 41, 59, 0.95)) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
}

.v2-normal-choice-card:active:not(:disabled) {
  transform: scale(0.97) !important;
}

.v2-normal-choice-card.is-selected {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25) !important;
}
html.dark .v2-normal-choice-card.is-selected,
body.dark .v2-normal-choice-card.is-selected {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.35), rgba(6, 78, 59, 0.6)) !important;
  color: #a7f3d0 !important;
}

.v2-normal-choice-card:disabled {
  cursor: default !important;
  opacity: 0.72 !important;
}

.v2-normal-choice-key {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  flex-shrink: 0 !important;
  transition: all 0.15s ease !important;
}
html.dark .v2-normal-choice-key,
body.dark .v2-normal-choice-key {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
}

/* Light Mode Overrides for V2 Dictation Wrapper inside Live Room */
html:not(.dark) .v2-dict-quiz-wrapper { background: #ffffff !important; border: 1px solid #cbd5e1 !important; color: #0f172a !important; box-shadow: 0 4px 16px rgba(15,23,42,0.06) !important; }
html:not(.dark) .v2-dict-q-korean-text, html:not(.dark) .v2-dict-q-kr-text { color: #0f172a !important; }
html:not(.dark) .v2-dict-q-mask-notice, html:not(.dark) .v2-dict-mask-hint { background: #f1f5f9 !important; color: #b45309 !important; border-color: #cbd5e1 !important; }
html:not(.dark) .v2-dict-mask-toggle-btn, html:not(.dark) .v2-dict-tool-btn { background: #fef3c7 !important; color: #b45309 !important; }
html:not(.dark) .v2-dict-audio-card { background: #f0fdf4 !important; border: 1px solid #bbf7d0 !important; }
html:not(.dark) .v2-dict-speed-selector, html:not(.dark) .v2-dict-play-count-badge, html:not(.dark) .v2-dict-tokens-card { background: #f8fafc !important; border: 1px solid #e2e8f0 !important; color: #334155 !important; }
html:not(.dark) .v2-dict-token-chip { background: #ffffff !important; color: #0f172a !important; border: 1px solid #cbd5e1 !important; }
html:not(.dark) .v2-dict-textarea { background: #ffffff !important; color: #0f172a !important; border: 1px solid #cbd5e1 !important; }
html:not(.dark) .v2-dict-trans-box, html:not(.dark) .v2-dict-diff-box { background: #f8fafc !important; border: 1px solid #cbd5e1 !important; color: #0f172a !important; }
html:not(.dark) .v2-dict-trans-result, html:not(.dark) .v2-diff-expected { color: #b45309 !important; }

.v2-normal-choice-card:hover:not(:disabled) .v2-normal-choice-key {
  background: #0284c7 !important;
  color: #fff !important;
  border-color: #38bdf8 !important;
}

.v2-normal-choice-card.is-selected .v2-normal-choice-key {
  background: #10b981 !important;
  color: #fff !important;
  border-color: #34d399 !important;
}

.v2-normal-choice-text {
  flex: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  word-break: break-word !important;
}

.v2-normal-choice-check {
  color: #34d399 !important;
  font-size: 14px !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
}

/* ========================================================================= */
/* 9. BÀI HỌC LIÊN HOÀN 3 PHẦN V2 (3-PART CONTINUOUS LEARNING ENGINE)       */
/* ========================================================================= */

.v2-step-nav-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 4px !important;
  background: rgba(15, 23, 42, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  padding: 4px !important;
  margin-bottom: 6px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.v2-step-tab {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  padding: 6px 8px !important;
  border-radius: 8px !important;
  background: rgba(30, 41, 59, 0.5) !important;
  border: 1px solid transparent !important;
  color: #94a3b8 !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  user-select: none !important;
  text-align: center !important;
}

.v2-step-tab:hover {
  background: rgba(51, 65, 85, 0.7) !important;
  color: #f1f5f9 !important;
}

.v2-step-tab.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(6, 78, 59, 0.5)) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
  font-weight: 700 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.25) !important;
}

.v2-step-num {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 50% !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
  flex-shrink: 0 !important;
}

.v2-step-tab.active .v2-step-num {
  background: #10b981 !important;
  color: #fff !important;
}

.v2-step-badge {
  font-size: 9.5px !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  font-weight: 700 !important;
  margin-left: 2px !important;
}

.v2-badge-done {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
}

.v2-badge-fail {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
}

.v2-badge-skip {
  background: rgba(148, 163, 184, 0.2) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

.v2-step-connector {
  width: 6px !important;
  height: 2px !important;
  background: rgba(255, 255, 255, 0.12) !important;
  flex-shrink: 0 !important;
}

/* Part 2: Sentence Unscramble / Sắp xếp câu */
.v2-unscramble-container {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.v2-unscramble-target-box {
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1.5px dashed rgba(56, 189, 248, 0.45) !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  min-height: 52px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.v2-unscramble-target-box.is-correct {
  border: 1.5px solid #10b981 !important;
  background: rgba(6, 78, 59, 0.25) !important;
}

.v2-unscramble-target-box.is-wrong {
  border: 1.5px solid #ef4444 !important;
  background: rgba(127, 29, 29, 0.25) !important;
}

.v2-unscramble-placeholder {
  color: #64748b !important;
  font-size: 12px !important;
  font-style: italic !important;
  width: 100% !important;
  text-align: center !important;
}

.v2-unscramble-pool {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  justify-content: center !important;
  padding: 6px 4px !important;
  min-height: 48px !important;
  align-items: center !important;
  box-sizing: border-box !important;
}

/* Word chips (Matching Image 4) */
.v2-unscramble-chip {
  background: #262a33 !important;
  border: 1px solid #3f4553 !important;
  color: #f8fafc !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  padding: 8px 16px !important;
  border-radius: 12px !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.15s ease !important;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3) !important;
  -webkit-tap-highlight-color: transparent !important;
  touch-action: manipulation !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1.35 !important;
}

.v2-unscramble-chip:hover:not(:disabled) {
  background: #333945 !important;
  border-color: #38bdf8 !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 14px rgba(56, 189, 248, 0.25) !important;
}

.v2-unscramble-chip:active:not(:disabled) {
  transform: scale(0.96) !important;
}

.v2-unscramble-chip.is-placed {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95)) !important;
  border-color: #0284c7 !important;
  color: #7dd3fc !important;
}

.v2-unscramble-chip:disabled {
  cursor: default !important;
  opacity: 0.65 !important;
  transform: none !important;
}

.v2-unscramble-tools {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  margin-top: 4px !important;
}

.v2-unscramble-tool-btn {
  background: rgba(30, 41, 59, 0.8) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: 0.15s !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.v2-unscramble-tool-btn:hover:not(:disabled) {
  background: #334155 !important;
  color: #fff !important;
}

.v2-unscramble-check-btn {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 4px 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: 0.15s !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.v2-unscramble-check-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8, #0284c7) !important;
}

/* Part Feedback Box */
.v2-part-feedback-box {
  padding: 6px 10px !important;
  border-radius: 8px !important;
  font-size: 11.5px !important;
  font-weight: 600 !important;
  margin-top: 6px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 4px !important;
  box-sizing: border-box !important;
  animation: v2DiffFade 0.2s ease-out !important;
}

.v2-feedback-correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border: 1px solid rgba(16, 185, 129, 0.4) !important;
  color: #34d399 !important;
}

.v2-feedback-wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  border: 1px solid rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}

.v2-feedback-skip {
  background: rgba(148, 163, 184, 0.12) !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  color: #94a3b8 !important;
}

/* Lesson Action Navigation Bar */
.v2-lesson-nav-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  margin-top: 8px !important;
  padding-top: 6px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.v2-nav-btn {
  padding: 7px 12px !important;
  border-radius: 8px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  border: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  transition: all 0.15s ease !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none !important;
  min-height: 34px !important;
}

.v2-nav-back {
  background: rgba(51, 65, 85, 0.8) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.v2-nav-back:hover:not(:disabled) {
  background: #475569 !important;
  color: #fff !important;
}

.v2-nav-back:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

.v2-nav-skip {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

.v2-nav-skip:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.3) !important;
  color: #fff !important;
}

.v2-nav-next {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #fff !important;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.35) !important;
}

.v2-nav-next:hover:not(:disabled) {
  background: linear-gradient(135deg, #38bdf8, #0284c7) !important;
}

.v2-nav-submit {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #fff !important;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.4) !important;
}

.v2-nav-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #34d399, #059669) !important;
  transform: translateY(-1px) !important;
}

.v2-nav-submit:disabled,
.v2-nav-btn.v2-submitted {
  background: #334155 !important;
  color: #94a3b8 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.v2-readonly-banner {
  width: 100% !important;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.18), rgba(15, 23, 42, 0.9)) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  color: #7dd3fc !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  margin-bottom: 6px !important;
  line-height: 1.35 !important;
}

.v2-submitted-banner {
  background: rgba(16, 185, 129, 0.2) !important;
  border: 1px solid #10b981 !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 11.5px !important;
  color: #34d399 !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
}

@keyframes v2SubmitPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

@media (max-width: 480px) {
  .v2-step-tab {
    padding: 5px 4px !important;
    font-size: 10.5px !important;
    gap: 3px !important;
  }

  .v2-step-tab .v2-step-label {
    display: inline-block !important;
  }

  .v2-unscramble-chip {
    padding: 7px 12px !important;
    font-size: 13.5px !important;
  }

  .v2-nav-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}

/* ========================================================================= */
/* EPS-TOPIK & CLASSROOM CBT DARK MODE SYSTEM                                */
/* Automatic dynamic adaptation for html.dark & html[data-theme="dark"]      */
/* ========================================================================= */

html.dark .eps-cbt-page,
html[data-theme="dark"] .eps-cbt-page {
  background: #080d1a !important;
  color: #f1f5f9 !important;
}

html.dark .eps-cbt-header,
html[data-theme="dark"] .eps-cbt-header {
  background: #0f172a !important;
  border-bottom: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-cbt-header h1,
html[data-theme="dark"] .eps-cbt-header h1 {
  color: #f8fafc !important;
}

html.dark .eps-candidate-strip,
html[data-theme="dark"] .eps-candidate-strip {
  background: linear-gradient(100deg, #1e293b, #0f172a, #1e293b) !important;
  border: 1px solid #334155 !important;
  color: #cbd5e1 !important;
}

html.dark .eps-candidate-strip b,
html[data-theme="dark"] .eps-candidate-strip b {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

html.dark .eps-version-bar,
html[data-theme="dark"] .eps-version-bar {
  background: #1e293b !important;
  border-bottom: 1px solid #334155 !important;
}

html.dark .eps-version-bar small,
html[data-theme="dark"] .eps-version-bar small {
  color: #94a3b8 !important;
}

html.dark .eps-runtime-layout,
html[data-theme="dark"] .eps-runtime-layout {
  background: #050811 !important;
}

html.dark .eps-paper,
html[data-theme="dark"] .eps-paper {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

html.dark .eps-paper-heading,
html[data-theme="dark"] .eps-paper-heading {
  border-bottom: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-paper-heading b,
html[data-theme="dark"] .eps-paper-heading b {
  color: #94a3b8 !important;
}

.eps-question-rubric {
  margin: 14px 0 8px;
  padding: 9px 13px;
  border-left: 3px solid #2f9bd5;
  border-radius: 0 4px 4px 0;
  background: #f2f8fc;
  color: #365066;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.eps-question-rich {
  font-family: 'Noto Sans KR', 'Pretendard', system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  overflow-x: auto;
}

.eps-question-rich h4,
.eps-question-rich h5 {
  margin: 4px 0 8px;
  font-size: 18px;
  font-weight: 700;
}

.eps-question-rich .text-center {
  text-align: center;
}

.eps-question-rich .text-start {
  text-align: left;
}

.eps-question-rich .fw-bold {
  font-weight: 700;
}

.eps-question-rich .fs-5 {
  font-size: 16px;
}

.eps-question-rich .m-auto {
  margin-left: auto;
  margin-right: auto;
}

.eps-question-rich .mt-2 {
  margin-top: 8px;
}

.eps-question-rich .mb-0 {
  margin-bottom: 0;
}

.eps-question-rich .p-0 {
  padding: 2px 4px;
}

.eps-question-rich .p-1 {
  padding: 6px;
}

.eps-question-rich .p-2 {
  padding: 10px;
}

.eps-question-rich .ps-1 {
  padding-left: 8px;
}

.eps-question-rich .pe-1 {
  padding-right: 8px;
}

.eps-question-rich table {
  border-collapse: collapse;
  max-width: 100%;
  margin: 8px auto;
  background: rgba(255, 255, 255, 0.5);
}

.eps-question-rich th,
.eps-question-rich td {
  border: 1px solid #475569;
  padding: 6px 10px;
  vertical-align: middle;
}

.eps-question-rich ul {
  margin: 8px 0 8px 22px;
  list-style: disc;
}

.eps-question-rich .text-decoration-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.eps-blank-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0 10px;
  margin: 0 3px;
  border: 1px solid #64748b;
  border-radius: 4px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.9em;
  letter-spacing: 0.12em;
  vertical-align: baseline;
}

.eps-option-underline {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

html.dark .eps-question-rubric,
html[data-theme="dark"] .eps-question-rubric {
  background: rgba(56, 189, 248, 0.12) !important;
  border-left-color: #38bdf8 !important;
  color: #e2e8f0 !important;
}

html.dark .eps-question-text,
html[data-theme="dark"] .eps-question-text {
  color: #f1f5f9 !important;
}

html.dark .eps-question-rich table,
html[data-theme="dark"] .eps-question-rich table {
  background: rgba(15, 23, 42, 0.65) !important;
}

html.dark .eps-question-rich th,
html.dark .eps-question-rich td,
html.dark .eps-question-rich .text-dark,
html.dark .eps-question-rich .border-dark,
html[data-theme="dark"] .eps-question-rich th,
html[data-theme="dark"] .eps-question-rich td,
html[data-theme="dark"] .eps-question-rich .text-dark,
html[data-theme="dark"] .eps-question-rich .border-dark {
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

html.dark .eps-blank-token,
html[data-theme="dark"] .eps-blank-token {
  background: #1e293b !important;
  border-color: #64748b !important;
  color: #f8fafc !important;
}

/* 4 Options / Answers in Dark Mode */
html.dark .eps-answer,
html[data-theme="dark"] .eps-answer {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #e2e8f0 !important;
}

html.dark .eps-answer:hover:not(:disabled),
html[data-theme="dark"] .eps-answer:hover:not(:disabled) {
  border-color: #60a5fa !important;
  background: #283548 !important;
  color: #ffffff !important;
}

html.dark .eps-answer b,
html[data-theme="dark"] .eps-answer b {
  color: #60a5fa !important;
}

html.dark .eps-answer.is-selected,
html[data-theme="dark"] .eps-answer.is-selected {
  border-color: #3b82f6 !important;
  background: rgba(59, 130, 246, 0.22) !important;
  color: #93c5fd !important;
  box-shadow: inset 0 0 0 1px #3b82f6 !important;
}

html.dark .eps-answer.is-selected b,
html[data-theme="dark"] .eps-answer.is-selected b {
  color: #93c5fd !important;
}

html.dark :is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after,
html[data-theme="dark"] :is(#view-eps-exam, .eps-cbt-scope) .eps-answer.is-selected:not(.is-correct):not(.is-wrong) b::after {
  color: #38bdf8;
  text-shadow: 0 1px #0f172a;
}

html.dark .eps-answer.is-correct,
html[data-theme="dark"] .eps-answer.is-correct {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
}

html.dark .eps-answer.is-wrong,
html[data-theme="dark"] .eps-answer.is-wrong {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
}

/* Audio Status & Tips */
html.dark .eps-paper-tip,
html[data-theme="dark"] .eps-paper-tip {
  background: #020617 !important;
  border: 1px solid #1e293b !important;
  color: #94a3b8 !important;
}

html.dark .eps-paper-tip button,
html[data-theme="dark"] .eps-paper-tip button {
  background: #2563eb !important;
  color: #ffffff !important;
}

/* Question Navigator Sidebar */
html.dark .eps-question-nav,
html[data-theme="dark"] .eps-question-nav {
  background: #0b1120 !important;
  border-left: 1px solid #1e293b !important;
}

html.dark .eps-nav-head,
html[data-theme="dark"] .eps-nav-head {
  border-color: #334155 !important;
  background: #1e293b !important;
}

html.dark .eps-nav-head>div,
html[data-theme="dark"] .eps-nav-head>div {
  border-right-color: #334155 !important;
}

html.dark .eps-nav-head b,
html[data-theme="dark"] .eps-nav-head b {
  color: #cbd5e1 !important;
}

html.dark .eps-nav-head span,
html[data-theme="dark"] .eps-nav-head span {
  background: #0f172a !important;
  color: #f8fafc !important;
}

html.dark .eps-nav-head em,
html[data-theme="dark"] .eps-nav-head em {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

html.dark .eps-nav-grid,
html[data-theme="dark"] .eps-nav-grid {
  background: #0f172a !important;
}

html.dark .eps-nav-grid>div,
html[data-theme="dark"] .eps-nav-grid>div {
  border-right-color: #1e293b !important;
}

html.dark .eps-nav-number,
html[data-theme="dark"] .eps-nav-number {
  border-bottom: 1px solid #1e293b !important;
  background: #0f172a !important;
  color: #94a3b8 !important;
}

html.dark .eps-nav-number:hover:not(:disabled),
html[data-theme="dark"] .eps-nav-number:hover:not(:disabled) {
  background: #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-nav-number.is-answered,
html[data-theme="dark"] .eps-nav-number.is-answered {
  background: rgba(59, 130, 246, 0.22) !important;
  color: #60a5fa !important;
}

html.dark .eps-nav-number.is-current,
html[data-theme="dark"] .eps-nav-number.is-current {
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* Dialogs & Confirmations */
html.dark .eps-dialog,
html[data-theme="dark"] .eps-dialog {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
}

html.dark .eps-dialog-body,
html[data-theme="dark"] .eps-dialog-body {
  color: #cbd5e1 !important;
}

/* Soundcheck & Preflight */
html.dark .eps-soundcheck,
html[data-theme="dark"] .eps-soundcheck {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-soundcheck h2,
html[data-theme="dark"] .eps-soundcheck h2 {
  color: #f8fafc !important;
  border-bottom-color: #334155 !important;
}

html.dark .eps-soundcheck>div:not(.eps-sound-actions),
html[data-theme="dark"] .eps-soundcheck>div:not(.eps-sound-actions) {
  background: #020617 !important;
  border-color: #1e293b !important;
  color: #cbd5e1 !important;
}

html.dark .eps-applicant-card,
html[data-theme="dark"] .eps-applicant-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-seat-number,
html[data-theme="dark"] .eps-seat-number {
  border-right-color: #1e293b !important;
  color: #cbd5e1 !important;
}

html.dark .eps-applicant-card dl>div,
html[data-theme="dark"] .eps-applicant-card dl>div {
  border-color: #334155 !important;
}

html.dark .eps-applicant-card dd,
html[data-theme="dark"] .eps-applicant-card dd {
  color: #f1f5f9 !important;
}

html.dark .eps-notice-list,
html[data-theme="dark"] .eps-notice-list {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #cbd5e1 !important;
}

html.dark .eps-notice-list p,
html[data-theme="dark"] .eps-notice-list p {
  color: #cbd5e1 !important;
}

/* Result Screen */
html.dark .eps-result-page,
html[data-theme="dark"] .eps-result-page {
  background: #080d1a !important;
  color: #f8fafc !important;
}

html.dark .eps-result-card,
html[data-theme="dark"] .eps-result-card {
  background: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}

html.dark .eps-result-breakdown,
html[data-theme="dark"] .eps-result-breakdown {
  background: #020617 !important;
  border: 1px solid #1e293b !important;
  color: #cbd5e1 !important;
}

/* ========================================================================= */
/* UNIVERSAL RESILIENT DARK-MODE SAFEGUARD FOR SECONDARY BUTTONS             */
/* Eliminates muddy/dirty gray backgrounds and invisible white text          */
/* ========================================================================= */
html.dark button.hw-bg-slate-200,
html.dark button.hw-bg-slate-300,
html[data-theme="dark"] button.hw-bg-slate-200,
html[data-theme="dark"] button.hw-bg-slate-300,
html.dark .tp-btn-secondary,
html[data-theme="dark"] .tp-btn-secondary,
html.dark a.hw-bg-slate-200,
html.dark a.hw-bg-slate-300 {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
  border: 1px solid #334155 !important;
}

html.dark button.hw-bg-slate-200:hover,
html.dark button.hw-bg-slate-300:hover,
html[data-theme="dark"] button.hw-bg-slate-200:hover,
html[data-theme="dark"] button.hw-bg-slate-300:hover,
html.dark .tp-btn-secondary:hover,
html[data-theme="dark"] .tp-btn-secondary:hover,
html.dark a.hw-bg-slate-200:hover,
html.dark a.hw-bg-slate-300:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
  border-color: #475569 !important;
}

/* ========================================================================= */
/* EPS-TOPIK & CLASSROOM CBT PARITY EXTENSIONS                              */
/* ========================================================================= */
:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer-row:not(.is-text-options):not(.is-image-options),
:is(#view-eps-exam, .eps-cbt-scope) .eps-answer-row.is-compact-options {
  width: min(100%, 740px) !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin-top: 10px !important;
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.has-tall-question-image .eps-answer-row:not(.is-text-options):not(.is-image-options) .eps-answer,
:is(#view-eps-exam, .eps-cbt-scope) .eps-answer-row.is-compact-options .eps-answer {
  min-width: 0 !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 6px 4px !important;
  min-height: 38px !important;
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-answer-row.is-compact-options .eps-answer b {
  font-size: 18px !important;
  min-width: auto !important;
}
:is(#view-eps-exam, .eps-cbt-scope).eps-exam-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 120 !important;
  background: #f5f5f5 !important;
  overflow: hidden !important;
}
html.dark :is(#view-eps-exam, .eps-cbt-scope).eps-exam-fullscreen {
  background: #080d1a !important;
}
:is(#view-eps-exam, .eps-cbt-scope).eps-exam-fullscreen :is(#eps-exam-app, .eps-exam-app) {
  height: 100% !important;
  overflow: auto !important;
  overscroll-behavior: contain !important;
}


/* =========================================================================
 * EPS-TOPIK QUESTION UNDERLINE STYLING (HIGH CONTRAST & ACCESSIBILITY)
 * ========================================================================= */
.tp-underlined,
.underline-text-option,
.text-decoration-underline,
u {
  text-decoration-line: underline !important;
  text-underline-offset: 4px !important;
  text-decoration-thickness: 2.5px !important;
  text-decoration-color: #4f46e5 !important;
  font-weight: 700 !important;
  padding-left: 2px !important;
  padding-right: 2px !important;
  text-decoration-skip-ink: none !important;
}

html.dark .tp-underlined,
html.dark .underline-text-option,
html.dark .text-decoration-underline,
html.dark u {
  text-decoration-color: #818cf8 !important;
}

/* Green highlight coordination when an option is the correct answer */
.hw-border-emerald-500 .tp-underlined,
.hw-border-emerald-500 .underline-text-option,
.hw-border-emerald-500 .text-decoration-underline,
.hw-border-emerald-500 u {
  text-decoration-color: #059669 !important;
}

html.dark .hw-border-emerald-500 .tp-underlined,
html.dark .hw-border-emerald-500 .underline-text-option,
html.dark .hw-border-emerald-500 .text-decoration-underline,
html.dark .hw-border-emerald-500 u {
  text-decoration-color: #34d399 !important;
}

/* EPS-TOPIK Listening 4-image choices (2x2 picture grid) */
:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options {
  width: min(600px, 100%) !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin-top: 12px !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer {
  align-items: flex-start !important;
  min-height: 92px;
  padding: 8px 10px !important;
  border: 1px solid #cdd8e3 !important;
  border-radius: 6px !important;
  background: #fff !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer:hover:not(:disabled) {
  border-color: #2f9bd5 !important;
  background: #f0f9ff !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer.is-selected {
  border-color: #168dcc !important;
  background: #dff3ff !important;
  box-shadow: inset 0 0 0 1px #168dcc !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer.is-correct {
  border-color: #2c9f65 !important;
  background: #e6f8ee !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer.is-wrong {
  border-color: #d95454 !important;
  background: #ffeded !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer span {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options .eps-answer span img {
  width: auto;
  max-width: 100%;
  max-height: 155px;
  object-fit: contain;
  border-radius: 4px;
}

@media (max-width: 480px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-image-options {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================================
   STRUCTURED CBT TEXT/ILLUSTRATION QUESTIONS (F250xx, dethithu, Classroom)
   Match standard mock exam ("bo de chuan"): proportional reading images,
   4 stacked rows for text choices, readable option typography on desktop & mobile.
   ========================================================================= */
:is(#view-eps-exam, .eps-cbt-scope) .eps-paper.is-text-question .eps-question-image {
  width: auto !important;
  max-width: min(calc(540px * var(--eps-question-image-scale, 1)), 100%) !important;
  height: auto !important;
  max-height: calc(clamp(200px, 38vh, 350px) * var(--eps-question-image-scale, 1)) !important;
  margin: 10px 0 14px !important;
  object-fit: contain !important;
  object-position: left center !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options {
  width: min(600px, 100%) !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  justify-items: stretch !important;
  gap: 4px !important;
  margin: 12px 0 0 !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options .eps-answer {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 36px !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  padding: 5px 8px 5px 10px !important;
  font-size: calc(15px * var(--eps-font-scale, 1)) !important;
  line-height: 1.42 !important;
  text-align: left !important;
  overflow: visible !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options .eps-answer b {
  flex: 0 0 auto !important;
  min-width: 26px !important;
  font-size: calc(17px * var(--eps-font-scale, 1)) !important;
  line-height: 1.3 !important;
  padding-top: 1px !important;
  text-align: left !important;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options .eps-answer span {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: visible !important;
  font-size: inherit !important;
  line-height: inherit !important;
  text-align: left !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}

@media (max-width: 640px) {
  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper.is-text-question .eps-question-image {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(min(36vh, 260px) * var(--eps-question-image-scale, 1)) !important;
    margin: 8px auto 12px !important;
    object-fit: contain !important;
    object-position: center center !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options {
    width: 100% !important;
    gap: 5px !important;
    margin-top: 10px !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options .eps-answer {
    min-height: 40px !important;
    padding: 6px 8px 6px 10px !important;
    font-size: calc(14px * var(--eps-font-scale, 1)) !important;
    line-height: 1.4 !important;
  }

  :is(#view-eps-exam, .eps-cbt-scope) .eps-paper .eps-answer-row.is-text-options .eps-answer b {
    min-width: 24px !important;
    font-size: calc(16px * var(--eps-font-scale, 1)) !important;
  }
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner,
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert {
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: 1360px !important;
  margin: 0 auto 22px !important;
  padding: 16px 20px;
  border-radius: 15px;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  flex-wrap: wrap;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert {
  margin-bottom: 18px !important;
  align-items: flex-start;
  flex-wrap: nowrap;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-content {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  flex: 1 1 300px;
  min-width: 0;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-content {
  align-items: center;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-icon {
  margin-top: 0;
  font-size: 19px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-copy strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 3px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-copy strong {
  font-size: 14.5px;
  margin-bottom: 2px;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-copy p,
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-copy span {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-cta {
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  transition: transform 0.14s ease, filter 0.14s ease;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-cta:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Light Mode — crisp high-contrast pastel-free cards & readable dark text */
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border-color: #6ee7b7;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.1);
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-icon { color: #d97706; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-copy strong { color: #065f46; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-copy span { color: #1e293b; }

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #93c5fd;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-icon { color: #2563eb; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-copy strong { color: #1e40af; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-copy p { color: #1e293b; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-cta {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.22);
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #7dd3fc;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-icon { color: #0284c7; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-copy strong { color: #075985; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-copy p { color: #1e293b; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-cta {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 1px solid #0369a1;
  color: #ffffff;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fbbf24;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.09);
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-icon { color: #d97706; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-copy strong { color: #92400e; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-copy p { color: #334155; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-cta {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid #92400e;
  color: #ffffff;
}

:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert {
  background: #fffbeb;
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.1);
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-icon { color: #d97706; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-copy strong { color: #92400e; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-copy span { color: #451a03; }
:is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-close {
  background: rgba(146, 64, 14, 0.12);
  color: #78350f;
}

/* Dark Mode — clean deep navy/emerald/amber surfaces & bright legible typography */
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked {
  background: linear-gradient(135deg, #07221d 0%, #0b1829 100%);
  border-color: rgba(16, 185, 129, 0.48);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-icon { color: #fbbf24; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-copy strong { color: #6ee7b7; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-unlocked .eps-entitlement-copy span { color: #e2e8f0; }

:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only {
  background: linear-gradient(135deg, #0c1d3b 0%, #0f172a 100%);
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-icon { color: #60a5fa; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-copy strong { color: #93c5fd; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-copy p { color: #e2e8f0; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-sample-only .eps-entitlement-cta {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(96, 165, 250, 0.55);
  color: #ffffff;
}

:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps {
  background: linear-gradient(135deg, #092438 0%, #0f172a 100%);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-icon { color: #38bdf8; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-copy strong { color: #7dd3fc; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-copy p { color: #e2e8f0; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-vip-missing-eps .eps-entitlement-cta {
  background: #0284c7;
  border-color: rgba(125, 211, 252, 0.45);
  color: #ffffff;
}

:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip {
  background: linear-gradient(135deg, #261808 0%, #0f172a 100%);
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-icon { color: #fbbf24; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-copy strong { color: #fcd34d; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-copy p { color: #e2e8f0; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-banner.is-eps-missing-vip .eps-entitlement-cta {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: rgba(251, 191, 36, 0.5);
  color: #0f172a;
}

:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert {
  background: linear-gradient(135deg, #291907 0%, #111827 100%);
  border-color: rgba(245, 158, 11, 0.5);
}
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-icon { color: #fbbf24; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-copy strong { color: #fde68a; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-copy span { color: #fef3c7; }
:is(html.dark, html[data-theme="dark"]) :is(#view-eps-exam, .eps-cbt-scope) .eps-library .eps-entitlement-alert .eps-entitlement-close {
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

/* --- EPS 3-TAB LIBRARY & FLEXIBLE PRACTICE/MIXED EXAM UI --- */
.eps-lib-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 1360px;
  margin: 0 auto 16px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #cbd9e6;
  background: #eff6fc;
}
.eps-lib-tabs > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #2f4b61;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.eps-lib-tabs > button em {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(15, 86, 128, .12);
  color: #0c4b70;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
}
.eps-lib-tabs > button.is-active {
  background: #ffffff;
  color: #0c476e;
  border-color: #b7d7eb;
  box-shadow: 0 3px 10px rgba(15, 76, 117, .1);
}
.eps-lib-tabs > button.is-active em {
  background: #1463a0;
  color: #ffffff;
}
.eps-lib-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 1360px;
  margin: 0 auto 10px;
}
.eps-lib-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 460px;
}
.eps-lib-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #547287;
  font-size: 13px;
}
.eps-lib-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid #c4d5e2;
  border-radius: 9px;
  background: #ffffff;
  color: #0f293c;
  font-size: 13px;
  outline: none;
}
.eps-lib-search input:focus {
  border-color: #1463a0;
  box-shadow: 0 0 0 3px rgba(20, 99, 160, .14);
}
.eps-lib-status-pills,
.eps-lib-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.eps-lib-pills {
  max-width: 1360px;
  margin: 0 auto 20px;
}
.eps-lib-status-pills > span {
  font-size: 12px;
  font-weight: 700;
  color: #365064;
  margin-right: 2px;
}
.eps-lib-status-pills > button,
.eps-lib-pills > button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #c4d5e2;
  background: #ffffff;
  color: #1e3a4f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.eps-lib-status-pills > button.is-active,
.eps-lib-pills > button.is-active {
  background: #1463a0;
  border-color: #1463a0;
  color: #ffffff;
}
.eps-lib-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: #1e3445;
}
.eps-lib-group-toggle > i {
  font-size: 13px;
  color: #3a5d75;
}
.eps-lib-empty {
  max-width: 560px;
  margin: 40px auto;
  padding: 28px;
  text-align: center;
  color: #3d5669;
  border: 1px dashed #b9cddc;
  border-radius: 12px;
  background: #ffffff;
}
.eps-lib-empty i {
  font-size: 24px;
  margin-bottom: 8px;
  color: #1463a0;
}
.eps-library-card-top em.is-locked {
  color: #92400e;
  background: #fef3c7;
  padding: 3px 7px;
  border-radius: 999px;
}
.eps-flex-audio-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 9px;
  background: #eef7fc;
  border: 1px solid #bce0f4;
}
.eps-flex-audio-bar > button {
  padding: 7px 14px;
  border-radius: 7px;
  border: 0;
  background: #1463a0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.eps-flex-audio-bar > span {
  font-size: 12px;
  color: #21445c;
}
.eps-question-stimulus {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid #1463a0;
  background: #f3f9fd;
  border-radius: 6px;
  color: #17344a;
  font-size: 13.5px;
  line-height: 1.55;
}
.eps-text-answer-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.eps-text-input,
.eps-textarea-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #bdd0dd;
  border-radius: 8px;
  background: #ffffff;
  color: #0f293c;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
}
.eps-text-input:focus,
.eps-textarea-input:focus {
  border-color: #1463a0;
  box-shadow: 0 0 0 3px rgba(20, 99, 160, .14);
}
.eps-model-answer-hint {
  padding: 12px;
  border-radius: 8px;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  font-size: 13px;
}
.eps-question-nav.is-flexible-nav .eps-nav-head.is-single-head {
  grid-template-columns: 1fr;
}
.eps-question-nav.is-flexible-nav .eps-nav-grid.is-flex-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px;
}

/* Dark mode parity for EPS 3-tab library & flexible practice UI */
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs {
  background: #0f172a;
  border-color: #1e293b;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button {
  color: #94a3b8;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button em {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button.is-active {
  background: #1e293b;
  border-color: #3b82f6;
  color: #f8fafc;
  box-shadow: none;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-tabs > button.is-active em {
  background: #2563eb;
  color: #ffffff;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-search i {
  color: #94a3b8;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-search input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-search input::placeholder {
  color: #64748b;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > span {
  color: #cbd5e1;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > button,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-pills > button {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-status-pills > button.is-active,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-pills > button.is-active {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-card-top em.is-locked {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-empty {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-empty i {
  color: #60a5fa;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar {
  background: #111c36;
  border-color: #1e3a8a;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar > button {
  background: #2563eb;
  color: #ffffff;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-flex-audio-bar > span {
  color: #cbd5e1;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-question-stimulus {
  background: #131c31;
  border-left-color: #3b82f6;
  color: #e2e8f0;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-text-input,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-textarea-input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-model-answer-hint {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.4);
  color: #6ee7b7;
}
/* High-contrast Library card stats, button & heading Light/Dark alignment */
.eps-library-stats small,
.eps-library-last-result > small {
  color: #4e6678;
}
.eps-library-card > button {
  background-color: #1463a0;
  background: linear-gradient(180deg, #217ec4 0%, #145e99 100%);
  color: #ffffff;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading h2,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-group-toggle,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading > span,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading b {
  color: #f1f5f9 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-lib-group-toggle > i,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading > span i {
  color: #60a5fa !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-heading small,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-stats small,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-last-result > small {
  color: #94a3b8 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-library-card > button {
  background-color: #1d4ed8 !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-submit-answer,
:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav footer > button {
  background-color: #145a96 !important;
  background: linear-gradient(180deg, #1d70b8 0%, #145a96 100%) !important;
  color: #ffffff !important;
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head {
  background-color: #163b5c !important;
  background: linear-gradient(180deg, #1e4e79 0%, #163b5c 100%) !important;
}
:is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head b {
  background-color: #145a96 !important;
  background: linear-gradient(180deg, #1d70b8 0%, #145a96 100%) !important;
  color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-nav-head strong,
:is(html.dark, html[data-theme="dark"], body.dark) .eps-nav-head strong {
  color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav {
  background: #0f172a !important;
  border-color: #1e293b !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head {
  background: #1e293b !important;
  border-color: #334155 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head b {
  background: #1e293b !important;
  border-bottom: 1px solid #334155 !important;
  color: #f1f5f9 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head span {
  background: #0f172a !important;
  color: #f8fafc !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-nav-head em {
  background: #334155 !important;
  color: #e2e8f0 !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav .eps-submit-answer,
:is(html.dark, html[data-theme="dark"], body.dark) :is(#view-eps-exam, .eps-cbt-scope) .eps-question-nav.is-flexible-nav footer > button {
  background-color: #1d4ed8 !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-question-nav.is-flexible-nav .eps-nav-grid button:not(.is-current):not(.is-answered) {
  background: #131c31 !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
@media (max-width: 640px) {
  .eps-lib-tabs {
    grid-template-columns: 1fr;
  }
}

/* Balanced Grid & Symmetrical Practice Cards (Tab 1, 14 Dạng & Level 2 / Đề Rời) */
.eps-library-grid {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.eps-library-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.eps-library-card-top {
  gap: 8px;
  flex-wrap: nowrap;
  min-height: 26px;
}
.eps-library-card-top > span,
.eps-library-card-top em {
  white-space: nowrap;
}
.eps-library-card-top > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eps-library-card-top em {
  flex-shrink: 0;
}
.eps-practice-card h2 {
  margin: 12px 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.38;
  min-height: calc(16.5px * 1.38 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.eps-practice-card > p {
  margin: 0 0 12px;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
  min-height: calc(12px * 1.45 * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
:is(html.dark, html[data-theme="dark"], body.dark) .eps-practice-card > p {
  color: #94a3b8 !important;
}
.eps-library-card .eps-library-stats {
  margin-top: auto;
  margin-bottom: 12px;
}
.eps-practice-card .eps-library-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.eps-practice-card .eps-library-stats span:last-child {
  border-right: 0;
}
.eps-library-card > button {
  margin-top: 0;
  width: 100%;
  min-height: 40px;
}
@media (max-width: 640px) {
  .eps-library-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .eps-practice-card h2,
  .eps-practice-card > p {
    min-height: 0;
  }
}

/* =========================================================================
   UNIFIED LIBRARY FRAME ARCHITECTURE (DESKTOP STANDARD = 1440px + MOBILE/TABLET)
   All sidebar destinations match #view-dashboard (.hw-library-home) frame
   without nested padding shift, scrollbar jitter, or mobile overflow.
   ========================================================================= */
:root {
  --hw-library-frame-max: 1440px;
}

@media (min-width: 768px) {
  body:not(.hw-game-core-active) #hw-app-layout > main {
    scrollbar-gutter: stable;
  }

  #hw-app-layout > main > #unified-hud-wrapper,
  body #hw-app-layout > main > #unified-hud-wrapper,
  html.anki-mode-off body #hw-app-layout > main > #unified-hud-wrapper,
  body.skin-tutien #hw-app-layout > main > #unified-hud-wrapper {
    width: min(var(--hw-library-frame-max), calc(100% - 48px)) !important;
    max-width: min(var(--hw-library-frame-max), calc(100% - 48px)) !important;
    margin: 0 auto 14px !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 767px) {
  #hw-app-layout > main > #unified-hud-wrapper,
  body #hw-app-layout > main > #unified-hud-wrapper,
  html.anki-mode-off body #hw-app-layout > main > #unified-hud-wrapper,
  body.skin-tutien #hw-app-layout > main > #unified-hud-wrapper {
    width: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    margin: 8px auto 12px !important;
    box-sizing: border-box !important;
    border-radius: 18px !important;
  }

  #hw-app-layout > main > .hw-flex-1 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    box-sizing: border-box !important;
  }
}

#hw-app-layout > main > .hw-flex-1 {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

#hw-app-layout > main > .hw-flex-1 > .hw-tab-view:not(.topik-exam-fullscreen):not(#view-review):not(:has(.eps-cbt-page)),
body.hw-game-core-active #hw-app-layout > main > .hw-flex-1 > #view-rpg.hw-game-core-workspace {
  width: min(var(--hw-library-frame-max), 100%) !important;
  max-width: min(var(--hw-library-frame-max), 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

/* Remove inner narrow caps & duplicate horizontal padding inside the unified shell */
#hw-app-layout #view-classroom > div,
#hw-app-layout #view-teacher > div,
#hw-app-layout #view-settings .hw-settings-container > div,
#hw-app-layout #view-attendance #attendance-root {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

#hw-app-layout #view-classroom > div,
#hw-app-layout #view-teacher > div,
#hw-app-layout #view-settings .hw-settings-container > div {
  padding-top: 0 !important;
}

#hw-app-layout #view-reference.hw-ref-container {
  width: min(var(--hw-library-frame-max), 100%) !important;
  max-width: min(var(--hw-library-frame-max), 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

#hw-app-layout #view-shadowing .shadowing-shell,
#hw-app-layout #view-alphabet-tab .alphabet-page-shell,
#hw-app-layout #view-analytics .fv-analytics-shell,
#hw-app-layout #view-topik-exam:not(.topik-exam-fullscreen) .topik-library {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

#hw-app-layout #view-shadowing .shadowing-shell {
  padding-top: 0 !important;
}

#hw-app-layout #view-alphabet-tab,
#hw-app-layout #view-analytics {
  background: transparent !important;
  min-height: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

#hw-app-layout #view-eps-exam .eps-library {
  padding: 0 0 40px !important;
  background: transparent !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#hw-app-layout #view-eps-exam .eps-library-hero,
#hw-app-layout #view-eps-exam .eps-lib-notice,
#hw-app-layout #view-eps-exam .eps-lib-tabs,
#hw-app-layout #view-eps-exam .eps-lib-toolbar,
#hw-app-layout #view-eps-exam .eps-lib-pills,
#hw-app-layout #view-eps-exam .eps-library-group,
#hw-app-layout #view-eps-exam .eps-library-grid,
#hw-app-layout #view-eps-exam .eps-lib-empty {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

@container (min-width: 1060px) {
  #hw-app-layout #view-eps-exam .eps-library-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@container (min-width: 800px) and (max-width: 1059px) {
  #hw-app-layout #view-eps-exam .eps-library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@container (min-width: 540px) and (max-width: 799px) {
  #hw-app-layout #view-eps-exam .eps-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@container (max-width: 539px) {
  #hw-app-layout #view-eps-exam .eps-library-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

#hw-app-layout #view-skills-test,
html.hw-env-ipad.hw-orientation-landscape #hw-app-layout #view-skills-test,
html.hw-env-tablet.hw-orientation-landscape #hw-app-layout #view-skills-test {
  width: min(var(--hw-library-frame-max), 100%) !important;
  max-width: min(var(--hw-library-frame-max), 100%) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

@media (max-width: 640px) {
  #hw-app-layout #view-topik-exam:not(.topik-exam-fullscreen) {
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* Tablet & narrow desktop safety against horizontal overflow inside tools */
@media (min-width: 768px) {
  #hw-app-layout > main > .hw-flex-1 {
    padding: 24px !important;
  }
  #hw-app-layout > nav,
  #hw-app-layout > #hw-mobile-bottom-nav,
  #hw-mobile-bottom-nav {
    display: none !important;
  }
}

@media (max-width: 767px) {
  #hw-app-layout > main {
    scrollbar-width: none;
  }
  #hw-app-layout > main::-webkit-scrollbar {
    display: none;
  }
}

@media (max-width: 1024px) {
  #hw-app-layout #view-shadowing .shadowing-library-add {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #hw-app-layout #view-alphabet-tab .alphabet-hero {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #hw-app-layout #view-teacher > div > div:first-child,
  #hw-app-layout #view-teacher > div > div:first-child > div:last-child {
    flex-wrap: wrap !important;
  }
  #hw-app-layout #view-skills-test {
    min-width: 0 !important;
    overflow-x: hidden !important;
  }
  #hw-app-layout #view-skills-test > *,
  #hw-app-layout #view-skills-test .v2-header-row,
  #hw-app-layout #view-skills-test .v2-sub-nav-container {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}
