/* ==========================================
   CSS DESIGN SYSTEM & DESIGN THEMES
   ========================================== */

:root {
  /* HSL Colors */
  --hue-primary: 220;
  
  /* Light Mode Palette */
  --bg-primary: #f4f6fa;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(226, 232, 240, 0.8);
  --border-glass: rgba(255, 255, 255, 0.4);
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;
  
  --color-primary: hsl(var(--hue-primary), 85%, 57%);
  --color-primary-hover: hsl(var(--hue-primary), 85%, 48%);
  --color-primary-light: hsl(var(--hue-primary), 90%, 94%);
  
  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;
  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;
  --color-purple: #8b5cf6;
  --color-purple-light: #f5f3ff;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 20px -2px rgba(148, 163, 184, 0.12), 0 2px 8px -1px rgba(148, 163, 184, 0.08);
  --shadow-lg: 0 10px 25px -5px rgba(148, 163, 184, 0.18), 0 8px 16px -6px rgba(148, 163, 184, 0.12);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.06);

  /* Tone Colors (Pinyin) */
  --tone-1: #ef4444; /* red */
  --tone-2: #10b981; /* green */
  --tone-3: #3b82f6; /* blue */
  --tone-4: #f97316; /* orange */
  --tone-5: #64748b; /* gray */
  
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --border-radius-circle: 50%;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables Override */
body.dark-theme {
  --bg-primary: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(51, 65, 85, 0.6);
  --border-glass: rgba(255, 255, 255, 0.05);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --color-primary-light: rgba(59, 130, 246, 0.15);
  --color-success-light: rgba(16, 185, 129, 0.1);
  --color-danger-light: rgba(239, 68, 68, 0.1);
  --color-warning-light: rgba(245, 158, 11) 0.1;
  --color-purple-light: rgba(139, 92, 246, 0.15);
  
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* ==========================================
   BASE STYLES
   ========================================== */

.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans SC', 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==========================================
   APP LAYOUT (SIDEBAR & CONTENT)
   ========================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.app-sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  color: var(--text-white);
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.brand-text h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 12px 16px;
  width: 100%;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.nav-item:hover i {
  transform: translateX(2px);
}

.nav-item.active {
  background-color: var(--color-primary);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Setting UI controls in Sidebar */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.setting-group input[type="range"] {
  width: 100%;
  accent-color: var(--color-primary);
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
}

.theme-switch-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Switch Toggle Button */
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .4s;
  border-radius: 24px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

.switch-toggle input:checked + .slider-round {
  background-color: var(--color-primary);
}

.switch-toggle input:checked + .slider-round:before {
  transform: translateX(20px);
}

/* Tone Color Legend */
.tone-legend {
  background-color: var(--color-primary-light);
  border-radius: var(--border-radius-sm);
  padding: 10px;
}

.legend-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
}

.legend-grid span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-grid span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.tone-1::before { background-color: var(--tone-1); }
.tone-1 { color: var(--tone-1); }
.tone-2::before { background-color: var(--tone-2); }
.tone-2 { color: var(--tone-2); }
.tone-3::before { background-color: var(--tone-3); }
.tone-3 { color: var(--tone-3); }
.tone-4::before { background-color: var(--tone-4); }
.tone-4 { color: var(--tone-4); }

/* Main Content Area */
.app-content {
  margin-left: 280px;
  padding: 40px;
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-normal);
}

/* Header inside content area */
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.header-title h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.header-title p {
  font-size: 14px;
  color: var(--text-muted);
}

.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.user-status i {
  color: var(--color-primary);
  font-size: 16px;
}

/* Tab content logic visibility */
.tab-content {
  display: none;
  animation: tabFadeIn var(--transition-normal);
}

.tab-content.active {
  display: block;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   DASHBOARD VIEW STYLING
   ========================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  right: -50px;
  top: -50px;
  opacity: 0.05;
  background-color: currentColor;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-info h3 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Card color overrides */
.stat-card.blue { color: var(--color-primary); }
.stat-card.blue .stat-icon { background-color: var(--color-primary-light); }
.stat-card.green { color: var(--color-success); }
.stat-card.green .stat-icon { background-color: var(--color-success-light); }
.stat-card.orange { color: var(--color-warning); }
.stat-card.orange .stat-icon { background-color: var(--color-warning-light); }
.stat-card.purple { color: var(--color-purple); }
.stat-card.purple .stat-icon { background-color: var(--color-purple-light); }

.dashboard-widgets {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.widget-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-glass);
}

.widget-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Daily word component style */
.daily-word-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.daily-word-content {
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-md);
  padding: 24px;
  border: 1px solid var(--border-color);
  text-align: center;
  position: relative;
  transition: transform var(--transition-fast);
}

.daily-word-content:hover {
  transform: scale(1.02);
}

.daily-word-zh-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 8px;
}

.daily-word-zh {
  font-size: 48px;
  font-weight: 700;
  font-family: 'Noto Sans SC', serif;
  color: var(--color-danger);
}

.daily-word-pinyin {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.daily-word-vi {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.daily-word-example {
  background-color: var(--bg-sidebar);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  font-size: 14px;
  text-align: left;
  border-left: 4px solid var(--color-success);
}

.daily-word-ex-zh {
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.daily-word-ex-vi {
  color: var(--text-muted);
  margin-top: 4px;
}

/* Shortcuts widget */
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.shortcut-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.shortcut-btn i {
  font-size: 20px;
  color: var(--color-primary);
}

.shortcut-btn:hover {
  background-color: var(--color-primary);
  color: var(--text-white);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.shortcut-btn:hover i {
  color: var(--text-white);
}

/* Saved word lists section */
.saved-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-glass);
  margin-top: 24px;
}

.saved-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-main);
}

.saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.saved-item {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.saved-item-zh {
  font-size: 18px;
  color: var(--color-danger);
  font-family: 'Noto Sans SC', sans-serif;
}

.saved-item-vi {
  color: var(--text-muted);
}

.saved-item .del-btn {
  color: var(--color-danger);
  cursor: pointer;
  font-weight: bold;
  padding: 0 4px;
  transition: transform var(--transition-fast);
}

.saved-item .del-btn:hover {
  transform: scale(1.2);
}

.empty-msg {
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* ==========================================
   VOCAB HUB (TABLE & FILTERS)
   ========================================== */

.filter-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box-container {
  flex-grow: 1;
  position: relative;
  min-width: 250px;
}

.search-box-container i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box-container input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-sidebar);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.search-box-container input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.select-container select {
  padding: 12px 24px 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-sidebar);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.select-container select:focus {
  border-color: var(--color-primary);
}

/* Table styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.vocab-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-sidebar);
  text-align: left;
}

.vocab-table th, .vocab-table td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.vocab-table th {
  background-color: var(--bg-sidebar);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
}

.vocab-table tr {
  transition: background-color var(--transition-fast);
}

.vocab-table tr:hover {
  background-color: var(--color-primary-light);
}

.vocab-table tr:last-child td {
  border-bottom: none;
}

/* Word styling inside table */
.text-vi {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
}

.text-zh-lg {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-danger);
  font-family: 'Noto Sans SC', sans-serif;
  letter-spacing: 1px;
}

.text-pinyin-cell {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

/* Sentences styling inside table */
.sentence-box {
  background-color: var(--bg-primary);
  padding: 12px 16px;
  border-left: 4px solid var(--color-success);
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sentence-zh {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sentence-vi {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Tone styling dynamic rules in JS based on colors */
.t-1 { color: var(--tone-1); font-weight: 600; }
.t-2 { color: var(--tone-2); font-weight: 600; }
.t-3 { color: var(--tone-3); font-weight: 600; }
.t-4 { color: var(--tone-4); font-weight: 600; }
.t-5 { color: var(--tone-5); }

/* Icons / Buttons custom style */
.btn-speaker {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-circle);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-speaker:hover {
  background-color: var(--color-primary);
  color: var(--text-white);
  transform: scale(1.1);
}

.btn-star {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.btn-star.saved {
  color: var(--color-warning);
}

.btn-star:hover {
  transform: scale(1.2);
}

.btn-write {
  background-color: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 30px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 600;
}

.btn-write:hover {
  background-color: var(--color-success);
  color: var(--text-white);
  transform: scale(1.05);
}

/* ==========================================
   WRITING PLAYGROUND VIEW STYLING
   ========================================== */

.writing-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 32px;
  align-items: start;
}

.writing-controls-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.writing-controls-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.writing-select-word, .writing-custom-input {
  margin-bottom: 20px;
}

.writing-select-word label, .writing-custom-input label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.writing-select-word select, .writing-custom-input input {
  width: 100%;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
}

.input-action-group {
  display: flex;
  gap: 8px;
}

.input-action-group input {
  flex-grow: 1;
}

.btn-primary, .btn-secondary, .btn-success, .btn-danger {
  border: none;
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--text-white);
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}
.btn-secondary:hover {
  background-color: var(--color-primary);
  color: var(--text-white);
}

.btn-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}
.btn-success:hover {
  background-color: var(--color-success);
  color: var(--text-white);
}

.btn-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}
.btn-danger:hover {
  background-color: var(--color-danger);
  color: var(--text-white);
}

.writing-modes-btn {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.writing-modes-btn button {
  width: 100%;
  text-align: center;
}

.writing-guide-info {
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  border: 1px dashed var(--border-color);
}

.writing-guide-info h4 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

.writing-guide-info p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

/* Right canvas side */
.writing-board-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 32px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.writing-header {
  margin-bottom: 24px;
}

.writing-header h2 {
  font-size: 32px;
  color: var(--color-danger);
}

.writing-header p {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

#writing-canvas-container {
  display: inline-flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  background-color: var(--bg-primary);
  padding: 24px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  min-height: 200px;
  align-items: center;
}

/* Hanzi writing grids */
.char-box {
  background-color: #ffffff;
  border: 2px solid var(--color-primary);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  /* Grid lines in Chinese writing books */
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.15) 1px, transparent 1px),
    linear-gradient(rgba(59, 130, 246, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.1) 1px, transparent 1px);
  background-size: 100% 50%, 50% 100%, 100% 100%, 100% 100%;
  background-position: center;
}

/* ==========================================
   PRACTICE & QUIZZES VIEW STYLING
   ========================================== */

.practice-modes {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.practice-mode-card {
  flex: 1;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.practice-mode-card i {
  font-size: 24px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.practice-mode-card h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.practice-mode-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.practice-mode-card.active {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
}

.practice-mode-card.active i {
  color: var(--color-primary);
}

/* Flashcard Styles */
.practice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 650px;
  margin: 0 auto;
}

.flashcard-deck {
  perspective: 1000px;
  width: 100%;
  max-width: 650px;
  height: 340px;
  margin: 0 auto 24px auto;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  box-sizing: border-box;
}

.flashcard-front {
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--bg-primary) 100%);
  color: var(--text-main);
}

.flashcard-back {
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--color-primary-light) 100%);
  color: var(--text-main);
  transform: rotateY(180deg);
}

.flashcard-zh {
  font-size: 76px;
  font-weight: 800;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--color-danger);
  margin-bottom: 12px;
}

.btn-audio-pill {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all var(--transition-fast) ease;
  margin-bottom: 10px;
}

.btn-audio-pill:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.45);
}

.btn-audio-pill.mini {
  padding: 4px 12px;
  font-size: 12px;
  margin-bottom: 0;
}

.flashcard-back-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 2px;
}

.flashcard-vi {
  font-size: 30px;
  font-weight: 800;
  color: var(--color-primary);
}

/* Tăng cỡ chữ Pinyin lên to, rõ nét */
.flashcard-pinyin {
  font-size: 28px;
  font-weight: 700;
  font-style: italic;
  color: #3b82f6;
  margin-top: 2px;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}

.flashcard-example {
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-sm);
  padding: 12px 18px;
  text-align: center;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  width: 100%;
  margin-top: 4px;
}

.ex-zh-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.flashcard-example .ex-zh {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Noto Sans SC', sans-serif;
}

.btn-audio-ex {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.15s ease;
}

.btn-audio-ex:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: scale(1.1);
}

.flashcard-example .ex-pinyin {
  font-size: 16px;
  color: #60a5fa;
  font-style: italic;
  margin-top: 3px;
  font-weight: 600;
}

.flashcard-example .ex-vi {
  font-size: 14px;
  color: var(--text-main);
  margin-top: 4px;
  font-weight: 500;
}

.click-hint {
  font-size: 12px;
  color: var(--text-muted);
  position: absolute;
  bottom: 20px;
}

.fc-speak-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 16px;
}

.flashcard-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.btn-nav {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-nav:hover {
  background-color: var(--color-primary);
  color: var(--text-white);
  border-color: var(--color-primary);
}

#fc-counter {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Quiz Box Styles */
.quiz-box {
  width: 100%;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.quiz-progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--bg-primary);
  border-radius: 3px;
  margin-bottom: 24px;
  overflow: hidden;
}

.quiz-progress-bar .progress {
  width: 0%;
  height: 100%;
  background-color: var(--color-primary);
  border-radius: 3px;
  transition: width var(--transition-normal);
}

.quiz-question-card {
  text-align: center;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius-md);
  padding: 30px;
  margin-bottom: 24px;
  position: relative;
}

.quiz-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: var(--color-primary);
  color: var(--text-white);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.quiz-question-card h3 {
  font-size: 44px;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--color-danger);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-opt {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition-fast);
}

.quiz-opt:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
}

.quiz-opt.correct {
  background-color: var(--color-success-light);
  border-color: var(--color-success);
  color: var(--color-success);
  font-weight: 700;
}

.quiz-opt.incorrect {
  background-color: var(--color-danger-light);
  border-color: var(--color-danger);
  color: var(--color-danger);
  text-decoration: line-through;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#quiz-counter, #audio-quiz-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Audio Question Play button */
.btn-audio-play-large {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-purple) 100%);
  color: var(--text-white);
  border: none;
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-circle);
  font-size: 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
  transition: all var(--transition-fast);
  margin-bottom: 12px;
}

.btn-audio-play-large:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.audio-hint-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Result Screen */
.result-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  width: 100%;
}

.result-trophy {
  font-size: 64px;
  color: var(--color-warning);
  margin-bottom: 16px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.result-score {
  font-size: 20px;
  margin-bottom: 8px;
}

.result-score strong {
  font-size: 32px;
  color: var(--color-success);
}

#result-feedback-msg {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* ==========================================
   DICTIONARY VIEW STYLING
   ========================================== */

.dictionary-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dict-search-header {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.dict-search-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.dict-search-header p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.dict-search-bar {
  display: flex;
  gap: 12px;
}

.dict-search-bar input {
  flex-grow: 1;
  padding: 14px 20px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-main);
  outline: none;
  font-size: 15px;
}

.dict-search-bar input:focus {
  border-color: var(--color-primary);
}

.dict-results-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}

.dict-results-list-card, .dict-detail-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  min-height: 400px;
}

.dict-results-list-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text-main);
}

.dict-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dict-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dict-item-row:hover, .dict-item-row.active {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
}

.dict-item-zh {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--color-danger);
}

.dict-item-pinyin {
  font-size: 13px;
  color: var(--text-muted);
}

.dict-item-vi {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* Detail panel */
.dict-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
}

.dict-detail-empty i {
  font-size: 48px;
}

.dict-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.dict-detail-header h2 {
  font-size: 40px;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--color-danger);
  line-height: 1;
  margin-bottom: 4px;
}

.pinyin-badge, .hsk-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.pinyin-badge {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.hsk-badge {
  background-color: var(--color-purple-light);
  color: var(--color-purple);
}

.dict-detail-actions {
  display: flex;
  gap: 8px;
}

.dict-detail-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.detail-vi {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
}

.detail-cat {
  font-size: 14px;
  font-weight: 600;
}

#dict-detail-strokes-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background-color: var(--bg-primary);
  padding: 16px;
  border-radius: var(--border-radius-sm);
  border: 1px dashed var(--border-color);
  margin-bottom: 12px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.dict-detail-footer {
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.btn-full {
  width: 100%;
  text-align: center;
}

/* ==========================================
   ADMIN / DATABASE MANAGER VIEW STYLING
   ========================================== */

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 32px;
  align-items: start;
}

.admin-form-card, .admin-list-card {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.admin-form-card h3, .admin-list-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--color-primary);
}

.required {
  color: var(--color-danger);
}

.form-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 20px 0;
}

.admin-form-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* Admin lists table */
.admin-search-bar {
  margin-bottom: 16px;
}

.admin-search-bar input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-main);
  outline: none;
  font-size: 14px;
}

.admin-table-container {
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
}

.admin-vocab-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.admin-vocab-table th, .admin-vocab-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.admin-vocab-table th {
  background-color: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-vocab-table tr:hover {
  background-color: var(--color-primary-light);
}

.admin-item-zh {
  font-size: 18px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--color-danger);
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.btn-icon {
  background: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition-fast);
}

.btn-icon.edit {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}
.btn-icon.edit:hover {
  color: var(--text-white);
  background-color: var(--color-primary);
}

.btn-icon.delete {
  color: var(--color-danger);
  background-color: var(--color-danger-light);
}
.btn-icon.delete:hover {
  color: var(--text-white);
  background-color: var(--color-danger);
}

/* ==========================================
   MODAL POPUP STYLING
   ========================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 32px;
  border-radius: var(--border-radius-lg);
  max-width: 550px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.show .modal-content {
  transform: scale(1);
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.close-modal:hover {
  color: var(--text-main);
}

#global-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-main);
}

#global-writer-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background-color: var(--bg-primary);
  padding: 20px;
  border-radius: var(--border-radius-md);
  border: 1px dashed var(--border-color);
}

.stroke-speed-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================
   TOAST NOTIFICATION STYLING
   ========================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  border-left: 4px solid var(--color-primary);
  min-width: 250px;
  animation: slideIn var(--transition-fast) forwards;
}

.toast.success { border-left-color: var(--color-success); }
.toast.danger { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }

.toast i {
  font-size: 18px;
}

.toast.success i { color: var(--color-success); }
.toast.danger i { color: var(--color-danger); }
.toast.warning i { color: var(--color-warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.fade-out {
  animation: slideOut var(--transition-fast) forwards;
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ==========================================
   RESPONSIVE DESIGN RULES
   ========================================== */

@media (max-width: 1024px) {
  .writing-layout, .admin-layout, .dict-results-layout {
    grid-template-columns: 1fr;
  }
  
  .dashboard-widgets {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .app-sidebar {
    width: 100%;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px;
  }
  
  .sidebar-footer {
    display: none; /* Hide setting footers in sidebar on mobile to avoid clutter */
  }
  
  .app-content {
    margin-left: 0;
    padding: 16px;
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .user-status {
    align-self: flex-end;
  }
  
  .flashcard-deck {
    height: 280px;
  }
  
  .flashcard-zh {
    font-size: 56px;
  }
  
  .flashcard-vi {
    font-size: 24px;
  }
  
  .practice-modes {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .vocab-table th:nth-child(4), .vocab-table td:nth-child(4) {
    display: none; /* Hide sentences on tiny screens */
  }
  
  .vocab-table th:nth-child(5), .vocab-table td:nth-child(5) {
    display: none; /* Hide draw stroke buttons on tiny screens */
  }
}

/* ==========================================
   BOOKMARK CUSTOM LISTS & POP-OVER STYLING
   ========================================== */

.bookmark-popover {
  position: absolute;
  z-index: 1050;
  width: 260px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.popover-header span {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.popover-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  transition: color var(--transition-fast);
}

.popover-close:hover {
  color: var(--color-danger);
}

.popover-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 13.5px;
}

.popover-item:hover {
  background-color: var(--color-primary-light);
}

.popover-item input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.popover-list-name {
  flex-grow: 1;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-list-count {
  color: var(--text-muted);
  font-size: 11px;
}

.popover-footer {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.popover-footer input {
  flex-grow: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 12px;
  background-color: var(--bg-primary);
  color: var(--text-main);
  outline: none;
}

.popover-footer input:focus {
  border-color: var(--color-primary);
}

.popover-footer button {
  background-color: var(--color-primary);
  color: var(--text-white);
  border: none;
  padding: 6px 10px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.popover-footer button:hover {
  background-color: var(--color-primary-hover);
}

/* Dashboard Saved Section Header & Tabs */
.saved-words-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.saved-words-header h2 {
  margin-bottom: 0 !important;
}

.saved-list-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.saved-lists-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-grow: 1;
}

.saved-tab-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.saved-tab-btn:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.saved-tab-btn.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-white);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.saved-list-actions {
  display: flex;
  gap: 8px;
}

.btn-icon-sm {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 13px;
}

.btn-icon-sm:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-icon-sm.delete-list:hover {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
  border-color: var(--color-danger);
}

/* ==========================================================================
   SAVED VOCABULARY NOTEBOOK TAB & CUSTOM TEST PLAYER STYLES
   ========================================================================== */

/* Layout */
.saved-vocab-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 992px) {
  .saved-vocab-layout {
    grid-template-columns: 1fr;
  }
}

/* Cột Trái: Thư mục học */
.vocab-lists-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-glass);
}

.lists-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.lists-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lists-sidebar-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.lists-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lists-sidebar-item:hover {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateX(4px);
}

.lists-sidebar-item.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--text-white);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.lists-sidebar-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.lists-sidebar-item-count {
  font-size: 11px;
  font-weight: 700;
  background-color: var(--border-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.lists-sidebar-item.active .lists-sidebar-item-count {
  background-color: rgba(255, 255, 255, 0.2);
  color: var(--text-white);
}

/* Cột Phải: Main panel */
.vocab-words-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.vocab-words-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.vocab-words-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.list-meta-stats {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.list-rename-delete-row {
  display: flex;
  gap: 8px;
}

/* Panel thiết lập bài kiểm tra tự chọn */
.test-config-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-glass);
}

.test-card-header {
  margin-bottom: 20px;
}

.test-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.test-card-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.test-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.test-config-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.test-config-item label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.test-config-item select {
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.test-config-item select:focus {
  border-color: var(--color-primary);
}

.test-start-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.selected-words-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 6px 16px;
  border-radius: 20px;
}

/* Bảng danh sách từ học */
.vocab-words-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.table-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.select-all-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
}

.select-all-label input[type="checkbox"],
.vocab-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.action-buttons-group {
  display: flex;
  gap: 8px;
}

/* OVERLAY LÀM BÀI THI CỰC ĐẸP */
.test-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.98);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.test-overlay.show {
  display: flex;
  opacity: 1;
}

.test-overlay-content {
  background: var(--bg-sidebar);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 800px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.test-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.test-info-meta {
  display: flex;
  gap: 12px;
}

.test-title-badge {
  background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
  color: var(--text-white);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}

.test-timer-badge {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.close-test-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--transition-fast);
}

.close-test-btn:hover {
  color: var(--color-danger);
}

/* Progress bar */
.test-progress-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
}

.test-progress-track {
  flex-grow: 1;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.test-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success));
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

.test-progress-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Question Area */
.test-question-area {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
  text-align: center;
}

.test-q-instruction {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 16px;
}

.test-q-main {
  font-size: 64px;
  font-weight: 800;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-main);
  margin-bottom: 24px;
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.test-q-meta {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 30px;
}

/* Multiple choice buttons */
.test-options-layout {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .test-options-layout {
    grid-template-columns: 1fr;
  }
}

.test-opt-btn {
  background-color: var(--bg-primary);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  padding: 18px 24px;
  border-radius: var(--border-radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.test-opt-btn:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-light);
  transform: translateY(-2px);
}

.test-opt-btn.correct {
  border-color: var(--color-success);
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.test-opt-btn.incorrect {
  border-color: var(--color-danger);
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* Typing answer styles */
.test-typing-layout {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-input-field {
  width: 100%;
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 18px;
  font-weight: 600;
  outline: none;
  text-align: center;
  transition: all var(--transition-fast);
}

.test-input-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.test-input-field.correct {
  border-color: var(--color-success);
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.test-input-field.incorrect {
  border-color: var(--color-danger);
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.test-feedback-box {
  font-size: 15px;
  font-weight: 600;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  display: none;
  animation: fadeIn var(--transition-fast);
}

.test-feedback-box.correct {
  display: block;
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.test-feedback-box.incorrect {
  display: block;
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

/* Canvas writing mode styles */
.test-canvas-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.test-canvas-boxes-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.test-canvas-guide-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Action Area */
.test-action-area {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

/* Results section */
.test-result-area {
  animation: fadeIn 0.4s ease-out;
}

.result-header {
  text-align: center;
  margin-bottom: 32px;
}

.result-header .trophy-icon {
  font-size: 64px;
  color: var(--color-warning);
  margin-bottom: 12px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.result-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 20px;
}

.result-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.result-stat-box {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.result-stat-box .stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-primary);
}

.result-stat-box .stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

.result-mistakes-section {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-top: 24px;
  text-align: left;
}

.result-mistakes-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.mistake-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  gap: 12px;
  flex-wrap: wrap;
}

.mistake-item-q {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mistake-item-icon {
  font-size: 16px;
}

.mistake-item-icon.correct { color: var(--color-success); }
.mistake-item-icon.incorrect { color: var(--color-danger); }

.mistake-item-zh {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
}

.mistake-item-vi {
  font-size: 13px;
  color: var(--text-muted);
}

.mistake-item-ans {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.mistake-item-ans .user-ans {
  color: var(--color-danger);
  margin-right: 8px;
}

.mistake-item-ans .user-ans.correct {
  color: var(--color-success);
}

.mistake-item-ans .correct-ans {
  color: var(--color-success);
  background-color: var(--color-success-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.audio-hint-btn-sm {
  background: var(--color-primary-light);
  border: none;
  color: var(--color-primary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.audio-hint-btn-sm:hover {
  background: var(--color-primary);
  color: var(--text-white);
}

/* ==========================================================================
   GRAMMAR HUB TAB STYLES
   ========================================================================== */

.grammar-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

@media (max-width: 576px) {
  .grammar-list-grid {
    grid-template-columns: 1fr;
  }
}

.grammar-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-glass);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.grammar-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15);
}

.grammar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.grammar-badges {
  display: flex;
  gap: 6px;
}

.grammar-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

.structure-box {
  background: var(--bg-primary);
  border-left: 4px solid var(--color-primary);
  padding: 10px 14px;
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary);
}

.grammar-explanation {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.grammar-examples-box {
  border-top: 1px dashed var(--border-color);
  padding-top: 14px;
}

.grammar-examples-box h5 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.grammar-example-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.grammar-example-item:last-child {
  margin-bottom: 0;
}

.grammar-ex-zh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.grammar-ex-zh {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  font-family: 'Noto Sans SC', sans-serif;
}

.grammar-ex-pinyin {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.grammar-ex-vi {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
  margin-top: 4px;
}

/* ==========================================
   COSMIC TIMELINE & MIND MAP DESIGN SYSTEM
   ========================================== */

#timeline-tab {
  padding: 0;
  overflow: hidden;
  border-radius: var(--border-radius-md);
}

.cosmic-layout {
  display: flex;
  gap: 24px;
  min-height: calc(100vh - 180px);
  position: relative;
  background: radial-gradient(circle at 50% 50%, #0c0f2b 0%, #03040c 100%);
  color: #e2e8f0;
  padding: 24px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Nền sao lấp lánh animated stars */
.cosmic-stars-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.cosmic-stars-bg::before,
.cosmic-stars-bg::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 90px 40px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 130px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(2.5px 2.5px at 160px 120px, #a5b4fc, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 200px 50px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 250px 210px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 300px 90px, #818cf8, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 350px 150px, #fff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 400px 400px;
  opacity: 0.45;
  animation: cosmicStarTwinkle 12s infinite linear;
}

.cosmic-stars-bg::after {
  background-size: 300px 300px;
  opacity: 0.3;
  animation: cosmicStarTwinkle 20s infinite linear reverse;
}

@keyframes cosmicStarTwinkle {
  0% { transform: translateY(0); opacity: 0.3; }
  50% { opacity: 0.8; }
  100% { transform: translateY(-100px); opacity: 0.3; }
}

/* Sidebar điều khiển trong vũ trụ */
.cosmic-control-panel {
  position: relative;
  z-index: 10;
  width: 280px;
  background: rgba(10, 12, 30, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.cosmic-panel-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #a5b4fc;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(165, 180, 252, 0.4);
}

.cosmic-panel-header p {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.cosmic-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cosmic-stat-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  padding: 12px 6px;
  text-align: center;
}

.cosmic-stat-item .stat-num {
  font-size: 24px;
  font-weight: 800;
  color: #818cf8;
  display: block;
  text-shadow: 0 0 10px rgba(129, 140, 248, 0.4);
}

.cosmic-stat-item .stat-label {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 4px;
  display: block;
}

/* Nút Cosmic Neon */
.btn-cosmic {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-cosmic:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.7);
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}

.animate-rocket {
  animation: rocketFloat 2s ease-in-out infinite;
}

@keyframes rocketFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px) translateX(2px); }
}

.cosmic-help-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(99, 102, 241, 0.2);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  margin-top: auto;
}

.cosmic-help-card h4 {
  font-size: 13px;
  color: #a5b4fc;
  margin-bottom: 6px;
}

.cosmic-help-card p {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
}

/* Khung sơ đồ Mind Map */
.cosmic-mindmap-area {
  flex-grow: 1;
  overflow: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(5, 5, 15, 0.3);
  position: relative;
  z-index: 5;
  cursor: grab;
}

.cosmic-mindmap-area:active {
  cursor: grabbing;
}

.mindmap-wrapper {
  position: relative;
  width: 1400px;
  height: 900px;
  margin: 0 auto;
}

/* SVG vẽ đường nối */
.mindmap-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.mindmap-svg path {
  fill: none;
  stroke: rgba(99, 102, 241, 0.35);
  stroke-width: 2.5;
  stroke-dasharray: 6, 6;
  filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.6));
  animation: pathDashOffset 30s infinite linear;
}

@keyframes pathDashOffset {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Trục Thiên Hà Dọc */
.timeline-galaxy-axis {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 100%;
  background: linear-gradient(to bottom, 
    rgba(99, 102, 241, 0) 0%, 
    rgba(99, 102, 241, 0.7) 10%, 
    rgba(139, 92, 246, 0.7) 90%, 
    rgba(139, 92, 246, 0) 100%);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.8), 0 0 40px rgba(139, 92, 246, 0.5);
  z-index: 2;
}

.galaxy-core {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background: radial-gradient(circle, #ffffff 0%, rgba(99,102,241,0.8) 40%, rgba(0,0,0,0) 80%);
  border-radius: 50%;
  box-shadow: 0 0 30px #ffffff;
  animation: galaxyPulse 3s infinite ease-in-out;
}

@keyframes galaxyPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* Các hành tinh bài đăng (Planet Nodes) */
.timeline-nodes-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
}

.planet-node {
  position: absolute;
  width: 80px;
  height: 80px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: planetFloat 6s ease-in-out infinite alternate;
  will-change: transform;
}

.planet-node:nth-child(even) {
  animation-duration: 8s;
  animation-delay: -2s;
}

@keyframes planetFloat {
  from { transform: translate(-50%, -50%) translateY(-5px); }
  to { transform: translate(-50%, -50%) translateY(5px); }
}

.planet-ring {
  position: absolute;
  width: 104px;
  height: 104px;
  border: 1px dashed rgba(129, 140, 248, 0.4);
  border-radius: 50%;
  animation: spinRing 20s infinite linear;
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.05);
}

.planet-node:hover .planet-ring {
  border-color: #818cf8;
  border-style: solid;
  box-shadow: 0 0 15px rgba(129, 140, 248, 0.3);
}

@keyframes spinRing {
  100% { transform: rotate(360deg); }
}

.planet-core {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #4f46e5 0%, #1e1b4b 100%);
  border: 2px solid rgba(165, 180, 252, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.6), inset -5px -5px 15px rgba(0,0,0,0.6);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
  z-index: 2;
}

.planet-core img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.planet-node:hover .planet-core {
  transform: scale(1.12);
  border-color: #ffffff;
  box-shadow: 0 0 30px rgba(165, 180, 252, 0.9), inset -2px -2px 10px rgba(0,0,0,0.4);
}

/* Nhãn hành tinh bên cạnh */
.planet-label {
  position: absolute;
  width: 200px;
  background: rgba(10, 11, 24, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(165, 180, 252, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
  z-index: 1;
  pointer-events: none;
  transition: all 0.3s ease;
}

.planet-node.pos-left .planet-label {
  right: 92px;
  text-align: right;
}

.planet-node.pos-right .planet-label {
  left: 92px;
  text-align: left;
}

.planet-node:hover .planet-label {
  border-color: rgba(165, 180, 252, 0.7);
  background: rgba(15, 17, 36, 0.9);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 10px rgba(165, 180, 252, 0.2);
}

.planet-label-author {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.planet-label-text {
  font-size: 11px;
  color: #94a3b8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-bottom: 4px;
}

.planet-label-time {
  font-size: 9px;
  color: #64748b;
  display: block;
}

/* Mốc thời gian trên Trục Thiên Hà */
.timeline-stem-marker {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #818cf8;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 700;
  color: #a5b4fc;
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.5);
  z-index: 4;
}

/* ==========================================
   COSMIC MODAL (GLASSMORPHISM POPUP)
   ========================================== */

.modal-content.cosmic-modal {
  background: rgba(11, 13, 33, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(165, 180, 252, 0.3);
  color: #e2e8f0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.15);
}

.modal-content.cosmic-modal .modal-header-title {
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(165, 180, 252, 0.4);
}

.modal-content.cosmic-modal .form-group label {
  color: #a5b4fc;
  font-weight: 600;
}

.modal-content.cosmic-modal input[type="text"],
.modal-content.cosmic-modal textarea {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(165, 180, 252, 0.25);
  color: #ffffff;
  border-radius: 8px;
  outline: none;
  transition: all 0.3s ease;
}

.modal-content.cosmic-modal input[type="text"]:focus,
.modal-content.cosmic-modal textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.3);
  background: rgba(0, 0, 0, 0.5);
}

/* Chọn avatar vũ trụ */
.avatar-selection-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  padding: 16px;
}

.preset-avatars {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.avatar-option {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avatar-option:hover {
  transform: scale(1.12);
  border-color: rgba(165, 180, 252, 0.6);
  background: rgba(165, 180, 252, 0.15);
}

.avatar-option.active {
  border-color: #818cf8;
  background: rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.6);
  transform: scale(1.12);
}

.avatar-upload-divider {
  text-align: center;
  font-size: 11px;
  color: #64748b;
  position: relative;
  margin: 16px 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.avatar-upload-divider::before,
.avatar-upload-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
}

.avatar-upload-divider::before { left: 0; }
.avatar-upload-divider::after { right: 0; }

.custom-avatar-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #818cf8;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.4);
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-preview.hidden {
  display: none !important;
}

/* Upload ảnh đính kèm bài viết */
.image-upload-wrapper {
  position: relative;
}

.image-preview-box {
  margin-top: 14px;
  position: relative;
  border-radius: 8px;
  border: 1px solid rgba(165, 180, 252, 0.3);
  overflow: hidden;
  max-height: 200px;
}

.image-preview-box img {
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
  display: block;
}

.remove-preview-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  transition: background 0.2s;
}

.remove-preview-btn:hover {
  background: #dc2626;
}

.image-preview-box.hidden {
  display: none !important;
}

/* Bố cục Modal chi tiết bài viết (Post Detail Modal) */
.modal-content.cosmic-modal.wide-modal {
  max-width: 900px;
  width: 90%;
  padding: 0;
  overflow: hidden;
}

.post-detail-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  min-height: 500px;
  max-height: calc(100vh - 120px);
}

@media (max-width: 768px) {
  .post-detail-layout {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
}

.post-main-content {
  padding: 30px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-detail-author-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.post-detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, #4f46e5 0%, #1e1b4b 100%);
  border: 2px solid rgba(165, 180, 252, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.post-detail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-detail-meta h3 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.post-detail-meta span {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  display: block;
}

.post-detail-body-text {
  font-size: 15px;
  line-height: 1.6;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-detail-image-box {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.post-detail-image-box img {
  width: 100%;
  height: auto;
  max-height: 350px;
  object-fit: contain;
  background: #03040c;
  display: block;
}

.post-detail-image-box.hidden {
  display: none !important;
}

/* Khu vực bình luận */
.post-comments-section {
  padding: 30px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.post-comments-section h4 {
  font-size: 15px;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comments-list {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 6px;
}

.comment-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  gap: 12px;
  animation: commentFadeIn 0.3s ease-out;
}

@keyframes commentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(165, 180, 252, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comment-info {
  flex-grow: 1;
  min-width: 0;
}

.comment-author-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.comment-author-name {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comment-time {
  font-size: 9px;
  color: #64748b;
}

.comment-content-text {
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  word-break: break-word;
}

/* Form Comment */
#cosmic-comment-form {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  flex-shrink: 0;
}

.comment-form-header {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 12px;
}

.form-group-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.preset-avatars.mini-presets {
  gap: 8px;
  margin-bottom: 0;
  justify-content: flex-start;
}

.preset-avatars.mini-presets .avatar-option {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

.custom-avatar-upload.mini-upload {
  gap: 8px;
}

.custom-avatar-upload.mini-upload button {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 12px;
}

.avatar-preview.mini-preview {
  width: 32px;
  height: 32px;
}

/* Trạng thái tắt nút gửi bình luận */
#btn-submit-comment:disabled {
  background: rgba(99, 102, 241, 0.2);
  color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: none;
  cursor: not-allowed;
}

/* Đồng bộ lớp modal hiển thị rộng */
.modal-content.cosmic-modal.wide-modal {
  border-radius: 16px;
}

/* Responsive fixes */
@media (max-width: 1024px) {
  .cosmic-layout {
    flex-direction: column;
    min-height: auto;
  }
  .cosmic-control-panel {
    width: 100%;
  }
  .cosmic-mindmap-area {
    min-height: 600px;
  }
}

/* ==========================================
   USER ACCOUNT & AUTHENTICATION STYLING
   ========================================== */
.sidebar-user-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(165, 180, 252, 0.15);
  border-radius: var(--border-radius-md);
  padding: 12px;
  margin: 10px 14px 20px 14px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 0 10px rgba(99, 102, 241, 0.05);
  transition: all 0.3s ease;
}

.sidebar-user-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15), inset 0 0 12px rgba(99, 102, 241, 0.08);
}

.user-guest-view, .user-logged-view {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-avatar, .logged-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  border: 1.5px solid var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
}

.guest-avatar {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
  color: var(--text-muted);
}

.guest-info, .logged-info {
  flex-grow: 1;
  min-width: 0;
}

.guest-info h4, .logged-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guest-info span, .logged-info span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-login-trigger, .btn-logout-trigger {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-login-trigger:hover {
  color: var(--color-primary);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.btn-logout-trigger:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Modal Auth Tab buttons */
.auth-tab-btn {
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  transition: all 0.3s;
}

.auth-tab-btn:hover {
  color: #fff !important;
}

.auth-tab-btn.active {
  color: var(--color-primary) !important;
  border-bottom-color: var(--color-primary) !important;
}

#authModal input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(165, 180, 252, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  outline: none;
  font-size: 14px;
  transition: all 0.3s ease;
}

#authModal input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
  background: rgba(0, 0, 0, 0.5);
}

/* Timeline Auth required message */
.timeline-auth-required-msg {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
}

.timeline-auth-required-msg i {
  color: var(--color-primary);
  text-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

/* Avatar customization */
.logged-avatar img, .user-info-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#authModal .avatar-option:hover, #createPostModal .avatar-option:hover, #postDetailModal .avatar-option:hover {
  border-color: var(--color-primary);
  transform: scale(1.1);
  background: rgba(99, 102, 241, 0.15);
}

#authModal .avatar-option.active, #createPostModal .avatar-option.active, #postDetailModal .avatar-option.active {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.25);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

/* ==========================================
   LUYỆN NGHE & DỊCH (PRACTICE SKILLS) TAB STYLING
   ========================================== */

.skills-practice-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.skills-selector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skills-type-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.skill-pill {
  flex: 1;
  min-width: 150px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 12px 18px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast) ease;
}

.skill-pill:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.skill-pill.active {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.skills-hsk-pills {
  display: flex;
  gap: 12px;
}

.hsk-pill {
  flex: 1;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 10px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast) ease;
}

.hsk-pill:hover {
  border-color: var(--color-success);
  color: var(--color-success);
  background: rgba(16, 185, 129, 0.08);
}

.hsk-pill.active {
  background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
  color: #ffffff;
  border-color: var(--color-success);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Workspace Grid */
.skills-workspace-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .skills-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.skills-list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  max-height: 750px;
  display: flex;
  flex-direction: column;
}

.skills-list-panel h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.skills-exercises-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.exercise-item {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exercise-item:hover {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.03);
  transform: translateX(4px);
}

.exercise-item.active {
  border-color: var(--color-primary);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.exercise-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exercise-item-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-main);
}

.exercise-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.exercise-status-badge.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.exercise-status-badge.unstarted {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Arena Panel */
.skills-arena-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 30px;
  box-shadow: var(--shadow-md);
  min-height: 450px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.arena-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 40px;
  color: var(--text-muted);
}

.arena-empty-state i {
  font-size: 56px;
  color: var(--color-primary);
  margin-bottom: 20px;
  opacity: 0.7;
}

.arena-empty-state h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.arena-empty-state p {
  font-size: 13.5px;
  max-width: 480px;
  line-height: 1.6;
}

.arena-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.arena-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arena-header-options {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.switch-toggle.mini-switch {
  width: 36px;
  height: 20px;
}

.switch-toggle.mini-switch .slider-round:before {
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
}

.switch-toggle.mini-switch input:checked + .slider-round:before {
  transform: translateX(16px);
}

.arena-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}

.skill-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Arena Vocab Container Styling */
.arena-vocab-container {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.vocab-container-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.vocab-container-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.vocab-batch-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.batch-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-save-batch {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.btn-save-batch:hover {
  background: var(--color-primary);
  color: #ffffff;
  transform: translateY(-1px);
}

.arena-vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.arena-vocab-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.arena-vocab-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.arena-vocab-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.arena-vocab-word-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.arena-vocab-word {
  font-size: 16px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-main);
  line-height: 1.2;
}

.arena-vocab-pinyin {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.arena-vocab-vi {
  font-size: 12px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-bookmark-card {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.15s ease;
}

.btn-bookmark-card:hover, .btn-bookmark-card.saved {
  color: var(--color-warning);
  transform: scale(1.15);
}

/* Cosmic Player Container */
.cosmic-player-container {
  background: linear-gradient(135deg, rgba(30, 27, 75, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--border-radius-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn-player-play, .btn-player-stop {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast) ease;
}

.btn-player-play {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.btn-player-play:hover {
  background: #4f46e5;
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
}

.btn-player-stop {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-player-stop:hover {
  background: var(--color-danger);
  color: #ffffff;
  transform: scale(1.08);
}

.player-speed-control {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-speed-control label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.player-speed-control input[type="range"] {
  width: 100px;
  cursor: pointer;
}

.player-subtitle-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Subtitle and highlighting container */
.arena-subtitles-container {
  min-height: 80px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.subtitle-placeholder {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.subtitle-char-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.subtitle-pinyin {
  font-size: 11px;
  color: #93c5fd; /* Light blue for high contrast on cosmic dark background */
  font-style: italic;
  margin-bottom: 2px;
}

.subtitle-char {
  font-size: 24px;
  font-family: 'Noto Sans SC', sans-serif;
  color: #f8fafc; /* Warm bright off-white for high contrast on cosmic dark background */
  line-height: 1.2;
}

.subtitle-punctuation {
  color: #cbd5e1; /* Light grey for high contrast */
}

/* Glowing Neon Highlight - Amber/Gold for extreme contrast and premium feel */
.subtitle-char-wrapper.highlight {
  background: rgba(250, 204, 21, 0.2);
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.5), inset 0 0 10px rgba(250, 204, 21, 0.2);
  transform: scale(1.15);
  border: 1px solid rgba(250, 204, 21, 0.6);
}

.subtitle-char-wrapper.highlight .subtitle-char {
  color: #facc15;
  text-shadow: 0 0 10px rgba(250, 204, 21, 0.8), 0 0 20px rgba(250, 204, 21, 0.4);
}

.subtitle-char-wrapper.highlight .subtitle-pinyin {
  color: #fef08a;
  font-weight: 600;
  text-shadow: 0 0 5px rgba(254, 240, 138, 0.5);
}

/* Cosmic player text contrast overrides */
.cosmic-player-container .player-subtitle-toggle {
  color: #cbd5e1;
}

.cosmic-player-container .player-speed-control label {
  color: #cbd5e1;
}

.cosmic-player-container .subtitle-placeholder {
  color: #94a3b8;
}

/* Player Seek Progress Bar styling */
.player-progress-container {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  width: 100%;
}

.player-progress-container .progress-time,
.player-progress-container .progress-total {
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
  min-width: 35px;
  text-align: center;
}

.arena-seek-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-primary) var(--seek-percent, 0%), rgba(255, 255, 255, 0.15) var(--seek-percent, 0%));
  outline: none;
  cursor: pointer;
}

.arena-seek-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.8);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.arena-seek-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 12px rgba(99, 102, 241, 1), 0 0 20px rgba(99, 102, 241, 0.5);
}

.arena-seek-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.arena-seek-slider::-moz-range-progress {
  height: 6px;
  background: var(--color-primary);
  border-radius: 3px;
}

.arena-seek-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.8);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.arena-seek-slider::-moz-range-thumb:hover {
  transform: scale(1.25);
  box-shadow: 0 0 12px rgba(99, 102, 241, 1);
}

/* Prompt Translation Container */
.arena-prompt-container {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 20px;
  margin-bottom: 24px;
}

.arena-prompt-container h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.prompt-text-box {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
}

/* Answer and controls */
.arena-answer-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.arena-answer-container label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.arena-answer-container textarea {
  width: 100%;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition-fast) ease;
}

.arena-answer-container textarea:focus {
  border-color: var(--color-primary);
}

.arena-submit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

/* AI grading result */
.arena-result-container {
  animation: fadeIn var(--transition-normal) ease;
}

.result-divider {
  border: none;
  height: 1px;
  background: var(--border-color);
  margin: 24px 0;
}

.arena-result-container h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-summary-row {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
  background: var(--bg-sidebar);
  border-radius: var(--border-radius-md);
  padding: 20px;
  border: 1px solid var(--border-color);
}

@media (max-width: 600px) {
  .result-summary-row {
    flex-direction: column;
    text-align: center;
  }
}

.score-circle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
  border: 3px solid var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
  position: relative;
}

.score-circle .score-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--color-success);
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.score-circle .score-max {
  font-size: 11px;
  color: var(--text-muted);
  position: absolute;
  bottom: 18px;
}

.score-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.feedback-comment-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-comment-box h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.feedback-comment-box p {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
}

.result-mistakes-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-mistakes-box h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.mistakes-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
}

.mistakes-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.mistakes-table th, .mistakes-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.mistakes-table th {
  background-color: var(--bg-sidebar);
  font-weight: 700;
  color: var(--text-muted);
}

.mistakes-table tr:last-child td {
  border-bottom: none;
}

.mistakes-table td.cell-original {
  color: var(--color-danger);
  font-weight: 500;
  background-color: rgba(239, 68, 68, 0.02);
}

.mistakes-table td.cell-correction {
  color: var(--color-success);
  font-weight: 600;
  background-color: rgba(16, 185, 129, 0.02);
}

.mistakes-table td.cell-explanation {
  color: var(--text-main);
  line-height: 1.5;
}

/* Loading state spinner */
.arena-grading-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 30px;
}

.arena-grading-loader .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AI Custom Translation Test Styling */
.ai-test-loader {
  text-align: center;
  padding: 40px 20px;
}

.ai-custom-test-container {
  padding: 10px 0;
  animation: fadeIn 0.3s ease;
}

.ai-integrated-words {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.ai-word-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ai-word-chip {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.ai-prompt-box {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--border-radius-md);
  padding: 18px;
  margin-bottom: 16px;
}

.ai-chinese-text {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Noto Sans SC', sans-serif;
  color: var(--text-main);
  line-height: 1.6;
}

.ai-vietnamese-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.5;
}

/* FLOATING AI CHAT ASSISTANT STYLES */
.ai-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  padding: 12px 20px 12px 16px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ai-chat-bubble:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.bubble-icon-wrapper {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.bubble-label {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.ai-chat-window {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: slideUpChat 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpChat {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-chat-header {
  padding: 14px 18px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-header-avatar {
  width: 40px;
  height: 40px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.ai-chat-title h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.online-status {
  font-size: 11.5px;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.online-status i {
  font-size: 8px;
}

.btn-close-chat {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
}

.btn-close-chat:hover {
  color: var(--color-danger);
  transform: rotate(90deg);
}

.ai-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-sidebar);
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.chat-message.ai-message {
  align-self: flex-start;
}

.chat-message.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.chat-message.user-message .chat-avatar {
  background: #4f46e5;
  color: #ffffff;
}

.chat-bubble-content {
  display: flex;
  flex-direction: column;
}

.chat-bubble-text {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.ai-message .chat-bubble-text {
  background: var(--bg-primary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
}

.user-message .chat-bubble-text {
  background: linear-gradient(135deg, var(--color-primary) 0%, #4f46e5 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  font-weight: 500;
}

.ai-chat-quick-prompts {
  padding: 8px 12px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.ai-chat-quick-prompts::-webkit-scrollbar {
  height: 4px;
}

.quick-prompt-btn {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.quick-prompt-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.ai-chat-footer {
  padding: 12px 14px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-footer input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.ai-chat-footer input:focus {
  border-color: var(--color-primary);
}

.btn-send-chat {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s;
}

.btn-send-chat:hover {
  background: #4f46e5;
  transform: scale(1.08);
}

/* SHARED VOCAB BOX IN COSMIC POSTS */
.shared-vocab-box {
  margin-top: 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shared-vocab-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shared-vocab-icon {
  width: 42px;
  height: 42px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.shared-vocab-info h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.shared-vocab-info p {
  margin: 2px 0 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}



