:root {
  --primary: #123d30;
  --ink: #123d30;
  --ink-deep: #0a2a20;
  --green: #246247;
  --sage: #dbe7d7;
  --sage-2: #eff4ec;
  --paper: #fbfaf5;
  --cream: #f4f1e8;
  --line: #dfe4dc;
  --muted: #66746d;
  --orange: #c58536;
  --danger: #ae4c3f;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-card: #ffffff;
  --surface-hover: #f1f5f2;
  --serif: Georgia, serif;
  --sans: Inter, sans-serif;
  --unbounded: "Unbounded", sans-serif;
  --font-brand: "Unbounded", sans-serif;
}

html.dark-theme,
body.dark-theme {
  --primary: #34d399;
  --ink: #e2e8f0;
  --ink-deep: #f8fafc;
  --green: #4ade80;
  --sage: #1e293b;
  --sage-2: #16202c;
  --paper: #11161b;
  --cream: #182028;
  --line: #263341;
  --muted: #94a3b8;
  --orange: #fbbf24;
  --danger: #f87171;
  --surface-bg: #161f28;
  --surface: #182028;
  --surface-2: #1e2832;
  --surface-card: #182028;
  --surface-hover: #222e3b;
  --text: #e2e8f0;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: no-preference) {

  /* Chặn smooth scroll khi đang nhập liệu để tránh Safari/Chrome cuộn giật màn hình ngoài */
  html:not(:has(input:focus, textarea:focus, select:focus, [contenteditable]:focus, .ql-editor:focus)) {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font: 15px/1.65 var(--sans);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0 !important;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main#mainContent,
main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
}

.page,
.page.active-page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.christmas-header-garland {
  max-width: 100vw;
  overflow: hidden;
}

/* Tối ưu typography chống rớt chữ và cân bằng dòng tự động */
h1,
h2,
h3,
h4,
h5,
h6,
.hero-title,
.preview-card-title,
.comp-card-title,
.rules-heading,
.section-title,
.modal-header h2,
.arena-locked-title {
  text-wrap: balance;
  word-break: normal;
  overflow-wrap: break-word;
}

p,
.post-copy-preview,
.detail-copy,
.document-desc,
.rules-intro-text {
  text-wrap: pretty;
  word-break: normal;
  overflow-wrap: break-word;
}

/* Các nhãn, huy hiệu, nút và chỉ số không bao giờ bị rớt chữ */
.badge,
.tag,
.post-tag,
.lb-rank-badge,
.you-tag,
.status-pill,
.streak-badge,
.topic-chip,
.filter-chip,
.pill-btn,
.button,
.mobile-nav-label,
.post-metric-pill,
.stat-badge,
.comp-lb-score,
.podium-score,
.stand-num,
.nc-identity-notice,
.lb-phase-btn,
.nc-role-badge,
.tab-btn,
.streak-tier-label {
  white-space: nowrap;
}

/* Modal Open & Scroll Locking across all browsers & devices */
html.modal-scroll-locked,
body.modal-scroll-locked {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
}

html:has(dialog[open]),
body:has(dialog[open]) {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  -webkit-overflow-scrolling: auto !important;
}

dialog[open] {
  overscroll-behavior: contain !important;
  touch-action: auto !important;
  pointer-events: auto !important;
}

dialog::backdrop {
  overscroll-behavior: none !important;
  pointer-events: auto !important;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  z-index: 10;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #a1c09d;
  outline-offset: 3px;
}

.site-header {
  height: 76px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 calc(max(36px, (100% - 1280px) / 2 + 36px));
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(251, 250, 245, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 3px rgba(10, 44, 30, 0.03);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.site-header .desktop-nav,
.site-header .header-actions {
  cursor: default;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6.5px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 15.5px;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.brand-text,
.brand>span:not(.brand-mark) {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  position: relative;
  top: 0;
  transform: translateY(0.75px);
}

.brand img,
.brand-mark img {
  width: 23px;
  height: 23px;
  object-fit: contain;
  border-radius: 0 !important;
  display: block;
  flex-shrink: 0;
  box-shadow: none !important;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
  border-radius: 0 !important;
  flex-shrink: 0;
  position: relative;
  width: 23px;
  height: 23px;
}

.brand span {
  white-space: nowrap !important;
}

.brand-colon {
  color: #8faf82;
  white-space: nowrap !important;
  display: inline-block;
  transform: translateY(-0.5px);
}

.brand>span:last-child {
  white-space: nowrap !important;
}

.desktop-nav {
  display: flex;
  gap: 6px;
  margin-left: clamp(12px, 3vw, 48px);
  align-items: center;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.nav-link {
  color: #586961;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap !important;
  transition: all 0.16s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(18, 61, 48, 0.05);
}

.nav-link.active {
  color: var(--primary);
  background: var(--sage-2);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(18, 61, 48, 0.06);
}

.desktop-nav .nav-link-icon {
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.desktop-nav .nav-link-icon svg {
  display: block;
}

.desktop-nav .nav-link-text {
  display: inline;
  white-space: nowrap !important;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-button:hover {
  background: var(--sage-2);
  border-color: var(--line);
  color: var(--primary);
}

.post-card.admin-post {
  background-color: #f0f9ff;
}

.post-card.admin-post:hover {
  background-color: #e0f2fe;
}

.profile-chip {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 4px 12px 4px 5px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: var(--ink);
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  height: 36px;
  box-sizing: border-box;
}

.profile-chip:hover {
  background: var(--paper);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.profile-chip-text {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap !important;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

.profile-chip b {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #dbe8d8;
  color: #286143;
  margin-left: 3px;
}

.chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  line-height: 1;
}

/* ==========================================================================
   QUICK USER ACTION MENU (Circular Animated Hamburger & Dropdown)
   ========================================================================== */
.quick-user-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.quick-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
}

.quick-menu-btn:hover {
  background: var(--paper);
  border-color: #cbd5e1;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.quick-user-menu-wrap.open .quick-menu-btn,
.quick-menu-btn.active {
  background: var(--surface, #eff4ec);
  border-color: var(--primary, #2d6a4f);
  color: var(--primary, #2d6a4f);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.15);
}

/* Hamburger to X Animation */
.hamburger-box {
  width: 14px;
  height: 11px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  pointer-events: none;
}

.hamburger-line {
  display: block;
  width: 14px;
  height: 1.8px;
  background-color: var(--ink, #1e293b);
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease,
    background-color 0.2s ease;
  transform-origin: center;
}

.quick-menu-btn:hover .hamburger-line {
  background-color: var(--primary, #2d6a4f);
}

.quick-user-menu-wrap.open .hamburger-line {
  background-color: var(--primary, #2d6a4f);
}

.quick-user-menu-wrap.open .hamburger-line.line-1 {
  transform: translateY(4.6px) rotate(45deg);
}

.quick-user-menu-wrap.open .hamburger-line.line-2 {
  opacity: 0;
  transform: scaleX(0);
}

.quick-user-menu-wrap.open .hamburger-line.line-3 {
  transform: translateY(-4.6px) rotate(-45deg);
}

/* Dropdown Container */
.quick-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.04);
  padding: 8px 6px;
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.2s;
  pointer-events: none;
}

.quick-user-menu-wrap.open .quick-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* User header inside dropdown */
.quick-menu-header {
  padding: 6px 10px 8px;
}

.quick-menu-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-menu-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.quick-menu-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.quick-menu-role {
  font-size: 11px;
  color: var(--muted, #64748b);
  line-height: 1.2;
  margin-top: 2px;
}

.quick-menu-divider {
  height: 1px;
  background: var(--line, #f1f5f9);
  margin: 6px 4px;
}

/* Menu items */
.quick-menu-items,
.quick-menu-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quick-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink, #1e293b);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.quick-menu-item:hover {
  background: var(--surface, #f8fafc);
  color: var(--primary, #2d6a4f);
}

.quick-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted, #64748b);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.quick-menu-item:hover .quick-menu-icon {
  color: var(--primary, #2d6a4f);
}

.quick-menu-label {
  flex: 1;
  white-space: nowrap;
}

.quick-menu-badge {
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  background: #fef3c7;
  color: #b45309;
  letter-spacing: -0.1px;
  margin-left: auto;
}

.quick-menu-item.quick-menu-danger {
  color: var(--error, #e03131);
}

.quick-menu-item.quick-menu-danger .quick-menu-icon {
  color: var(--error, #e03131);
}

.quick-menu-item.quick-menu-danger:hover {
  background: #fff5f5;
  color: #c92a2a;
}

.quick-menu-item.quick-menu-primary {
  color: var(--primary, #2d6a4f);
  font-weight: 600;
}

.quick-menu-item.quick-menu-primary:hover {
  background: var(--surface, #eff4ec);
}

/* Quick Menu Guest Section (Chỉ hiển thị khi chưa đăng nhập) */
.quick-menu-guest-section {
  padding: 4px 2px 2px;
}

.quick-menu-guest-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  background: var(--cream, #f4f1e8);
  border-radius: 10px;
  border: 1px solid var(--line, #e2e8f0);
}

.quick-menu-guest-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--sage, #dbe7d7);
  color: var(--primary, #123d30);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-menu-guest-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quick-menu-guest-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.quick-menu-guest-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.quick-menu-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: var(--primary, #123d30);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(18, 61, 48, 0.2);
}

.quick-menu-login-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 4px 10px rgba(18, 61, 48, 0.28);
}

.quick-menu-login-btn:active {
  transform: translateY(0);
}

/* Quick Menu Theme Toggle Row (Chuyển đổi Chế độ tối mượt mà) */
.quick-menu-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.16s ease, color 0.16s ease;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.quick-menu-theme-row:hover {
  background: var(--surface, #eff4ec);
}

.quick-menu-theme-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.theme-icon-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.quick-menu-theme-row:hover .theme-icon-indicator {
  color: var(--primary);
  transform: rotate(-8deg);
}

/* iOS/macOS Modern Slider Switch */
.theme-toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 12px;
  padding: 2px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-switch-slider {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.theme-switch-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease;
}

.theme-toggle-switch.active,
html.dark-theme #quickMenuThemeToggle,
body.dark-theme #quickMenuThemeToggle {
  background: #10b981;
}

html.dark-theme .theme-toggle-switch:not(.active),
body.dark-theme .theme-toggle-switch:not(.active) {
  background: #334155;
}

.theme-toggle-switch.active .theme-switch-thumb,
html.dark-theme #quickMenuThemeToggle .theme-switch-thumb,
body.dark-theme #quickMenuThemeToggle .theme-switch-thumb {
  transform: translateX(18px);
  background: #f8fafc;
}

/* ==========================================================================
   UNIFIED MODERN SVG ICON SYSTEM
   Consistent stroke, alignment, and optical balance for UI chrome
   ========================================================================== */
.ui-icon {
  display: inline-block;
  vertical-align: -0.15em;
  width: 1.15em;
  height: 1.15em;
  flex-shrink: 0;
  stroke-width: 1.85;
}

.ui-btn-icon {
  display: inline-block;
  vertical-align: -0.16em;
  width: 1.15em;
  height: 1.15em;
  margin-right: 5px;
  flex-shrink: 0;
  stroke-width: 1.85;
}

.icon-upvote-svg {
  display: inline-block;
  vertical-align: -0.12em;
  margin-right: 3px;
  flex-shrink: 0;
}

.icon-chat-svg {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.shield-icon-svg {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

.modal-close-icon {
  display: block;
}

.avatar {
  --ring-inset: -4.5px;
  --ring-width: 2.5px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  background: var(--ink);
  color: white;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 800;
  flex: none;
  position: relative;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  user-select: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: visible !important;
}

.avatar>* {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
}

.avatar-sm {
  --ring-inset: -4px;
  --ring-width: 2px;
  width: 31px;
  height: 31px;
  font-size: 16px;
}

.avatar-xs {
  --ring-inset: -3.5px;
  --ring-width: 2px;
  width: 27px;
  height: 27px;
  font-size: 14px;
}

.avatar-lg {
  --ring-inset: -6.5px;
  --ring-width: 3.5px;
  width: 72px;
  height: 72px;
  font-size: 38px;
  background: #305e4d;
}

.avatar.teal {
  background: #346f65;
}

.avatar.sand {
  background: #ba9364;
}

.avatar.ink {
  background: #35494a;
}

.page {
  display: none;
  max-width: 1208px;
  margin: auto;
  padding: 59px 36px 72px;
  min-height: calc(100vh - 76px);
}

.page.active-page {
  display: block;
}

.eyebrow {
  margin: 0 0 8px;
  color: #66786d;
  font-family: "Unbounded", sans-serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 1.2px;
}

.home-hero {
  min-height: 288px;
  display: grid;
  grid-template-columns: 1fr 384px;
  gap: 60px;
  align-items: center;
}

.hero-copy h1,
.forum-heading h1,
.account-header h1 {
  font-family: var(--serif);
  font-size: clamp(36px, 4.2vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 500;
  margin: 0;
  color: var(--ink-deep);
}

h1 em {
  font-style: italic;
  font-weight: 400;
  color: #2f7354;
}

.hero-intro {
  max-width: 505px;
  color: #587067;
  font-size: 15px;
  margin: 18px 0 24px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.button-sm {
  min-height: 30px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 6px;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 2px 8px rgba(18, 61, 48, 0.15);
}

.button-primary:hover {
  background: #09231b;
  box-shadow: 0 4px 14px rgba(18, 61, 48, 0.22);
}

.button-primary span {
  font-size: 16px;
  font-weight: 400;
  vertical-align: -1px;
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  padding-left: 3px;
}

.button-quiet:hover {
  color: var(--green);
}

.button-quiet span,
.button-dark span {
  padding-left: 5px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
}

.button-outline {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.button-outline:hover {
  background: var(--sage-2);
  border-color: #cbd5e1;
}

.button-dark {
  background: #eef3eb;
  color: var(--ink);
  width: 100%;
  margin-top: 18px;
  text-align: left;
}

/* Streak Tier Avatar Frames & Background Colors */
.avatar.avatar-tier-2 {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #ffd700;
}

.avatar-lg.avatar-tier-2 {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #ffd700;
}

/* Diagonal Gradient Border (Tiers 3, 4, 5 only - moves smoothly along 135deg diagonal) */
@keyframes diagonalBorderShift {
  0% {
    background-position: 0% 0%;
  }

  50% {
    background-position: 100% 100%;
  }

  100% {
    background-position: 0% 0%;
  }
}

.avatar.avatar-tier-3::before,
.avatar.avatar-tier-4::before,
.avatar.avatar-tier-5::before,
.avatar.avatar-tier-6::before,
.avatar.avatar-tier-7::before,
.avatar.avatar-tier-8::before {
  content: "";
  position: absolute;
  inset: var(--ring-inset, -4.5px);
  border-radius: 50%;
  padding: var(--ring-width, 2.5px);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
  transform: none;
  background-size: 280% 280%;
  animation: diagonalBorderShift 7s ease-in-out infinite;
}

.avatar.avatar-tier-3 {
  background: linear-gradient(135deg, #5f3dc4 0%, #7048e8 50%, #845ef7 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
}

.avatar-lg.avatar-tier-3 {
  box-shadow: 0 0 0 3px #fff;
}

.avatar.avatar-tier-3::before {
  background: linear-gradient(135deg, #5f3dc4 0%, #9775fa 25%, #e5dbff 50%, #7048e8 75%, #5f3dc4 100%);
  background-size: 280% 280%;
  filter: drop-shadow(0 0 4px rgba(132, 94, 247, 0.55));
  animation: diagonalBorderShift 7.5s ease-in-out infinite;
}

.avatar.avatar-tier-4 {
  background: linear-gradient(135deg, #c92a2a 0%, #e03131 50%, #ff6b6b 100%) !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
}

.avatar-lg.avatar-tier-4 {
  box-shadow: 0 0 0 3px #fff;
}

.avatar.avatar-tier-4::before {
  background: linear-gradient(135deg, #c92a2a 0%, #ff6b6b 25%, #ffe3e3 50%, #e03131 75%, #c92a2a 100%);
  background-size: 280% 280%;
  filter: drop-shadow(0 0 4px rgba(224, 49, 49, 0.65));
  animation: diagonalBorderShift 7s ease-in-out infinite;
}

/* Tier 5: Học giả uyên bác (50d) - Rose Quartz */
.avatar.avatar-tier-5 {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 40%, #c45b83 80%, #e8a9c1 100%) !important;
  background-size: 220% 220% !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
  animation: roseQuartzBgShift 12s ease-in-out infinite;
}

.avatar-lg.avatar-tier-5 {
  box-shadow: 0 0 0 3px #fff;
}

.avatar.avatar-tier-5::before {
  background: linear-gradient(135deg, #57223b 0%, #c45b83 30%, #e8a9c1 55%, #fde8ef 75%, #8a3157 100%);
  background-size: 280% 280%;
  filter: drop-shadow(0 0 5px rgba(196, 91, 131, 0.7));
  animation: diagonalBorderShift 8.5s ease-in-out infinite;
}

/* Tier 6: Nhà kiến tạo tri thức (100d) - Mythic Prism (old tier 5) */
.avatar.avatar-tier-6 {
  background: linear-gradient(135deg, #5f3dc4 0%, #a61e4d 45%, #e03131 85%, #f783ac 100%) !important;
  background-size: 250% 250% !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
  animation: mythicBgShift 12s ease-in-out infinite;
}

.avatar-lg.avatar-tier-6 {
  box-shadow: 0 0 0 3px #fff;
}

.avatar.avatar-tier-6::before {
  background: linear-gradient(135deg, #7048e8 0%, #f783ac 20%, #ffd43b 40%, #ff6b6b 65%, #a61e4d 85%, #7048e8 100%);
  background-size: 300% 300%;
  filter: drop-shadow(0 0 5px rgba(247, 131, 172, 0.75));
  animation: diagonalBorderShift 8.5s ease-in-out infinite;
}

/* Tier 7: Bậc thầy học thuật (200d) - Super Duolingo Neon */
.avatar.avatar-tier-7 {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 35%, #6366f1 70%, #ec4899 100%) !important;
  background-size: 300% 300% !important;
  color: #fff !important;
  box-shadow: 0 0 0 2px #fff;
  animation: superNeonShift 12s ease-in-out infinite;
}

.avatar-lg.avatar-tier-7 {
  box-shadow: 0 0 0 3px #fff;
}

.avatar.avatar-tier-7::before {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 30%, #ec4899 60%, #818cf8 80%, #00f59b 100%);
  background-size: 300% 300%;
  filter: drop-shadow(0 0 6px rgba(0, 210, 255, 0.85));
  animation: diagonalBorderShift 8.5s ease-in-out infinite;
}

/* Tier 8: Học giả lưu danh (365d) - Pure Celestial Diamond Luxury */
.avatar.avatar-tier-8 {
  background: linear-gradient(135deg, #090d16 0%, #1e293b 30%, #94a3b8 65%, #ffffff 100%) !important;
  background-size: 260% 260% !important;
  color: #fff !important;
  box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.95), 0 0 16px rgba(255, 255, 255, 0.55) !important;
  animation: diamondSheen 12s ease-in-out infinite;
}

.avatar-lg.avatar-tier-8 {
  box-shadow: 0 0 0 3.5px rgba(255, 255, 255, 0.95), 0 0 22px rgba(255, 255, 255, 0.65) !important;
}

.avatar.avatar-tier-8::before {
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 25%, #475569 50%, #ffffff 75%, #94a3b8 100%);
  background-size: 300% 300%;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 14px rgba(203, 213, 225, 0.65));
  animation: diagonalBorderShift 9s ease-in-out infinite;
}

@keyframes roseQuartzBgShift {

  0%,
  100% {
    background-position: 0% 0%;
  }

  50% {
    background-position: 100% 100%;
  }
}

@keyframes superNeonShift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

@keyframes diamondSheen {

  0%,
  100% {
    background-position: 0% 20%;
  }

  50% {
    background-position: 100% 80%;
  }
}

@keyframes mythicBgShift {
  0% {
    background-position: 0% 0%;
  }

  50% {
    background-position: 100% 100%;
  }

  100% {
    background-position: 0% 0%;
  }
}

/* ==========================================================================
   AVATAR TIER BULLETPROOF SHIELD (BẢO VỆ VIỀN VÀ HÀO QUANG TOÀN DIỆN KHỎI BỊ CẮT)
   Quy tắc kỹ thuật bất biến:
   1. Mọi phần tử .avatar và container chứa avatar KHÔNG ĐƯỢC có overflow: hidden
   2. Container danh sách/bảng xếp hạng (.comp-lb-user, .lb-item) bắt buộc overflow: visible !important
      (Cơ chế cắt chữ dài tự động bằng dấu 3 chấm đã được thực hiện tại .comp-lb-name / .lb-name-text)
   3. Wrappers luôn có padding an toàn và z-index để không bị đè hay cắt cạnh
   ========================================================================== */
.avatar,
.avatar[class*="avatar-tier-"],
.comp-lb-avatar-wrap,
.lb-avatar-wrap,
.podium-avatar-wrap,
.podium-avatar {
  overflow: visible !important;
}

.comp-lb-user,
.lb-item {
  overflow: visible !important;
}

.comp-lb-avatar-wrap,
.lb-avatar-wrap {
  overflow: visible !important;
  z-index: 2 !important;
  flex-shrink: 0 !important;
}

/* Streak Tier User Name Colors */
.user-name-tier-0,
.user-name-tier-1,
.user-name-tier-2,
.user-name-default {
  color: #2f5e45;
  font-weight: 700;
}

body.dark-theme .user-name-tier-0,
body.dark-theme .user-name-tier-1,
body.dark-theme .user-name-tier-2,
body.dark-theme .user-name-default,
body.dark-theme b.user-name-tier-0,
body.dark-theme b.user-name-tier-1,
body.dark-theme b.user-name-tier-2,
body.dark-theme b.user-name-default,
body.dark-theme span.user-name-tier-0,
body.dark-theme span.user-name-tier-1,
body.dark-theme span.user-name-tier-2,
body.dark-theme span.user-name-default,
body.dark-theme strong.user-name-tier-0,
body.dark-theme strong.user-name-tier-1,
body.dark-theme strong.user-name-tier-2,
body.dark-theme strong.user-name-default,
body.dark-theme h1.user-name-tier-0,
body.dark-theme h1.user-name-tier-1,
body.dark-theme h1.user-name-tier-2,
body.dark-theme h1.user-name-default,
body.dark-theme div.user-name-tier-0,
body.dark-theme div.user-name-tier-1,
body.dark-theme div.user-name-tier-2,
body.dark-theme div.user-name-default {
  color: #4ade80 !important;
}

.user-name-tier-3,
b.user-name-tier-3,
span.user-name-tier-3,
strong.user-name-tier-3,
h1.user-name-tier-3 {
  color: #7048e8;
  font-weight: 700;
}

body.dark-theme .user-name-tier-3,
body.dark-theme b.user-name-tier-3,
body.dark-theme span.user-name-tier-3,
body.dark-theme strong.user-name-tier-3,
body.dark-theme h1.user-name-tier-3,
body.dark-theme div.user-name-tier-3 {
  color: #c084fc !important;
}

.user-name-tier-4,
b.user-name-tier-4,
span.user-name-tier-4,
strong.user-name-tier-4,
h1.user-name-tier-4 {
  color: #e03131;
  font-weight: 700;
}

body.dark-theme .user-name-tier-4,
body.dark-theme b.user-name-tier-4,
body.dark-theme span.user-name-tier-4,
body.dark-theme strong.user-name-tier-4,
body.dark-theme h1.user-name-tier-4,
body.dark-theme div.user-name-tier-4 {
  color: #fb7185 !important;
}

/* Tier 5: Học giả uyên bác (50d) - Rose Quartz */
.user-name-tier-5,
b.user-name-tier-5,
span.user-name-tier-5,
strong.user-name-tier-5,
h1.user-name-tier-5,
div.user-name-tier-5,
.post-meta b.user-name-tier-5,
.post-meta div b.user-name-tier-5,
.reply-header b.user-name-tier-5,
.post-detail-header b.user-name-tier-5,
.profile-chip-text span.user-name-tier-5,
.lb-name.user-name-tier-5,
.co-study-user-title.user-name-tier-5,
.account-header h1.user-name-tier-5,
.document-footer span.user-name-tier-5 {
  background-image: linear-gradient(90deg,
      #57223b 0%,
      #8a3157 25%,
      #b04373 50%,
      #8a3157 75%,
      #57223b 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
  animation: shimmerName 8.5s ease-in-out infinite;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: inline-block;
  vertical-align: middle;
  text-shadow: none;
  filter: none;
  box-shadow: none;
}

body.dark-theme .user-name-tier-5,
body.dark-theme b.user-name-tier-5,
body.dark-theme span.user-name-tier-5,
body.dark-theme strong.user-name-tier-5,
body.dark-theme h1.user-name-tier-5,
body.dark-theme div.user-name-tier-5 {
  background-image: linear-gradient(90deg,
      #c45b83 0%,
      #f472b6 35%,
      #fbcfe8 60%,
      #f472b6 85%,
      #c45b83 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

/* Tier 6: Nhà kiến tạo tri thức (100d) - Mythic Prism (old tier 5) */
.user-name-tier-6,
b.user-name-tier-6,
span.user-name-tier-6,
strong.user-name-tier-6,
h1.user-name-tier-6,
div.user-name-tier-6,
.post-meta b.user-name-tier-6,
.post-meta div b.user-name-tier-6,
.reply-header b.user-name-tier-6,
.post-detail-header b.user-name-tier-6,
.profile-chip-text span.user-name-tier-6,
.lb-name.user-name-tier-6,
.co-study-user-title.user-name-tier-6,
.account-header h1.user-name-tier-6,
.document-footer span.user-name-tier-6 {
  background-image: linear-gradient(90deg,
      #5c35c9 0%,
      #a61e4d 30%,
      #c2255c 60%,
      #7048e8 85%,
      #5c35c9 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
  animation: shimmerName 8.5s ease-in-out infinite;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: inline-block;
  vertical-align: middle;
  text-shadow: none;
  filter: none;
  box-shadow: none;
}

body.dark-theme .user-name-tier-6,
body.dark-theme b.user-name-tier-6,
body.dark-theme span.user-name-tier-6,
body.dark-theme strong.user-name-tier-6,
body.dark-theme h1.user-name-tier-6,
body.dark-theme div.user-name-tier-6 {
  background-image: linear-gradient(90deg,
      #7048e8 0%,
      #d6336c 25%,
      #ff6b6b 50%,
      #f783ac 75%,
      #7048e8 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

/* Tier 7: Bậc thầy học thuật (200d) - Super Duolingo Neon */
.user-name-tier-7,
b.user-name-tier-7,
span.user-name-tier-7,
strong.user-name-tier-7,
h1.user-name-tier-7,
div.user-name-tier-7,
.post-meta b.user-name-tier-7,
.post-meta div b.user-name-tier-7,
.reply-header b.user-name-tier-7,
.post-detail-header b.user-name-tier-7,
.profile-chip-text span.user-name-tier-7,
.lb-name.user-name-tier-7,
.co-study-user-title.user-name-tier-7,
.account-header h1.user-name-tier-7,
.document-footer span.user-name-tier-7 {
  background-image: linear-gradient(90deg,
      #00875a 0%,
      #0070ba 30%,
      #4f46e5 60%,
      #be185d 85%,
      #00875a 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
  animation: shimmerName 8.5s ease-in-out infinite;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: inline-block;
  vertical-align: middle;
  text-shadow: none;
  filter: none;
  box-shadow: none;
}

body.dark-theme .user-name-tier-7,
body.dark-theme b.user-name-tier-7,
body.dark-theme span.user-name-tier-7,
body.dark-theme strong.user-name-tier-7,
body.dark-theme h1.user-name-tier-7,
body.dark-theme div.user-name-tier-7 {
  background-image: linear-gradient(90deg,
      #00f59b 0%,
      #00d2ff 30%,
      #818cf8 60%,
      #ec4899 85%,
      #00f59b 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

/* Tier 8: Học giả lưu danh (365d) - Pure Celestial Diamond Luxury (High-Contrast Platinum Titanium) */
.user-name-tier-8,
b.user-name-tier-8,
span.user-name-tier-8,
strong.user-name-tier-8,
h1.user-name-tier-8,
div.user-name-tier-8,
.post-meta b.user-name-tier-8,
.post-meta div b.user-name-tier-8,
.reply-header b.user-name-tier-8,
.post-detail-header b.user-name-tier-8,
.profile-chip-text span.user-name-tier-8,
.lb-name.user-name-tier-8,
.co-study-user-title.user-name-tier-8,
.account-header h1.user-name-tier-8,
.document-footer span.user-name-tier-8 {
  background-image: linear-gradient(90deg,
      #0f172a 0%,
      #1e293b 25%,
      #475569 50%,
      #1e293b 75%,
      #0f172a 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  background-repeat: repeat-x;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
  animation: diamondShimmer 9s ease-in-out infinite;
  -webkit-animation: diamondShimmer 9s ease-in-out infinite;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: inline-block;
  vertical-align: middle;
  text-shadow: none;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7));
  box-shadow: none;
}

body.dark-theme .user-name-tier-8,
body.dark-theme b.user-name-tier-8,
body.dark-theme span.user-name-tier-8,
body.dark-theme strong.user-name-tier-8,
body.dark-theme h1.user-name-tier-8,
body.dark-theme div.user-name-tier-8 {
  background-image: linear-gradient(90deg,
      #94a3b8 0%,
      #cbd5e1 25%,
      #ffffff 50%,
      #cbd5e1 75%,
      #94a3b8 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)) !important;
  text-shadow: none !important;
  animation: diamondShimmer 9s ease-in-out infinite !important;
  -webkit-animation: diamondShimmer 9s ease-in-out infinite !important;
}

@keyframes diamondShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@-webkit-keyframes diamondShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmerName {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@-webkit-keyframes shimmerName {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@keyframes seamlessNameShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

@-webkit-keyframes seamlessNameShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* Theme Shift overrides */
[data-user-theme="ruby"] {
  --primary: #c92a2a;
  --primary-soft: #ffe3e3;
  --accent: #e03131;
  --green: #c92a2a;
  --ink: #3b0a11;
  --ink-deep: #24050a;
  --paper: #fdf6f6;
  --cream: #faecec;
  --line: #eed6d6;
  --sage: #f8c8c8;
  --sage-2: #fae4e4;
  --muted: #7d5e63;
}

[data-user-theme="ruby"] body {
  background: #fdf6f6;
  color: #3b0a11;
}

[data-user-theme="ruby"] .button-primary {
  background: linear-gradient(135deg, #a61e32 0%, #c92a2a 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(201, 42, 42, 0.35) !important;
}

[data-user-theme="ruby"] .button-dark {
  background: #fae4e4 !important;
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .button-outline {
  border-color: #e0a8a8 !important;
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .button-quiet {
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .site-header {
  border-bottom-color: #eed6d6;
}

[data-user-theme="ruby"] .brand-colon {
  color: #e03131 !important;
}

[data-user-theme="ruby"] .nav-link:hover,
[data-user-theme="ruby"] .nav-link.active {
  background: #fae4e4 !important;
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .icon-button:hover {
  background: #fae4e4 !important;
}

[data-user-theme="ruby"] .profile-chip b {
  background: #fae4e4 !important;
  color: #a61e32 !important;
}

[data-user-theme="ruby"] .quick-user-menu-wrap.open .quick-menu-btn {
  background: #faf0f0;
  border-color: #c92a2a;
  color: #c92a2a;
  box-shadow: 0 2px 8px rgba(201, 42, 42, 0.2);
}

[data-user-theme="ruby"] .quick-user-menu-wrap.open .hamburger-line,
[data-user-theme="ruby"] .quick-menu-btn:hover .hamburger-line {
  background-color: #c92a2a;
}

[data-user-theme="ruby"] .quick-menu-item:hover {
  background: #faf0f0;
  color: #8e1526;
}

[data-user-theme="ruby"] .quick-menu-item:hover .quick-menu-icon {
  color: #c92a2a;
}

[data-user-theme="ruby"] .quick-menu-item.quick-menu-primary {
  color: #c92a2a;
}

[data-user-theme="ruby"] .quick-menu-item.quick-menu-primary:hover {
  background: #faf0f0;
}

[data-user-theme="ruby"] h1 em {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .search-panel {
  border-color: #f0cece !important;
  box-shadow: 0 10px 24px rgba(201, 42, 42, 0.08) !important;
  background: #fff !important;
}

[data-user-theme="ruby"] .search-glyph,
[data-user-theme="ruby"] .search-inline span {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .search-inline {
  border-color: #f0cece !important;
}

[data-user-theme="ruby"] .filter-chip:hover,
[data-user-theme="ruby"] .filter-chip.selected {
  background: #fae4e4 !important;
  color: #a61e32 !important;
}

[data-user-theme="ruby"] .filter-button {
  border-color: #e8c4c4 !important;
  background: #faf0f0 !important;
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .lb-tab.active {
  background: #c92a2a !important;
  color: #fff !important;
}

[data-user-theme="ruby"] .lb-tab {
  color: #8e1526;
}

[data-user-theme="ruby"] .lb-carousel-header {
  background: #faf0f0;
}

[data-user-theme="ruby"] .lb-nav-btn:hover {
  color: #c92a2a;
  border-color: #e8c4c4;
}

[data-user-theme="ruby"] .lb-active-title {
  color: #8e1526;
}

[data-user-theme="ruby"] .lb-dot.active {
  background: #c92a2a;
}

[data-user-theme="ruby"] .tab.active:after {
  background: #c92a2a !important;
}

[data-user-theme="ruby"] .post-tag {
  color: #a61e32 !important;
  background: #fae4e4 !important;
}

[data-user-theme="ruby"] .topic {
  border-color: #f0cece !important;
  background: #fff5f5 !important;
  color: #8e1526 !important;
}

[data-user-theme="ruby"] .topic:hover {
  border-color: #c92a2a !important;
  background: #fae4e4 !important;
}

[data-user-theme="ruby"] .topics-card,
[data-user-theme="ruby"] .mini-card {
  background: #faecec !important;
}

[data-user-theme="ruby"] .active-card {
  background: #fff8f8 !important;
  border-color: #f5dcdc !important;
}

[data-user-theme="ruby"] .active-card-title>span {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .post-card:hover {
  background: #fdf0f0 !important;
}

[data-user-theme="ruby"] .post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #a61e32 !important;
}

[data-user-theme="ruby"] .text-link {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .announcement {
  border-left-color: #c92a2a !important;
}

[data-user-theme="ruby"] .announcement-icon {
  background: #fae4e4 !important;
  color: #a61e32 !important;
}

[data-user-theme="ruby"] .activity-icon {
  background: #fae4e4 !important;
  color: #a61e32 !important;
}

[data-user-theme="ruby"] .activity-points {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .admin-panel {
  background: #440c14 !important;
}

[data-user-theme="ruby"] .admin-panel .eyebrow {
  color: #ffc9c9 !important;
}

[data-user-theme="ruby"] .streak-journey-header {
  background: linear-gradient(135deg, #440c14 0%, #7a1523 100%) !important;
}

[data-user-theme="ruby"] button:focus-visible,
[data-user-theme="ruby"] a:focus-visible,
[data-user-theme="ruby"] input:focus-visible,
[data-user-theme="ruby"] textarea:focus-visible,
[data-user-theme="ruby"] select:focus-visible {
  outline-color: #ff6b6b !important;
}

[data-user-theme="mythic"] {
  --primary: #5f3dc4;
  --primary-soft: #f3d9fa;
  --accent: #d6336c;
  --green: #7048e8;
  --ink: #2b0e45;
  --ink-deep: #19052b;
  --paper: #faf6fd;
  --cream: #f4ecfa;
  --line: #e6d6f2;
  --sage: #e0c8f5;
  --sage-2: #f2e6fa;
  --muted: #6e5585;
}

[data-user-theme="mythic"] body {
  background: #faf6fd;
  color: #2b0e45;
}

[data-user-theme="mythic"] .button-primary {
  background: linear-gradient(135deg, #5f3dc4 0%, #9c1c68 50%, #d6336c 100%) !important;
  background-size: 200% auto !important;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(112, 72, 232, 0.45), 0 2px 8px rgba(214, 51, 108, 0.3) !important;
  animation: mythicButtonGlow 4s ease infinite alternate;
}

@keyframes mythicButtonGlow {
  0% {
    background-position: 0% center;
    box-shadow: 0 4px 18px rgba(112, 72, 232, 0.45), 0 2px 8px rgba(214, 51, 108, 0.3);
  }

  100% {
    background-position: 100% center;
    box-shadow: 0 4px 20px rgba(214, 51, 108, 0.5), 0 2px 10px rgba(112, 72, 232, 0.35);
  }
}

[data-user-theme="mythic"] .button-dark {
  background: #f2e6fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .button-outline {
  border-color: #d0bfff !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .button-quiet {
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .site-header {
  border-bottom-color: #e6d6f2;
}

[data-user-theme="mythic"] .brand-colon {
  color: #d6336c !important;
}

[data-user-theme="mythic"] .nav-link:hover,
[data-user-theme="mythic"] .nav-link.active {
  background: #f2e6fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .icon-button:hover {
  background: #f2e6fa !important;
}

[data-user-theme="mythic"] .profile-chip b {
  background: #f2e6fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .quick-user-menu-wrap.open .quick-menu-btn {
  background: #f8f0fc;
  border-color: #7048e8;
  color: #7048e8;
  box-shadow: 0 2px 8px rgba(112, 72, 232, 0.2);
}

[data-user-theme="mythic"] .quick-user-menu-wrap.open .hamburger-line,
[data-user-theme="mythic"] .quick-menu-btn:hover .hamburger-line {
  background-color: #7048e8;
}

[data-user-theme="mythic"] .quick-menu-item:hover {
  background: #f8f0fc;
  color: #5f3dc4;
}

[data-user-theme="mythic"] .quick-menu-item:hover .quick-menu-icon {
  color: #7048e8;
}

[data-user-theme="mythic"] .quick-menu-item.quick-menu-primary {
  color: #7048e8;
}

[data-user-theme="mythic"] .quick-menu-item.quick-menu-primary:hover {
  background: #f8f0fc;
}

[data-user-theme="mythic"] h1 em {
  background: linear-gradient(90deg, #7048e8, #f783ac, #ff6b6b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-user-theme="mythic"] .search-panel {
  border-color: #dec5f4 !important;
  box-shadow: 0 10px 24px rgba(112, 72, 232, 0.12) !important;
  background: #fff !important;
}

[data-user-theme="mythic"] .search-glyph,
[data-user-theme="mythic"] .search-inline span {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .search-inline {
  border-color: #dec5f4 !important;
}

[data-user-theme="mythic"] .filter-chip:hover,
[data-user-theme="mythic"] .filter-chip.selected {
  background: #f0e2fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .filter-button {
  border-color: #dec5f4 !important;
  background: #f8f0fc !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .lb-tab.active {
  background: linear-gradient(135deg, #5f3dc4 0%, #d6336c 100%) !important;
  color: #fff !important;
}

[data-user-theme="mythic"] .lb-tab {
  color: #5f3dc4;
}

[data-user-theme="mythic"] .lb-carousel-header {
  background: #f8f0fc;
}

[data-user-theme="mythic"] .lb-nav-btn:hover {
  color: #7048e8;
  border-color: #dec5f4;
}

[data-user-theme="mythic"] .lb-active-title {
  color: #5f3dc4;
}

[data-user-theme="mythic"] .lb-dot.active {
  background: linear-gradient(90deg, #7048e8, #f783ac);
}

[data-user-theme="mythic"] .tab.active:after {
  background: linear-gradient(90deg, #7048e8, #f783ac) !important;
}

[data-user-theme="mythic"] .post-tag {
  color: #5f3dc4 !important;
  background: #f0e2fa !important;
}

[data-user-theme="mythic"] .topic {
  border-color: #dec5f4 !important;
  background: #fbf8fe !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .topic:hover {
  border-color: #7048e8 !important;
  background: #f0e2fa !important;
}

[data-user-theme="mythic"] .topics-card,
[data-user-theme="mythic"] .mini-card {
  background: #f4ecfa !important;
}

[data-user-theme="mythic"] .active-card {
  background: #fcf9fe !important;
  border-color: #ecdcf7 !important;
}

[data-user-theme="mythic"] .active-card-title>span {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .post-card:hover {
  background: #f6eeff !important;
}

[data-user-theme="mythic"] .post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .text-link {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .announcement {
  border-left-color: #7048e8 !important;
}

[data-user-theme="mythic"] .announcement-icon {
  background: #f0e2fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .activity-icon {
  background: #f0e2fa !important;
  color: #5f3dc4 !important;
}

[data-user-theme="mythic"] .activity-points {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .admin-panel {
  background: linear-gradient(135deg, #280838 0%, #4a0e4e 50%, #68112a 100%) !important;
}

[data-user-theme="mythic"] .admin-panel .eyebrow {
  color: #fcc2d7 !important;
}

[data-user-theme="mythic"] .streak-journey-header {
  background: linear-gradient(135deg, #280838 0%, #4a0e4e 50%, #68112a 100%) !important;
}

[data-user-theme="mythic"] button:focus-visible,
[data-user-theme="mythic"] a:focus-visible,
[data-user-theme="mythic"] input:focus-visible,
[data-user-theme="mythic"] textarea:focus-visible,
[data-user-theme="mythic"] select:focus-visible {
  outline-color: #b197fc !important;
}

/* ==========================================================================

/* ==========================================================================
   TIER 5: ROSE QUARTZ THEME (50D - HỌC GIẢ UYÊN BÁC)
   #57223B -> #8A3157 -> #C45B83 -> #E8A9C1
   ========================================================================== */
[data-user-theme="rosequartz"] {
  --primary: #8a3157;
  --primary-soft: #fde8ef;
  --accent: #c45b83;
  --green: #8a3157;
  --ink: #3b1323;
  --ink-deep: #240a15;
  --paper: #fff9fb;
  --cream: #fcedf2;
  --line: #f7d3e0;
  --sage: #f2bacf;
  --sage-2: #fcedf2;
  --muted: #8a3157;
}

[data-user-theme="rosequartz"] body {
  background: #fff9fb;
  color: #3b1323;
}

[data-user-theme="rosequartz"] .button-primary {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 50%, #c45b83 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 16px rgba(138, 49, 87, 0.3) !important;
}

[data-user-theme="rosequartz"] .button-dark {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .button-outline {
  border-color: #f2bacf !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .button-quiet {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .site-header {
  border-bottom-color: #f7d3e0;
}

[data-user-theme="rosequartz"] .brand-colon {
  color: #c45b83 !important;
}

[data-user-theme="rosequartz"] .nav-link:hover,
[data-user-theme="rosequartz"] .nav-link.active {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .icon-button:hover {
  background: #fcedf2 !important;
}

[data-user-theme="rosequartz"] .profile-chip b {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .quick-user-menu-wrap.open .quick-menu-btn {
  background: #fdf2f6;
  border-color: #8a3157;
  color: #8a3157;
  box-shadow: 0 2px 8px rgba(138, 49, 87, 0.2);
}

[data-user-theme="rosequartz"] .quick-user-menu-wrap.open .hamburger-line,
[data-user-theme="rosequartz"] .quick-menu-btn:hover .hamburger-line {
  background-color: #8a3157;
}

[data-user-theme="rosequartz"] .quick-menu-item:hover {
  background: #fdf2f6;
  color: #8a3157;
}

[data-user-theme="rosequartz"] .quick-menu-item:hover .quick-menu-icon {
  color: #8a3157;
}

[data-user-theme="rosequartz"] .quick-menu-item.quick-menu-primary {
  color: #8a3157;
}

[data-user-theme="rosequartz"] .quick-menu-item.quick-menu-primary:hover {
  background: #fdf2f6;
}

[data-user-theme="rosequartz"] h1 em {
  background: linear-gradient(90deg, #57223b, #8a3157, #c45b83);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-user-theme="rosequartz"] .search-panel {
  border-color: #f7d3e0 !important;
  box-shadow: 0 10px 24px rgba(138, 49, 87, 0.1) !important;
  background: #fff !important;
}

[data-user-theme="rosequartz"] .search-glyph,
[data-user-theme="rosequartz"] .search-inline span {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .search-inline {
  border-color: #f7d3e0 !important;
}

[data-user-theme="rosequartz"] .filter-chip:hover,
[data-user-theme="rosequartz"] .filter-chip.selected {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .filter-button {
  border-color: #f7d3e0 !important;
  background: #fdf2f6 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .lb-tab.active {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 50%, #c45b83 100%) !important;
  color: #fff !important;
}

[data-user-theme="rosequartz"] .lb-tab {
  color: #8a3157;
}

[data-user-theme="rosequartz"] .lb-carousel-header {
  background: #fdf2f6;
}

[data-user-theme="rosequartz"] .lb-nav-btn:hover {
  color: #8a3157;
  border-color: #f7d3e0;
}

[data-user-theme="rosequartz"] .lb-active-title {
  color: #8a3157;
}

[data-user-theme="rosequartz"] .lb-dot.active {
  background: linear-gradient(90deg, #8a3157, #c45b83);
}

[data-user-theme="rosequartz"] .tab.active:after {
  background: #8a3157 !important;
}

[data-user-theme="rosequartz"] .post-tag {
  color: #8a3157 !important;
  background: #fcedf2 !important;
}

[data-user-theme="rosequartz"] .topic {
  border-color: #f7d3e0 !important;
  background: #fffbfc !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .topic:hover {
  border-color: #8a3157 !important;
  background: #fcedf2 !important;
}

[data-user-theme="rosequartz"] .topics-card,
[data-user-theme="rosequartz"] .mini-card {
  background: #fcedf2 !important;
}

[data-user-theme="rosequartz"] .active-card {
  background: #fff8fb !important;
  border-color: #f5dce6 !important;
}

[data-user-theme="rosequartz"] .active-card-title>span {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .post-card:hover {
  background: #fdf2f6 !important;
}

[data-user-theme="rosequartz"] .post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .text-link {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .announcement {
  border-left-color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .announcement-icon {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .activity-icon {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .activity-points {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .admin-panel {
  background: linear-gradient(135deg, #3d1425 0%, #5c1e3a 50%, #8a3157 100%) !important;
}

[data-user-theme="rosequartz"] .admin-panel .eyebrow {
  color: #fcedf2 !important;
}

[data-user-theme="rosequartz"] .streak-journey-header {
  background: linear-gradient(135deg, #3d1425 0%, #5c1e3a 50%, #8a3157 100%) !important;
}

[data-user-theme="rosequartz"] button:focus-visible,
[data-user-theme="rosequartz"] a:focus-visible,
[data-user-theme="rosequartz"] input:focus-visible,
[data-user-theme="rosequartz"] textarea:focus-visible,
[data-user-theme="rosequartz"] select:focus-visible {
  outline-color: #c45b83 !important;
}

/* ==========================================================================
   TIER 7: SUPER DUOLINGO NEON THEME (200D - BẬC THẦY HỌC THUẬT)
   ========================================================================== */
[data-user-theme="super"] {
  --primary: #00cec9;
  --primary-soft: #e0fbfb;
  --accent: #ec4899;
  --green: #00f59b;
  --ink: #0f172a;
  --ink-deep: #020617;
  --paper: #f0fdf9;
  --cream: #e6fcf5;
  --line: #cbf3e4;
  --sage: #a7f3d0;
  --sage-2: #d1fae5;
  --muted: #475569;
}

[data-user-theme="super"] body {
  background: #f0fdf9;
  color: #0f172a;
}

[data-user-theme="super"] .button-primary {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #0b0d28 !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 18px rgba(0, 210, 255, 0.45) !important;
}

[data-user-theme="super"] .button-dark {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .button-outline {
  border-color: #80cbc4 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .button-quiet {
  color: #00897b !important;
}

[data-user-theme="super"] .site-header {
  border-bottom-color: #cbf3e4;
}

[data-user-theme="super"] .brand-colon {
  color: #00d2ff !important;
}

[data-user-theme="super"] .nav-link:hover,
[data-user-theme="super"] .nav-link.active {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .icon-button:hover {
  background: #e6fcf5 !important;
}

[data-user-theme="super"] .profile-chip b {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .quick-user-menu-wrap.open .quick-menu-btn {
  background: #e6fcf5;
  border-color: #00cec9;
  color: #00897b;
  box-shadow: 0 2px 8px rgba(0, 206, 201, 0.25);
}

[data-user-theme="super"] .quick-user-menu-wrap.open .hamburger-line,
[data-user-theme="super"] .quick-menu-btn:hover .hamburger-line {
  background-color: #00b894;
}

[data-user-theme="super"] .quick-menu-item:hover {
  background: #e6fcf5;
  color: #00897b;
}

[data-user-theme="super"] .quick-menu-item:hover .quick-menu-icon {
  color: #00b894;
}

[data-user-theme="super"] .quick-menu-item.quick-menu-primary {
  color: #00897b;
}

[data-user-theme="super"] .quick-menu-item.quick-menu-primary:hover {
  background: #e6fcf5;
}

[data-user-theme="super"] h1 em {
  background: linear-gradient(90deg, #00f59b, #00d2ff, #818cf8, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-user-theme="super"] .search-panel {
  border-color: #cbf3e4 !important;
  box-shadow: 0 10px 24px rgba(0, 206, 201, 0.12) !important;
  background: #fff !important;
}

[data-user-theme="super"] .search-glyph,
[data-user-theme="super"] .search-inline span {
  color: #00b894 !important;
}

[data-user-theme="super"] .search-inline {
  border-color: #cbf3e4 !important;
}

[data-user-theme="super"] .filter-chip:hover,
[data-user-theme="super"] .filter-chip.selected {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .filter-button {
  border-color: #cbf3e4 !important;
  background: #f0fdf9 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .lb-tab.active {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #0b0d28 !important;
  font-weight: 800 !important;
}

[data-user-theme="super"] .lb-tab {
  color: #00897b;
}

[data-user-theme="super"] .lb-carousel-header {
  background: #e6fcf5;
}

[data-user-theme="super"] .lb-nav-btn:hover {
  color: #00b894;
  border-color: #cbf3e4;
}

[data-user-theme="super"] .lb-active-title {
  color: #00897b;
}

[data-user-theme="super"] .lb-dot.active {
  background: linear-gradient(90deg, #00f59b, #00d2ff);
}

[data-user-theme="super"] .tab.active:after {
  background: linear-gradient(90deg, #00f59b, #00d2ff) !important;
}

[data-user-theme="super"] .post-tag {
  color: #00897b !important;
  background: #e6fcf5 !important;
}

[data-user-theme="super"] .topic {
  border-color: #cbf3e4 !important;
  background: #f5fdfa !important;
  color: #00897b !important;
}

[data-user-theme="super"] .topic:hover {
  border-color: #00b894 !important;
  background: #e6fcf5 !important;
}

[data-user-theme="super"] .topics-card,
[data-user-theme="super"] .mini-card {
  background: #e6fcf5 !important;
}

[data-user-theme="super"] .active-card {
  background: #f5fdfa !important;
  border-color: #cbf3e4 !important;
}

[data-user-theme="super"] .active-card-title>span {
  color: #00b894 !important;
}

[data-user-theme="super"] .post-card:hover {
  background: #e6fcf5 !important;
}

[data-user-theme="super"] .post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #00897b !important;
}

[data-user-theme="super"] .text-link {
  color: #00897b !important;
}

[data-user-theme="super"] .announcement {
  border-left-color: #00b894 !important;
}

[data-user-theme="super"] .announcement-icon {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .activity-icon {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

[data-user-theme="super"] .activity-points {
  color: #00897b !important;
}

[data-user-theme="super"] .admin-panel {
  background: linear-gradient(135deg, #091334 0%, #0f174a 50%, #1a1660 100%) !important;
}

[data-user-theme="super"] .admin-panel .eyebrow {
  color: #a5f3fc !important;
}

[data-user-theme="super"] .streak-journey-header {
  background: linear-gradient(135deg, #091334 0%, #0f174a 50%, #1a1660 100%) !important;
}

[data-user-theme="super"] button:focus-visible,
[data-user-theme="super"] a:focus-visible,
[data-user-theme="super"] input:focus-visible,
[data-user-theme="super"] textarea:focus-visible,
[data-user-theme="super"] select:focus-visible {
  outline-color: #00d2ff !important;
}

/* ==========================================================================
   TIER 8: PURE CELESTIAL DIAMOND LUXURY THEME (365D - HỌC GIẢ LƯU DANH)
   ========================================================================== */
[data-user-theme="diamond"] {
  --primary: #0f172a;
  --primary-soft: #f1f5f9;
  --accent: #475569;
  --green: #0f172a;
  --ink: #0f172a;
  --ink-deep: #020617;
  --paper: #ffffff;
  --cream: #f8fafc;
  --line: #cbd5e1;
  --sage: #94a3b8;
  --sage-2: #e2e8f0;
  --muted: #64748b;
}

[data-user-theme="diamond"] body {
  background: #f8fafc;
  color: #0f172a;
}

[data-user-theme="diamond"] .site-header {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(203, 213, 225, 0.8) !important;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05) !important;
}

[data-user-theme="diamond"] .button-primary {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}

[data-user-theme="diamond"] .button-dark {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .button-outline {
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .button-quiet {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .brand-colon {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .nav-link:hover,
[data-user-theme="diamond"] .nav-link.active {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .icon-button:hover {
  background: #e2e8f0 !important;
}

[data-user-theme="diamond"] .profile-chip b {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .quick-user-menu-wrap.open .quick-menu-btn {
  background: #e2e8f0;
  border-color: #0f172a;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

[data-user-theme="diamond"] .quick-user-menu-wrap.open .hamburger-line,
[data-user-theme="diamond"] .quick-menu-btn:hover .hamburger-line {
  background-color: #0f172a;
}

[data-user-theme="diamond"] .quick-menu-item:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-user-theme="diamond"] .quick-menu-item:hover .quick-menu-icon {
  color: #0f172a;
}

[data-user-theme="diamond"] .quick-menu-item.quick-menu-primary {
  color: #0f172a;
}

[data-user-theme="diamond"] .quick-menu-item.quick-menu-primary:hover {
  background: #e2e8f0;
}

[data-user-theme="diamond"] h1 em {
  background: linear-gradient(90deg, #0f172a, #334155, #64748b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-user-theme="diamond"] .search-panel {
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08) !important;
  background: #fff !important;
}

[data-user-theme="diamond"] .search-glyph,
[data-user-theme="diamond"] .search-inline span {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .search-inline {
  border-color: #cbd5e1 !important;
}

[data-user-theme="diamond"] .filter-chip:hover,
[data-user-theme="diamond"] .filter-chip.selected {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .filter-button {
  border-color: #cbd5e1 !important;
  background: #f8fafc !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .lb-tab.active {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%) !important;
  color: #fff !important;
}

[data-user-theme="diamond"] .lb-tab {
  color: #0f172a;
}

[data-user-theme="diamond"] .lb-carousel-header {
  background: #f8fafc;
}

[data-user-theme="diamond"] .lb-nav-btn:hover {
  color: #0f172a;
  border-color: #cbd5e1;
}

[data-user-theme="diamond"] .lb-active-title {
  color: #0f172a;
}

[data-user-theme="diamond"] .lb-dot.active {
  background: #0f172a;
}

[data-user-theme="diamond"] .tab.active:after {
  background: #0f172a !important;
}

[data-user-theme="diamond"] .post-tag {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

[data-user-theme="diamond"] .topic {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .topic:hover {
  border-color: #0f172a !important;
  background: #e2e8f0 !important;
}

[data-user-theme="diamond"] .topics-card,
[data-user-theme="diamond"] .mini-card {
  background: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
}

[data-user-theme="diamond"] .active-card {
  background: #ffffff !important;
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
}

[data-user-theme="diamond"] .active-card-title>span {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .post-card {
  border: 1px solid rgba(148, 163, 184, 0.35) !important;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

[data-user-theme="diamond"] .post-card:hover {
  border-color: rgba(71, 85, 105, 0.5) !important;
  background: #f8fafc !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08), inset 0 1px 0 #ffffff !important;
}

[data-user-theme="diamond"] .post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .text-link {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .announcement {
  border-left-color: #0f172a !important;
}

[data-user-theme="diamond"] .announcement-icon {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .activity-icon {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .activity-points {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .admin-panel {
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #090d16 100%) !important;
}

[data-user-theme="diamond"] .admin-panel .eyebrow {
  color: #cbd5e1 !important;
}

[data-user-theme="diamond"] .streak-journey-header {
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #090d16 80%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
}

[data-user-theme="diamond"] button:focus-visible,
[data-user-theme="diamond"] a:focus-visible,
[data-user-theme="diamond"] input:focus-visible,
[data-user-theme="diamond"] textarea:focus-visible,
[data-user-theme="diamond"] select:focus-visible {
  outline-color: #475569 !important;
}

/* ==========================================================================
   THEME DETAIL OVERRIDES: ELIMINATE GREEN LEAKAGE ACROSS ALL STREAK THEMES
   ========================================================================== */

/* Rose Quartz (50d - Thạch anh hồng) */
[data-user-theme="rosequartz"] {
  --theme-stat-vote: #f472b6;
  --theme-doc-action: #f472b6;
  --theme-account-active: #f472b6;
  --pts-pos-bg: rgba(138, 49, 87, 0.1);
  --pts-pos-color: #8a3157;
  --pts-pos-border: rgba(138, 49, 87, 0.2);
  --pts-pos-bg-dark: rgba(244, 114, 182, 0.15);
  --pts-pos-color-dark: #f472b6;
  --pts-pos-border-dark: rgba(244, 114, 182, 0.3);
  --study-color-primary: #8a3157;
  --study-color-secondary: #c45b83;
  --study-color-accessory: #e8a9c1;
  --primary-gradient: linear-gradient(135deg, #8a3157 0%, #c45b83 100%);
}

[data-user-theme="rosequartz"] .ambient-track.active {
  background: rgba(138, 49, 87, 0.12) !important;
  border-color: #8a3157 !important;
  box-shadow: 0 0 16px rgba(138, 49, 87, 0.25) !important;
}

[data-user-theme="rosequartz"] .ambient-track.active .ambient-track-toggle {
  background: linear-gradient(135deg, #8a3157 0%, #c45b83 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

[data-user-theme="rosequartz"] .pulse-dot {
  background: #c45b83 !important;
  box-shadow: 0 0 0 0 rgba(196, 91, 131, 0.7) !important;
}

body.dark-theme[data-user-theme="rosequartz"],
[data-user-theme="rosequartz"] body.dark-theme {
  --study-color-primary: #f472b6;
  --study-color-secondary: #c45b83;
  --study-color-accessory: #fbcfe8;
}

/* Super Duolingo / Siêu tân tinh (200d) */
[data-user-theme="super"] {
  --theme-stat-vote: #00d2ff;
  --theme-doc-action: #00d2ff;
  --theme-account-active: #00d2ff;
  --pts-pos-bg: rgba(0, 137, 123, 0.1);
  --pts-pos-color: #00875a;
  --pts-pos-border: rgba(0, 137, 123, 0.25);
  --pts-pos-bg-dark: rgba(0, 245, 155, 0.15);
  --pts-pos-color-dark: #00f59b;
  --pts-pos-border-dark: rgba(0, 245, 155, 0.3);
  --study-color-primary: #0070ba;
  --study-color-secondary: #00875a;
  --study-color-accessory: #6366f1;
  --primary-gradient: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%);
}

[data-user-theme="super"] .ambient-track.active {
  background: rgba(0, 210, 255, 0.12) !important;
  border-color: #00d2ff !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.3) !important;
}

[data-user-theme="super"] .ambient-track.active .ambient-track-toggle {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 100%) !important;
  border-color: transparent !important;
  color: #070926 !important;
}

[data-user-theme="super"] .pulse-dot {
  background: #00f59b !important;
  box-shadow: 0 0 0 0 rgba(0, 245, 155, 0.7) !important;
}

body.dark-theme[data-user-theme="super"],
[data-user-theme="super"] body.dark-theme {
  --study-color-primary: #00d2ff;
  --study-color-secondary: #00f59b;
  --study-color-accessory: #818cf8;
}

/* Celestial Diamond / Đen huyền bí (365d) */
[data-user-theme="diamond"] {
  --theme-stat-vote: #e2e8f0;
  --theme-doc-action: #e2e8f0;
  --theme-account-active: #ffffff;
  --pts-pos-bg: rgba(15, 23, 42, 0.08);
  --pts-pos-color: #0f172a;
  --pts-pos-border: rgba(15, 23, 42, 0.25);
  --pts-pos-bg-dark: rgba(255, 255, 255, 0.12);
  --pts-pos-color-dark: #ffffff;
  --pts-pos-border-dark: rgba(255, 255, 255, 0.35);
  --study-color-primary: #0f172a;
  --study-color-secondary: #334155;
  --study-color-accessory: #64748b;
  --primary-gradient: linear-gradient(135deg, #0f172a 0%, #334155 100%);
}

[data-user-theme="diamond"] .ambient-track.active {
  background: rgba(15, 23, 42, 0.08) !important;
  border-color: #0f172a !important;
  box-shadow: 0 0 16px rgba(15, 23, 42, 0.15) !important;
}

[data-user-theme="diamond"] .ambient-track.active .ambient-track-toggle {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] .pulse-dot {
  background: #0f172a !important;
  box-shadow: 0 0 0 0 rgba(15, 23, 42, 0.5) !important;
}

body.dark-theme[data-user-theme="diamond"],
[data-user-theme="diamond"] body.dark-theme {
  --study-color-primary: #ffffff;
  --study-color-secondary: #cbd5e1;
  --study-color-accessory: #94a3b8;
  --primary-gradient: linear-gradient(135deg, #cbd5e1 0%, #ffffff 100%);
}

body.dark-theme[data-user-theme="diamond"] .ambient-track.active,
[data-user-theme="diamond"] body.dark-theme .ambient-track.active {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.25) !important;
}

body.dark-theme[data-user-theme="diamond"] .ambient-track.active .ambient-track-toggle,
[data-user-theme="diamond"] body.dark-theme .ambient-track.active .ambient-track-toggle {
  background: #ffffff !important;
  border-color: transparent !important;
  color: #090d16 !important;
}

body.dark-theme[data-user-theme="diamond"] .pulse-dot,
[data-user-theme="diamond"] body.dark-theme .pulse-dot {
  background: #ffffff !important;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7) !important;
}

/* Mythic Prism / Tím hoàng gia (100d) */
[data-user-theme="mythic"] {
  --theme-stat-vote: #c084fc;
  --theme-doc-action: #c084fc;
  --theme-account-active: #c084fc;
  --pts-pos-bg: rgba(112, 72, 232, 0.1);
  --pts-pos-color: #7048e8;
  --pts-pos-border: rgba(112, 72, 232, 0.25);
  --pts-pos-bg-dark: rgba(192, 132, 252, 0.15);
  --pts-pos-color-dark: #c084fc;
  --pts-pos-border-dark: rgba(192, 132, 252, 0.3);
  --study-color-primary: #7048e8;
  --study-color-secondary: #9c36b5;
  --study-color-accessory: #d6336c;
  --primary-gradient: linear-gradient(135deg, #7048e8 0%, #a61e4d 100%);
}

[data-user-theme="mythic"] .ambient-track.active {
  background: rgba(112, 72, 232, 0.12) !important;
  border-color: #7048e8 !important;
}

[data-user-theme="mythic"] .ambient-track.active .ambient-track-toggle {
  background: linear-gradient(135deg, #7048e8 0%, #a61e4d 100%) !important;
  color: #fff !important;
}

/* Ruby / Đỏ huyết sắc (30d) */
[data-user-theme="ruby"] {
  --theme-stat-vote: #fb7185;
  --theme-doc-action: #fb7185;
  --theme-account-active: #fb7185;
  --pts-pos-bg: rgba(224, 49, 49, 0.1);
  --pts-pos-color: #e03131;
  --pts-pos-border: rgba(224, 49, 49, 0.25);
  --pts-pos-bg-dark: rgba(251, 113, 133, 0.15);
  --pts-pos-color-dark: #fb7185;
  --pts-pos-border-dark: rgba(251, 113, 133, 0.3);
  --study-color-primary: #e03131;
  --study-color-secondary: #c92a2a;
  --study-color-accessory: #ff6b6b;
  --primary-gradient: linear-gradient(135deg, #e03131 0%, #c92a2a 100%);
}

[data-user-theme="ruby"] .ambient-track.active {
  background: rgba(224, 49, 49, 0.12) !important;
  border-color: #e03131 !important;
}

[data-user-theme="ruby"] .ambient-track.active .ambient-track-toggle {
  background: linear-gradient(135deg, #e03131 0%, #c92a2a 100%) !important;
  color: #fff !important;
}

/* Community & Mobile Nav overrides to eliminate green leaks */
/* Ruby (Đỏ huyết sắc) */
[data-user-theme="ruby"] .btn-create-community {
  border-color: #c92a2a;
  background: rgba(201, 42, 42, 0.08);
  color: #c92a2a;
}
[data-user-theme="ruby"] .btn-create-community:hover {
  background: #c92a2a;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(201, 42, 42, 0.25);
}
[data-user-theme="ruby"] .community-sidebar-item.active {
  background: rgba(201, 42, 42, 0.08);
  border-color: #c92a2a;
}
[data-user-theme="ruby"] .mobile-link.active,
[data-user-theme="ruby"] .mobile-link.active svg,
[data-user-theme="ruby"] .mobile-link.active .mobile-nav-label {
  color: #c92a2a !important;
}

/* Rose Quartz (Thạch anh hồng) */
[data-user-theme="rosequartz"] .btn-create-community {
  border-color: #8a3157;
  background: rgba(138, 49, 87, 0.08);
  color: #8a3157;
}
[data-user-theme="rosequartz"] .btn-create-community:hover {
  background: #8a3157;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(138, 49, 87, 0.25);
}
[data-user-theme="rosequartz"] .community-sidebar-item.active {
  background: rgba(138, 49, 87, 0.08);
  border-color: #8a3157;
}
[data-user-theme="rosequartz"] .mobile-link.active,
[data-user-theme="rosequartz"] .mobile-link.active svg,
[data-user-theme="rosequartz"] .mobile-link.active .mobile-nav-label {
  color: #8a3157 !important;
}

/* Mythic (Tím hoàng gia) */
[data-user-theme="mythic"] .btn-create-community {
  border-color: #7048e8;
  background: rgba(112, 72, 232, 0.08);
  color: #7048e8;
}
[data-user-theme="mythic"] .btn-create-community:hover {
  background: #7048e8;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(112, 72, 232, 0.25);
}
[data-user-theme="mythic"] .community-sidebar-item.active {
  background: rgba(112, 72, 232, 0.08);
  border-color: #7048e8;
}
[data-user-theme="mythic"] .mobile-link.active,
[data-user-theme="mythic"] .mobile-link.active svg,
[data-user-theme="mythic"] .mobile-link.active .mobile-nav-label {
  color: #7048e8 !important;
}

/* Super (Siêu tân tinh) */
[data-user-theme="super"] .btn-create-community {
  border-color: #00cec9;
  background: rgba(0, 206, 201, 0.1);
  color: #00897b;
}
[data-user-theme="super"] .btn-create-community:hover {
  background: #00cec9;
  color: #0b0d28;
  box-shadow: 0 3px 8px rgba(0, 206, 201, 0.25);
}
[data-user-theme="super"] .community-sidebar-item.active {
  background: rgba(0, 206, 201, 0.1);
  border-color: #00cec9;
}
[data-user-theme="super"] .mobile-link.active,
[data-user-theme="super"] .mobile-link.active svg,
[data-user-theme="super"] .mobile-link.active .mobile-nav-label {
  color: #00897b !important;
}

/* Diamond (Đen huyền bí) */
[data-user-theme="diamond"] .btn-create-community {
  border-color: #0f172a;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
[data-user-theme="diamond"] .btn-create-community:hover {
  background: #0f172a;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.25);
}
[data-user-theme="diamond"] .community-sidebar-item.active {
  background: rgba(15, 23, 42, 0.08);
  border-color: #0f172a;
}
[data-user-theme="diamond"] .mobile-link.active,
[data-user-theme="diamond"] .mobile-link.active svg,
[data-user-theme="diamond"] .mobile-link.active .mobile-nav-label {
  color: #0f172a !important;
}

/* Dark mode variations for Diamond */
body.dark-theme [data-user-theme="diamond"] .btn-create-community,
[data-user-theme="diamond"] body.dark-theme .btn-create-community {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
body.dark-theme [data-user-theme="diamond"] .btn-create-community:hover,
[data-user-theme="diamond"] body.dark-theme .btn-create-community:hover {
  background: #ffffff;
  color: #090d16;
}
body.dark-theme [data-user-theme="diamond"] .community-sidebar-item.active,
[data-user-theme="diamond"] body.dark-theme .community-sidebar-item.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
}
body.dark-theme [data-user-theme="diamond"] .mobile-link.active,
body.dark-theme [data-user-theme="diamond"] .mobile-link.active svg,
body.dark-theme [data-user-theme="diamond"] .mobile-link.active .mobile-nav-label {
  color: #ffffff !important;
}

/* Flame SVG & Realistic Multi-directional Animations */
.flame-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
  overflow: visible !important;
  transform-origin: 50% 92%;
  filter: none !important;
  animation: flameRootSway 2.4s ease-in-out infinite alternate;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.flame-svg:hover {
  transform: scale(1.18);
}

/* 1. Root / Base Silhouette */
.flame-outer-base,
.flame-outer {
  transform-origin: 50% 95%;
  animation: flameBasePulse 2s ease-in-out infinite;
}

/* 2. Left Tongue (uốn lượn nhịp nhàng, khép kín 100%) */
.flame-tongue-left {
  transform-origin: 35% 85%;
  animation: flameLeftFlicker 1.8s ease-in-out infinite;
}

/* 3. Right Tongue (uốn lượn nhịp nhàng, khép kín 100%) */
.flame-tongue-right {
  transform-origin: 65% 85%;
  animation: flameRightFlicker 2s ease-in-out 0.3s infinite;
}

/* 4. Center Main Tongue (vươn cao & uốn sóng) */
.flame-tongue-center {
  transform-origin: 50% 90%;
  animation: flameCenterDance 1.6s ease-in-out infinite;
}

/* 5. Mid Layer (dòng đối lưu nhiệt tạo khối 3D) */
.flame-mid {
  transform-origin: 50% 90%;
  animation: flameMidConvection 1.4s ease-in-out infinite;
}

/* 6. Core Heat (nhịp thở nhiệt phát sáng) */
.flame-core,
.flame-inner {
  transform-origin: 50% 95%;
  animation: flameCoreHeat 1.2s ease-in-out infinite;
}

/* 7. Floating Embers (đốm lửa nhỏ bay lên) */
.flame-ember,
.flame-spark {
  transform-origin: center;
  opacity: 0;
}

.flame-ember.ember-1,
.flame-spark.spark-1 {
  animation: emberFloatUp1 1.8s ease-out infinite;
}

.flame-ember.ember-2,
.flame-spark.spark-2 {
  animation: emberFloatUp2 2.2s ease-out 0.6s infinite;
}

.flame-ember.ember-3,
.flame-spark.spark-3 {
  animation: emberFloatUp3 1.9s ease-out 1.1s infinite;
}

.flame-ember.ember-4,
.flame-spark.spark-4 {
  animation: emberFloatUp1 2.4s ease-out 0.3s infinite;
}

.flame-ember.ember-5,
.flame-spark.spark-5 {
  animation: emberFloatUp2 1.6s ease-out 0.9s infinite;
}

/* 8. Star Sparkles (✦) */
.flame-sparkle,
.flame-star {
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 3px #ffffff);
}

.flame-sparkle.sparkle-1,
.flame-star.star-1 {
  animation: sparkleGlint 1.8s ease-in-out infinite;
}

.flame-sparkle.sparkle-2,
.flame-star.star-2 {
  animation: sparkleGlint 2.1s ease-in-out 0.7s infinite;
}

.flame-sparkle.sparkle-3,
.flame-star.star-3 {
  animation: sparkleGlint 1.5s ease-in-out 0.4s infinite;
}

.flame-sparkle.sparkle-mythic,
.flame-star.star-mythic {
  filter: none !important;
}

.flame-sparkle.sparkle-super {
  animation: sparkleSuper 1.2s ease-in-out infinite alternate;
  transform-origin: center;
}

/* Tier 8: High-Jewelry Diamond Glints, Shards & Crystal Dust (No cartoon stars) */
.flame-diamond-glint {
  transform-box: fill-box;
  transform-origin: center;
  animation: diamondGlintTwinkle 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 2px #ffffff) drop-shadow(0 0 5px rgba(224, 242, 254, 0.75));
}

.flame-diamond-glint.glint-1 {
  animation-delay: 0s;
}

.flame-diamond-glint.glint-2 {
  animation-delay: 0.8s;
}

.flame-diamond-glint.glint-3 {
  animation-delay: 1.6s;
}

.flame-diamond-shard {
  transform-box: fill-box;
  transform-origin: center;
  animation: diamondShardFloat 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.85));
}

.flame-diamond-shard.shard-1 {
  animation-delay: 0.4s;
}

.flame-diamond-shard.shard-2 {
  animation-delay: 1.8s;
}

.flame-diamond-dust {
  animation: diamondDustFloat 2s ease-in-out infinite alternate;
}

.flame-diamond-facets {
  animation: diamondFacetPulse 2.6s ease-in-out infinite alternate;
}

@keyframes sparkleSuper {
  0% {
    transform: scale(0.7) rotate(0deg);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.25) rotate(45deg);
    opacity: 1;
  }
}

@keyframes diamondGlintTwinkle {

  0%,
  100% {
    transform: scale(0.6) rotate(0deg);
    opacity: 0.35;
  }

  50% {
    transform: scale(1.3) rotate(45deg);
    opacity: 1;
  }
}

@keyframes diamondShardFloat {

  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.65;
  }

  50% {
    transform: translateY(-2px) rotate(15deg);
    opacity: 1;
  }
}

@keyframes diamondDustFloat {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0.4;
  }

  100% {
    transform: translateY(-3px) scale(1.15);
    opacity: 1;
  }
}

@keyframes diamondFacetPulse {
  0% {
    opacity: 0.75;
  }

  100% {
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
  }
}

/* Tier Glows (Crisp vector rendering without blurry halo or background) */
.flame-svg,
.flame-svg.flame-tier-0,
.flame-svg.flame-tier-1,
.flame-svg.flame-tier-2,
.flame-svg.flame-tier-3,
.flame-svg.flame-tier-4,
.flame-svg.flame-tier-5,
.flame-svg.flame-tier-6,
.flame-svg.flame-tier-7,
.flame-svg.flame-tier-8 {
  filter: none !important;
}

.flame-svg.flame-tier-5 {
  animation: flameRootSway 2.4s ease-in-out infinite;
}

.flame-svg.flame-tier-6 {
  animation: flameRootSway 2.2s ease-in-out infinite;
}

.flame-svg.flame-tier-7 {
  animation: flameRootSway 2s ease-in-out infinite;
}

.flame-svg.flame-tier-8 {
  animation: flameRootSway 1.8s ease-in-out infinite;
}

/* KEYFRAMES FOR 100% SEAMLESS PERIODIC FIRE DYNAMICS (ZERO JUMP / ZERO KHỰNG) */
@keyframes flameRootSway {

  0%,
  100% {
    transform: rotate(-1.5deg) scale(0.99, 1.01);
  }

  50% {
    transform: rotate(1.5deg) scale(1.01, 0.99);
  }
}

@keyframes flameBasePulse {

  0%,
  100% {
    transform: scale(0.98, 1.02);
  }

  50% {
    transform: scale(1.02, 0.98);
  }
}

@keyframes flameLeftFlicker {

  0%,
  100% {
    transform: rotate(-2.5deg) scale(0.96, 1.03) skewX(-1.5deg);
  }

  35% {
    transform: rotate(1.2deg) scale(1.03, 0.97) skewX(1.2deg);
  }

  70% {
    transform: rotate(-0.5deg) scale(0.98, 1.02) skewX(-0.5deg);
  }
}

@keyframes flameRightFlicker {

  0%,
  100% {
    transform: rotate(2.5deg) scale(0.97, 1.03) skewX(1.5deg);
  }

  40% {
    transform: rotate(-1.5deg) scale(1.03, 0.97) skewX(-1.2deg);
  }

  75% {
    transform: rotate(0.8deg) scale(0.99, 1.01) skewX(0.5deg);
  }
}

@keyframes flameCenterDance {

  0%,
  100% {
    transform: scale(0.97, 1.03) translateY(-0.2px) skewX(-1deg);
  }

  50% {
    transform: scale(1.03, 0.97) translateY(0.3px) skewX(1.2deg);
  }
}

@keyframes flameMidConvection {

  0%,
  100% {
    transform: scale(0.96, 1.04) translateY(-0.2px);
    opacity: 0.94;
  }

  50% {
    transform: scale(1.04, 0.96) translateY(0.2px);
    opacity: 1;
  }
}

@keyframes flameCoreHeat {

  0%,
  100% {
    transform: scale(0.92, 1.06);
    opacity: 0.88;
  }

  50% {
    transform: scale(1.08, 0.94);
    opacity: 1;
  }
}

@keyframes emberFloatUp1 {
  0% {
    transform: translateY(0) translateX(0) scale(0.3);
    opacity: 0;
  }

  25% {
    opacity: 0.9;
    transform: translateY(-3px) translateX(-0.5px) scale(1);
  }

  80% {
    opacity: 0.7;
    transform: translateY(-9px) translateX(0.8px) scale(0.7);
  }

  100% {
    opacity: 0;
    transform: translateY(-13px) translateX(1.2px) scale(0.2);
  }
}

@keyframes emberFloatUp2 {
  0% {
    transform: translateY(0) translateX(0) scale(0.3);
    opacity: 0;
  }

  30% {
    opacity: 0.9;
    transform: translateY(-3.5px) translateX(0.6px) scale(1);
  }

  85% {
    opacity: 0.7;
    transform: translateY(-10px) translateX(-0.8px) scale(0.6);
  }

  100% {
    opacity: 0;
    transform: translateY(-14px) translateX(-1.2px) scale(0.2);
  }
}

@keyframes emberFloatUp3 {
  0% {
    transform: translateY(0) scale(0.3);
    opacity: 0;
  }

  35% {
    opacity: 0.9;
    transform: translateY(-4px) scale(1);
  }

  80% {
    opacity: 0.7;
    transform: translateY(-9px) scale(0.6);
  }

  100% {
    opacity: 0;
    transform: translateY(-13px) scale(0.2);
  }
}

@keyframes sparkleGlint {

  0%,
  100% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }

  50% {
    transform: scale(1.15) rotate(90deg);
    opacity: 1;
  }
}

@keyframes mythicPrismAura {

  0%,
  100% {
    filter: none;
  }
}

/* Contribution Card & Tiers */
.contribution-card {
  border-radius: 12px;
  background: linear-gradient(135deg, #123d30 0%, #1c523f 100%);
  color: white;
  padding: 18px 20px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(18, 61, 48, 0.2);
  border: 1px solid rgba(138, 177, 141, 0.25);
  transition: all 0.4s ease;
}

.contribution-card:after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  right: -115px;
  bottom: -145px;
  pointer-events: none;
}

.contribution-card[data-streak-tier="7"]:after,
.contribution-card[data-streak-tier="8"]:after {
  display: none !important;
}

/* Tier 0 (0-2d): Sage Green */
.contribution-card[data-streak-tier="0"] {
  background: linear-gradient(135deg, #123d30 0%, #1d503e 100%);
  border-color: rgba(138, 177, 141, 0.25);
}

.contribution-card[data-streak-tier="0"] .streak-tier-label {
  color: #c2d5c4;
}

/* Tier 1 (3-6d): Sapphire Blue */
.contribution-card[data-streak-tier="1"] {
  background: linear-gradient(135deg, #0b2545 0%, #134074 100%);
  border-color: rgba(77, 171, 247, 0.35);
  box-shadow: 0 16px 36px rgba(11, 37, 69, 0.35);
}

.contribution-card[data-streak-tier="1"] .card-topline {
  color: #a5d8ff;
}

.contribution-card[data-streak-tier="1"] .streak-tier-label {
  color: #a5d8ff;
}

/* Tier 2 (7-13d): Amber Gold */
.contribution-card[data-streak-tier="2"] {
  background: linear-gradient(135deg, #3d2a02 0%, #634505 100%);
  border-color: rgba(255, 212, 59, 0.45);
  box-shadow: 0 16px 36px rgba(99, 69, 5, 0.35);
}

.contribution-card[data-streak-tier="2"] .card-topline {
  color: #ffe066;
}

.contribution-card[data-streak-tier="2"] .streak-tier-label {
  color: #ffe066;
}

/* Tier 3 (14-29d): Amethyst Purple */
.contribution-card[data-streak-tier="3"] {
  background: linear-gradient(135deg, #2a0e4a 0%, #4c1880 100%);
  border-color: rgba(177, 151, 252, 0.45);
  box-shadow: 0 16px 36px rgba(76, 24, 128, 0.4);
}

.contribution-card[data-streak-tier="3"] .card-topline {
  color: #d0bfff;
}

.contribution-card[data-streak-tier="3"] .streak-tier-label {
  color: #d0bfff;
}

/* Tier 4 (30-49d): Ruby Crimson */
.contribution-card[data-streak-tier="4"] {
  background: linear-gradient(135deg, #440c14 0%, #7a1523 100%);
  border-color: rgba(255, 107, 107, 0.5);
  box-shadow: 0 16px 36px rgba(122, 21, 35, 0.45);
}

.contribution-card[data-streak-tier="4"] .card-topline {
  color: #ffc9c9;
}

.contribution-card[data-streak-tier="4"] .streak-tier-label {
  color: #ffc9c9;
}

/* Tier 5 (50-99d): Học giả uyên bác - Rose Quartz */
.contribution-card[data-streak-tier="5"] {
  background: linear-gradient(135deg, #3d1425 0%, #5c1e3a 45%, #8a3157 80%, #b84373 100%);
  border-color: rgba(232, 169, 193, 0.45);
  box-shadow: 0 16px 40px rgba(138, 49, 87, 0.35);
}

.contribution-card[data-streak-tier="5"] .card-topline,
.contribution-card[data-streak-tier="5"] .streak-tier-label {
  color: #fde8ef;
  text-shadow: 0 0 10px rgba(196, 91, 131, 0.6);
}

/* Tier 6 (100-199d): Nhà kiến tạo tri thức - Mythic Prism (old tier 5) */
.contribution-card[data-streak-tier="6"] {
  background: linear-gradient(135deg, #280838 0%, #4a0e4e 45%, #7048e8 75%, #a61e4d 100%);
  border-color: rgba(247, 131, 172, 0.65);
  box-shadow: 0 16px 40px rgba(112, 72, 232, 0.45), 0 0 20px rgba(255, 212, 59, 0.3);
}

.contribution-card[data-streak-tier="6"] .card-topline,
.contribution-card[data-streak-tier="6"] .streak-tier-label {
  color: #ffe066;
  text-shadow: 0 0 8px rgba(247, 131, 172, 0.6);
}

/* Tier 7 (200-364d): Bậc thầy học thuật - Super Duolingo Neon */
.contribution-card[data-streak-tier="7"] {
  background-color: #070926;
  background-image: url('covers/super-space-bg.jpg'), linear-gradient(135deg, #070926 0%, #0d1238 35%, #1e1b4b 70%, #2e0854 100%);
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(0, 210, 255, 0.55);
  box-shadow: 0 16px 44px rgba(99, 102, 241, 0.45), 0 0 25px rgba(0, 245, 155, 0.3);
  position: relative;
  overflow: hidden;
  max-width: 384px;
  width: 100%;
  box-sizing: border-box;
}

.contribution-card[data-streak-tier="7"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(1.5px 1.5px at 20% 30%, #ffffff, rgba(0,0,0,0)),
                    radial-gradient(1.5px 1.5px at 40% 70%, #00f59b, rgba(0,0,0,0)),
                    radial-gradient(1px 1px at 60% 20%, #00d2ff, rgba(0,0,0,0)),
                    radial-gradient(2px 2px at 80% 60%, #ec4899, rgba(0,0,0,0)),
                    radial-gradient(1px 1px at 90% 15%, #ffffff, rgba(0,0,0,0)),
                    radial-gradient(1.5px 1.5px at 15% 85%, #818cf8, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 240px 240px;
  opacity: 0.65;
  animation: cosmicStardustTwinkle 8s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
}

@keyframes cosmicStardustTwinkle {
  0% { opacity: 0.35; }
  50% { opacity: 0.85; }
  100% { opacity: 0.45; }
}

.contribution-card[data-streak-tier="7"] > *:not(canvas) {
  position: relative;
  z-index: 2;
}

.contribution-card[data-streak-tier="7"] .card-topline {
  color: #00f59b;
  text-shadow: 0 0 10px rgba(0, 245, 155, 0.7);
}

.contribution-card[data-streak-tier="7"] .streak-tier-label {
  color: #00d2ff;
  text-shadow: 0 0 12px rgba(0, 210, 255, 0.75);
}

/* Tier 8 (365+d): Học giả lưu danh - Celestial Diamond Luxury (Concept Mảnh thủy tinh / Low-poly faceted glass shards) */
.contribution-card[data-streak-tier="8"] {
  background-color: #f1f5f9;
  background-image: url('covers/streak-faceted-platinum.svg');
  background-size: cover;
  background-position: center;
  border: 1.5px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16), 0 0 24px rgba(255, 255, 255, 0.95);
  color: #0f172a;
  max-width: 384px;
  width: 100%;
  box-sizing: border-box;
}

.contribution-card[data-streak-tier="8"] > *:not(canvas) {
  position: relative;
  z-index: 2;
}

.contribution-card[data-streak-tier="8"]::after {
  content: "";
  position: absolute;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
  background-size: 250% 250%;
  pointer-events: none;
  animation: diamondCardSheenSweep 6s ease-in-out infinite;
  z-index: 1;
}

@keyframes diamondCardSheenSweep {
  0%,
  100% {
    background-position: 0% 0%;
    opacity: 0.2;
  }

  50% {
    background-position: 100% 100%;
    opacity: 0.8;
  }
}

.contribution-card[data-streak-tier="8"] .card-topline {
  color: #0f172a !important;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.contribution-card[data-streak-tier="8"] .streak-tier-label {
  color: #0f172a !important;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.contribution-card[data-streak-tier="8"] .streak-number {
  color: #0f172a !important;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.contribution-card[data-streak-tier="8"] .streak-number span {
  color: #475569 !important;
}

.contribution-card[data-streak-tier="8"] .streak-journey-btn,
.contribution-card[data-streak-tier="8"] .streak-shield-badge {
  background: rgba(255, 255, 255, 0.85) !important;
  color: #0f172a !important;
  border-color: rgba(148, 163, 184, 0.6) !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08), inset 0 1px 0 #ffffff !important;
}

.contribution-card[data-streak-tier="8"] .streak-shield-badge .shield-icon {
  color: #0f172a !important;
}

/* Tier 8 Contribution Card Day Labels in Light Mode (High Contrast Black) */
html:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day,
body:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day {
  color: #0f172a !important;
  font-weight: 700 !important;
}

html:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day small,
body:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day small {
  color: #0f172a !important;
  font-weight: 700 !important;
}

html:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day i,
body:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day i {
  border-color: rgba(15, 23, 42, 0.28) !important;
  background: rgba(15, 23, 42, 0.06) !important;
  color: #0f172a !important;
}

html:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day.done i,
body:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day.done i {
  background: rgba(15, 23, 42, 0.15) !important;
  border-color: rgba(15, 23, 42, 0.55) !important;
  color: #0f172a !important;
}

html:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day.today i,
body:not(.dark-theme) .contribution-card[data-streak-tier="8"] .day.today i {
  border-color: #0f172a !important;
  box-shadow: 0 0 10px rgba(15, 23, 42, 0.3) !important;
  color: #0f172a !important;
}

/* Tier 8 Contribution Card Day Labels in Dark Mode (Pure White & Starlight Contrast) */
html.dark-theme .contribution-card[data-streak-tier="8"] .day,
body.dark-theme .contribution-card[data-streak-tier="8"] .day {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .day small,
body.dark-theme .contribution-card[data-streak-tier="8"] .day small {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .day i,
body.dark-theme .contribution-card[data-streak-tier="8"] .day i {
  border-color: rgba(255, 255, 255, 0.4) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .day.done i,
body.dark-theme .contribution-card[data-streak-tier="8"] .day.done i {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.85) !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .day.today i,
body.dark-theme .contribution-card[data-streak-tier="8"] .day.today i {
  border-color: #ffffff !important;
  box-shadow: 0 0 14px rgba(255, 255, 255, 0.8) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.35) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"],
body.dark-theme .contribution-card[data-streak-tier="8"] {
  background-color: #05070e !important;
  background-image: url('covers/streak-faceted-obsidian.svg') !important;
  background-size: cover !important;
  background-position: center !important;
  border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.85), 0 0 28px rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"]::after,
body.dark-theme .contribution-card[data-streak-tier="8"]::after {
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.15) 50%, transparent 65%) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .card-topline,
body.dark-theme .contribution-card[data-streak-tier="8"] .card-topline {
  color: #f8fafc !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .streak-tier-label,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-tier-label {
  color: #ffffff !important;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.85) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .streak-number,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-number {
  color: #ffffff !important;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.7) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .streak-number span,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-number span {
  color: #cbd5e1 !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .streak-journey-btn,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-journey-btn,
html.dark-theme .contribution-card[data-streak-tier="8"] .streak-shield-badge,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-shield-badge {
  background: rgba(15, 23, 42, 0.85) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

html.dark-theme .contribution-card[data-streak-tier="8"] .streak-shield-badge .shield-icon,
body.dark-theme .contribution-card[data-streak-tier="8"] .streak-shield-badge .shield-icon {
  color: #ffffff !important;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 9px "Unbounded", sans-serif;
  letter-spacing: 0.8px;
  color: #c2d5c4;
}

.topline-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topline-actions {
  display: flex;
  align-items: center;
}

.streak-journey-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}

.streak-journey-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.streak-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 10px;
}

.streak-flame-wrap {
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.streak-flame-interactive {
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
  outline: none;
  border-radius: 50%;
}

.streak-flame-interactive:hover {
  transform: scale(1.1);
  filter: brightness(1.12);
}

.streak-flame-interactive:active {
  transform: scale(0.92);
}

.streak-flame-interactive:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

@keyframes streakTogglePop {
  0% {
    transform: scale(0.85);
    filter: brightness(1.4) drop-shadow(0 0 12px #ffffff);
  }

  50% {
    transform: scale(1.2);
    filter: brightness(1.2) drop-shadow(0 0 8px currentColor);
  }

  100% {
    transform: scale(1);
    filter: none;
  }
}

.streak-flame-interactive.streak-just-toggled {
  animation: streakTogglePop 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.streak-val-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.streak-number {
  font: 38px/1 var(--serif);
  margin: 0;
  padding: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.streak-number span {
  font: 14px var(--sans);
  font-weight: 600;
  opacity: 0.85;
}

.streak-tier-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.92;
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.streak-shield-wrap {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.streak-shield-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.16);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  white-space: nowrap;
  backdrop-filter: blur(4px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}

.streak-shield-badge:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1.5px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.streak-shield-badge:active {
  transform: translateY(0) scale(0.98);
}

.streak-shield-notice {
  background: rgba(255, 255, 255, 0.15);
  border-left: 3px solid #f59f00;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  margin-bottom: 10px;
  color: #fff;
}

/* Week Strip Mini Flames */
.week-strip {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
  margin-top: 6px;
}

.day {
  display: grid;
  place-items: center;
  gap: 3px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 9px;
  font-weight: 600;
}

.day i {
  font-style: normal;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  font-size: 10px;
  transition: all 0.2s ease;
}

.day.done i {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
}

.day.today i {
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Streak Journey Modal Styling */
.streak-journey-modal {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  max-width: 620px;
  width: 92%;
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  background: var(--paper);
}

.admin-streak-test-bar {
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-admin-streak-preset {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(5, 150, 105, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: #065f46;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-admin-streak-preset:hover {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
  transform: translateY(-1px);
}

html.dark-theme .btn-admin-streak-preset,
body.dark-theme .btn-admin-streak-preset {
  background: rgba(15, 23, 42, 0.7);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}

html.dark-theme .btn-admin-streak-preset:hover,
body.dark-theme .btn-admin-streak-preset:hover {
  background: #059669;
  color: #ffffff;
}

.streak-journey-header {
  background: linear-gradient(135deg, #123d30 0%, #1f5742 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.streak-journey-header .eyebrow {
  margin: 0;
  font: 10px "Unbounded", sans-serif;
  letter-spacing: 1px;
}

.streak-journey-header h2 {
  margin: 4px 0 0;
  font-size: 20px;
  color: #fff;
}

.streak-journey-body {
  padding: 20px 24px 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.streak-journey-banner-container {
  border-radius: 12px;
  background: linear-gradient(135deg, #0b2545 0%, #2b134b 50%, #440d13 100%);
  color: white;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.journey-banner-icon {
  font-size: 36px;
  margin-bottom: 6px;
}

.journey-banner-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}

.journey-banner-subtitle {
  font-size: 12px;
  opacity: 0.85;
}

.journey-milestones-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.journey-milestone-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.journey-milestone-card.unlocked {
  border-color: #ffd43b;
  background: #fffdf5;
  box-shadow: 0 4px 14px rgba(245, 159, 0, 0.12);
}

.journey-milestone-card.active-target {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(18, 61, 48, 0.12);
}

.milestone-badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  flex-shrink: 0;
}

.milestone-info {
  flex: 1;
}

.milestone-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.milestone-days {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.milestone-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.journey-milestone-card.unlocked .milestone-status {
  background: #fff3bf;
  color: #d9480f;
}

.milestone-desc {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.milestone-perks-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.milestone-perk-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.4;
}

.milestone-perk-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.milestone-perk-tag.perk-forum {
  background: rgba(25, 96, 68, 0.1);
  color: #196044;
  border: 1px solid rgba(25, 96, 68, 0.22);
}

.milestone-perk-tag.perk-study {
  background: rgba(14, 116, 144, 0.1);
  color: #0e7490;
  border: 1px solid rgba(14, 116, 144, 0.22);
}

.milestone-perk-text {
  color: var(--muted);
}

.journey-milestone-card.unlocked .milestone-perk-text {
  color: var(--ink);
}

.milestone-perk-text.perk-study-waiting {
  color: #8c9b93;
  font-style: italic;
}

@media (max-width: 600px) {
  .journey-milestone-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon title"
      "perks perks";
    padding: 12px;
    gap: 8px 12px;
    align-items: center;
  }

  .milestone-badge-icon {
    grid-area: icon;
    width: 36px;
    height: 36px;
    align-self: center;
    margin: 0;
  }

  .milestone-info {
    display: contents;
  }

  .milestone-title-row {
    grid-area: title;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    margin: 0;
  }

  .milestone-days {
    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.35;
  }

  .milestone-status {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    line-height: 1.35;
  }

  .milestone-perks-container {
    grid-area: perks;
    width: 100%;
    gap: 6px;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
  }

  .journey-milestone-card.unlocked .milestone-perks-container {
    border-top: 1px dashed rgba(245, 159, 0, 0.25);
  }

  .milestone-perk-row {
    font-size: 11px;
    gap: 6px;
    align-items: baseline;
  }

  .milestone-perk-tag {
    font-size: 9.5px;
    padding: 1px 6px;
  }

  .milestone-perk-text {
    font-size: 11px;
    line-height: 1.4;
    word-break: break-word;
  }

  .streak-journey-body {
    padding: 14px 14px 18px;
  }

  .streak-journey-header {
    padding: 16px 18px;
  }
}

/* Journey Shield Pill in Modal Header */
.journey-shield-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 5px 11px;
  border-radius: 20px;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  font-family: inherit;
}

.journey-shield-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   STREAK SHIELD MODAL STYLING
   ========================================== */
.streak-shield-modal {
  border: none;
  border-radius: 18px;
  overflow: hidden;
  max-width: 520px;
  width: 92%;
  padding: 0;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  background: var(--paper, #fff);
  font-family: var(--sans);
}

.streak-shield-header {
  background: linear-gradient(135deg, #092c3e 0%, #11536b 50%, #0d465c 100%);
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.streak-shield-header .eyebrow {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #7dd3fc;
}

.streak-shield-header h2 {
  margin: 4px 0 0;
  font-size: 19px;
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-shield-body {
  padding: 20px 22px 24px;
  max-height: 72vh;
  overflow-y: auto;
}

/* Overview card with slots */
.shield-overview-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 14px;
  padding: 18px 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.shield-overview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shield-count-hero {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 2px;
}

.shield-count-num {
  font-size: 32px;
  font-weight: 900;
  color: #38bdf8;
  line-height: 1;
}

.shield-count-max {
  font-size: 15px;
  font-weight: 700;
  color: #94a3b8;
}

.shield-slots-row {
  display: flex;
  gap: 8px;
}

.shield-slot {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s ease;
}

.shield-slot.filled {
  background: rgba(56, 189, 248, 0.2);
  border: 1.5px solid #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.shield-slot.empty {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  color: #64748b;
  font-size: 13px;
}

.shield-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  line-height: 1.4;
}

/* Feature info rules box */
.shield-rules-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
}

.shield-rules-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shield-rules-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: #475569;
  line-height: 1.45;
  margin: 0;
  padding: 0;
}

.shield-rules-list li {
  list-style: none;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

/* History filter tabs & list */
.shield-history-section {
  margin-top: 18px;
}

.shield-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}

.shield-history-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shield-history-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
}

.shield-tab-btn {
  border: none;
  background: none;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.shield-tab-btn.active {
  background: #fff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.shield-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 2px;
}

.shield-log-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  gap: 10px;
  transition: transform 0.15s ease;
}

.shield-log-item:hover {
  transform: translateX(2px);
}

.shield-log-item.is-add {
  border-left: 3.5px solid #10b981;
}

.shield-log-item.is-use {
  border-left: 3.5px solid #ef4444;
}

.shield-log-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.shield-log-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.shield-log-badge.add {
  background: #ecfdf5;
  color: #059669;
}

.shield-log-badge.use {
  background: #fef2f2;
  color: #dc2626;
}

.shield-log-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shield-log-reason {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shield-log-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

.shield-log-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.shield-log-delta {
  font-size: 13px;
  font-weight: 800;
}

.shield-log-delta.add {
  color: #059669;
}

.shield-log-delta.use {
  color: #dc2626;
}

.shield-log-balance {
  font-size: 10.5px;
  color: #64748b;
}

.shield-history-empty {
  text-align: center;
  padding: 24px 12px;
  color: #94a3b8;
  font-size: 12.5px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
}

@media (max-width: 600px) {
  .streak-shield-body {
    padding: 16px 14px 20px;
  }

  .streak-shield-header {
    padding: 16px 18px;
  }

  .shield-overview-card {
    padding: 14px 16px;
  }

  .shield-count-num {
    font-size: 28px;
  }

  .shield-slot {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .shield-history-list {
    max-height: 200px;
  }
}

.search-panel {
  height: 66px;
  margin: 33px 0 45px;
  background: #fff;
  border: 1px solid #d8e0d6;
  box-shadow: 0 10px 20px #1d4e3810;
  border-radius: 9px;
  display: flex;
  align-items: center;
  padding: 0 19px;
  gap: 13px;
}

.search-glyph {
  font-size: 25px;
  color: #34634e;
}

.search-panel input,
.search-inline input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 16px;
}

.search-panel input::placeholder,
.search-inline input::placeholder {
  color: #89978f;
}

.search-panel kbd {
  border: 1px solid #dce3dc;
  border-radius: 4px;
  padding: 2px 6px;
  color: #8a998f;
  font:
    10px "Unbounded",
    sans-serif;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 48px;
}

.announcement {
  background: #e5eee1;
  border-left: 3px solid #5e9470;
  padding: 20px 21px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-radius: 0 8px 8px 0;
}

.announcement-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #cee1c9;
  color: #286143;
  font-size: 16px;
  flex: none;
}

.announcement h2 {
  font-size: 14px;
  margin: 0 0 3px;
  letter-spacing: -0.2px;
}

.announcement p:not(.eyebrow) {
  font-size: 11px;
  color: #597067;
  margin: 0;
}

.announcement .eyebrow {
  font-size: 8px;
  margin-bottom: 4px;
}

.arrow-circle {
  border: 0;
  background: transparent;
  font-size: 20px;
  color: var(--ink);
  margin-left: auto;
}

.section-block {
  margin-top: 43px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-heading h2,
.account-activity h2 {
  font: 400 26px/1.15 var(--serif);
  letter-spacing: -1px;
  margin: 0;
}

.text-link {
  border: 0;
  background: transparent;
  color: #2b7451;
  font-weight: 800;
  font-size: 11px;
  padding: 5px 0;
}

.post-list {
  border-top: 1px solid var(--line);
}

.post-card {
  padding: 18px 10px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.16s ease, transform 0.16s ease;
}

.post-card:hover {
  background: rgba(18, 61, 48, 0.035);
}

.edit-timer-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  opacity: 0.75;
  transition: opacity 0.2s;
  flex-shrink: 0;
  color: var(--ink, #1e293b);
  box-sizing: border-box;
}

.edit-timer-btn:hover {
  opacity: 1;
}

.edit-timer-btn svg.edit-countdown-svg,
.edit-timer-btn svg.timer-circle {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 24px !important;
  max-height: 24px !important;
  transform: rotate(-90deg) !important;
}

.edit-timer-btn svg circle {
  fill: none;
  stroke: var(--sage-4, #c2d1c7);
  stroke-width: 2;
}

.edit-timer-btn svg circle.progress {
  stroke: var(--ink, #1e293b);
  stroke-dasharray: 63;
  /* 2 * pi * r (r=10) */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}

.edited-indicator {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.6;
}

.post-card .avatar {
  margin-top: 2px;
}

.post-meta {
  font-size: 10px;
  color: #718178;
  margin-bottom: 5px;
}

.post-meta b:not([class*="user-name"]):not(.user-name-default) {
  color: #416f55;
}

.post-card h3 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 5px;
  letter-spacing: -0.2px;
}

.post-card>div p {
  font-size: 11px;
  color: #687a70;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  min-width: max-content;
}

.post-stats-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.post-stats-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.post-stat-item.stat-views {
  color: var(--muted, #64748b);
}

.post-stat-item.stat-comments {
  color: #2e5944;
}

.post-stat-item.stat-votes {
  color: var(--primary, #123d30);
}

body.dark-theme .post-stat-item.stat-comments {
  color: #6ee7b7;
}

body.dark-theme .post-stat-item.stat-votes {
  color: var(--theme-stat-vote, #34d399);
}

.post-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-family: var(--sans);
  color: #246247;
  background: #e2efdf;
  border: 1px solid rgba(36, 98, 71, 0.15);
  white-space: nowrap;
  box-sizing: border-box;
  text-decoration: none;
}

.post-tag.post-doc-tag {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  cursor: pointer;
  transition: all 0.15s ease;
}

.post-tag.post-doc-tag:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #b45309;
}

body.dark-theme .post-tag {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.25);
}

body.dark-theme .post-tag.post-doc-tag {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

body.dark-theme .post-tag.post-doc-tag:hover {
  background: rgba(251, 191, 36, 0.22);
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.mini-card {
  background: #f3f4ed;
  border-radius: 8px;
  padding: 19px 19px;
}

.topics-card {
  background: #f0f4ec;
}

.topic-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mobile-topics {
  display: none;
}

.topic {
  border: 1px solid #ccdbcb;
  background: #f9fbf7;
  color: #3c624d;
  border-radius: 20px;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.topic:hover {
  border-color: #4f8464;
}

.active-card {
  background: #fcfbf6;
  border: 1px solid #edf0e9;
}

.active-card-title {
  display: flex;
  justify-content: space-between;
}

.active-card-title>span {
  color: #568065;
}

.active-card ul {
  list-style: none;
  padding: 0;
  margin: 13px 0 0;
}

.active-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  min-width: 0;
}

.active-card li p,
.global-contrib-text {
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  color: #5b6e63;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.active-card li strong {
  color: var(--ink);
  font-weight: 600;
}

.global-contrib-action {
  color: #5b6e63;
}

.global-contrib-sep {
  display: inline-block;
  margin: 0 4px;
  opacity: 0.5;
}

.active-card small {
  color: #8b9990;
  font-size: 10px;
  white-space: nowrap;
}

body.dark-theme .global-contrib-text,
body.dark-theme .global-contrib-action {
  color: #94a3b8;
}

body.dark-theme .active-card li strong {
  color: #f1f5f9;
}

.forum-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 2px 0 35px;
}

.forum-heading h1 {
  font-size: 44px;
}

.forum-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-inline {
  height: 48px;
  background: #fff;
  border: 1px solid #dce4db;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex: 1;
}

.search-inline span {
  font-size: 21px;
  color: #527b63;
}

.filter-button {
  border: 1px solid #cedacd;
  background: #f5f8f3;
  color: var(--ink);
  border-radius: 7px;
  min-width: 94px;
  font-size: 12px;
  font-weight: 800;
}

.filters {
  display: none;
  align-items: center;
  gap: 7px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.filters.open {
  display: flex;
}

.filter-chip {
  background: transparent;
  border: 0;
  color: #6d7d74;
  border-radius: 17px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
}

.filter-chip:hover,
.filter-chip.selected {
  background: #dcebd8;
  color: #275d42;
}

.filter-divider {
  height: 22px;
  border-left: 1px solid var(--line);
  margin: 0 3px;
}

.filters select {
  border: 0;
  background: transparent;
  color: #496453;
  font-size: 11px;
  font-weight: 700;
  outline: 0;
}

.forum-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 32px;
}

@media (min-width: 1400px) {
  .forum-layout {
    grid-template-columns: minmax(0, 1fr) 370px;
    gap: 36px;
  }
}

.forum-feed {
  border-top: 1px solid var(--line);
}

.forum-feed .post-card {
  padding: 21px 4px;
}

.forum-feed .post-card h3 {
  font-size: 15px;
}

.forum-aside {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.forum-aside h3 {
  font: 400 19px var(--serif);
  margin: 4px 0 8px;
}

.forum-aside p:not(.eyebrow) {
  font-size: 11px;
  color: #63736a;
  line-height: 1.6;
  margin: 0;
}

.stat-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.stat-card .eyebrow {
  grid-column: span 2;
}

.stat-card div {
  border-top: 1px solid #d9e2d5;
  padding-top: 9px;
  display: flex;
  flex-direction: column;
}

.stat-card strong {
  font: 400 25px var(--serif);
}

.stat-card span {
  font-size: 9px;
  color: #728179;
}

.document-tabs {
  display: flex;
  gap: 21px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 25px;
}

.tab {
  border: 0;
  background: transparent;
  padding: 0 2px 11px;
  color: #718077;
  font-size: 12px;
  font-weight: 800;
  position: relative;
}

.tab.active {
  color: var(--ink);
}

.tab.active:after {
  content: "";
  position: absolute;
  height: 2px;
  background: #357452;
  left: 0;
  right: 0;
  bottom: -1px;
}

.document-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.document-card {
  background: #fff;
  border: 1px solid #e4e9e2;
  border-radius: 8px;
  padding: 18px;
  min-height: 198px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px #173d2b12;
}

.document-type {
  width: max-content;
  height: 24px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 700;
  font-size: 10px;
  font-family: var(--sans);
  margin-bottom: 16px;
  text-transform: uppercase;
  background: #f0f0f0;
  color: #666;
  box-sizing: border-box;
  line-height: 1;
}

.document-type[data-format="PDF"] {
  background: #fce4e4;
  color: #c92a2a;
}

.document-type[data-format="Word"],
.document-type[data-format="DOCX"],
.document-type[data-format="DOC"] {
  background: #e7f5ff;
  color: #1971c2;
}

.document-type[data-format="Slide"],
.document-type[data-format="PPTX"],
.document-type[data-format="PPT"] {
  background: #fff4e6;
  color: #d9480f;
}

.document-type[data-format="Bảng tính"],
.document-type[data-format="Excel"],
.document-type[data-format="XLSX"],
.document-type[data-format="CSV"] {
  background: #ebfbee;
  color: #2b8a3e;
}

.document-type[data-format="Hình ảnh"],
.document-type[data-format="IMAGE"] {
  background: #e3fafc;
  color: #0b7285;
}

.document-type[data-format="Video"] {
  background: #f3f0ff;
  color: #6741d9;
}

.document-type[data-format="Audio"],
.document-type[data-format="Podcast"] {
  background: #fff0f6;
  color: #c2255c;
}

.document-type[data-format="Mã nguồn"],
.document-type[data-format="Notebook"],
.document-type[data-format="Code"] {
  background: #e6fcf5;
  color: #0ca678;
}

.document-type[data-format="Tập dữ liệu"],
.document-type[data-format="Dataset"] {
  background: #fff9db;
  color: #f08c00;
}

.document-type[data-format="Ebook"] {
  background: #f4ece1;
  color: #8c5b36;
}

.document-type[data-format="Khác"] {
  background: #f1f3f5;
  color: #495057;
}

.document-card .eyebrow {
  font-size: 8px;
  margin-bottom: 6px;
}

.document-card h2 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 7px;
  letter-spacing: -0.2px;
}

.document-desc {
  font-size: 10px;
  color: #708077;
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.document-desc p {
  margin: 0 0 4px 0;
}

.document-desc p:last-child {
  margin-bottom: 0;
}

.document-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.document-header-badges .document-type,
.document-header-badges .document-id-badge {
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}

.document-header-badges .document-type {
  margin-bottom: 0 !important;
}

.document-id-badge {
  background: var(--surface-2, rgba(18, 61, 48, 0.06));
  color: var(--primary, #123d30);
  border: 1px solid var(--line, #cbd5e1);
  font-family: var(--sans);
}

body.dark-theme .document-id-badge {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.document-footer {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #60766a;
  font-size: 10.5px;
  border-top: 1px solid var(--line, #e2e8f0);
}

.document-footer-author {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.document-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.doc-card-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-light, #475569);
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.doc-card-action-btn:hover {
  background: var(--surface-2, #f1f5f9);
  color: var(--primary, #123d30);
  border-color: var(--primary, #123d30);
}

.doc-card-action-btn.is-saved {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.4);
}

body.dark-theme .doc-card-action-btn {
  background: var(--surface-2, #1e293b);
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-theme .doc-card-action-btn:hover {
  color: var(--theme-doc-action, #34d399);
  border-color: var(--theme-doc-action, #34d399);
}

body.dark-theme .doc-card-action-btn.is-saved {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
}

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

.profile-large {
  display: flex;
  align-items: center;
  gap: 17px;
}

.change-avatar-btn {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 999px;
  line-height: 1;
  z-index: 2;
  cursor: pointer;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--line, #334155);
  color: var(--text, #fff);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.change-avatar-btn:hover {
  border-color: var(--primary, #38bdf8);
  color: var(--primary, #38bdf8);
}

.change-avatar-btn .change-avatar-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.account-header h1 {
  font-size: 40px;
  letter-spacing: -1.8px;
}

.role-label {
  margin: 3px 0;
  color: #607268;
  font-size: 12px;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  padding: 25px 0;
  margin-bottom: 35px;
}

.account-stats>div {
  padding: 0 29px;
  border-left: 1px solid var(--line);
}

.account-stats>div:first-child {
  border: 0;
  padding-left: 0;
}

.account-stats p {
  font:
    10px "Unbounded",
    sans-serif;
  letter-spacing: 0.7px;
  color: #708076;
  margin: 0 0 5px;
}

.account-stats strong {
  font: 400 31px var(--serif);
  display: block;
  letter-spacing: -1px;
}

.account-stats strong em {
  font: 400 12px var(--sans);
  letter-spacing: 0;
}

.account-stats small {
  font-size: 10px;
  color: #61766a;
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 45px;
  min-width: 0;
  max-width: 100%;
}

.account-activity {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.account-activity-header {
  margin-bottom: 22px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.account-activity-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.account-activity-top-row .eyebrow {
  margin: 0;
}

.account-tabs-scroll-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
  padding-bottom: 2px;
}

.account-tabs-scroll-wrap::-webkit-scrollbar {
  display: none;
}

.account-tabs-nav {
  display: inline-flex;
  gap: 4px;
  background: var(--surface-2, rgba(18, 61, 48, 0.04));
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line, #e2e8f0);
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}

.account-activity-divider {
  border-bottom: 1px solid var(--line, #e2e8f0);
  margin-top: 14px;
}

.account-tabs-nav::-webkit-scrollbar {
  display: none;
}

.account-tabs-nav .tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: var(--sans);
  line-height: 1.3;
}

.account-tabs-nav .tab:hover {
  color: var(--ink, #123d30);
  background: rgba(255, 255, 255, 0.5);
}

.account-tabs-nav .tab.active {
  background: var(--surface, #ffffff);
  color: var(--primary, #123d30);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

body.dark-theme .account-tabs-nav {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .account-tabs-nav .tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

body.dark-theme .account-tabs-nav .tab.active {
  background: #1e293b;
  color: var(--theme-account-active, #34d399);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line, #edf2f7);
  transition: all 0.15s ease;
}

.activity-row:hover {
  background: var(--surface-2, rgba(18, 61, 48, 0.025));
  border-color: var(--line, #e2e8f0);
}

.activity-icon-badge {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon-badge.badge-green {
  background: rgba(36, 98, 71, 0.1);
  color: #246247;
}

.activity-icon-badge.badge-blue {
  background: rgba(14, 116, 144, 0.1);
  color: #0e7490;
}

.activity-icon-badge.badge-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.activity-icon-badge.badge-purple {
  background: rgba(109, 40, 217, 0.1);
  color: #7c3aed;
}

.activity-icon-badge.badge-rose {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
}

.activity-icon-badge.badge-slate {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

body.dark-theme .activity-icon-badge.badge-green {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

body.dark-theme .activity-icon-badge.badge-blue {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}

body.dark-theme .activity-icon-badge.badge-amber {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}

body.dark-theme .activity-icon-badge.badge-purple {
  background: rgba(167, 139, 250, 0.14);
  color: #c084fc;
}

body.dark-theme .activity-icon-badge.badge-rose {
  background: rgba(251, 113, 133, 0.14);
  color: #fb7185;
}

body.dark-theme .activity-icon-badge.badge-slate {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

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

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #123d30);
  line-height: 1.4;
  word-break: break-word;
}

.activity-time {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.activity-points-wrap {
  flex-shrink: 0;
  margin-left: 8px;
}

.activity-points-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
}

.activity-points-pill.pts-positive {
  background: var(--pts-pos-bg, rgba(36, 98, 71, 0.1));
  color: var(--pts-pos-color, #246247);
  border: 1px solid var(--pts-pos-border, rgba(36, 98, 71, 0.2));
}

.activity-points-pill.pts-negative {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.activity-points-pill.pts-zero {
  background: var(--surface-2, rgba(18, 61, 48, 0.04));
  color: var(--muted, #64748b);
  border: 1px solid var(--line, #cbd5e1);
}

body.dark-theme .activity-points-pill.pts-positive {
  background: var(--pts-pos-bg-dark, rgba(52, 211, 153, 0.12));
  color: var(--pts-pos-color-dark, #34d399);
  border-color: var(--pts-pos-border-dark, rgba(52, 211, 153, 0.28));
}

body.dark-theme .activity-points-pill.pts-negative {
  background: rgba(251, 113, 133, 0.12);
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.28);
}

.activity-empty-state {
  text-align: center;
  padding: 36px 16px;
  border: 1px dashed var(--line, #cbd5e1);
  border-radius: 12px;
  background: var(--surface-2, rgba(18, 61, 48, 0.02));
  margin: 12px 0;
}

.activity-empty-state .empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted, #64748b);
  margin-bottom: 12px;
}

body.dark-theme .activity-empty-state .empty-state-icon {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.activity-empty-state .empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #123d30);
  margin: 0 0 4px;
}

.activity-empty-state .empty-state-desc {
  font-size: 12px;
  color: var(--muted, #64748b);
  max-width: 420px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.admin-panel {
  background: var(--ink);
  color: #fff;
  padding: 24px;
  border-radius: 8px;
  align-self: start;
}

.admin-panel .eyebrow {
  color: #b9d0bd;
}

.admin-panel h2 {
  font: 400 26px var(--serif);
  margin: 0 0 8px;
}

.admin-panel>p:not(.eyebrow) {
  font-size: 11px;
  line-height: 1.65;
  color: #c1d3c4;
  margin: 0;
}

.admin-metrics {
  display: flex;
  gap: 20px;
  border-top: 1px solid #396951;
  margin-top: 18px;
  padding-top: 14px;
}

.admin-metrics span {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  color: #b9cebd;
}

.admin-metrics b {
  font: 400 22px var(--serif);
  color: white;
}

.mobile-nav {
  display: none;
}

.mobile-fab {
  display: grid;
  place-items: center;
  position: fixed;
  right: 28px;
  left: auto;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  z-index: 9990;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary, #123d30) 0%, var(--primary-dark, #0d2c23) 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 28px rgba(18, 61, 48, 0.28);
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

.mobile-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px rgba(18, 61, 48, 0.36);
}

dialog:not([open]) {
  display: none !important;
}

.modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal):not(.xmas-tree-modal),
dialog.modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal):not(.xmas-tree-modal) {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 0;
  border-radius: 16px;
  padding: 0;
  color: var(--ink);
  background: #fbfcf8;
  box-shadow: 0 24px 65px #0827194a;
  width: min(620px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

dialog[open].quiz-arena-modal,
dialog[open].quiz-start-confirm-modal,
dialog[open].quiz-exit-confirm-modal {
  display: block;
}

.modal::backdrop,
dialog::backdrop {
  background: #0a2c1e80;
  backdrop-filter: blur(3px);
  overscroll-behavior: none;
  touch-action: none;
  pointer-events: auto;
}

.modal form {
  padding: 27px;
}

.admin-modal {
  padding: 28px 30px !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  border: 1px solid rgba(18, 61, 48, 0.12) !important;
  box-shadow: 0 24px 70px rgba(10, 42, 32, 0.25) !important;
  width: min(980px, calc(100vw - 28px)) !important;
  max-width: 980px !important;
  max-height: min(90vh, 760px) !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

.admin-modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-modal .eyebrow {
  font-family: "Unbounded", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--green);
  text-transform: uppercase;
  margin: 0 0 6px;
  line-height: 1.4;
}

.admin-modal .modal-head h2 {
  font-family: var(--sans) !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  color: var(--ink) !important;
  letter-spacing: normal !important;
  margin: 0;
}

.admin-modal .auth-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.admin-modal .auth-tabs::-webkit-scrollbar {
  display: none;
}

.admin-modal .admin-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #61756a;
  border-bottom: 2px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all 0.2s ease;
}

.admin-modal .admin-tab:hover {
  color: var(--ink);
}

.admin-modal .admin-tab.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 20px;
}

.modal-head h2 {
  font: 400 25px/1.15 var(--serif);
  margin: 0;
  letter-spacing: -1px;
}

.close-modal {
  border: 0;
  background: transparent;
  color: #61756a;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.close-modal:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}

.modal label {
  display: block;
  margin: 14px 0 6px;
  color: var(--ink, #123d30);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
}

.modal input,
.modal textarea,
.modal select {
  display: block;
  width: 100%;
  border: 1.5px solid #d5ded4;
  background: #ffffff;
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 14px;
  margin-top: 6px;
  resize: vertical;
  font-size: 16px;
  font-weight: 500;
  font-family: var(--sans);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 61, 48, 0.12);
}

.modal textarea {
  line-height: 1.5;
}

.modal small {
  display: block;
  font-size: 9px;
  color: #798980;
  font-weight: 500;
  margin-top: 4px;
}

.anonymous-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #edf3e9;
  padding: 12px;
  border-radius: 7px;
  margin-top: 17px;
  gap: 10px;
}

.anonymous-choice strong,
.anonymous-choice span {
  display: block;
  font-size: 10px;
}

.anonymous-choice span {
  color: #687970;
  font-size: 9px;
  max-width: 240px;
  margin-top: 2px;
}

.switch-group {
  display: flex;
  background: #fff;
  border: 1px solid #d7e3d5;
  border-radius: 5px;
  padding: 2px;
  white-space: nowrap;
}

.identity-choice {
  border: 0;
  background: transparent;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  color: #65756d;
  padding: 6px 7px;
}

.identity-choice.selected {
  background: #316d4f;
  color: #fff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.detail-meta {
  color: #6d8074;
  font-size: 11px;
  margin: -8px 0 4px;
}

.post-read-count {
  font-size: 11px;
  color: #6d8074;
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-title {
  font: 400 29px/1.15 var(--serif);
  letter-spacing: -1.1px;
  margin: 0 0 11px;
}

.detail-copy {
  font-size: 13px;
  line-height: 1.75;
  color: #425c50;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 20px 0;
}

.useful-button {
  border: 1px solid #cbdaca;
  background: #f5f9f3;
  color: #426951;
  border-radius: 5px;
  padding: 7px 11px;
  font-size: 10px;
  font-weight: 800;
}

.detail-response-title {
  font-size: 13px;
  margin: 0 0 5px;
}

.response {
  position: relative;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
}

.response-children {
  margin-left: 24px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.response-children .response {
  border-bottom: none;
  padding-bottom: 0;
}

.response-copy {
  font-size: 12px;
  color: #425e51;
  margin: -4px 0 3px;
  white-space: pre-wrap;
}

.response-meta {
  font-size: 10px;
  color: #74847b;
}

.chosen-label {
  display: inline-block;
  background: #dbead7;
  color: #2e6a48;
  border-radius: 3px;
  padding: 2px 5px;
  margin-left: 5px;
  font-size: 8px;
  font-weight: 800;
}

.admin-dashboard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0 24px;
}

.admin-dashboard>div {
  background: #f6f8f5;
  border: 1px solid #e2eae1;
  border-radius: 10px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.admin-dashboard strong {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--primary);
}

.admin-dashboard span {
  font-size: 12.5px;
  font-weight: 600;
  color: #556b5e;
  line-height: 1.35;
}

.admin-queue {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.admin-queue>div {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.admin-queue p {
  margin: 0;
  flex: 1;
  font-size: 10px;
}

.admin-queue small {
  font-size: 9px;
  color: #728178;
}

.queue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5b9c71;
}

.queue-dot.amber {
  background: #d6a151;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  inset: auto auto 30px 50%;
  margin: 0;
  transform: translateX(-50%);
  border: 0;
  background: #123d30;
  color: white;
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 12px;
  box-shadow: 0 9px 22px #09251a40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
}

/* ==========================================================================
   DESKTOP ZOOM (>= 125%) / COMPACT SCREENS (<= 1080px)
   ========================================================================== */
@media (max-width: 1080px) {
  .site-header {
    padding: 0 16px;
  }

  .desktop-nav {
    margin-left: clamp(8px, 1.8vw, 24px);
    gap: 4px;
  }

  .profile-chip-text {
    max-width: 90px;
  }
}

@media (max-width: 800px) {
  header#siteHeader.site-header,
  .site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: calc(64px + env(safe-area-inset-top, 0px)) !important;
    padding-top: env(safe-area-inset-top, 0px) !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    z-index: 1000 !important;
  }

  main {
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
  }

  body.study-zen-fullscreen main {
    padding-top: 0 !important;
  }

  .desktop-nav,
  .desktop-search,
  .profile-chip-text,
  .chevron {
    display: none;
  }

  .profile-chip {
    padding: 3px !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    justify-content: center !important;
  }

  .quick-menu-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .page {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 39px 20px 92px;
    min-height: calc(100vh - 64px);
    overflow-x: hidden !important;
  }

  .home-hero {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    grid-template-columns: 1fr;
    gap: 26px;
    min-height: 0;
  }

  .hero-actions {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .christmas-header-garland {
    contain: paint !important;
    overflow: hidden !important;
    max-width: 100% !important;
  }

  .hero-copy h1,
  .forum-heading h1 {
    font-size: clamp(24px, 6.5vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.5px;
  }

  .hero-intro {
    font-size: 13px;
    margin: 15px 0 20px;
  }

  .detail-content {
    font-size: 14px;
    margin-bottom: 30px;
    color: var(--ink);
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .contribution-card {
    max-width: none;
  }

  .search-panel {
    height: 56px;
    margin: 28px 0 31px;
  }

  .search-panel kbd {
    display: none;
  }

  .home-grid,
  .forum-layout,
  .account-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 28px;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .side-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
  }

  .side-column .topics-card {
    display: none;
  }

  .forum-aside {
    display: none;
  }

  .announcement {
    padding: 15px;
  }

  .announcement h2 {
    font-size: 12px;
  }

  .announcement p:not(.eyebrow) {
    font-size: 10px;
  }

  .section-block {
    margin-top: 32px;
  }

  .mobile-topics {
    display: block;
    margin-bottom: 24px;
    margin-top: 16px;
  }

  .mobile-topics .topic-cloud {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 85px;
    /* enough for 2 rows of topics (around 28px each + 8px gap) */
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    align-content: flex-start;
  }

  .mobile-topics .topic-cloud::-webkit-scrollbar {
    display: none;
  }

  .mobile-topics .topic {
    margin-bottom: 0;
  }

  .post-card {
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 9px;
    padding: 16px 1px;
  }

  .post-card .avatar {
    width: 27px;
    height: 27px;
    font-size: 14px;
  }

  .post-card h3,
  .forum-feed .post-card h3 {
    font-size: 13px;
  }

  .post-stats {
    grid-column: 2;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    margin-top: 6px;
    gap: 8px;
    box-sizing: border-box;
  }

  .post-stats-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  .post-stats-metrics {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    flex-shrink: 0;
  }

  .post-doc-tag .doc-tag-label {
    display: none;
  }

  .forum-heading {
    align-items: start;
    margin: 0 0 27px;
  }

  .forum-heading .button {
    padding: 0 12px;
    white-space: nowrap;
  }

  .forum-heading .button span {
    display: none;
  }

  .forum-tools {
    margin-bottom: 9px;
  }

  .filter-button {
    min-width: 47px;
    font-size: 16px;
  }

  .filter-button span {
    display: none;
  }

  .filters {
    overflow-x: auto;
    margin-right: -20px;
    padding-right: 20px;
    white-space: nowrap;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filter-divider {
    display: none;
  }

  .forum-aside {
    display: block;
    margin-top: 16px;
  }

  .button-sm {
    padding: 0 6px;
    font-size: 10px;
    min-height: 24px;
  }

  .button-sm span {
    display: none;
  }

  .button-sm .ui-btn-icon {
    margin-right: 0 !important;
  }

  .detail-actions .button-sm:has(svg),
  .detail-actions .response-vote-btn,
  .detail-actions .response-copy-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  .detail-actions .button-sm svg,
  .detail-actions .button-sm .ui-btn-icon,
  .detail-actions .button-sm .icon-upvote-svg {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    flex-shrink: 0 !important;
  }

  .doc-card-action-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
  }

  .doc-card-action-btn span {
    display: none !important;
  }

  .doc-card-action-btn svg {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    flex-shrink: 0 !important;
  }

  .document-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .document-card {
    padding: 14px;
    min-height: 175px;
  }

  .document-card h2 {
    font-size: 12px;
  }

  .document-desc {
    font-size: 11px;
  }

  .document-type {
    margin-bottom: 12px;
    width: max-content;
    height: auto;
  }

  .detail-scrollable {
    padding: 21px 18px;
  }

  .account-header {
    padding-bottom: 24px;
  }

  .account-header h1 {
    font-size: clamp(20px, 5.5vw, 26px);
  }

  .profile-large {
    gap: 12px;
  }

  .avatar-lg {
    width: 53px;
    height: 53px;
    font-size: 28px;
  }

  .account-header .button-outline {
    min-height: 34px;
    padding: 0 11px;
  }

  .account-stats {
    margin-bottom: 28px;
    padding: 18px 0;
  }

  .account-stats>div {
    padding: 0 10px;
  }

  .account-stats strong {
    font-size: 23px;
  }

  .account-stats small {
    display: none;
  }

  .account-stats p {
    font-size: 8px;
    letter-spacing: 0.3px;
  }

  .account-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 21px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .account-activity {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  .account-tabs-scroll-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: visible !important;
    padding-bottom: 0 !important;
  }

  .account-tabs-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    gap: 4px !important;
  }

  .account-tabs-nav .tab {
    padding: 7px 6px !important;
    font-size: 11.5px !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-shrink: 0 !important;
  }

  .admin-panel {
    padding: 20px;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body {
    padding-bottom: 0 !important;
  }

  /* ==========================================================================
     iOS 26 CONCEPT FLOATING ISLAND MOBILE NAVIGATION
     ========================================================================== */
  .mobile-nav {
    display: flex;
    position: fixed;
    z-index: 100;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(0);
    width: calc(100% - 24px);
    max-width: 440px;
    height: 62px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.85);
    outline: 1px solid rgba(18, 61, 48, 0.08);
    border-radius: 9999px;
    box-shadow:
      0 12px 32px -4px rgba(10, 44, 30, 0.14),
      0 4px 12px -2px rgba(0, 0, 0, 0.06),
      inset 0 1px 1px rgba(255, 255, 255, 0.9);
    justify-content: space-evenly;
    align-items: center;
    padding: 4px 8px;
    margin: 0 auto;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
  }

  .mobile-nav.nav-hidden {
    transform: translateX(-50%) translateY(calc(100% + 28px + env(safe-area-inset-bottom, 0px))) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    box-shadow: none !important;
  }

  [data-user-theme="dark"] .mobile-nav,
  [data-user-theme="midnight"] .mobile-nav,
  body.dark-theme .mobile-nav {
    background: rgba(18, 24, 21, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    outline: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
      0 12px 32px -4px rgba(0, 0, 0, 0.5),
      0 4px 12px -2px rgba(0, 0, 0, 0.3),
      inset 0 1px 1px rgba(255, 255, 255, 0.1);
  }

  .mobile-link {
    color: #64748b;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1 1 0%;
    min-width: 0;
    height: 100%;
    padding: 4px 2px;
    border-radius: 9999px;
    position: relative;
    transition: color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-label {
    display: block;
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.15px;
    white-space: nowrap !important;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: clip;
  }

  .mobile-link svg {
    width: 20px;
    height: 20px;
    margin: 0 auto;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.2s ease;
    stroke: currentColor;
    flex-shrink: 0;
  }

  .mobile-link.active {
    color: var(--primary, #123d30);
  }

  .mobile-link.active .mobile-nav-label {
    font-weight: 700 !important;
  }

  .mobile-link.active svg {
    transform: translateY(-1px) scale(1.08);
    stroke-width: 2.3;
    stroke: var(--primary, #123d30);
  }

  .mobile-link:active {
    transform: scale(0.92);
  }

  .mobile-fab {
    display: grid;
    place-items: center;
    position: fixed;
    right: 18px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    z-index: 99;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #123d30 0%, #1a5743 100%);
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 26px;
    box-shadow: 0 8px 24px rgba(18, 61, 48, 0.35), 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    will-change: transform;
  }

  .mobile-fab.nav-hidden {
    transform: translateY(calc(100% + 100px)) scale(0.8) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .mobile-fab:active {
    transform: scale(0.9);
  }

  .modal {
    width: calc(100vw - 20px);
    max-height: 90vh;
  }

  .modal form {
    padding: 21px 18px;
  }

  .admin-modal {
    padding: 20px 16px !important;
    width: calc(100vw - 20px) !important;
  }

  .admin-modal .modal-head h2 {
    font-size: 19px !important;
  }

  .modal-head h2 {
    font-size: 22px;
  }

  .anonymous-choice {
    align-items: start;
    flex-direction: column;
  }

  .admin-dashboard {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .admin-dashboard>div {
    padding: 12px 10px !important;
  }

  .admin-dashboard strong {
    font-size: 24px !important;
  }

  .admin-dashboard span {
    font-size: 11px !important;
  }

  .toast {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: max-content;
    max-width: calc(100vw - 30px);
  }
}

@media (max-width: 420px) {
  .document-grid {
    grid-template-columns: 1fr;
  }

  .document-card {
    min-height: 150px;
  }

  .docs-heading h1 {
    font-size: 34px;
  }

  .hero-actions .button-quiet {
    font-size: 11px;
  }

  .hero-actions {
    gap: 7px;
  }

  .contribution-card {
    padding: 19px;
  }

  .account-stats>div {
    padding: 0 6px;
  }

  .account-stats strong {
    font-size: 20px;
  }

  .account-stats strong em {
    font-size: 9px;
  }
}

/* Quill & Rich Text Overrides */
.ql-toolbar.ql-snow {
  border: 1px solid var(--line) !important;
  border-bottom: none !important;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  background-color: #fafbfc;
}

.ql-container.ql-snow {
  border: 1px solid var(--line) !important;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  font-family: inherit !important;
  font-size: 13px !important;
}

.ql-editor {
  padding: 12px !important;
}

.ql-editor:focus::before {
  display: none !important;
}

/* Rich Text Formatting in rendered output */
.post-copy-preview,
.detail-copy,
.response-copy,
.document-desc {
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

.post-copy-preview.ql-editor,
.detail-copy.ql-editor,
.collapsible-content.ql-editor,
.document-desc.ql-editor {
  padding: 0;
}

.post-copy-preview {
  font-size: 11px;
  color: #687a70;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.post-copy-preview p {
  display: inline;
  margin: 0;
}

.detail-copy p,
.response-copy p {
  margin: 0 0 8px 0;
}

.detail-copy p:last-child,
.response-copy p:last-child {
  margin-bottom: 0;
}

.post-copy-preview ul,
.detail-copy ul,
.response-copy ul,
.post-copy-preview ol,
.detail-copy ol,
.response-copy ol {
  margin: 0 0 8px 0;
  padding-left: 20px;
}

.post-copy-preview a,
.detail-copy a,
.response-copy a {
  color: var(--primary);
  text-decoration: underline;
}

/* Collapsible Content (Xem thêm) */
.collapsible-wrapper {
  position: relative;
}

.collapsible-content {
  max-height: 140px;
  overflow: hidden;
  position: relative;
  word-break: break-word;
  overflow-wrap: break-word;
}

.collapsible-content.expanded {
  max-height: none;
}

.collapsible-content.has-overflow:not(.expanded)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--paper));
  pointer-events: none;
}

.read-more-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 11px;
  padding: 4px 0 0 0;
  cursor: pointer;
  display: none;
}

.read-more-btn:hover {
  text-decoration: underline;
}

/* Sticky Reply Bar */
dialog.detail-modal[open] {
  display: flex;
}

.detail-modal {
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: none;
  align-items: center;
  justify-content: center;
  max-height: 100%;
  height: 100%;
  width: 100%;
  max-width: 100%;
}

.detail-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 760px);
  width: min(620px, calc(100vw - 28px));
  background: #fbfcf8;
  border-radius: 11px;
  box-shadow: 0 24px 65px #0827194a;
  overflow: hidden;
}

.detail-scrollable {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 27px;
  -webkit-overflow-scrolling: touch;
}

.pinned-reply {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 12px 24px;
}

.reply-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.reply-avatar-dropdown {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.dropdown-arrow {
  font-size: 10px;
  color: var(--muted);
}

.reply-bar .dropdown-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 160px;
  z-index: 100;
  display: none;
}

.reply-bar .dropdown-menu.show {
  display: block;
}

.reply-bar .dropdown-menu div {
  padding: 8px 12px;
  font-size: 12px;
}

.reply-bar .dropdown-menu div:hover {
  background: var(--sage);
}

.reply-pill {
  flex: 1;
  position: relative;
  background: #e0e5e2;
  border-radius: 20px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.reply-bar.collapsed .reply-pill {
  flex-direction: row;
  align-items: center;
  min-height: 40px;
  max-height: 60px;
  overflow: hidden;
}

.reply-bar.collapsed .ql-toolbar {
  display: none;
}

.reply-bar.collapsed .ql-container {
  border: none;
  min-height: 40px;
  max-height: 60px;
  height: auto;
  flex: 1;
  min-width: 0;
  border-radius: 20px;
  font-size: 16px;
}

.reply-bar.collapsed .ql-editor {
  padding: 8px 14px;
  line-height: 1.35;
  min-height: 40px;
  max-height: 60px;
  overflow-y: auto !important;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
  scrollbar-width: none;
  /* Firefox */
}

.reply-bar.expanded .ql-editor {
  max-height: 40vh;
  overflow-y: auto;
}

.reply-bar.collapsed .ql-editor::-webkit-scrollbar {
  display: none;
  /* Safari and Chrome */
}

.reply-bar.expanded .ql-container {
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.reply-bar.expanded .ql-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: white;
}

.reply-bar.expanded .reply-pill {
  background: transparent;
  border-radius: 0;
}

.reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 6px;
}

.reply-bar.expanded .reply-actions {
  padding: 8px 0 0 0;
  justify-content: flex-end;
}

.reply-bar.expanded .btn-expand-tools {
  display: none;
}

.btn-send {
  background-color: var(--primary) !important;
  color: white !important;
  opacity: 1 !important;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.reply-bar.expanded .btn-send {
  border-radius: 8px;
  width: auto;
  padding: 0 16px;
}

.reply-bar.expanded .btn-send::after {
  content: "Gửi phản hồi";
  margin-left: 6px;
  font-size: 13px;
  font-family: var(--sans);
}

.modal form#replyForm {
  padding: 0;
}

.detail-modal>.pinned-reply {
  padding: 12px 24px;
}

.reply-bar.collapsed .ql-editor.ql-blank::before {
  top: 50%;
  transform: translateY(-50%);
  right: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-expand-tools {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
}

.btn-collapse-tools {
  background: none;
  border: none;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--muted);
  cursor: pointer;
  padding: 0 12px;
}

.btn-collapse-tools:hover {
  color: var(--ink);
  text-decoration: underline;
}

.reply-bar.collapsed .btn-collapse-tools {
  display: none;
}

.reply-bar.expanded .btn-collapse-tools {
  display: block;
}

/* Leaderboard Carousel Navigation Styles */
.lb-carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 6px 0 10px;
  background: var(--surface, #eff4ec);
  padding: 4px 6px;
  border-radius: 8px;
  user-select: none;
}

.lb-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: white;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.lb-nav-btn:hover {
  color: var(--primary);
  background: white;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.lb-nav-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.lb-title-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.15s ease;
  min-width: 0;
}

.lb-title-container:hover {
  background: rgba(255, 255, 255, 0.65);
}

.lb-active-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary, #1e3a2f);
  letter-spacing: -0.2px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lb-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 3px;
}

.lb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sage, #94a3b8);
  opacity: 0.45;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.lb-dot:hover {
  opacity: 0.8;
}

.lb-dot.active {
  width: 14px;
  border-radius: 3px;
  background: var(--primary, #2d6a4f);
  opacity: 1;
}

.lb-tabs {
  display: flex;
  gap: 2px;
  margin: 6px 0 10px;
  background: var(--surface, #eff4ec);
  padding: 3px;
  border-radius: 8px;
}

.lb-tab {
  flex: 1;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.lb-tab:hover {
  color: var(--primary);
}

.lb-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

#leaderboardList {
  display: flex;
  flex-direction: column;
  gap: 5px !important;
}

.mini-card.leaderboard-card {
  padding: 16px 12px;
}

.leaderboard-item {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  cursor: pointer;
  position: relative;
}

.lb-capsule {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 3px 12px 3px 5px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1.5px 5px rgba(0, 0, 0, 0.03);
  overflow: visible !important;
  height: 40px;
  box-sizing: border-box;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}

.leaderboard-item:hover .lb-capsule {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
}

.lb-cover-art-wrap {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.lb-cover-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72%;
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
  opacity: 0.95;
  transition: transform 0.3s ease;
}

.leaderboard-item:hover .lb-cover-art,
.comp-lb-row:hover .lb-cover-art {
  transform: scale(1.04);
}

.lb-cover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  background: linear-gradient(118deg,
      #ffffff 0%,
      #ffffff 32%,
      rgba(255, 255, 255, 0.94) 44%,
      rgba(255, 255, 255, 0.62) 58%,
      rgba(255, 255, 255, 0.18) 76%,
      rgba(255, 255, 255, 0) 95%);
}

.leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #f0fdf4 0%,
      #f0fdf4 32%,
      rgba(240, 253, 244, 0.94) 44%,
      rgba(240, 253, 244, 0.62) 58%,
      rgba(240, 253, 244, 0.18) 76%,
      rgba(240, 253, 244, 0) 95%);
}

.lb-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  flex-shrink: 0;
  padding: 1px;
  overflow: visible !important;
  z-index: 3;
}

.lb-avatar-wrap .avatar {
  width: 28px;
  height: 28px;
  font-size: 15px;
  border-radius: 50%;
  overflow: visible !important;
}

.lb-rank-badge {
  position: absolute;
  top: -3px;
  left: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 2px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  z-index: 10 !important;
  box-sizing: border-box;
  line-height: 1;
}

.lb-rank-badge.rank-1 {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: #ffffff;
  border-color: #fffbeb;
  box-shadow: 0 1px 3px rgba(217, 119, 6, 0.35);
}

.lb-rank-badge.rank-2 {
  background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 50%, #94a3b8 100%);
  color: #1e293b;
  border-color: #ffffff;
  box-shadow: 0 1px 3px rgba(100, 116, 139, 0.3);
}

.lb-rank-badge.rank-3 {
  background: linear-gradient(135deg, #fdba74 0%, #ea580c 50%, #c2410c 100%);
  color: #ffffff;
  border-color: #fff7ed;
  box-shadow: 0 1px 3px rgba(194, 65, 12, 0.35);
}

.lb-rank-badge.rank-4,
.lb-rank-badge.rank-5,
.lb-rank-badge.rank-6,
.lb-rank-badge.rank-7,
.lb-rank-badge.rank-8,
.lb-rank-badge.rank-9,
.lb-rank-badge.rank-10 {
  background: #64748b;
  color: #ffffff;
  border-color: #ffffff;
}

.lb-rank-badge.rank-me {
  background: #10b981;
  color: #ffffff;
  border-color: #ffffff;
}

.lb-info {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  z-index: 2;
}

.lb-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
  color: #111827;
}

.lb-role {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 9999px;
  font-weight: 700;
  white-space: nowrap;
}

.lb-role-admin {
  background: #fee2e2;
  color: #b91c1c;
}

.lb-role-ta {
  background: #e0f2fe;
  color: #0369a1;
}

.lb-role-lecturer {
  background: #f3e8ff;
  color: #7e22ce;
}

.lb-role-member {
  background: #e0f2fe;
  color: #0284c7;
}

/* Detached stats pill on the right */
.lb-points,
.lb-stats-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 10px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.03);
  font-weight: 700;
  font-size: 12px;
  color: #1e293b;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.leaderboard-item:hover .lb-points,
.leaderboard-item:hover .lb-stats-pill {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06);
}

.lb-points-likes,
.lb-stats-likes {
  background: #ffffff !important;
  color: #e11d48 !important;
  border: 1.5px solid #fecdd3 !important;
  box-shadow: 0 1.5px 5px rgba(225, 29, 72, 0.08) !important;
}

.lb-points-study,
.lb-stats-study {
  background: #ffffff !important;
  color: #d97706 !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 1.5px 5px rgba(217, 119, 6, 0.08) !important;
}

/* User Highlight in Leaderboard (Top 5 item or 6th row) */
.leaderboard-item.is-me .lb-capsule {
  background: #f0fdf4;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.leaderboard-item.is-me:hover .lb-capsule {
  border-color: #10b981;
}

.leaderboard-item.lb-my-rank-row {
  margin-top: 4px !important;
}

.leaderboard-item.lb-my-rank-row .lb-capsule {
  border-style: dashed;
  border-color: rgba(16, 185, 129, 0.6);
  background: #f0fdf4;
}

/* Theme overrides for current user leaderboard highlight */
[data-user-theme="ruby"] .leaderboard-item.is-me .lb-capsule {
  background: #fff1f2;
  border-color: #e11d48;
}

[data-user-theme="ruby"] .leaderboard-item.is-me:hover .lb-capsule {
  border-color: #be123c;
}

[data-user-theme="ruby"] .leaderboard-item.lb-my-rank-row .lb-capsule {
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.1);
}

[data-user-theme="ruby"] .leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #fff1f2 0%,
      #fff1f2 32%,
      rgba(255, 241, 242, 0.94) 44%,
      rgba(255, 241, 242, 0.62) 58%,
      rgba(255, 241, 242, 0.18) 76%,
      rgba(255, 241, 242, 0) 95%);
}

[data-user-theme="ruby"] .lb-rank-badge.rank-me {
  background: #e11d48;
}

[data-user-theme="mythic"] .leaderboard-item.is-me .lb-capsule {
  background: #faf5ff;
  border-color: #9333ea;
}

[data-user-theme="mythic"] .leaderboard-item.is-me:hover .lb-capsule {
  border-color: #7e22ce;
}

[data-user-theme="mythic"] .leaderboard-item.lb-my-rank-row .lb-capsule {
  box-shadow: 0 2px 8px rgba(147, 51, 234, 0.1);
}

[data-user-theme="mythic"] .leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #faf5ff 0%,
      #faf5ff 32%,
      rgba(250, 245, 255, 0.94) 44%,
      rgba(250, 245, 255, 0.62) 58%,
      rgba(250, 245, 255, 0.18) 76%,
      rgba(250, 245, 255, 0) 95%);
}

[data-user-theme="mythic"] .lb-rank-badge.rank-me {
  background: #9333ea;
}

/* Rose Quartz Leaderboard Highlighting */
[data-user-theme="rosequartz"] .leaderboard-item.is-me .lb-capsule {
  background: #fdf2f6;
  border-color: #c45b83;
}

[data-user-theme="rosequartz"] .leaderboard-item.is-me:hover .lb-capsule {
  border-color: #8a3157;
}

[data-user-theme="rosequartz"] .leaderboard-item.lb-my-rank-row .lb-capsule {
  box-shadow: 0 2px 8px rgba(138, 49, 87, 0.12);
}

[data-user-theme="rosequartz"] .leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #fdf2f6 0%,
      #fdf2f6 32%,
      rgba(253, 242, 246, 0.94) 44%,
      rgba(253, 242, 246, 0.62) 58%,
      rgba(253, 242, 246, 0.18) 76%,
      rgba(253, 242, 246, 0) 95%);
}

[data-user-theme="rosequartz"] .lb-rank-badge.rank-me {
  background: #8a3157;
}

/* Super Neon Leaderboard Highlighting */
[data-user-theme="super"] .leaderboard-item.is-me .lb-capsule {
  background: #e6fcf5;
  border-color: #00cec9;
}

[data-user-theme="super"] .leaderboard-item.is-me:hover .lb-capsule {
  border-color: #00b894;
}

[data-user-theme="super"] .leaderboard-item.lb-my-rank-row .lb-capsule {
  box-shadow: 0 2px 8px rgba(0, 206, 201, 0.15);
}

[data-user-theme="super"] .leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #e6fcf5 0%,
      #e6fcf5 32%,
      rgba(230, 252, 245, 0.94) 44%,
      rgba(230, 252, 245, 0.62) 58%,
      rgba(230, 252, 245, 0.18) 76%,
      rgba(230, 252, 245, 0) 95%);
}

[data-user-theme="super"] .lb-rank-badge.rank-me {
  background: linear-gradient(135deg, #00b894, #00cec9);
}

/* Diamond Celestial Leaderboard Highlighting */
[data-user-theme="diamond"] .leaderboard-item.is-me .lb-capsule {
  background: #f1f5f9;
  border-color: #334155;
}

[data-user-theme="diamond"] .leaderboard-item.is-me:hover .lb-capsule {
  border-color: #0f172a;
}

[data-user-theme="diamond"] .leaderboard-item.lb-my-rank-row .lb-capsule {
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

[data-user-theme="diamond"] .leaderboard-item.lb-my-rank-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #f1f5f9 0%,
      #f1f5f9 32%,
      rgba(241, 245, 249, 0.94) 44%,
      rgba(241, 245, 249, 0.62) 58%,
      rgba(241, 245, 249, 0.18) 76%,
      rgba(241, 245, 249, 0) 95%);
}

[data-user-theme="diamond"] .lb-rank-badge.rank-me {
  background: #0f172a;
}

/* Fix iOS & Mobile Auto-Zoom ONLY on interactive typing form inputs */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select,
.editor-container .ql-editor,
form .ql-editor,
.reply-bar .ql-editor {
  touch-action: manipulation;
}

@media (max-width: 1366px),
(hover: none) and (pointer: coarse) {

  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select,
  .modal input:not([type="checkbox"]):not([type="radio"]),
  .modal textarea,
  .modal select,
  .doc-reply-textarea,
  .doc-comment-textarea,
  .search-panel input,
  .search-inline input,
  .study-goal-box input,
  .todo-input-wrap input,
  .study-settings-modal input,
  .study-settings-modal .stepper-input input,
  .auth-modal input,
  .editor-container .ql-editor,
  form .ql-editor,
  .reply-bar .ql-editor,
  .reply-bar.collapsed .ql-container,
  .reply-bar.expanded .ql-container {
    font-size: 16px !important;
  }

  /* Protect rendered cards, post previews, and descriptions from blowing up */
  .post-copy-preview,
  .post-copy-preview.ql-editor {
    font-size: 11px !important;
  }

  .detail-copy,
  .detail-copy.ql-editor {
    font-size: 14px !important;
  }

  .response-copy,
  .response-copy.ql-editor {
    font-size: 13px !important;
  }

  .document-desc,
  .document-desc.ql-editor {
    font-size: 12px !important;
  }

  .collapsible-content,
  .collapsible-content.ql-editor {
    font-size: 13px !important;
  }
}

/* ==========================================================================
   STUDY LOUNGE (Phòng Tự Học NCKH - Pomodoro Focus Arena)
   ========================================================================== */
#study {
  position: relative;
  transition: all 0.3s ease;
}

/* ==========================================================================
   STUDY BACKGROUND & IMMERSIVE GLASSMORPHISM
   ========================================================================== */
.study-bg-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease-in-out, background-image 0.5s ease;
  pointer-events: none;
  transform: translateZ(0);
}

.study-bg-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(180deg, rgba(8, 14, 11, var(--study-overlay-opacity, 0.35)) 0%, rgba(6, 10, 8, calc(var(--study-overlay-opacity, 0.35) + 0.15)) 100%);
  z-index: 0;
  opacity: 0;
  transition: opacity 0.5s ease, background 0.3s ease;
  pointer-events: none;
  transform: translateZ(0);
}

#study.has-custom-bg .study-bg-layer,
#study.has-custom-bg .study-bg-overlay {
  opacity: 1;
}

/* Glassmorphism theme when custom or preset wallpaper is active */
#study.has-custom-bg {
  color: #f8fafc;
}

#study.has-custom-bg .study-heading h1 {
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

#study.has-custom-bg .study-heading .eyebrow {
  background: var(--primary-gradient, linear-gradient(135deg, #6ee7b7 0%, #34d399 100%));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #6ee7b7;
  font-weight: 700;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}

#study.has-custom-bg .study-live-badge,
#study.has-custom-bg .study-action-btn {
  background: rgba(14, 20, 17, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#study.has-custom-bg .study-action-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

#study.has-custom-bg .study-action-btn.active,
.study-action-btn.active {
  background: var(--primary-gradient, linear-gradient(135deg, #10b981 0%, #059669 100%)) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px var(--primary-glow, rgba(16, 185, 129, 0.45)) !important;
}

#study .button-primary {
  background: var(--primary-gradient, linear-gradient(135deg, #10b981 0%, #059669 100%)) !important;
  color: #fff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 10px var(--primary-glow, rgba(16, 185, 129, 0.35)) !important;
}

#study.has-custom-bg .study-card {
  background: rgba(14, 20, 17, var(--study-card-opacity, 0.58));
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #f8fafc;
}

#study.has-custom-bg .study-card h3,
#study.has-custom-bg .study-card h4,
#study.has-custom-bg .study-card h5 {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .study-card p,
#study.has-custom-bg .study-card span {
  color: #e2e8f0;
}

#study.has-custom-bg .study-card small {
  color: #cbd5e1;
}

#study.has-custom-bg .study-mode-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#study.has-custom-bg .study-mode-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

#study.has-custom-bg .study-mode-btn.active,
.study-mode-btn.active {
  background: var(--primary-gradient, linear-gradient(135deg, #10b981 0%, #059669 100%)) !important;
  border-color: transparent !important;
  color: #ffffff !important;
  box-shadow: 0 4px 18px var(--primary-glow, rgba(16, 185, 129, 0.45)) !important;
}

#study.has-custom-bg .study-mode-btn strong {
  color: #ffffff;
}

#study.has-custom-bg .study-mode-btn span {
  color: #e2e8f0;
}

#study.has-custom-bg .timer-bg-circle {
  stroke: rgba(255, 255, 255, 0.16);
}

#study.has-custom-bg .timer-clock {
  color: #ffffff;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.65);
}

#study.has-custom-bg .timer-status-label {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#study.has-custom-bg .study-quote-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
}

#study.has-custom-bg .study-quote-card:hover {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

#study.has-custom-bg .timer-quote-text {
  color: #f1f5f9;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

#study.has-custom-bg .timer-quote-text .quote-author {
  color: #6ee7b7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

#study.has-custom-bg .study-goal-box label {
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

#study.has-custom-bg .study-goal-box input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

#study.has-custom-bg .study-goal-box input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

#study.has-custom-bg .study-action-ctrl.button-outline {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  backdrop-filter: blur(10px);
}

#study.has-custom-bg .study-action-ctrl.button-outline:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Sound Tabs & Ambient Tracks */
#study.has-custom-bg .sound-tab {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#study.has-custom-bg .sound-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
}

#study.has-custom-bg .sound-tab.active,
.sound-tab.active {
  color: #ffffff !important;
  background: var(--primary-gradient, linear-gradient(135deg, #10b981 0%, #059669 100%)) !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px var(--primary-glow, rgba(16, 185, 129, 0.4)) !important;
}

#study.has-custom-bg #toggleAmbientMaster {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

#study.has-custom-bg #toggleAmbientMaster:hover {
  background: rgba(255, 255, 255, 0.24);
}

#study.has-custom-bg .ambient-sub {
  color: #cbd5e1;
}

#study.has-custom-bg .ambient-track {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#study.has-custom-bg .ambient-name,
#study.has-custom-bg .ambient-name strong {
  color: #ffffff !important;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

#study.has-custom-bg .ambient-track small,
#study.has-custom-bg .ambient-track-sub {
  color: #cbd5e1 !important;
}

#study.has-custom-bg .ambient-track-toggle {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

#study.has-custom-bg .ambient-track-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

#study.has-custom-bg .ambient-track.active,
.ambient-track.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--primary, rgba(52, 211, 153, 0.6)) !important;
  box-shadow: 0 0 16px var(--primary-glow, rgba(16, 185, 129, 0.25));
}

#study.has-custom-bg .ambient-track.active .ambient-track-toggle,
.ambient-track.active .ambient-track-toggle {
  background: var(--primary-gradient, linear-gradient(135deg, #10b981 0%, #059669 100%)) !important;
  border-color: transparent !important;
  color: #ffffff !important;
}

#study.has-custom-bg .custom-audio-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

#study.has-custom-bg .custom-audio-sub,
#study.has-custom-bg .custom-audio-sub small {
  color: #cbd5e1 !important;
}

/* Co-Study Lounge List (Không gian chung) */
#study.has-custom-bg .co-study-head h3 {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .co-study-tip {
  color: #cbd5e1;
}

#study.has-custom-bg .co-study-item {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#study.has-custom-bg .co-study-item:hover {
  filter: brightness(1.08);
}

.co-study-item.theme-dark-card .co-study-user-title:not([class*="user-name-tier"]):not(.user-name-default) {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.co-study-item.theme-dark-card .co-study-user-title.user-name-default {
  color: #6ee7b7 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.co-study-item.theme-dark-card .co-study-goal {
  color: #cbd5e1 !important;
}

.co-study-item.theme-dark-card .co-study-time {
  background: rgba(0, 0, 0, 0.45) !important;
  color: #a7f3d0 !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 600;
}

.co-study-item.theme-dark-card .co-study-cheers-row {
  border-top-color: rgba(255, 255, 255, 0.14);
}

.co-study-item.theme-dark-card .co-study-cheers-label {
  color: #cbd5e1;
}

.co-study-item.theme-dark-card .cheer-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.co-study-item.theme-dark-card .cheer-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
}

.co-study-item.theme-light-card .co-study-user-title:not([class*="user-name-tier"]):not(.user-name-default) {
  color: #123d30 !important;
  text-shadow: none;
}

.co-study-item.theme-light-card .co-study-user-title.user-name-default {
  color: #2f5e45 !important;
  text-shadow: none;
}

.co-study-item.theme-light-card .co-study-goal {
  color: #5a6b63 !important;
}

.co-study-item.theme-light-card .co-study-time {
  background: #ffffff !important;
  color: var(--primary, #10b981) !important;
  border: 1px solid var(--line, #e2e8f0) !important;
  font-weight: 700;
}

.co-study-item.theme-light-card .co-study-cheers-row {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.co-study-item.theme-light-card .co-study-cheers-label {
  color: #64748b;
}

.co-study-item.theme-light-card .cheer-btn {
  background: #ffffff;
  border-color: var(--line, #e2e8f0);
}

.co-study-item.theme-light-card .cheer-btn:hover:not(:disabled) {
  background: #f0f7f3;
}

#study.has-custom-bg .co-study-empty {
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.25);
}

/* Study Logs & Quick Stats */
#study.has-custom-bg .study-log-item {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#study.has-custom-bg .study-log-title {
  color: #ffffff !important;
  font-weight: 600;
}

#study.has-custom-bg .study-log-time {
  color: #a7f3d0 !important;
}

#study.has-custom-bg .study-log-meta,
#study.has-custom-bg .study-empty-logs {
  color: #cbd5e1 !important;
}

#study.has-custom-bg .study-stat-box {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

#study.has-custom-bg .study-stat-val {
  color: #ffffff !important;
  font-weight: 700;
}

#study.has-custom-bg .study-stat-label {
  color: #cbd5e1 !important;
}

#study.has-custom-bg .custom-wall-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

#study.has-custom-bg .custom-wall-info {
  color: #cbd5e1;
}

/* Zen View / Panoramic Mode (Thu gọn bảng để ngắm trọn hình nền) */
#study.study-zen-view .study-side-col,
#study.study-zen-view #soundArenaCard,
#study.study-zen-view #themeArenaCard {
  display: none !important;
}

#study.study-zen-view .study-layout {
  grid-template-columns: 1fr;
  max-width: 520px;
  margin: 0 auto;
}

#study.study-zen-view .study-timer-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(10px);
}

.study-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

.study-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.study-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.study-action-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.study-action-btn:hover {
  background: var(--surface-bg, #f4f7f5);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.study-action-btn.icon-only {
  padding: 6px 10px;
  font-size: 15px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 24px;
  align-items: start;
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.study-main-col,
.study-side-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.study-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Timer Card & Mode Selector (Modern Zen Clock) */
.study-timer-card {
  text-align: center;
  position: relative;
  overflow: hidden;
  padding: 24px 20px 20px;
  background: var(--surface-card, #ffffff);
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.timer-top-banner {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 0.1px;
}

.timer-mode-selector-capsule {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-bg, #f1f5f3);
  border: 1px solid var(--line);
  border-radius: 9999px;
  margin: 0 auto 14px;
  max-width: 100%;
}

.mode-capsule-btn {
  padding: 8px 22px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.mode-capsule-btn:hover {
  color: var(--ink);
}

.mode-capsule-btn.active {
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

html.dark-theme .mode-capsule-btn.active,
body.dark-theme .mode-capsule-btn.active {
  background: #334155;
  color: #f8fafc;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Circular Watch Face Dial with Minute Ticks & Progress Knob */
.timer-visual-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0 10px;
}

.timer-circle {
  display: grid;
  place-items: center;
  width: 280px;
  height: 280px;
  flex-shrink: 0;
  position: relative;
}

.timer-svg {
  grid-area: 1 / 1;
  width: 280px;
  height: 280px;
}

.timer-bg-circle {
  fill: none;
  stroke: rgba(0, 0, 0, 0.04);
  stroke-width: 6;
}

html.dark-theme .timer-bg-circle,
body.dark-theme .timer-bg-circle {
  stroke: rgba(255, 255, 255, 0.08);
}

:root {
  --study-color-primary: #10b981;
  --study-color-secondary: #10b981;
  --study-color-accessory: #10b981;
}

.timer-progress-circle {
  fill: none;
  stroke: var(--study-color-secondary, #10b981);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 716.28;
  /* 2 * PI * 114 */
  stroke-dashoffset: 0;
  transform-box: view-box;
  transform-origin: 140px 140px;
  transform: scaleX(-1) rotate(-90deg);
  transition: stroke-dashoffset 0.35s ease, stroke 0.3s ease, opacity 0.25s ease;
}

.timer-progress-knob {
  fill: var(--study-color-secondary, #10b981);
  stroke: #ffffff;
  stroke-width: 2.5;
  filter: drop-shadow(0 2px 5px rgba(16, 185, 129, 0.45));
  transform-box: view-box;
  transform-origin: 140px 140px;
  transition: transform 0.35s ease;
}

html.dark-theme .timer-progress-knob,
body.dark-theme .timer-progress-knob {
  stroke: #1e293b;
}

.timer-dial-ticks line {
  stroke: var(--ink);
  opacity: 0.16;
  stroke-linecap: round;
}

.timer-dial-ticks line.major {
  opacity: 0.45;
  stroke-width: 2;
}

.timer-center-content {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.timer-center-sub,
.timer-mode-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.timer-clock {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 56px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap !important;
  word-break: keep-all;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  text-align: center;
  margin: 0;
}

html.dark-theme .timer-clock,
body.dark-theme .timer-clock {
  color: var(--study-color-primary, #10b981);
}

.timer-status-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 14px;
  background: var(--surface-bg, #f4f7f5);
  white-space: nowrap;
}

/* ====================================================
   6 CLOCK STYLES VISUAL LAYOUTS
   ==================================================== */
.clock-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 280px;
}

/* 2. Flip Clock (Ảnh Mẫu 1) */
.flip-status-tag {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--study-color-primary, #10b981);
  text-transform: uppercase;
  margin-bottom: 12px;
  line-height: 1;
}

.flip-board-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 0 16px;
}

.flip-card {
  position: relative;
  width: 140px;
  height: 168px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 700px;
  transform-style: preserve-3d;
}

.flip-card.leaf-flipping {
  animation: flipCardKick 0.38s cubic-bezier(0.2, 0.8, 0.4, 1);
}

@keyframes flipCardKick {
  0% {
    transform: scale(1);
  }

  35% {
    transform: scale(0.97) translateY(1px);
  }

  70% {
    transform: scale(1.01) translateY(-1px);
  }

  100% {
    transform: scale(1) translateY(0);
  }
}

.flip-flap-leaf {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: #ffffff;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  transform-origin: bottom center;
  z-index: 10;
  backface-visibility: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
  animation: flapTurnDown 0.36s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

html.dark-theme .flip-flap-leaf,
body.dark-theme .flip-flap-leaf,
#study.has-custom-bg .flip-flap-leaf {
  background: #1e293b;
}

.flip-flap-leaf .flip-digit-number {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

@keyframes flapTurnDown {
  0% {
    transform: rotateX(0deg);
    opacity: 1;
    filter: brightness(1);
  }

  50% {
    filter: brightness(0.92);
  }

  100% {
    transform: rotateX(-90deg);
    opacity: 0.05;
    filter: brightness(0.8);
  }
}

html.dark-theme .flip-card,
body.dark-theme .flip-card,
#study.has-custom-bg .flip-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.flip-digit-number {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 104px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
  line-height: 1;
  letter-spacing: -3px;
  z-index: 1;
  user-select: none;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.flip-divider-slit {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1.5px;
  background: rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  z-index: 3;
  pointer-events: none;
}

html.dark-theme .flip-divider-slit,
body.dark-theme .flip-divider-slit,
#study.has-custom-bg .flip-divider-slit {
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
}

.flip-notch {
  position: absolute;
  top: calc(50% - 4px);
  width: 6px;
  height: 8px;
  background: var(--surface, #f8fafc);
  z-index: 4;
}

.flip-notch-left {
  left: 0;
  border-radius: 0 4px 4px 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: none;
}

.flip-notch-right {
  right: 0;
  border-radius: 4px 0 0 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-right: none;
}

.flip-colon {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  justify-content: center;
}

.colon-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.flip-shelf-stand {
  width: 280px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

html.dark-theme .flip-shelf-stand,
body.dark-theme .flip-shelf-stand,
#study.has-custom-bg .flip-shelf-stand {
  background: rgba(255, 255, 255, 0.12);
}

.flip-shelf-prog {
  height: 100%;
  width: 0%;
  background: var(--study-color-secondary, #10b981);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* 3. Minimal */
.minimal-status-tag {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--study-color-primary, #10b981);
  text-transform: uppercase;
  margin-bottom: 6px;
  line-height: 1;
}

.minimal-clock-text {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 76px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  margin: 4px 0 14px;
  line-height: 1;
}

.minimal-prog-track {
  width: 240px;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 0 auto;
}

html.dark-theme .minimal-prog-track,
body.dark-theme .minimal-prog-track,
#study.has-custom-bg .minimal-prog-track {
  background: rgba(255, 255, 255, 0.14);
}

.minimal-prog-fill {
  height: 100%;
  width: 0%;
  background: var(--study-color-secondary, #10b981);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* 4. Kitchen Timer (Ảnh Mẫu 2) */
.kitchen-dial-wrap {
  width: 270px;
  height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kitchen-svg {
  width: 270px;
  height: 270px;
}

.kitchen-digital-readout {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 46px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  margin-top: 14px;
  text-align: center;
}

/* 5. Digital Clock (7-Segment LCD - Ảnh Mẫu 3) */
.digital-alarm-casing {
  position: relative;
  width: 340px;
  padding: 20px 24px 18px;
  border-radius: 28px;
  background: #f2ece7;
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, 0.95), inset 0 -3px 6px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
}

html.dark-theme .digital-alarm-casing,
body.dark-theme .digital-alarm-casing,
#study.has-custom-bg .digital-alarm-casing {
  background: #1c2430;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.06), inset 0 -2px 6px rgba(0, 0, 0, 0.4), 0 14px 40px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.08);
}

.digital-casing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  width: 100%;
}

.digital-status-tag {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: var(--study-color-primary, #10b981);
  text-transform: uppercase;
  line-height: 1;
}

.digital-sensor-hole {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

html.dark-theme .digital-sensor-hole,
body.dark-theme .digital-sensor-hole,
#study.has-custom-bg .digital-sensor-hole {
  background: rgba(255, 255, 255, 0.15);
}

.digital-7seg-display {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.digital-7seg-svg {
  width: 100%;
  height: auto;
  max-height: 96px;
}

.seg-on {
  fill: var(--study-color-primary, #10b981);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--study-color-primary, #10b981) 60%, transparent));
  transition: fill 0.15s ease;
}

.seg-off {
  fill: rgba(0, 0, 0, 0.05);
  transition: fill 0.15s ease;
}

html.dark-theme .seg-off,
body.dark-theme .seg-off,
#study.has-custom-bg .seg-off {
  fill: rgba(255, 255, 255, 0.06);
}

.colon-sq {
  fill: var(--study-color-primary, #10b981);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--study-color-primary, #10b981) 60%, transparent));
}

.digital-led-blocks {
  display: flex;
  gap: 4px;
  justify-content: space-between;
  width: 100%;
  margin-top: 14px;
}

.led-block {
  flex: 1 1 0;
  height: 7px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.07);
  transition: background 0.2s, box-shadow 0.2s;
}

html.dark-theme .led-block,
body.dark-theme .led-block,
#study.has-custom-bg .led-block {
  background: rgba(255, 255, 255, 0.08);
}

.led-block.active {
  background: var(--study-color-secondary, #10b981) !important;
  box-shadow: 0 0 5px color-mix(in srgb, var(--study-color-secondary, #10b981) 60%, transparent);
}

/* 6. Hourglass (Đồng hồ cát tự nhiên, chân thực & chuyển động vật lý) */
.hourglass-assembly-wrap {
  width: 170px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 0;
  transform-origin: 50% 50%;
  will-change: transform;
}

.hourglass-assembly-wrap.hourglass-turn-over {
  animation: hourglassFlipSmooth 0.85s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

@keyframes hourglassFlipSmooth {
  0% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(90deg) scale(0.94);
  }

  100% {
    transform: rotate(180deg) scale(1);
  }
}

.hourglass-svg {
  width: 170px;
  height: 240px;
  overflow: visible;
}

.hourglass-digital-readout {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 44px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  margin-top: 12px;
  text-align: center;
}

@keyframes sandStreamTrickle {
  0% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -12;
  }
}

.hourglass-stream-active {
  animation: sandStreamTrickle 0.35s linear infinite;
}

@keyframes particleRain {
  0% {
    transform: translateY(0);
    opacity: 0;
  }

  30% {
    opacity: 0.9;
  }

  80% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(70px);
    opacity: 0;
  }
}

.falling-particle-1 {
  animation: particleRain 0.45s linear infinite;
}

.falling-particle-2 {
  animation: particleRain 0.52s linear infinite 0.15s;
}

.falling-particle-3 {
  animation: particleRain 0.48s linear infinite 0.3s;
}

@keyframes ripplePulse {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.4;
  }

  100% {
    transform: scale(0.85);
    opacity: 0.8;
  }
}

.sand-impact-ripple {
  transform-origin: 90px 200px;
  animation: ripplePulse 0.7s ease-in-out infinite;
}

/* Primary Action Controls: Reset (Circular), Start (Accessory Pill), Next (Circular) */
.study-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 12px auto 14px;
  flex-wrap: nowrap;
}

.study-btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface, #ffffff);
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
  padding: 0;
}

.study-btn-circle:hover {
  transform: scale(1.08);
  border-color: var(--study-color-accessory, #10b981);
  color: var(--study-color-accessory, #10b981);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.study-btn-circle:active {
  transform: scale(0.95);
}

html.dark-theme .study-btn-circle,
body.dark-theme .study-btn-circle {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

.study-btn-pill {
  height: 48px;
  padding: 0 32px;
  border-radius: 9999px;
  background: var(--study-color-accessory, #10b981) !important;
  color: #ffffff !important;
  font-size: 15.5px;
  font-weight: 700;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 18px var(--study-accessory-glow, rgba(16, 185, 129, 0.4)) !important;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.study-btn-pill:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 24px var(--study-accessory-glow, rgba(16, 185, 129, 0.5)) !important;
  filter: brightness(1.06);
}

.study-btn-pill:active {
  transform: scale(0.98);
}

.study-btn-pause {
  background: var(--study-color-accessory, #10b981) !important;
  box-shadow: 0 4px 18px var(--study-accessory-glow, rgba(16, 185, 129, 0.4)) !important;
}

.study-btn-secondary {
  height: 48px;
  padding: 0 20px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.08) !important;
  color: var(--study-color-accessory, #10b981) !important;
  border: 1.5px solid var(--study-color-accessory, #10b981) !important;
  font-size: 14.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.study-btn-secondary:hover {
  background: rgba(16, 185, 129, 0.16) !important;
  transform: scale(1.03);
}

.study-btn-secondary:active {
  transform: scale(0.98);
}

html.dark-theme .study-btn-secondary,
body.dark-theme .study-btn-secondary {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #a7f3d0 !important;
}

.study-btn-break {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.35) !important;
}

.study-btn-leave {
  background: var(--study-color-accessory, #10b981) !important;
  box-shadow: 0 4px 18px var(--study-accessory-glow, rgba(16, 185, 129, 0.4)) !important;
}

/* Quick Task Prompt ("+ Bạn đang tập trung vào việc gì?") */
.study-quick-task-wrap {
  margin: 0 auto 12px;
  max-width: 420px;
  text-align: center;
}

.study-quick-task-prompt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 9999px;
  transition: all 0.2s ease;
  user-select: none;
}

.study-quick-task-prompt .prompt-icon {
  color: var(--study-color-accessory, #10b981);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}

.study-quick-task-prompt:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

html.dark-theme .study-quick-task-prompt:hover,
body.dark-theme .study-quick-task-prompt:hover {
  background: rgba(255, 255, 255, 0.06);
}

.study-goal-input-box input {
  width: 100%;
  height: 38px;
  border-radius: 9999px;
  border: 1.5px solid var(--study-color-accessory, #10b981);
  padding: 0 16px;
  font-size: 13px;
  text-align: center;
  outline: none;
  background: var(--surface, #ffffff);
  color: var(--ink);
  box-sizing: border-box;
}

.study-goal-input-box input:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--study-color-accessory, #10b981) 25%, transparent);
}

.prompt-clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.prompt-clear-btn:hover {
  color: #ef4444;
}

/* Meta Progress Row */
.study-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 auto 12px;
}

.study-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--surface-bg, #f4f7f5);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.meta-dots {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  margin-right: 5px;
}

.meta-goal-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.2s ease;
  box-sizing: border-box;
  flex-shrink: 0;
}

.meta-goal-dot.filled {
  background-color: var(--study-color-accessory, #10b981) !important;
  border: 1.5px solid var(--study-color-accessory, #10b981) !important;
  box-shadow: 0 0 5px var(--study-accessory-glow, rgba(16, 185, 129, 0.45));
}

.meta-goal-dot.empty {
  border: 1.5px solid var(--study-color-accessory, #10b981) !important;
  opacity: 0.45;
  background-color: transparent !important;
}

html.dark-theme .meta-goal-dot.empty,
body.dark-theme .meta-goal-dot.empty {
  border-color: var(--study-color-accessory, #10b981);
  opacity: 0.55;
}

.cycle-pill-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--study-color-secondary, #10b981);
  display: inline-block;
  flex-shrink: 0;
  box-sizing: border-box;
  margin-right: 2px;
  transition: all 0.25s ease;
}

.cycle-pill-indicator.active {
  background-color: var(--study-color-secondary, #10b981);
  box-shadow: 0 0 6px color-mix(in srgb, var(--study-color-secondary, #10b981) 50%, transparent);
}

.study-meta-pill.preset-pill {
  cursor: pointer;
  transition: all 0.2s ease;
}

.study-meta-pill.preset-pill:hover {
  border-color: var(--study-color-secondary, #10b981);
  color: var(--study-color-secondary, #10b981);
}

/* Dedicated Study Quote Card */
.study-quote-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface-bg, #f4f7f5);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 16px;
  margin: 0 auto 14px;
  max-width: 520px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.study-quote-card:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  border-color: var(--study-color-accessory, #10b981);
}

.quote-icon {
  font-size: 14px;
  flex-shrink: 0;
  color: var(--study-color-accessory, #10b981);
}

.timer-quote-text {
  font-size: 12px;
  color: var(--text, #1e293b);
  line-height: 1.4;
  text-align: center;
}

/* THE UNIFIED 6-BUTTON FLOATING DOCK TOOLBAR (UNDER THE CLOCK) */
.study-dock-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  margin: 0 auto 12px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
}

html.dark-theme .study-dock-toolbar,
body.dark-theme .study-dock-toolbar {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
  flex-shrink: 0;
}

.dock-btn:hover {
  background: color-mix(in srgb, var(--study-color-accessory, #10b981) 12%, transparent);
  transform: translateY(-2px);
  color: var(--study-color-accessory, #10b981);
}

html.dark-theme .dock-btn:hover,
body.dark-theme .dock-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--study-color-accessory, #34d399);
}

.dock-btn:active {
  transform: scale(0.92);
}

.dock-btn .dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.dock-btn .dock-label {
  display: none !important;
}

@media (max-width: 768px) {
  .study-actions {
    gap: 12px;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 360px;
    justify-content: center;
    margin: 10px auto 14px;
  }

  .study-actions .btn-label {
    display: none !important;
  }

  .study-btn-pill,
  .study-btn-secondary {
    height: 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px !important;
  }

  .study-btn-pill[style*="none"],
  .study-btn-secondary[style*="none"] {
    display: none !important;
  }

  .study-btn-circle {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 50% !important;
    padding: 0 !important;
  }

  .study-quick-task-wrap {
    margin: 0 auto 10px;
  }

  .study-meta-row {
    gap: 6px;
    margin: 0 auto 10px;
  }

  .study-meta-pill {
    padding: 4px 9px;
    font-size: 11.5px;
  }

  .study-dock-toolbar {
    gap: 6px;
    padding: 5px 10px;
    width: fit-content;
    max-width: 100%;
    justify-content: center;
    margin: 0 auto 10px;
  }

  .study-quote-card {
    margin: 0 auto 10px;
  }

  .dock-btn {
    width: 38px !important;
    height: 38px !important;
  }

  .dock-btn .dock-label {
    display: none !important;
  }
}

/* Goal input */
.study-goal-box {
  margin: 12px auto 18px;
  max-width: 460px;
  text-align: left;
}

.study-goal-box label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.study-goal-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-bg, #fafcfb);
  color: var(--ink);
  font-size: 14px;
  box-sizing: border-box;
}

.study-goal-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 94, 69, 0.12);
}

/* Controls */
.study-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  max-width: 480px;
  margin: 10px auto 14px;
}

.study-action-ctrl .btn-icon {
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.study-action-ctrl .btn-label {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.study-btn-pulse {
  animation: subtlePulse 2.5s infinite;
}

@keyframes subtlePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(47, 94, 69, 0.2);
  }

  50% {
    transform: scale(1.02);
    box-shadow: 0 6px 18px rgba(47, 94, 69, 0.35);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(47, 94, 69, 0.2);
  }
}

/* ==========================================================================
   AUDIO & AMBIANCE ARENA
   ========================================================================== */
.ambient-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.sound-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.sound-tabs::-webkit-scrollbar {
  display: none;
}

.sound-tab {
  background: none;
  border: 1px solid transparent;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.sound-tab:hover {
  color: var(--ink);
  background: var(--surface-bg, #f4f7f5);
}

.sound-tab.active {
  color: var(--primary);
  background: #eef5f1;
  border-color: rgba(47, 94, 69, 0.2);
}

.perk-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  background: #f1f3f5;
  color: #868e96;
}

.perk-badge.unlocked {
  display: none !important;
}

.ambient-sub-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.ambient-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.mix-mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

/* Ambient Grid (Single column: các khối ngang căn dọc trên cả PC & Mobile) */
.ambient-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.ambient-track {
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.ambient-track.active {
  border-color: var(--primary);
  background: #eef5f1;
  box-shadow: 0 2px 8px rgba(47, 94, 69, 0.1);
}

.ambient-track.locked {
  opacity: 0.65;
  position: relative;
}

.ambient-track-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.ambient-track-info>div {
  min-width: 0;
}

.ambient-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ambient-track-toggle {
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap !important;
  min-width: 58px;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.ambient-track.active .ambient-track-toggle {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ambient-track-delete {
  background: var(--paper, #fff);
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted, #64748b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.ambient-track-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
  transform: translateY(-1px);
}

.ambient-track.active .ambient-track-delete {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(47, 94, 69, 0.2);
}

.ambient-track.active .ambient-track-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.ambient-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.ambient-slider {
  width: 100%;
  min-width: 0;
  accent-color: var(--primary);
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
  box-sizing: border-box;
}

/* Lo-Fi & Custom Audio Tabs */
.perk-locked-banner {
  background: #fff9db;
  border: 1px solid #ffe066;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #795548;
  margin-bottom: 14px;
}

.perk-locked-banner .lock-icon {
  font-size: 22px;
}

.perk-locked-banner strong {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
}

.perk-locked-banner p {
  font-size: 12px;
  margin: 0;
  opacity: 0.85;
}

.lofi-tracks-list,
.custom-audio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.lofi-track-item,
.custom-audio-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: all 0.2s ease;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.custom-audio-name {
  flex: 1;
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.custom-audio-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.lofi-track-item.playing,
.custom-audio-item.playing {
  border-color: var(--primary);
  background: #eef5f1;
}

.upload-dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background: var(--surface-bg, #fafcfb);
  margin-bottom: 14px;
}

.dropzone-tip {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}

/* Custom Audio Sub-sections (Rạch ròi cho từng loại) */
.custom-audio-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.custom-audio-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.custom-audio-head h4 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--ink);
}

.custom-audio-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.custom-audio-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-audio-limit-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-bg, #f1f3f5);
  color: var(--muted);
}

.custom-audio-limit-badge.unlimited {
  background: #d3f9d8;
  color: #2b8a3e;
  font-weight: 700;
}

/* Clock color picker (Streak >= 14) */
.clock-color-wrap {
  display: flex;
  flex-direction: column;
}

.clock-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.clock-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.clock-color-swatch:hover {
  transform: scale(1.15);
}

.clock-color-swatch.active {
  box-shadow: 0 0 0 2px var(--primary, #10b981);
  transform: scale(1.1);
}

/* Gradient Swatches (Streak >= 50) */
.color-swatch.gradient {
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.color-swatch.gradient::after {
  content: '✨';
  font-size: 10px;
  position: absolute;
  top: 1px;
  right: 1px;
}

/* ==========================================================================
   THEME & WALLPAPER ARENA
   ========================================================================== */
.theme-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.theme-card-header h3 {
  font-size: 16px;
  margin: 0 0 2px;
  color: var(--ink);
}

.theme-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.theme-selection-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.theme-tier-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

.preset-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.preset-thumb-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.preset-thumb-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.preset-thumb-card.selected {
  border-color: var(--primary);
  background: var(--surface-bg, #f4f7f5);
  box-shadow: 0 0 0 2px var(--primary-glow, rgba(18, 61, 48, 0.2));
}

.preset-thumb-color {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.preset-thumb-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-active-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--primary, #123d30);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.custom-wall-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-bg, #f7faf8);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.custom-wall-info {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-wall-limit-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--sage, #dbe7d7);
  color: var(--ink, #123d30);
  font-weight: 600;
}

.custom-wall-limit-badge.unlimited {
  background: #d3f9d8;
  color: #2b8a3e;
  font-weight: 700;
}

/* Custom Wallpapers Grid Gallery */
.custom-wallpapers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.custom-wallpaper-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.custom-wallpaper-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.custom-wallpaper-card.selected {
  border-color: var(--primary);
  background: var(--surface-bg, #f4f7f5);
  box-shadow: 0 0 0 2px var(--primary-glow, rgba(18, 61, 48, 0.2));
}

.custom-wallpaper-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.custom-wall-active-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: var(--primary, #123d30);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.custom-wall-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-wall-del-btn:hover {
  background: #e63946;
}

.custom-wallpaper-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  gap: 4px;
}

.custom-wallpaper-name {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.custom-wallpaper-size {
  color: var(--muted);
  font-size: 10px;
  flex-shrink: 0;
}

/* Wallpaper Dimming / Contrast Control */
.wallpaper-dim-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-bg, #f7faf8);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.wallpaper-dim-slider-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-palette-picker {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.color-swatch:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.color-swatch.active {
  box-shadow: 0 0 0 3px #ffffff, 0 0 14px var(--primary-glow, rgba(16, 185, 129, 0.6));
  transform: scale(1.12);
  border-color: #ffffff;
}

.color-swatch.active::after {
  content: '✓';
  font-size: 15px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.color-swatch.locked {
  opacity: 0.65;
  filter: grayscale(0.2);
}

.color-swatch.locked::after {
  content: '🔒';
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.clock-color-swatch.locked {
  opacity: 0.55;
  position: relative;
}

.clock-color-swatch.locked::after {
  content: '🔒';
  font-size: 10px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.preset-thumb-card.locked {
  opacity: 0.7;
}

.preset-thumb-card.locked .preset-thumb-color {
  filter: grayscale(0.25) brightness(0.8);
  position: relative;
}

.preset-thumb-card.locked .preset-thumb-color::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
}

.custom-wallpaper-card.locked {
  opacity: 0.7;
}

.custom-wallpaper-card.locked .custom-wallpaper-preview::after {
  content: '🔒';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.85);
}

.color-swatch-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

.color-swatch-btn.active {
  box-shadow: 0 0 0 2.5px var(--primary);
}

/* ==========================================================================
   CO-STUDY & TO-DO CHECKLIST
   ========================================================================== */
.co-study-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.co-study-head h3 {
  font-size: 16px;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.co-study-tip {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}

#coStudyCountBadge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 12px;
}

@media (max-width: 600px) {
  .co-study-head {
    align-items: center;
    gap: 6px;
  }

  .co-study-head h3 {
    font-size: 14.5px;
  }

  .co-study-tip {
    font-size: 11px;
  }

  #coStudyCountBadge {
    font-size: 10.5px;
    padding: 2px 6px;
  }
}

.co-study-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.co-study-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 20px 10px;
  background: var(--surface-bg, #f7faf8);
  border-radius: 10px;
  border: 1px dashed var(--line);
}

.co-study-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: transform 0.15s ease;
  box-sizing: border-box;
  width: 100%;
}

.co-study-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.co-study-item.is-self {
  border-color: var(--primary);
  background: #f0f7f3;
}

.co-study-info {
  flex: 1;
  min-width: 0;
}

.co-study-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.self-status-pill {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
}

.co-study-goal {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.co-study-status-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.co-study-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.co-study-cheers-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  padding-top: 6px;
  border-top: 1px solid rgba(125, 125, 125, 0.12);
  box-sizing: border-box;
}

.co-study-cheers-label {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.75;
  margin-right: auto;
  letter-spacing: 0.2px;
}

.co-study-cheers {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.cheer-btn {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s;
}

.cheer-btn:hover:not(:disabled) {
  transform: scale(1.18);
  background: #fff8e1;
}

.cheer-btn:disabled,
.cheer-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* To-Do Checklist */
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.todo-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.todo-head h3 {
  font-size: 14px;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
}

.todo-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.todo-head-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.todo-head-icon-btn:hover {
  border-color: var(--study-color-accessory, #10b981);
  color: var(--study-color-accessory, #10b981);
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}

.todo-input-wrap {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.todo-input-wrap input {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface-bg, #fafcfb);
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.todo-input-wrap input:focus {
  border-color: var(--study-color-accessory, #10b981);
  outline: none;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.todo-tag-select {
  flex: 0 0 auto;
  max-width: 110px;
  height: 38px;
  padding: 0 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: var(--surface-bg, #fafcfb);
  color: var(--ink);
  cursor: pointer;
  box-sizing: border-box;
}

@media (max-width: 500px) {
  .todo-tag-select {
    max-width: 80px !important;
    padding: 0 4px !important;
    font-size: 11.5px !important;
  }
}

.todo-add-btn,
#addTodoBtn {
  min-width: 38px !important;
  width: 38px !important;
  height: 38px !important;
  flex: 0 0 38px !important;
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: var(--study-color-accessory, #10b981) !important;
  color: #ffffff !important;
  padding: 0;
  line-height: 1;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--study-color-accessory, #10b981) 35%, transparent);
  transition: all 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}

.todo-add-btn:hover,
#addTodoBtn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px color-mix(in srgb, var(--study-color-accessory, #10b981) 45%, transparent);
}

.todo-add-btn:active,
#addTodoBtn:active {
  transform: translateY(0);
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-bg, #f7faf8);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
}

.todo-item.done span {
  text-decoration: line-through;
  opacity: 0.55;
}

.todo-item input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.todo-del-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

.todo-del-btn:hover {
  color: #c62828;
}

/* Floating Cheer Toast */
.floating-cheer {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--paper);
  border: 2px solid #ffd54f;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  animation: floatCheerIn 3.5s forwards ease-out;
  pointer-events: none;
}

@keyframes floatCheerIn {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }

  15% {
    opacity: 1;
    transform: translateY(0) scale(1.05);
  }

  25% {
    transform: translateY(0) scale(1);
  }

  80% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
    transform: translateY(-30px);
  }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .study-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .study-main-col,
  .study-side-col {
    display: contents;
  }

  #timerMainCard {
    order: 1;
  }

  #todoMainCard,
  .todo-card {
    order: 2;
  }

  #coStudyCard,
  .co-study-card {
    order: 3;
  }

  #soundArenaCard {
    order: 4;
  }

  #themeArenaCard {
    order: 5;
  }

  .timer-circle {
    width: 220px;
    height: 220px;
  }

  .timer-svg {
    width: 220px;
    height: 220px;
  }

  .timer-clock {
    font-size: 42px !important;
    line-height: 1;
    white-space: nowrap !important;
  }

  .timer-mode-selector {
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .study-mode-btn {
    padding: 8px 6px;
    min-height: 52px;
    min-width: 0;
    box-sizing: border-box;
  }

  .study-mode-btn strong {
    font-size: 12px;
  }

  .study-mode-btn span {
    font-size: 10px;
  }

  .study-action-ctrl {
    min-width: 110px;
    height: 42px;
    padding: 0 14px;
    font-size: 13px;
    box-sizing: border-box;
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  #study.page {
    padding: 68px 12px 100px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .study-bg-layer,
  .study-bg-overlay {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
  }

  .study-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
  }

  .study-heading h1 {
    font-size: 24px !important;
    line-height: 1.15;
    margin-bottom: 0;
  }

  .study-heading p.eyebrow {
    font-size: 11px !important;
    margin-bottom: 2px;
  }

  .study-live-badge {
    align-self: flex-start;
  }

  .study-card {
    padding: 14px 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
  }

  .timer-mode-selector {
    gap: 6px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .study-mode-btn {
    padding: 6px 3px;
    min-width: 0;
    min-height: 48px;
    box-sizing: border-box;
  }

  .study-mode-btn strong {
    font-size: 11px;
    letter-spacing: -0.2px;
  }

  .study-mode-btn span {
    font-size: 9px;
  }

  .timer-circle {
    width: 200px;
    height: 200px;
  }

  .timer-svg {
    width: 200px;
    height: 200px;
  }

  .timer-clock {
    font-size: 38px !important;
  }

  .study-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin: 8px auto 12px;
  }

  .study-actions .btn-label {
    display: none !important;
  }

  .study-actions .study-btn-circle {
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    border-radius: 50% !important;
    padding: 0 !important;
  }

  .study-actions .study-btn-pill,
  .study-actions .study-btn-secondary {
    flex: 0 0 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center;
    justify-content: center;
  }

  .study-actions .study-btn-pill[style*="none"],
  .study-actions .study-btn-secondary[style*="none"] {
    display: none !important;
  }

  .ambient-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .ambient-track {
    padding: 10px 12px;
  }

  .ambient-track-toggle {
    min-width: 52px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .sound-tabs {
    gap: 6px;
  }

  .sound-tab {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* Study Lounge & Arena Badges (Disabled per user request) */
.study-nav-badge,
.arena-nav-badge {
  display: none !important;
}

.nav-link-arena {
  display: inline-flex;
  align-items: center;
}

.nav-link-arena svg {
  vertical-align: -2px;
  margin-right: 4px;
  flex-shrink: 0;
  stroke: currentColor;
}

.study-maintenance-card {
  background: var(--surface);
  border: 1px dashed var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   SELF-STUDY POPUPS: LEFT HALF POSITIONING, SLIDE IN FROM RIGHT & ELEVATED SHADOW
   ========================================================================== */
@keyframes studySlideInFromRightEdge {
  0% {
    opacity: 0;
    transform: translateX(60px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes studyCenterModalIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

dialog.study-popup-right:not([open]),
dialog.study-popup-left:not([open]),
dialog.study-settings-modal:not([open]),
dialog.study-method-guide-modal:not([open]),
dialog.study-confirm-modal:not([open]) {
  display: none !important;
}

/* 1. Customization / Settings Popups: Slid-over Drawer on Right (Desktop), No Wallpaper Blur */
dialog.study-popup-right,
dialog.study-settings-modal,
dialog.study-method-guide-modal {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  margin: 0 !important;
  transform: none !important;
  width: 480px !important;
  max-width: min(92vw, 520px) !important;
  height: 100vh !important;
  max-height: 100vh !important;
  background: #ffffff !important;
  border-radius: 20px 0 0 20px !important;
  border: 1px solid rgba(18, 61, 48, 0.12) !important;
  border-right: none !important;
  box-shadow: -14px 0 45px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
  padding: 24px 28px !important;
  box-sizing: border-box !important;
  z-index: 9999 !important;
  overflow-y: auto !important;
}

dialog.study-popup-right[open],
dialog.study-settings-modal[open],
dialog.study-method-guide-modal[open] {
  display: flex !important;
  flex-direction: column !important;
  animation: studySlideInFromRightEdge 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Do NOT blur the background wallpaper when opening study customization */
dialog.study-popup-right::backdrop,
dialog.study-settings-modal::backdrop,
dialog.study-method-guide-modal::backdrop {
  background: rgba(0, 0, 0, 0.05) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 2. Confirmation & Action Modals: Dead Center */
dialog.study-confirm-modal,
dialog#studyExitConfirmModal,
dialog#studyJoinPinModal,
dialog#studyCreateMeetingModal,
dialog#studySwitchSpaceConfirmModal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  transform: translate(-50%, -50%) !important;
  width: 90vw !important;
  max-width: 450px !important;
  max-height: 85vh !important;
  background: #ffffff !important;
  border-radius: 18px !important;
  border: 1px solid rgba(18, 61, 48, 0.14) !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35) !important;
  padding: 24px 26px !important;
  box-sizing: border-box !important;
  z-index: 10000 !important;
  overflow-y: auto !important;
}

dialog.study-confirm-modal[open],
dialog#studyExitConfirmModal[open],
dialog#studyJoinPinModal[open],
dialog#studyCreateMeetingModal[open],
dialog#studySwitchSpaceConfirmModal[open] {
  display: flex !important;
  flex-direction: column !important;
  animation: studyCenterModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

dialog.study-confirm-modal::backdrop,
dialog#studyExitConfirmModal::backdrop,
dialog#studyJoinPinModal::backdrop,
dialog#studyCreateMeetingModal::backdrop,
dialog#studySwitchSpaceConfirmModal::backdrop {
  background: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
}

@keyframes studySlideUpMobile {
  from {
    transform: translateY(100%);
    opacity: 0.7;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {

  dialog.study-popup-right,
  dialog.study-popup-left,
  dialog.study-settings-modal,
  dialog.study-method-guide-modal {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 88vh !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 22px 18px 30px 18px !important;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.45) !important;
    animation: studySlideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    overflow-y: auto !important;
  }

  dialog.study-confirm-modal,
  dialog#studyExitConfirmModal,
  dialog#studyJoinPinModal,
  dialog#studyCreateMeetingModal,
  dialog#studySwitchSpaceConfirmModal {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: calc(100vw - 32px) !important;
    max-width: 420px !important;
    max-height: 85vh !important;
    border-radius: 18px !important;
    padding: 20px 20px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4) !important;
    animation: studyCenterModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    overflow-y: auto !important;
  }

  .preset-selector-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .study-settings-modal .duration-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .study-settings-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 8px !important;
    scrollbar-width: none !important;
  }

  .study-settings-tabs::-webkit-scrollbar {
    display: none !important;
  }

  .settings-tab-btn {
    padding: 0 !important;
    height: 38px !important;
  }

  .study-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 360px !important;
    margin: 10px auto 14px !important;
  }

  .study-actions .btn-label {
    display: none !important;
  }

  .study-actions .study-btn-circle {
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    border-radius: 50% !important;
    padding: 0 !important;
  }

  .study-actions .study-btn-pill,
  .study-actions .study-btn-secondary {
    flex: 0 0 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center;
    justify-content: center;
  }

  .study-actions .study-btn-pill[style*="none"],
  .study-actions .study-btn-secondary[style*="none"] {
    display: none !important;
  }

  .study-layout {
    flex-direction: column !important;
    gap: 16px !important;
  }

  .study-main-col,
  .study-side-col {
    width: 100% !important;
    max-width: 100% !important;
  }

  .library-room-card {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .library-room-card button {
    width: 100% !important;
    justify-content: center !important;
  }

  .active-space-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .active-space-stats {
    justify-content: space-between !important;
    width: 100% !important;
  }

  .active-space-stats .btn-leave-space {
    width: auto !important;
  }
}

.study-settings-modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.study-settings-modal .close-modal {
  border: 1px solid #d5ded4;
  background: #fbfcf9;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #61756a;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.15s;
}

.study-settings-modal .close-modal:hover {
  background: #f0f4ef;
  color: var(--ink);
  border-color: #bccbc0;
}

.study-settings-modal .eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: var(--green);
  text-transform: uppercase;
  margin: 0 0 6px;
  line-height: 1.4;
}

.study-settings-modal .modal-head h2 {
  font: 700 20px/1.35 var(--sans);
  color: var(--ink);
  margin: 0;
  letter-spacing: normal;
}

.study-settings-modal .settings-body {
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 480px;
}

.study-settings-modal .settings-group {
  background: #fbfcf9;
  border: 1px solid #e7ece5;
  border-radius: 12px;
  padding: 16px 18px;
}

.study-settings-modal .settings-group h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--green);
  margin: 0 0 14px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.study-settings-modal .duration-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.study-settings-modal .duration-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.study-settings-modal .duration-item label {
  font-size: 12px;
  font-weight: 600;
  color: #4a5c51;
  margin: 0 0 6px;
  line-height: 1.4;
}

.study-settings-modal .stepper-input {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #d5ded4;
  border-radius: 8px;
  overflow: hidden;
  height: 38px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.study-settings-modal .stepper-input:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 98, 71, 0.15);
}

.study-settings-modal .step-btn {
  width: 34px;
  height: 100%;
  background: #f1f5ef;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.study-settings-modal .step-btn:hover {
  background: #e1ebde;
  color: var(--green);
}

.study-settings-modal .step-btn:active {
  background: #d4e2cf;
}

.study-settings-modal .stepper-input input {
  flex: 1;
  width: 100%;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  padding: 0;
  margin: 0;
  appearance: textfield;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
}

.study-settings-modal .stepper-input input::-webkit-outer-spin-button,
.study-settings-modal .stepper-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.study-settings-modal .stepper-input input:focus {
  outline: none;
}

.study-settings-modal .toggle-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.study-settings-modal .setting-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #e7ece5;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.study-settings-modal .setting-toggle-row:hover {
  background: #fbfdfa;
  border-color: #cbd8c8;
}

.study-settings-modal .setting-toggle-row div {
  flex: 1;
}

.study-settings-modal .setting-toggle-row strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  margin-bottom: 4px;
}

.study-settings-modal .setting-toggle-row span {
  display: block;
  font-size: 12px;
  color: #61756a;
  line-height: 1.45;
  margin-top: 2px;
}

.study-settings-modal .toggle-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  min-width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  outline: none;
  border: none;
  margin: 0;
  padding: 0;
  transition: background 0.25s;
}

.study-settings-modal .toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.study-settings-modal .toggle-switch:checked {
  background: #246247;
}

.study-settings-modal .toggle-switch:checked::after {
  transform: translateX(20px);
}

.study-settings-modal .alarm-settings-row {
  background: #ffffff;
  border: 1px solid #e7ece5;
  border-radius: 9px;
  padding: 12px;
}

.study-settings-modal .alarm-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.study-settings-modal .alarm-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.study-settings-modal .alarm-field select {
  flex: 1;
  min-width: 170px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d5ded4;
  background: #fbfcf9;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
}

.study-settings-modal .alarm-field select:focus {
  border-color: var(--green);
  outline: none;
}

.study-settings-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px !important;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 520px) {
  .study-settings-modal {
    padding: 18px 16px;
    width: calc(100vw - 20px);
  }

  .study-settings-modal .modal-head h2 {
    font-size: 18px;
  }

  .study-settings-modal .duration-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .study-settings-modal .duration-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
  }

  .study-settings-modal .duration-item label {
    font-size: 12px;
    margin: 0;
    line-height: 1.4;
  }

  .study-settings-modal .stepper-input {
    width: 130px;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   STUDY ROOM UPGRADE: PRESETS, FLOWTIME, DAILY GOAL, TASKS & ADVANCED SETTINGS
   ========================================================================== */

/* 1. Timer Presets Navigation Bar */
.study-presets-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px 2px;
  margin-bottom: 6px;
  scrollbar-width: thin;
}

.study-presets-bar::-webkit-scrollbar {
  height: 4px;
}

.study-presets-bar::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  user-select: none;
}

.preset-chip:hover {
  background: var(--surface-hover, #f1f5f2);
  border-color: var(--primary);
  color: var(--primary);
}

.preset-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow, rgba(16, 185, 129, 0.35));
}

.preset-chip.custom-chip {
  background: #f8fafc;
  border-style: dashed;
}

.preset-chip.custom-chip.active {
  background: var(--primary);
  color: #fff;
  border-style: solid;
}

.guide-trigger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 11px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}

.guide-trigger-icon:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* 2. Flowtime Break Ratio Selector */
.flowtime-ratio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 8px 14px;
  margin-top: 10px;
  animation: fadeInDown 0.25s ease;
}

.flowtime-ratio-label {
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
}

.flowtime-ratio-buttons {
  display: flex;
  gap: 6px;
}

.ft-ratio-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: #ffffff;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.ft-ratio-btn:hover {
  background: #e0f2fe;
}

.ft-ratio-btn.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
}

.flowtime-calc-preview {
  font-size: 12px;
  font-weight: 800;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
}

/* 3. Daily Goal Pomodoro Bar */
.study-daily-goal-bar {
  margin: 10px 0 6px 0;
  padding: 8px 12px;
  background: var(--surface-bg, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.daily-goal-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}

.daily-goal-title {
  color: var(--muted);
  font-weight: 600;
}

.daily-goal-count {
  color: var(--ink);
  font-weight: 800;
}

.daily-goal-pct {
  color: var(--primary);
  font-weight: 700;
  margin-left: auto;
}

.daily-goal-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.daily-goal-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 999px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 4. Enhanced Tasks & Todo Checklist */
.todo-head-title-row,
.todo-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 0;
  line-height: 1;
}

.todo-pct-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--study-color-accessory, #10b981);
  background: color-mix(in srgb, var(--study-color-accessory, #10b981) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--study-color-accessory, #10b981) 30%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.todo-title-row h3 {
  white-space: nowrap !important;
  word-break: keep-all !important;
  display: inline-flex;
  align-items: center;
  margin: 0;
  line-height: 1;
}

.todo-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.todo-tag-mgr-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.todo-tag-mgr-btn:hover {
  background: var(--surface-hover, #f1f5f2);
  border-color: var(--study-color-accessory, #10b981);
}

.todo-tag-select {
  max-width: 135px;
  height: 38px;
  padding: 0 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  background: var(--surface-bg, #fafcfb);
  color: var(--ink);
  cursor: pointer;
}

.todo-tag-select:focus {
  border-color: var(--primary);
  outline: none;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  transition: all 0.15s;
}

.todo-item:hover {
  border-color: #cbd5e1;
}

.todo-item.done {
  opacity: 0.65;
}

.todo-item-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  line-height: 1.35;
}

.todo-item.done .todo-item-text {
  text-decoration: line-through;
}

.todo-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  line-height: 1.2;
}

.todo-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border-width: 1px;
  border-style: solid;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
  user-select: none;
}

.todo-status-badge:hover {
  transform: scale(1.05);
}

/* 5. Study Settings Modal Upgrade (Tabs & Panes - Icon Only Dock) */
.study-settings-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface, #ffffff);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-tab-btn:hover {
  background: var(--surface-hover, #f1f5f2);
  color: var(--study-color-primary, #10b981);
  transform: translateY(-1px);
}

.settings-tab-btn.active {
  background: color-mix(in srgb, var(--study-color-primary, #10b981) 12%, transparent);
  color: var(--study-color-primary, #10b981);
  border-color: var(--study-color-primary, #10b981);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--study-color-primary, #10b981) 20%, transparent);
}

html.dark-theme .settings-tab-btn,
body.dark-theme .settings-tab-btn {
  background: #1c2430;
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

html.dark-theme .settings-tab-btn:hover,
body.dark-theme .settings-tab-btn:hover {
  background: #243040;
  color: #f1f5f9;
}

html.dark-theme .settings-tab-btn.active,
body.dark-theme .settings-tab-btn.active {
  background: color-mix(in srgb, var(--study-color-primary, #10b981) 18%, transparent);
  border-color: var(--study-color-primary, #10b981);
  color: var(--study-color-primary, #10b981);
}

.settings-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.settings-group-header h3 {
  margin: 0 !important;
}

.btn-guide-link {
  background: none;
  border: none;
  color: #0284c7;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.btn-guide-link:hover {
  text-decoration: underline;
}

/* Preset Selector Grid in Modal */
.preset-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.preset-card {
  padding: 10px 8px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.preset-card:hover {
  border-color: var(--green);
  background: #fbfdfa;
}

.preset-card.active {
  border-color: var(--green);
  background: #f0f7f3;
  box-shadow: 0 0 0 2px rgba(36, 98, 71, 0.15);
}

.preset-card-val {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.preset-card-desc {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.preset-card.active .preset-card-val {
  color: var(--green);
}

/* Ratio Pills */
.ratio-pill-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ratio-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  transition: all 0.15s;
}

.ratio-pill:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}

/* Cycle interval row */
.cycle-interval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}

.interval-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.stepper-sm {
  height: 32px;
  width: 105px;
}

.full-cycle-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--green);
  background: #eef7f2;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(36, 98, 71, 0.2);
}

/* Ring multiplier and reminder pills */
.ring-multiplier-group,
.reminder-pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ring-mult-btn,
.remind-pill-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.ring-mult-btn:hover,
.remind-pill-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.ring-mult-btn.active,
.remind-pill-btn.active {
  background: var(--green);
  color: #ffffff;
  border-color: var(--green);
}

/* Task Labels Manager List */
.task-labels-mgr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.task-label-mgr-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
}

.task-label-mgr-row input.task-label-color-input,
.create-label-inline-form input#newLabelColorInput {
  display: inline-block !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  border: none !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
}

.task-label-mgr-row input.task-label-mgr-name {
  display: block !important;
  flex: 1 !important;
  min-width: 0 !important;
  width: auto !important;
  height: 34px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: 0 10px !important;
  margin: 0 !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  background: #ffffff !important;
}

.task-label-del-btn {
  background: none !important;
  border: none !important;
  color: #ef4444 !important;
  cursor: pointer !important;
  padding: 6px !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  transition: all 0.15s ease !important;
}

.task-label-del-btn:hover {
  background: #fee2e2 !important;
}

body.dark-theme .task-label-mgr-row input.task-label-mgr-name {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

body.dark-theme .task-label-del-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
}

/* Method Guide Modal Cards */
.method-card {
  padding: 16px;
  background: var(--surface-bg, #fbfcf9);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.method-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 8px;
}

.method-icon {
  font-size: 18px;
}

.method-card-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 10px 0;
}

.method-formula-box {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
}

.method-example-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 12.5px;
  color: #166534;
}

.example-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  background: #22c55e;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.method-benefit-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: #1e40af;
}

/* Mobile responsiveness */
@media (max-width: 640px) {
  .preset-selector-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ratio-pill-selector {
    grid-template-columns: 1fr;
  }

  .cycle-interval-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   FLEXIBLE STUDY SPACES & COHORT ROOMS (IMPECCABLE CRAFT & ANTI-SLOP TASTE)
   ========================================================================== */
.study-spaces-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.study-spaces-filter-bar::-webkit-scrollbar {
  display: none;
}

.space-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface-bg, #ffffff);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.space-filter-pill:hover {
  border-color: var(--primary);
  color: var(--ink);
}

.space-filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.space-filter-pill.create-pill {
  border-style: dashed;
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.4);
}

.space-filter-pill.create-pill:hover {
  background: rgba(16, 185, 129, 0.08);
  border-style: solid;
}

/* Active Space Banner */
.active-space-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.active-space-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.active-space-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.active-space-meta {
  flex: 1;
  min-width: 0;
}

.active-space-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.active-space-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.active-space-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.25;
}

.badge-commons {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-shared {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-private {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.active-space-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-space-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.space-seats-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.space-seats-indicator strong {
  color: var(--ink);
  font-weight: 700;
}

.seat-dots-row {
  display: flex;
  gap: 2.5px;
  align-items: center;
}

.seat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
  transition: all 0.2s;
}

.seat-dot.occupied {
  background: #10b981;
}

.btn-leave-space {
  font-size: 11px;
  font-weight: 600;
  color: #ef4444;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-leave-space:hover {
  color: #b91c1c;
}

/* Shared Cohort Tasks Box */
.shared-cohort-tasks-box {
  background: var(--surface-bg, #f7faf8);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.shared-tasks-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.shared-task-pct {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary);
}

.shared-task-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.shared-task-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.shared-task-add-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.shared-task-add-row input {
  flex: 1;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.shared-tasks-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.shared-task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.shared-task-item.done {
  opacity: 0.65;
}

.shared-task-item.done .shared-task-text {
  text-decoration: line-through;
}

.shared-task-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  color: var(--ink);
}

.shared-task-contributor {
  font-size: 10.5px;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Study Rooms Modal */
.study-rooms-modal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 16px;
}

.room-modal-tab-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.room-modal-tab-btn:hover {
  color: var(--ink);
  background: var(--surface-bg, #f0f4f2);
}

.room-modal-tab-btn.active {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}

.room-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 600px) {
  .room-cards-grid {
    grid-template-columns: 1fr;
  }
}

.room-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface-bg, #ffffff);
  transition: all 0.2s ease;
}

.room-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.room-card.is-current {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.04);
}

.room-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.room-card-icon {
  font-size: 24px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #f8fafc);
  border-radius: 10px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.room-card-meta {
  flex: 1;
  min-width: 0;
}

.room-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.room-card-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
}

.room-card-obj {
  font-size: 11.5px;
  color: var(--primary);
  background: rgba(16, 185, 129, 0.08);
  padding: 5px 8px;
  border-radius: 6px;
  margin-top: 8px;
  font-weight: 500;
}

.room-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.room-occupancy-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Dark Theme Overrides */
body.dark-theme .space-filter-pill {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

body.dark-theme .space-filter-pill:hover {
  border-color: #10b981;
  color: #f1f5f9;
}

body.dark-theme .space-filter-pill.active {
  background: #10b981;
  color: #ffffff;
}

body.dark-theme .active-space-banner,
body.dark-theme .shared-cohort-tasks-box {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .active-space-icon {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .room-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .room-card-icon {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .shared-task-item {
  background: #0f172a;
  border-color: #334155;
}

body.dark-theme .shared-task-add-row input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

/* ==========================================================================
   3 FUNCTIONAL STUDY SPACES: LIBRARY, MEETING ROOMS & PRIVATE PODS
   ========================================================================== */
.library-rooms-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface-bg, #ffffff);
  transition: all 0.2s ease;
}

.library-room-card:hover {
  border-color: var(--primary, #10b981);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.library-room-card.is-current {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.library-room-info {
  flex: 1;
  min-width: 0;
}

.library-room-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.library-room-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.library-preset-pill {
  font-size: 11px;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 1px 7px;
  border-radius: 999px;
}

.library-room-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 6px 0;
}

.library-room-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
}

.library-live-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}

.library-live-status-pill.mode-focus {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.library-live-status-pill.mode-break {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.live-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(0.85);
  }
}

.library-occupancy-text {
  color: var(--muted);
  font-weight: 500;
}

/* Meeting Rooms */
.meeting-guide-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: var(--surface-bg, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .meeting-guide-banner {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.meeting-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.meeting-guide-step .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #10b981);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.meeting-guide-step p {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}

.meeting-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quick-join-meeting-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-join-meeting-wrap input {
  width: 100px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.meeting-rooms-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meeting-room-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-bg, #ffffff);
  transition: all 0.2s ease;
}

.meeting-room-card:hover {
  border-color: var(--primary);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.meeting-code-pill {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Private Solo Pods Promo Card */
.private-pod-promo-card {
  text-align: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-bg, #fbfcf9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.private-pod-promo-card .promo-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
}

.private-pod-promo-card h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.private-pod-promo-card p {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 440px;
  margin: 0;
}

.private-pods-active-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #d97706;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 2px 10px;
  border-radius: 999px;
  margin: 2px 0;
}

.stat-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d97706;
  animation: livePulse 1.6s infinite;
}

.btn-join-private-pod {
  margin-top: 4px;
  padding: 8px 18px;
}

/* Active Room Controls */
.btn-danger-leave {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-danger-leave:hover {
  background: #fecaca;
  color: #b91c1c;
  border-color: #f87171;
}

.meeting-share-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--surface-bg, #f8fafc);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meeting-guest-timer-notice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: var(--surface-bg, #f8fafc);
  font-size: 13.5px;
  font-weight: 700;
  min-height: 42px;
  box-sizing: border-box;
  animation: fadeIn 0.2s ease;
}

.shared-task-editor-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 12px;
  cursor: help;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.shared-task-editor-avatar:hover {
  transform: scale(1.15);
}

/* Dark Theme Additions */
body.dark-theme dialog.study-popup-right,
body.dark-theme dialog.study-popup-left,
body.dark-theme dialog.study-settings-modal,
body.dark-theme dialog.study-method-guide-modal,
body.dark-theme dialog.study-confirm-modal {
  background: #0f172a !important;
  border-color: #334155 !important;
  box-shadow: 0 32px 80px -12px rgba(0, 0, 0, 0.75), 0 16px 32px -6px rgba(0, 0, 0, 0.45) !important;
  color: #f1f5f9;
}

body.dark-theme dialog.study-popup-right .settings-group,
body.dark-theme dialog.study-popup-left .settings-group,
body.dark-theme .study-settings-modal .settings-group,
body.dark-theme .method-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

body.dark-theme .library-room-card,
body.dark-theme .meeting-room-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .meeting-guide-banner,
body.dark-theme .private-pod-promo-card,
body.dark-theme .meeting-share-toolbar {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .quick-join-meeting-wrap input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-theme .meeting-guest-timer-notice {
  background: #1e293b;
  border-color: #334155;
}

body.dark-theme .btn-danger-leave {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #f87171;
}

body.dark-theme .btn-danger-leave:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* --- Fullscreen Zen Mode --- */
body.study-zen-fullscreen .site-header,
body.study-zen-fullscreen footer,
body.study-zen-fullscreen .noise {
  display: none !important;
}

body.study-zen-fullscreen #study {
  padding-top: 16px;
  min-height: 100vh;
}

body.study-zen-fullscreen .study-side-col {
  display: none;
}

body.study-zen-fullscreen .study-main-col {
  max-width: 760px;
  margin: 0 auto;
}

/* --- DOCUMENT VIEWER & DISCUSSION FEATURE --- */
.doc-viewer-dialog {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: 90vw !important;
  max-width: 1200px !important;
  height: 90vh !important;
  max-height: 900px !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.4) !important;
  z-index: 1000 !important;
}

.doc-viewer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.doc-viewer-head {
  padding: 12px 18px;
  border-bottom: 1px solid var(--sage-2, #e2e8f0);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  margin-bottom: 0 !important;
  z-index: 65;
}

.doc-viewer-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.doc-viewer-icon {
  color: var(--primary, #123d30);
  flex-shrink: 0;
}

.doc-viewer-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--ink, #1e293b);
  line-height: 1.35;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-viewer-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-viewer-head-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 6px 10px;
}

.doc-viewer-save-btn.is-saved {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #d97706 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

body.dark-theme .doc-viewer-save-btn.is-saved {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.5) !important;
}

@media (max-width: 640px) {
  .doc-viewer-head-actions .button span {
    display: none !important;
  }

  .doc-viewer-head-actions .button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  .doc-viewer-head-actions .button .ui-btn-icon,
  .doc-viewer-head-actions .button svg {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    flex-shrink: 0 !important;
  }
}

.doc-viewer-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #f8f9fa;
}

.icon-chat-svg {
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
  stroke: currentColor;
}

/* Floating Discussion Button */
.doc-discussion-toggle-btn {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 70;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary, #123d30);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.doc-discussion-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  filter: brightness(1.1);
}

.doc-discussion-toggle-btn:active {
  transform: scale(0.95);
}

.doc-discussion-toggle-btn.is-open {
  background: #1e293b;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.doc-discussion-toggle-btn.is-open:hover {
  transform: rotate(90deg) scale(1.08);
  background: #0f172a;
}

.doc-btn-icon-chat,
.doc-btn-icon-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  pointer-events: none;
}

.doc-btn-icon-close {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.doc-btn-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary, #123d30);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* Discussion Panel (Desktop: Right half 50%, sliding in from right) */
.doc-discussion-panel {
  position: absolute;
  top: 49px;
  bottom: 0;
  right: 0;
  width: 50%;
  max-width: 50%;
  height: calc(100% - 49px);
  background: #ffffff;
  border-left: 1px solid var(--border, #e2e8f0);
  border-top: none;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.14);
  z-index: 60;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRightDocPanel 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRightDocPanel {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.doc-discussion-header {
  padding: 12px 18px 10px 18px;
  border-bottom: 1px solid var(--sage-2, #f1f5f9);
  background: var(--paper, #fdfbf7);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.doc-discussion-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-discussion-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #1e293b);
}

.doc-discussion-count-pill {
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-soft, rgba(18, 61, 48, 0.1));
  color: var(--primary, #123d30);
  padding: 1px 7px;
  border-radius: 999px;
}

.doc-discussion-hint {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin: 0;
}

.doc-discussion-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}

.doc-comment-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted, #64748b);
  margin: auto 0;
}

.doc-comment-empty-icon {
  font-size: 32px;
  margin-bottom: 6px;
  opacity: 0.6;
}

.doc-comment-empty p {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--ink, #1e293b);
}

.doc-comment-empty span {
  font-size: 12px;
  color: var(--muted, #64748b);
}

.doc-comment-card {
  background: var(--paper, #fbfaf5);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.15s ease;
}

.doc-comment-card:hover {
  background: var(--cream, #f5f2e9);
}

.doc-comment-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doc-comment-author-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.2;
  flex-wrap: wrap;
}

.doc-comment-time {
  font-size: 10px;
  color: var(--muted, #64748b);
  white-space: nowrap;
}

.doc-comment-role-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary, #123d30);
}

.doc-comment-anon-badge {
  font-size: 11px;
  color: var(--muted, #64748b);
}

.doc-comment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.doc-comment-actions .edit-timer-btn {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
}

.doc-comment-actions .edit-timer-btn svg.edit-countdown-svg,
.doc-comment-actions .edit-timer-btn svg.timer-circle {
  max-width: 20px !important;
  max-height: 20px !important;
}

.doc-comment-del-btn {
  background: transparent;
  border: none;
  color: var(--muted, #94a3b8);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.doc-comment-del-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.doc-comment-content {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink, #1e293b);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-discussion-footer {
  padding: 10px 80px 12px 18px;
  border-top: 1px solid var(--sage-2, #f1f5f9);
  background: var(--paper, #fdfbf7);
  flex-shrink: 0;
  position: relative;
}

/* Discussion Reply Bar: Avatar dropdown + Pill input + Airplane send button */
.doc-reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.doc-reply-avatar-dropdown {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  user-select: none;
}

.doc-reply-avatar-dropdown .dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #ffffff;
  border: 1px solid var(--line, #d5ded4);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  width: 170px;
  z-index: 120;
  display: none;
  overflow: hidden;
}

.doc-reply-avatar-dropdown .dropdown-menu.show {
  display: block;
  animation: fadeInDocMenu 0.15s ease;
}

@keyframes fadeInDocMenu {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-reply-avatar-dropdown .dropdown-menu div {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink, #1e293b);
  cursor: pointer;
  transition: background 0.15s ease;
}

.doc-reply-avatar-dropdown .dropdown-menu div:hover {
  background: var(--sage, #e0e5e2);
}

.doc-reply-pill {
  flex: 1;
  position: relative;
  background: #e9ece8;
  border-radius: 20px;
  display: flex;
  align-items: center;
  padding: 2px 4px 2px 14px;
  min-height: 40px;
  box-sizing: border-box;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.doc-reply-pill:focus-within {
  background: #ffffff;
  box-shadow: 0 0 0 2px var(--primary, #123d30);
}

.doc-reply-textarea {
  flex: 1;
  min-width: 0;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 6px 8px 0 !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
  color: var(--ink, #1e293b) !important;
  resize: none !important;
  outline: none !important;
  font-family: inherit !important;
  max-height: 72px;
  overflow-y: auto;
}

.doc-reply-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 2px;
}

.doc-btn-send {
  background: var(--primary, #123d30);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.15s ease;
  flex-shrink: 0;
}

.doc-btn-send:hover {
  transform: scale(1.06);
  opacity: 0.95;
}

.doc-btn-send:active {
  transform: scale(0.95);
}

.doc-btn-send svg {
  margin-left: 2px;
  margin-top: 1px;
}

/* Theme Shift Overrides for Document Discussion */
[data-user-theme="ruby"] .doc-discussion-toggle-btn {
  background: linear-gradient(135deg, #a61e32 0%, #c92a2a 100%) !important;
  box-shadow: 0 6px 22px rgba(201, 42, 42, 0.4) !important;
}

[data-user-theme="ruby"] .doc-discussion-toggle-btn.is-open {
  background: #3b0a11 !important;
}

[data-user-theme="ruby"] .doc-discussion-count-pill {
  background: #ffe3e3 !important;
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .doc-btn-send {
  background: linear-gradient(135deg, #a61e32 0%, #c92a2a 100%) !important;
}

[data-user-theme="mythic"] .doc-discussion-toggle-btn {
  background: linear-gradient(135deg, #5f3dc4 0%, #9c1c68 50%, #d6336c 100%) !important;
  background-size: 200% auto !important;
  box-shadow: 0 6px 24px rgba(112, 72, 232, 0.5) !important;
  animation: mythicButtonGlow 4s ease infinite alternate !important;
}

[data-user-theme="mythic"] .doc-discussion-toggle-btn.is-open {
  background: #19052b !important;
  animation: none !important;
}

[data-user-theme="mythic"] .doc-discussion-count-pill {
  background: #f3d9fa !important;
  color: #5f3dc4 !important;
}

/* Rose Quartz Document Discussion Overrides */
[data-user-theme="rosequartz"] .doc-discussion-toggle-btn {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 50%, #c45b83 100%) !important;
  box-shadow: 0 6px 22px rgba(138, 49, 87, 0.35) !important;
}

[data-user-theme="rosequartz"] .doc-discussion-toggle-btn.is-open {
  background: #3b1323 !important;
}

[data-user-theme="rosequartz"] .doc-discussion-count-pill {
  background: #fcedf2 !important;
  color: #8a3157 !important;
}

/* Super Neon Document Discussion Overrides */
[data-user-theme="super"] .doc-discussion-toggle-btn {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #0b0d28 !important;
  box-shadow: 0 6px 22px rgba(0, 210, 255, 0.45) !important;
}

[data-user-theme="super"] .doc-discussion-toggle-btn.is-open {
  background: #0b0d28 !important;
  color: #00d2ff !important;
}

[data-user-theme="super"] .doc-discussion-count-pill {
  background: #e6fcf5 !important;
  color: #00897b !important;
}

/* Diamond Celestial Document Discussion Overrides */
[data-user-theme="diamond"] .doc-discussion-toggle-btn {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.35) !important;
}

[data-user-theme="diamond"] .doc-discussion-toggle-btn.is-open {
  background: #020617 !important;
}

[data-user-theme="diamond"] .doc-discussion-count-pill {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-user-theme="mythic"] .doc-btn-send {
  background: linear-gradient(135deg, #5f3dc4 0%, #9c1c68 50%, #d6336c 100%) !important;
}

/* Mobile Responsive Overrides */
@media (max-width: 900px) {
  .doc-viewer-dialog {
    width: calc(100vw - 16px) !important;
    height: calc(100vh - 24px) !important;
    max-height: calc(100vh - 24px) !important;
    border-radius: 12px !important;
  }

  .doc-viewer-head {
    padding: 10px 14px;
    gap: 8px;
  }

  .doc-viewer-title {
    font-size: 13.5px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  /* Discussion Panel: Overlays 80% bottom sheet on Mobile */
  .doc-discussion-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 80%;
    max-height: 80%;
    border-top: 1px solid var(--border, #e2e8f0);
    border-left: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.25);
    animation: slideUpDocPanelMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes slideUpDocPanelMobile {
    from {
      transform: translateY(100%);
      opacity: 0;
    }

    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .doc-discussion-toggle-btn {
    bottom: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
  }

  .doc-reply-bar {
    gap: 8px;
  }

  .doc-reply-pill {
    min-height: 38px;
    padding: 2px 4px 2px 12px;
  }

  .doc-reply-textarea {
    font-size: 16px !important;
  }

  .doc-btn-send {
    width: 30px;
    height: 30px;
  }

  .doc-discussion-body {
    padding: 12px 14px;
  }

  .doc-discussion-footer {
    padding: 8px 66px 10px 12px;
  }
}

/* =========================================================================
   WEEKLY COMPETITION MODULE (RE:SEARCH ARENA) STYLES
   ========================================================================= */

/* =========================================================================
   HOME SHOWCASE: ARENA GATEWAY & NOTIFICATION BANNER STACK (430x240px)
   ========================================================================= */

.home-showcase-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 430px);
  gap: 20px;
  height: 240px;
  max-height: 240px;
  margin: 0 0 24px 0;
  width: 100%;
  box-sizing: border-box;
}

.weekly-competition-card {
  position: relative;
  height: 240px;
  max-height: 240px;
  min-height: 240px;
  margin: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #09281e 0%, #124233 50%, #0c271e 100%);
  color: #fff;
  padding: 18px 24px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(9, 40, 30, 0.25), 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.weekly-competition-card .comp-card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  gap: 0;
  text-align: left;
  box-sizing: border-box;
}

.weekly-competition-card .comp-left {
  flex: 0 0 auto !important;
  width: 100%;
  text-align: left;
}

.weekly-competition-card .comp-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  text-align: left;
}

.weekly-competition-card .comp-topic-title {
  margin: 0 0 3px 0;
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  letter-spacing: -0.2px;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.weekly-competition-card .comp-phase-subtitle {
  margin: 0;
  font-size: 13px;
  color: #a7d3c0;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arena-portal-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
  display: inline-flex;
  align-items: center;
}

.weekly-competition-card .comp-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  gap: 16px;
  margin-top: auto;
  text-align: left;
}

.weekly-competition-card .comp-timer-box {
  text-align: left !important;
  border-right: none !important;
  padding-right: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  min-width: fit-content;
}

.weekly-competition-card .comp-timer-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
  font-weight: 500;
  text-align: left;
  white-space: nowrap !important;
}

.weekly-competition-card .comp-countdown {
  font-family: "Unbounded", sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 0.5px;
  line-height: 1;
  text-align: left;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.weekly-competition-card .comp-action-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0 !important;
  white-space: nowrap;
}

.weekly-competition-card .comp-user-status {
  font-size: 11.5px;
  color: #d1fae5;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.weekly-competition-card .comp-cta-button {
  height: 38px;
  padding: 0 18px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.weekly-competition-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(15, 51, 39, 0.3), 0 0 0 1px rgba(234, 179, 8, 0.35);
  border-color: rgba(234, 179, 8, 0.4);
}

/* ========================================================
   NGĂN XẾP BANNER THÔNG BÁO (Chuẩn 430 x 240 px, luân phiên 15s)
   ======================================================== */
.banner-stack-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-width: 0;
  height: 240px;
  max-height: 240px;
  border-radius: 16px;
  overflow: hidden;
  background: #0d1e18;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(10, 38, 28, 0.25), 0 2px 6px rgba(0, 0, 0, 0.08);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  flex-shrink: 0;
  box-sizing: border-box;
}

.banner-stack-card:active {
  cursor: grabbing;
}

.banner-timer-bar {
  display: none !important;
}

.banner-drag-hint {
  display: none !important;
}

.banner-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  z-index: 1;
}

.banner-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.banner-slide {
  width: 100%;
  min-width: 100%;
  height: 100%;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.banner-slide.no-action {
  cursor: default;
}

.banner-image,
.banner-stack-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(5, 20, 15, 0.7) 60%, rgba(5, 20, 15, 0.92) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px 20px;
  z-index: 3;
}

.banner-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  align-self: flex-start;
}

.banner-badge.info {
  background: rgba(14, 165, 233, 0.25);
  border: 1px solid rgba(14, 165, 233, 0.5);
  color: #38bdf8;
}

.banner-badge.event {
  background: rgba(234, 179, 8, 0.25);
  border: 1px solid rgba(234, 179, 8, 0.5);
  color: #fde047;
}

.banner-badge.update {
  background: rgba(168, 85, 247, 0.25);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #c084fc;
}

.banner-title {
  font-family: "Unbounded", sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin: 0 0 4px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.banner-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 8px 0;
}

.banner-footer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.banner-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.banner-dot {
  width: 6px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.25s ease;
}

.banner-dot.active {
  width: 20px;
  background: #eab308;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.6);
}

.banner-counter-badge {
  display: none !important;
}

.banner-floating-controls {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 4px 8px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.comp-card-glow {
  position: absolute;
  top: -50%;
  right: -20%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(234, 179, 8, 0.15) 0%, rgba(36, 98, 71, 0.05) 50%, transparent 70%);
  pointer-events: none;
  filter: blur(40px);
  animation: compGlowPulse 6s ease-in-out infinite alternate;
}

@keyframes compGlowPulse {
  0% {
    transform: scale(0.9) translate(0, 0);
    opacity: 0.6;
  }

  100% {
    transform: scale(1.15) translate(-10px, 10px);
    opacity: 1;
  }
}

.comp-card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.comp-left {
  flex: 0 0 auto !important;
  width: 100%;
  text-align: left;
}

.comp-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.comp-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
  white-space: nowrap;
  box-sizing: border-box;
}

/* 1. ĐANG MỞ CỔNG: Xanh lá */
.comp-status-badge.status-open,
.comp-status-badge.open {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

/* 2. ĐANG TỔNG KẾT: Xanh lam */
.comp-status-badge.status-summary,
.comp-status-badge.reviewing,
.comp-status-badge.summary {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

/* 3. SẮP MỞ CỔNG: Màu cam */
.comp-status-badge.status-upcoming,
.comp-status-badge.upcoming,
.comp-status-badge.countdown {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

/* 4. RIÊNG CHỦ NHẬT: Tím đỏ gradient */
.comp-status-badge.status-sunday,
.comp-status-badge.sunday {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.3) 0%, rgba(244, 63, 94, 0.3) 100%);
  color: #f472b6;
  border: 1px solid rgba(244, 114, 182, 0.5);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDotAnim 1.8s infinite ease-in-out;
}

@keyframes pulseDotAnim {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
}

.comp-week-tag {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.comp-topic-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  letter-spacing: -0.2px;
}

.comp-phase-subtitle {
  margin: 0;
  font-size: 13px;
  color: #a7d3c0;
  line-height: 1.4;
}

.comp-right {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  gap: 16px;
  margin-top: auto;
  text-align: left;
}

.comp-timer-box {
  text-align: left !important;
  border-right: none !important;
  padding-right: 0 !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.comp-timer-label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
  font-weight: 500;
  text-align: left;
}

.comp-countdown {
  font-family: "Unbounded", sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 0.5px;
  line-height: 1;
  text-align: left;
}

.comp-action-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.comp-user-status {
  font-size: 11px;
  color: #d1fae5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comp-star-score {
  color: #fde047;
  font-weight: 700;
}

.comp-cta-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f59e0b;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 18px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
}

.comp-cta-button:hover {
  background: #fbbf24;
  transform: translateX(2px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.comp-cta-arrow {
  transition: transform 0.2s ease;
}

.comp-cta-button:hover .comp-cta-arrow {
  transform: translateX(3px);
}

/* CTA Button status variants */
.comp-cta-button.cta-open {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.comp-cta-button.cta-open:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

.comp-cta-button.cta-summary {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.comp-cta-button.cta-summary:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

.comp-cta-button.cta-countdown {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.comp-cta-button.cta-countdown:hover {
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.45);
}

.comp-cta-button.cta-sunday {
  background: linear-gradient(135deg, #a855f7 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
}

.comp-cta-button.cta-sunday:hover {
  background: linear-gradient(135deg, #c084fc 0%, #f43f5e 100%);
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.45);
}

/* =========================================================================
   COMPETITION THEMED CONTAINERS (Home Card & Arena Gateway Hero)
   Synchronized by status: Open (Green), Summary (Blue), Upcoming (Orange), Sunday (Purple-Red Gradient)
   ========================================================================= */

.weekly-competition-card,
.comp-gateway-hero {
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* 1. ĐANG MỞ CỔNG: Xanh lá (Green Theme) */
.weekly-competition-card.theme-state-open,
.comp-gateway-hero.theme-state-open {
  background: linear-gradient(135deg, #07281d 0%, #104835 52%, #082d20 100%) !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
  box-shadow: 0 12px 32px rgba(7, 40, 29, 0.35) !important;
}

.weekly-competition-card.theme-state-open:hover {
  border-color: rgba(52, 211, 153, 0.5) !important;
  box-shadow: 0 16px 40px rgba(7, 40, 29, 0.45), 0 0 0 1px rgba(52, 211, 153, 0.3) !important;
}

.weekly-competition-card.theme-state-open .comp-card-glow {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.25) 0%, rgba(7, 40, 29, 0.05) 50%, transparent 70%) !important;
}

.weekly-competition-card.theme-state-open p,
.comp-gateway-hero.theme-state-open p {
  color: #a7f3d0 !important;
}

.comp-gateway-hero.theme-state-open .comp-phase-tag {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
  color: #d1fae5 !important;
}

.comp-gateway-hero.theme-state-open .gateway-clock-card {
  border-color: rgba(52, 211, 153, 0.38) !important;
}

/* 2. ĐANG TỔNG KẾT: Xanh lam (Blue Theme) */
.weekly-competition-card.theme-state-summary,
.comp-gateway-hero.theme-state-summary {
  background: linear-gradient(135deg, #091e36 0%, #11385f 52%, #081b2f 100%) !important;
  border-color: rgba(56, 189, 248, 0.32) !important;
  box-shadow: 0 12px 32px rgba(9, 30, 54, 0.38) !important;
}

.weekly-competition-card.theme-state-summary:hover {
  border-color: rgba(56, 189, 248, 0.5) !important;
  box-shadow: 0 16px 40px rgba(9, 30, 54, 0.48), 0 0 0 1px rgba(56, 189, 248, 0.3) !important;
}

.weekly-competition-card.theme-state-summary .comp-card-glow {
  background: radial-gradient(circle, rgba(14, 165, 233, 0.25) 0%, rgba(9, 30, 54, 0.05) 50%, transparent 70%) !important;
}

.weekly-competition-card.theme-state-summary p,
.comp-gateway-hero.theme-state-summary p {
  color: #bae6fd !important;
}

.comp-gateway-hero.theme-state-summary .comp-phase-tag {
  background: rgba(14, 165, 233, 0.2) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #e0f2fe !important;
}

.comp-gateway-hero.theme-state-summary .gateway-clock-card {
  border-color: rgba(56, 189, 248, 0.4) !important;
}

/* 3. SẮP MỞ CỔNG: Màu cam (Orange Theme) */
.weekly-competition-card.theme-state-upcoming,
.comp-gateway-hero.theme-state-upcoming {
  background: linear-gradient(135deg, #331705 0%, #582808 52%, #2d1404 100%) !important;
  border-color: rgba(251, 146, 60, 0.35) !important;
  box-shadow: 0 12px 32px rgba(51, 23, 5, 0.4) !important;
}

.weekly-competition-card.theme-state-upcoming:hover {
  border-color: rgba(251, 146, 60, 0.55) !important;
  box-shadow: 0 16px 40px rgba(51, 23, 5, 0.5), 0 0 0 1px rgba(251, 146, 60, 0.3) !important;
}

.weekly-competition-card.theme-state-upcoming .comp-card-glow {
  background: radial-gradient(circle, rgba(249, 115, 22, 0.25) 0%, rgba(51, 23, 5, 0.05) 50%, transparent 70%) !important;
}

.weekly-competition-card.theme-state-upcoming p,
.comp-gateway-hero.theme-state-upcoming p {
  color: #fed7aa !important;
}

.comp-gateway-hero.theme-state-upcoming .comp-phase-tag {
  background: rgba(249, 115, 22, 0.2) !important;
  border-color: rgba(251, 146, 60, 0.35) !important;
  color: #ffedd5 !important;
}

.comp-gateway-hero.theme-state-upcoming .gateway-clock-card {
  border-color: rgba(251, 146, 60, 0.45) !important;
}

/* 4. RIÊNG CHỦ NHẬT: Tím đỏ gradient (Purple-Red Gradient Theme) */
.weekly-competition-card.theme-state-sunday,
.comp-gateway-hero.theme-state-sunday {
  background: linear-gradient(135deg, #3b0764 0%, #581c87 35%, #831843 70%, #4c0519 100%) !important;
  border-color: rgba(244, 114, 182, 0.4) !important;
  box-shadow: 0 12px 32px rgba(88, 28, 135, 0.45) !important;
}

.weekly-competition-card.theme-state-sunday:hover {
  border-color: rgba(244, 114, 182, 0.6) !important;
  box-shadow: 0 16px 40px rgba(88, 28, 135, 0.55), 0 0 0 1px rgba(244, 114, 182, 0.35) !important;
}

.weekly-competition-card.theme-state-sunday .comp-card-glow {
  background: radial-gradient(circle, rgba(236, 72, 153, 0.28) 0%, rgba(147, 51, 234, 0.15) 50%, transparent 70%) !important;
}

.weekly-competition-card.theme-state-sunday p,
.comp-gateway-hero.theme-state-sunday p {
  color: #fbcfe8 !important;
}

.comp-gateway-hero.theme-state-sunday .comp-phase-tag {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(244, 63, 94, 0.25) 100%) !important;
  border-color: rgba(244, 114, 182, 0.4) !important;
  color: #fdf2f8 !important;
}

.comp-gateway-hero.theme-state-sunday .gateway-clock-card {
  border-color: rgba(244, 114, 182, 0.48) !important;
}

/* 5. TẠM ĐÓNG: Màu xám (Grey / Slate Theme) */
.weekly-competition-card.theme-state-paused,
.comp-gateway-hero.theme-state-paused {
  background: linear-gradient(135deg, #1e293b 0%, #334155 52%, #1e293b 100%) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.4) !important;
}

.weekly-competition-card.theme-state-paused:hover {
  border-color: rgba(148, 163, 184, 0.55) !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.5), 0 0 0 1px rgba(148, 163, 184, 0.3) !important;
}

.weekly-competition-card.theme-state-paused .comp-card-glow {
  background: radial-gradient(circle, rgba(148, 163, 184, 0.2) 0%, rgba(30, 41, 59, 0.05) 50%, transparent 70%) !important;
}

.weekly-competition-card.theme-state-paused p,
.comp-gateway-hero.theme-state-paused p {
  color: #cbd5e1 !important;
}

.comp-gateway-hero.theme-state-paused .comp-phase-tag {
  background: rgba(148, 163, 184, 0.2) !important;
  border-color: rgba(148, 163, 184, 0.35) !important;
  color: #f1f5f9 !important;
}

.comp-gateway-hero.theme-state-paused .gateway-clock-card {
  border-color: rgba(148, 163, 184, 0.4) !important;
}

.comp-status-badge.status-paused,
.comp-status-badge.paused {
  background: rgba(148, 163, 184, 0.2) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(148, 163, 184, 0.4) !important;
}

.comp-cta-button.cta-paused {
  background: rgba(148, 163, 184, 0.22) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.45) !important;
}

.comp-cta-button.cta-paused:hover {
  background: rgba(148, 163, 184, 0.35) !important;
  border-color: rgba(148, 163, 184, 0.65) !important;
}

/* ==========================================================================
   RESEARCH ARENA (ĐẤU TRƯỜNG HỌC THUẬT & THI ĐUA NCKH) - MATCHING DEMO HERO
   ========================================================================== */

#arena.page {
  max-width: 1040px;
  margin: 0 auto;
}

/* 1. ARENA HERO BANNER (MATCHING DEMO EXACTLY) */
.arena-hero-banner {
  position: relative;
  width: 100%;
  min-height: 290px;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 22px;
  background: #0b1a2f;
  box-shadow: 0 16px 40px -12px rgba(11, 26, 47, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.arena-banner-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  z-index: 1;
  pointer-events: none;
}

.arena-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 20, 38, 0.22) 0%, rgba(8, 20, 38, 0.05) 40%, rgba(8, 20, 38, 0.55) 100%),
              linear-gradient(90deg, rgba(8, 20, 38, 0.3) 0%, rgba(8, 20, 38, 0.08) 60%, transparent 100%);
  z-index: 2;
  pointer-events: none;
}

.arena-banner-content {
  position: relative;
  z-index: 3;
  padding: 26px 32px 28px 32px;
  width: 100%;
  min-height: 290px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.arena-banner-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: auto;
  flex-wrap: wrap;
}

.arena-banner-bottom {
  margin-top: auto;
  max-width: 760px;
}

.arena-tag-gold,
.arena-tag-season,
.arena-tag-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  line-height: 1;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 800;
  padding: 0 14px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.arena-tag-gold {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
  gap: 4px;
}

.arena-tag-season {
  background: rgba(16, 185, 129, 0.35);
  border: 1px solid rgba(110, 231, 183, 0.55);
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.arena-tag-type {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #f8fafc;
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}

.arena-hero-title {
  font-size: 32px;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 8px 0;
  line-height: 1.25;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 4px 14px rgba(0, 0, 0, 0.9), 0 0 24px rgba(0, 0, 0, 0.8);
}

.arena-hero-subtitle {
  font-size: 14.5px;
  color: #e2e8f0;
  margin: 0;
  line-height: 1.5;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 2px 8px rgba(0, 0, 0, 0.9);
}

/* 2. ARENA LOCKED CARD (GUEST / NON-ADMIN USERS PREVIEW) */
.arena-locked-card {
  background: var(--surface);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 22px;
  padding: 40px 28px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto 36px auto;
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.07);
  position: relative;
  overflow: hidden;
}

.arena-locked-halo {
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  height: 200px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  filter: blur(30px);
}

.arena-locked-icon-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px auto;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(239, 68, 68, 0.16) 100%);
  border: 2px solid rgba(245, 158, 11, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.18);
  position: relative;
}

.arena-locked-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px dashed rgba(245, 158, 11, 0.4);
  animation: spinSlow 16s linear infinite;
}

.arena-locked-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #d97706;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.arena-locked-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  margin: 0 0 12px 0;
}

.arena-locked-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 28px auto;
}

.arena-locked-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 30px;
  text-align: left;
}

.arena-preview-card {
  background: var(--sage-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.arena-preview-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.4);
}

.arena-preview-card.highlight {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(217, 119, 6, 0.04) 100%);
  border-color: rgba(245, 158, 11, 0.3);
}

.preview-card-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.preview-card-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
}

.preview-card-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  margin: 0;
}

.arena-locked-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.arena-cta-home {
  padding: 9px 22px !important;
  font-weight: 800 !important;
  border-radius: 999px !important;
}

/* 3. ARENA ADMIN COMMAND BAR (CLEAN NEUTRAL CARD MATCHING DEMO) */
.arena-admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 12px 20px;
  border-radius: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.admin-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-badge-icon {
  font-size: 18px;
}

.admin-bar-actions .button {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 999px !important;
  padding: 6px 16px !important;
  font-weight: 700 !important;
  font-size: 12.5px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-bar-actions .button:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* 4. ARENA TABS CONTAINER & SEGMENTED PILLS (FOREST GREEN ACTIVE PILL MATCHING DEMO) */
.arena-tabs-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 8px 30px -10px rgba(0, 0, 0, 0.04);
}

.comp-nav-tabs.arena-nav-tabs {
  display: flex;
  gap: 8px;
  background: #f1f5f3;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.comp-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.comp-tab-btn:hover:not(.active) {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.7);
}

.comp-tab-btn.active {
  background: #194d3e !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 14px rgba(25, 77, 62, 0.3) !important;
}

.comp-tab-btn.active::after {
  display: none !important;
}

/* 6. TAB 1: CỔNG THI ĐẤU (GATEWAY TOURNAMENT CARD) */
.comp-gateway-hero {
  background: linear-gradient(135deg, #0d281f 0%, #174233 55%, #0f3326 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(13, 40, 31, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 28px;
}

.comp-gateway-hero-left {
  flex: 1 1 auto;
  min-width: 0;
}

.comp-gateway-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
}

.comp-phase-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  box-sizing: border-box;
}

.comp-class-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 28px;
  line-height: 28px;
  padding: 0 12px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  letter-spacing: 0.2px;
  box-sizing: border-box;
}

.comp-gateway-hero.theme-state-open .comp-class-badge {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.3);
  color: #d1fae5;
}

.comp-gateway-hero.theme-state-sunday .comp-class-badge {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(244, 114, 182, 0.3);
  color: #fce7f3;
}

.comp-gateway-hero.theme-state-summary .comp-class-badge {
  background: rgba(14, 165, 233, 0.16);
  border-color: rgba(56, 189, 248, 0.3);
  color: #e0f2fe;
}

.comp-gateway-hero.theme-state-upcoming .comp-class-badge {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(251, 146, 60, 0.3);
  color: #ffedd5;
}

.comp-gateway-hero h3 {
  margin: 0 0 6px 0;
  font-size: 21px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.2px;
  position: relative;
  z-index: 2;
}

.comp-gateway-hero p {
  margin: 0;
  font-size: 13.5px;
  color: #a7d3c0;
  position: relative;
  z-index: 2;
}

.gateway-clock-card {
  flex: 0 0 auto;
  margin-left: auto;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 14px;
  padding: 12px 20px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.gateway-clock-card .gateway-clock-icon {
  order: 1;
  font-size: 32px;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  animation: hourglassFlip 5.2s infinite cubic-bezier(0.35, 0, 0.25, 1);
  will-change: transform;
  filter: drop-shadow(0 2px 10px rgba(250, 204, 21, 0.5));
}

.gateway-hourglass-svg {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes hourglassFlip {
  0% {
    transform: rotate(0deg);
  }

  7.5% {
    transform: rotate(185deg);
  }

  11% {
    transform: rotate(180deg);
  }

  50% {
    transform: rotate(180deg);
  }

  57.5% {
    transform: rotate(365deg);
  }

  61% {
    transform: rotate(360deg);
  }

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

.gateway-clock-card .gateway-clock-body {
  order: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gateway-clock-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.75);
}

.gateway-clock-digits {
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  font-weight: 900;
  color: #fde047;
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(250, 204, 21, 0.45);
}

/* User Attempts Card */
.comp-user-attempts-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.03);
}

.attempts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.attempts-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.attempts-title-icon {
  font-size: 16px;
}

.attempts-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.attempts-phase-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  background: var(--sage-2);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.attempts-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.attempt-stat-box {
  background: var(--sage-2);
  border-radius: 12px;
  padding: 14px 10px;
  border: 1px solid var(--line);
  text-align: center;
  transition: all 0.2s ease;
}

.attempt-stat-box:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.attempt-stat-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
}

.attempt-stat-val {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
}

.attempt-stat-val.star-val {
  color: #d97706;
}

.attempt-stat-val.bonus-val {
  color: #059669;
}

.attempt-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.attempts-note-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-left: 4px solid #10b981;
  border-radius: 10px;
  padding: 12px 14px;
}

.note-banner-icon {
  font-size: 16px;
  line-height: 1.4;
  flex-shrink: 0;
}

.note-banner-text {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.gateway-action-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  text-align: center;
  padding: 8px 0 4px 0;
  box-sizing: border-box;
}

.gateway-action-container.hidden,
.gateway-action-container[style*="display: none"],
#compTabGateway.is-sunday .gateway-action-container,
#compTabGateway.is-sunday #gatewayStartQuizBtn,
#compTabGateway.is-sunday #attemptStatBoxCount {
  display: none !important;
}

.theme-state-sunday #compAttemptsTeaser,
.theme-state-sunday .comp-user-status #compAttemptsTeaser {
  display: none !important;
}


.gateway-play-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 15.5px !important;
  font-weight: 800 !important;
  padding: 13px 36px !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.38) !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer;
  max-width: 100%;
}

.gateway-play-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01) !important;
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.45) !important;
}

.gateway-play-btn:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.gateway-blocked-msg {
  margin-top: 0 !important;
  font-size: 13px;
  color: #dc2626;
  font-weight: 700;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 8px 18px;
  border-radius: 999px;
  display: inline-block;
  max-width: 760px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

/* 7. TAB 2: BẢNG XẾP HẠNG & 3D PODIUM (MATCHING DEMO BOX 6) */
.lb-header-controls {
  margin-bottom: 20px;
}

.lb-phase-selectors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.lb-phase-btn {
  background: var(--sage-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lb-phase-btn:hover {
  background: var(--sage);
}

.lb-phase-btn.active {
  background: #123d30;
  color: #ffffff;
  border-color: #123d30;
  box-shadow: 0 3px 10px rgba(18, 61, 48, 0.2);
}

.lb-phase-btn.week-lb-btn {
  border-color: #eab308;
}

.lb-phase-btn.week-lb-btn.active {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: #b45309;
}

.lb-refresh-btn {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  margin-left: auto;
}

.lb-refresh-btn:hover {
  background: var(--sage);
  color: var(--ink);
  border-color: var(--primary);
}

.lb-class-selector-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 4px 0 10px 0;
  width: 100%;
}

.lb-class-selector-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sage-2, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  padding: 3px 5px;
  border-radius: 999px;
}

.lb-class-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted, #64748b);
  padding: 0 6px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.lb-class-btn {
  background: transparent;
  border: none;
  color: var(--ink, #334155);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lb-class-btn:hover {
  color: var(--primary, #0f172a);
  background: rgba(0, 0, 0, 0.04);
}

.lb-class-btn.active {
  background: #123d30;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(18, 61, 48, 0.25);
}

.lb-summary-notice {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 12px;
  background: var(--sage-2);
  border-radius: 8px;
  display: inline-block;
}

/* 3D Podium Container (Matching Demo Box 6) */
.comp-podium-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 10px 22px 10px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 140px;
  position: relative;
}

.podium-avatar-wrap {
  position: relative;
  margin-bottom: 10px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  overflow: visible;
  z-index: 2;
}

.podium-avatar {
  position: relative;
  z-index: 1;
  width: 52px !important;
  height: 52px !important;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  font-size: 27px;
  background: var(--sage-2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border: 2.5px solid #ffffff;
  flex-shrink: 0;
  overflow: visible !important;
}

.podium-col.rank-1 .podium-avatar {
  width: 66px !important;
  height: 66px !important;
  font-size: 35px;
  border-color: #facc15;
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.5);
  overflow: visible !important;
}

.podium-crown {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  animation: medalBob 2.6s ease-in-out infinite alternate;
  z-index: 50 !important;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-crown.gold {
  top: -28px;
}

.podium-crown.silver {
  top: -24px;
}

.podium-crown.bronze {
  top: -24px;
}

.arena-medal-svg {
  display: block;
  overflow: visible;
  transition: transform 0.25s ease;
}

@keyframes medalBob {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
  }

  100% {
    transform: translateX(-50%) translateY(-5px) scale(1.03);
  }
}

.podium-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  text-align: center;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 0 4px;
}

.podium-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  word-break: keep-all;
}

.podium-score {
  font-size: 12px;
  font-weight: 800;
  color: #b45309;
  background: #fef3c7;
  padding: 2.5px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.1);
}

.podium-score.gold-score {
  background: #fde68a;
  color: #92400e;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.podium-stand {
  width: 100%;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 6px 16px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.podium-stand::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
}

.stand-num {
  font-size: 26px;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 2;
}

.podium-stand-cover {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.28;
  mix-blend-mode: overlay;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 1;
}

.podium-col:hover .podium-stand-cover {
  transform: scale(1.08);
  opacity: 0.45;
}

.podium-stand.stand-1 {
  height: 110px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 60%, #b45309 100%);
}

.podium-stand.stand-2 {
  height: 80px;
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 60%, #475569 100%);
}

.podium-stand.stand-3 {
  height: 60px;
  background: linear-gradient(180deg, #d97706 0%, #b45309 60%, #78350f 100%);
}

/* ==========================================================================
   ARENA TOP 3 CONCEPTS & SWITCHER
   ========================================================================== */

/* Switcher Bar */
.arena-concept-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 9999px;
  background: var(--sage-2);
  border: 1px solid var(--line);
  margin-bottom: 4px;
}

.arena-concept-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.arena-concept-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}

.concept-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.concept-chip:hover {
  color: var(--ink);
  border-color: rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.concept-chip.active {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #92400e;
  border-color: #f59e0b;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.2);
}

/* --------------------------------------------------------------------------
   CONCEPT 1: PRESTIGE CHAMPION CARDS (THẺ QUÁN QUÂN)
   -------------------------------------------------------------------------- */
.arena-concept1-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  width: 100%;
  padding-top: 52px;
}

.arena-champion-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  position: relative;
}

.arena-champion-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.arena-champion-card.rank-2,
.arena-champion-card.rank-3 {
  width: 205px;
  flex: 0 1 205px;
}

.arena-champion-card.rank-1 {
  width: 235px;
  flex: 0 1 235px;
  border: 2px solid #f59e0b;
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.2);
  z-index: 2;
}

.arena-champion-card.rank-1:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 34px rgba(245, 158, 11, 0.28);
}

.arena-champion-card.empty {
  visibility: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   MINI NAMECARD (THẺ TÊN MINI TOP 3 ARENA)
   Tỉ lệ chuẩn 680x760 (17:19) khớp hoàn hảo 100% với NamecardStage,
   cho phép scale khung viền nghệ thuật và khung cơ bản đồng bộ tuyệt đối!
   -------------------------------------------------------------------------- */
.arena-champion-card.mini-namecard {
  position: relative;
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: visible !important;
  box-sizing: border-box;
  aspect-ratio: 680 / 760;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  border: none;
  box-shadow: none;
}

.arena-champion-card.mini-namecard:hover {
  transform: translateY(-4px);
}

.arena-champion-card.mini-namecard.rank-1 {
  --mini-scale: 0.3382;
  /* 230 / 680 */
  width: calc(680px * var(--mini-scale));
  height: calc(760px * var(--mini-scale));
  z-index: 2;
}

.arena-champion-card.mini-namecard.rank-2,
.arena-champion-card.mini-namecard.rank-3 {
  --mini-scale: 0.2941;
  /* 200 / 680 */
  width: calc(680px * var(--mini-scale));
  height: calc(760px * var(--mini-scale));
  z-index: 1;
}

/* 1. Thân thẻ Canvas (Mini Card Canvas): Bo góc 60px * scale theo chuẩn khung Chinh Phục Bầu Trời, clip ảnh bìa & nội dung đồng bộ NamecardStage */
.mini-card-canvas {
  position: absolute;
  inset: 0;
  border-radius: calc(60px * var(--mini-scale));
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  z-index: 5;
}

/* Khung viền vinh danh mặc định cho Top 3 khi không trang bị khung riêng (áp dụng trực tiếp lên Canvas) */
.arena-champion-card.mini-namecard.rank-1[data-frame="none"] .mini-card-canvas,
.arena-champion-card.mini-namecard.rank-1[data-frame="default"] .mini-card-canvas {
  border: calc(10px * var(--mini-scale)) solid #f59e0b;
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.22);
}

.arena-champion-card.mini-namecard.rank-2[data-frame="none"] .mini-card-canvas,
.arena-champion-card.mini-namecard.rank-2[data-frame="default"] .mini-card-canvas {
  border: calc(10px * var(--mini-scale)) solid #94a3b8;
  box-shadow: 0 6px 20px rgba(148, 163, 184, 0.18);
}

.arena-champion-card.mini-namecard.rank-3[data-frame="none"] .mini-card-canvas,
.arena-champion-card.mini-namecard.rank-3[data-frame="default"] .mini-card-canvas {
  border: calc(10px * var(--mini-scale)) solid #ea580c;
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.18);
}

.arena-champion-card.mini-namecard:not([data-frame="none"]):not([data-frame="default"]) .mini-card-canvas {
  border: none;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
}

/* Khung thẻ tên mini (Mini Namecard Frame Layer) - Scale đồng bộ với khung namecard gốc */
.mini-card-frame-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.2));
  opacity: 0;
  transition: opacity 180ms ease;
}

.mini-card-frame-layer[data-frame] {
  opacity: 1;
}

.mini-card-frame-layer[data-frame="default"],
.mini-card-frame-layer[data-frame="none"],
.mini-card-frame-layer[data-frame=""] {
  opacity: 0;
  display: none;
}

/* 5 Khung nghệ thuật cao cấp - Scale chuẩn xác theo insets gốc và tỉ lệ 680x760 */
.mini-card-frame-layer[data-frame="leaves"] {
  background-image: url("frames/v2/leaves.png?v=5");
  inset: calc(-42px * var(--mini-scale)) calc(-38px * var(--mini-scale)) calc(-61px * var(--mini-scale)) calc(-38px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="sakura"] {
  background-image: url("frames/v2/sakura.png?v=5");
  inset: calc(-46px * var(--mini-scale)) calc(-42px * var(--mini-scale)) calc(-64px * var(--mini-scale)) calc(-42px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="ice"] {
  background-image: url("frames/v2/ice.png?v=5");
  inset: calc(-54px * var(--mini-scale)) calc(-52px * var(--mini-scale)) calc(-58px * var(--mini-scale)) calc(-66px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="stars"] {
  background-image: url("frames/v2/stars.png?v=5");
  inset: calc(-54px * var(--mini-scale)) calc(-50px * var(--mini-scale)) calc(-58px * var(--mini-scale)) calc(-66px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="gold"] {
  background-image: url("frames/v2/gold.png?v=8");
  inset: calc(-34px * var(--mini-scale)) calc(-44px * var(--mini-scale)) calc(-34px * var(--mini-scale)) calc(-44px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="thung_lung_suong_thu"] {
  background-image: url("frames/v2/thung_lung_suong_thu.png?v=3");
  inset: calc(-36px * var(--mini-scale)) calc(-44px * var(--mini-scale)) calc(-36px * var(--mini-scale)) calc(-44px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="thien_ha_huyen_ao"] {
  background-image: url("frames/v2/thien_ha_huyen_ao.png?v=3");
  inset: calc(-32px * var(--mini-scale)) calc(-44px * var(--mini-scale)) calc(-32px * var(--mini-scale)) calc(-44px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="pha_le_hoang_gia"] {
  background-image: url("frames/v2/pha_le_hoang_gia.png?v=3");
  inset: calc(-34px * var(--mini-scale)) calc(-46px * var(--mini-scale)) calc(-34px * var(--mini-scale)) calc(-46px * var(--mini-scale));
  background-size: 100% 100%;
}

/* Khung hoạt động giới hạn */
.mini-card-frame-layer[data-frame="chinh_phuc_bau_troi"] {
  background-image: url("frames/v2/chinh_phuc_bau_troi.png?v=1");
  inset: calc(-50px * var(--mini-scale)) calc(-71px * var(--mini-scale)) calc(-61px * var(--mini-scale)) calc(-64px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="ton_vinh_phai_dep"] {
  background-image: url("frames/v2/ton_vinh_phai_dep.png?v=2");
  inset: calc(-46px * var(--mini-scale)) calc(-29px * var(--mini-scale)) calc(-45px * var(--mini-scale)) calc(-41px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="bua_tiec_ma_mi"] {
  background-image: url("frames/v2/bua_tiec_ma_mi.png?v=2");
  inset: calc(-52px * var(--mini-scale)) calc(-40px * var(--mini-scale)) calc(-53px * var(--mini-scale)) calc(-42px * var(--mini-scale));
  background-size: 100% 100%;
}

.mini-card-frame-layer[data-frame="phep_mau_mua_dong"] {
  background-image: url("frames/v2/phep_mau_mua_dong.png?v=5");
  inset: calc(-34px * var(--mini-scale)) calc(-38px * var(--mini-scale)) calc(-34px * var(--mini-scale)) calc(-40px * var(--mini-scale));
  background-size: 100% 100%;
}

/* Khung cơ bản miễn phí - Scale độ dày viền theo chuẩn công thức 12px * scale, bo góc 60px * scale */
.mini-card-frame-layer[data-frame^="basic_"] {
  inset: 0px;
  border-radius: calc(60px * var(--mini-scale));
  border-width: calc(12px * var(--mini-scale));
  border-style: solid;
  background: none;
  pointer-events: none;
  z-index: 25;
}

.mini-card-frame-layer[data-frame="basic_ocean"] {
  border-color: transparent;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #93c5fd 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.mini-card-frame-layer[data-frame="basic_emerald"] {
  border-color: transparent;
  background: linear-gradient(135deg, #064e3b 0%, #059669 50%, #6ee7b7 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

.mini-card-frame-layer[data-frame="basic_sunset"] {
  border-color: transparent;
  background: linear-gradient(135deg, #4c0519 0%, #db2777 50%, #fcd34d 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 10px rgba(219, 39, 119, 0.35);
}

.mini-card-frame-layer[data-frame="basic_aurora"] {
  border-color: transparent;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #4338ca 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

.mini-card-frame-layer[data-frame="basic_royal"] {
  border-color: transparent;
  background: linear-gradient(135deg, #3b0764 0%, #7c3aed 50%, #c084fc 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
}

.mini-card-frame-layer[data-frame="basic_midnight"] {
  border-color: #0f172a;
  background: none;
  box-shadow: 0 0 10px rgba(15, 23, 42, 0.3);
}

.mini-card-frame-layer[data-frame="basic_slate"] {
  border-color: #475569;
  background: none;
  box-shadow: 0 0 10px rgba(71, 85, 105, 0.3);
}

.mini-card-frame-layer[data-frame="basic_deep_green"] {
  border-color: #064e3b;
  background: none;
  box-shadow: 0 0 10px rgba(6, 78, 59, 0.3);
}

.mini-card-frame-layer[data-frame="basic_pure_black"] {
  border-color: #18181b;
  background: none;
  box-shadow: 0 0 10px rgba(24, 24, 27, 0.35);
}

/* Banner ảnh bìa mini (Mini Cover Art Banner) */
.champ-cover-banner {
  width: 100%;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  height: 34%;
  flex-shrink: 0;
}

.champ-cover-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
      rgba(0, 0, 0, 0.12) 0%,
      rgba(0, 0, 0, 0.02) 40%,
      rgba(0, 0, 0, 0.6) 100%);
  pointer-events: none;
}

/* Huy chương Top 3 vinh danh nằm ngoài hẳn phía trên khung, căn giữa, không dính avatar */
.champ-top-medal-anchor {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

/* Khi có khung nghệ thuật vươn ra ngoài, nâng huy chương lên cao hơn để nằm ngoài hẳn hoa văn của khung */
.arena-champion-card.mini-namecard[data-frame="gold"] .champ-top-medal-anchor {
  margin-bottom: calc(68px * var(--mini-scale));
}

.arena-champion-card.mini-namecard[data-frame="phep_mau_mua_dong"] .champ-top-medal-anchor {
  margin-bottom: calc(84px * var(--mini-scale));
}

.arena-champion-card.mini-namecard[data-frame="stars"] .champ-top-medal-anchor,
.arena-champion-card.mini-namecard[data-frame="ice"] .champ-top-medal-anchor {
  margin-bottom: calc(62px * var(--mini-scale));
}

.arena-champion-card.mini-namecard[data-frame="leaves"] .champ-top-medal-anchor,
.arena-champion-card.mini-namecard[data-frame="sakura"] .champ-top-medal-anchor,
.arena-champion-card.mini-namecard[data-frame="ton_vinh_phai_dep"] .champ-top-medal-anchor,
.arena-champion-card.mini-namecard[data-frame="bua_tiec_ma_mi"] .champ-top-medal-anchor {
  margin-bottom: calc(54px * var(--mini-scale));
}

.champ-crown.rank-medal {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 35;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.22));
  animation: medalBobAbove 2.6s ease-in-out infinite alternate;
}

.champ-crown.rank-medal.rank-1 {
  filter: drop-shadow(0 6px 14px rgba(245, 158, 11, 0.35));
}

@keyframes medalBobAbove {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-4px);
  }
}

/* Thân thẻ tên mini */
.champ-body.mini-namecard-body {
  padding: 0 6px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 5;
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
}

/* Avatar Wrapper (đặt giữa ranh giới banner & body, hoàn toàn độc lập không dính huy chương) */
.champ-avatar-wrap {
  margin-top: -24px;
  position: relative;
  margin-bottom: 0;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  z-index: 4;
}

.arena-champion-card.mini-namecard.rank-1 .champ-avatar-wrap {
  margin-top: -27px;
}

/* Avatar giữ nguyên màu nền và khung chuỗi tự nhiên, không ép khung vàng/bạc/đồng hay nền trắng */
.champ-avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
  position: relative;
}

.champ-avatar.rank-1-avatar {
  width: 54px;
  height: 54px;
  font-size: 24px;
  --ring-inset: -4px;
  --ring-width: 2.5px;
}

.champ-avatar.rank-2-avatar {
  width: 48px;
  height: 48px;
  font-size: 21px;
  --ring-inset: -3.5px;
  --ring-width: 2px;
}

.champ-avatar.rank-3-avatar {
  width: 46px;
  height: 46px;
  font-size: 20px;
  --ring-inset: -3.5px;
  --ring-width: 2px;
}

.arena-champion-card:hover .champ-avatar {
  transform: scale(1.05);
}

/* Cụm thông tin: Tên, Tag thứ hạng, Điểm số (khoảng hở vừa phải, không dính sát và cách khung dưới đẹp mắt) */
.champ-info-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  gap: 7px;
  padding-top: 4px;
  padding-bottom: calc(32px * var(--mini-scale));
  min-width: 0;
  box-sizing: border-box;
}

.arena-champion-card.mini-namecard.rank-1 .champ-info-group {
  gap: 8px;
}

/* Tên & Icon lửa chuỗi */
.champ-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.champ-name.font-bold {
  font-size: 14.5px;
  font-weight: 800;
}

.champ-name svg {
  flex-shrink: 0;
}

.champ-name .lb-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  display: inline-block;
}

/* Tag Quán quân, Á quân, Quý quân nằm giữa tên và điểm số */
.champ-rank-tag-wrap {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.champ-rank-pill {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 2px 10px;
  border-radius: 9999px;
  display: inline-block;
  line-height: 1.4;
}

.champ-rank-pill.pill-rank-1 {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.16);
}

.champ-rank-pill.pill-rank-2 {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.champ-rank-pill.pill-rank-3 {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #ffedd5;
}

/* Số điểm: Đồng bộ huy hiệu và icon ngôi sao tương phản cao */
.champ-score {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  line-height: 1.3;
  margin: 0;
  box-sizing: border-box;
}

.champ-score .champ-score-star {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-right: 1px;
}

/* TOP 1: Khung điểm Quán quân vàng kim rực rỡ với Ngôi sao Trắng Tinh Khiết nổi bật 100%, không bị chìm */
.champ-score.gold-score {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}

.champ-score.gold-score .champ-score-star {
  color: #ffffff !important;
  fill: #ffffff !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}

/* TOP 2: Hạng Bạc */
.champ-score.silver-score {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(100, 116, 139, 0.12);
}

.champ-score.silver-score .champ-score-star {
  color: #64748b !important;
  fill: #64748b !important;
  stroke: #64748b !important;
}

/* TOP 3: Hạng Đồng */
.champ-score.bronze-score {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.12);
}

.champ-score.bronze-score .champ-score-star {
  color: #ea580c !important;
  fill: #ea580c !important;
  stroke: #ea580c !important;
}

/* --------------------------------------------------------------------------
   CONCEPT 2: FLOATING GLASS STAGE (BỤC KÍNH BAY)
   -------------------------------------------------------------------------- */
.arena-concept2-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding-top: 10px;
}

.arena-glass-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.arena-glass-col.rank-2,
.arena-glass-col.rank-3 {
  width: 180px;
  flex: 0 1 180px;
}

.arena-glass-col.rank-1 {
  width: 205px;
  flex: 0 1 205px;
  z-index: 2;
}

.arena-glass-col.empty {
  visibility: hidden;
  pointer-events: none;
}

.arena-glass-card {
  width: 100%;
  border-radius: 16px;
  padding: 12px 10px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  margin-bottom: 8px;
  transition: transform 0.2s ease;
}

.arena-glass-col:hover .arena-glass-card {
  transform: translateY(-3px);
}

.arena-glass-card.rank-1-glass {
  border: 2px solid #f59e0b;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.22);
}

.glass-backdrop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2.5px);
  pointer-events: none;
}

.glass-card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #ffffff;
}

.glass-crown {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glass-avatar {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, 0.85) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-bottom: 5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.arena-glass-col.rank-1 .glass-avatar {
  width: 56px !important;
  height: 56px !important;
  border: 2.5px solid #facc15 !important;
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.45);
}

.glass-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.glass-user-name.font-bold {
  font-size: 13.5px;
  font-weight: 800;
  color: #fef08a;
}

.glass-score-badge {
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 8px;
  border-radius: 9999px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.glass-score-badge.gold-score {
  background: rgba(245, 158, 11, 0.35);
  border-color: #f59e0b;
  color: #ffffff;
}

.arena-metallic-pedestal {
  width: 100%;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.12);
}

.arena-metallic-pedestal::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.5);
}

.pedestal-1 {
  height: 68px;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 60%, #b45309 100%);
}

.pedestal-2 {
  height: 48px;
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 60%, #475569 100%);
}

.pedestal-3 {
  height: 34px;
  background: linear-gradient(180deg, #d97706 0%, #b45309 60%, #78350f 100%);
}

/* --------------------------------------------------------------------------
   CONCEPT 3: ROYAL GRAND CAPSULES (CAPSULE HOÀNG GIA)
   -------------------------------------------------------------------------- */
.arena-concept3-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.royal-grand-capsule {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 8px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: all 0.2s ease;
  height: 52px;
}

.royal-grand-capsule:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.royal-grand-capsule.rank-1 {
  height: 60px;
  border: 2px solid #f59e0b;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.22);
}

.royal-cover-art {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 72%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.royal-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg,
      #ffffff 0%,
      #ffffff 28%,
      rgba(255, 255, 255, 0.94) 44%,
      rgba(255, 255, 255, 0.58) 64%,
      rgba(255, 255, 255, 0.15) 82%,
      rgba(255, 255, 255, 0) 98%);
  pointer-events: none;
}

.royal-left-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}

.royal-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.royal-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  border: 2px solid #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.royal-grand-capsule.rank-1 .royal-avatar {
  width: 44px !important;
  height: 44px !important;
  border: 2px solid #facc15 !important;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.4);
}

.royal-medal-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.royal-info {
  display: flex;
  flex-direction: column;
}

.royal-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.royal-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.royal-name.font-bold {
  font-size: 14.5px;
  font-weight: 800;
}

.royal-rank-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 1.5px 7px;
  border-radius: 9999px;
  letter-spacing: 0.3px;
}

.royal-rank-pill.gold {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.royal-rank-pill.silver {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.royal-rank-pill.bronze {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #ffedd5;
}

.royal-score-badge {
  position: relative;
  z-index: 2;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--sage-2);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
}

.royal-score-badge.gold-score {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Leaderboard List (Matching Demo Box 6) */
.comp-lb-list-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.02);
}

.comp-lb-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--sage-2);
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
}

.comp-lb-list {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 5px;
}

.comp-lb-row {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-bottom: 0 !important;
  cursor: pointer;
  font-size: 13px;
  z-index: 1;
}

.comp-lb-capsule {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 3px 12px 3px 5px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1.5px 5px rgba(0, 0, 0, 0.03);
  overflow: visible !important;
  height: 40px;
  box-sizing: border-box;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  z-index: 1;
}

.comp-lb-row:hover .comp-lb-capsule {
  transform: translateY(-1px);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
}

.comp-lb-capsule .lb-cover-overlay {
  background: linear-gradient(118deg,
      #ffffff 0%,
      #ffffff 32%,
      rgba(255, 255, 255, 0.94) 44%,
      rgba(255, 255, 255, 0.62) 58%,
      rgba(255, 255, 255, 0.18) 76%,
      rgba(255, 255, 255, 0) 95%);
}

.comp-lb-row.is-current-user .comp-lb-capsule {
  background: #f0fdf4;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
}

.comp-lb-row.is-current-user:hover .comp-lb-capsule {
  border-color: #10b981;
}

.comp-lb-row.is-current-user .comp-lb-capsule .lb-cover-overlay {
  background: linear-gradient(118deg,
      #f0fdf4 0%,
      #f0fdf4 32%,
      rgba(240, 253, 244, 0.94) 44%,
      rgba(240, 253, 244, 0.62) 58%,
      rgba(240, 253, 244, 0.18) 76%,
      rgba(240, 253, 244, 0) 95%);
}

.comp-lb-row.top-11-plus-row {
  margin-top: 4px !important;
}

.comp-lb-row.top-11-plus-row .comp-lb-capsule {
  border-style: dashed;
  border-color: rgba(245, 158, 11, 0.6);
  background: #fffbeb;
}

.comp-lb-row.top-11-plus-row .comp-lb-capsule .lb-cover-overlay {
  background: linear-gradient(118deg,
      #fffbeb 0%,
      #fffbeb 32%,
      rgba(255, 251, 235, 0.94) 44%,
      rgba(255, 251, 235, 0.62) 58%,
      rgba(255, 251, 235, 0.18) 76%,
      rgba(255, 251, 235, 0) 95%);
}

.comp-lb-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow: visible;
  z-index: 2;
}

.comp-lb-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 7px;
  overflow: visible !important;
  z-index: 3;
}

.comp-lb-avatar-wrap .avatar {
  width: 28px;
  height: 28px;
  font-size: 15px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: visible !important;
}

.comp-lb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  background: var(--sage-2);
  border: 1px solid var(--line);
  font-size: 16px;
  font-weight: 700;
  color: #123d30;
  flex-shrink: 0;
}

.comp-lb-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.comp-lb-name .lb-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
  min-width: 0;
  flex: 1 1 auto;
}

.you-tag {
  font-size: 11px;
  background: #10b981;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  line-height: 1.2;
}

.comp-lb-score {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  border-radius: 9999px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.03);
  font-weight: 700;
  font-size: 12px;
  color: #1e293b;
  white-space: nowrap;
  line-height: 1;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.comp-lb-row:hover .comp-lb-score {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06);
}

.comp-lb-empty {
  text-align: center;
  padding: 32px 18px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}

.comp-lb-footer-note {
  margin: 14px 0 6px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.5;
  padding: 0 12px;
}

.arena-demo-footnote {
  text-align: center;
  margin-top: 20px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--muted);
  font-weight: 500;
}

/* 8. TAB 3: THỂ LỆ & CƠ CẤU GIẢI THƯỞNG */
.rules-content-body {
  padding: 4px 0 20px 0;
}

.rules-section {
  margin-bottom: 28px;
}

.rules-heading {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px 0;
}

.rules-intro-text {
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.6;
  margin: 0 0 14px 0;
}

.rules-phase-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.rules-p-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.rules-p-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.p-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.p-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  background: #123d30;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 6px;
}

.p-bonus-tag {
  font-size: 11px;
  font-weight: 800;
  background: #d1fae5;
  color: #047857;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.p-bonus-tag.finale {
  background: var(--sage-2);
  color: var(--muted);
  border-color: var(--line);
}

.rules-p-card strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--ink);
}

.rules-p-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Callout Cards (Làm bù & Chủ Nhật) */
.rules-callout-card {
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
}

.rules-catchup-card {
  background: rgba(14, 165, 233, 0.07);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-left: 4px solid #0284c7;
}

.rules-sunday-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.callout-header strong {
  font-size: 13.5px;
  color: var(--ink);
}

.callout-badge-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
}

.callout-badge-tag.blue {
  background: #0284c7;
  color: #ffffff;
}

.callout-badge-tag.gold {
  background: #d97706;
  color: #ffffff;
}

.callout-bullets {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.callout-desc {
  margin: 0;
  font-size: 12.5px;
  color: #78350f;
  line-height: 1.55;
}

/* Schedule Grid */
.rules-schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.schedule-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.schedule-card.gate-open {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.05) 0%, var(--surface) 100%);
}

.schedule-badge {
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.schedule-card.gate-open .schedule-badge {
  color: #059669;
}

.schedule-card.gate-summary .schedule-badge {
  color: #0284c7;
}

.schedule-card.gate-countdown .schedule-badge {
  color: #d97706;
}

.schedule-time {
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.schedule-card p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* Formula Card */
.rules-formula-card {
  background: linear-gradient(135deg, #09261c 0%, #134233 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 14px;
  border: 1px solid rgba(52, 211, 153, 0.25);
  box-shadow: 0 8px 24px rgba(9, 38, 28, 0.25);
}

.formula-title {
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #a7d3c0;
  margin-bottom: 16px;
  text-align: center;
}

.formula-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  text-align: center;
  margin-bottom: 14px;
}

.f-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 10px;
  border-radius: 12px;
}

.f-num {
  display: block;
  font-size: 19px;
  font-weight: 900;
  color: #fde047;
  margin-bottom: 4px;
}

.f-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.35;
}

.formula-max {
  text-align: center;
  font-size: 13.5px;
  color: #86efac;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 12px;
  font-weight: 800;
}

/* Penalty Box */
.rules-penalty-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 14px;
  padding: 18px;
  margin-top: 14px;
}

.penalty-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.penalty-icon {
  font-size: 18px;
}

.penalty-header h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: #9f1239;
}

.penalty-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.penalty-step {
  background: #ffffff;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.step-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
}

.step-badge.step-1,
.step-badge.step-2 {
  background: #fee2e2;
  color: #991b1b;
}

.step-badge.step-3 {
  background: #991b1b;
  color: #ffffff;
}

.step-badge.step-zero {
  background: #0f172a;
  color: #f87171;
}

.step-info {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.35;
}

/* Rewards Table */
.rules-rewards-table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.rules-rewards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.rules-rewards-table th {
  background: var(--sage-2);
  padding: 12px 16px;
  font-weight: 800;
  font-size: 12px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rules-rewards-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

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

.rules-rewards-table tr.rank-top1 {
  background: rgba(250, 204, 21, 0.08);
  font-weight: 700;
}

.rules-rewards-table .pts-val {
  color: #15803d;
  font-weight: 800;
}

.rules-bonus-box {
  background: var(--sage-2);
  border-radius: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
}

.rules-bonus-box h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
}

.bonus-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.bonus-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink);
}

.bonus-chip.highlight {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
  font-weight: 700;
}

/* Shield Explanation */
.rules-shield-explain {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 14px;
}

.shield-explain-icon {
  font-size: 20px;
  line-height: 1.3;
  flex-shrink: 0;
}

.rules-shield-explain strong {
  font-size: 13px;
  color: #1e40af;
  display: block;
  margin-bottom: 2px;
}

.rules-shield-explain p {
  margin: 0;
  font-size: 12px;
  color: #1e3a8a;
  line-height: 1.45;
}

/* 9. DARK THEME OVERRIDES FOR ARENA */
[data-user-theme="dark"] .arena-locked-card,
[data-user-theme="midnight"] .arena-locked-card,
body.dark-theme .arena-locked-card {
  background: rgba(15, 33, 27, 0.85);
  border-color: rgba(245, 158, 11, 0.4);
}

[data-user-theme="dark"] .arena-preview-card,
[data-user-theme="midnight"] .arena-preview-card,
body.dark-theme .arena-preview-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-user-theme="dark"] .comp-nav-tabs.arena-nav-tabs,
[data-user-theme="midnight"] .comp-nav-tabs.arena-nav-tabs,
body.dark-theme .comp-nav-tabs.arena-nav-tabs {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-user-theme="dark"] .comp-tab-btn.active,
[data-user-theme="midnight"] .comp-tab-btn.active,
body.dark-theme .comp-tab-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff !important;
}

/* 10. RESPONSIVE MOBILE ADJUSTMENTS (FLAWLESS & MATCHING DEMO) */
@media (max-width: 768px) {
  #arena.page {
    padding: 20px 14px 130px 14px;
  }

  .arena-hero-banner {
    min-height: 240px;
    margin-bottom: 16px;
    border-radius: 18px;
  }

  .arena-banner-bg-img {
    object-position: center center;
  }

  .arena-banner-overlay {
    display: block;
    background: linear-gradient(180deg, rgba(8, 20, 38, 0.25) 0%, rgba(8, 20, 38, 0.08) 35%, rgba(8, 20, 38, 0.6) 100%);
  }

  .arena-banner-content {
    padding: 18px 16px 18px 16px;
    min-height: 240px;
  }

  .arena-banner-tags {
    gap: 6px;
    margin-bottom: auto;
  }

  .arena-tag-gold,
  .arena-tag-season,
  .arena-tag-type {
    height: 24px;
    font-size: 10px;
    padding: 0 10px;
  }

  .arena-hero-title {
    font-size: clamp(16px, 4.5vw, 20px);
    line-height: 1.3;
    margin: 0 0 6px 0;
    text-wrap: balance;
    word-break: normal;
  }

  .arena-hero-subtitle {
    font-size: 12.5px;
    line-height: 1.45;
  }

  .arena-admin-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 12.5px;
  }

  .admin-bar-actions {
    width: 100%;
  }

  .admin-bar-actions .button {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 8px 14px !important;
  }

  .arena-locked-card {
    padding: 28px 16px;
    border-radius: 16px;
  }

  .arena-locked-preview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .arena-tabs-container {
    padding: 16px 12px;
    border-radius: 16px;
  }

  .comp-nav-tabs.arena-nav-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    padding: 4px !important;
    border-radius: 12px !important;
    background: var(--sage-2, #f1f5f3) !important;
    border: 1px solid var(--line, rgba(0, 0, 0, 0.08)) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .comp-nav-tabs.arena-nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .comp-tab-btn {
    flex: 1 1 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 4px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    justify-content: center !important;
    text-align: center !important;
    border-radius: 8px !important;
    gap: 4px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .comp-tab-btn .tab-icon {
    font-size: 13px !important;
  }

  .comp-tab-btn .tab-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .desktop-only-inline {
    display: none !important;
  }

  .comp-tab-btn.active {
    background: #194d3e !important;
    color: #ffffff !important;
  }

  .comp-gateway-hero {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 16px 14px !important;
    border-radius: 14px !important;
  }

  .comp-gateway-hero-left {
    width: 100% !important;
  }

  .comp-gateway-badge-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px 10px !important;
    margin-bottom: 12px !important;
  }

  .comp-gateway-badge-row .comp-status-badge,
  .comp-gateway-badge-row .comp-phase-tag {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    height: 28px !important;
    line-height: 28px !important;
    padding: 0 12px !important;
    border-radius: 9999px !important;
    font-size: 11.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .comp-gateway-badge-row .comp-class-badge {
    flex-basis: 100% !important;
    width: fit-content !important;
    max-width: 100% !important;
    white-space: nowrap !important;
    margin-top: 4px !important;
    height: 28px !important;
    line-height: 28px !important;
    padding: 0 12px !important;
    border-radius: 9999px !important;
    font-size: 11.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .comp-gateway-hero h3 {
    font-size: 17px;
  }

  .comp-gateway-hero p {
    margin-bottom: 0;
    font-size: 13px;
  }

  .gateway-clock-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-left: 0 !important;
    padding: 12px 14px !important;
    box-sizing: border-box !important;
    border-radius: 12px !important;
    gap: 12px !important;
    min-height: auto !important;
  }

  .gateway-clock-card .gateway-clock-body {
    order: 1 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .gateway-clock-card .gateway-clock-label {
    font-size: 11px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 2px !important;
  }

  .gateway-clock-digits {
    font-size: 22px !important;
    letter-spacing: 0.5px !important;
  }

  .gateway-clock-card .gateway-clock-icon {
    order: 2 !important;
    margin-left: auto !important;
    font-size: 44px !important;
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* User attempts card on mobile */
  .comp-user-attempts-card {
    padding: 14px !important;
    border-radius: 14px !important;
    margin-bottom: 14px !important;
  }

  .attempts-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .attempt-stat-box {
    padding: 10px 10px !important;
    border-radius: 10px !important;
  }

  .attempt-stat-label {
    font-size: 11px !important;
  }

  .attempt-stat-val {
    font-size: 14.5px !important;
  }

  .attempts-note-banner {
    padding: 10px 12px !important;
    font-size: 12px !important;
    line-height: 1.45 !important;
    border-radius: 10px !important;
    gap: 8px !important;
  }

  /* Journey container on mobile */
  .comp-phases-journey-container {
    padding: 14px !important;
    border-radius: 14px !important;
    margin: 14px 0 !important;
  }

  .comp-phases-journey-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .phase-journey-card {
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }

  .pj-phase-num {
    font-size: 13.5px !important;
  }

  .pj-topic {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 6px 0 !important;
  }

  .pj-score-box {
    padding: 6px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
  }

  .pj-action-btn {
    min-height: 42px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    width: 100% !important;
    border-radius: 9px !important;
  }

  /* Gateway CTA button */
  .gateway-action-container {
    display: flex;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-top: 14px !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .gateway-play-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    padding: 12px 16px !important;
  }

  .gateway-blocked-msg {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 12px !important;
    padding: 10px 14px !important;
    line-height: 1.45 !important;
    text-align: center !important;
    margin-top: 0 !important;
    border-radius: 10px !important;
  }

  /* Sunday components on mobile */
  .gateway-sunday-container {
    margin: 14px 0 !important;
  }

  .sunday-hero-banner {
    padding: 20px 14px !important;
    border-radius: 12px !important;
  }

  .sunday-cup-icon {
    font-size: 38px !important;
    margin-bottom: 6px !important;
  }

  .sunday-hero-content h3 {
    font-size: 18px !important;
    margin: 0 0 6px !important;
  }

  .sunday-hero-content p {
    font-size: 13px !important;
    margin: 0 auto 16px !important;
    line-height: 1.45 !important;
  }

  .sunday-goto-lb-btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 46px !important;
    font-size: 14px !important;
    padding: 11px 16px !important;
  }

  .sunday-ceremony-banner {
    padding: 20px 14px !important;
    border-radius: 14px !important;
    margin-bottom: 16px !important;
  }

  .ceremony-trophy-icon {
    font-size: 38px !important;
    margin-bottom: 6px !important;
  }

  .ceremony-badge {
    font-size: 10px !important;
    padding: 4px 10px !important;
  }

  .ceremony-heading {
    font-size: 18px !important;
    line-height: 1.3 !important;
    margin: 4px 0 6px !important;
  }

  .ceremony-desc {
    font-size: 12.5px !important;
    line-height: 1.4 !important;
  }

  /* Leaderboard controls */
  .lb-header-controls {
    margin-bottom: 14px !important;
  }

  .lb-phase-selectors {
    display: flex !important;
    gap: 6px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding-bottom: 4px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }

  .lb-phase-selectors::-webkit-scrollbar {
    display: none !important;
  }

  .lb-phase-btn {
    padding: 7px 12px !important;
    font-size: 11.5px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-height: 34px !important;
  }

  .lb-refresh-btn {
    padding: 7px 10px !important;
    font-size: 11.5px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-height: 34px !important;
    margin-left: auto !important;
  }

  .lb-summary-notice {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
  }

  /* Podium & Top 3 on mobile */
  .comp-podium-wrap {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 12px 2px 16px 2px !important;
    width: 100% !important;
  }

  .arena-concept-switcher-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    border-radius: 14px !important;
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  .arena-concept-pills {
    width: 100% !important;
    overflow-x: auto !important;
    padding-bottom: 2px !important;
  }

  .concept-chip {
    font-size: 10.5px !important;
    padding: 3px 8px !important;
  }

  /* Concept 1 Mobile */
  .arena-concept1-wrap {
    gap: 6px !important;
    padding-top: 38px !important;
    padding-bottom: 6px !important;
    align-items: flex-end !important;
    justify-content: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  .arena-champion-card.rank-1,
  .arena-champion-card.rank-2,
  .arena-champion-card.rank-3 {
    width: auto !important;
    flex: none !important;
  }

  /* Mini Namecard trên mobile: Giữ chuẩn tuyệt đối tỉ lệ 680x760 (17:19) đồng nhất với Namecard gốc */
  .arena-champion-card.mini-namecard {
    aspect-ratio: 680 / 760 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .arena-champion-card.mini-namecard.rank-1 {
    --mini-scale: 0.185 !important;
    width: calc(680px * var(--mini-scale)) !important;
    /* ~125.8px */
    height: calc(760px * var(--mini-scale)) !important;
    /* ~140.6px */
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }

  .arena-champion-card.mini-namecard.rank-2,
  .arena-champion-card.mini-namecard.rank-3 {
    --mini-scale: 0.153 !important;
    width: calc(680px * var(--mini-scale)) !important;
    /* ~104px */
    height: calc(760px * var(--mini-scale)) !important;
    /* ~116.3px */
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }

  .champ-cover-banner {
    height: 33% !important;
  }

  /* Huy chương Top 3 trên Mobile: Nằm ngoài hẳn phía trên khung, căn giữa, không dính avatar */
  .champ-top-medal-anchor {
    margin-bottom: 6px !important;
  }

  .arena-champion-card.mini-namecard[data-frame="gold"] .champ-top-medal-anchor {
    margin-bottom: calc(68px * var(--mini-scale)) !important;
  }

  .arena-champion-card.mini-namecard[data-frame="phep_mau_mua_dong"] .champ-top-medal-anchor {
    margin-bottom: calc(84px * var(--mini-scale)) !important;
  }

  .arena-champion-card.mini-namecard[data-frame="stars"] .champ-top-medal-anchor,
  .arena-champion-card.mini-namecard[data-frame="ice"] .champ-top-medal-anchor {
    margin-bottom: calc(62px * var(--mini-scale)) !important;
  }

  .arena-champion-card.mini-namecard[data-frame="leaves"] .champ-top-medal-anchor,
  .arena-champion-card.mini-namecard[data-frame="sakura"] .champ-top-medal-anchor,
  .arena-champion-card.mini-namecard[data-frame="ton_vinh_phai_dep"] .champ-top-medal-anchor,
  .arena-champion-card.mini-namecard[data-frame="bua_tiec_ma_mi"] .champ-top-medal-anchor {
    margin-bottom: calc(54px * var(--mini-scale)) !important;
  }

  .champ-crown.rank-medal {
    position: static !important;
    animation: medalBobAboveMobile 2.6s ease-in-out infinite alternate !important;
  }

  .champ-crown.rank-medal.rank-1 svg {
    width: 28px !important;
    height: 28px !important;
  }

  .champ-crown.rank-medal.rank-2 svg {
    width: 25px !important;
    height: 25px !important;
  }

  .champ-crown.rank-medal.rank-3 svg {
    width: 23px !important;
    height: 23px !important;
  }

  @keyframes medalBobAboveMobile {
    0% {
      transform: translateY(0);
    }

    100% {
      transform: translateY(-2.5px);
    }
  }

  .champ-body.mini-namecard-body {
    padding: 0 3px 0 3px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex: 1 !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .champ-avatar-wrap {
    margin-top: -14px !important;
    margin-bottom: 0 !important;
    position: relative !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  .arena-champion-card.mini-namecard.rank-1 .champ-avatar-wrap {
    margin-top: -17px !important;
    margin-bottom: 0 !important;
  }

  .champ-avatar.rank-1-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 14.5px !important;
    --ring-inset: -2.5px;
    --ring-width: 1.5px;
  }

  .champ-avatar.rank-2-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 12px !important;
    --ring-inset: -2px;
    --ring-width: 1.2px;
  }

  .champ-avatar.rank-3-avatar {
    width: 26px !important;
    height: 26px !important;
    font-size: 11px !important;
    --ring-inset: -2px;
    --ring-width: 1.2px;
  }

  /* Cụm thông tin trên Mobile: Khoảng hở vừa phải, không dính sát và cách khung dưới đẹp mắt */
  .champ-info-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    flex: 1 !important;
    gap: 4px !important;
    padding-top: 2px !important;
    padding-bottom: 7px !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
  }

  .arena-champion-card.mini-namecard.rank-1 .champ-info-group {
    gap: 4.5px !important;
    padding-bottom: 9px !important;
  }

  .champ-name {
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 0 2px !important;
    gap: 2px !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    line-height: 1.2 !important;
  }

  .champ-name.font-bold {
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  .champ-name svg {
    flex-shrink: 0 !important;
    width: 11px !important;
    height: 11px !important;
  }

  .champ-name .lb-name-text {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    max-width: calc(100% - 13px) !important;
    display: inline-block !important;
  }

  .champ-rank-tag-wrap {
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }

  .champ-rank-pill {
    font-size: 8px !important;
    font-weight: 800 !important;
    padding: 1.5px 5.5px !important;
    letter-spacing: 0.1px !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    border-radius: 9999px !important;
    max-width: 96% !important;
    box-sizing: border-box !important;
  }

  .champ-score {
    font-size: 9.5px !important;
    font-weight: 800 !important;
    padding: 1.5px 7px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.2 !important;
    border-radius: 9999px !important;
    margin: 0 !important;
  }

  .champ-score .champ-score-star {
    width: 10px !important;
    height: 10px !important;
    margin-right: 1.5px !important;
    flex-shrink: 0 !important;
  }

  /* Concept 2 Mobile */
  .arena-concept2-wrap {
    gap: 6px !important;
  }

  .arena-glass-col.rank-1 {
    width: 36% !important;
    flex: 0 1 36% !important;
  }

  .arena-glass-col.rank-2,
  .arena-glass-col.rank-3 {
    width: 31% !important;
    flex: 0 1 31% !important;
  }

  .arena-glass-card {
    padding: 8px 4px !important;
    border-radius: 12px !important;
    margin-bottom: 5px !important;
  }

  .glass-avatar {
    width: 36px !important;
    height: 36px !important;
    font-size: 15px !important;
  }

  .arena-glass-col.rank-1 .glass-avatar {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
  }

  .glass-user-name {
    font-size: 10.5px !important;
  }

  .glass-score-badge {
    font-size: 9.5px !important;
    padding: 1.5px 5px !important;
  }

  .pedestal-1 {
    height: 48px !important;
  }

  .pedestal-2 {
    height: 34px !important;
  }

  .pedestal-3 {
    height: 24px !important;
  }

  /* Concept 3 Mobile */
  .royal-grand-capsule {
    height: 46px !important;
    padding: 0 10px 0 6px !important;
  }

  .royal-grand-capsule.rank-1 {
    height: 52px !important;
  }

  .royal-avatar {
    width: 32px !important;
    height: 32px !important;
  }

  .royal-grand-capsule.rank-1 .royal-avatar {
    width: 38px !important;
    height: 38px !important;
  }

  .royal-name {
    font-size: 12px !important;
  }

  .royal-name.font-bold {
    font-size: 12.5px !important;
  }

  .royal-score-badge {
    font-size: 10.5px !important;
    padding: 2.5px 8px !important;
  }

  .podium-col {
    width: 31%;
    max-width: 110px;
  }

  .podium-avatar {
    width: 44px !important;
    height: 44px !important;
    font-size: 23px;
  }

  .podium-col.rank-1 .podium-avatar {
    width: 56px !important;
    height: 56px !important;
    font-size: 29px;
  }

  .podium-crown {
    font-size: 18px;
    top: -14px;
    z-index: 50 !important;
  }

  .podium-crown.gold {
    font-size: 22px;
    top: -18px;
  }

  .podium-name {
    font-size: 11px;
    max-width: 90px;
  }

  .podium-score {
    font-size: 10.5px;
    padding: 2px 6px;
  }

  .podium-stand.stand-1 {
    height: 85px;
  }

  .podium-stand.stand-2 {
    height: 65px;
  }

  .podium-stand.stand-3 {
    height: 50px;
  }

  .stand-num {
    font-size: 20px;
  }

  .comp-lb-list-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 12px !important;
    font-size: 11px !important;
    overflow: visible;
  }

  .comp-lb-row {
    display: flex !important;
    padding: 0 !important;
    font-size: 12px !important;
    gap: 6px !important;
    overflow: visible !important;
  }

  .comp-lb-user {
    gap: 6px;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .comp-lb-avatar-wrap {
    padding: 5px;
    flex-shrink: 0;
    overflow: visible;
    z-index: 2;
  }

  .comp-lb-avatar-wrap .avatar {
    width: 27px;
    height: 27px;
    font-size: 14px;
    overflow: visible !important;
  }

  .comp-lb-avatar {
    width: 27px;
    height: 27px;
    font-size: 14px;
    flex-shrink: 0;
  }

  .comp-lb-footer-note {
    font-size: 11.5px;
    margin: 10px 0 4px 0;
  }

  .comp-lb-name {
    gap: 4px;
    min-width: 0;
    font-size: 12.5px;
  }

  .comp-lb-name .lb-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
  }

  .you-tag {
    font-size: 9.5px;
    padding: 1px 4px;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  .comp-lb-score {
    font-size: 12px;
    white-space: nowrap;
    text-align: right;
  }

  .rules-phase-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rules-schedule-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rules-sunday-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }

  .formula-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .penalty-steps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .rules-rewards-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =========================================================================
   QUIZ ARENA MODAL STYLES (10 MIN GAMEPLAY)
   ========================================================================= */

dialog.quiz-arena-modal,
.quiz-arena-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  background: #0d281f !important;
  color: #fff !important;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  width: min(900px, calc(100vw - 24px));
  max-width: 900px;
  height: min(92vh, 92dvh, 860px);
  max-height: min(92vh, 92dvh);
  min-height: min(520px, 85vh);
  display: block;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.quiz-play-container,
#quizPlayView {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

.quiz-play-container *,
#quizPlayView * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-drag: none !important;
}

.quiz-body-content {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px 28px;
}

.quiz-header-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 22px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quiz-header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.quiz-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-phase-badge {
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 8px;
  border-radius: 6px;
  color: #d1fae5;
  letter-spacing: 0.3px;
}

.quiz-q-counter {
  font-size: 14px;
  font-weight: 800;
  color: #facc15;
}

.quiz-exit-wrap {
  display: flex;
  align-items: center;
}

.quiz-header-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.quiz-timer-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.quiz-timer-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  overflow: hidden;
  min-width: 60px;
}

.quiz-timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #facc15 75%, #ef4444 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.quiz-timer-display {
  font-family: "Unbounded", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 72px;
  white-space: nowrap;
  flex-shrink: 0;
}

.quiz-timer-display.low-time {
  color: #ef4444;
  animation: lowTimePulse 0.8s infinite alternate;
}

@keyframes lowTimePulse {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.1);
    color: #f87171;
  }
}

.quiz-score-right {
  font-size: 15px;
  font-weight: 800;
  color: #fde047;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.quiz-stars-badge {
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.3);
  padding: 3px 10px;
  border-radius: 9999px;
  white-space: nowrap;
}

.quiz-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.quiz-exit-btn:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.quiz-exit-btn:active {
  transform: translateY(0);
}

.quiz-exit-btn .exit-btn-icon {
  font-size: 13px;
  line-height: 1;
}

.quiz-body-content {
  flex: 1;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.quiz-penalty-toast {
  position: absolute;
  top: 10px;
  right: 36px;
  background: #ef4444;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
  animation: penaltyFloatAnim 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes penaltyFloatAnim {
  0% {
    transform: translateY(10px) scale(0.8);
    opacity: 0;
  }

  20% {
    transform: translateY(0) scale(1.1);
    opacity: 1;
  }

  80% {
    transform: translateY(-10px) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateY(-24px) scale(0.9);
    opacity: 0;
  }
}

.quiz-bonus-toast {
  position: absolute;
  top: 10px;
  right: 36px;
  background: #10b981;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.5);
  animation: penaltyFloatAnim 1.2s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

.quiz-question-card {
  margin-bottom: 24px;
}

.q-tries-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  color: #a7d3c0;
  margin-bottom: 12px;
}

.tries-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

.tries-dot.active {
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

.tries-dot.used {
  background: #ef4444;
}

.quiz-question-text {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  color: #ffffff;
  margin: 0;
}

.quiz-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quiz-option-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(4px);
}

.quiz-option-btn .opt-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.quiz-option-btn.opt-correct {
  background: #059669 !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
}

.quiz-option-btn.opt-wrong {
  background: #991b1b !important;
  border-color: #f87171 !important;
  opacity: 0.6;
  text-decoration: line-through;
  animation: shakeOpt 0.4s ease-in-out;
}

@keyframes shakeOpt {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

/* QUIZ RESULT VIEW */
.quiz-result-container {
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  max-height: 92dvh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.quiz-result-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
}

.quiz-result-close-btn:hover {
  background: rgba(239, 68, 68, 0.28);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
  transform: scale(1.08);
}

.quiz-confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  z-index: 1;
}

.result-card-inner {
  position: relative;
  z-index: 2;
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}

.result-badge-anim {
  font-size: 48px;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
  animation: resultPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultPop {
  0% {
    transform: scale(0.4) rotate(-15deg);
    opacity: 0;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.result-card-inner h2 {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  margin: 0 0 4px 0;
  letter-spacing: 0.5px;
}

.result-subtitle {
  font-size: 13px;
  color: #a7d3c0;
  margin: 0 0 20px 0;
}

.result-hero-score {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 16px;
  padding: 16px;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.score-star-icon {
  font-size: 28px;
}

.score-number {
  font-size: 42px;
  font-weight: 900;
  color: #fde047;
  line-height: 1;
}

.score-max-label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.result-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.res-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}

.res-label {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.res-item strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
}

.res-pts {
  font-size: 11px;
  font-weight: 700;
  color: #34d399;
}

.result-phase-record-box {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #fef08a;
  margin-bottom: 12px;
}

.result-leaderboard-notice {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
  margin: 0 0 24px 0;
}

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

/* Responsive queries */
@media (max-width: 980px) {
  .home-showcase-row {
    position: relative;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 14px;
    display: block;
    height: auto;
    max-height: none;
  }

  .banner-stack-card {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 228px;
    max-height: 228px;
    min-height: 228px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  }

  .banner-drag-hint {
    display: none !important;
  }

  .banner-floating-controls {
    top: 10px;
    bottom: auto;
    right: 12px;
    padding: 3px 8px;
    gap: 6px;
  }

  .weekly-competition-card {
    padding: 13px 16px 12px;
    margin: 0;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: 228px;
    max-height: 228px;
    min-height: 228px;
    border-radius: 14px;
    border: none;
    box-shadow: none;
    flex-shrink: 0;
    box-sizing: border-box;
  }

  .comp-card-content {
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    height: 100%;
    gap: 4px;
    text-align: left;
  }

  .comp-left {
    flex: none;
    width: 100%;
    text-align: left;
  }

  .comp-badge-row {
    margin-bottom: 2px;
    gap: 6px;
    padding-right: 90px;
    box-sizing: border-box;
  }

  .comp-status-badge {
    padding: 2.5px 8px;
    font-size: 10px;
  }

  .comp-week-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  .arena-portal-tag {
    display: none !important;
  }

  .comp-topic-title {
    font-size: 15px;
    line-height: 1.25;
    margin: 0 0 2px 0;
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .comp-phase-subtitle {
    font-size: 11.5px;
    line-height: 1.25;
    margin: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .comp-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 8px;
    padding-right: 0 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    gap: 6px;
    box-sizing: border-box;
  }

  .comp-timer-box {
    text-align: left !important;
    border-right: none !important;
    padding-right: 0 !important;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .comp-timer-label {
    font-size: 9.5px;
    margin-bottom: 0px;
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
    display: block;
    color: rgba(255, 255, 255, 0.7);
  }

  .comp-countdown {
    font-size: 16px;
    line-height: 1.1;
    margin-top: 1px;
    text-align: left;
    white-space: nowrap;
  }

  .weekly-competition-card .comp-action-box {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 3px !important;
    flex-shrink: 0;
  }

  .weekly-competition-card .comp-user-status {
    font-size: 10px;
    margin-bottom: 0;
    gap: 3px;
    white-space: nowrap;
  }

  .weekly-competition-card .comp-cta-button {
    font-size: 11px !important;
    padding: 0 12px !important;
    border-radius: 9999px !important;
    height: 28px !important;
    white-space: nowrap;
  }

  .attempts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .rules-phase-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .formula-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .penalty-steps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .result-breakdown-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 14px;
  }

  .res-item {
    padding: 8px 4px;
    border-radius: 8px;
  }

  .res-label {
    font-size: 9.5px;
    margin-bottom: 2px;
  }

  .res-item strong {
    font-size: 13.5px;
  }

  .res-pts {
    font-size: 10px;
  }

  .quiz-result-container {
    padding: 20px 16px max(24px, env(safe-area-inset-bottom, 20px));
    max-height: 92dvh;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .result-badge-anim {
    font-size: 36px;
    margin-bottom: 4px;
  }

  .result-card-inner h2 {
    font-size: 19px;
  }

  .result-subtitle {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .result-hero-score {
    padding: 10px 16px;
    margin-bottom: 16px;
    border-radius: 12px;
    gap: 6px;
  }

  .score-number {
    font-size: 32px;
  }

  .score-star-icon {
    font-size: 22px;
  }

  .result-phase-record-box {
    padding: 8px 10px;
    font-size: 11px;
    margin-bottom: 10px;
  }

  .result-leaderboard-notice {
    font-size: 11px;
    margin-bottom: 14px;
  }

  .result-actions {
    position: sticky;
    bottom: 0;
    background: rgba(13, 40, 31, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 0 max(16px, env(safe-area-inset-bottom, 16px));
    margin-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
  }

  .result-actions .button {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    min-height: 48px;
    touch-action: manipulation;
    cursor: pointer;
  }

  .comp-podium-wrap {
    gap: 8px;
  }

  .podium-col {
    width: 100px;
  }

  .quiz-body-content {
    padding: 20px 16px;
  }

  .quiz-header-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  .quiz-header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .quiz-header-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }

  .quiz-info-left {
    gap: 6px;
  }

  .quiz-phase-badge {
    font-size: 10px;
    padding: 3px 6px;
  }

  .quiz-q-counter {
    font-size: 13px;
  }

  .quiz-exit-btn {
    padding: 3px 8px;
    font-size: 11px;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .quiz-timer-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .quiz-timer-track {
    flex: 1;
    height: 6px;
    min-width: 50px;
    display: block !important;
  }

  .quiz-timer-display {
    font-size: 13px;
    min-width: 54px;
    gap: 3px;
  }

  .quiz-timer-display .timer-icon {
    font-size: 12px;
  }

  .quiz-score-right {
    font-size: 13px;
    flex-shrink: 0;
  }

  .quiz-stars-badge {
    padding: 2px 7px;
    font-size: 12px;
  }

  .quiz-exit-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .quiz-exit-footer {
    flex-direction: column-reverse;
    gap: 10px;
    padding: 12px 16px max(16px, env(safe-area-inset-bottom, 16px));
  }

  .quiz-exit-footer .button {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 14px;
    touch-action: manipulation;
  }

  .quiz-exit-body {
    padding: 16px;
    gap: 12px;
  }
}

/* QUIZ EXIT CONFIRMATION MODAL */
dialog.quiz-exit-confirm-modal,
.quiz-exit-confirm-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 18px;
  background: #0f172a !important;
  color: #f1f5f9 !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: min(500px, calc(100vw - 28px));
  max-width: 500px;
  height: fit-content;
  max-height: min(90vh, 90dvh);
  display: block;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.quiz-exit-confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.quiz-exit-modal-card {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 90dvh);
  width: 100%;
  overflow: hidden;
}

.quiz-exit-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-exit-badge-icon {
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  flex-shrink: 0;
}

.quiz-exit-title-group h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.quiz-exit-title-group p {
  margin: 4px 0 0 0;
  font-size: 13px;
  color: #94a3b8;
}

.quiz-exit-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.quiz-exit-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quiz-exit-stat-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.stat-box-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.stat-box-val {
  font-size: 15px;
  color: #38bdf8;
  font-weight: 800;
  font-family: "Unbounded", sans-serif;
}

.quiz-exit-guarantee-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
  color: #fef3c7;
}

.guarantee-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.guarantee-text strong {
  color: #fde047;
}

.quiz-exit-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom, 16px));
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quiz-exit-resume-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: 1px solid rgba(16, 185, 129, 0.5) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.quiz-exit-resume-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.quiz-exit-confirm-btn {
  background: transparent !important;
  border: 1px solid rgba(239, 68, 68, 0.45) !important;
  color: #fca5a5 !important;
  font-weight: 600 !important;
}

.quiz-exit-confirm-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
  color: #ffffff !important;
}

.quiz-exit-guarantee-card.pause-mode {
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #e0f2fe;
}

.quiz-exit-guarantee-card.pause-mode .guarantee-text strong {
  color: #38bdf8;
}

.quiz-exit-guarantee-card.danger-mode {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fee2e2;
}

.quiz-exit-guarantee-card.danger-mode .guarantee-text strong {
  color: #f87171;
}

.danger-confirm-btn {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  border: 1px solid rgba(239, 68, 68, 0.8) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4) !important;
}

.danger-confirm-btn:hover {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%) !important;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.6) !important;
}

/* ========================================================
   3-PHASE JOURNEY GRID (LÀM BÙ & ĐẶC QUYỀN ĐÚNG HẠN)
======================================================== */
.comp-phases-journey-container {
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.phases-journey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.phases-journey-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.journey-sub-hint {
  font-size: 11.5px;
  color: var(--muted);
  background: var(--sage-2);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--line);
  font-weight: 600;
}

.comp-phases-journey-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .comp-phases-journey-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.phase-journey-card {
  background: var(--surface-soft, rgba(0, 0, 0, 0.02));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  transition: all 0.2s ease;
}

.phase-journey-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.phase-journey-card.card-on-time {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08) 0%, var(--surface) 100%);
}

.phase-journey-card.card-catch-up {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.08) 0%, var(--surface) 100%);
}

.phase-journey-card.card-completed {
  border-color: rgba(56, 189, 248, 0.35);
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.06) 0%, var(--surface) 100%);
}

.phase-journey-card.card-locked {
  opacity: 0.65;
}

.pj-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pj-phase-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.pj-phase-days {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.pj-status-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.pj-status-chip.chip-on-time {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.pj-status-chip.chip-catch-up {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.pj-status-chip.chip-completed {
  background: rgba(56, 189, 248, 0.15);
  color: #0284c7;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pj-status-chip.chip-locked {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.pj-topic {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  min-height: 34px;
}

.pj-score-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--sage-2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
}

.pj-score-label {
  color: var(--muted);
  font-size: 11px;
}

.pj-score-val {
  font-weight: 800;
  color: #d97706;
  font-family: "Unbounded", sans-serif;
}

/* Dark mode theme overrides for Journey */
[data-user-theme="dark"] .comp-phases-journey-container,
[data-user-theme="midnight"] .comp-phases-journey-container,
body.dark-theme .comp-phases-journey-container {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-user-theme="dark"] .phases-journey-header h4,
[data-user-theme="midnight"] .phases-journey-header h4,
body.dark-theme .phases-journey-header h4 {
  color: #f8fafc;
}

[data-user-theme="dark"] .journey-sub-hint,
[data-user-theme="midnight"] .journey-sub-hint,
body.dark-theme .journey-sub-hint {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.07);
}

[data-user-theme="dark"] .phase-journey-card,
[data-user-theme="midnight"] .phase-journey-card,
body.dark-theme .phase-journey-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-user-theme="dark"] .phase-journey-card.card-on-time,
[data-user-theme="midnight"] .phase-journey-card.card-on-time,
body.dark-theme .phase-journey-card.card-on-time {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%);
}

[data-user-theme="dark"] .phase-journey-card.card-catch-up,
[data-user-theme="midnight"] .phase-journey-card.card-catch-up,
body.dark-theme .phase-journey-card.card-catch-up {
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.08) 0%, rgba(15, 23, 42, 0.6) 100%);
}

[data-user-theme="dark"] .phase-journey-card.card-completed,
[data-user-theme="midnight"] .phase-journey-card.card-completed,
body.dark-theme .phase-journey-card.card-completed {
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.06) 0%, rgba(15, 23, 42, 0.6) 100%);
}

[data-user-theme="dark"] .pj-phase-num,
[data-user-theme="midnight"] .pj-phase-num,
body.dark-theme .pj-phase-num {
  color: #f1f5f9;
}

[data-user-theme="dark"] .pj-phase-days,
[data-user-theme="midnight"] .pj-phase-days,
body.dark-theme .pj-phase-days {
  color: #94a3b8;
}

[data-user-theme="dark"] .pj-topic,
[data-user-theme="midnight"] .pj-topic,
body.dark-theme .pj-topic {
  color: #cbd5e1;
}

[data-user-theme="dark"] .pj-score-box,
[data-user-theme="midnight"] .pj-score-box,
body.dark-theme .pj-score-box {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-user-theme="dark"] .pj-score-val,
[data-user-theme="midnight"] .pj-score-val,
body.dark-theme .pj-score-val {
  color: #fde047;
}

[data-user-theme="dark"] .pj-status-chip.chip-on-time,
[data-user-theme="midnight"] .pj-status-chip.chip-on-time,
body.dark-theme .pj-status-chip.chip-on-time {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

[data-user-theme="dark"] .pj-status-chip.chip-catch-up,
[data-user-theme="midnight"] .pj-status-chip.chip-catch-up,
body.dark-theme .pj-status-chip.chip-catch-up {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.pj-action-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  border: none;
}

.pj-action-btn.btn-play-ontime {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.pj-action-btn.btn-play-ontime:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  transform: translateY(-1px);
}

.pj-action-btn.btn-play-catchup {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.pj-action-btn.btn-play-catchup:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
}

.pj-action-btn.btn-resume {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.pj-action-btn.btn-resume:hover {
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  transform: translateY(-1px);
}

.pj-action-btn.btn-view-result {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: 1px solid rgba(124, 58, 237, 0.4);
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.35);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pj-action-btn.btn-view-result:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  color: #ffffff;
  border-color: rgba(167, 139, 250, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(139, 92, 246, 0.5);
}

.pj-action-btn.btn-done {
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  cursor: default;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pj-action-btn.btn-disabled {
  background: rgba(255, 255, 255, 0.04);
  color: #64748b;
  cursor: not-allowed;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* SUNDAY PRACTICE MODE STYLES */
.pj-status-chip.chip-practice {
  background: rgba(139, 92, 246, 0.16);
  color: #a78bfa;
  border-color: rgba(139, 92, 246, 0.4);
}

.pj-action-btn.btn-play-practice {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  border: 1px solid rgba(139, 92, 246, 0.5);
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.pj-action-btn.btn-play-practice:hover {
  background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.55);
}

.pj-action-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.quiz-phase-badge.practice-mode {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
  border: 1px solid rgba(167, 139, 250, 0.6);
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
}

.quiz-practice-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.quiz-practice-nav-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-practice-q-palette {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.q-palette-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.q-palette-btn:hover {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.15);
  transform: translateY(-1px);
}

.q-palette-btn.active {
  border-color: #a78bfa;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.4) 0%, rgba(109, 40, 217, 0.5) 100%);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
  font-weight: 800;
}

.q-palette-btn.answered-correct {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.q-palette-btn.answered-wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
}

@media (max-width: 640px) {
  .quiz-practice-nav-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .quiz-practice-q-palette {
    order: 3;
    width: 100%;
    margin-top: 6px;
  }
}

/* ========================================================
   MODAL XÁC NHẬN BẮT ĐẦU LƯỢT THI DUY NHẤT
======================================================== */
dialog.quiz-start-confirm-modal,
.quiz-start-confirm-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: #0f172a !important;
  color: #f1f5f9 !important;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.06);
  width: min(520px, calc(100vw - 28px));
  max-width: 520px;
  height: fit-content;
  max-height: min(90vh, 90dvh);
  display: block;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.quiz-start-confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.quiz-start-modal-card {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 90dvh);
  width: 100%;
  overflow: hidden;
}

.quiz-start-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-start-badge-icon {
  font-size: 26px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  flex-shrink: 0;
}

.quiz-start-title-group h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.quiz-start-phase-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 20px;
  padding: 2px 10px;
  margin-top: 4px;
}

.quiz-start-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Warning highlight card with exact mandatory Vietnamese prompt */
.quiz-start-warning-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.1) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.15);
}

.warning-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.warning-prompt {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.45;
  margin-bottom: 6px;
  letter-spacing: -0.2px;
}

.warning-subtext {
  margin: 0;
  font-size: 12.5px;
  color: #fef08a;
  line-height: 1.4;
}

/* Bonus indicator card */
.quiz-start-bonus-card {
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-start-bonus-card.on-time {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #d1fae5;
}

.quiz-start-bonus-card.on-time strong {
  color: #34d399;
}

.quiz-start-bonus-card.catch-up {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fef3c7;
}

.quiz-start-bonus-card.catch-up strong {
  color: #fbbf24;
}

.quiz-start-bonus-card.final-phase {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
}

.quiz-start-bonus-card.final-phase strong {
  color: #38bdf8;
}

.quiz-start-rules-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 12px 14px;
}

.qsr-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qsr-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.qsr-info {
  display: flex;
  flex-direction: column;
}

.qsr-info strong {
  font-size: 12.5px;
  color: #e2e8f0;
}

.qsr-info span {
  font-size: 11px;
  color: #94a3b8;
}

.quiz-start-footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px max(16px, env(safe-area-inset-bottom, 16px));
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quiz-start-proceed-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
  border: 1px solid rgba(99, 102, 241, 0.6) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.quiz-start-proceed-btn:hover {
  background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%) !important;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .quiz-start-header {
    padding: 14px 18px;
    gap: 10px;
  }

  .quiz-start-header h3 {
    font-size: 16px;
  }

  .quiz-start-body {
    padding: 16px;
    gap: 12px;
  }

  .quiz-start-warning-card {
    padding: 12px 14px;
    gap: 10px;
  }

  .warning-prompt {
    font-size: 14px;
  }

  .quiz-start-footer {
    flex-direction: column-reverse;
    gap: 10px;
    padding: 12px 16px max(16px, env(safe-area-inset-bottom, 16px));
  }

  .quiz-start-footer .button {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 14px;
    touch-action: manipulation;
  }
}

.post-detail-page {
  padding-top: 14px !important;
  padding-bottom: 140px;
}

.post-detail-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.post-detail-top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 76px;
  z-index: 500;
  background: var(--paper);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-top: 0;
  margin-bottom: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  will-change: transform;
}

.post-detail-top-nav.top-nav-hidden {
  transform: translateY(-120%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.back-to-forum-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-to-forum-btn:hover {
  background: var(--sage-2);
  border-color: var(--sage-3);
  transform: translateX(-3px);
}

.post-detail-breadcrumb {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.post-detail-breadcrumb .bc-sep {
  opacity: 0.4;
}

.post-detail-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-detail-share-btn,
.post-detail-save-btn {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  transition: all 0.2s ease;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
}

.post-detail-share-btn:hover,
.post-detail-save-btn:hover {
  background: var(--sage-2);
}

.post-detail-save-btn.is-saved {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--sage-2);
}

.detail-action-frame {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid #becbc1;
  border-radius: 7px;
  box-sizing: border-box;
  white-space: nowrap;
}

.post-detail-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 36px;
  box-shadow: 0 4px 24px rgba(10, 35, 23, 0.05);
}

.post-detail-card .detail-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.35;
  margin: 10px 0 16px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.post-detail-card .detail-copy {
  font-size: 15.5px;
  line-height: 1.78;
  color: #24352b;
  margin: 22px 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 26px;
}

.post-detail-card .detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.post-detail-card .detail-response-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 24px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-detail-pinned-reply {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 32px));
  z-index: 99;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(8, 39, 25, 0.16);
  background: var(--paper);
  padding: 12px 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

body:has(#postDetail.active-page) .mobile-nav,
body:has(#postDetail.active-page) .mobile-fab {
  display: none !important;
}

@media (max-width: 768px) {
  .post-detail-page {
    padding-top: 10px !important;
    padding-bottom: 130px;
  }

  .post-detail-container {
    padding: 0 10px 32px;
  }

  .post-detail-top-nav {
    top: calc(64px + env(safe-area-inset-top, 0px));
    margin-top: 0;
    margin-bottom: 12px;
    padding: 8px 0;
  }

  .post-detail-share-btn,
  .post-detail-save-btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .detail-action-frame {
    min-height: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .back-to-forum-btn {
    padding: 7px 14px;
    font-size: 13px;
  }

  .post-detail-card {
    padding: 20px 14px;
    border-radius: 10px;
  }

  .post-detail-card .detail-title {
    font-size: 19px;
    margin: 8px 0 12px;
  }

  .post-detail-card .detail-copy {
    font-size: 14.5px;
    line-height: 1.65;
    margin: 16px 0;
    padding-bottom: 20px;
  }

  .post-detail-card .detail-actions {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .post-detail-breadcrumb {
    display: none;
  }

  .post-detail-pinned-reply {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 20px);
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(8, 39, 25, 0.18);
  }
}

/* --- CẢI TIẾN TRANG CÁ NHÂN MOBILE: 3 NÚT NẰM 1 HÀNG DƯỚI THÔNG TIN VÀ TRÊN THỐNG KÊ --- */
@media (max-width: 600px) {
  .account-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 16px !important;
    padding-bottom: 20px !important;
  }

  .account-header .profile-large {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
  }

  .change-avatar-btn {
    bottom: -2px !important;
    right: -4px !important;
    left: auto !important;
    transform: none !important;
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    background: var(--bg-card, #0f172a) !important;
    border: 1.5px solid var(--primary, #38bdf8) !important;
    color: var(--primary, #38bdf8) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .change-avatar-btn .change-avatar-text {
    display: none !important;
  }

  .change-avatar-btn .change-avatar-icon {
    width: 12px !important;
    height: 12px !important;
  }

  .change-avatar-btn:disabled {
    width: auto !important;
    min-width: 22px !important;
    height: 18px !important;
    padding: 0 5px !important;
    border-radius: 999px !important;
    font-size: 9px !important;
  }

  .account-header h1 {
    font-size: 24px !important;
    word-break: break-word !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    margin: 4px 0 2px !important;
  }

  .account-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 4px !important;
  }

  .account-actions .button {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px 6px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    text-align: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border-radius: 8px !important;
    min-height: 38px !important;
    display: inline-flex;
    align-items: center !important;
  }

  .account-actions .button[style*="display: none"],
  .account-actions .button[hidden],
  .account-actions .button.is-hidden {
    display: none !important;
  }

  .account-actions #logoutButton {
    grid-column: span 2 !important;
  }

  .account-actions #accountLoginBtn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    font-size: 14px !important;
    padding: 10px 16px !important;
  }
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-actions .button[style*="display: none"],
.account-actions .button[hidden],
.account-actions .button.is-hidden {
  display: none !important;
}

.account-actions #accountLoginBtn {
  min-width: 130px !important;
  padding: 9px 20px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

/* ============================================================
   NAMECARD (THẺ TÊN CÁ NHÂN) & TRANG TRÍ STYLES
   ============================================================ */

.namecard-modal,
dialog.modal.namecard-modal {
  /* Modal đóng vai trò là Viewport bao trùm cả khung trang trí lẫn thẻ namecard.
     Kích thước chuẩn trên PC: 780px x 890px (bao gồm 680px x 760px của thẻ + khoảng đệm khung hoa lá vươn ra ngoài).
     Trên mọi thiết bị, modal và toàn bộ sân khấu co giãn đồng nhất theo tỷ lệ đường chéo mà không bị trình duyệt cắt xén. */
  --nc-modal-w: 830px;
  --nc-modal-h: 930px;
  --nc-ratio: 830 / 930;

  width: min(var(--nc-modal-w), 96vw, calc(96vh * (830 / 930))) !important;
  max-width: var(--nc-modal-w) !important;
  height: calc(min(var(--nc-modal-w), 96vw, calc(96vh * (830 / 930))) * (930 / 830)) !important;
  max-height: min(var(--nc-modal-h), 96vh) !important;
  aspect-ratio: var(--nc-ratio) !important;

  border-radius: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  overscroll-behavior: none !important;
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  font-family: var(--sans) !important;
}

.namecard-modal::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
}

.namecard-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  color: #1e293b;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s ease;
}

.namecard-close-btn:hover {
  background: #ffffff;
  transform: scale(1.08);
}

.namecard-cover-actions {
  position: absolute;
  top: 16px;
  right: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 40;
  pointer-events: auto;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Nút xem/sửa ảnh bìa tự động ẩn khi cuộn xuống để không đè lên avatar & thông tin */
.namecard-cover-actions.nc-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(-8px) scale(0.9) !important;
}

/* Sân khấu NamecardStage: Luôn giữ nguyên kích thước chuẩn PC (680px x 760px),
   được đặt ở vị trí trung tâm modal để khung thoải mái vươn ra ngoài mà không bị dialog cắt cụt */
.namecard-stage {
  position: absolute;
  top: calc(85px * var(--nc-scale, 1));
  left: calc(75px * var(--nc-scale, 1));
  width: 680px;
  height: 760px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  transform-origin: top left;
  transform: scale(var(--nc-scale, 1));
}

/* 1. THÂN THẺ CANVAS: Chiếm trọn 100% stage, bo góc 60px chuẩn theo khung Chinh Phục Bầu Trời, đổ bóng sang trọng
   và OVERFLOW HIDDEN để CLIP hoàn hảo nội dung cuộn bên trong, không bao giờ bị trào ra ngoài đỉnh thẻ */
.namecard-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 60px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 30px 70px -15px rgba(15, 23, 42, 0.4);
  z-index: 10;
}


/* Stationary Cover Image - Cố định ở đỉnh canvas, mở rộng thêm 50px theo chiều dọc (265px) khớp khoảng đệm 250px của spacer */
.namecard-cover {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 265px;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #93c5fd 100%);
  background-size: cover;
  background-position: center;
  z-index: 1;
  pointer-events: none;
}

.namecard-view-cover-btn,
.namecard-edit-cover-btn {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--unbounded);
  letter-spacing: -0.2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.namecard-view-cover-btn:hover,
.namecard-edit-cover-btn:hover {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-1px);
}

/* Scrollable Card Body - Nằm trọn vẹn trong canvas, cuộn bên trong và được canvas clip tại mép */
.namecard-card {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100%;
  height: 100% !important;
  max-height: 100% !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  font-family: var(--sans);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Decorative frame lives above the card as an inert, absolute layer.
   Được scale theo chuẩn tỉ lệ của namecard stage. */
.namecard-frame-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: center / 100% 100% no-repeat;
  filter: drop-shadow(0 7px 14px rgba(15, 23, 42, 0.25));
  opacity: 0;
  transition: opacity 180ms ease;
}

.namecard-frame-layer[data-frame] {
  opacity: 1;
}

.namecard-frame-layer[data-frame="default"],
.namecard-frame-layer[data-frame="none"],
.namecard-frame-layer[data-frame=""] {
  opacity: 0;
  display: none;
}

/* 5 Khung nghệ thuật cao cấp */
.namecard-frame-layer[data-frame="leaves"] {
  background-image: url("frames/v2/leaves.png?v=5");
  inset: -42px -38px -61px -38px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="sakura"] {
  background-image: url("frames/v2/sakura.png?v=5");
  inset: -46px -42px -64px -42px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="ice"] {
  background-image: url("frames/v2/ice.png?v=5");
  inset: -54px -52px -58px -66px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="stars"] {
  background-image: url("frames/v2/stars.png?v=5");
  inset: -54px -50px -58px -66px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="gold"] {
  background-image: url("frames/v2/gold.png?v=8");
  inset: -34px -44px -34px -44px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="thung_lung_suong_thu"] {
  background-image: url("frames/v2/thung_lung_suong_thu.png?v=3");
  inset: -36px -44px -36px -44px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="thien_ha_huyen_ao"] {
  background-image: url("frames/v2/thien_ha_huyen_ao.png?v=3");
  inset: -32px -44px -32px -44px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="pha_le_hoang_gia"] {
  background-image: url("frames/v2/pha_le_hoang_gia.png?v=3");
  inset: -34px -46px -34px -46px;
  background-size: 100% 100%;
}

/* Khung hoạt động giới hạn */
.namecard-frame-layer[data-frame="chinh_phuc_bau_troi"] {
  background-image: url("frames/v2/chinh_phuc_bau_troi.png?v=1");
  inset: -50px -71px -61px -64px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="ton_vinh_phai_dep"] {
  background-image: url("frames/v2/ton_vinh_phai_dep.png?v=2");
  inset: -46px -29px -45px -41px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="bua_tiec_ma_mi"] {
  background-image: url("frames/v2/bua_tiec_ma_mi.png?v=2");
  inset: -52px -40px -53px -42px;
  background-size: 100% 100%;
}

.namecard-frame-layer[data-frame="phep_mau_mua_dong"] {
  background-image: url("frames/v2/phep_mau_mua_dong.png?v=5");
  inset: -34px -38px -34px -40px;
  background-size: 100% 100%;
}

/* Khung cơ bản miễn phí (độ dày 12px, bo góc ngoài 60px - bo góc trong chuẩn công thức: 60px - 12px = 48px) */
.namecard-frame-layer[data-frame^="basic_"] {
  inset: 0px;
  border-radius: 60px;
  background: none;
  pointer-events: none;
  z-index: 25;
}

.namecard-frame-layer[data-frame="basic_ocean"] {
  border: 12px solid transparent;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #93c5fd 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.35);
}

.namecard-frame-layer[data-frame="basic_emerald"] {
  border: 12px solid transparent;
  background: linear-gradient(135deg, #064e3b 0%, #059669 50%, #6ee7b7 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35);
}

.namecard-frame-layer[data-frame="basic_sunset"] {
  border: 12px solid transparent;
  background: linear-gradient(135deg, #4c0519 0%, #db2777 50%, #fcd34d 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 16px rgba(219, 39, 119, 0.35);
}

.namecard-frame-layer[data-frame="basic_aurora"] {
  border: 12px solid transparent;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #4338ca 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 16px rgba(67, 56, 202, 0.35);
}

.namecard-frame-layer[data-frame="basic_royal"] {
  border: 12px solid transparent;
  background: linear-gradient(135deg, #3b0764 0%, #7c3aed 50%, #c084fc 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.35);
}

.namecard-frame-layer[data-frame="basic_midnight"] {
  border: 12px solid #0f172a;
  box-shadow: 0 0 16px rgba(15, 23, 42, 0.3);
}

.namecard-frame-layer[data-frame="basic_slate"] {
  border: 12px solid #334155;
  box-shadow: 0 0 16px rgba(51, 65, 85, 0.3);
}

.namecard-frame-layer[data-frame="basic_deep_green"] {
  border: 12px solid #064e3b;
  box-shadow: 0 0 16px rgba(6, 78, 59, 0.3);
}

.namecard-frame-layer[data-frame="basic_pure_black"] {
  border: 12px solid #18181b;
  box-shadow: 0 0 16px rgba(24, 24, 27, 0.35);
}


/* Thumbnails xem trước trong bộ chọn frame */
.frame-choice-preview {
  width: 100%;
  height: 60px;
  margin-bottom: 6px;
  border-radius: 8px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-color: transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-choice-preview[data-frame-preview="none"],
.frame-choice-preview[data-frame-preview="default"] {
  border: 1.5px dashed #cbd5e1;
  background: #f8fafc;
}

.frame-choice-preview[data-frame-preview="none"]::after,
.frame-choice-preview[data-frame-preview="default"]::after {
  content: "✕ Không khung";
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
}

/* 5 ảnh thumb cao cấp chính thức */
.frame-choice-preview[data-frame-preview="leaves"] {
  background-image: url("frames/v2/thumbs/leaves.png?v=6");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="stars"] {
  background-image: url("frames/v2/thumbs/stars.png?v=6");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="gold"] {
  background-image: url("frames/v2/thumbs/gold.png?v=7");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="thung_lung_suong_thu"] {
  background-image: url("frames/v2/thumbs/thung_lung_suong_thu.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="thien_ha_huyen_ao"] {
  background-image: url("frames/v2/thumbs/thien_ha_huyen_ao.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="pha_le_hoang_gia"] {
  background-image: url("frames/v2/thumbs/pha_le_hoang_gia.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="sakura"] {
  background-image: url("frames/v2/thumbs/sakura.png?v=6");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="ice"] {
  background-image: url("frames/v2/thumbs/ice.png?v=6");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="chinh_phuc_bau_troi"] {
  background-image: url("frames/v2/thumbs/chinh_phuc_bau_troi.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="ton_vinh_phai_dep"] {
  background-image: url("frames/v2/thumbs/ton_vinh_phai_dep.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="bua_tiec_ma_mi"] {
  background-image: url("frames/v2/thumbs/bua_tiec_ma_mi.png?v=1");
  background-size: 100% 100%;
}

.frame-choice-preview[data-frame-preview="phep_mau_mua_dong"] {
  background-image: url("frames/v2/thumbs/phep_mau_mua_dong.png?v=3");
  background-size: 100% 100%;
}

/* Khung cơ bản miễn phí swatch (viền 4px, góc ngoài 8px - góc trong chuẩn: 8px - 4px = 4px) */
.frame-choice-preview[data-frame-preview="basic_ocean"] {
  border: 4px solid transparent;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #93c5fd 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.frame-choice-preview[data-frame-preview="basic_emerald"] {
  border: 4px solid transparent;
  background: linear-gradient(135deg, #064e3b 0%, #059669 50%, #6ee7b7 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.frame-choice-preview[data-frame-preview="basic_sunset"] {
  border: 4px solid transparent;
  background: linear-gradient(135deg, #4c0519 0%, #db2777 50%, #fcd34d 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.frame-choice-preview[data-frame-preview="basic_aurora"] {
  border: 4px solid transparent;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #4338ca 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.frame-choice-preview[data-frame-preview="basic_royal"] {
  border: 4px solid transparent;
  background: linear-gradient(135deg, #3b0764 0%, #7c3aed 50%, #c084fc 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.frame-choice-preview[data-frame-preview="basic_midnight"] {
  border: 4px solid #0f172a;
  background: #f8fafc;
}

.frame-choice-preview[data-frame-preview="basic_slate"] {
  border: 4px solid #334155;
  background: #f8fafc;
}

.frame-choice-preview[data-frame-preview="basic_deep_green"] {
  border: 4px solid #064e3b;
  background: #f8fafc;
}

.frame-choice-preview[data-frame-preview="basic_pure_black"] {
  border: 4px solid #18181b;
  background: #f8fafc;
}

.choice-unlock-badge {
  margin-top: 3px;
  color: #39714a;
  font-size: 10px;
  font-weight: 700;
}

.namecard-card[data-frame] {
  border: 0;
  box-shadow: none;
}


/* Spacer allowing fixed cover behind to be visible at top (tăng thêm 50px dọc từ 200px lên 250px) */
.namecard-cover-spacer {
  height: 250px;
  flex-shrink: 0;
  pointer-events: none;
}

/* Content Container that slides OVER the stationary cover (chuẩn nested corner: R_outer(60px) - basic_border(12px) = 48px) */
.namecard-content-wrap {
  position: relative;
  z-index: 3;
  background: #ffffff;
  border-radius: 48px 48px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.06);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.namecard-edit-name-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--unbounded);
  letter-spacing: -0.2px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
  transition: all 0.15s ease;
}

.namecard-edit-name-btn:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Header */
.namecard-header {
  padding: 0 28px 18px;
  display: flex;
  flex-direction: column;
  position: relative;
  font-family: var(--sans);
}

.namecard-profile-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-top: -52px;
  width: 100%;
}

.namecard-avatar-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  flex-shrink: 0;
  margin-left: 10px;
}

.namecard-avatar-circle {
  width: 104px !important;
  height: 104px !important;
  flex-shrink: 0 !important;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  font-size: 52px !important;
  position: relative;
  overflow: visible;
  --ring-inset: -7.5px;
  --ring-width: 4px;
  user-select: none;
  box-sizing: border-box;
  padding: 0;
  transition: all 0.3s ease;
}

#namecardAvatar,
.namecard-avatar-circle>span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  text-indent: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 3;
  pointer-events: none;
}

/* Streak Tier Avatar Frames & Glow for Namecard (Stands still in place, no zoom) */
.namecard-avatar-circle.avatar-tier-2 {
  border: 4px solid #ffffff;
  box-shadow: 0 0 0 4.5px #f59f00, 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.namecard-avatar-circle.avatar-tier-3 {
  background: linear-gradient(135deg, #5f3dc4 0%, #7048e8 50%, #845ef7 100%) !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
}

.namecard-avatar-circle.avatar-tier-4 {
  background: linear-gradient(135deg, #c92a2a 0%, #e03131 50%, #ff6b6b 100%) !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
}

.namecard-avatar-circle.avatar-tier-5 {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 40%, #c45b83 80%, #e8a9c1 100%) !important;
  background-size: 220% 220% !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
  animation: roseQuartzBgShift 12s ease-in-out infinite;
  -webkit-animation: roseQuartzBgShift 12s ease-in-out infinite;
}

.namecard-avatar-circle.avatar-tier-6 {
  background: linear-gradient(135deg, #5f3dc4 0%, #a61e4d 45%, #e03131 85%, #f783ac 100%) !important;
  background-size: 250% 250% !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
  animation: mythicBgShift 12s ease-in-out infinite;
  -webkit-animation: mythicBgShift 12s ease-in-out infinite;
}

.namecard-avatar-circle.avatar-tier-7 {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 35%, #6366f1 70%, #ec4899 100%) !important;
  background-size: 300% 300% !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
  animation: superNeonShift 12s ease-in-out infinite;
  -webkit-animation: superNeonShift 12s ease-in-out infinite;
}

.namecard-avatar-circle.avatar-tier-8 {
  background: linear-gradient(135deg, #090d16 0%, #1e293b 30%, #94a3b8 65%, #ffffff 100%) !important;
  background-size: 260% 260% !important;
  color: #ffffff !important;
  border: 4px solid #ffffff;
  box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.95), 0 0 20px rgba(255, 255, 255, 0.6) !important;
  animation: diamondSheen 12s ease-in-out infinite;
  -webkit-animation: diamondSheen 12s ease-in-out infinite;
}

.namecard-identity {
  padding-top: 56px;
  flex: 1;
  min-width: 0;
}

.namecard-display-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: #0a2a20 !important;
  -webkit-text-fill-color: #0a2a20 !important;
  line-height: 1.25;
  letter-spacing: -0.3px;
  word-break: break-word;
}

.namecard-modal .namecard-display-name,
.namecard-canvas .namecard-display-name,
body.dark-theme .namecard-modal .namecard-display-name,
body.dark-theme .namecard-canvas .namecard-display-name,
.namecard-modal .namecard-display-name.user-name-tier-0,
.namecard-modal .namecard-display-name.user-name-tier-1,
.namecard-modal .namecard-display-name.user-name-tier-2,
.namecard-modal .namecard-display-name.user-name-default,
.namecard-canvas .namecard-display-name.user-name-tier-0,
.namecard-canvas .namecard-display-name.user-name-tier-1,
.namecard-canvas .namecard-display-name.user-name-tier-2,
.namecard-canvas .namecard-display-name.user-name-default,
body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-0,
body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-1,
body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-2,
body.dark-theme .namecard-modal .namecard-display-name.user-name-default,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-0,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-1,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-2,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-default {
  color: #0a2a20 !important;
  -webkit-text-fill-color: #0a2a20 !important;
}

.namecard-display-name.user-name-tier-3,
.namecard-modal .namecard-display-name.user-name-tier-3,
.namecard-canvas .namecard-display-name.user-name-tier-3,
body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-3,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-3 {
  color: #7048e8 !important;
  -webkit-text-fill-color: #7048e8 !important;
}

.namecard-display-name.user-name-tier-4,
.namecard-modal .namecard-display-name.user-name-tier-4,
.namecard-canvas .namecard-display-name.user-name-tier-4,
body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-4,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-4 {
  color: #e03131 !important;
  -webkit-text-fill-color: #e03131 !important;
}

.namecard-display-name.user-name-tier-5,
.namecard-modal .namecard-display-name.user-name-tier-5,
.namecard-canvas .namecard-display-name.user-name-tier-5 {
  background-image: linear-gradient(90deg,
      #57223b 0%,
      #8a3157 25%,
      #b04373 50%,
      #8a3157 75%,
      #57223b 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800;
  display: inline-block !important;
  vertical-align: middle;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-5,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-5 {
  background-image: linear-gradient(90deg,
      #c45b83 0%,
      #f472b6 35%,
      #fbcfe8 60%,
      #f472b6 85%,
      #c45b83 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

.namecard-display-name.user-name-tier-6,
.namecard-modal .namecard-display-name.user-name-tier-6,
.namecard-canvas .namecard-display-name.user-name-tier-6 {
  background-image: linear-gradient(90deg,
      #5c35c9 0%,
      #a61e4d 30%,
      #c2255c 60%,
      #7048e8 85%,
      #5c35c9 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800;
  display: inline-block !important;
  vertical-align: middle;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-6,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-6 {
  background-image: linear-gradient(90deg,
      #7048e8 0%,
      #d6336c 25%,
      #ff6b6b 50%,
      #f783ac 75%,
      #7048e8 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

.namecard-display-name.user-name-tier-7,
.namecard-modal .namecard-display-name.user-name-tier-7,
.namecard-canvas .namecard-display-name.user-name-tier-7 {
  background-image: linear-gradient(90deg,
      #00875a 0%,
      #0070ba 30%,
      #4f46e5 60%,
      #be185d 85%,
      #00875a 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800;
  display: inline-block !important;
  vertical-align: middle;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-7,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-7 {
  background-image: linear-gradient(90deg,
      #00f59b 0%,
      #00d2ff 30%,
      #818cf8 60%,
      #ec4899 85%,
      #00f59b 100%) !important;
  background-size: 200% 100% !important;
  animation: shimmerName 8.5s ease-in-out infinite !important;
  -webkit-animation: shimmerName 8.5s ease-in-out infinite !important;
}

.namecard-display-name.user-name-tier-8,
.namecard-modal .namecard-display-name.user-name-tier-8,
.namecard-canvas .namecard-display-name.user-name-tier-8 {
  background-image: linear-gradient(90deg,
      #0f172a 0%,
      #1e293b 25%,
      #475569 50%,
      #1e293b 75%,
      #0f172a 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800;
  display: inline-block !important;
  vertical-align: middle;
  text-shadow: none !important;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7)) !important;
  animation: diamondShimmer 9s ease-in-out infinite !important;
  -webkit-animation: diamondShimmer 9s ease-in-out infinite !important;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

body.dark-theme .namecard-modal .namecard-display-name.user-name-tier-8,
body.dark-theme .namecard-canvas .namecard-display-name.user-name-tier-8 {
  background-image: linear-gradient(90deg,
      #94a3b8 0%,
      #cbd5e1 25%,
      #ffffff 50%,
      #cbd5e1 75%,
      #94a3b8 100%) !important;
  background-size: 200% 100% !important;
  background-repeat: repeat-x !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  color: transparent !important;
  font-weight: 800;
  display: inline-block !important;
  vertical-align: middle;
  text-shadow: none !important;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.4)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)) !important;
  animation: diamondShimmer 9s ease-in-out infinite !important;
  -webkit-animation: diamondShimmer 9s ease-in-out infinite !important;
  will-change: background-position;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.namecard-badges {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-top: 6px;
}

.namecard-role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f5e9;
  color: #1b5e20;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--unbounded);
  letter-spacing: -0.2px;
  border: 1px solid #c8e6c9;
  white-space: nowrap;
}

.namecard-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--unbounded);
  letter-spacing: -0.2px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.namecard-id-badge:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.namecard-bio {
  width: calc(100% - 10px);
  padding: 0;
  margin: 14px 0 0 10px;
  box-sizing: border-box;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted, #66746d);
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-word;
}

/* Bố cục Namecard được chuẩn hóa đồng nhất trên mọi kích cỡ */

/* Sections Body (khôi phục căn lề mép ngoài chuẩn xác đồng bộ với header: padding 28px) */
.namecard-body {
  padding: 0 28px 90px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: var(--sans);
}

.namecard-block {
  background: #f8fafc;
  border: 1px solid #eef2f6;
  border-radius: 20px;
  padding: 18px 20px;
}

.namecard-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.namecard-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.namecard-block-title .nc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.namecard-block-title h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-deep, #0a2a20);
}

/* Horizontal Scrolling Tiles Row - chống rối, chống rớt chữ, tự động kéo dài theo nội dung */
.namecard-tiles {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.16) transparent;
}

.namecard-tiles::-webkit-scrollbar {
  height: 4px;
}

.namecard-tiles::-webkit-scrollbar-track {
  background: transparent;
}

.namecard-tiles::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 999px;
}

.namecard-tiles::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.namecard-tiles-5,
.namecard-tiles-6 {
  display: flex;
  gap: 10px;
}

.namecard-tiles-5 .namecard-tile,
.namecard-tiles-6 .namecard-tile {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 12px 16px;
}

.namecard-tiles-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  overflow-x: visible;
  padding-bottom: 2px;
}

.namecard-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.namecard-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.nc-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.nc-tile-icon svg {
  display: block;
}

.nc-tile-val {
  font-family: var(--unbounded);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-deep, #0a2a20);
  line-height: 1.25;
  margin-bottom: 4px;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.nc-tile-lbl {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--muted, #66746d);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

/* Horizontal tile (Tự học) */
.namecard-tile.horizontal {
  flex-direction: row;
  text-align: left;
  padding: 14px 18px;
  gap: 14px;
  justify-content: flex-start;
  min-width: 0;
}

.namecard-tile.horizontal .nc-tile-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  margin-bottom: 0;
}

.namecard-tile.horizontal .nc-tile-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.namecard-tile.horizontal .nc-tile-val {
  font-family: var(--unbounded);
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.3px;
}

.namecard-tile.horizontal .nc-tile-lbl {
  font-family: var(--sans);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   NAMECARD INTERNAL USER PROFILE (ADMIN ONLY)
   ========================================== */

.namecard-internal-block {
  border: 1px dashed rgba(99, 102, 241, 0.4) !important;
  background: rgba(99, 102, 241, 0.03) !important;
  border-radius: 14px;
  padding: 12px 14px;
}

.nc-admin-table {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.nc-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.nc-admin-row:last-child {
  border-bottom: none;
}

.nc-admin-lbl {
  width: 78px;
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
}

.nc-admin-val {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
  font-family: var(--sans);
}

.nc-admin-copy-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.nc-admin-copy-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
  transform: translateY(-1px);
}

.nc-admin-copy-btn:active {
  transform: translateY(0);
}

.nc-copy-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nc-copy-all-btn:hover {
  background: #eef2ff;
  border-color: #4f46e5;
  transform: translateY(-1px);
}

.nc-copy-all-btn:active {
  transform: translateY(0);
}


/* ==========================================
   FULL COVER VIEWER MODAL (LIGHTBOX)
   ========================================== */

.full-cover-viewer-modal,
dialog.modal.full-cover-viewer-modal {
  max-width: 92vw !important;
  width: 960px !important;
  padding: 0 !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  background: #090d16 !important;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  z-index: 100 !important;
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
}

.full-cover-viewer-modal::backdrop {
  background: rgba(10, 15, 25, 0.85) !important;
  backdrop-filter: blur(8px) !important;
}

.full-cover-viewer-modal .namecard-close-btn {
  top: 14px;
  right: 14px;
  z-index: 110;
}

.full-cover-viewer-body {
  width: 100%;
  max-height: 82vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #090d16;
  padding: 0;
  overflow: hidden;
}

.full-cover-viewer-body img {
  width: 100%;
  height: auto;
  max-height: 82vh;
  object-fit: contain;
  display: block;
}

/* ==========================================
   EDIT PROFILE & NAMECARD MODAL PICKERS
   ========================================== */

.account-security-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #166534;
  margin-bottom: 14px;
}

.avatar-selection-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-choice-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  font-size: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  letter-spacing: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.avatar-choice-btn:hover {
  border-color: var(--primary, #0f172a);
  transform: scale(1.08);
}

.avatar-choice-btn.active {
  border-color: var(--primary, #0f172a);
  background: #f1f5f9;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.15);
}

.frame-selection-grid,
.cover-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;
}

.frame-choice-item,
.cover-choice-item {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.frame-choice-item:hover,
.cover-choice-item:hover {
  border-color: #94a3b8;
}

.frame-choice-item.active,
.cover-choice-item.active {
  border-color: var(--primary, #0f172a);
  background: #f8fafc;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.15);
}

.frame-choice-item.locked,
.cover-choice-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.choice-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.choice-preview-box {
  width: 100%;
  height: 32px;
  border-radius: 8px;
  margin-bottom: 4px;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.choice-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.choice-lock-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 11px;
}

/* Namecard uses unified PC/mobile geometry locked to aspect-ratio 680/760 with diagonal scaling */

/* Must follow the retired prototype frame rules above: frames never consume
   content space or alter card geometry. */
.namecard-card[data-frame] {
  border: 0;
  box-shadow: none;
}

/* ==========================================
   NAMECARD EDIT MODAL: FLOATING POP-UP SAVE BUTTON
   ========================================== */

.namecard-sticky-actions {
  position: sticky;
  bottom: 8px;
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transform: translateY(22px) scale(0.92);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.namecard-sticky-actions.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.namecard-dirty-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 4px 16px rgba(10, 42, 32, 0.08);
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  pointer-events: auto;
  user-select: none;
}

.namecard-dirty-indicator .dirty-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
  animation: dirtyDotPulse 1.6s infinite;
}

@keyframes dirtyDotPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
  }

  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

.namecard-save-floating-btn {
  pointer-events: auto;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.96rem;
  padding: 10px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1b5e20 0%, #123d30 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(18, 61, 48, 0.38), 0 0 0 2.5px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.2px;
}

.namecard-sticky-actions.visible .namecard-save-floating-btn {
  animation: saveBtnPopAttention 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes saveBtnPopAttention {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.85);
  }

  65% {
    transform: translateY(-4px) scale(1.06);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.namecard-save-floating-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 28px rgba(18, 61, 48, 0.48), 0 0 0 2.5px #ffffff;
  background: linear-gradient(135deg, #226e29 0%, #164e3e 100%);
}

.namecard-save-floating-btn:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 480px) {
  .namecard-dirty-indicator span:last-child {
    display: none;
  }

  .namecard-dirty-indicator {
    padding: 7px 8px;
  }

  .namecard-save-floating-btn {
    padding: 9px 24px;
    font-size: 0.92rem;
  }
}

/* ========================================================
   NAMECARD STUDIO: SPLIT-SCREEN REALTIME REDESIGN
   ======================================================== */

.namecard-studio-modal,
dialog.modal.namecard-studio-modal {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: min(1080px, calc(100vw - 36px)) !important;
  max-width: 1080px !important;
  height: min(86vh, 760px) !important;
  max-height: 760px !important;
  border-radius: 20px !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 25px 70px -15px rgba(15, 23, 42, 0.35) !important;
  z-index: 1000 !important;
}

body.dark-theme .namecard-studio-modal,
body.dark-theme dialog.modal.namecard-studio-modal {
  background: #0f172a !important;
  border-color: #334155 !important;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.6) !important;
}

.namecard-studio-container {
  display: flex;
  flex-direction: row;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* LEFT PANE: Editor */
.namecard-studio-editor {
  flex: 0 0 520px;
  width: 520px;
  max-width: 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
  position: relative;
  border-right: 1px solid var(--border);
}

body.dark-theme .namecard-studio-editor {
  background: #0f172a;
  border-right-color: #334155;
}

.namecard-studio-head {
  padding: 16px 22px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  min-width: 0;
}

body.dark-theme .namecard-studio-head {
  background: #0f172a;
  border-color: #334155;
}

.studio-title-wrap {
  flex: 1;
  min-width: 0;
}

.studio-title-wrap .studio-eyebrow {
  display: block;
  font-family: var(--unbounded);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary, #1e3a8a);
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

.studio-title-wrap h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink-deep, #0a2a20);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-theme .studio-title-wrap h2 {
  color: #f8fafc;
}

.studio-close-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.studio-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

body.dark-theme .studio-close-btn:hover {
  background: #1e293b;
  color: #f8fafc;
}

/* NAVIGATION BAR (SVG Icons only, no text) */
.studio-nav-bar {
  display: flex;
  gap: 10px;
  padding: 10px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  position: relative;
}

body.dark-theme .studio-nav-bar {
  background: #111c30;
  border-color: #334155;
}

.studio-nav-btn {
  width: 44px;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: #ffffff;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
}

body.dark-theme .studio-nav-btn {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

.studio-nav-btn:hover {
  color: var(--primary, #2563eb);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.studio-nav-btn.active {
  background: #eff6ff;
  color: #2563eb;
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.16);
}

body.dark-theme .studio-nav-btn.active {
  background: #1e3a8a;
  color: #bfdbfe;
  border-color: #3b82f6;
}

/* Tooltip for SVG nav button */
.studio-nav-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.studio-nav-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(8px);
}

/* Form & Panels */
.studio-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 80px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.studio-panel {
  display: none;
}

.studio-panel.active {
  display: block;
  animation: studioFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes studioFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.studio-field {
  margin-bottom: 20px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.field-label-row label {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-deep, #0a2a20);
  margin: 0;
}

body.dark-theme .field-label-row label {
  color: #f1f5f9;
}

.field-char-count {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: var(--unbounded);
}

.avatar-notice-pill {
  font-size: 0.78rem;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.custom-avatar-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.custom-avatar-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
}

/* Sub-tab Pill Group */
.sub-tab-pill-group {
  display: flex;
  width: 100%;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

body.dark-theme .sub-tab-pill-group {
  background: #111c30;
  border-color: #334155;
}

.sub-tab-pill {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

body.dark-theme .sub-tab-pill {
  color: #94a3b8;
}

.sub-tab-pill.active {
  background: #ffffff;
  color: var(--primary, #0f172a);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

body.dark-theme .sub-tab-pill.active {
  background: #1e293b;
  color: #f8fafc;
}

.studio-section-notice {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.studio-sub-panel {
  display: none;
}

.studio-sub-panel.active {
  display: block;
}

/* Badges for items */
.choice-unlock-badge.badge-available {
  background: #dcfce7 !important;
  color: #15803d !important;
  font-weight: 700 !important;
  border: 1px solid #bbf7d0 !important;
}

.choice-unlock-badge.badge-countdown {
  background: #fef3c7 !important;
  color: #b45309 !important;
  font-weight: 700 !important;
  border: 1px solid #fde68a !important;
}

.choice-unlock-badge.badge-permanent {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  font-weight: 700 !important;
  border: 1px solid #bae6fd !important;
}

/* Custom cover upload styling */
.custom-cover-upload-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.studio-upload-btn {
  width: 100%;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
}

.custom-cover-preview-box {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  height: 90px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.custom-cover-preview-box button {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.custom-cover-preview-box button:hover {
  background: #ef4444;
}

/* Sticky Action Bar Buttons */
.studio-actions-btns {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* RIGHT PANE: LIVE INTERACTIVE PREVIEW */
.namecard-studio-preview {
  flex: 0 0 440px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

body.dark-theme .namecard-studio-preview {
  background: linear-gradient(180deg, #0b1120 0%, #111827 100%);
  border-color: #334155;
}

.studio-preview-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
}

.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: var(--unbounded);
  border: 1px solid rgba(147, 197, 253, 0.5);
  letter-spacing: -0.2px;
}

body.dark-theme .preview-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.preview-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  animation: studioPulse 1.8s infinite;
}

@keyframes studioPulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
  }

  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(59, 130, 246, 0);
  }

  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.preview-hint {
  font-size: 0.76rem;
  color: var(--muted);
}

/* Scaler for live demo Namecard stage */
.studio-stage-scaler {
  --demo-scale: 0.52;
  width: calc(680px * var(--demo-scale));
  height: calc(760px * var(--demo-scale));
  position: relative;
  margin: 0 auto;
  flex-shrink: 0;
  border-radius: calc(60px * var(--demo-scale));
  box-shadow: 0 20px 50px -15px rgba(15, 23, 42, 0.25);
}

.studio-stage-scaler .namecard-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  transform: scale(var(--demo-scale));
  pointer-events: none;
}

/* CONFIRM DISCARD MODAL */
.confirm-discard-modal,
dialog.modal.confirm-discard-modal {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  border-radius: 20px !important;
  padding: 0 !important;
  max-width: 440px !important;
  width: 90vw !important;
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.5) !important;
  overflow: hidden !important;
  z-index: 1100 !important;
}

body.dark-theme .confirm-discard-modal {
  background: #0f172a;
  border-color: #334155;
}

.confirm-modal-box {
  padding: 28px 24px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.confirm-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

body.dark-theme .confirm-modal-icon {
  background: rgba(245, 158, 11, 0.15);
}

.confirm-modal-title {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.35;
}

body.dark-theme .confirm-modal-title {
  color: #f8fafc;
}

.confirm-modal-desc {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 24px;
}

body.dark-theme .confirm-modal-desc {
  color: #94a3b8;
}

.confirm-modal-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.confirm-modal-actions button {
  flex: 1;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 10px;
}

/* RESPONSIVE LAYOUT */
@media (max-width: 860px) {

  .namecard-studio-modal,
  dialog.modal.namecard-studio-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    width: 95vw !important;
    max-width: 480px !important;
    height: 92vh !important;
    max-height: 92vh !important;
    z-index: 1000 !important;
  }

  .namecard-studio-container {
    flex-direction: column;
    height: 100%;
    max-height: none;
  }

  .namecard-studio-preview {
    order: -1;
    flex: 0 0 auto;
    padding: 12px 14px 16px;
    border-left: none;
    border-bottom: 1px solid var(--border);
    max-height: 290px;
  }

  .studio-preview-head {
    margin-bottom: 8px;
  }

  .studio-stage-scaler {
    --demo-scale: 0.32;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.2);
  }

  .namecard-studio-editor {
    flex: 1;
    width: 100%;
    max-width: 100%;
    border-right: none;
    overflow-y: auto;
  }

  .namecard-studio-head {
    padding: 12px 16px 10px;
  }

  .studio-title-wrap h2 {
    font-size: 1.15rem;
    white-space: normal;
  }

  .studio-form {
    padding: 14px 16px 80px;
  }
}

/* ========================================================
   NAMECARD LIKES / FAVORITES WIDGET
   ======================================================== */
.namecard-like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.namecard-like-btn .nc-heart-icon {
  width: 15px;
  height: 15px;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), fill 0.2s ease;
  flex-shrink: 0;
  display: block;
}

.namecard-like-btn .nc-like-count {
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: -0.2px;
}

.namecard-like-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.04);
}

.namecard-like-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.namecard-like-btn.animate-pop .nc-heart-icon {
  animation: heartPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.45);
  }

  100% {
    transform: scale(1);
  }
}

/* Animation chú ý / highlight nút tim khi truy cập qua banner Cập nhật Namecard */
.namecard-like-btn.highlight-heart-attention {
  animation: heartBtnAttentionBounce 2.5s cubic-bezier(0.25, 1, 0.5, 1);
  border-color: #f43f5e !important;
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.28), 0 4px 16px rgba(244, 63, 94, 0.35) !important;
}

.namecard-like-btn.highlight-heart-attention .nc-heart-icon {
  animation: heartIconAttentionPulse 1.25s ease-in-out 2;
  color: #f43f5e !important;
  fill: #f43f5e !important;
}

@keyframes heartBtnAttentionBounce {

  0%,
  100% {
    transform: scale(1);
  }

  15%,
  45% {
    transform: translateY(-4px) scale(1.14);
    box-shadow: 0 0 0 6px rgba(244, 63, 94, 0.4), 0 6px 20px rgba(244, 63, 94, 0.45);
  }

  30% {
    transform: translateY(0) scale(1.05);
  }

  60% {
    transform: translateY(0) scale(1);
  }
}

@keyframes heartIconAttentionPulse {

  0%,
  100% {
    transform: scale(1);
  }

  35% {
    transform: scale(1.45);
  }

  70% {
    transform: scale(1.15);
  }
}

/* Tier-based Theme Colors for Namecard Like Widget */
/* Tier 0 & 1 (Default / <= 6 days): Emerald Green */
.namecard-like-btn[data-streak-tier="0"],
.namecard-like-btn[data-streak-tier="1"],
.namecard-like-btn:not([data-streak-tier]) {
  color: #1e5d46;
  border-color: rgba(30, 93, 70, 0.3);
  background: rgba(30, 93, 70, 0.06);
}

.namecard-like-btn[data-streak-tier="0"]:hover,
.namecard-like-btn[data-streak-tier="1"]:hover {
  background: rgba(30, 93, 70, 0.12);
  border-color: #1e5d46;
}

.namecard-like-btn[data-streak-tier="0"].has-liked,
.namecard-like-btn[data-streak-tier="1"].has-liked {
  background: rgba(30, 93, 70, 0.14);
  border-color: #1e5d46;
}

.namecard-like-btn[data-streak-tier="0"].has-liked .nc-heart-icon,
.namecard-like-btn[data-streak-tier="1"].has-liked .nc-heart-icon {
  fill: #1e5d46;
}

/* Tier 2 (7 - 13 days): Amber / Gold */
.namecard-like-btn[data-streak-tier="2"] {
  color: #b45309;
  border-color: rgba(180, 83, 9, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.namecard-like-btn[data-streak-tier="2"]:hover {
  background: rgba(245, 158, 11, 0.15);
  border-color: #b45309;
}

.namecard-like-btn[data-streak-tier="2"].has-liked {
  background: rgba(245, 158, 11, 0.18);
  border-color: #b45309;
}

.namecard-like-btn[data-streak-tier="2"].has-liked .nc-heart-icon {
  fill: #b45309;
}

/* Tier 3 (14 - 29 days): Violet / Amethyst */
.namecard-like-btn[data-streak-tier="3"] {
  color: #6d28d9;
  border-color: rgba(109, 40, 217, 0.35);
  background: rgba(109, 40, 217, 0.08);
}

.namecard-like-btn[data-streak-tier="3"]:hover {
  background: rgba(109, 40, 217, 0.15);
  border-color: #6d28d9;
}

.namecard-like-btn[data-streak-tier="3"].has-liked {
  background: rgba(109, 40, 217, 0.18);
  border-color: #6d28d9;
}

.namecard-like-btn[data-streak-tier="3"].has-liked .nc-heart-icon {
  fill: #6d28d9;
}

/* Tier 4 (30 - 49 days): Ruby / Red */
.namecard-like-btn[data-streak-tier="4"] {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.38);
  background: rgba(220, 38, 38, 0.08);
}

.namecard-like-btn[data-streak-tier="4"]:hover {
  background: rgba(220, 38, 38, 0.16);
  border-color: #dc2626;
}

.namecard-like-btn[data-streak-tier="4"].has-liked {
  background: rgba(220, 38, 38, 0.2);
  border-color: #dc2626;
}

.namecard-like-btn[data-streak-tier="4"].has-liked .nc-heart-icon {
  fill: #dc2626;
}

/* Tier 5 (50-99d): Rose Quartz */
.namecard-like-btn[data-streak-tier="5"] {
  background: linear-gradient(135deg, rgba(87, 34, 59, 0.12) 0%, rgba(138, 49, 87, 0.16) 50%, rgba(196, 91, 131, 0.2) 100%);
  color: #8a3157;
  border-width: 1.5px;
  border-style: solid;
  border-color: #c45b83;
  box-shadow: 0 0 10px rgba(196, 91, 131, 0.25);
}

.namecard-like-btn[data-streak-tier="5"] .nc-heart-icon {
  fill: #c45b83;
}

.namecard-like-btn[data-streak-tier="5"]:hover {
  box-shadow: 0 0 14px rgba(196, 91, 131, 0.4);
}

.namecard-like-btn[data-streak-tier="5"].has-liked {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 50%, #c45b83 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 14px rgba(196, 91, 131, 0.45);
}

.namecard-like-btn[data-streak-tier="5"].has-liked .nc-heart-icon {
  fill: #ffffff;
}

/* Tier 6 (100-199d): Mythic Prism */
.namecard-like-btn[data-streak-tier="6"] {
  background: linear-gradient(135deg, rgba(95, 61, 196, 0.15) 0%, rgba(166, 30, 77, 0.18) 35%, rgba(224, 49, 49, 0.18) 70%, rgba(247, 131, 172, 0.2) 100%);
  background-size: 300% 300%;
  animation: dynamicHeartColorShift 4s ease-in-out infinite alternate;
  color: #e03131;
  border-width: 1.5px;
  border-style: solid;
  border-color: #e03131;
  box-shadow: 0 0 10px rgba(224, 49, 49, 0.25);
}

.namecard-like-btn[data-streak-tier="6"] .nc-heart-icon {
  animation: dynamicHeartIconPulse 2.5s ease-in-out infinite;
  fill: #e03131;
}

.namecard-like-btn[data-streak-tier="6"]:hover {
  box-shadow: 0 0 16px rgba(224, 49, 49, 0.45);
}

.namecard-like-btn[data-streak-tier="6"].has-liked {
  background: linear-gradient(135deg, #5f3dc4 0%, #a61e4d 35%, #e03131 70%, #f783ac 100%);
  background-size: 300% 300%;
  animation: dynamicHeartColorShift 4s ease-in-out infinite alternate;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 14px rgba(224, 49, 49, 0.45);
}

.namecard-like-btn[data-streak-tier="6"].has-liked .nc-heart-icon {
  fill: #ffffff;
  animation: dynamicHeartIconPulse 2.5s ease-in-out infinite;
}

/* Tier 7 (200-364d): Super Duolingo Neon */
.namecard-like-btn[data-streak-tier="7"] {
  background: linear-gradient(135deg, rgba(0, 245, 155, 0.15) 0%, rgba(0, 210, 255, 0.15) 50%, rgba(236, 72, 153, 0.15) 100%);
  color: #00cec9;
  border-width: 1.5px;
  border-style: solid;
  border-color: #00cec9;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.35);
}

.namecard-like-btn[data-streak-tier="7"] .nc-heart-icon {
  fill: #00cec9;
}

.namecard-like-btn[data-streak-tier="7"]:hover {
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.55);
}

.namecard-like-btn[data-streak-tier="7"].has-liked {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 45%, #6366f1 75%, #ec4899 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.5);
}

.namecard-like-btn[data-streak-tier="7"].has-liked .nc-heart-icon {
  fill: #ffffff;
}

/* Tier 8 (365+d): Celestial Diamond */
.namecard-like-btn[data-streak-tier="8"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(226, 232, 240, 0.9) 50%, rgba(203, 213, 225, 0.9) 100%);
  color: #0f172a;
  border-width: 1.5px;
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.8);
  box-shadow: 0 0 14px rgba(15, 23, 42, 0.18), inset 0 1px 0 #ffffff;
}

.namecard-like-btn[data-streak-tier="8"] .nc-heart-icon {
  fill: #0f172a;
}

.namecard-like-btn[data-streak-tier="8"]:hover {
  box-shadow: 0 0 20px rgba(15, 23, 42, 0.3);
}

.namecard-like-btn[data-streak-tier="8"].has-liked {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 18px rgba(15, 23, 42, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.namecard-like-btn[data-streak-tier="8"].has-liked .nc-heart-icon {
  fill: #ffffff;
}

@keyframes dynamicHeartColorShift {
  0% {
    background-position: 0% 0%;
    border-color: #e03131;
    color: #e03131;
    box-shadow: 0 0 10px rgba(224, 49, 49, 0.35);
  }

  33% {
    border-color: #a61e4d;
    color: #a61e4d;
    box-shadow: 0 0 12px rgba(166, 30, 77, 0.4);
  }

  66% {
    border-color: #5f3dc4;
    color: #5f3dc4;
    box-shadow: 0 0 12px rgba(95, 61, 196, 0.4);
  }

  100% {
    background-position: 100% 100%;
    border-color: #f783ac;
    color: #f783ac;
    box-shadow: 0 0 10px rgba(247, 131, 172, 0.4);
  }
}

@keyframes dynamicHeartIconPulse {

  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(224, 49, 49, 0.5));
  }

  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px rgba(166, 30, 77, 0.8));
  }
}

/* Dark Theme Tier Variants */
body.dark-theme .namecard-like-btn[data-streak-tier="0"],
body.dark-theme .namecard-like-btn[data-streak-tier="1"],
body.dark-theme .namecard-like-btn:not([data-streak-tier]) {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.12);
}

body.dark-theme .namecard-like-btn[data-streak-tier="0"].has-liked .nc-heart-icon,
body.dark-theme .namecard-like-btn[data-streak-tier="1"].has-liked .nc-heart-icon {
  fill: #34d399;
}

body.dark-theme .namecard-like-btn[data-streak-tier="2"] {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.14);
}

body.dark-theme .namecard-like-btn[data-streak-tier="2"].has-liked .nc-heart-icon {
  fill: #fbbf24;
}

body.dark-theme .namecard-like-btn[data-streak-tier="3"] {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.14);
}

body.dark-theme .namecard-like-btn[data-streak-tier="3"].has-liked .nc-heart-icon {
  fill: #a78bfa;
}

body.dark-theme .namecard-like-btn[data-streak-tier="4"] {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.16);
}

body.dark-theme .namecard-like-btn[data-streak-tier="4"].has-liked .nc-heart-icon {
  fill: #fb7185;
}

body.dark-theme .namecard-like-btn[data-streak-tier="5"] {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.45);
  background: rgba(244, 114, 182, 0.16);
}

body.dark-theme .namecard-like-btn[data-streak-tier="5"].has-liked .nc-heart-icon {
  fill: #f472b6;
}

body.dark-theme .namecard-like-btn[data-streak-tier="6"] {
  background: linear-gradient(135deg, rgba(95, 61, 196, 0.25) 0%, rgba(166, 30, 77, 0.3) 35%, rgba(224, 49, 49, 0.3) 70%, rgba(247, 131, 172, 0.35) 100%);
  background-size: 300% 300%;
  animation: dynamicHeartColorShift 4s ease-in-out infinite alternate;
  color: #ff8787;
  border-color: #ff8787;
  box-shadow: 0 0 12px rgba(224, 49, 49, 0.4);
}

body.dark-theme .namecard-like-btn[data-streak-tier="6"] .nc-heart-icon {
  fill: #ff8787;
  animation: dynamicHeartIconPulse 2.5s ease-in-out infinite;
}

body.dark-theme .namecard-like-btn[data-streak-tier="6"].has-liked {
  background: linear-gradient(135deg, #5f3dc4 0%, #a61e4d 35%, #e03131 70%, #f783ac 100%);
  background-size: 300% 300%;
  animation: dynamicHeartColorShift 4s ease-in-out infinite alternate;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 16px rgba(247, 131, 172, 0.5);
}

body.dark-theme .namecard-like-btn[data-streak-tier="6"].has-liked .nc-heart-icon {
  fill: #ffffff;
  animation: dynamicHeartIconPulse 2.5s ease-in-out infinite;
}

body.dark-theme .namecard-like-btn[data-streak-tier="7"] {
  color: #00d2ff;
  border-color: rgba(0, 210, 255, 0.5);
  background: rgba(0, 210, 255, 0.16);
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
}

body.dark-theme .namecard-like-btn[data-streak-tier="7"].has-liked {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 45%, #6366f1 75%, #ec4899 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.5);
}

body.dark-theme .namecard-like-btn[data-streak-tier="7"].has-liked .nc-heart-icon {
  fill: #ffffff;
}

body.dark-theme .namecard-like-btn[data-streak-tier="8"] {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(148, 163, 184, 0.2) 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35);
}

body.dark-theme .namecard-like-btn[data-streak-tier="8"] .nc-heart-icon {
  fill: #ffffff;
}

body.dark-theme .namecard-like-btn[data-streak-tier="8"].has-liked {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 50%, #cbd5e1 100%);
  color: #080b11;
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
}

body.dark-theme .namecard-like-btn[data-streak-tier="8"].has-liked .nc-heart-icon {
  fill: #080b11;
}

/* ========================================================
   NAMECARD LIKES POPOVER (CỬA SỔ NHỎ NẢY RA)
   ======================================================== */
.namecard-like-anchor {
  position: relative;
  display: inline-flex;
}

.namecard-likes-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 350px;
  max-width: min(350px, calc(100vw - 32px));
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16), 0 3px 12px rgba(0, 0, 0, 0.08);
  z-index: 1050;
  padding: 14px 16px 12px;
  box-sizing: border-box;
  animation: ncPopoverIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes ncPopoverIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Triangle Pointer / Speech Bubble Arrow pointing up to like button */
.namecard-likes-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 11px;
  height: 11px;
  background: var(--surface, #ffffff);
  border-left: 1px solid var(--line, #e2e8f0);
  border-top: 1px solid var(--line, #e2e8f0);
  transform: rotate(45deg);
  z-index: 2;
}

.nc-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.nc-popover-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.nc-popover-heart-icon {
  flex-shrink: 0;
}

.nc-popover-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink, #0f172a);
  white-space: nowrap;
}

.nc-popover-total-pill {
  background: #f43f5e;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.3;
}

.nc-popover-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted, #64748b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  transition: all 0.15s ease;
  padding: 0;
}

.nc-popover-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink, #0f172a);
}

.nc-popover-lock-note {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted, #64748b);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #f1f5f9);
}

.nc-popover-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 180px;
}

.nc-popover-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 6px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.nc-popover-user-row:hover {
  background: var(--surface-2, rgba(18, 61, 48, 0.03));
}

.nc-popover-user-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.nc-popover-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  background: #f1f5f9;
  overflow: hidden;
}

.nc-popover-user-info {
  min-width: 0;
  flex: 1;
}

.nc-popover-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #0f172a);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.nc-popover-user-time {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.nc-popover-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--sans);
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1.2px solid #f43f5e;
  color: #f43f5e;
  background: transparent;
}

.nc-popover-action-btn:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.1);
  transform: translateY(-1px);
}

.nc-popover-action-btn.is-liked {
  background: #f43f5e !important;
  color: #ffffff !important;
  border-color: #f43f5e !important;
  cursor: default !important;
  transform: none !important;
}

/* Pagination Row */
.nc-popover-pagination-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line, #f1f5f9);
}

.nc-page-arrow,
.nc-page-num {
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--sans);
}

.nc-page-arrow:hover:not(:disabled),
.nc-page-num:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink, #0f172a);
}

.nc-page-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nc-page-num.active {
  background: #f43f5e !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

.nc-page-dots {
  color: var(--muted, #64748b);
  font-size: 11px;
  padding: 0 2px;
}

.nc-popover-limit-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 6px;
  font-style: italic;
}

/* Dark Theme for Popover */
body.dark-theme .namecard-likes-popover {
  background: #181f2a;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

body.dark-theme .namecard-likes-popover::before {
  background: #181f2a;
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .nc-popover-title {
  color: #f1f5f9;
}

body.dark-theme .nc-popover-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

body.dark-theme .nc-popover-lock-note,
body.dark-theme .nc-popover-pagination-wrap {
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .nc-popover-user-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .nc-popover-user-name {
  color: #f1f5f9;
}

body.dark-theme .nc-popover-avatar {
  background: #232d3d;
}

body.dark-theme .nc-page-arrow:hover:not(:disabled),
body.dark-theme .nc-page-num:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

/* ========================================================
   ARENA COMPETITION: QUIZ HINT & SUNDAY CEREMONY STYLES
   ======================================================== */

.quiz-question-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.quiz-hint-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #f59e0b;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  font-size: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  flex-shrink: 0;
  padding: 0;
}

.quiz-hint-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
  background: #fef08a;
}

.quiz-hint-btn.active {
  background: #f59e0b;
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.65);
}

.quiz-hint-box {
  margin-top: 14px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  animation: hintFadeDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

@keyframes hintFadeDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-hint-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.quiz-hint-tag {
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.quiz-hint-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: #92400e;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.quiz-hint-close-btn:hover {
  background: rgba(245, 158, 11, 0.18);
}

.quiz-hint-body {
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.55;
  font-weight: 500;
}

/* SUNDAY GATEWAY NOTICE */
.gateway-sunday-container {
  margin: 16px 0;
}

.sunday-hero-banner {
  background: linear-gradient(135deg, rgba(254, 240, 138, 0.2) 0%, rgba(245, 158, 11, 0.16) 50%, rgba(217, 119, 6, 0.2) 100%);
  border: 1.5px solid rgba(245, 158, 11, 0.45);
  border-radius: 14px;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.14);
  position: relative;
  overflow: hidden;
}

.sunday-cup-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: trophyFloat 2.4s ease-in-out infinite;
}

@keyframes trophyFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.sunday-pill-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #b45309;
  background: rgba(254, 240, 138, 0.7);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.sunday-hero-content h3 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 800;
  color: var(--ink);
}

.sunday-hero-content p {
  margin: 0 auto 22px;
  max-width: 580px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.sunday-goto-lb-btn {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #eab308 100%) !important;
  color: #fff !important;
  font-weight: 700 !important;
  border: 1px solid #b45309 !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35) !important;
  cursor: pointer;
  transition: all 0.25s ease !important;
  padding: 12px 28px !important;
  font-size: 15px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.sunday-goto-lb-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.5) !important;
}

/* SUNDAY LEADERBOARD CEREMONY BANNER */
.sunday-ceremony-banner {
  margin-bottom: 22px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #eab308;
  border-radius: 16px;
  padding: 28px 22px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(234, 179, 8, 0.3);
  animation: ceremonyEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ceremonyEntrance {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ceremony-glow-halo {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  height: 150px;
  background: radial-gradient(circle, rgba(234, 179, 8, 0.4) 0%, transparent 70%);
  pointer-events: none;
}

.sunday-ceremony-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none !important;
  z-index: 1;
}

.ceremony-content {
  position: relative;
  z-index: 2;
}

.ceremony-trophy-icon {
  font-size: 50px;
  margin-bottom: 8px;
  display: inline-block;
  animation: trophyPop 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes trophyPop {
  0% {
    transform: scale(0);
  }

  60% {
    transform: scale(1.25);
  }

  100% {
    transform: scale(1);
  }
}

.ceremony-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  color: #fef08a;
  background: rgba(234, 179, 8, 0.25);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 5px 16px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.ceremony-heading {
  margin: 6px 0 8px;
  font-size: 23px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffffff 0%, #fef08a 45%, #facc15 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.ceremony-desc {
  margin: 0;
  font-size: 14px;
  color: #cbd5e1;
}

.ceremony-decor-stars {
  margin-top: 10px;
  color: #facc15;
  letter-spacing: 6px;
  font-size: 14px;
  opacity: 0.85;
}

/* ========================================================
   ARENA MOBILE OPTIMIZATIONS (<= 600px & <= 480px)
   ======================================================== */

@media (max-width: 600px) {
  .quiz-question-top-bar {
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .quiz-question-top-bar .q-tries-pill {
    margin-bottom: 0 !important;
    font-size: 10.5px !important;
    padding: 3px 8px !important;
  }

  .quiz-hint-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 16px !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25) !important;
  }

  .quiz-hint-box {
    margin-top: 10px !important;
    padding: 10px 12px !important;
    border-radius: 9px !important;
  }

  .quiz-hint-tag {
    font-size: 11px !important;
  }

  .quiz-hint-close-btn {
    font-size: 16px !important;
  }

  .quiz-hint-body {
    font-size: 12.5px !important;
    line-height: 1.45 !important;
  }

  .quiz-question-text {
    font-size: 16px !important;
    line-height: 1.45 !important;
  }

  .quiz-options-grid {
    gap: 8px !important;
  }

  .quiz-option-btn {
    min-height: 44px !important;
    padding: 10px 12px !important;
    font-size: 13.5px !important;
  }
}

@media (max-width: 480px) {
  .arena-hero-title {
    font-size: 16.5px !important;
    line-height: 1.35 !important;
  }

  .arena-tabs-container {
    padding: 12px 8px !important;
    border-radius: 14px !important;
  }

  .comp-nav-tabs.arena-nav-tabs {
    gap: 3px !important;
    padding: 3px !important;
    border-radius: 10px !important;
  }

  .comp-tab-btn {
    font-size: 10px !important;
    padding: 7px 2px !important;
    gap: 2px !important;
    min-height: 38px !important;
  }

  .comp-tab-btn .tab-icon {
    font-size: 12px !important;
  }

  .comp-gateway-hero h3 {
    font-size: 16px !important;
  }

  .gateway-clock-digits {
    font-size: 19px !important;
    letter-spacing: 0.5px !important;
  }

  .gateway-clock-card .gateway-clock-icon {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    font-size: 38px !important;
  }

  .comp-podium-wrap {
    gap: 6px !important;
    padding: 16px 2px 10px 2px !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .podium-col {
    width: 32% !important;
    max-width: 95px !important;
  }

  .podium-avatar {
    width: 38px !important;
    height: 38px !important;
    font-size: 20px !important;
  }

  .podium-col.rank-1 .podium-avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 25px !important;
  }

  .podium-name {
    font-size: 10px !important;
    max-width: 78px !important;
  }

  .podium-score {
    font-size: 9.5px !important;
    padding: 2px 4px !important;
  }

  .podium-stand.stand-1 {
    height: 72px !important;
  }

  .podium-stand.stand-2 {
    height: 56px !important;
  }

  .podium-stand.stand-3 {
    height: 42px !important;
  }

  .comp-lb-avatar-wrap .avatar {
    width: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
  }

  .comp-lb-name {
    font-size: 12px !important;
  }

  .comp-lb-score {
    font-size: 11.5px !important;
  }
}

/* === THẺ YÊU CẦU CẬP NHẬT THÔNG TIN SINH VIÊN (TRANG CÁ NHÂN) === */
#accountStudentPromptCard {
  transition: all 0.25s ease;
}

#accountStudentPromptCard:hover {
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.12) !important;
}

@media (max-width: 640px) {
  #accountStudentPromptCard>div {
    flex-direction: column;
    align-items: stretch !important;
    gap: 14px !important;
  }

  #accountStudentPromptCard #promptUpdateProfileBtn {
    width: 100%;
    justify-content: center;
  }
}

input:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed !important;
  border-color: #cbd5e1 !important;
  opacity: 0.85;
}

/* ==========================================================================
   MOBILE LANDSCAPE & COMPACT VIEWPORT OPTIMIZATIONS (Height <= 520px)
   ========================================================================== */
@media (max-height: 520px) {
  .site-header {
    height: 52px !important;
    padding: 0 16px !important;
  }

  .brand {
    font-size: 14px !important;
    gap: 5.5px !important;
  }

  .brand img {
    width: 22px !important;
    height: 22px !important;
  }

  .desktop-nav {
    display: flex !important;
    gap: 6px !important;
    margin-left: clamp(8px, 1.5vw, 20px) !important;
  }

  .desktop-nav .nav-link-icon {
    display: inline-flex !important;
  }

  .desktop-nav .nav-link-text {
    display: none !important;
  }

  .desktop-nav .nav-link {
    padding: 6px 9px !important;
    border-radius: 6px !important;
  }

  .header-actions {
    gap: 8px !important;
  }

  .desktop-search {
    display: inline-flex !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 20px !important;
  }

  .profile-chip {
    padding: 2px 6px !important;
    gap: 6px !important;
  }

  .profile-chip-text {
    max-width: 80px !important;
    font-size: 11px !important;
  }

  .site-header .avatar,
  .profile-chip .avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
  }

  /* Protect Namecard avatar from any parent or global overrides */
  .namecard-avatar-circle {
    width: 104px !important;
    height: 104px !important;
    font-size: 52px !important;
    flex-shrink: 0 !important;
  }

  /* Arena Leaderboard & Podium in Mobile Landscape */
  .comp-podium-wrap {
    gap: 8px !important;
    padding: 16px 2px 8px 2px !important;
    margin-bottom: 12px !important;
    overflow: visible !important;
  }

  .podium-col {
    width: 88px !important;
    max-width: 95px !important;
  }

  .podium-avatar {
    width: 38px !important;
    height: 38px !important;
    font-size: 20px !important;
  }

  .podium-col.rank-1 .podium-avatar {
    width: 48px !important;
    height: 48px !important;
    font-size: 26px !important;
  }

  .podium-crown {
    font-size: 16px !important;
    top: -12px !important;
    z-index: 50 !important;
  }

  .podium-crown.gold {
    font-size: 20px !important;
    top: -16px !important;
  }

  .podium-name {
    font-size: 10.5px !important;
    max-width: 80px !important;
  }

  .podium-score {
    font-size: 9.5px !important;
  }

  .podium-stand.stand-1 {
    height: 52px !important;
  }

  .podium-stand.stand-2 {
    height: 40px !important;
  }

  .podium-stand.stand-3 {
    height: 30px !important;
  }

  .stand-num {
    font-size: 15px !important;
  }

  .comp-lb-avatar-wrap .avatar {
    width: 26px !important;
    height: 26px !important;
    font-size: 14px !important;
  }

  .comp-lb-avatar {
    width: 26px !important;
    height: 26px !important;
    font-size: 14px !important;
  }

  /* Hide bottom floating island nav & FAB in landscape mobile to maximize screen real estate */
  .mobile-nav,
  .mobile-fab {
    display: none !important;
  }

  body {
    padding-bottom: 20px !important;
  }

  .page {
    padding: 16px 16px 28px !important;
    min-height: auto !important;
  }

  .home-hero {
    gap: 12px !important;
    margin-bottom: 14px !important;
  }

  .hero-copy h1 {
    font-size: 22px !important;
    line-height: 1.25 !important;
    letter-spacing: -0.5px !important;
    margin-bottom: 6px !important;
  }

  .hero-intro {
    font-size: 12px !important;
    line-height: 1.4 !important;
    margin: 4px 0 10px !important;
  }

  .hero-actions {
    margin-top: 8px !important;
    gap: 8px !important;
  }

  /* Home showcase: Two cards side by side, compact 190px */
  .home-showcase-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    height: 190px !important;
    max-height: 190px !important;
    min-height: 190px !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .weekly-competition-card,
  .banner-stack-card {
    height: 190px !important;
    min-height: 190px !important;
    max-height: 190px !important;
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 12px !important;
  }

  .weekly-competition-card {
    padding: 12px 14px !important;
  }

  .weekly-competition-card .comp-topic-title {
    font-size: 14px !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
  }

  .weekly-competition-card .comp-phase-subtitle {
    font-size: 11px !important;
  }

  .weekly-competition-card .comp-right {
    padding-top: 8px !important;
    gap: 8px !important;
  }

  .weekly-competition-card .comp-countdown {
    font-size: 16px !important;
  }

  .weekly-competition-card .comp-timer-label {
    font-size: 10px !important;
  }

  .weekly-competition-card .comp-cta-button {
    height: 32px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
  }

  .weekly-competition-card .comp-user-status {
    font-size: 10px !important;
  }
}

/* Arena Podium Stand Highlights for Top 3 Medals */
.podium-stand.stand-1 {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 50%, #92400e 100%) !important;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 8px 24px rgba(217, 119, 6, 0.35) !important;
}

.podium-stand.stand-2 {
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 50%, #475569 100%) !important;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.6), 0 8px 20px rgba(100, 116, 139, 0.3) !important;
}

.podium-stand.stand-3 {
  background: linear-gradient(180deg, #fdba74 0%, #c2410c 50%, #7c2d12 100%) !important;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5), 0 8px 20px rgba(194, 65, 12, 0.3) !important;
}

/* ==========================================================================
   ADVANCED DARK MODE DESIGN SYSTEM (6 NGUYÊN TẮC VÀNG CHUYÊN NGHIỆP)
   1. Không dùng #000000: Dùng #11161b (rich charcoal slate) và #182028
   2. Tận dụng Blending modes & hiệu ứng chiều sâu (translucent borders, soft glows)
   3. Giảm độ bão hòa (desaturate) màu sắc (#34d399, #fbbf24, #f87171)
   4. Sử dụng chữ trắng với độ mờ (opacity) / #e2e8f0 thay cho #ffffff 100%
   5. Làm cho trạng thái tương tác rõ nét (glow, hover, active borders)
   6. Chuyển đổi trực quan với icon Mặt trời / Mặt trăng và lưu LocalStorage
   ========================================================================== */

/* 1. Global image dimming filter per user's guide */
html.dark-theme img:not(.brand-logo-img):not(.avatar):not(.user-avatar):not(.emoji):not(.achievement-badge-img):not(.namecard-avatar-img):not(.badge-icon-img),
body.dark-theme img:not(.brand-logo-img):not(.avatar):not(.user-avatar):not(.emoji):not(.achievement-badge-img):not(.namecard-avatar-img):not(.badge-icon-img) {
  filter: brightness(0.85) contrast(1.1);
  transition: filter 0.3s ease;
}

html.dark-theme img:not(.brand-logo-img):not(.avatar):not(.user-avatar):not(.emoji):not(.achievement-badge-img):not(.namecard-avatar-img):not(.badge-icon-img):hover,
body.dark-theme img:not(.brand-logo-img):not(.avatar):not(.user-avatar):not(.emoji):not(.achievement-badge-img):not(.namecard-avatar-img):not(.badge-icon-img):hover {
  filter: brightness(1) contrast(1);
}

/* 2. Header & Top Bar */
body.dark-theme .site-header {
  background: rgba(17, 22, 27, 0.90) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .brand {
  color: #f1f5f9;
}

body.dark-theme .brand-colon {
  color: #34d399;
}

body.dark-theme .nav-link {
  color: #94a3b8;
}

body.dark-theme .nav-link:hover,
body.dark-theme .nav-link.active {
  background: rgba(255, 255, 255, 0.06);
  color: #34d399;
}

body.dark-theme .icon-button {
  color: #94a3b8;
}

body.dark-theme .icon-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #34d399;
}

body.dark-theme .profile-chip {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body.dark-theme .profile-chip:hover {
  background: #1e2832;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.15);
}

body.dark-theme .profile-chip b {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

body.dark-theme .quick-menu-btn {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

body.dark-theme .quick-menu-btn:hover {
  background: #1e2832;
  border-color: #34d399;
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}

body.dark-theme .quick-menu-btn .hamburger-line {
  background-color: #94a3b8;
}

body.dark-theme .quick-menu-btn:hover .hamburger-line,
body.dark-theme .quick-user-menu-wrap.open .hamburger-line {
  background-color: #34d399;
}

/* 3. Quick Menu Dropdown */
body.dark-theme .quick-menu-dropdown {
  background: #182028;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark-theme .quick-menu-name {
  color: #f1f5f9;
}

body.dark-theme .quick-menu-role {
  color: #94a3b8;
}

body.dark-theme .quick-menu-divider {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .quick-menu-item {
  color: #cbd5e1;
}

body.dark-theme .quick-menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

body.dark-theme .quick-menu-item:hover .quick-menu-icon {
  color: #34d399;
}

body.dark-theme .quick-menu-item.quick-menu-primary {
  color: #34d399;
}

body.dark-theme .quick-menu-item.quick-menu-primary:hover {
  background: rgba(52, 211, 153, 0.12);
}

body.dark-theme .quick-menu-item.quick-menu-danger {
  color: #f87171;
}

body.dark-theme .quick-menu-item.quick-menu-danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

body.dark-theme .quick-menu-guest-card {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .quick-menu-guest-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

body.dark-theme .quick-menu-login-btn {
  background: #34d399;
  color: #0b1a13;
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.35);
}

body.dark-theme .quick-menu-login-btn:hover {
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.45);
}

body.dark-theme .quick-menu-theme-row {
  color: #e2e8f0;
}

body.dark-theme .quick-menu-theme-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .theme-icon-indicator {
  color: #fbbf24;
}

/* 4. Search Panel & Hero */
body.dark-theme .search-panel {
  background: #182028;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

body.dark-theme .search-glyph {
  color: #34d399;
}

body.dark-theme .search-panel input,
body.dark-theme .search-inline input {
  color: #f1f5f9;
}

body.dark-theme .search-panel input::placeholder,
body.dark-theme .search-inline input::placeholder {
  color: #64748b;
}

body.dark-theme .search-panel kbd {
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .filter-chip {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

body.dark-theme .filter-chip:hover,
body.dark-theme .filter-chip.selected {
  background: rgba(52, 211, 153, 0.15);
  border-color: #34d399;
  color: #34d399;
}

/* 5. Discussion Feed & Post Cards */
body.dark-theme .post-list {
  border-top-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .post-card {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-theme .post-card:hover {
  background: rgba(255, 255, 255, 0.035);
}

body.dark-theme .post-card.admin-post {
  background-color: rgba(30, 58, 80, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

body.dark-theme .post-card.admin-post:hover {
  background-color: rgba(30, 58, 80, 0.6);
}

body.dark-theme .post-title {
  color: #f1f5f9;
}

body.dark-theme .post-copy-preview {
  color: #94a3b8;
}

body.dark-theme .post-tag,
body.dark-theme .tag {
  background: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .announcement {
  background: #162620;
  border-left-color: #34d399;
  color: #e2e8f0;
}

body.dark-theme .announcement-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

/* 6. Sidebar Mini Cards & Active Cards */
body.dark-theme .mini-card,
body.dark-theme .topics-card,
body.dark-theme .active-card {
  background: #182028;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

body.dark-theme .topic {
  background: #1e2936;
  border-color: rgba(255, 255, 255, 0.1);
  color: #86efac;
}

body.dark-theme .topic:hover {
  background: #253342;
  border-color: #34d399;
}

/* 7. Leaderboard Carousel in Dark Mode */
body.dark-theme .lb-carousel-header {
  background: #182028;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-theme .lb-nav-btn {
  background: #1e2832;
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-theme .lb-nav-btn:hover {
  background: #253342;
  color: #34d399;
  border-color: #34d399;
}

body.dark-theme .lb-active-title {
  color: #34d399;
}

body.dark-theme .lb-title-container:hover {
  background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .lb-dot {
  background: #475569;
}

body.dark-theme .lb-dot.active {
  background: #34d399;
}

body.dark-theme .lb-tabs {
  background: #182028;
}

body.dark-theme .lb-tab {
  color: #94a3b8;
}

body.dark-theme .lb-tab.active {
  background: #1e2832;
  color: #34d399;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* 8. Modals, Forms & Dialogs in Dark Mode */
body.dark-theme .modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal),
body.dark-theme dialog.modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal) {
  background: #182028;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

body.dark-theme .admin-modal {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .admin-modal .modal-head h2 {
  color: #f1f5f9 !important;
}

body.dark-theme .admin-modal .modal-head .eyebrow {
  color: #34d399 !important;
}

body.dark-theme .admin-modal .close-modal {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

body.dark-theme .admin-modal .close-modal:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

body.dark-theme .admin-modal .admin-tab {
  color: #94a3b8 !important;
  border-bottom: 2px solid transparent !important;
}

body.dark-theme .admin-modal .admin-tab:hover {
  color: #f1f5f9 !important;
}

body.dark-theme .admin-modal .admin-tab.active {
  color: #34d399 !important;
  border-bottom: 2px solid #34d399 !important;
}

body.dark-theme .admin-modal .admin-tab.active:after {
  background: #34d399 !important;
}

/* Admin Dashboard Metrics Cards in Dark Mode */
body.dark-theme .admin-dashboard>div {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .admin-dashboard strong {
  color: #34d399 !important;
}

body.dark-theme .admin-dashboard span {
  color: #94a3b8 !important;
}

/* Quick Lookup Card */
body.dark-theme .admin-quick-lookup-card {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .admin-quick-lookup-card h4 {
  color: #f1f5f9 !important;
}

body.dark-theme .admin-quick-lookup-card p {
  color: #94a3b8 !important;
}

body.dark-theme .admin-quick-lookup-card code {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #34d399 !important;
}

/* Admin Tables (Members, Resets, Trash, Hidden) in Dark Mode */
body.dark-theme .admin-modal table th {
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .admin-modal table td {
  color: #e2e8f0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .admin-modal table tr:hover td {
  background: rgba(255, 255, 255, 0.03) !important;
}

/* Admin Documents & Topics List in Dark Mode */
body.dark-theme #adminDocList>div,
body.dark-theme #adminTopicList>div {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-theme #adminDocList h3,
body.dark-theme #adminTopicList h3 {
  color: #f1f5f9 !important;
}

body.dark-theme #adminDocList p,
body.dark-theme #adminTopicList p {
  color: #94a3b8 !important;
}

/* Admin Competition Simulator Bar */
body.dark-theme .admin-comp-sim-bar {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .admin-comp-sim-bar strong {
  color: #f1f5f9 !important;
}

body.dark-theme #adminSimCurrentTime {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
}

/* Admin Competition Management Cards */
body.dark-theme .admin-modal .admin-card,
body.dark-theme .admin-modal .admin-card[style] {
  background: #141c24 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .admin-modal .admin-card h3,
body.dark-theme .admin-modal .admin-card h4,
body.dark-theme .admin-modal .admin-card label {
  color: #f1f5f9 !important;
}

body.dark-theme .admin-modal .admin-card span[style*="color: #166534"],
body.dark-theme .admin-modal .admin-card span[style*="color: #15803d"],
body.dark-theme .admin-modal .admin-card h4[style*="color: #14532d"] {
  color: #34d399 !important;
}

body.dark-theme .admin-modal .admin-card div[style*="background: #f0fdf4"],
body.dark-theme .admin-modal .admin-card div[style*="background:#f0fdf4"],
body.dark-theme .admin-modal .admin-card div[style*="background: var(--sage-2)"],
body.dark-theme .admin-modal .admin-card div[style*="background:var(--sage-2)"] {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .admin-board-tab-btn.active,
body.dark-theme .admin-track-btn.active,
body.dark-theme .admin-phase-tab-btn.active {
  background: #34d399 !important;
  color: #0f172a !important;
  border-color: #34d399 !important;
}

body.dark-theme .admin-board-tab-btn:not(.active),
body.dark-theme .admin-track-btn:not(.active),
body.dark-theme .admin-phase-tab-btn:not(.active) {
  background: #16202c !important;
  color: #94a3b8 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme #adminWeekDateRangeBadge {
  background: rgba(52, 211, 153, 0.12) !important;
  color: #34d399 !important;
  border: 1px solid rgba(52, 211, 153, 0.25) !important;
}

body.dark-theme #adminSelectedWeekStatusText {
  color: #4ade80 !important;
}

body.dark-theme #adminPhaseStatusBadge {
  color: #34d399 !important;
}

body.dark-theme .admin-modal select.input-field,
body.dark-theme .admin-modal input.input-field,
body.dark-theme .admin-modal input.input {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .admin-q-card {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .admin-q-card strong {
  color: #f1f5f9 !important;
}

body.dark-theme .admin-q-card input,
body.dark-theme .admin-q-card select {
  background: #16202c !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

/* Account Page Admin Panel in Dark Mode */
body.dark-theme .admin-panel {
  background: #16202c !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .admin-panel .eyebrow {
  color: #34d399 !important;
}

body.dark-theme .admin-panel h2 {
  color: #ffffff !important;
}

body.dark-theme .admin-panel>p:not(.eyebrow) {
  color: #cbd5e1 !important;
}

body.dark-theme .admin-metrics {
  border-top-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .admin-metrics span {
  color: #94a3b8 !important;
}

body.dark-theme .admin-metrics b {
  color: #ffffff !important;
}

/* Arena Admin Bar in Dark Mode */
body.dark-theme .arena-admin-bar {
  background: #16202c !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .arena-admin-bar .admin-bar-left span {
  color: #f1f5f9 !important;
}

body.dark-theme .arena-admin-bar .admin-bar-left small {
  color: #94a3b8 !important;
}

body.dark-theme .admin-bar-actions .button {
  background: #1c2632 !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

body.dark-theme .admin-bar-actions .button:hover {
  background: #233140 !important;
  color: #ffffff !important;
}

body.dark-theme .modal::backdrop,
body.dark-theme dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
}

body.dark-theme .modal-head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .modal input,
body.dark-theme .modal textarea,
body.dark-theme .modal select {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
}

body.dark-theme .modal input:focus,
body.dark-theme .modal textarea:focus,
body.dark-theme .modal select:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

body.dark-theme .button-outline {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

body.dark-theme .button-outline:hover {
  background: #1e2832;
  border-color: #34d399;
}

body.dark-theme .button-dark {
  background: #1e2832;
  color: #f1f5f9;
}

body.dark-theme .button-dark:hover {
  background: #253342;
}

/* 9. Quill Editor in Dark Mode */
body.dark-theme .ql-toolbar.ql-snow {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-bottom: none !important;
}

body.dark-theme .ql-container.ql-snow {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .ql-editor {
  color: #f1f5f9 !important;
}

body.dark-theme .ql-snow .ql-editor.ql-blank::before {
  color: #64748b !important;
}

body.dark-theme .ql-snow .ql-stroke {
  stroke: #94a3b8 !important;
}

body.dark-theme .ql-snow .ql-fill {
  fill: #94a3b8 !important;
}

body.dark-theme .ql-snow .ql-picker {
  color: #94a3b8 !important;
}

body.dark-theme .ql-snow .ql-picker-label {
  color: #94a3b8 !important;
}

body.dark-theme .ql-snow .ql-picker.ql-expanded .ql-picker-label {
  background-color: #1e2832 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #34d399 !important;
}

body.dark-theme .ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke {
  stroke: #34d399 !important;
}

body.dark-theme .ql-snow .ql-picker-options,
body.dark-theme .ql-toolbar.ql-snow .ql-picker-options,
body.dark-theme .ql-snow .ql-color-picker .ql-picker-options,
body.dark-theme .ql-snow .ql-icon-picker .ql-picker-options {
  background-color: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .ql-snow .ql-picker-item {
  color: #e2e8f0 !important;
}

body.dark-theme .ql-snow .ql-picker-item:hover,
body.dark-theme .ql-snow .ql-picker-item.ql-selected {
  color: #34d399 !important;
}

body.dark-theme .ql-snow.ql-toolbar button:hover,
body.dark-theme .ql-snow .ql-toolbar button:hover,
body.dark-theme .ql-snow.ql-toolbar button:focus,
body.dark-theme .ql-snow .ql-toolbar button:focus,
body.dark-theme .ql-snow.ql-toolbar button.ql-active,
body.dark-theme .ql-snow .ql-toolbar button.ql-active {
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 4px;
}

body.dark-theme .ql-snow.ql-toolbar button:hover .ql-stroke,
body.dark-theme .ql-snow .ql-toolbar button:hover .ql-stroke,
body.dark-theme .ql-snow.ql-toolbar button:focus .ql-stroke,
body.dark-theme .ql-snow .ql-toolbar button:focus .ql-stroke,
body.dark-theme .ql-snow.ql-toolbar button.ql-active .ql-stroke,
body.dark-theme .ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: #34d399 !important;
}

body.dark-theme .ql-snow.ql-toolbar button:hover .ql-fill,
body.dark-theme .ql-snow .ql-toolbar button:hover .ql-fill,
body.dark-theme .ql-snow.ql-toolbar button:focus .ql-fill,
body.dark-theme .ql-snow .ql-toolbar button:focus .ql-fill,
body.dark-theme .ql-snow.ql-toolbar button.ql-active .ql-fill,
body.dark-theme .ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: #34d399 !important;
}

body.dark-theme .ql-snow .ql-tooltip {
  background-color: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .ql-snow .ql-tooltip input[type=text] {
  background-color: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .ql-snow .ql-tooltip a.ql-action {
  color: #34d399 !important;
}

body.dark-theme .ql-snow .ql-tooltip a.ql-remove {
  color: #f87171 !important;
}

body.dark-theme .reply-bar.expanded .ql-toolbar {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-bottom: none !important;
}

body.dark-theme .reply-bar.expanded .ql-container {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

/* 10. Code & Pre Blocks */
body.dark-theme pre,
body.dark-theme code {
  background: #161e27;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 11. Mobile Navigation & Bar */
body.dark-theme .mobile-nav {
  background: rgba(18, 24, 28, 0.90) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .mobile-link {
  color: #94a3b8;
}

body.dark-theme .mobile-link:hover,
body.dark-theme .mobile-link.active {
  color: #34d399;
}

/* 12. Primary Buttons in Dark Mode */
body.dark-theme .button-primary,
body.dark-theme .button.button-primary {
  background: #34d399 !important;
  color: #0b1a13 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(52, 211, 153, 0.3) !important;
}

body.dark-theme .button-primary:hover,
body.dark-theme .button.button-primary:hover {
  background: #4ade80 !important;
  color: #0b1a13 !important;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.45) !important;
}

/* 13. Inline Search & Filters in Dark Mode */
body.dark-theme .search-inline {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .search-inline span,
body.dark-theme .search-inline .search-inline-icon {
  color: #34d399 !important;
}

body.dark-theme .search-inline input {
  color: #f1f5f9 !important;
}

body.dark-theme .filter-button {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .filter-button:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme select#topicFilter,
body.dark-theme .filters select {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

/* 14. Leaderboard Items in Sidebar & Arena */
body.dark-theme .leaderboard-item,
body.dark-theme .comp-lb-row {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-theme .lb-capsule,
body.dark-theme .comp-lb-capsule {
  background: #202c39 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
  box-shadow: 0 1.5px 6px rgba(0, 0, 0, 0.25) !important;
}

body.dark-theme .leaderboard-item:hover .lb-capsule,
body.dark-theme .comp-lb-row:hover .comp-lb-capsule {
  background: #253342 !important;
  border-color: rgba(129, 140, 248, 0.45) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45) !important;
}

body.dark-theme .lb-capsule .lb-name,
body.dark-theme .comp-lb-capsule .comp-lb-name {
  color: #f1f5f9 !important;
}

body.dark-theme .lb-capsule .lb-cover-overlay,
body.dark-theme .comp-lb-capsule .lb-cover-overlay {
  background: linear-gradient(118deg,
      #202c39 0%,
      #202c39 32%,
      rgba(32, 44, 57, 0.95) 44%,
      rgba(32, 44, 57, 0.68) 58%,
      rgba(32, 44, 57, 0.2) 76%,
      rgba(32, 44, 57, 0) 95%) !important;
}

body.dark-theme .leaderboard-item.is-me .lb-capsule,
body.dark-theme .comp-lb-row.is-current-user .comp-lb-capsule {
  background: #0f241a !important;
  border-color: #34d399 !important;
}

body.dark-theme .leaderboard-item.is-me .lb-cover-overlay,
body.dark-theme .comp-lb-row.is-current-user .lb-cover-overlay {
  background: linear-gradient(118deg,
      #0f241a 0%,
      #0f241a 32%,
      rgba(15, 36, 26, 0.95) 44%,
      rgba(15, 36, 26, 0.68) 58%,
      rgba(15, 36, 26, 0.2) 76%,
      rgba(15, 36, 26, 0) 95%) !important;
}

body.dark-theme .lb-points,
body.dark-theme .lb-stats-pill,
body.dark-theme .comp-lb-score {
  background: #202c39 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 1.5px 5px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .lb-points-likes,
body.dark-theme .lb-stats-likes {
  background: #2b1118 !important;
  color: #fda4af !important;
  border: 1.5px solid rgba(244, 63, 94, 0.4) !important;
  box-shadow: 0 1.5px 5px rgba(244, 63, 94, 0.15) !important;
}

body.dark-theme .lb-points-study,
body.dark-theme .lb-stats-study {
  background: #2b1f0d !important;
  color: #fcd34d !important;
  border: 1.5px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 1.5px 5px rgba(245, 158, 11, 0.15) !important;
}

body.dark-theme .lb-rank-badge {
  border-color: #202c39 !important;
}

body.dark-theme .lb-rank-badge.rank-4,
body.dark-theme .lb-rank-badge.rank-5,
body.dark-theme .lb-rank-badge.rank-6,
body.dark-theme .lb-rank-badge.rank-7,
body.dark-theme .lb-rank-badge.rank-8,
body.dark-theme .lb-rank-badge.rank-9,
body.dark-theme .lb-rank-badge.rank-10 {
  background: #475569 !important;
  color: #f1f5f9 !important;
  border-color: #202c39 !important;
}

body.dark-theme .comp-lb-list-header {
  background: #17222c !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}

body.dark-theme .comp-lb-row.top-11-plus-row .comp-lb-capsule {
  background: #271e0c !important;
  border-color: rgba(245, 158, 11, 0.7) !important;
}

body.dark-theme .comp-lb-row.top-11-plus-row .lb-cover-overlay {
  background: linear-gradient(118deg,
      #271e0c 0%,
      #271e0c 32%,
      rgba(39, 30, 12, 0.95) 44%,
      rgba(39, 30, 12, 0.68) 58%,
      rgba(39, 30, 12, 0.2) 76%,
      rgba(39, 30, 12, 0) 95%) !important;
}

/* 14b. Dark Theme Overrides for Arena Top 3 Concepts */
body.dark-theme .arena-concept-switcher-bar {
  background: #17222c !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .concept-chip {
  background: #202c39 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .concept-chip:hover {
  background: #273646 !important;
  color: #ffffff !important;
  color: #fbbf24 !important;
}

body.dark-theme .arena-champion-card {
  background: #1e2a38 !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .arena-champion-card.mini-namecard {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-theme .mini-card-canvas {
  background: #182028 !important;
}

body.dark-theme .arena-champion-card.mini-namecard.rank-1[data-frame="none"] .mini-card-canvas,
body.dark-theme .arena-champion-card.mini-namecard.rank-1[data-frame="default"] .mini-card-canvas {
  border-color: #f59e0b !important;
  box-shadow: 0 8px 28px rgba(245, 158, 11, 0.25) !important;
}

body.dark-theme .arena-champion-card.mini-namecard.rank-2[data-frame="none"] .mini-card-canvas,
body.dark-theme .arena-champion-card.mini-namecard.rank-2[data-frame="default"] .mini-card-canvas {
  border-color: #64748b !important;
  box-shadow: 0 6px 20px rgba(100, 116, 139, 0.25) !important;
}

body.dark-theme .arena-champion-card.mini-namecard.rank-3[data-frame="none"] .mini-card-canvas,
body.dark-theme .arena-champion-card.mini-namecard.rank-3[data-frame="default"] .mini-card-canvas {
  border-color: #c2410c !important;
  box-shadow: 0 6px 20px rgba(194, 65, 12, 0.25) !important;
}

body.dark-theme .arena-champion-card.mini-namecard:not([data-frame="none"]):not([data-frame="default"]) .mini-card-canvas {
  border: none !important;
}

body.dark-theme .champ-name {
  color: #f1f5f9 !important;
}

body.dark-theme .champ-rank-pill.pill-rank-1 {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fde68a !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

body.dark-theme .champ-rank-pill.pill-rank-2 {
  background: rgba(148, 163, 184, 0.2) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.4) !important;
}

body.dark-theme .champ-rank-pill.pill-rank-3 {
  background: rgba(249, 115, 22, 0.2) !important;
  color: #fed7aa !important;
  border-color: rgba(249, 115, 22, 0.4) !important;
}

body.dark-theme .champ-score {
  background: #273646 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .champ-score.gold-score {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

body.dark-theme .champ-score.gold-score .champ-score-star {
  color: #ffffff !important;
  fill: #ffffff !important;
  stroke: #ffffff !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

body.dark-theme .champ-score.silver-score {
  background: #273646 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .champ-score.silver-score .champ-score-star {
  color: #94a3b8 !important;
  fill: #94a3b8 !important;
  stroke: #94a3b8 !important;
}

body.dark-theme .champ-score.bronze-score {
  background: #3b2216 !important;
  color: #fdba74 !important;
  border: 1px solid rgba(251, 146, 60, 0.28) !important;
}

body.dark-theme .champ-score.bronze-score .champ-score-star {
  color: #fb923c !important;
  fill: #fb923c !important;
  stroke: #fb923c !important;
}

body.dark-theme .champ-rank-pill.pill-rank-1 {
  background: #2a2010 !important;
  color: #fcd34d !important;
  border-color: rgba(245, 158, 11, 0.45) !important;
}

body.dark-theme .champ-rank-pill.pill-rank-2 {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .champ-rank-pill.pill-rank-3 {
  background: #2a1b12 !important;
  color: #fdba74 !important;
  border-color: rgba(249, 115, 22, 0.4) !important;
}

body.dark-theme .arena-glass-card {
  border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme .arena-glass-card.rank-1-glass {
  border-color: #f59e0b !important;
}

body.dark-theme .royal-grand-capsule {
  background: #202c39 !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
}

body.dark-theme .royal-grand-capsule.rank-1 {
  background: #272113 !important;
  border-color: #f59e0b !important;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25) !important;
}

body.dark-theme .royal-cover-overlay {
  background: linear-gradient(115deg,
      #202c39 0%,
      #202c39 28%,
      rgba(32, 44, 57, 0.95) 44%,
      rgba(32, 44, 57, 0.65) 64%,
      rgba(32, 44, 57, 0.18) 82%,
      rgba(32, 44, 57, 0) 98%) !important;
}

body.dark-theme .royal-grand-capsule.rank-1 .royal-cover-overlay {
  background: linear-gradient(115deg,
      #272113 0%,
      #272113 28%,
      rgba(39, 33, 19, 0.95) 44%,
      rgba(39, 33, 19, 0.65) 64%,
      rgba(39, 33, 19, 0.18) 82%,
      rgba(39, 33, 19, 0) 98%) !important;
}

body.dark-theme .royal-name {
  color: #f1f5f9 !important;
}

body.dark-theme .royal-score-badge {
  background: #283747 !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* 15. Other Document & Study Cards */
body.dark-theme .document-card,
body.dark-theme .study-card,
body.dark-theme .rule-card {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

/* ==========================================================================
   16. LÀM SÁNG TEXT XANH LÁ ĐẬM & CẢI THIỆN ĐỘ TƯƠNG PHẢN TOÀN TRANG
   ========================================================================== */
body.dark-theme h1 em,
body.dark-theme h2 em,
body.dark-theme h3 em {
  color: #4ade80 !important;
  /* Luminous emerald mint thay cho xanh lục đậm chìm */
  font-style: italic;
}

body.dark-theme .eyebrow {
  color: #86efac !important;
  /* Xanh ngọc sáng tinh tế, dễ đọc */
  font-weight: 500 !important;
}

body.dark-theme .hero-intro {
  color: #cbd5e1 !important;
  /* Xám bạc sáng thay cho #587067 đậm chìm */
}

body.dark-theme .brand-colon {
  color: #34d399 !important;
}

body.dark-theme .text-link,
body.dark-theme a.text-link {
  color: #4ade80 !important;
}

body.dark-theme .role-label {
  color: #a7f3d0 !important;
}

body.dark-theme label:not(.theme-switch) {
  color: #86efac !important;
}

body.dark-theme .stat-card .eyebrow,
body.dark-theme .document-card .eyebrow,
body.dark-theme .admin-panel .eyebrow {
  color: #86efac !important;
}

body.dark-theme .account-header .eyebrow,
body.dark-theme .profile-large .eyebrow {
  color: #86efac !important;
}

body.dark-theme .account-stats>div {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .account-stats p {
  color: #94a3b8 !important;
}

body.dark-theme .account-stats strong {
  color: #f1f5f9 !important;
}

body.dark-theme .account-stats small {
  color: #64748b !important;
}

body.dark-theme #accountStudentPromptCard {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-left: 4px solid #34d399 !important;
}

body.dark-theme #accountStudentPromptCard strong {
  color: #f1f5f9 !important;
}

body.dark-theme #accountStudentPromptCard span {
  color: #94a3b8 !important;
}

body.dark-theme #accountStudentPromptCard svg {
  color: #34d399 !important;
}

body.dark-theme #accountStudentPromptCard div[style*="background: rgba(30, 93, 70"] {
  background: rgba(52, 211, 153, 0.15) !important;
}

/* ==========================================================================
   17. ĐỒNG BỘ DARK MODE CHO TIER CHUỖI 30 NGÀY (RUBY) & 50 NGÀY (MYTHIC)
   Loại bỏ hoàn toàn nền trắng/hồng nhạt/tím nhạt khi bật dark mode
   ========================================================================== */
/* --- TIER 4: RUBY (CHUỖI >= 30 NGÀY) --- */
html.dark-theme[data-user-theme="ruby"],
body.dark-theme[data-user-theme="ruby"] {
  --primary: #fb7185;
  --primary-soft: rgba(251, 113, 133, 0.18);
  --accent: #f43f5e;
  --green: #fb7185;
  --ink: #fbebf0;
  --ink-deep: #ffffff;
  --paper: #150d10;
  --cream: #1e1317;
  --line: #381a24;
  --sage: #2a141c;
  --sage-2: #211016;
  --muted: #b898a3;
  --surface-bg: #1e1317;
  --text: #fbebf0;
}

html.dark-theme[data-user-theme="ruby"] body,
body.dark-theme[data-user-theme="ruby"] body,
[data-user-theme="ruby"] body.dark-theme {
  background: #150d10 !important;
  color: #fbebf0 !important;
}

[data-user-theme="ruby"] body.dark-theme .site-header {
  background: rgba(21, 13, 16, 0.92) !important;
  border-bottom-color: rgba(251, 113, 133, 0.2) !important;
}

[data-user-theme="ruby"] body.dark-theme .brand-colon {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .search-panel {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.25) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55) !important;
}

[data-user-theme="ruby"] body.dark-theme .search-panel input,
[data-user-theme="ruby"] body.dark-theme .search-inline input {
  color: #fbebf0 !important;
}

[data-user-theme="ruby"] body.dark-theme .search-glyph,
[data-user-theme="ruby"] body.dark-theme .search-inline span {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .topics-card,
[data-user-theme="ruby"] body.dark-theme .mini-card,
[data-user-theme="ruby"] body.dark-theme .active-card {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.2) !important;
}

[data-user-theme="ruby"] body.dark-theme .active-card-title>span {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .topic {
  background: #27161e !important;
  border-color: rgba(251, 113, 133, 0.25) !important;
  color: #fda4af !important;
}

[data-user-theme="ruby"] body.dark-theme .topic:hover {
  background: #341b27 !important;
  border-color: #fb7185 !important;
  color: #ffffff !important;
}

[data-user-theme="ruby"] body.dark-theme .post-tag {
  color: #fda4af !important;
  background: rgba(251, 113, 133, 0.15) !important;
}

[data-user-theme="ruby"] body.dark-theme .post-card:hover {
  background: rgba(251, 113, 133, 0.05) !important;
}

[data-user-theme="ruby"] body.dark-theme .button-primary {
  background: linear-gradient(135deg, #be123c 0%, #e11d48 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.45) !important;
}

[data-user-theme="ruby"] body.dark-theme .button-dark {
  background: #2c1620 !important;
  color: #fecdd3 !important;
  border: 1px solid rgba(251, 113, 133, 0.2) !important;
}

[data-user-theme="ruby"] body.dark-theme .button-dark:hover {
  background: #3b1c2b !important;
}

[data-user-theme="ruby"] body.dark-theme .button-outline {
  border-color: rgba(251, 113, 133, 0.35) !important;
  color: #fecdd3 !important;
  background: rgba(251, 113, 133, 0.06) !important;
}

[data-user-theme="ruby"] body.dark-theme .button-outline:hover {
  background: rgba(251, 113, 133, 0.15) !important;
  border-color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .profile-chip {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.25) !important;
  color: #fbebf0 !important;
}

[data-user-theme="ruby"] body.dark-theme .profile-chip b {
  background: rgba(251, 113, 133, 0.2) !important;
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .nav-link {
  color: #b898a3 !important;
}

[data-user-theme="ruby"] body.dark-theme .nav-link:hover,
[data-user-theme="ruby"] body.dark-theme .nav-link.active {
  background: rgba(251, 113, 133, 0.12) !important;
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .icon-button:hover {
  background: rgba(251, 113, 133, 0.12) !important;
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .account-stats>div {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.2) !important;
  color: #fbebf0 !important;
}

[data-user-theme="ruby"] body.dark-theme #accountStudentPromptCard {
  background: #1e1317 !important;
  border: 1px solid rgba(251, 113, 133, 0.25) !important;
  border-left: 4px solid #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme #accountStudentPromptCard strong {
  color: #fbebf0 !important;
}

[data-user-theme="ruby"] body.dark-theme #accountStudentPromptCard span {
  color: #b898a3 !important;
}

[data-user-theme="ruby"] body.dark-theme #accountStudentPromptCard svg {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .quick-menu-dropdown {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.25) !important;
}

[data-user-theme="ruby"] body.dark-theme .quick-menu-item:hover {
  background: rgba(251, 113, 133, 0.12) !important;
  color: #ffffff !important;
}

[data-user-theme="ruby"] body.dark-theme .quick-menu-item.quick-menu-primary {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-carousel-header {
  background: #1e1317 !important;
  border-color: rgba(251, 113, 133, 0.2) !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-active-title {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-tab.active {
  background: #e11d48 !important;
  color: #ffffff !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-tab {
  color: #fda4af !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-dot.active {
  background: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme h1 em {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .hero-copy h1,
[data-user-theme="ruby"] body.dark-theme h1,
[data-user-theme="ruby"] body.dark-theme h2,
[data-user-theme="ruby"] body.dark-theme h3 {
  color: #ffffff !important;
}

[data-user-theme="ruby"] body.dark-theme .hero-intro {
  color: #cbd5e1 !important;
}

[data-user-theme="ruby"] body.dark-theme .admin-panel {
  background: linear-gradient(135deg, #2b0b14 0%, #400f1c 50%, #541122 100%) !important;
  border: 1px solid rgba(251, 113, 133, 0.25) !important;
}

[data-user-theme="ruby"] body.dark-theme .eyebrow,
html.dark-theme[data-user-theme="ruby"] body .eyebrow,
[data-user-theme="ruby"] body.dark-theme .stat-card .eyebrow,
[data-user-theme="ruby"] body.dark-theme .document-card .eyebrow,
[data-user-theme="ruby"] body.dark-theme .admin-panel .eyebrow,
[data-user-theme="ruby"] body.dark-theme .account-header .eyebrow,
[data-user-theme="ruby"] body.dark-theme .profile-large .eyebrow,
[data-user-theme="ruby"] body.dark-theme .streak-journey-header .eyebrow,
[data-user-theme="ruby"] body.dark-theme .streak-shield-header .eyebrow {
  color: #fda4af !important;
}

[data-user-theme="ruby"] body.dark-theme .text-link,
[data-user-theme="ruby"] body.dark-theme a.text-link,
html.dark-theme[data-user-theme="ruby"] body .text-link,
html.dark-theme[data-user-theme="ruby"] body a.text-link {
  color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .role-label {
  color: #fecdd3 !important;
}

[data-user-theme="ruby"] body.dark-theme label:not(.theme-switch) {
  color: #fda4af !important;
}

[data-user-theme="ruby"] body.dark-theme .tab.active,
[data-user-theme="ruby"] body.dark-theme .tab-button.active,
[data-user-theme="ruby"] body.dark-theme .account-tab-btn.active {
  color: #fb7185 !important;
  border-bottom-color: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .tab.active:after {
  background: #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-points {
  background: rgba(225, 29, 72, 0.15) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(225, 29, 72, 0.3) !important;
}

[data-user-theme="ruby"] body.dark-theme .leaderboard-item.is-me .lb-capsule {
  background: #2b0d14 !important;
  border: 1.5px solid #fb7185 !important;
}

[data-user-theme="ruby"] body.dark-theme .leaderboard-item.is-me .lb-cover-overlay {
  background: linear-gradient(118deg,
      #2b0d14 0%,
      #2b0d14 32%,
      rgba(43, 13, 20, 0.95) 44%,
      rgba(43, 13, 20, 0.68) 58%,
      rgba(43, 13, 20, 0.2) 76%,
      rgba(43, 13, 20, 0) 95%) !important;
}

[data-user-theme="ruby"] body.dark-theme .lb-rank-badge.rank-me {
  background: #fb7185 !important;
  color: #4c0519 !important;
}

[data-user-theme="ruby"] body.dark-theme #study .study-heading h1 em {
  color: #fb7185 !important;
}


/* --- TIER 5: MYTHIC (CHUỖI >= 50 NGÀY) --- */
html.dark-theme[data-user-theme="mythic"],
body.dark-theme[data-user-theme="mythic"] {
  --primary: #c084fc;
  --primary-soft: rgba(192, 132, 252, 0.18);
  --accent: #e879f9;
  --green: #c084fc;
  --ink: #f3effb;
  --ink-deep: #ffffff;
  --paper: #110d19;
  --cream: #181224;
  --line: #2e2040;
  --sage: #231835;
  --sage-2: #1b1229;
  --muted: #a89bc2;
  --surface-bg: #181224;
  --text: #f3effb;
}

html.dark-theme[data-user-theme="mythic"] body,
body.dark-theme[data-user-theme="mythic"] body,
[data-user-theme="mythic"] body.dark-theme {
  background: #110d19 !important;
  color: #f3effb !important;
}

[data-user-theme="mythic"] body.dark-theme .site-header {
  background: rgba(17, 13, 25, 0.92) !important;
  border-bottom-color: rgba(192, 132, 252, 0.2) !important;
}

[data-user-theme="mythic"] body.dark-theme .brand-colon {
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .search-panel {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.25) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55) !important;
}

[data-user-theme="mythic"] body.dark-theme .search-panel input,
[data-user-theme="mythic"] body.dark-theme .search-inline input {
  color: #f3effb !important;
}

[data-user-theme="mythic"] body.dark-theme .search-glyph,
[data-user-theme="mythic"] body.dark-theme .search-inline span {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .topics-card,
[data-user-theme="mythic"] body.dark-theme .mini-card,
[data-user-theme="mythic"] body.dark-theme .active-card {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.2) !important;
}

[data-user-theme="mythic"] body.dark-theme .active-card-title>span {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .topic {
  background: #231836 !important;
  border-color: rgba(192, 132, 252, 0.25) !important;
  color: #d8b4fe !important;
}

[data-user-theme="mythic"] body.dark-theme .topic:hover {
  background: #2e1e47 !important;
  border-color: #c084fc !important;
  color: #ffffff !important;
}

[data-user-theme="mythic"] body.dark-theme .post-tag {
  color: #d8b4fe !important;
  background: rgba(192, 132, 252, 0.15) !important;
}

[data-user-theme="mythic"] body.dark-theme .post-card:hover {
  background: rgba(192, 132, 252, 0.05) !important;
}

[data-user-theme="mythic"] body.dark-theme .button-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #c026d3 50%, #f43f5e 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.45) !important;
}

[data-user-theme="mythic"] body.dark-theme .button-dark {
  background: #241738 !important;
  color: #e9d5ff !important;
  border: 1px solid rgba(192, 132, 252, 0.2) !important;
}

[data-user-theme="mythic"] body.dark-theme .button-dark:hover {
  background: #311e4d !important;
}

[data-user-theme="mythic"] body.dark-theme .button-outline {
  border-color: rgba(192, 132, 252, 0.35) !important;
  color: #e9d5ff !important;
  background: rgba(192, 132, 252, 0.06) !important;
}

[data-user-theme="mythic"] body.dark-theme .button-outline:hover {
  background: rgba(192, 132, 252, 0.15) !important;
  border-color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .profile-chip {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.25) !important;
  color: #f3effb !important;
}

[data-user-theme="mythic"] body.dark-theme .profile-chip b {
  background: rgba(192, 132, 252, 0.2) !important;
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .nav-link {
  color: #a89bc2 !important;
}

[data-user-theme="mythic"] body.dark-theme .nav-link:hover,
[data-user-theme="mythic"] body.dark-theme .nav-link.active {
  background: rgba(192, 132, 252, 0.12) !important;
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .icon-button:hover {
  background: rgba(192, 132, 252, 0.12) !important;
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .account-stats>div {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.2) !important;
  color: #f3effb !important;
}

[data-user-theme="mythic"] body.dark-theme #accountStudentPromptCard {
  background: #181224 !important;
  border: 1px solid rgba(192, 132, 252, 0.25) !important;
  border-left: 4px solid #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme #accountStudentPromptCard strong {
  color: #f3effb !important;
}

[data-user-theme="mythic"] body.dark-theme #accountStudentPromptCard span {
  color: #a89bc2 !important;
}

[data-user-theme="mythic"] body.dark-theme #accountStudentPromptCard svg {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .quick-menu-dropdown {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.25) !important;
}

[data-user-theme="mythic"] body.dark-theme .quick-menu-item:hover {
  background: rgba(192, 132, 252, 0.12) !important;
  color: #ffffff !important;
}

[data-user-theme="mythic"] body.dark-theme .quick-menu-item.quick-menu-primary {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-carousel-header {
  background: #181224 !important;
  border-color: rgba(192, 132, 252, 0.2) !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-active-title {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-tab.active {
  background: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%) !important;
  color: #ffffff !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-tab {
  color: #d8b4fe !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-dot.active {
  background: linear-gradient(90deg, #c084fc, #f472b6) !important;
}

[data-user-theme="mythic"] body.dark-theme h1 em {
  background: linear-gradient(90deg, #c084fc, #f472b6, #fb7185) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

[data-user-theme="mythic"] body.dark-theme .hero-copy h1,
[data-user-theme="mythic"] body.dark-theme h1,
[data-user-theme="mythic"] body.dark-theme h2,
[data-user-theme="mythic"] body.dark-theme h3 {
  color: #ffffff !important;
}

[data-user-theme="mythic"] body.dark-theme .hero-intro {
  color: #cbd5e1 !important;
}

[data-user-theme="mythic"] body.dark-theme .admin-panel {
  background: linear-gradient(135deg, #1c0f2b 0%, #2f103b 50%, #430d2a 100%) !important;
  border: 1px solid rgba(232, 121, 249, 0.25) !important;
}

[data-user-theme="mythic"] body.dark-theme .eyebrow,
html.dark-theme[data-user-theme="mythic"] body .eyebrow,
[data-user-theme="mythic"] body.dark-theme .stat-card .eyebrow,
[data-user-theme="mythic"] body.dark-theme .document-card .eyebrow,
[data-user-theme="mythic"] body.dark-theme .admin-panel .eyebrow,
[data-user-theme="mythic"] body.dark-theme .account-header .eyebrow,
[data-user-theme="mythic"] body.dark-theme .profile-large .eyebrow,
[data-user-theme="mythic"] body.dark-theme .streak-journey-header .eyebrow,
[data-user-theme="mythic"] body.dark-theme .streak-shield-header .eyebrow {
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .text-link,
[data-user-theme="mythic"] body.dark-theme a.text-link,
html.dark-theme[data-user-theme="mythic"] body .text-link,
html.dark-theme[data-user-theme="mythic"] body a.text-link {
  color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .role-label {
  color: #e9d5ff !important;
}

[data-user-theme="mythic"] body.dark-theme label:not(.theme-switch) {
  color: #e879f9 !important;
}

[data-user-theme="mythic"] body.dark-theme .tab.active,
[data-user-theme="mythic"] body.dark-theme .tab-button.active,
[data-user-theme="mythic"] body.dark-theme .account-tab-btn.active {
  color: #c084fc !important;
  border-bottom-color: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .tab.active:after {
  background: #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-points {
  background: rgba(147, 51, 234, 0.15) !important;
  color: #c084fc !important;
  border: 1px solid rgba(147, 51, 234, 0.3) !important;
}

[data-user-theme="mythic"] body.dark-theme .leaderboard-item.is-me .lb-capsule {
  background: #24123a !important;
  border: 1.5px solid #c084fc !important;
}

[data-user-theme="mythic"] body.dark-theme .leaderboard-item.is-me .lb-cover-overlay {
  background: linear-gradient(118deg,
      #24123a 0%,
      #24123a 32%,
      rgba(36, 18, 58, 0.95) 44%,
      rgba(36, 18, 58, 0.68) 58%,
      rgba(36, 18, 58, 0.2) 76%,
      rgba(36, 18, 58, 0) 95%) !important;
}

[data-user-theme="mythic"] body.dark-theme .lb-rank-badge.rank-me {
  background: #c084fc !important;
  color: #2e1065 !important;
}

[data-user-theme="mythic"] body.dark-theme #study .study-heading h1 em {
  background: linear-gradient(90deg, #c084fc, #f472b6, #fb7185) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* ==========================================================================
   TIER 7: SUPER DUOLINGO NEON DARK MODE (200D - BẬC THẦY HỌC THUẬT)
   Cosmic Midnight Indigo + Cyan, Emerald & Vibrant Magenta
   ========================================================================== */
html.dark-theme[data-user-theme="super"],
body.dark-theme[data-user-theme="super"] {
  --primary: #00d2ff;
  --primary-soft: rgba(0, 210, 255, 0.16);
  --accent: #ec4899;
  --green: #00f59b;
  --ink: #f8fafc;
  --ink-deep: #ffffff;
  --paper: #0b0d28;
  --cream: #13103d;
  --line: #221b5e;
  --sage: #1a154c;
  --sage-2: #15103c;
  --muted: #94a3b8;
  --surface-bg: #13103d;
  --text: #f8fafc;
}

html.dark-theme[data-user-theme="super"] body,
body.dark-theme[data-user-theme="super"] body,
[data-user-theme="super"] body.dark-theme {
  background: radial-gradient(circle at 50% 0%, #1c1352 0%, #0b0d28 65%) fixed !important;
  color: #f8fafc !important;
}

[data-user-theme="super"] body.dark-theme .site-header {
  background: rgba(11, 13, 40, 0.92) !important;
  border-bottom-color: rgba(0, 210, 255, 0.22) !important;
}

[data-user-theme="super"] body.dark-theme .brand-colon {
  color: #00d2ff !important;
}

[data-user-theme="super"] body.dark-theme .topics-card,
[data-user-theme="super"] body.dark-theme .mini-card,
[data-user-theme="super"] body.dark-theme .active-card,
[data-user-theme="super"] body.dark-theme .post-card,
[data-user-theme="super"] body.dark-theme .search-panel {
  background: #13103d !important;
  border-color: rgba(129, 140, 248, 0.22) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6) !important;
}

[data-user-theme="super"] body.dark-theme .button-primary {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #080b1e !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 20px rgba(0, 210, 255, 0.5) !important;
}

[data-user-theme="super"] body.dark-theme .button-dark {
  background: #1b164f !important;
  color: #e0f2fe !important;
  border: 1px solid rgba(0, 210, 255, 0.25) !important;
}

[data-user-theme="super"] body.dark-theme .button-outline {
  border-color: rgba(0, 210, 255, 0.35) !important;
  color: #e0f2fe !important;
  background: rgba(0, 210, 255, 0.06) !important;
}

[data-user-theme="super"] body.dark-theme .tab.active:after {
  background: #00d2ff !important;
  box-shadow: 0 0 10px #00d2ff !important;
}

[data-user-theme="super"] body.dark-theme h1 em {
  background: linear-gradient(90deg, #00f59b, #00d2ff, #ec4899) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

/* ==========================================================================
   TIER 5: ROSE QUARTZ DARK MODE (50D - HỌC GIẢ UYÊN BÁC)
   Deep Velvet Wine & Luminous Rose Quartz Accents
   ========================================================================== */
html.dark-theme[data-user-theme="rosequartz"],
body.dark-theme[data-user-theme="rosequartz"] {
  --primary: #f472b6;
  --primary-soft: rgba(244, 114, 182, 0.16);
  --accent: #fbcfe8;
  --green: #f472b6;
  --ink: #fdf2f8;
  --ink-deep: #ffffff;
  --paper: #190710;
  --cream: #240b18;
  --line: rgba(244, 114, 182, 0.22);
  --sage: #361024;
  --sage-2: #240b18;
  --muted: #f472b6;
  --surface-bg: #240b18;
  --text: #fdf2f8;
}

html.dark-theme[data-user-theme="rosequartz"] body,
body.dark-theme[data-user-theme="rosequartz"] body,
[data-user-theme="rosequartz"] body.dark-theme {
  background: radial-gradient(circle at 50% 0%, #2f0e21 0%, #14050d 75%) fixed !important;
  color: #fdf2f8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .site-header {
  background: rgba(25, 7, 16, 0.88) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  border-bottom: 1px solid rgba(244, 114, 182, 0.25) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .brand-colon {
  color: #f472b6 !important;
  text-shadow: 0 0 10px rgba(244, 114, 182, 0.7) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .topics-card,
[data-user-theme="rosequartz"] body.dark-theme .mini-card,
[data-user-theme="rosequartz"] body.dark-theme .active-card,
[data-user-theme="rosequartz"] body.dark-theme .post-card,
[data-user-theme="rosequartz"] body.dark-theme .search-panel {
  background: rgba(36, 11, 24, 0.82) !important;
  backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(244, 114, 182, 0.22) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .post-card:hover {
  background: rgba(48, 15, 33, 0.88) !important;
  border-color: rgba(244, 114, 182, 0.45) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55), 0 0 16px rgba(244, 114, 182, 0.2) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .button-primary {
  background: linear-gradient(135deg, #8a3157 0%, #c45b83 50%, #f472b6 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 18px rgba(196, 91, 131, 0.45) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .tab.active:after {
  background: #f472b6 !important;
  box-shadow: 0 0 10px #f472b6 !important;
}

/* ==========================================================================
   TIER 8: PURE CELESTIAL DIAMOND LUXURY DARK MODE (365D - HỌC GIẢ LƯU DANH)
   Titanium Obsidian + Frosted Crystal Glass + Brilliant Diamond White Accents
   ========================================================================== */
html.dark-theme[data-user-theme="diamond"],
body.dark-theme[data-user-theme="diamond"] {
  --primary: #ffffff;
  --primary-soft: rgba(255, 255, 255, 0.14);
  --accent: #38bdf8;
  --green: #94a3b8;
  --ink: #f8fafc;
  --ink-deep: #ffffff;
  --paper: #080b11;
  --cream: #0e1420;
  --line: rgba(255, 255, 255, 0.16);
  --sage: #161e2e;
  --sage-2: #111827;
  --muted: #94a3b8;
  --surface-bg: #0e1420;
  --text: #f8fafc;
}

html.dark-theme[data-user-theme="diamond"] body,
body.dark-theme[data-user-theme="diamond"] body,
[data-user-theme="diamond"] body.dark-theme {
  background: radial-gradient(circle at 50% 0%, #151d2d 0%, #080b11 60%) fixed !important;
  color: #f8fafc !important;
}

[data-user-theme="diamond"] body.dark-theme .site-header {
  background: rgba(8, 11, 17, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75), inset 0 -1px 0 rgba(255, 255, 255, 0.08) !important;
}

[data-user-theme="diamond"] body.dark-theme .brand-colon {
  color: #ffffff !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8) !important;
}

[data-user-theme="diamond"] body.dark-theme .topics-card,
[data-user-theme="diamond"] body.dark-theme .mini-card,
[data-user-theme="diamond"] body.dark-theme .active-card,
[data-user-theme="diamond"] body.dark-theme .post-card,
[data-user-theme="diamond"] body.dark-theme .search-panel {
  background: rgba(14, 20, 32, 0.82) !important;
  backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

[data-user-theme="diamond"] body.dark-theme .post-card:hover {
  background: rgba(25, 34, 52, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(255, 255, 255, 0.1) !important;
}

[data-user-theme="diamond"] body.dark-theme .button-primary {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 45%, #cbd5e1 75%, #ffffff 100%) !important;
  color: #090d16 !important;
  font-weight: 800 !important;
  letter-spacing: 0.3px !important;
  border: 1px solid rgba(255, 255, 255, 0.9) !important;
  box-shadow: 0 4px 22px rgba(255, 255, 255, 0.35), 0 0 12px rgba(255, 255, 255, 0.2) !important;
}

[data-user-theme="diamond"] body.dark-theme .button-dark {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

[data-user-theme="diamond"] body.dark-theme .button-outline {
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.04) !important;
}

[data-user-theme="diamond"] body.dark-theme .button-outline:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
}

[data-user-theme="diamond"] body.dark-theme .tab.active:after {
  background: #ffffff !important;
  box-shadow: 0 0 12px #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme h1 em {
  background: linear-gradient(110deg, #94a3b8 0%, #cbd5e1 20%, #ffffff 50%, #e0f2fe 75%, #ffffff 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5)) !important;
}

/* --- Comprehensive Dark Theme Element Overrides for Rose Quartz, Super, Diamond --- */
[data-user-theme="rosequartz"] body.dark-theme .button-dark {
  background: rgba(244, 114, 182, 0.15) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .button-outline {
  border-color: rgba(244, 114, 182, 0.3) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .button-quiet {
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .nav-link:hover,
[data-user-theme="rosequartz"] body.dark-theme .nav-link.active {
  background: rgba(244, 114, 182, 0.16) !important;
  color: #fdf2f8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .icon-button:hover,
[data-user-theme="rosequartz"] body.dark-theme .profile-chip b {
  background: rgba(244, 114, 182, 0.16) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .search-glyph,
[data-user-theme="rosequartz"] body.dark-theme .search-inline span {
  color: #f472b6 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .search-inline {
  border-color: rgba(244, 114, 182, 0.3) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .filter-chip:hover,
[data-user-theme="rosequartz"] body.dark-theme .filter-chip.selected {
  background: rgba(244, 114, 182, 0.2) !important;
  color: #fdf2f8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .filter-button {
  border-color: rgba(244, 114, 182, 0.3) !important;
  background: rgba(36, 11, 24, 0.9) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .lb-tab.active {
  background: linear-gradient(135deg, #8a3157, #c45b83) !important;
  color: #ffffff !important;
}

[data-user-theme="rosequartz"] body.dark-theme .lb-dot.active {
  background: #f472b6 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .post-tag {
  color: #fbcfe8 !important;
  background: rgba(244, 114, 182, 0.15) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .topic {
  border-color: rgba(244, 114, 182, 0.25) !important;
  background: rgba(36, 11, 24, 0.7) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .topic:hover {
  border-color: #f472b6 !important;
  background: rgba(244, 114, 182, 0.2) !important;
}

[data-user-theme="rosequartz"] body.dark-theme .active-card-title>span {
  color: #f472b6 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .post-meta b:not([class*="user-name"]):not(.user-name-default),
[data-user-theme="rosequartz"] body.dark-theme .text-link {
  color: #f472b6 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .announcement {
  border-left-color: #f472b6 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .announcement-icon,
[data-user-theme="rosequartz"] body.dark-theme .activity-icon {
  background: rgba(244, 114, 182, 0.15) !important;
  color: #fbcfe8 !important;
}

[data-user-theme="rosequartz"] body.dark-theme .activity-points {
  color: #f472b6 !important;
}

/* Super Neon Dark Element Overrides */
[data-user-theme="super"] body.dark-theme .button-quiet {
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .nav-link:hover,
[data-user-theme="super"] body.dark-theme .nav-link.active {
  background: rgba(0, 210, 255, 0.16) !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .icon-button:hover,
[data-user-theme="super"] body.dark-theme .profile-chip b {
  background: rgba(0, 210, 255, 0.16) !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .search-glyph,
[data-user-theme="super"] body.dark-theme .search-inline span {
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .search-inline {
  border-color: rgba(0, 210, 255, 0.3) !important;
}

[data-user-theme="super"] body.dark-theme .filter-chip:hover,
[data-user-theme="super"] body.dark-theme .filter-chip.selected {
  background: rgba(0, 210, 255, 0.2) !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .filter-button {
  border-color: rgba(0, 210, 255, 0.3) !important;
  background: #13103d !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .lb-tab.active {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #080b1e !important;
}

[data-user-theme="super"] body.dark-theme .lb-dot.active {
  background: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .post-tag {
  color: #00f59b !important;
  background: rgba(0, 245, 155, 0.15) !important;
}

[data-user-theme="super"] body.dark-theme .topic {
  border-color: rgba(0, 210, 255, 0.25) !important;
  background: #13103d !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .topic:hover {
  border-color: #00f59b !important;
  background: rgba(0, 210, 255, 0.18) !important;
}

[data-user-theme="super"] body.dark-theme .active-card-title>span {
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .post-meta b:not([class*="user-name"]):not(.user-name-default),
[data-user-theme="super"] body.dark-theme .text-link {
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .announcement {
  border-left-color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .announcement-icon,
[data-user-theme="super"] body.dark-theme .activity-icon {
  background: rgba(0, 245, 155, 0.15) !important;
  color: #00f59b !important;
}

[data-user-theme="super"] body.dark-theme .activity-points {
  color: #00f59b !important;
}

/* Diamond Celestial Dark Element Overrides */
[data-user-theme="diamond"] body.dark-theme .button-dark {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .button-outline {
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .button-quiet {
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .nav-link:hover,
[data-user-theme="diamond"] body.dark-theme .nav-link.active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .icon-button:hover,
[data-user-theme="diamond"] body.dark-theme .profile-chip b {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .search-glyph,
[data-user-theme="diamond"] body.dark-theme .search-inline span {
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .search-inline {
  border-color: rgba(255, 255, 255, 0.25) !important;
}

[data-user-theme="diamond"] body.dark-theme .filter-chip:hover,
[data-user-theme="diamond"] body.dark-theme .filter-chip.selected {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .filter-button {
  border-color: rgba(255, 255, 255, 0.25) !important;
  background: #0e1420 !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .lb-tab.active {
  background: linear-gradient(135deg, #ffffff, #cbd5e1) !important;
  color: #090d16 !important;
}

[data-user-theme="diamond"] body.dark-theme .lb-dot.active {
  background: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .post-tag {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

[data-user-theme="diamond"] body.dark-theme .topic {
  border-color: rgba(255, 255, 255, 0.2) !important;
  background: #0e1420 !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .topic:hover {
  border-color: #ffffff !important;
  background: rgba(255, 255, 255, 0.15) !important;
}

[data-user-theme="diamond"] body.dark-theme .active-card-title>span {
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .post-meta b:not([class*="user-name"]):not(.user-name-default),
[data-user-theme="diamond"] body.dark-theme .text-link {
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .announcement {
  border-left-color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .announcement-icon,
[data-user-theme="diamond"] body.dark-theme .activity-icon {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

[data-user-theme="diamond"] body.dark-theme .activity-points {
  color: #ffffff !important;
}



/* ==========================================================================
   18. PHÒNG TỰ HỌC (#study) TOÀN DIỆN TRONG DARK MODE
   ========================================================================== */
body.dark-theme #study .study-heading h1 {
  color: #f1f5f9 !important;
}

body.dark-theme #study .study-heading h1 em {
  color: #4ade80 !important;
  font-style: italic;
}

body.dark-theme #study .study-panel,
body.dark-theme #study .study-card,
body.dark-theme #study .todo-card {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .study-mode-btn:not(.active) {
  background: #161f28 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .study-mode-btn:not(.active) strong {
  color: #f1f5f9 !important;
}

body.dark-theme .study-mode-btn:not(.active) span {
  color: #94a3b8 !important;
}

body.dark-theme .study-mode-btn:hover:not(.active) {
  background: #1f2b38 !important;
  border-color: #34d399 !important;
}

body.dark-theme .study-mode-btn.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
}

body.dark-theme .study-quote-card {
  background: #161f28 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}

body.dark-theme .study-quote-card:hover {
  background: #1c2733 !important;
  border-color: var(--study-color-accessory, #34d399) !important;
}

body.dark-theme .quote-icon {
  color: var(--study-color-accessory, #34d399) !important;
}

body.dark-theme .timer-quote-text {
  color: #cbd5e1 !important;
}

body.dark-theme .timer-quote-text .quote-author {
  color: var(--study-color-accessory, #34d399) !important;
}

body.dark-theme .study-goal-box label {
  color: #86efac !important;
}

body.dark-theme .study-goal-box input {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .study-goal-box input:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
}

body.dark-theme .study-goal-box input::placeholder {
  color: #64748b !important;
}

body.dark-theme .todo-head h3 {
  color: #f1f5f9 !important;
}

body.dark-theme .todo-input-wrap input {
  background: #11161b !important;
  border: 1.5px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .todo-input-wrap input:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
}

body.dark-theme .todo-input-wrap input::placeholder {
  color: #64748b !important;
}

body.dark-theme .todo-item {
  background: #161f28 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .co-study-empty {
  background: #161f28 !important;
  border: 1px dashed rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

body.dark-theme .co-study-item,
body.dark-theme .co-study-item.theme-light-card {
  background: #161f28 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .co-study-item.theme-light-card .co-study-user-title {
  color: #f1f5f9 !important;
  text-shadow: none !important;
}

body.dark-theme .co-study-item.theme-light-card .co-study-goal {
  color: #94a3b8 !important;
}

body.dark-theme .co-study-item.theme-light-card .co-study-time {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #34d399 !important;
}

body.dark-theme .co-study-item.theme-light-card .co-study-cheers-row {
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .co-study-item.theme-light-card .co-study-cheers-label {
  color: #94a3b8 !important;
}

body.dark-theme .co-study-item.theme-light-card .cheer-btn {
  background: #1e2832 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .co-study-item.theme-light-card .cheer-btn:hover:not(:disabled) {
  background: #253342 !important;
  border-color: #34d399 !important;
}

body.dark-theme .co-study-item.is-self {
  background: rgba(52, 211, 153, 0.12) !important;
  border-color: #34d399 !important;
}

body.dark-theme .co-study-item.is-self .self-status-pill {
  background: rgba(52, 211, 153, 0.2) !important;
  color: #34d399 !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
}

/* Modal Cài đặt chu kỳ Pomodoro */
body.dark-theme .study-settings-modal {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .study-settings-modal .modal-head h2 {
  color: #f1f5f9 !important;
}

body.dark-theme .study-settings-modal .close-modal {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #94a3b8 !important;
}

body.dark-theme .study-settings-modal .close-modal:hover {
  background: #1e2832 !important;
  color: #34d399 !important;
  border-color: #34d399 !important;
}

body.dark-theme .study-settings-modal .settings-group {
  background: #141c24 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .study-settings-modal .settings-group h3 {
  color: #4ade80 !important;
}

body.dark-theme .study-settings-modal .duration-item label {
  color: #cbd5e1 !important;
}

body.dark-theme .study-settings-modal .stepper-input {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme .study-settings-modal .stepper-input input {
  color: #ffffff !important;
  background: transparent !important;
}

body.dark-theme .study-settings-modal .step-btn {
  background: #1e2832 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .study-settings-modal .step-btn:hover {
  background: #253342 !important;
  color: #34d399 !important;
}

body.dark-theme .study-settings-modal .setting-toggle-row {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .study-settings-modal .setting-toggle-row:hover {
  background: #18222d !important;
}

body.dark-theme .study-settings-modal .setting-toggle-row strong {
  color: #f1f5f9 !important;
}

body.dark-theme .study-settings-modal .setting-toggle-row span {
  color: #94a3b8 !important;
}

body.dark-theme .study-settings-modal .alarm-field label {
  color: #86efac !important;
}

body.dark-theme .study-settings-modal .alarm-field select {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .preset-chip {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body.dark-theme .preset-chip:hover {
  background: #222d38;
  color: #34d399;
  border-color: #34d399;
}

body.dark-theme .preset-chip.active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

body.dark-theme .preset-chip.custom-chip {
  background: #141c24;
}

body.dark-theme .flowtime-ratio-bar {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}

body.dark-theme .ft-ratio-btn {
  background: #182028;
  border-color: rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

body.dark-theme .ft-ratio-btn.active {
  background: #0284c7;
  color: #ffffff;
}

body.dark-theme .study-daily-goal-bar {
  background: #141c24;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .daily-goal-track {
  background: #1e293b;
}

body.dark-theme .todo-tag-mgr-btn {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body.dark-theme .todo-tag-select {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

body.dark-theme .todo-item {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

body.dark-theme .study-settings-tabs {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .settings-tab-btn {
  color: #94a3b8;
}

body.dark-theme .settings-tab-btn:hover {
  background: #1e2832;
  color: #f1f5f9;
}

body.dark-theme .settings-tab-btn.active {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

body.dark-theme .preset-card {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .preset-card:hover {
  border-color: #34d399;
  background: #18222d;
}

body.dark-theme .preset-card.active {
  background: rgba(52, 211, 153, 0.15);
  border-color: #34d399;
}

body.dark-theme .preset-card-val {
  color: #f1f5f9;
}

body.dark-theme .preset-card.active .preset-card-val {
  color: #34d399;
}

body.dark-theme .ratio-pill {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

body.dark-theme .full-cycle-badge {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

body.dark-theme .ring-mult-btn,
body.dark-theme .remind-pill-btn {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

body.dark-theme .ring-mult-btn.active,
body.dark-theme .remind-pill-btn.active {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

body.dark-theme .task-label-mgr-row {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .task-label-mgr-name {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

body.dark-theme .method-card {
  background: #141c24;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .method-card-title {
  color: #f1f5f9;
}

body.dark-theme .method-card-desc {
  color: #cbd5e1;
}

body.dark-theme .method-formula-box {
  background: #11161b;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .method-example-box {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}

body.dark-theme .method-benefit-box {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

body.dark-theme .study-method-guide-modal {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
}

/* ==========================================================================
   19. GIAO DIỆN XEM CHI TIẾT BÀI ĐĂNG TRONG DARK MODE
   Sửa triệt để chữ chìm màu xanh đen (#24352b, #425c50) sang chữ sáng rõ
   ========================================================================== */
body.dark-theme .post-detail-card {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .post-detail-card .detail-title {
  color: #f1f5f9 !important;
}

body.dark-theme .post-detail-card .detail-copy,
body.dark-theme .detail-copy,
body.dark-theme .response-copy {
  color: #e2e8f0 !important;
  /* Chữ trắng mờ cao cấp, tương phản chuẩn */
}

body.dark-theme .post-detail-card .detail-copy p,
body.dark-theme .detail-copy p,
body.dark-theme .response-copy p {
  color: #e2e8f0 !important;
}

body.dark-theme .detail-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .useful-button {
  background: #1e2832 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .useful-button:hover {
  background: #253342 !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
}

body.dark-theme .useful-button.active {
  background: rgba(52, 211, 153, 0.18) !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
}

body.dark-theme .post-detail-top-nav button,
body.dark-theme .post-detail-share-btn,
body.dark-theme .post-detail-save-btn {
  background: #1e2832 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .post-detail-top-nav button:hover,
body.dark-theme .post-detail-share-btn:hover,
body.dark-theme .post-detail-save-btn:hover {
  background: #253342 !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
}

body.dark-theme .detail-response-title {
  color: #f1f5f9 !important;
}

body.dark-theme .response-card {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .response-meta {
  color: #94a3b8 !important;
}

body.dark-theme .chosen-label {
  background: rgba(52, 211, 153, 0.18) !important;
  color: #34d399 !important;
  border: 1px solid rgba(52, 211, 153, 0.3) !important;
}

body.dark-theme .post-detail-pinned-reply {
  background: rgba(24, 32, 40, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6) !important;
}

body.dark-theme .reply-pill {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme .reply-bar.collapsed .ql-editor {
  color: #f1f5f9 !important;
}

body.dark-theme .reply-bar .dropdown-menu {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .reply-bar .dropdown-menu div {
  color: #cbd5e1 !important;
}

body.dark-theme .reply-bar .dropdown-menu div:hover {
  background: rgba(52, 211, 153, 0.14) !important;
  color: #34d399 !important;
}

/* ==========================================================================
   20. ĐỒNG BỘ TOÀN BỘ CỬA SỔ POP-UP (MODAL & DIALOG) TRONG DARK MODE
   ========================================================================== */
body.dark-theme .modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal),
body.dark-theme dialog.modal:not(.quiz-arena-modal):not(.quiz-start-confirm-modal):not(.quiz-exit-confirm-modal):not(.namecard-modal):not(.full-cover-viewer-modal):not(.namecard-studio-modal):not(.confirm-discard-modal) {
  background: #182028 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75) !important;
}

body.dark-theme .modal:not(.namecard-modal):not(.full-cover-viewer-modal) .modal-head h2,
body.dark-theme dialog.modal:not(.namecard-modal):not(.full-cover-viewer-modal) .modal-head h2 {
  color: #f1f5f9 !important;
}

body.dark-theme .modal:not(.namecard-modal):not(.full-cover-viewer-modal) .close-modal,
body.dark-theme dialog.modal:not(.namecard-modal):not(.full-cover-viewer-modal) .close-modal {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #94a3b8 !important;
}

body.dark-theme .modal:not(.namecard-modal):not(.full-cover-viewer-modal) .close-modal:hover,
body.dark-theme dialog.modal:not(.namecard-modal):not(.full-cover-viewer-modal) .close-modal:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
  color: #34d399 !important;
}

body.dark-theme .modal:not(.namecard-modal) label,
body.dark-theme dialog.modal:not(.namecard-modal) label {
  color: #86efac !important;
}

body.dark-theme .modal:not(.namecard-modal) input,
body.dark-theme .modal:not(.namecard-modal) textarea,
body.dark-theme .modal:not(.namecard-modal) select,
body.dark-theme dialog.modal:not(.namecard-modal) input,
body.dark-theme dialog.modal:not(.namecard-modal) textarea,
body.dark-theme dialog.modal:not(.namecard-modal) select {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .modal:not(.namecard-modal) input:focus,
body.dark-theme .modal:not(.namecard-modal) textarea:focus,
body.dark-theme .modal:not(.namecard-modal) select:focus,
body.dark-theme dialog.modal:not(.namecard-modal) input:focus,
body.dark-theme dialog.modal:not(.namecard-modal) textarea:focus,
body.dark-theme dialog.modal:not(.namecard-modal) select:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25) !important;
}

/* Modal xem tài liệu (.doc-viewer-dialog) */
body.dark-theme .doc-viewer-container,
body.dark-theme .doc-viewer-head {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .doc-viewer-title {
  color: #f1f5f9 !important;
}

/* ==========================================================================
   21. THẺ TÊN (NAMECARD) BẢO TOÀN TRONG DARK MODE
   ========================================================================== */
body.dark-theme .namecard-modal,
body.dark-theme dialog.modal.namecard-modal,
body.dark-theme .full-cover-viewer-modal,
body.dark-theme dialog.modal.full-cover-viewer-modal {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

body.dark-theme .namecard-canvas {
  background: #ffffff !important;
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.7) !important;
}

body.dark-theme .namecard-bio {
  color: #475569 !important;
}

body.dark-theme .namecard-block-title h3 {
  color: #0a2a20 !important;
}

body.dark-theme .nc-admin-val {
  color: #0f172a !important;
}

body.dark-theme .nc-admin-lbl {
  color: #64748b !important;
}

body.dark-theme .namecard-tile {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

body.dark-theme .namecard-tile .nc-tile-val {
  color: #0f172a !important;
}

body.dark-theme .namecard-tile .nc-tile-lbl {
  color: #64748b !important;
}

body.dark-theme .nc-admin-table {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .nc-admin-row {
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .nc-admin-lbl {
  color: #94a3b8 !important;
}

body.dark-theme .nc-admin-val {
  color: #f1f5f9 !important;
}

body.dark-theme .nc-admin-copy-btn {
  background: #1c2632 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .nc-admin-copy-btn:hover {
  background: #253344 !important;
  color: #ffffff !important;
}

body.dark-theme .nc-copy-all-btn {
  background: #1c2632 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #818cf8 !important;
}

body.dark-theme .nc-copy-all-btn:hover {
  background: #253344 !important;
  color: #a5b4fc !important;
}

/* ==========================================================================
   22. HÀNH TRÌNH GIỮ CHUỖI & KHIÊN BẢO VỆ TRONG DARK MODE
   ========================================================================== */
body.dark-theme .streak-journey-modal,
body.dark-theme .streak-shield-modal {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.75) !important;
}

body.dark-theme .streak-journey-header,
body.dark-theme .streak-shield-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .streak-journey-header h2,
body.dark-theme .streak-shield-header h2 {
  color: #f1f5f9 !important;
}

body.dark-theme .streak-journey-body,
body.dark-theme .streak-shield-body {
  background: #182028 !important;
  color: #e2e8f0 !important;
}

body.dark-theme .journey-banner-placeholder {
  background: linear-gradient(135deg, #11161b 0%, #1e2832 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .journey-banner-title {
  color: #f1f5f9 !important;
}

body.dark-theme .journey-banner-subtitle {
  color: #94a3b8 !important;
}

body.dark-theme .journey-milestone-card {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .journey-milestone-card.unlocked {
  background: rgba(245, 158, 11, 0.08) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

body.dark-theme .journey-milestone-card.active-target {
  border-color: #34d399 !important;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.25) !important;
}

body.dark-theme .milestone-badge-icon {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .milestone-days {
  color: #f1f5f9 !important;
}

body.dark-theme .milestone-status {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
}

body.dark-theme .journey-milestone-card.unlocked .milestone-status {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.35) !important;
}

body.dark-theme .milestone-desc {
  color: #94a3b8 !important;
}

body.dark-theme .milestone-perk-tag.perk-forum {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

body.dark-theme .milestone-perk-tag.perk-study {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

body.dark-theme .milestone-perk-text {
  color: #cbd5e1 !important;
}

body.dark-theme .journey-milestone-card.unlocked .milestone-perk-text {
  color: #f1f5f9 !important;
}

body.dark-theme .milestone-perk-text.perk-study-waiting {
  color: #64748b !important;
}

body.dark-theme .journey-shield-btn {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

body.dark-theme .journey-shield-btn:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
}

/* Shield modal */
body.dark-theme .shield-overview-card {
  background: linear-gradient(135deg, #11161b 0%, #1e2832 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .shield-rules-box {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .shield-rules-title {
  color: #38bdf8 !important;
}

body.dark-theme .shield-rules-list,
body.dark-theme .shield-rules-list li {
  color: #cbd5e1 !important;
}

body.dark-theme .shield-history-title {
  color: #f1f5f9 !important;
}

body.dark-theme .shield-history-tabs {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .shield-tab-btn {
  color: #94a3b8 !important;
}

body.dark-theme .shield-tab-btn:hover {
  color: #f1f5f9 !important;
}

body.dark-theme .shield-tab-btn.active {
  background: #1e2832 !important;
  color: #38bdf8 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

body.dark-theme .shield-log-item {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .shield-log-item.is-add {
  border-left: 3.5px solid #10b981 !important;
}

body.dark-theme .shield-log-item.is-use {
  border-left: 3.5px solid #ef4444 !important;
}

body.dark-theme .shield-log-badge.add {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

body.dark-theme .shield-log-badge.use {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #f87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

body.dark-theme .shield-log-reason {
  color: #f1f5f9 !important;
}

body.dark-theme .shield-log-time {
  color: #94a3b8 !important;
}

body.dark-theme .shield-log-delta {
  color: #f1f5f9 !important;
}

body.dark-theme .shield-empty-state,
body.dark-theme .shield-history-loading {
  color: #94a3b8 !important;
}

/* ==========================================================================
   23. BẢNG XẾP HẠNG (LEADERBOARD) TRONG DARK MODE
   ========================================================================== */
body.dark-theme .lb-points {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .lb-points-likes {
  background: rgba(225, 29, 72, 0.2) !important;
  color: #fb7185 !important;
  border: 1px solid rgba(251, 113, 133, 0.3) !important;
}

body.dark-theme .lb-points-study {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(251, 191, 36, 0.35) !important;
}

body.dark-theme .lb-role-admin {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

body.dark-theme .lb-role-ta {
  background: rgba(59, 130, 246, 0.2) !important;
  color: #93c5fd !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

body.dark-theme .lb-role-lecturer {
  background: rgba(168, 85, 247, 0.2) !important;
  color: #d8b4fe !important;
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
}

body.dark-theme .lb-role-member {
  background: rgba(2, 132, 199, 0.2) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(2, 132, 199, 0.3) !important;
}

body.dark-theme .leaderboard-item.is-me .lb-capsule {
  background: #0f241a !important;
  border: 1.5px solid #34d399 !important;
}

body.dark-theme .leaderboard-item.is-me:hover .lb-capsule {
  background: #143525 !important;
}

body.dark-theme .leaderboard-item.is-me .lb-cover-overlay {
  background: linear-gradient(118deg,
      #0f241a 0%,
      #0f241a 32%,
      rgba(15, 36, 26, 0.95) 44%,
      rgba(15, 36, 26, 0.68) 58%,
      rgba(15, 36, 26, 0.2) 76%,
      rgba(15, 36, 26, 0) 95%) !important;
}

body.dark-theme .lb-rank-badge.rank-me {
  background: #34d399 !important;
  color: #0a2a20 !important;
}

/* ============================================================
   EDITORIAL FEEDBACK STRIP & SITE REVIEWS
   Bespoke, crafted review section at the bottom of Home
   ============================================================ */

.site-reviews-strip {
  margin-top: 32px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(244, 241, 232, 0.65) 0%, rgba(251, 250, 245, 0.95) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  position: relative;
  overflow: hidden;
}

.reviews-strip-inner {
  display: flex;
  align-items: stretch;
  gap: 20px;
  min-height: 168px;
}

/* Cột tổng quan đánh giá bên trái */
.reviews-strip-summary {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.reviews-summary-badge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reviews-summary-icon {
  color: #f59f00;
  font-size: 13px;
  animation: pulseStar 2.5s infinite ease-in-out;
}

@keyframes pulseStar {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }

  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

.reviews-summary-label {
  font-family: var(--font-brand, var(--unbounded));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.reviews-score-cluster {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0;
}

.reviews-score-big {
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink-deep);
  letter-spacing: -0.02em;
}

.reviews-stars-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reviews-stars-visual {
  color: #f59f00;
  font-size: 1.15rem;
  letter-spacing: 2px;
  line-height: 1.2;
}

.reviews-count-meta {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.reviews-count-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.reviews-summary-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reviews-write-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.reviews-write-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(18, 61, 48, 0.15);
}

.reviews-see-all-cta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.reviews-see-all-cta:hover {
  text-decoration: underline;
  color: var(--green);
}

/* Vùng Carousel cuộn ngang luân hồi không ngừng (Infinite Marquee) */
.reviews-strip-carousel-container {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 4px;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 24px, black calc(100% - 24px), transparent 100%);
}

.reviews-strip-track {
  display: flex;
  gap: 14px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  padding: 4px 2px;
  align-items: stretch;
}

.reviews-marquee-group {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
  align-items: stretch;
  animation: reviewMarqueeScroll var(--marquee-duration, 40s) linear infinite;
  will-change: transform;
}

/* Tự động tạm dừng êm ái khi di chuột vào để người dùng dễ đọc và bấm xem */
.reviews-strip-carousel-container:hover .reviews-marquee-group {
  animation-play-state: paused;
}

@keyframes reviewMarqueeScroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(calc(-100% - 14px));
  }
}

.reviews-nav-btn {
  display: none !important;
}

/* Thẻ đánh giá trong dải cuộn ngang */
.review-strip-card {
  width: 310px;
  min-width: 310px;
  flex-shrink: 0;
  scroll-snap-align: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  cursor: pointer;
}

.review-strip-card:hover {
  transform: translateY(-2px);
  border-color: rgba(36, 98, 71, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.review-card-author-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.review-card-author-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.review-card-author-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.review-card-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-card-stars {
  color: #f59f00;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  flex-shrink: 0;
}

.review-card-content {
  font-size: 13px;
  line-height: 1.48;
  color: var(--ink);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 0 10px 0;
  opacity: 0.95;
}

.review-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
}

.review-card-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  flex: 1;
}

.review-micro-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--sage-2);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.review-micro-tag-more {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 4px;
}

.review-card-date {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================================
   MODAL VIẾT / SỬA ĐÁNH GIÁ (SITE REVIEW MODAL)
   ============================================================ */

dialog.modal.site-review-modal {
  max-width: 580px !important;
  width: min(580px, calc(100vw - 28px)) !important;
  height: auto !important;
  min-height: min(480px, 82vh) !important;
  max-height: min(88vh, 88dvh, 740px) !important;
  padding: 0 !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08)) !important;
  box-shadow: 0 24px 65px rgba(8, 39, 25, 0.28) !important;
}

dialog.modal.site-review-modal[open] {
  display: flex !important;
  flex-direction: column !important;
}

dialog.modal.site-review-modal:not([open]) {
  display: none !important;
}

.site-review-form,
.modal form.site-review-form {
  display: flex !important;
  flex-direction: column !important;
  padding: 22px 24px 20px !important;
  width: 100% !important;
  height: auto !important;
  min-height: min(480px, 82vh) !important;
  max-height: min(88vh, 88dvh, 740px) !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.site-review-modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  padding-top: 2px;
  flex-shrink: 0;
}

.site-review-modal .modal-head .eyebrow {
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.site-review-modal .modal-head h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.25;
}

.site-review-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 200px;
  padding-right: 4px;
  scrollbar-width: thin;
}

.site-review-label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-deep);
  margin-bottom: 5px;
}

.site-review-label .sub-label {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
}

.star-picker-section {
  background: var(--cream);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-align: center;
}

.star-rating-picker {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 4px;
}

.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 28px;
  color: var(--line);
  padding: 0 3px;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}

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

.star-btn.active,
.star-btn.hover-active {
  color: #f59f00;
}

.star-sentiment-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--green);
  min-height: 18px;
  transition: all 0.2s ease;
}

.site-review-tags-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.tags-selected-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary);
  background: var(--sage);
  padding: 2px 7px;
  border-radius: 999px;
}

.site-review-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 115px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.site-review-tag-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.site-review-tag-pill:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.site-review-tag-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 3px 8px rgba(18, 61, 48, 0.25);
}

.site-review-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  resize: vertical;
  min-height: 70px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.site-review-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 98, 71, 0.12);
}

.site-review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.site-review-footer .footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.dark-theme dialog.modal.site-review-modal {
  background: #111a16 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.55) !important;
}

@media (max-width: 580px) {
  dialog.modal.site-review-modal {
    width: calc(100vw - 20px) !important;
    min-height: min(440px, 86vh) !important;
    border-radius: 16px !important;
  }

  .site-review-form,
  .modal form.site-review-form {
    padding: 16px 16px 14px !important;
    min-height: min(440px, 86vh) !important;
  }

  .site-review-modal .modal-head h2 {
    font-size: 1.22rem;
  }
}

/* ============================================================
   MODAL TẤT CẢ ĐÁNH GIÁ (ALL REVIEWS MODAL)
   ============================================================ */

dialog.modal.all-reviews-modal {
  max-width: 820px !important;
  width: min(820px, calc(100vw - 28px)) !important;
  max-height: min(88vh, 850px) !important;
  padding: 24px 28px !important;
  border-radius: 20px !important;
  overflow: hidden !important;
}

dialog.modal.all-reviews-modal[open] {
  display: flex !important;
  flex-direction: column !important;
}

dialog.modal.all-reviews-modal:not([open]) {
  display: none !important;
}

.all-reviews-modal .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-top: 4px;
  flex-shrink: 0;
}

.all-reviews-modal .modal-head .eyebrow {
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.all-reviews-modal .modal-head h2 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

.all-reviews-body {
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 4px;
  scrollbar-width: thin;
}

.all-reviews-overview {
  display: flex;
  align-items: center;
  gap: 32px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 20px;
}

.overview-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  text-align: center;
  border-right: 1px solid var(--line);
  padding-right: 28px;
}

.overview-score-num {
  font-family: var(--serif);
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--ink-deep);
}

.overview-score-stars {
  color: #f59f00;
  font-size: 1.25rem;
  letter-spacing: 2px;
  margin: 4px 0 2px 0;
}

.overview-score-total {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.overview-distribution-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.distribution-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  width: 100%;
}

.dist-star-label {
  width: 42px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.dist-bar-track {
  flex: 1;
  min-width: 60px;
  height: 8px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59f00, #fbbf24);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.dist-count-label {
  width: 32px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.all-reviews-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.all-reviews-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.all-review-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease;
}

.all-review-card:hover {
  border-color: rgba(36, 98, 71, 0.4);
}

.all-review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.all-review-card-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 14px;
  white-space: pre-line;
}

.all-review-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.all-review-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ============================================================
   DARK THEME OVERRIDES FOR SITE REVIEWS
   ============================================================ */

body.dark-theme .site-reviews-strip {
  background: linear-gradient(135deg, rgba(22, 31, 40, 0.9) 0%, rgba(17, 22, 27, 0.95) 100%);
  border-color: var(--line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

body.dark-theme .reviews-strip-summary {
  border-color: var(--line);
}

body.dark-theme .reviews-summary-label {
  color: #94a3b8;
}

body.dark-theme .reviews-score-big {
  color: #f8fafc;
}

body.dark-theme .reviews-stars-visual,
body.dark-theme .review-card-stars,
body.dark-theme .overview-score-stars {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
}

body.dark-theme .review-strip-card {
  background: #161f28;
  border-color: #263341;
}

body.dark-theme .review-strip-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .reviews-nav-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-theme .reviews-nav-btn:hover {
  background: #283548;
}

body.dark-theme .star-picker-section {
  background: #161f28;
  border-color: #263341;
}

body.dark-theme .star-btn {
  color: #334155;
}

body.dark-theme .star-btn.active,
body.dark-theme .star-btn.hover-active {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}

body.dark-theme .star-sentiment-label {
  color: #34d399;
}

body.dark-theme .tags-selected-count {
  background: #1e293b;
  color: #34d399;
}

body.dark-theme .site-review-tag-pill {
  background: #161f28;
  border-color: #263341;
  color: #cbd5e1;
}

body.dark-theme .site-review-tag-pill:hover {
  border-color: #34d399;
}

body.dark-theme .site-review-tag-pill.active {
  background: #34d399;
  color: #062b1e;
  border-color: #34d399;
  box-shadow: 0 3px 10px rgba(52, 211, 153, 0.3);
}

body.dark-theme .site-review-textarea {
  background: #161f28;
  border-color: #263341;
  color: #f8fafc;
}

body.dark-theme .site-review-textarea:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}

body.dark-theme .all-reviews-overview {
  background: #161f28;
  border-color: #263341;
}

body.dark-theme .overview-score-box {
  border-color: #263341;
}

body.dark-theme .overview-score-num {
  color: #f8fafc;
}

body.dark-theme .dist-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .filter-pill {
  background: #161f28;
  border-color: #263341;
  color: #cbd5e1;
}

body.dark-theme .filter-pill.active {
  background: #34d399;
  color: #062b1e;
  border-color: #34d399;
}

body.dark-theme .all-review-card {
  background: #161f28;
  border-color: #263341;
}

body.dark-theme .all-review-card:hover {
  border-color: #34d399;
}

body.dark-theme .all-review-card-footer {
  border-color: #263341;
}

/* ============================================================
   RESPONSIVE DESIGN CHO SITE REVIEWS
   ============================================================ */

@media (max-width: 860px) {
  .reviews-strip-inner {
    flex-direction: column;
    min-height: auto;
    gap: 16px;
  }

  .reviews-strip-summary {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
    gap: 12px;
  }

  .reviews-score-cluster {
    margin: 4px 0;
  }

  .review-strip-card {
    width: 275px;
    min-width: 275px;
  }

  .all-reviews-overview {
    flex-direction: column;
    gap: 18px;
    text-align: center;
    padding: 16px !important;
  }

  .overview-score-box {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-right: 0;
    padding-bottom: 14px;
    width: 100%;
  }

  .overview-distribution-bars {
    width: 100% !important;
    align-self: stretch !important;
  }

  .all-reviews-grid {
    grid-template-columns: 1fr;
  }
}

/* ====================================================
   CLOCK STYLE SELECTOR (SETTINGS MODAL)
   ==================================================== */
.clock-style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 540px) {
  .clock-style-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.clock-style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.clock-style-card:hover {
  transform: translateY(-2px);
  border-color: var(--study-color-secondary, #10b981);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.clock-style-card.active {
  border-color: var(--study-color-secondary, #10b981) !important;
  box-shadow: 0 0 0 2px var(--study-color-secondary, #10b981), 0 6px 18px rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.05);
}

.clock-style-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.style-preview-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--study-color-secondary, #10b981);
}

.mini-flip-card {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mini-flip-sep {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  margin: 0 1px;
}

.mini-flip-shelf {
  width: 38px;
  height: 3px;
  background: var(--study-color-secondary, #10b981);
  border-radius: 2px;
  margin-top: 3px;
}

.mini-min-time {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.mini-min-line {
  width: 32px;
  height: 3px;
  background: var(--study-color-secondary, #10b981);
  border-radius: 2px;
  margin-top: 3px;
}

.mini-dig-box {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 3px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mini-dig-display {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 800;
  color: var(--study-color-primary, #10b981);
}

.mini-dig-segments {
  font-size: 7px;
  color: var(--study-color-secondary, #10b981);
  line-height: 1;
  margin-top: 1px;
  letter-spacing: -1px;
}

/* ====================================================
   3 COLOR ROLES CUSTOMIZATION
   ==================================================== */
.color-swatch-row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.color-role-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.color-role-swatch:hover {
  transform: scale(1.18);
}

.color-role-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #0f172a, 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: scale(1.12);
}

.color-role-swatch.locked {
  filter: grayscale(0.55) opacity(0.6);
  cursor: pointer;
}

/* 3 Nút chọn màu đa sắc tròn đồng bộ kích cỡ (24px x 24px) */
.study-custom-color-picker-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.study-custom-color-circle-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: conic-gradient(from 0deg,
      #ff0055 0deg,
      #ff5500 45deg,
      #ffcc00 90deg,
      #33cc33 135deg,
      #00ccff 180deg,
      #3366ff 225deg,
      #cc00ff 270deg,
      #ff0099 315deg,
      #ff0055 360deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
  outline: none;
}

.study-custom-color-circle-btn:not(.locked):hover {
  transform: scale(1.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.study-custom-color-circle-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--surface, #ffffff), 0 0 0 3px #0f172a, 0 2px 8px rgba(0, 0, 0, 0.35);
}

.study-custom-color-circle-btn .custom-color-active-dot {
  display: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--custom-current-color, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.study-custom-color-circle-btn.active:not(.locked) .custom-color-active-dot {
  display: block;
}

.study-custom-color-circle-btn.locked .custom-color-active-dot {
  display: none !important;
}

.study-custom-color-circle-btn.locked {
  filter: grayscale(0.65) opacity(0.75);
  cursor: pointer;
}

.study-custom-color-circle-btn.locked:hover {
  transform: scale(1.08);
}

.study-custom-color-circle-btn .custom-color-lock-icon {
  display: none;
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.9));
}

.study-custom-color-circle-btn.locked .custom-color-lock-icon {
  display: flex;
}

.visually-hidden-color-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ====================================================
   WALLPAPER ENHANCED CONTRAST
   ==================================================== */
#study.has-custom-bg .study-meta-pill {
  background: rgba(15, 23, 42, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .study-quick-task-prompt {
  background: rgba(15, 23, 42, 0.65) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #f1f5f9 !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#study.has-custom-bg .study-quick-task-prompt .prompt-text {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .study-dock-toolbar {
  background: rgba(15, 23, 42, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

#study.has-custom-bg .dock-btn {
  color: #cbd5e1 !important;
}

#study.has-custom-bg .dock-btn:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.18) !important;
}

#study.has-custom-bg .space-filter-pill {
  background: rgba(15, 23, 42, 0.65) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #cbd5e1 !important;
  backdrop-filter: blur(10px);
}

#study.has-custom-bg .space-filter-pill.active {
  background: var(--study-color-accessory, #10b981) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

#study.has-custom-bg .private-pod-promo-card,
#study.has-custom-bg .library-room-card,
#study.has-custom-bg .meeting-room-card {
  background: rgba(15, 23, 42, 0.68) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #f8fafc !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#study.has-custom-bg .private-pod-promo-card h4,
#study.has-custom-bg .library-room-card h4,
#study.has-custom-bg .meeting-room-card h4 {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .todo-integrated-section {
  border-top-color: rgba(255, 255, 255, 0.2) !important;
}

#study.has-custom-bg .todo-head h3,
#study.has-custom-bg .todo-pct-badge {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

#study.has-custom-bg .todo-head-icon-btn {
  background: rgba(15, 23, 42, 0.65) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #cbd5e1 !important;
}

#study.has-custom-bg .todo-head-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

#study.has-custom-bg .todo-input-wrap input,
#study.has-custom-bg .todo-tag-select {
  background: rgba(15, 23, 42, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

#study.has-custom-bg .todo-item {
  background: rgba(15, 23, 42, 0.68) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
}

/* ==========================================================================
   22. POST LINKED DOCUMENT & EXTERNAL LINK VIEWER
   ========================================================================== */
.post-linked-docs-block {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.post-linked-docs-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.post-linked-doc-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2, rgba(235, 240, 237, 0.6));
  border: 1px solid var(--line, #e2e8f0);
  border-left: 4px solid var(--primary, #123d30);
  border-radius: 8px;
  padding: 9px 14px;
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.post-linked-doc-card:hover {
  border-color: var(--primary, #123d30);
  background: var(--surface, #ffffff);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.post-linked-doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  background: rgba(18, 61, 48, 0.08);
  color: var(--primary, #123d30);
  flex-shrink: 0;
}

.post-linked-doc-info {
  flex: 1;
  min-width: 0;
}

.post-linked-doc-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--sage-5, #5e7a68);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-linked-doc-eyebrow .doc-format-badge {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.post-linked-doc-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}

.post-linked-doc-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.post-doc-tag {
  background: rgba(18, 61, 48, 0.08) !important;
  color: var(--primary, #123d30) !important;
  border: 1px solid rgba(18, 61, 48, 0.2) !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.post-doc-tag:hover {
  background: rgba(18, 61, 48, 0.15) !important;
}

@keyframes highlightDocPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 61, 48, 0.6);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(18, 61, 48, 0);
    transform: scale(1.02);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(18, 61, 48, 0);
    transform: scale(1);
  }
}

.document-card.highlight-pulse,
.response.highlight-pulse,
.doc-comment-card.highlight-pulse {
  animation: highlightDocPulse 1.2s ease-in-out 2;
  border-color: var(--primary) !important;
}

body.dark-theme .post-linked-doc-card {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
  border-left-color: #34d399;
}

body.dark-theme .post-linked-doc-card:hover {
  background: #202b36;
  border-color: #34d399;
}

body.dark-theme .post-linked-doc-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

body.dark-theme .post-linked-doc-title {
  color: #f1f5f9;
}

body.dark-theme .post-linked-doc-eyebrow {
  color: #94a3b8;
}

body.dark-theme .post-linked-doc-eyebrow .doc-format-badge {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-theme .post-doc-tag {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(52, 211, 153, 0.3) !important;
}

@media (max-width: 640px) {
  .post-linked-doc-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .post-linked-doc-icon {
    display: none !important;
  }

  .post-linked-doc-info {
    width: 100%;
    min-width: 0;
  }

  .post-linked-doc-title {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: 13.5px;
    line-height: 1.4;
  }

  .post-linked-doc-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
  }

  .post-linked-doc-actions .button {
    font-size: 12px !important;
    padding: 5px 10px !important;
  }

  .doc-attach-item-title {
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
  }
}

/* ==========================================================================
   23. SMART DOCUMENT PICKER & ATTACHMENT WIDGET
   ========================================================================== */
.button-xs {
  padding: 3px 8px !important;
  font-size: 11px !important;
  height: 26px !important;
  border-radius: 6px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.doc-attach-box {
  border: 1.5px dashed var(--line, #cbd5e1);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
  transition: all 0.2s ease;
  overflow: hidden;
}

.doc-attach-box:hover {
  border-color: var(--primary, #123d30);
  background: var(--surface, #ffffff);
}

.doc-attach-empty-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
}

.doc-attach-empty-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(18, 61, 48, 0.08);
  color: var(--primary, #123d30);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-attach-empty-text {
  flex: 1;
  min-width: 0;
}

.doc-attach-empty-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.doc-attach-empty-desc {
  font-size: 11.5px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.doc-attach-btn {
  flex-shrink: 0;
  font-size: 12px !important;
  padding: 6px 12px !important;
}

.doc-attach-selected-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(18, 61, 48, 0.04);
  border: 1px solid rgba(18, 61, 48, 0.25);
  border-radius: 10px;
}

.doc-format-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--primary, #123d30);
  color: #ffffff;
  text-transform: uppercase;
  flex-shrink: 0;
}

.doc-attach-selected-info {
  flex: 1;
  min-width: 0;
}

.doc-attach-selected-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-attach-selected-meta {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.doc-attach-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Document Picker List Item */
.doc-picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  transition: all 0.15s ease;
  cursor: pointer;
}

.doc-picker-item:hover {
  border-color: var(--primary, #123d30);
  background: var(--surface-2, #f8fafc);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.doc-picker-item.is-selected {
  border-color: var(--primary, #123d30);
  background: rgba(18, 61, 48, 0.06);
}

.doc-picker-item-info {
  flex: 1;
  min-width: 0;
}

.doc-picker-item-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-picker-item-desc {
  font-size: 12px;
  color: var(--muted, #64748b);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-picker-item-meta {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.dark-theme .doc-attach-box {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .doc-attach-empty-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

body.dark-theme .doc-attach-empty-title,
body.dark-theme .doc-attach-selected-title {
  color: #f1f5f9;
}

body.dark-theme .doc-attach-selected-state {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.3);
}

body.dark-theme .doc-format-pill {
  background: #34d399;
  color: #064e3b;
}

body.dark-theme .doc-picker-item {
  background: #182028;
  border-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .doc-picker-item:hover {
  background: #202b36;
  border-color: #34d399;
}

body.dark-theme .doc-picker-item.is-selected {
  background: rgba(52, 211, 153, 0.12);
  border-color: #34d399;
}

body.dark-theme .doc-picker-item-title {
  color: #f1f5f9;
}

body.dark-theme .doc-picker-container,
body.dark-theme .doc-picker-head,
body.dark-theme .doc-picker-footer {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .doc-picker-toolbar {
  background: #131920 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* Multi-document attachment list inside forms */
.doc-attach-multi-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.doc-attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(18, 61, 48, 0.04);
  border: 1px solid rgba(18, 61, 48, 0.22);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.doc-attach-item:hover {
  background: rgba(18, 61, 48, 0.08);
}

.doc-attach-item-info {
  flex: 1;
  min-width: 0;
}

.doc-attach-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.35;
}

.doc-attach-item-meta {
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 1px;
}

.doc-attach-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.doc-attach-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2, #f8fafc);
  border-top: 1px dashed var(--line, #cbd5e1);
}

body.dark-theme .doc-attach-item {
  background: rgba(52, 211, 153, 0.06);
  border-color: rgba(52, 211, 153, 0.25);
}

body.dark-theme .doc-attach-item:hover {
  background: rgba(52, 211, 153, 0.12);
}

body.dark-theme .doc-attach-item-title {
  color: #f1f5f9;
}

body.dark-theme .doc-attach-add-row {
  background: #182028;
  border-top-color: rgba(255, 255, 255, 0.12);
}

/* Post list multi-doc badge */
.post-doc-more-tag {
  background: rgba(18, 61, 48, 0.1) !important;
  color: var(--primary) !important;
  font-weight: 600 !important;
  cursor: pointer;
}

body.dark-theme .post-doc-more-tag {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
}

/* Platform Rating Prompt Banner (5 minutes active) */
#platformRatingBanner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999990;
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  font-family: inherit;
  max-width: 440px;
  box-sizing: border-box;
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: slideUpRatingPrompt 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpRatingPrompt {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  #platformRatingBanner {
    left: 14px !important;
    right: 14px !important;
    bottom: 14px !important;
    max-width: none !important;
  }
}

/* Document Subtitle / Citation & Viewer Subtitle */
.document-subtitle {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: -4px 0 9px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  font-style: italic;
}

.document-subtitle .doc-sub-icon {
  font-style: normal;
  font-size: 13px;
  opacity: 0.85;
}

.doc-viewer-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
  line-height: 1.35;
}

body.dark-theme .document-subtitle,
body.dark-theme .doc-viewer-subtitle {
  color: #94a3b8;
}

/* ==========================================================================
   DARK THEME COMPREHENSIVE INPUTS & BUTTONS AUDIT
   ========================================================================== */

/* 1. Global text inputs, textareas, selects in dark mode */
body.dark-theme input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]),
body.dark-theme textarea,
body.dark-theme select {
  background-color: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):focus,
body.dark-theme textarea:focus,
body.dark-theme select:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2) !important;
}

/* 2. Disabled states in dark mode (prevent bright white blinding inputs) */
body.dark-theme input:disabled,
body.dark-theme textarea:disabled,
body.dark-theme select:disabled {
  background-color: #161e26 !important;
  color: #64748b !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  cursor: not-allowed !important;
}

/* 3. Select options & dropdown menus in dark mode */
body.dark-theme select option {
  background-color: #182028 !important;
  color: #f1f5f9 !important;
}

/* 4. Placeholder colors */
body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}

/* 5. Custom inputs in study spaces, task lists, admin panel */
body.dark-theme .task-label-mgr-row input.task-label-mgr-name,
body.dark-theme .shared-task-add-row input,
body.dark-theme .input-field,
body.dark-theme .todo-tag-select,
body.dark-theme #studyGoalInput,
body.dark-theme #inputQuickJoinCode,
body.dark-theme #newSharedTaskInput,
body.dark-theme #newTodoInput {
  background-color: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

/* 6. Stepper inputs & select boxes in study settings */
body.dark-theme .study-settings-modal .stepper-input {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme .study-settings-modal .stepper-input input {
  background: transparent !important;
  color: #f1f5f9 !important;
}

body.dark-theme .study-settings-modal .alarm-field select {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

/* 7. Buttons: button-outline, admin buttons, useful button, switch groups */
body.dark-theme .button-outline {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .button-outline:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme .admin-bar-actions .button {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .admin-bar-actions .button:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme .useful-button {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .useful-button:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme .switch-group {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

body.dark-theme .identity-choice {
  color: #94a3b8 !important;
}

body.dark-theme .identity-choice.selected {
  background: #34d399 !important;
  color: #0b1a13 !important;
}

body.dark-theme .filter-button {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

body.dark-theme .filter-button:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme .filter-chip.selected {
  background: rgba(52, 211, 153, 0.2) !important;
  color: #34d399 !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
}

/* 8. Study confirmation dialogs in dark mode */
body.dark-theme dialog.study-confirm-modal,
body.dark-theme dialog#studyExitConfirmModal,
body.dark-theme dialog#studyJoinPinModal,
body.dark-theme dialog#studyCreateMeetingModal,
body.dark-theme dialog#studySwitchSpaceConfirmModal {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

/* ==========================================================================
   21. KHU VỰC ĐĂNG BÀI THẢO LUẬN & ĐỀ XUẤT TÀI LIỆU TRONG DARK MODE
   ========================================================================== */

/* 1. Modal đăng bài (#questionModal) & Modal chỉnh sửa (#editModal) */
body.dark-theme #questionModal,
body.dark-theme #editModal,
body.dark-theme #documentModal {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 25px 75px rgba(0, 0, 0, 0.8) !important;
}

body.dark-theme #questionModal .modal-head h2,
body.dark-theme #editModal .modal-head h2,
body.dark-theme #documentModal .modal-head h2 {
  color: #f1f5f9 !important;
}

body.dark-theme #questionModal label,
body.dark-theme #editModal label,
body.dark-theme #documentModal label {
  color: #34d399 !important;
}

body.dark-theme #questionModal small,
body.dark-theme #editModal small,
body.dark-theme #documentModal small {
  color: #94a3b8 !important;
}

/* 2. Anonymous Choice container & switch */
body.dark-theme .anonymous-choice {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .anonymous-choice strong {
  color: #f1f5f9 !important;
}

body.dark-theme .anonymous-choice span {
  color: #94a3b8 !important;
}

/* 3. Document attachment box & items */
body.dark-theme .doc-attach-box {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

body.dark-theme .doc-attach-box:hover {
  background: #182028 !important;
  border-color: #34d399 !important;
}

body.dark-theme .doc-attach-empty-title {
  color: #f1f5f9 !important;
}

body.dark-theme .doc-attach-empty-desc {
  color: #94a3b8 !important;
}

body.dark-theme .doc-attach-empty-icon {
  background: rgba(52, 211, 153, 0.15) !important;
  color: #34d399 !important;
}

body.dark-theme .doc-attach-item {
  background: #182028 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme .doc-attach-item:hover {
  background: #202b36 !important;
  border-color: #34d399 !important;
}

body.dark-theme .doc-attach-item-title {
  color: #f1f5f9 !important;
}

body.dark-theme .doc-attach-item-meta {
  color: #94a3b8 !important;
}

body.dark-theme .doc-attach-add-row {
  background: #11161b !important;
  border-top: 1px dashed rgba(255, 255, 255, 0.14) !important;
}

/* 4. Proposal / Select buttons */
body.dark-theme #proposeTopicBtn {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #34d399 !important;
}

body.dark-theme #proposeTopicBtn:hover {
  background: #182028 !important;
  border-color: #34d399 !important;
}

/* 5. Document Modal guideline banner */
body.dark-theme #documentModal div[style*="background: var(--sage-2)"] {
  background: #11161b !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
}

body.dark-theme #documentModal div[style*="background: var(--sage-2)"] strong {
  color: #34d399 !important;
}

body.dark-theme #documentModal div[style*="background: var(--sage-2)"] a {
  color: #4ade80 !important;
}

/* 6. Document Picker Modal (#documentPickerModal) */
body.dark-theme #documentPickerModal,
body.dark-theme #documentPickerModal .doc-picker-container {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f1f5f9 !important;
}

body.dark-theme #documentPickerModal .doc-picker-head {
  background: #182028 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme #documentPickerModal .doc-picker-toolbar {
  background: #11161b !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme #documentPickerModal #docPickerSearch {
  background: #182028 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme #documentPickerModal #docPickerSearch::placeholder {
  color: #64748b !important;
}

body.dark-theme #documentPickerModal .doc-picker-footer {
  background: #182028 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme #documentPickerModal .doc-picker-item {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

body.dark-theme #documentPickerModal .doc-picker-item:hover {
  background: #1e2832 !important;
  border-color: #34d399 !important;
}

body.dark-theme #documentPickerModal .doc-picker-item.is-selected {
  background: rgba(52, 211, 153, 0.12) !important;
  border-color: #34d399 !important;
}

body.dark-theme #documentPickerModal .doc-picker-item-title {
  color: #f1f5f9 !important;
}

body.dark-theme #documentPickerModal .doc-picker-item-desc {
  color: #94a3b8 !important;
}

body.dark-theme #documentPickerModal .doc-picker-item-meta {
  color: #64748b !important;
}

/* ==========================================================================
   MODERN GLASSMORPHISM - FLOATING & ADAPTIVE DESKTOP NAVIGATION BAR
   ========================================================================== */
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
}

.desktop-nav-compact-trigger {
  display: none;
}

.desktop-nav-shell {
  display: flex;
  align-items: center;
}

.desktop-nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

/* Shared Frosted Glass Theme Tokens (Header Pills + Post Detail Capsules) */
header#siteHeader.site-header,
#postDetail .post-detail-top-nav,
#postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-elevated: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-strong: rgba(15, 23, 42, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.94);
  --glass-shadow:
    0 12px 32px -10px rgba(10, 44, 30, 0.14),
    0 4px 12px -4px rgba(10, 44, 30, 0.06);
  --glass-brand-ink: #0f172a;
  --glass-colon: #059669;
  --glass-nav-ink: #475569;
  --glass-nav-ink-hover: #0a2c1e;
  --glass-nav-hover-bg: rgba(15, 23, 42, 0.055);
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.17), rgba(5, 150, 105, 0.1));
  --glass-nav-pill-border: rgba(5, 150, 105, 0.28);
  --glass-nav-active-ink: #064e3b;
  --glass-accent-dot: #10b981;
  --glass-control-bg: rgba(255, 255, 255, 0.62);
  --glass-control-hover-bg: rgba(255, 255, 255, 0.96);
  --glass-control-border: rgba(15, 23, 42, 0.08);
  --glass-badge-bg: rgba(16, 185, 129, 0.12);
  --glass-badge-ink: #047857;
  --glass-popover-bg: rgba(255, 255, 255, 0.92);
  --glass-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --glass-dur: 0.38s;
}

[data-user-theme="ruby"] header#siteHeader.site-header,
[data-user-theme="ruby"] #postDetail .post-detail-top-nav,
[data-user-theme="ruby"] #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(255, 245, 247, 0.74);
  --glass-bg-elevated: rgba(255, 249, 250, 0.92);
  --glass-border: rgba(225, 29, 72, 0.15);
  --glass-border-strong: rgba(225, 29, 72, 0.24);
  --glass-shadow:
    0 12px 32px -10px rgba(159, 18, 57, 0.15),
    0 4px 12px -4px rgba(159, 18, 57, 0.06);
  --glass-colon: #e11d48;
  --glass-nav-ink-hover: #881337;
  --glass-nav-hover-bg: rgba(225, 29, 72, 0.06);
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(225, 29, 72, 0.16), rgba(244, 63, 94, 0.1));
  --glass-nav-pill-border: rgba(225, 29, 72, 0.3);
  --glass-nav-active-ink: #881337;
  --glass-accent-dot: #e11d48;
  --glass-badge-bg: rgba(225, 29, 72, 0.12);
  --glass-badge-ink: #be123c;
  --glass-popover-bg: rgba(255, 248, 250, 0.94);
}

[data-user-theme="mythic"] header#siteHeader.site-header,
[data-user-theme="mythic"] #postDetail .post-detail-top-nav,
[data-user-theme="mythic"] #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(250, 245, 255, 0.74);
  --glass-bg-elevated: rgba(252, 249, 255, 0.92);
  --glass-border: rgba(124, 58, 237, 0.17);
  --glass-border-strong: rgba(124, 58, 237, 0.26);
  --glass-shadow:
    0 12px 32px -10px rgba(109, 40, 217, 0.16),
    0 4px 12px -4px rgba(109, 40, 217, 0.07);
  --glass-colon: #7c3aed;
  --glass-nav-ink-hover: #4c1d95;
  --glass-nav-hover-bg: rgba(124, 58, 237, 0.07);
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(168, 85, 247, 0.11));
  --glass-nav-pill-border: rgba(124, 58, 237, 0.3);
  --glass-nav-active-ink: #4c1d95;
  --glass-accent-dot: #7c3aed;
  --glass-badge-bg: rgba(124, 58, 237, 0.12);
  --glass-badge-ink: #6d28d9;
  --glass-popover-bg: rgba(250, 246, 255, 0.94);
}

[data-user-theme="rosequartz"] header#siteHeader.site-header,
[data-user-theme="rosequartz"] #postDetail .post-detail-top-nav,
[data-user-theme="rosequartz"] #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(255, 249, 251, 0.76);
  --glass-border: rgba(196, 91, 131, 0.18);
  --glass-colon: #c45b83;
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(196, 91, 131, 0.18), rgba(138, 49, 87, 0.1));
  --glass-nav-pill-border: rgba(138, 49, 87, 0.28);
  --glass-nav-active-ink: #57223b;
  --glass-accent-dot: #c45b83;
  --glass-badge-bg: rgba(196, 91, 131, 0.14);
  --glass-badge-ink: #8a3157;
}

[data-user-theme="super"] header#siteHeader.site-header,
[data-user-theme="super"] #postDetail .post-detail-top-nav,
[data-user-theme="super"] #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(240, 253, 249, 0.78);
  --glass-border: rgba(0, 206, 201, 0.2);
  --glass-colon: #00b894;
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(0, 245, 155, 0.2), rgba(0, 206, 201, 0.12));
  --glass-nav-pill-border: rgba(0, 184, 148, 0.3);
  --glass-nav-active-ink: #004d40;
  --glass-accent-dot: #00f59b;
  --glass-badge-bg: rgba(0, 206, 201, 0.15);
  --glass-badge-ink: #00897b;
}

[data-user-theme="diamond"] header#siteHeader.site-header,
[data-user-theme="diamond"] #postDetail .post-detail-top-nav,
[data-user-theme="diamond"] #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(148, 163, 184, 0.35);
  --glass-colon: #0f172a;
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.1), rgba(51, 65, 85, 0.06));
  --glass-nav-pill-border: rgba(15, 23, 42, 0.25);
  --glass-nav-active-ink: #0f172a;
  --glass-accent-dot: #0f172a;
  --glass-badge-bg: rgba(15, 23, 42, 0.1);
  --glass-badge-ink: #0f172a;
}

body.dark-theme header#siteHeader.site-header,
body.dark-theme #postDetail .post-detail-top-nav,
body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(17, 24, 31, 0.68);
  --glass-bg-elevated: rgba(22, 31, 41, 0.86);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-strong: rgba(255, 255, 255, 0.2);
  --glass-highlight: rgba(255, 255, 255, 0.12);
  --glass-shadow:
    0 14px 36px -8px rgba(0, 0, 0, 0.54),
    0 2px 8px rgba(0, 0, 0, 0.28);
  --glass-brand-ink: #f8fafc;
  --glass-colon: #34d399;
  --glass-nav-ink: #94a3b8;
  --glass-nav-ink-hover: #f8fafc;
  --glass-nav-hover-bg: rgba(255, 255, 255, 0.08);
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(52, 211, 153, 0.22), rgba(16, 185, 129, 0.12));
  --glass-nav-pill-border: rgba(52, 211, 153, 0.36);
  --glass-nav-active-ink: #a7f3d0;
  --glass-accent-dot: #34d399;
  --glass-control-bg: rgba(255, 255, 255, 0.06);
  --glass-control-hover-bg: rgba(255, 255, 255, 0.15);
  --glass-control-border: rgba(255, 255, 255, 0.13);
  --glass-badge-bg: rgba(52, 211, 153, 0.18);
  --glass-badge-ink: #6ee7b7;
  --glass-popover-bg: rgba(15, 21, 28, 0.92);
}

[data-user-theme="ruby"] body.dark-theme header#siteHeader.site-header,
[data-user-theme="ruby"] body.dark-theme #postDetail .post-detail-top-nav,
[data-user-theme="ruby"] body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(24, 15, 20, 0.72);
  --glass-bg-elevated: rgba(33, 20, 27, 0.88);
  --glass-border: rgba(244, 63, 94, 0.24);
  --glass-border-strong: rgba(251, 113, 133, 0.34);
  --glass-shadow:
    0 14px 36px -8px rgba(0, 0, 0, 0.58),
    0 2px 12px rgba(244, 63, 94, 0.16);
  --glass-colon: #fb7185;
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.24), rgba(225, 29, 72, 0.14));
  --glass-nav-pill-border: rgba(251, 113, 133, 0.38);
  --glass-nav-active-ink: #fecdd3;
  --glass-accent-dot: #fb7185;
  --glass-badge-bg: rgba(244, 63, 94, 0.2);
  --glass-badge-ink: #fda4af;
  --glass-popover-bg: rgba(22, 13, 18, 0.94);
}

[data-user-theme="mythic"] body.dark-theme header#siteHeader.site-header,
[data-user-theme="mythic"] body.dark-theme #postDetail .post-detail-top-nav,
[data-user-theme="mythic"] body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-bg: rgba(21, 15, 36, 0.72);
  --glass-bg-elevated: rgba(30, 21, 50, 0.88);
  --glass-border: rgba(167, 139, 250, 0.25);
  --glass-border-strong: rgba(196, 181, 253, 0.35);
  --glass-shadow:
    0 14px 36px -8px rgba(0, 0, 0, 0.6),
    0 2px 12px rgba(139, 92, 246, 0.22);
  --glass-colon: #a78bfa;
  --glass-nav-pill-bg: linear-gradient(135deg, rgba(167, 139, 250, 0.24), rgba(139, 92, 246, 0.14));
  --glass-nav-pill-border: rgba(196, 181, 253, 0.38);
  --glass-nav-active-ink: #ede9fe;
  --glass-accent-dot: #c4b5fd;
  --glass-badge-bg: rgba(167, 139, 250, 0.2);
  --glass-badge-ink: #ddd6fe;
  --glass-popover-bg: rgba(19, 13, 33, 0.94);
}

[data-user-theme="rosequartz"] body.dark-theme header#siteHeader.site-header,
[data-user-theme="rosequartz"] body.dark-theme #postDetail .post-detail-top-nav,
[data-user-theme="rosequartz"] body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-colon: #f472b6;
  --glass-nav-pill-bg: rgba(244, 114, 182, 0.2);
  --glass-nav-pill-border: rgba(244, 114, 182, 0.35);
  --glass-nav-active-ink: #fdf2f8;
  --glass-accent-dot: #f472b6;
}

[data-user-theme="super"] body.dark-theme header#siteHeader.site-header,
[data-user-theme="super"] body.dark-theme #postDetail .post-detail-top-nav,
[data-user-theme="super"] body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-colon: #00f59b;
  --glass-nav-pill-bg: rgba(0, 210, 255, 0.22);
  --glass-nav-pill-border: rgba(0, 245, 155, 0.4);
  --glass-nav-active-ink: #ffffff;
  --glass-accent-dot: #00f59b;
}

[data-user-theme="diamond"] body.dark-theme header#siteHeader.site-header,
[data-user-theme="diamond"] body.dark-theme #postDetail .post-detail-top-nav,
[data-user-theme="diamond"] body.dark-theme #postDetail .post-detail-pinned-reply {
  --glass-colon: #ffffff;
  --glass-nav-pill-bg: rgba(255, 255, 255, 0.16);
  --glass-nav-pill-border: rgba(255, 255, 255, 0.3);
  --glass-nav-active-ink: #ffffff;
  --glass-accent-dot: #ffffff;
}

@media (min-width: 801px) and (min-height: 521px) {
  html {
    scroll-padding-top: 84px;
  }

  main {
    padding-top: 76px;
  }

  body.study-zen-fullscreen main {
    padding-top: 0 !important;
  }

  header#siteHeader.site-header {
    position: fixed;
    top: 14px;
    left: 0;
    right: 0;
    height: 48px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 clamp(14px, 2.5vw, 28px);
    background: transparent !important;
    border-bottom: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none;
    cursor: default;
    z-index: 1000;
  }

  header#siteHeader .site-header-inner {
    width: 100%;
    max-width: 1208px;
    height: 48px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
  }

  /* 1. Left Glass Pill: Brand Logo */
  header#siteHeader .brand {
    display: inline-flex;
    align-items: center;
    pointer-events: auto;
    flex: 0 0 auto;
    height: 44px;
    padding: 0 15px 0 8px;
    border-radius: 9999px;
    gap: 7px;
    font-size: 15px;
    color: var(--glass-brand-ink) !important;
    background: var(--glass-bg);
    backdrop-filter: blur(22px) saturate(185%);
    -webkit-backdrop-filter: blur(22px) saturate(185%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
    transition:
      background 0.25s ease,
      border-color 0.25s ease,
      box-shadow 0.25s ease,
      transform 0.25s var(--glass-ease);
  }

  header#siteHeader .brand:hover {
    background: var(--glass-bg-elevated);
    transform: translateY(-1px);
  }

  header#siteHeader .brand-mark {
    width: 23px;
    height: 23px;
    border-radius: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible !important;
    flex-shrink: 0;
  }

  header#siteHeader .brand-mark img {
    width: 23px;
    height: 23px;
    border-radius: 0 !important;
    object-fit: contain;
  }

  header#siteHeader .brand-colon {
    color: var(--glass-colon) !important;
  }

  /* 2. Center Glass Pill (Equal gap) <-> Left-Docked Feature Icon Orb (near Logo) */
  header#siteHeader .desktop-nav {
    position: absolute;
    top: 0;
    left: var(--nav-expanded-left, 220px);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    margin-left: 0 !important;
    pointer-events: none;
    z-index: 1002;
    will-change: left;
    transition: left 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @media (prefers-reduced-motion: no-preference) {
    header#siteHeader .desktop-nav {
      transition-timing-function: linear(0, 0.088 4%, 0.304 10%, 0.618 18%, 0.896 27%, 1.032 37%,
          1.052 44%, 1.032 53%, 1.005 66%, 0.996 78%, 1.002 90%, 1);
    }
  }

  /* Khi cuộn xuống: thu nhỏ về bên cụm logo (dock sát bên phải logo 12px) */
  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav {
    left: var(--nav-compact-left, calc(var(--brand-w, 150px) + 12px));
  }

  /* Khi peek mở thanh điều hướng khi đang compact: giữ neo bên logo và mở rộng sang phải */
  header#siteHeader.is-compact.is-nav-peek .desktop-nav {
    left: var(--nav-compact-left, calc(var(--brand-w, 150px) + 12px));
  }

  header#siteHeader .desktop-nav-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 48px;
    width: var(--nav-expanded-w, auto);
    min-width: 48px;
    padding: 4px;
    border-radius: 9999px;
    overflow: hidden;
    box-sizing: border-box;
    pointer-events: auto;
    contain: layout style;
    background: var(--glass-bg);
    backdrop-filter: blur(22px) saturate(185%);
    -webkit-backdrop-filter: blur(22px) saturate(185%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
    will-change: width;
    transition:
      width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
      background 0.22s ease,
      border-color 0.22s ease,
      box-shadow 0.22s ease;
  }

  @media (prefers-reduced-motion: no-preference) {

    /* Specular glass sheen layer sweeping across the capsule on state morph */
    header#siteHeader .desktop-nav-shell::after {
      content: "";
      position: absolute;
      inset: -2px;
      background: linear-gradient(112deg,
          transparent 22%,
          rgba(255, 255, 255, 0.38) 48%,
          rgba(255, 255, 255, 0.12) 56%,
          transparent 78%);
      transform: translate3d(-120%, 0, 0);
      opacity: 0;
      pointer-events: none;
      z-index: 4;
    }

    body.dark-theme header#siteHeader .desktop-nav-shell::after {
      background: linear-gradient(112deg,
          transparent 24%,
          rgba(255, 255, 255, 0.16) 49%,
          rgba(196, 181, 253, 0.08) 57%,
          transparent 78%);
    }

    header#siteHeader:not(.is-compact) .desktop-nav-shell,
    header#siteHeader.is-nav-peek .desktop-nav-shell {
      transition-timing-function:
        linear(0, 0.095 5%, 0.34 12%, 0.69 21%, 0.96 31%, 1.036 42%, 1.042 49%, 1.018 61%, 0.998 76%, 1.002 90%, 1),
        ease, ease, ease;
    }

    header#siteHeader.is-morph-to-expand .desktop-nav-shell::after {
      animation: navGlassSheen 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }

    header#siteHeader.is-morph-to-compact .desktop-nav-shell {
      animation: navOrbSquish 0.56s cubic-bezier(0.22, 1, 0.36, 1);
    }

    header#siteHeader.is-morph-to-compact .desktop-nav-shell::after {
      animation: navGlassSheenReverse 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    }
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-shell {
    width: 48px;
    box-shadow:
      inset 0 1px 0 var(--glass-highlight),
      0 10px 26px -8px rgba(15, 23, 42, 0.2),
      0 0 0 1px var(--glass-nav-pill-border);
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-shell:hover {
    background: var(--glass-bg-elevated);
    border-color: var(--glass-border-strong);
    box-shadow:
      inset 0 1px 0 var(--glass-highlight),
      0 14px 32px -8px rgba(15, 23, 42, 0.26),
      0 0 18px -4px var(--glass-accent-dot);
  }

  header#siteHeader .desktop-nav-links {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    width: max-content;
    opacity: 1;
    transform: scale(1);
    transform-origin: left center;
    pointer-events: auto;
    visibility: visible;
    transition:
      opacity 0.24s ease 0.08s,
      transform 0.36s cubic-bezier(0.22, 1, 0.36, 1) 0.04s,
      visibility 0s linear 0s;
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-links {
    opacity: 0;
    transform: scale(0.86);
    pointer-events: none;
    visibility: hidden;
    transition:
      opacity 0.13s ease,
      transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
      visibility 0s linear 0.14s;
  }

  /* Responsive spacing on narrow desktop/tablet screens */
  @media (min-width: 801px) and (max-width: 1080px) {
    header#siteHeader .desktop-nav-links .nav-link {
      padding: 0 10px;
      font-size: 13px;
      gap: 3px;
    }
  }

  @media (min-width: 801px) and (max-width: 920px) {
    header#siteHeader .desktop-nav-links {
      gap: 2px;
    }
    header#siteHeader .desktop-nav-links .nav-link {
      padding: 0 7px;
      font-size: 12px;
      gap: 2px;
    }
  }

  /* Elevated Glass State When Scrolled Down */
  header#siteHeader.is-scrolled .brand,
  header#siteHeader.is-scrolled .desktop-nav-shell,
  header#siteHeader.is-scrolled .header-actions {
    background: var(--glass-bg-elevated, var(--glass-bg));
    border-color: var(--glass-border-strong, var(--glass-border));
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 12px 28px -8px rgba(0, 0, 0, 0.22);
  }

  /* Sliding Liquid Glass Active Indicator */
  header#siteHeader .nav-active-glider {
    position: absolute;
    top: 0;
    left: 0;
    height: 38px;
    width: var(--glider-w, 0px);
    border-radius: 9999px;
    background: var(--glass-nav-pill-bg);
    border: 1px solid var(--glass-nav-pill-border);
    box-shadow:
      inset 0 1px 0 var(--glass-highlight),
      0 4px 14px -3px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    opacity: 0;
    z-index: 0;
    transform: translate3d(var(--glider-x, 0px), 0, 0);
    will-change: transform, width;
    transition:
      transform 0.44s cubic-bezier(0.22, 1, 0.36, 1),
      width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.18s ease,
      background 0.25s ease,
      border-color 0.25s ease;
  }

  @media (prefers-reduced-motion: no-preference) {
    header#siteHeader .nav-active-glider {
      transition-timing-function:
        linear(0, 0.095 5%, 0.34 12%, 0.68 21%, 0.96 31%, 1.048 42%, 1.055 49%, 1.022 61%, 0.996 76%, 1.002 90%, 1),
        cubic-bezier(0.22, 1, 0.36, 1),
        ease, ease, ease;
    }
  }

  header#siteHeader .nav-active-glider.is-instant {
    transition: none !important;
  }

  header#siteHeader .nav-active-glider.is-ready {
    opacity: 1;
  }

  header#siteHeader .desktop-nav-links .nav-link {
    position: relative;
    z-index: 1;
    height: 38px;
    padding: 0 14px;
    border-radius: 9999px;
    border: 1px solid transparent;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--glass-nav-ink) !important;
    background: transparent !important;
    box-shadow: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    text-decoration: none;
    transition:
      color 0.2s ease,
      background 0.2s ease,
      border-color 0.2s ease,
      box-shadow 0.2s ease,
      transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  header#siteHeader .desktop-nav-links .nav-link:hover {
    color: var(--glass-nav-ink-hover) !important;
    background: var(--glass-nav-hover-bg) !important;
    transform: translateY(-1px);
  }

  header#siteHeader .desktop-nav-links .nav-link:active {
    transform: scale(0.95);
  }

  header#siteHeader .desktop-nav-links .nav-link:focus-visible,
  header#siteHeader .desktop-nav-compact-trigger:focus-visible,
  header#siteHeader .brand:focus-visible,
  header#siteHeader .profile-chip:focus-visible,
  header#siteHeader .desktop-search:focus-visible,
  header#siteHeader .quick-menu-btn:focus-visible {
    outline: 2px solid var(--glass-accent-dot);
    outline-offset: 2px;
  }

  header#siteHeader .desktop-nav-links .nav-link.active {
    color: var(--glass-nav-active-ink) !important;
    font-weight: 700;
    background: var(--glass-nav-pill-bg) !important;
    border-color: var(--glass-nav-pill-border) !important;
    box-shadow:
      inset 0 1px 0 var(--glass-highlight),
      0 2px 10px -2px rgba(0, 0, 0, 0.08) !important;
  }

  header#siteHeader .desktop-nav-links.has-glider .nav-link.active {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  header#siteHeader .desktop-nav-links .nav-link .nav-link-icon svg {
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  header#siteHeader .desktop-nav-links .nav-link:hover .nav-link-icon svg,
  header#siteHeader .desktop-nav-links .nav-link.active .nav-link-icon svg {
    transform: scale(1.08);
  }

  @media (prefers-reduced-motion: no-preference) {
    header#siteHeader.is-morph-to-expand .desktop-nav-links .nav-link {
      animation: navLinkBloomIn 0.44s cubic-bezier(0.22, 1, 0.36, 1) backwards;
      animation-delay: calc(var(--nav-i, 0) * 28ms);
    }
  }

  header#siteHeader .desktop-nav-links .nav-link-arena svg {
    margin-right: 0;
    vertical-align: middle;
  }

  /* Compact Circular Active-Feature Icon Trigger */
  header#siteHeader .desktop-nav-compact-trigger {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: var(--glass-nav-active-ink) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.55);
    transition:
      opacity 0.12s ease,
      transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
      background 0.2s ease,
      color 0.2s ease,
      visibility 0s linear 0.14s;
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-compact-trigger {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
    transition:
      opacity 0.22s ease 0.12s,
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
      background 0.2s ease,
      color 0.2s ease,
      visibility 0s linear 0s;
  }

  @media (prefers-reduced-motion: no-preference) {
    header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-compact-trigger {
      transition-timing-function:
        ease,
        linear(0, 0.22 8%, 0.71 21%, 1.06 36%, 1.09 45%, 1.03 60%, 0.992 76%, 1.003 90%, 1),
        ease, ease, linear;
    }

    header#siteHeader.is-morph-to-compact .desktop-nav-compact-trigger .compact-nav-icon {
      animation: compactIconBloom 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.08s backwards;
    }
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-compact-trigger:hover {
    background: var(--glass-nav-pill-bg);
    transform: scale(1.08) translateY(-1px);
  }

  header#siteHeader.is-compact:not(.is-nav-peek) .desktop-nav-compact-trigger:active {
    transform: scale(0.92);
  }

  header#siteHeader .compact-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* 3. Right Glass Pill: Profile + Search + Hamburger */
  header#siteHeader .header-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 48px;
    padding: 5px 6px;
    border-radius: 9999px;
    flex: 0 0 auto;
    margin-left: auto;
    pointer-events: auto;
    overflow: visible;
    contain: layout style;
    background: var(--glass-bg);
    backdrop-filter: blur(22px) saturate(185%);
    -webkit-backdrop-filter: blur(22px) saturate(185%);
    border: 1px solid var(--glass-border);
    box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow);
    z-index: 1003;
    transition:
      background 0.25s ease,
      border-color 0.25s ease,
      box-shadow 0.25s ease;
  }

  header#siteHeader .profile-chip {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    height: 36px;
    min-width: 36px;
    padding: 2px 12px 2px 2.5px;
    border-radius: 9999px;
    background: var(--glass-control-bg) !important;
    border: 1px solid var(--glass-control-border) !important;
    box-shadow: none !important;
    color: var(--glass-brand-ink) !important;
    overflow: visible;
    transition:
      padding var(--glass-dur) var(--glass-ease),
      background 0.22s ease,
      border-color 0.22s ease;
  }

  header#siteHeader .profile-chip:hover {
    background: var(--glass-control-hover-bg) !important;
  }

  header#siteHeader .profile-chip .profile-chip-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: var(--chip-text-w, auto);
    max-width: 240px;
    margin-left: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    opacity: 1;
    will-change: width, margin-left, opacity;
    transition:
      width var(--glass-dur) var(--glass-ease),
      margin-left var(--glass-dur) var(--glass-ease),
      opacity 0.22s ease 0.08s;
  }

  header#siteHeader .profile-chip .profile-chip-text b {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    background: var(--glass-badge-bg) !important;
    color: var(--glass-badge-ink) !important;
    flex-shrink: 0;
  }

  header#siteHeader.is-compact .profile-chip,
  header#siteHeader.is-chip-collapsed .profile-chip {
    padding: 2px;
    background: transparent !important;
    border-color: transparent !important;
  }

  header#siteHeader.is-compact .profile-chip .profile-chip-text,
  header#siteHeader.is-chip-collapsed .profile-chip .profile-chip-text {
    width: 0 !important;
    max-width: 0 !important;
    margin-left: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    transition:
      width var(--glass-dur) var(--glass-ease),
      margin-left var(--glass-dur) var(--glass-ease),
      opacity 0.16s ease;
  }

  /* Đóng mở tên: di chuột vào avatar khi đang thu gọn sẽ tự mở rộng tên với hiệu ứng lò xo */
  header#siteHeader.is-compact .profile-chip:hover,
  header#siteHeader.is-chip-collapsed .profile-chip:hover {
    padding: 2px 12px 2px 2.5px !important;
    background: var(--glass-control-hover-bg) !important;
    border: 1px solid var(--glass-control-border) !important;
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.12) !important;
  }

  header#siteHeader.is-compact .profile-chip:hover .profile-chip-text,
  header#siteHeader.is-chip-collapsed .profile-chip:hover .profile-chip-text {
    width: var(--chip-text-w, auto) !important;
    max-width: 180px !important;
    margin-left: 8px !important;
    padding: 0 !important;
    opacity: 1 !important;
    overflow: hidden !important;
    pointer-events: auto !important;
  }

  header#siteHeader .desktop-search,
  header#siteHeader .nav-notification-btn,
  header#siteHeader .quick-menu-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--glass-control-bg) !important;
    border: 1px solid var(--glass-control-border) !important;
    color: var(--glass-nav-ink-hover) !important;
    box-shadow: none !important;
    transition:
      background 0.2s ease,
      border-color 0.2s ease,
      transform 0.2s var(--glass-ease);
  }

  header#siteHeader .desktop-search svg,
  header#siteHeader .desktop-search .ui-icon {
    width: 17px !important;
    height: 17px !important;
    stroke-width: 2.1 !important;
    vertical-align: middle;
  }

  header#siteHeader .nav-notification-btn .notif-bell-icon {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2.1 !important;
    vertical-align: middle;
  }

  header#siteHeader .quick-menu-btn .hamburger-box {
    width: 16px !important;
    height: 12px !important;
  }

  header#siteHeader .quick-menu-btn .hamburger-line {
    height: 2px !important;
    border-radius: 2px !important;
    background: currentColor;
  }

  header#siteHeader .desktop-search:hover,
  header#siteHeader .nav-notification-btn:hover,
  header#siteHeader .notification-trigger-wrap.open .nav-notification-btn,
  header#siteHeader .quick-menu-btn:hover,
  header#siteHeader .quick-menu-btn.active {
    background: var(--glass-control-hover-bg) !important;
    border-color: var(--glass-border-strong) !important;
    transform: translateY(-1px);
    color: var(--primary) !important;
  }

  header#siteHeader .desktop-search:active,
  header#siteHeader .nav-notification-btn:active,
  header#siteHeader .quick-menu-btn:active,
  header#siteHeader .brand:active,
  header#siteHeader .profile-chip:active {
    transform: scale(0.95);
  }

  header#siteHeader .quick-menu-dropdown {
    top: calc(100% + 14px);
    right: -6px;
    background: var(--glass-popover-bg);
    backdrop-filter: blur(26px) saturate(190%);
    -webkit-backdrop-filter: blur(26px) saturate(190%);
    border-color: var(--glass-border-strong);
  }
}

@media (min-width: 801px) and (max-width: 1080px) and (min-height: 521px) {
  header#siteHeader .profile-chip .profile-chip-text {
    max-width: 130px;
  }
}

@media (min-width: 801px) and (max-width: 960px) and (min-height: 521px) {
  header#siteHeader .desktop-nav-links .nav-link {
    padding: 0 8px !important;
    gap: 4px !important;
    font-size: 13px !important;
  }
}

@keyframes navGlassSheen {
  0% {
    opacity: 0;
    transform: translate3d(-120%, 0, 0);
  }

  20% {
    opacity: 1;
  }

  85% {
    opacity: 0.7;
  }

  100% {
    opacity: 0;
    transform: translate3d(130%, 0, 0);
  }
}

@keyframes navGlassSheenReverse {
  0% {
    opacity: 0;
    transform: translate3d(120%, 0, 0);
  }

  25% {
    opacity: 0.9;
  }

  100% {
    opacity: 0;
    transform: translate3d(-130%, 0, 0);
  }
}

@keyframes navOrbSquish {

  0%,
  42% {
    transform: scale(1);
  }

  62% {
    transform: scale(0.91, 1.06);
  }

  82% {
    transform: scale(1.06, 0.96);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes navLinkBloomIn {
  from {
    opacity: 0;
    transform: translate3d(-10px, 0, 0) scale(0.88);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes compactIconBloom {
  from {
    opacity: 0;
    transform: scale(0.6);
    filter: blur(4px);
  }

  60% {
    opacity: 1;
    transform: scale(1.1);
    filter: blur(0);
  }

  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@media (prefers-reduced-motion: reduce) {

  header#siteHeader .desktop-nav,
  header#siteHeader .desktop-nav-shell,
  header#siteHeader .nav-active-glider,
  header#siteHeader .desktop-nav-compact-trigger,
  header#siteHeader .profile-chip,
  header#siteHeader .profile-chip .profile-chip-text {
    transition-property: opacity, color, background-color, border-color;
    transition-duration: 0.14s;
    transition-delay: 0ms;
  }

  header#siteHeader .brand,
  header#siteHeader .desktop-nav-links .nav-link,
  header#siteHeader .desktop-search,
  header#siteHeader .quick-menu-btn {
    transition-property: color, background-color, border-color;
    transition-duration: 0.14s;
    transform: none !important;
  }
}

/* ==========================================================================
   CHRISTMAS 2026 SEASONAL DECORATIONS, SNOW CANVAS & SITE-WIDE BGM WIDGET
   Active from 2026-11-11 until 2026-12-31 23:59:59+07:00
   ========================================================================== */

body:not(.christmas-season) .xmas-seasonal-control,
body:not(.christmas-season) #christmasTreeCanvas,
body:not(.christmas-season) #christmasSnowCanvas,
body:not(.christmas-season) .christmas-santa-hat,
body:not(.christmas-season) .christmas-header-garland {
  display: none !important;
}

/* Seasonal Winter Ambient Wash (Northern Lights in Dark Mode, Champagne Frost in Light Mode) */
body.christmas-season:not(.christmas-effects-off)::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 420px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(62% 58% at 16% 8%, rgba(186, 230, 253, 0.32) 0%, rgba(186, 230, 253, 0) 70%),
    radial-gradient(50% 48% at 86% 6%, rgba(254, 240, 138, 0.22) 0%, rgba(254, 240, 138, 0) 72%),
    radial-gradient(45% 40% at 52% 0%, rgba(167, 243, 208, 0.16) 0%, rgba(167, 243, 208, 0) 70%);
}

html.dark-theme body.christmas-season:not(.christmas-effects-off)::before,
body.dark-theme.christmas-season:not(.christmas-effects-off)::before {
  background:
    radial-gradient(56% 56% at 18% 6%, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 72%),
    radial-gradient(48% 52% at 82% 8%, rgba(56, 189, 248, 0.16) 0%, rgba(56, 189, 248, 0) 72%),
    radial-gradient(40% 34% at 48% 2%, rgba(248, 113, 113, 0.1) 0%, rgba(248, 113, 113, 0) 70%);
}

main {
  position: relative;
  z-index: 2;
}

/* Backmost Edge 3D-Projected Luxury Christmas Tree Layer (strictly behind main UI cards, nav & snow) */
#christmasTreeCanvas.christmas-tree-edge-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.94;
  transition: opacity 0.35s ease;
}

body.christmas-effects-off #christmasTreeCanvas.christmas-tree-edge-canvas {
  display: none;
}

html.study-mode-active #christmasTreeCanvas.christmas-tree-edge-canvas {
  opacity: 0.24;
}

body.arena-quiz-active #christmasTreeCanvas.christmas-tree-edge-canvas {
  opacity: 0.14;
}

/* Fullscreen non-blocking snow + smoothed bottom snowbank layer (strictly behind controls/nav) */
#christmasSnowCanvas.christmas-snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 45;
  opacity: 1;
  transition: opacity 0.35s ease;
}

body.christmas-effects-off #christmasSnowCanvas.christmas-snow-canvas {
  display: none;
}

html.study-mode-active #christmasSnowCanvas.christmas-snow-canvas {
  opacity: 0.42;
}

body.arena-quiz-active #christmasSnowCanvas.christmas-snow-canvas {
  opacity: 0.25;
}

/* Header Santa hat on brand logo without clipping */
.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.christmas-season:not(.christmas-effects-off) header#siteHeader .brand-mark,
body.christmas-season:not(.christmas-effects-off) .brand-mark {
  overflow: visible !important;
}

body.christmas-season:not(.christmas-effects-off) .brand-mark img {
  border-radius: 0 !important;
}

.christmas-santa-hat {
  display: none;
}

body.christmas-season:not(.christmas-effects-off) .christmas-santa-hat {
  display: block;
  position: absolute;
  top: -10px;
  left: -5px;
  width: 22px;
  height: 17px;
  transform: rotate(-16deg);
  transform-origin: 70% 80%;
  pointer-events: none;
  z-index: 4;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.24));
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: no-preference) {
  body.christmas-season:not(.christmas-effects-off) .brand:hover .christmas-santa-hat {
    transform: rotate(-8deg) translateY(-1px);
  }
}

body.christmas-effects-off .christmas-santa-hat,
body.christmas-effects-off .christmas-header-garland {
  display: none !important;
}

/* Real SVG Pine Garland & C9 Teardrop String Lights (repeats cleanly without stretching) */
.christmas-header-garland {
  display: none;
}

body.christmas-season:not(.christmas-effects-off) header#siteHeader .site-header-inner {
  position: relative;
  z-index: 2;
}

@media (min-width: 801px) and (min-height: 521px) {
  body.christmas-season:not(.christmas-effects-off) header#siteHeader .christmas-header-garland {
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 44px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    filter: drop-shadow(0 2px 5px rgba(10, 36, 26, 0.18));
  }
}

@media (max-width: 800px),
(max-height: 520px) {
  body.christmas-season:not(.christmas-effects-off) header#siteHeader .christmas-header-garland {
    position: absolute;
    top: calc(100% - 6px);
    left: 0;
    right: 0;
    height: 30px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(10, 36, 26, 0.18));
  }

  body.christmas-season:not(.christmas-effects-off) .christmas-header-garland .xmas-garland-unit {
    width: 164px;
    height: 30px;
    flex: 0 0 164px;
  }
}

.christmas-header-garland .xmas-garland-unit {
  width: 240px;
  height: 44px;
  flex: 0 0 240px;
  display: block;
}

.christmas-header-garland .xmas-lamp {
  opacity: 0.94;
}

@media (prefers-reduced-motion: no-preference) {
  .christmas-header-garland .xmas-lamp-a {
    animation: xmasLampGlow 4.4s ease-in-out infinite alternate;
  }

  .christmas-header-garland .xmas-lamp-b {
    animation: xmasLampGlow 5.1s ease-in-out 1.1s infinite alternate;
  }

  .christmas-header-garland .xmas-lamp-c {
    animation: xmasLampGlow 4.7s ease-in-out 2.2s infinite alternate;
  }

  .christmas-header-garland .xmas-lamp-d {
    animation: xmasLampGlow 5.5s ease-in-out 3.2s infinite alternate;
  }
}

@keyframes xmasLampGlow {
  0% {
    opacity: 0.56;
  }

  100% {
    opacity: 1;
  }
}

/* Interactive Dynamic Snow Drifts Resting ABOVE Large Cards (DOM-anchored edge canvas for zero scroll jitter) */
.xmas-card-bg-clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.xmas-card-edge-snow {
  position: absolute;
  top: -20px;
  left: -1px;
  width: calc(100% + 2px);
  height: 26px;
  pointer-events: none;
  z-index: 6;
  display: block;
}

body.christmas-season:not(.christmas-effects-off) .xmas-snow-card {
  position: relative;
  overflow: visible !important;
}

body.christmas-season:not(.christmas-effects-off) .contribution-card.xmas-snow-card:after {
  clip-path: inset(0 115px 145px 0 round 0 0 16px 0);
}

body.christmas-season:not(.christmas-effects-off) #bannerStackCard .banner-viewport {
  overflow: hidden;
  border-radius: inherit;
}

body.christmas-effects-off .xmas-card-edge-snow,
body.arena-quiz-active .xmas-card-edge-snow {
  display: none !important;
}

body.christmas-season:not(.christmas-effects-off) .xmas-snow-card.is-snow-hover {
  cursor: grab;
}

body.christmas-season:not(.christmas-effects-off) #bannerStackCard {
  box-shadow: 0 14px 32px -10px rgba(18, 63, 49, 0.22), 0 0 0 1px rgba(248, 113, 113, 0.22);
}

html.dark-theme body.christmas-season:not(.christmas-effects-off) #bannerStackCard,
body.dark-theme.christmas-season:not(.christmas-effects-off) #bannerStackCard {
  box-shadow: 0 16px 36px -8px rgba(0, 0, 0, 0.56), 0 0 0 1px rgba(125, 211, 252, 0.24);
}

/* Festive Primary Hero Accent & Atmospheric Winter Polish */
body.christmas-season:not(.christmas-effects-off) .home-hero {
  position: relative;
}

body.christmas-season:not(.christmas-effects-off) #askFromHome {
  box-shadow: 0 10px 24px -8px rgba(18, 61, 48, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.christmas-season:not(.christmas-effects-off) .card,
body.christmas-season:not(.christmas-effects-off) .post-card,
body.christmas-season:not(.christmas-effects-off) .document-card {
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

body.christmas-season:not(.christmas-effects-off) .card:hover,
body.christmas-season:not(.christmas-effects-off) .post-card:hover {
  border-color: rgba(56, 189, 248, 0.28);
}

/* Mobile Floating Island frosted winter highlight (stays transparent to taps) */
@media (max-width: 760px) {
  body.christmas-season:not(.christmas-effects-off) .christmas-santa-hat {
    top: -9px;
    left: -4px;
    width: 19px;
    height: 14px;
  }

  body.christmas-season:not(.christmas-effects-off) .mobile-nav {
    box-shadow: 0 -1px 0 rgba(186, 230, 253, 0.65) inset, 0 12px 32px rgba(18, 61, 48, 0.18);
  }
}

/* Persistent Site-Wide Christmas BGM & Snow Controller (Liquid Glass Pill) */
.christmas-floating-widget {
  position: fixed;
  left: max(18px, env(safe-area-inset-left, 0px));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 98;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid rgba(220, 38, 38, 0.2);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  color: var(--ink, #123d30);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.2s ease, border-color 0.2s ease;
}

.christmas-floating-widget.is-hidden-for-context {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

html.dark-theme .christmas-floating-widget,
body.dark-theme .christmas-floating-widget {
  background: rgba(18, 25, 34, 0.84);
  border-color: rgba(125, 211, 252, 0.22);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.xmas-widget-music-btn,
.xmas-widget-snow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 9999px;
  min-height: 36px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.xmas-widget-music-btn {
  padding: 0 12px;
}

.xmas-widget-snow-btn {
  width: 36px;
  padding: 0;
  color: var(--muted, #64748b);
}

.xmas-widget-music-btn:hover,
.xmas-widget-snow-btn:hover {
  background: rgba(18, 61, 48, 0.08);
}

html.dark-theme .xmas-widget-music-btn:hover,
html.dark-theme .xmas-widget-snow-btn:hover,
body.dark-theme .xmas-widget-music-btn:hover,
body.dark-theme .xmas-widget-snow-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.xmas-widget-music-btn.is-playing {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.14), rgba(16, 185, 129, 0.14));
  color: #b91c1c;
}

html.dark-theme .xmas-widget-music-btn.is-playing,
body.dark-theme .xmas-widget-music-btn.is-playing {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.22), rgba(52, 211, 153, 0.18));
  color: #fda4af;
}

.xmas-widget-snow-btn.active {
  color: #0284c7;
  background: rgba(14, 165, 233, 0.1);
}

html.dark-theme .xmas-widget-snow-btn.active,
body.dark-theme .xmas-widget-snow-btn.active {
  color: #7dd3fc;
  background: rgba(125, 211, 252, 0.14);
}

.xmas-widget-sep {
  width: 1px;
  height: 20px;
  background: rgba(100, 116, 139, 0.22);
  flex-shrink: 0;
}

.xmas-music-eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.xmas-widget-music-btn.is-playing .xmas-music-icon {
  display: none;
}

.xmas-widget-music-btn.is-playing .xmas-music-eq {
  display: inline-flex;
}

.xmas-music-eq span {
  width: 2.5px;
  border-radius: 2px;
  background: currentColor;
  height: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  .xmas-widget-music-btn.is-playing .xmas-music-eq span:nth-child(1) {
    animation: xmasEqBar 0.9s ease-in-out infinite alternate;
  }

  .xmas-widget-music-btn.is-playing .xmas-music-eq span:nth-child(2) {
    animation: xmasEqBar 0.65s ease-in-out 0.2s infinite alternate;
  }

  .xmas-widget-music-btn.is-playing .xmas-music-eq span:nth-child(3) {
    animation: xmasEqBar 0.8s ease-in-out 0.35s infinite alternate;
  }
}

@keyframes xmasEqBar {
  0% {
    transform: scaleY(0.45);
    opacity: 0.7;
  }

  100% {
    transform: scaleY(1.3);
    opacity: 1;
  }
}

.xmas-theme-preset-btn {
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #b91c1c !important;
}

html.dark-theme .xmas-theme-preset-btn,
body.dark-theme .xmas-theme-preset-btn {
  border-color: rgba(248, 113, 113, 0.38) !important;
  color: #fca5a5 !important;
}

/* Floating Widget: Community Christmas Tree Trigger Button */
.xmas-widget-tree-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 11px;
  border: none;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.14), rgba(245, 158, 11, 0.14));
  color: #14532d;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.15s ease, color 0.18s ease;
}

.xmas-widget-tree-btn:hover {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.24), rgba(245, 158, 11, 0.22));
  transform: translateY(-1px);
}

.xmas-widget-tree-btn:focus-visible,
.xmas-widget-music-btn:focus-visible,
.xmas-widget-snow-btn:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

html.dark-theme .xmas-widget-tree-btn,
body.dark-theme .xmas-widget-tree-btn {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.18), rgba(251, 191, 36, 0.16));
  color: #6ee7b7;
}

html.dark-theme .xmas-widget-tree-btn:hover,
body.dark-theme .xmas-widget-tree-btn:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.28), rgba(251, 191, 36, 0.24));
}

.xmas-tree-widget-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.88);
  color: #14532d;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

html.dark-theme .xmas-tree-widget-badge,
body.dark-theme .xmas-tree-widget-badge {
  background: rgba(15, 23, 42, 0.78);
  color: #a7f3d0;
}

/* Home Hero & Quick Menu Community Tree Triggers */
body.christmas-season .hero-actions {
  flex-wrap: wrap;
}

.xmas-hero-tree-btn {
  border: 1px solid rgba(22, 163, 74, 0.3) !important;
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.92), rgba(254, 249, 195, 0.78)) !important;
  color: #14532d !important;
  box-shadow: 0 6px 18px -6px rgba(20, 83, 45, 0.22);
}

.xmas-hero-tree-btn:hover {
  border-color: rgba(22, 163, 74, 0.5) !important;
  background: linear-gradient(135deg, rgba(209, 250, 229, 0.96), rgba(254, 240, 138, 0.86)) !important;
}

html.dark-theme .xmas-hero-tree-btn,
body.dark-theme .xmas-hero-tree-btn {
  border-color: rgba(52, 211, 153, 0.34) !important;
  background: linear-gradient(135deg, rgba(16, 48, 38, 0.88), rgba(45, 34, 14, 0.76)) !important;
  color: #a7f3d0 !important;
}

.xmas-tree-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 9999px;
  background: rgba(20, 83, 45, 0.14);
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Loại bỏ hoàn toàn số lượng trang trí cạnh icon cây thông theo yêu cầu */
.xmas-tree-widget-badge,
.xmas-tree-count-badge,
.quick-menu-tree-count {
  display: none !important;
}

/* ==========================================================================
   COMMUNITY CHRISTMAS TREE STUDIO PAGE (<section id="christmasTreePage">)
   ========================================================================== */
#christmasTreePage.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

#christmasTreePage.active-page {
  display: flex !important;
  flex-direction: column !important;
}

/* 2 distinct windows container: Window 1 (Tree) and Window 2 (Panels) */
.xmas-tree-two-windows {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(380px, 1.15fr);
  gap: 20px;
  align-items: stretch;
  width: 100%;
  height: min(calc(100vh - 120px), 660px);
  min-height: 540px;
}

/* WINDOW 1: SÂN KHẤU CÂY THÔNG 3D ĐỘC LẬP */
.xmas-tree-card-stage {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 22px;
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 16px 48px rgba(8, 28, 22, 0.12);
  overflow: hidden;
}

html.dark-theme .xmas-tree-card-stage,
body.dark-theme .xmas-tree-card-stage {
  background: #111820;
  border-color: rgba(125, 211, 252, 0.2);
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.xmas-tree-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line, #dfe4dc);
  background: var(--surface, #ffffff);
  flex-shrink: 0;
}

html.dark-theme .xmas-tree-stage-header,
body.dark-theme .xmas-tree-stage-header {
  background: #111820;
  border-bottom-color: rgba(125, 211, 252, 0.15);
}

.xmas-tree-stage-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.xmas-tree-stage-badge {
  font-family: var(--unbounded, "Unbounded", sans-serif);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #123d30);
  white-space: nowrap;
}

html.dark-theme .xmas-tree-stage-badge,
body.dark-theme .xmas-tree-stage-badge {
  color: #e2e8f0;
}

.xmas-tree-stage-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.xmas-tree-stage-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 10px;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.65), rgba(248, 250, 252, 0.9));
}

html.dark-theme .xmas-tree-stage-body,
body.dark-theme .xmas-tree-stage-body {
  background: linear-gradient(180deg, #0b181c, #0d1620);
}

.xmas-tree-stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(20, 83, 45, 0.12);
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.95) 0%, rgba(224, 242, 254, 0.62) 68%, rgba(203, 213, 225, 0.45) 100%);
}

html.dark-theme .xmas-tree-stage-wrap,
body.dark-theme .xmas-tree-stage-wrap {
  border-color: rgba(125, 211, 252, 0.18);
  background: radial-gradient(circle at 50% 40%, #102a27 0%, #091820 65%, #061016 100%);
}

/* WINDOW 2: BẢNG ĐIỀU KHIỂN & TUỲ CHỈNH */
.xmas-tree-card-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 22px;
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 16px 48px rgba(8, 28, 22, 0.12);
  overflow: hidden;
}

html.dark-theme .xmas-tree-card-panel,
body.dark-theme .xmas-tree-card-panel {
  background: #111820;
  border-color: rgba(125, 211, 252, 0.2);
  color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

/* Hide corner edge tree when on dedicated Christmas tree page */
body:has(#christmasTreePage.active-page) #christmasTreeCanvas.christmas-tree-edge-canvas,
#christmasTreePage.active-page~#christmasTreeCanvas {
  display: none !important;
}

dialog#christmasTreeModal[open] {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  inset: 0 !important;
  width: min(1040px, calc(100vw - 24px));
  max-width: 1040px;
  height: min(92vh, 840px);
  max-height: min(92vh, 840px);
  margin: auto !important;
  padding: 0;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 22px;
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 28px 80px rgba(8, 28, 22, 0.34);
  overflow: hidden;
  overscroll-behavior: contain;
  z-index: 100000 !important;
}

dialog#christmasTreeModal:modal {
  overscroll-behavior: contain;
}

dialog#christmasTreeModal::backdrop {
  background: rgba(7, 24, 21, 0.58);
  backdrop-filter: blur(6px);
  overflow: hidden;
  overscroll-behavior: contain;
}

html.dark-theme dialog#christmasTreeModal[open],
body.dark-theme dialog#christmasTreeModal[open] {
  background: #111820;
  border-color: rgba(125, 211, 252, 0.2);
  color: #e2e8f0;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65);
}

#christmasTreePage form {
  padding: 0;
}

#christmasTreePage [hidden] {
  display: none !important;
}

.xmas-tree-page-shell,
.xmas-tree-dialog-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 24px;
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 20px 60px rgba(8, 28, 22, 0.16);
  overflow: hidden;
}

html.dark-theme .xmas-tree-page-shell,
body.dark-theme .xmas-tree-page-shell {
  background: #111820;
  border-color: rgba(125, 211, 252, 0.2);
  color: #e2e8f0;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.xmas-tree-page-header,
.xmas-tree-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px 10px;
  border-bottom: 1px solid var(--line, #dfe4dc);
  flex-shrink: 0;
  background: var(--surface, #ffffff);
}

html.dark-theme .xmas-tree-page-header,
body.dark-theme .xmas-tree-page-header,
html.dark-theme .xmas-tree-modal-header,
body.dark-theme .xmas-tree-modal-header {
  background: #111820;
  border-bottom-color: rgba(125, 211, 252, 0.15);
}

.xmas-tree-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.xmas-tree-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--line, #dfe4dc);
  color: var(--ink, #123d30);
  transition: background 0.16s ease, transform 0.15s ease;
}

.xmas-tree-back-btn:hover {
  background: var(--surface-hover, #e2e8f0);
  transform: translateX(-1px);
}

.xmas-tree-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.xmas-tree-header-copy h1,
.xmas-tree-header-copy h2 {
  margin: 0 0 4px;
  font-family: var(--unbounded, "Unbounded", sans-serif);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  line-height: 1.3;
}

.xmas-tree-header-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #64748b);
  line-height: 1.45;
}

.xmas-tree-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 9999px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: var(--ink, #123d30);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.16s ease, transform 0.15s ease;
}

.xmas-tree-close-btn:hover {
  background: var(--surface-hover, #e2e8f0);
  transform: scale(1.04);
}

.xmas-tree-close-btn:focus-visible,
.xmas-stage-ctrl-btn:focus-visible,
.xmas-panel-tab:focus-visible,
.xmas-slot-pill:focus-visible,
.xmas-preset-chip:focus-visible,
.xmas-gallery-locate-btn:focus-visible,
.xmas-gallery-delete-btn:focus-visible,
.xmas-inspector-close:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}



#christmasTreeStudioCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}

#christmasTreeStudioCanvas.is-dragging {
  cursor: grabbing;
}

.xmas-tree-stage-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.xmas-stage-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  color: #123d30;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.xmas-stage-ctrl-btn:hover {
  background: #ffffff;
}

.xmas-stage-ctrl-btn[aria-pressed="false"] {
  opacity: 0.78;
}

html.dark-theme .xmas-stage-ctrl-btn,
body.dark-theme .xmas-stage-ctrl-btn {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

.xmas-tree-milestone-bar {
  position: absolute;
  bottom: 10px;
  left: 10px;
  top: auto;
  z-index: 4;
  max-width: calc(100% - 20px);
  padding: 5px 11px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(20, 83, 45, 0.12);
  backdrop-filter: blur(10px);
  color: #14532d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

html.dark-theme .xmas-tree-milestone-bar,
body.dark-theme .xmas-tree-milestone-bar {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(52, 211, 153, 0.24);
  color: #a7f3d0;
}

.xmas-tree-inspector {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 6;
  max-height: 62%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(20, 83, 45, 0.18);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.2);
}

html.dark-theme .xmas-tree-inspector,
body.dark-theme .xmas-tree-inspector {
  background: rgba(15, 23, 42, 0.94);
  border-color: rgba(125, 211, 252, 0.25);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.xmas-inspector-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f1f5f9);
  color: var(--ink, #123d30);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.xmas-inspector-content {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-right: 28px;
}

.xmas-inspector-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid rgba(15, 23, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: #f8fafc;
}

.xmas-inspector-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xmas-inspector-meta {
  min-width: 0;
  flex: 1;
}

.xmas-inspector-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(22, 163, 74, 0.35);
  text-underline-offset: 2px;
}

.xmas-inspector-type {
  font-size: 11.5px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.xmas-inspector-wish {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.xmas-tree-stage-hint {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  text-align: center;
}

.xmas-tree-panel-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.xmas-tree-panel-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--line, #dfe4dc);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.xmas-tree-panel-tabs::-webkit-scrollbar {
  display: none;
}

.xmas-panel-tab {
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted, #64748b);
  padding: 10px 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.xmas-panel-tab.active {
  color: var(--primary, #123d30);
  border-bottom-color: #16a34a;
}

.xmas-tree-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 18px;
  overscroll-behavior: contain;
}

.xmas-tree-guest-box {
  padding: 18px;
  border-radius: 14px;
  border: 1px dashed rgba(22, 163, 74, 0.35);
  background: rgba(236, 253, 245, 0.55);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  line-height: 1.5;
}

html.dark-theme .xmas-tree-guest-box,
body.dark-theme .xmas-tree-guest-box {
  background: rgba(16, 42, 34, 0.45);
  border-color: rgba(52, 211, 153, 0.3);
}

.xmas-tree-guest-box p {
  margin: 0;
}

.xmas-tier-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(15, 118, 110, 0.06);
  border: 1px solid rgba(15, 118, 110, 0.16);
}

html.dark-theme .xmas-tier-status-strip,
body.dark-theme .xmas-tier-status-strip {
  background: rgba(16, 42, 34, 0.55);
  border-color: rgba(52, 211, 153, 0.22);
}

.xmas-tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: #0f766e;
}

html.dark-theme .xmas-tier-pill,
body.dark-theme .xmas-tier-pill {
  color: #6ee7b7;
}

.xmas-slot-quota-note {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted, #64748b);
}

.xmas-slot-switcher,
.xmas-slot-switcher-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.xmas-slot-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 11px;
  border: 1.5px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: var(--ink, #123d30);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.xmas-slot-pill:hover {
  border-color: rgba(22, 163, 74, 0.45);
}

.xmas-slot-pill.is-used::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  flex-shrink: 0;
}

.xmas-slot-pill.active {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  color: #14532d;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.22);
}

html.dark-theme .xmas-slot-pill,
body.dark-theme .xmas-slot-pill {
  background: #13221d;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html.dark-theme .xmas-slot-pill.active,
body.dark-theme .xmas-slot-pill.active {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.16);
  color: #a7f3d0;
}

.xmas-decorate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xmas-polaroid-preview-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.xmas-mini-polaroid-preview {
  position: relative;
  width: 124px;
  padding: 8px 8px 12px;
  border-radius: 10px;
  background: #FFFAF0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
  flex-shrink: 0;
  transform: rotate(-1.6deg);
  transition: background 0.18s ease, transform 0.2s ease;
}

.xmas-preview-seal-badge {
  position: absolute;
  top: -8px;
  left: -6px;
  right: -6px;
  padding: 3px 6px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #be123c, #9f1239);
  color: #fef3c7;
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 4px 10px rgba(159, 18, 57, 0.35);
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xmas-preview-photo-box {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a, #1d4ed8);
  color: #fff;
  font-size: 28px;
}

.xmas-preview-photo-box img,
.xmas-preview-photo-box canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.xmas-preview-caption {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.3;
  color: #334155;
  text-align: center;
  min-height: 26px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.xmas-polaroid-upload-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

#christmasTreePage label {
  color: inherit;
  margin: 0;
}

#christmasTreePage .xmas-field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 2px;
}

#christmasTreePage input[type="radio"],
#christmasTreePage input[type="checkbox"] {
  display: inline-block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  flex-shrink: 0;
}

#christmasTreePage input.xmas-file-sr,
.xmas-file-sr {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  opacity: 0 !important;
  pointer-events: none;
}

#christmasTreePage .xmas-upload-dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.5px dashed rgba(22, 163, 74, 0.42);
  background: rgba(240, 253, 244, 0.72);
  color: var(--ink, #123d30);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.15s ease;
}

#christmasTreePage .xmas-upload-dropzone:hover,
#christmasTreePage .xmas-upload-dropzone.is-dragover {
  border-color: #16a34a;
  background: rgba(220, 252, 231, 0.85);
}

#christmasTreePage .xmas-upload-dropzone:has(input:focus-visible) {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

html.dark-theme #christmasTreePage .xmas-upload-dropzone,
body.dark-theme #christmasTreePage .xmas-upload-dropzone {
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(16, 42, 34, 0.6);
  color: #ecfdf5;
}

.xmas-upload-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #16a34a, #0f766e);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.xmas-upload-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.xmas-upload-copy strong {
  font-size: 13px;
  font-weight: 700;
}

.xmas-upload-copy small {
  font-size: 11px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xmas-clear-photo-link {
  align-self: flex-start;
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--muted, #64748b);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.xmas-clear-photo-link:hover {
  color: var(--ink, #123d30);
}

.xmas-preset-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.xmas-preset-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  border-radius: 11px;
  border: 1.5px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: var(--ink, #123d30);
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.15s ease, box-shadow 0.16s ease;
}

.xmas-preset-card:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 163, 74, 0.55);
}

.xmas-preset-card.active {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.35);
}

.xmas-preset-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  overflow: hidden;
  background: #0f172a;
}

.xmas-preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.xmas-preset-name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

html.dark-theme .xmas-preset-card,
body.dark-theme .xmas-preset-card {
  background: #13221d;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.2);
}

html.dark-theme .xmas-preset-card.active,
body.dark-theme .xmas-preset-card.active {
  border-color: #34d399;
  color: #a7f3d0;
  background: rgba(52, 211, 153, 0.14);
}

.xmas-fieldset {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line, #dfe4dc);
}

.xmas-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #64748b);
}

.xmas-color-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#christmasTreePage .xmas-color-radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 7px;
  margin: 0;
  border-radius: 9999px;
  border: 1.5px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#christmasTreePage .xmas-color-radio input,
#christmasTreePage .xmas-acc-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.xmas-swatch-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
}

.xmas-color-radio:has(input:checked) {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.25);
}

.xmas-color-radio:has(input:focus-visible),
.xmas-acc-card:has(input:focus-visible),
.xmas-preset-card:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

.xmas-acc-preview-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid rgba(22, 163, 74, 0.24);
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.85), rgba(254, 249, 195, 0.55));
}

html.dark-theme .xmas-acc-preview-strip,
body.dark-theme .xmas-acc-preview-strip {
  background: linear-gradient(135deg, rgba(16, 46, 34, 0.8), rgba(66, 32, 6, 0.45));
  border-color: rgba(52, 211, 153, 0.28);
}

.xmas-acc-preview-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
  flex-shrink: 0;
}

.xmas-acc-preview-copy {
  min-width: 0;
}

.xmas-acc-preview-copy strong {
  display: block;
  font-size: 13px;
}

.xmas-acc-preview-copy p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xmas-acc-radio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#christmasTreePage .xmas-acc-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  margin: 0;
  border-radius: 11px;
  border: 1.5px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.14s ease, background 0.15s ease;
}

#christmasTreePage .xmas-acc-card:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 163, 74, 0.48);
}

.xmas-acc-card-emblem {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.22);
}

.xmas-acc-card-name {
  min-width: 0;
  line-height: 1.25;
}

.xmas-acc-card:has(input:checked) {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.28);
}

html.dark-theme #christmasTreePage .xmas-acc-card,
body.dark-theme #christmasTreePage .xmas-acc-card {
  background: #13221d;
  border-color: rgba(148, 163, 184, 0.22);
}

html.dark-theme .xmas-acc-card:has(input:checked),
body.dark-theme .xmas-acc-card:has(input:checked) {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

/* Sealed Mystery Badge inside Gallery & Inspector */
.xmas-mystery-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(190, 18, 60, 0.1);
  color: #be123c;
  border: 1px solid rgba(190, 18, 60, 0.25);
}

html.dark-theme .xmas-mystery-tag,
body.dark-theme .xmas-mystery-tag {
  background: rgba(251, 113, 133, 0.15);
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.3);
}

/* Confirmation Modal: "Bạn có muốn giữ món quà này đến Giáng sinh?" */
dialog.xmas-confirm-modal {
  margin: auto;
  padding: 0;
  border: 1px solid var(--line, #dfe4dc);
  border-radius: 22px;
  width: min(440px, calc(100vw - 24px));
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 28px 64px rgba(2, 16, 12, 0.42);
  overscroll-behavior: contain;
}

dialog.xmas-confirm-modal:not([open]) {
  display: none;
}

dialog.xmas-confirm-modal::backdrop {
  background: rgba(4, 15, 11, 0.62);
  backdrop-filter: blur(5px);
}

html.dark-theme dialog.xmas-confirm-modal,
body.dark-theme dialog.xmas-confirm-modal {
  background: #0d1d17;
  color: #ecfdf5;
  border-color: rgba(134, 239, 172, 0.22);
}

.xmas-confirm-card {
  padding: 24px 22px 20px;
  text-align: center;
}

.xmas-confirm-hero {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
}

.xmas-confirm-card h3 {
  margin: 0 0 8px;
  font-family: var(--unbounded, "Unbounded", sans-serif);
  font-size: 16.5px;
  line-height: 1.35;
}

.xmas-confirm-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted, #64748b);
}

.xmas-confirm-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.xmas-confirm-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 10px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.xmas-confirm-choice-btn:hover {
  transform: translateY(-2px);
}

.xmas-confirm-choice-btn strong {
  font-size: 14px;
  font-weight: 800;
}

.xmas-confirm-choice-btn span {
  font-size: 11px;
  opacity: 0.88;
}

.xmas-confirm-choice-btn.is-seal {
  background: linear-gradient(135deg, #be123c, #9f1239);
  color: #fff7ed;
  box-shadow: 0 10px 22px rgba(159, 18, 57, 0.28);
}

.xmas-confirm-choice-btn.is-open {
  background: linear-gradient(135deg, #16a34a, #0f766e);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.28);
}

.xmas-confirm-cancel-btn {
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
}

.xmas-confirm-cancel-btn:hover {
  color: var(--ink, #123d30);
  text-decoration: underline;
}

.xmas-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#christmasTreePage .xmas-field-group textarea,
#christmasTreePage .xmas-field-group input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  color: inherit;
  font-size: 13.5px;
  resize: vertical;
}

.xmas-field-group textarea:focus-visible,
.xmas-field-group input[type="text"]:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 1px;
}

.xmas-field-hint {
  font-size: 11.5px;
  color: var(--muted, #64748b);
  align-self: flex-end;
}

#christmasTreePage .xmas-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.xmas-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.xmas-form-actions-centered {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

#christmasTreePage .xmas-hang-cta-btn {
  width: min(100%, 300px);
  min-height: 46px;
  padding: 11px 28px;
  border-radius: 9999px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #15803d 0%, #166534 55%, #0f766e 100%);
  border: 1px solid rgba(167, 243, 208, 0.35);
  color: #ffffff;
  box-shadow: 0 10px 24px -6px rgba(21, 128, 61, 0.45);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

#christmasTreePage .xmas-hang-cta-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 14px 28px -6px rgba(21, 128, 61, 0.52);
}

#christmasTreePage .xmas-hang-cta-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Upload Streak Lock + Tier Gradient Swatch Badges */
.xmas-upload-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.xmas-streak-req-tag,
.xmas-tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  font-style: normal;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

html.dark-theme .xmas-streak-req-tag,
body.dark-theme .xmas-streak-req-tag,
html.dark-theme .xmas-tier-chip,
body.dark-theme .xmas-tier-chip {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
}

.xmas-streak-req-tag.is-unlocked {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.3);
}

html.dark-theme .xmas-streak-req-tag.is-unlocked,
body.dark-theme .xmas-streak-req-tag.is-unlocked {
  background: rgba(52, 211, 153, 0.14);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.32);
}

#christmasTreePage .xmas-upload-dropzone.is-locked {
  opacity: 0.62;
  cursor: not-allowed;
  border-style: solid;
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.12);
}

.xmas-upload-lock-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: #b45309;
}

html.dark-theme .xmas-upload-lock-note,
body.dark-theme .xmas-upload-lock-note {
  color: #fde68a;
}

.is-tier-option.is-locked,
.is-tier-option.is-tier-locked {
  opacity: 0.54;
  cursor: not-allowed !important;
}

/* Greeting Card Studio Designer & Live 6-Template Preview */
.xmas-card-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#christmasTreePage .xmas-card-tpl-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  margin: 0;
  border-radius: 10px;
  border: 1.5px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

#christmasTreePage .xmas-card-tpl-opt input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.xmas-card-tpl-opt:has(input:checked) {
  border-color: #16a34a;
  background: rgba(22, 163, 74, 0.11);
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.25);
}

html.dark-theme #christmasTreePage .xmas-card-tpl-opt,
body.dark-theme #christmasTreePage .xmas-card-tpl-opt {
  background: #13221d;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

.xmas-tpl-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  flex-shrink: 0;
}

.xmas-card-meta-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.xmas-card-designer-wrap {
  display: flex;
  justify-content: center;
}

.xmas-card-live-preview {
  width: min(100%, 272px);
}

#xmasCardCharCount.is-over-limit {
  color: #dc2626;
  font-weight: 800;
}

.xmas-card-sheet {
  position: relative;
  width: 100%;
  aspect-ratio: 1414 / 2000;
  border-radius: 14px;
  overflow: hidden;
  container-type: inline-size;
  color: #1e293b;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  border: 1.5px solid rgba(15, 23, 42, 0.08);
  box-sizing: border-box;
  user-select: none;
}

.xmas-card-sheet.is-viewer {
  width: min(100%, 440px);
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.34);
}

.xmas-card-sheet .xc-tpl-artwork {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  z-index: 1;
}

.xmas-card-sheet .xc-tpl-name {
  position: absolute;
  z-index: 2;
  font-family: var(--serif);
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.xmas-card-sheet .xc-tpl-wish {
  position: absolute;
  z-index: 2;
  font-family: var(--sans);
  font-weight: 600;
  text-align: left;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  overflow: hidden;
  pointer-events: none;
}

.xmas-danger-btn {
  color: var(--danger, #ae4c3f) !important;
  border-color: rgba(174, 76, 63, 0.32) !important;
}

.xmas-tree-status-banner {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  min-height: 18px;
  color: #15803d;
}

.xmas-tree-status-banner.is-error {
  color: var(--danger, #dc2626);
}

.xmas-tree-gallery-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.xmas-gallery-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface-2, #f8fafc);
}

.xmas-gallery-item.is-selected {
  border-color: #16a34a;
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.25);
}

.xmas-gallery-icon {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #dfe4dc);
  font-size: 20px;
}

.xmas-gallery-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xmas-gallery-info {
  flex: 1;
  min-width: 0;
}

.xmas-gallery-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.xmas-gallery-msg {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted, #64748b);
  word-break: break-word;
}

.xmas-gallery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  max-width: 170px;
}

.xmas-gallery-locate-btn,
.xmas-gallery-delete-btn,
.xmas-open-viewer-btn {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface, #fff);
  color: var(--ink, #123d30);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.xmas-open-viewer-btn {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.34);
  color: #15803d;
}

.xmas-open-viewer-btn:hover {
  background: rgba(22, 163, 74, 0.2);
}

html.dark-theme .xmas-open-viewer-btn,
body.dark-theme .xmas-open-viewer-btn {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(74, 222, 128, 0.38);
  color: #86efac;
}

html.dark-theme .xmas-gallery-locate-btn,
body.dark-theme .xmas-gallery-locate-btn,
html.dark-theme .xmas-gallery-delete-btn,
body.dark-theme .xmas-gallery-delete-btn {
  background: #162230;
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

.xmas-gallery-delete-btn {
  color: var(--danger, #ae4c3f);
  border-color: rgba(174, 76, 63, 0.28);
}

.xmas-gallery-submeta,
.xmas-inspector-subname {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-top: 3px;
}

.xmas-inspector-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* Ornament Heart Like Pill */
.xmas-like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 9999px;
  border: 1px solid rgba(244, 63, 94, 0.34);
  background: rgba(255, 255, 255, 0.92);
  color: #e11d48;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  user-select: none;
}

.xmas-like-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(244, 63, 94, 0.08);
}

.xmas-like-btn .xmas-heart-icon {
  display: block;
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), fill 0.18s ease;
}

.xmas-like-btn .xmas-like-count {
  font-variant-numeric: tabular-nums;
}

.xmas-like-btn.has-liked {
  background: rgba(244, 63, 94, 0.14);
  border-color: #f43f5e;
}

.xmas-like-btn.has-liked .xmas-heart-icon {
  fill: #f43f5e;
  stroke: #f43f5e;
}

.xmas-like-btn.animate-pop .xmas-heart-icon {
  animation: heartPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

html.dark-theme .xmas-like-btn,
body.dark-theme .xmas-like-btn {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(251, 113, 133, 0.38);
  color: #fda4af;
}

html.dark-theme .xmas-like-btn.has-liked,
body.dark-theme .xmas-like-btn.has-liked {
  background: rgba(244, 63, 94, 0.24);
  border-color: #fb7185;
}

/* Christmas Countdown Bar */
.xmas-countdown-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), rgba(22, 163, 74, 0.1));
  border: 1px solid rgba(22, 163, 74, 0.22);
}

.xmas-countdown-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: #14532d;
}

.xmas-countdown-clock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #b91c1c;
}

.xmas-countdown-clock span strong {
  font-size: 13.5px;
}

html.dark-theme .xmas-countdown-bar,
body.dark-theme .xmas-countdown-bar {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.16), rgba(16, 185, 129, 0.14));
  border-color: rgba(74, 222, 128, 0.26);
}

html.dark-theme .xmas-countdown-label,
body.dark-theme .xmas-countdown-label {
  color: #bbf7d0;
}

html.dark-theme .xmas-countdown-clock,
body.dark-theme .xmas-countdown-clock {
  color: #fda4af;
}

/* Christmas Tree Likes Leaderboard Tab (Arena Top 3 Podium + Top 4-10 List) */
.xmas-lb-summary-notice {
  margin-bottom: 6px;
  font-size: 12px;
}

.xmas-lb-podium-wrap {
  padding: 4px 0 22px;
  overflow: visible;
}

.xmas-lb-podium-wrap .arena-concept1-wrap {
  gap: 8px;
  padding-top: 40px;
}

.xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-1 {
  --mini-scale: 0.222;
  width: calc(680px * var(--mini-scale));
  height: calc(760px * var(--mini-scale));
}

.xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-2,
.xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-3 {
  --mini-scale: 0.19;
  width: calc(680px * var(--mini-scale));
  height: calc(760px * var(--mini-scale));
}

.xmas-lb-podium-wrap .champ-cover-banner {
  height: 33%;
}

.xmas-lb-podium-wrap .champ-body.mini-namecard-body {
  padding: 0 5px;
}

.xmas-lb-podium-wrap .champ-avatar-wrap {
  margin-top: -16px;
}

.xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-1 .champ-avatar-wrap {
  margin-top: -20px;
}

.xmas-lb-podium-wrap .champ-avatar.rank-1-avatar {
  width: 40px;
  height: 40px;
  font-size: 17px;
  --ring-inset: -3px;
  --ring-width: 2px;
}

.xmas-lb-podium-wrap .champ-avatar.rank-2-avatar,
.xmas-lb-podium-wrap .champ-avatar.rank-3-avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
  --ring-inset: -2.5px;
  --ring-width: 1.5px;
}

.xmas-lb-podium-wrap .champ-crown.rank-medal.rank-1 svg {
  width: 30px;
  height: 30px;
}

.xmas-lb-podium-wrap .champ-crown.rank-medal.rank-2 svg,
.xmas-lb-podium-wrap .champ-crown.rank-medal.rank-3 svg {
  width: 26px;
  height: 26px;
}

.xmas-lb-podium-wrap .champ-info-group {
  gap: 4px;
  padding-top: 2px;
  padding-bottom: 9px;
}

.xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-1 .champ-info-group {
  gap: 5px;
  padding-bottom: 11px;
}

.xmas-lb-podium-wrap .champ-name {
  font-size: 11px;
  padding: 0 3px;
  gap: 2.5px;
}

.xmas-lb-podium-wrap .champ-name.font-bold {
  font-size: 12px;
}

.xmas-lb-podium-wrap .champ-rank-pill {
  font-size: 9.5px;
  padding: 1.5px 8px;
}

.xmas-lb-podium-wrap .champ-score {
  font-size: 10.5px;
  padding: 2px 9px;
}

.xmas-lb-podium-wrap .xmas-lb-empty {
  width: 100%;
  padding: 28px 16px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--muted, #64748b);
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 14px;
}

.xmas-lb-list-container {
  margin-top: 6px;
}

.xmas-lb-heart-icon {
  margin-right: 3px;
  vertical-align: -2px;
}

@media (max-width: 760px) {
  .xmas-tree-panel-tabs {
    padding: 8px 10px 0;
    gap: 2px;
  }

  .xmas-panel-tab {
    padding: 8px 8px;
    font-size: 11.5px;
  }

  .xmas-lb-podium-wrap .arena-concept1-wrap {
    gap: 6px !important;
    padding-top: 38px !important;
  }

  .xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-1 {
    --mini-scale: 0.165 !important;
    width: calc(680px * var(--mini-scale)) !important;
    height: calc(760px * var(--mini-scale)) !important;
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }

  .xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-2,
  .xmas-lb-podium-wrap .arena-champion-card.mini-namecard.rank-3 {
    --mini-scale: 0.138 !important;
    width: calc(680px * var(--mini-scale)) !important;
    height: calc(760px * var(--mini-scale)) !important;
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }
}

/* Mobile Stage Fullscreen Button & State */
.xmas-stage-fs-btn {
  display: none;
  padding: 0 9px;
}

.xmas-stage-fs-btn .xmas-fs-compress-icon {
  display: none;
}

.xmas-stage-fs-btn[aria-pressed="true"] .xmas-fs-expand-icon {
  display: none;
}

.xmas-stage-fs-btn[aria-pressed="true"] .xmas-fs-compress-icon {
  display: block;
}

#christmasTreePage.is-stage-fullscreen,
dialog#christmasTreeModal.is-stage-fullscreen[open] {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100000 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: var(--surface, #ffffff) !important;
}

#christmasTreePage.is-stage-fullscreen .xmas-tree-two-windows {
  display: flex !important;
  flex-direction: column !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}

#christmasTreePage.is-stage-fullscreen .xmas-tree-card-panel {
  display: none !important;
}

#christmasTreePage.is-stage-fullscreen .xmas-tree-card-stage {
  flex: 1 !important;
  width: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  border: none !important;
}

#christmasTreePage.is-stage-fullscreen .xmas-tree-stage-body {
  flex: 1 !important;
  padding: 10px !important;
}

#christmasTreePage.is-stage-fullscreen .xmas-tree-stage-wrap {
  flex: 1 !important;
  height: 100% !important;
  min-height: 0 !important;
}

/* Fullscreen Ornament Viewer Modal (Thiep / Polaroid / Gift Reveal) */
dialog#xmasItemViewerModal[open] {
  width: min(94vw, 560px);
  max-width: 560px;
  height: auto;
  max-height: 92dvh;
  margin: auto;
  padding: 0;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: var(--surface, #ffffff);
  color: var(--ink, #123d30);
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

dialog#xmasItemViewerModal::backdrop {
  background: rgba(7, 16, 22, 0.72);
  backdrop-filter: blur(8px);
}

html.dark-theme dialog#xmasItemViewerModal[open],
body.dark-theme dialog#xmasItemViewerModal[open] {
  background: #111820;
  border-color: rgba(125, 211, 252, 0.24);
  color: #e2e8f0;
}

.xmas-item-viewer-shell {
  display: flex;
  flex-direction: column;
  max-height: 92dvh;
  min-height: 0;
}

.xmas-item-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, #dfe4dc);
  flex-shrink: 0;
}

.xmas-item-viewer-meta h3 {
  margin: 0;
  font-family: var(--unbounded, "Unbounded", sans-serif);
  font-size: 15px;
  font-weight: 700;
}

.xmas-item-viewer-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted, #64748b);
}

.xmas-item-viewer-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.xmas-item-viewer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(248, 250, 252, 0.92), rgba(226, 232, 240, 0.5));
}

html.dark-theme .xmas-item-viewer-body,
body.dark-theme .xmas-item-viewer-body {
  background: radial-gradient(circle at center, #13252a, #09121a);
}

.xmas-viewer-card-stage {
  width: 100%;
  display: flex;
  justify-content: center;
}

.xmas-viewer-polaroid-frame {
  width: min(100%, 360px);
  padding: 16px 16px 20px;
  border-radius: 14px;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.xmas-viewer-polaroid-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xmas-viewer-polaroid-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.xmas-viewer-polaroid-caption {
  text-align: center;
  color: #1e293b;
}

.xmas-viewer-polaroid-frame.is-dark-frame .xmas-viewer-polaroid-caption {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  padding: 10px 12px;
}

.xmas-viewer-polaroid-msg {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.xmas-viewer-polaroid-by {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.xmas-viewer-gift-box {
  position: relative;
  width: min(100%, 420px);
  padding: 24px 20px 22px;
  border-radius: 20px;
  border: 3px solid;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.xmas-viewer-gift-ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 100%;
  opacity: 0.34;
  pointer-events: none;
}

.xmas-viewer-gift-emblem {
  position: relative;
  z-index: 2;
  width: 68px;
  height: 68px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.xmas-viewer-gift-note {
  position: relative;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  border-radius: 14px;
  padding: 18px 18px 16px;
  text-align: center;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
}

.xmas-viewer-gift-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  margin-bottom: 8px;
}

.xmas-viewer-gift-msg {
  margin: 0 0 12px;
  font-size: 15.5px;
  line-height: 1.55;
  font-weight: 600;
  word-break: break-word;
  white-space: pre-wrap;
}

.xmas-viewer-gift-from {
  font-size: 12.5px;
  color: #475569;
}

.xmas-viewer-locked-card {
  text-align: center;
  padding: 28px 20px;
  max-width: 340px;
}

.xmas-viewer-locked-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: rgba(190, 18, 60, 0.14);
  color: #be123c;
  margin-bottom: 12px;
}

.xmas-item-viewer-likes-list {
  border-top: 1px solid var(--line, #dfe4dc);
  padding: 12px 18px;
  max-height: 180px;
  overflow-y: auto;
  background: var(--surface-2, #f8fafc);
}

html.dark-theme .xmas-item-viewer-likes-list,
body.dark-theme .xmas-item-viewer-likes-list {
  background: #0d1620;
  border-top-color: rgba(148, 163, 184, 0.2);
}

.xmas-likes-list-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #64748b);
  margin-bottom: 8px;
}

.xmas-likes-list-rows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.xmas-liker-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 9999px;
  border: 1px solid var(--line, #dfe4dc);
  background: var(--surface, #fff);
  color: var(--ink, #123d30);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.xmas-liker-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16a34a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.xmas-likes-empty {
  font-size: 12.5px;
  color: var(--muted, #64748b);
}

@media (max-width: 860px) {
  #christmasTreePage.page {
    padding: 8px 10px 110px;
  }

  .xmas-tree-two-windows {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .xmas-tree-card-stage {
    height: 330px;
    min-height: 330px;
    max-height: 330px;
    flex: none;
    border-radius: 18px;
  }

  .xmas-tree-stage-header {
    padding: 8px 12px;
  }

  .xmas-tree-stage-badge {
    font-size: 12px;
    white-space: nowrap;
  }

  .xmas-stage-ctrl-btn {
    min-height: 28px;
    padding: 0 7px;
    font-size: 11px;
    gap: 4px;
  }

  .xmas-stage-ctrl-btn .xmas-spin-text {
    font-size: 10.5px;
  }

  .xmas-tree-stage-body {
    padding: 6px 10px 8px;
  }

  .xmas-tree-stage-wrap {
    flex: 1;
    min-height: 0;
    height: 100%;
  }

  .xmas-tree-milestone-bar {
    bottom: 8px;
    left: 8px;
    top: auto;
    max-width: calc(100% - 16px);
    font-size: 11px;
    padding: 4px 9px;
  }

  .xmas-tree-stage-hint {
    margin: 5px 2px 0;
    font-size: 11px;
  }

  .xmas-tree-card-panel {
    border-radius: 18px;
    height: auto;
    min-height: 0;
    max-height: none;
    flex: none;
  }

  .xmas-tree-page-header {
    padding: 10px 12px 8px;
    border-radius: 18px 18px 0 0;
  }

  .xmas-tree-header-left {
    gap: 8px;
    align-items: center;
  }

  .xmas-tree-back-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .xmas-tree-close-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .xmas-tree-header-copy h1,
  .xmas-tree-header-copy h2 {
    font-size: 15px;
    margin: 0;
  }

  .xmas-tree-header-sub {
    display: none;
  }

  dialog#christmasTreeModal[open] {
    width: calc(100vw - 16px);
    max-height: 92dvh;
    border-radius: 18px;
  }

  .xmas-tree-dialog-shell {
    max-height: 92dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .xmas-tree-modal-header {
    position: sticky;
    top: 0;
    z-index: 25;
    padding: 12px 14px 10px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  html.dark-theme .xmas-tree-modal-header,
  body.dark-theme .xmas-tree-modal-header {
    background: rgba(17, 24, 32, 0.96);
  }

  .xmas-stage-fs-btn {
    display: inline-flex;
  }

  .xmas-tree-panel-col {
    min-width: 0;
    width: 100%;
    overflow: visible;
  }

  .xmas-tree-panel-body {
    overflow-y: visible;
    padding: 14px;
  }

  .xmas-acc-radio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xmas-slot-switcher-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xmas-card-template-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xmas-gallery-item {
    flex-wrap: wrap;
  }

  .xmas-gallery-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    padding-left: 54px;
  }
}

@media (max-width: 480px) {
  .xmas-polaroid-preview-row {
    flex-direction: column;
    align-items: center;
  }

  .xmas-preset-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .xmas-confirm-choices {
    grid-template-columns: 1fr;
  }
}

/* Mobile Layout & WCAG Touch Targets (44x44 minimum, clear of Floating Island .mobile-nav & .mobile-fab) */
@media (max-width: 760px),
(pointer: coarse) {

  .xmas-widget-music-btn,
  .xmas-widget-snow-btn,
  .xmas-widget-tree-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 760px) {
  .christmas-floating-widget {
    left: max(12px, env(safe-area-inset-left, 0px));
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    padding: 3px;
    max-width: calc(100vw - 92px);
  }

  html.study-mode-active .christmas-floating-widget {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .xmas-widget-label {
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11.5px;
  }

  .xmas-widget-music-btn {
    padding: 0 9px;
    gap: 5px;
  }

  .xmas-widget-tree-btn {
    padding: 0 9px;
    gap: 4px;
  }

  .xmas-hero-tree-btn {
    padding: 0 12px !important;
    font-size: 12px !important;
    min-height: 36px !important;
  }
}

/* ==========================================================================
   POST DETAIL: LIQUID GLASS & FULL-PILL COHESIVE SYSTEM
   Harmonizes top toolbar, docked reading bar, card actions & reply capsule
   ========================================================================== */
#postDetail .post-detail-top-nav-slot {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  overflow-anchor: none;
}

#postDetail .post-detail-top-nav {
  margin: 0 !important;
  padding: 5px 6px !important;
  min-height: 48px;
  height: 48px;
  gap: 8px;
  border-radius: 9999px !important;
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: space-between;
  background: var(--glass-bg) !important;
  backdrop-filter: blur(22px) saturate(185%);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  border: 1px solid var(--glass-border) !important;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow) !important;
  box-sizing: border-box;
  will-change: transform, opacity;
}

#postDetail .post-detail-breadcrumb {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--glass-nav-ink);
  overflow: hidden;
  white-space: nowrap;
}

#postDetail .post-detail-breadcrumb .bc-prefix {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#postDetail #postDetailBreadcrumbTopic {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--glass-nav-ink-hover);
  font-weight: 600;
}

#postDetail .post-detail-top-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

#postDetail .post-detail-top-nav button,
#postDetail .back-to-forum-btn,
#postDetail .post-detail-share-btn,
#postDetail .post-detail-save-btn {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 9999px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--glass-control-bg) !important;
  border: 1px solid var(--glass-control-border) !important;
  color: var(--glass-nav-ink-hover) !important;
  box-shadow: none !important;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.18s ease-out;
}

#postDetail .post-detail-top-nav button:hover,
#postDetail .back-to-forum-btn:hover,
#postDetail .post-detail-share-btn:hover,
#postDetail .post-detail-save-btn:hover {
  background: var(--glass-control-hover-bg) !important;
  border-color: var(--glass-border-strong) !important;
  color: var(--glass-nav-active-ink) !important;
  transform: translateY(-1px);
}

#postDetail .back-to-forum-btn:hover .back-arrow {
  transform: translateX(-2px);
}

#postDetail .back-to-forum-btn .back-arrow {
  transition: transform 0.2s ease-out;
}

#postDetail .post-detail-top-nav button:active,
#postDetail .back-to-forum-btn:active,
#postDetail .post-detail-share-btn:active,
#postDetail .post-detail-save-btn:active {
  transform: scale(0.95) !important;
}

#postDetail .post-detail-top-nav button:focus-visible,
#postDetail .back-to-forum-btn:focus-visible,
#postDetail .post-detail-share-btn:focus-visible,
#postDetail .post-detail-save-btn:focus-visible {
  outline: 2px solid var(--glass-accent-dot);
  outline-offset: 2px;
}

#postDetail .post-detail-save-btn.is-saved {
  background: var(--glass-nav-pill-bg) !important;
  border-color: var(--glass-nav-pill-border) !important;
  color: var(--glass-nav-active-ink) !important;
}

/* Softly round post detail card, card action pills & floating composer */
#postDetail .post-detail-card {
  border-radius: 22px;
}

#postDetail .detail-actions .button-sm,
#postDetail .detail-actions .button-outline,
#postDetail .detail-action-frame,
#postDetail .post-linked-doc-actions .button {
  border-radius: 9999px;
}

#postDetail .post-detail-pinned-reply {
  border-radius: 9999px;
  padding: 6px 8px;
  background: var(--glass-bg) !important;
  backdrop-filter: blur(22px) saturate(185%);
  -webkit-backdrop-filter: blur(22px) saturate(185%);
  border: 1px solid var(--glass-border) !important;
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--glass-shadow) !important;
  transition:
    border-radius 0.28s ease-out,
    padding 0.24s ease-out,
    background 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease;
}

#postDetail .post-detail-pinned-reply:has(.reply-bar.expanded) {
  border-radius: 22px;
  padding: 14px 16px;
}

#postDetail .post-detail-pinned-reply .reply-bar.collapsed .reply-pill {
  border-radius: 9999px;
  background: var(--glass-control-bg) !important;
  border: 1px solid var(--glass-control-border) !important;
}

#postDetail .post-detail-pinned-reply .reply-bar.collapsed .ql-container {
  border-radius: 9999px;
}

#postDetail .post-detail-pinned-reply .reply-avatar-dropdown {
  margin-bottom: 0;
  padding-left: 2px;
}

#postDetail .post-detail-pinned-reply .reply-bar.collapsed {
  align-items: center;
}

#postDetail .post-detail-pinned-reply .btn-send {
  border-radius: 9999px;
}

#postDetail .post-detail-pinned-reply .btn-expand-tools,
#postDetail .post-detail-pinned-reply .btn-collapse-tools {
  border-radius: 9999px;
}

/* ============================================================
   UNIFIED REPLY CONTEXT (LEVEL-2 REPLY BANNER)
   ============================================================ */

.reply-context-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 12px 5px 10px;
  margin-bottom: 6px;
  background: rgba(18, 63, 49, 0.08);
  border: 1px solid rgba(18, 63, 49, 0.12);
  border-radius: 9999px;
  font-size: 12px;
  color: var(--primary, #123f31);
  animation: replyBannerSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes replyBannerSlideIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reply-context-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.reply-context-icon {
  flex-shrink: 0;
  color: var(--primary, #123f31);
}

.reply-context-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-context-cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(18, 63, 49, 0.18);
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary, #123f31);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.reply-context-cancel-btn:hover {
  background: var(--surface, #ffffff);
  color: var(--error, #dc2626);
  border-color: rgba(220, 38, 38, 0.35);
  transform: scale(1.04);
}

/* Morph pinned reply dock when reply context is active */
#postDetail .post-detail-pinned-reply.has-reply-context {
  border-radius: 22px !important;
  padding: 8px 12px 6px !important;
}

#postDetail .post-detail-pinned-reply.dock-reply-pulse {
  animation: dockReplyPulse 0.45s ease-out;
}

@keyframes dockReplyPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 63, 49, 0.45);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(18, 63, 49, 0.18), var(--glass-shadow);
  }

  100% {
    box-shadow: var(--glass-shadow);
  }
}

/* Dark mode overrides */
body.dark-theme .reply-context-banner {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.22);
  color: #34d399;
}

body.dark-theme .reply-context-icon {
  color: #34d399;
}

body.dark-theme .reply-context-cancel-btn {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(52, 211, 153, 0.3);
  color: #e2e8f0;
}

body.dark-theme .reply-context-cancel-btn:hover {
  background: #334155;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
}

/* Ruby theme overrides */
[data-user-theme="ruby"] .reply-context-banner {
  background: rgba(225, 29, 72, 0.09);
  border-color: rgba(225, 29, 72, 0.18);
  color: #e11d48;
}

[data-user-theme="ruby"] .reply-context-icon {
  color: #e11d48;
}

[data-user-theme="ruby"] .reply-context-cancel-btn {
  border-color: rgba(225, 29, 72, 0.22);
  color: #e11d48;
}

[data-user-theme="ruby"] body.dark-theme .reply-context-banner {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.25);
  color: #fb7185;
}

[data-user-theme="ruby"] body.dark-theme .reply-context-icon {
  color: #fb7185;
}

/* Mythic theme overrides */
[data-user-theme="mythic"] .reply-context-banner {
  background: rgba(124, 58, 237, 0.09);
  border-color: rgba(124, 58, 237, 0.18);
  color: #7c3aed;
}

[data-user-theme="mythic"] .reply-context-icon {
  color: #7c3aed;
}

[data-user-theme="mythic"] .reply-context-cancel-btn {
  border-color: rgba(124, 58, 237, 0.22);
  color: #7c3aed;
}

[data-user-theme="mythic"] body.dark-theme .reply-context-banner {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.25);
  color: #a78bfa;
}

[data-user-theme="mythic"] body.dark-theme .reply-context-icon {
  color: #a78bfa;
}

/* Rose Quartz Reply Context */
[data-user-theme="rosequartz"] .reply-context-banner {
  background: rgba(138, 49, 87, 0.08);
  border-color: rgba(138, 49, 87, 0.2);
  color: #8a3157;
}
[data-user-theme="rosequartz"] .reply-context-icon {
  color: #8a3157;
}
[data-user-theme="rosequartz"] .reply-context-cancel-btn {
  border-color: rgba(138, 49, 87, 0.25);
  color: #8a3157;
}
[data-user-theme="rosequartz"] body.dark-theme .reply-context-banner {
  background: rgba(244, 114, 182, 0.14);
  border-color: rgba(244, 114, 182, 0.28);
  color: #fbcfe8;
}
[data-user-theme="rosequartz"] body.dark-theme .reply-context-icon {
  color: #fbcfe8;
}

/* Super Neon Reply Context */
[data-user-theme="super"] .reply-context-banner {
  background: rgba(0, 184, 148, 0.08);
  border-color: rgba(0, 206, 201, 0.25);
  color: #00897b;
}
[data-user-theme="super"] .reply-context-icon {
  color: #00b894;
}
[data-user-theme="super"] .reply-context-cancel-btn {
  border-color: rgba(0, 206, 201, 0.3);
  color: #00897b;
}
[data-user-theme="super"] body.dark-theme .reply-context-banner {
  background: rgba(0, 210, 255, 0.14);
  border-color: rgba(0, 245, 155, 0.3);
  color: #00f59b;
}
[data-user-theme="super"] body.dark-theme .reply-context-icon {
  color: #00f59b;
}

/* Diamond Celestial Reply Context */
[data-user-theme="diamond"] .reply-context-banner {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.18);
  color: #0f172a;
}
[data-user-theme="diamond"] .reply-context-icon {
  color: #0f172a;
}
[data-user-theme="diamond"] .reply-context-cancel-btn {
  border-color: rgba(15, 23, 42, 0.25);
  color: #0f172a;
}
[data-user-theme="diamond"] body.dark-theme .reply-context-banner {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
[data-user-theme="diamond"] body.dark-theme .reply-context-icon {
  color: #ffffff;
}

/* Christmas theme overrides */
body.christmas-season:not(.christmas-effects-off) .reply-context-banner {
  background: rgba(22, 101, 52, 0.1);
  border-color: rgba(220, 38, 38, 0.25);
  color: #15803d;
}

body.christmas-season:not(.christmas-effects-off) .reply-context-icon {
  color: #dc2626;
}

body.christmas-season:not(.christmas-effects-off) .reply-context-cancel-btn {
  border-color: rgba(220, 38, 38, 0.3);
  color: #dc2626;
}

/* Desktop Floating Header Integration (aligns cleanly at top: 14px when compact) */
@media (min-width: 801px) and (min-height: 521px) {
  #postDetail.post-detail-page {
    padding-top: 16px !important;
  }

  #postDetail .post-detail-top-nav-slot {
    min-height: 48px;
    height: 48px;
    margin-bottom: 20px;
  }

  #postDetail .post-detail-top-nav:not(.is-header-docked) {
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    transform: none;
    z-index: 90;
  }

  #postDetail .post-detail-top-nav.is-header-docked {
    position: fixed;
    top: 70px;
    left: 50%;
    width: min(740px, calc(100vw - 44px));
    max-width: calc(100vw - 44px);
    transform: translate3d(-50%, 0, 0) scale(1);
    z-index: 1001;
    pointer-events: auto;
    opacity: 1;
    transition:
      opacity 0.22s ease,
      transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      width 0.24s ease-out,
      background 0.24s ease,
      border-color 0.24s ease;
  }

  #postDetail .post-detail-top-nav.is-header-docked.is-peek-suppressed {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate3d(-50%, -10px, 0) scale(0.95) !important;
  }

  body.detail-dock-tight #postDetail .post-detail-top-nav.is-header-docked .post-detail-breadcrumb .bc-prefix {
    display: none;
  }

  body.detail-dock-tight #postDetail .post-detail-top-nav.is-header-docked button {
    padding: 0 11px;
    font-size: 12.5px;
  }

  body.detail-dock-compact-bc #postDetail .post-detail-top-nav.is-header-docked .post-detail-breadcrumb {
    display: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    #postDetail .post-detail-top-nav.is-header-docked {
      transition:
        opacity 0.22s ease,
        transform 0.44s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.28s ease-out,
        background 0.24s ease,
        border-color 0.24s ease;
      transition:
        opacity 0.22s ease,
        transform 0.44s linear(0, 0.24, 0.68, 0.96, 1.03, 1.01, 0.997, 1),
        width 0.28s ease-out,
        background 0.24s ease,
        border-color 0.24s ease;
      animation: detailDockPop 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    }
  }
}

/* Mobile Sticky Full-Pill Post Detail Top Bar */
@media (max-width: 800px),
(max-height: 520px) {
  #postDetail .post-detail-top-nav-slot {
    margin-bottom: 12px;
  }

  #postDetail .post-detail-top-nav {
    position: sticky;
    top: calc(70px + env(safe-area-inset-top, 0px));
    height: 44px;
    min-height: 44px;
    padding: 4px 5px !important;
    z-index: 500;
  }

  #postDetail .post-detail-breadcrumb {
    display: none;
  }

  #postDetail .post-detail-top-nav button,
  #postDetail .back-to-forum-btn,
  #postDetail .post-detail-share-btn,
  #postDetail .post-detail-save-btn {
    height: 34px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  #postDetail .post-detail-card {
    border-radius: 16px;
  }

  #postDetail .post-detail-pinned-reply {
    padding: 6px 8px;
  }
}

@keyframes detailDockPop {
  0% {
    opacity: 0;
    transform: translate3d(-50%, -12px, 0) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translate3d(-50%, 0, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {

  #postDetail .post-detail-top-nav,
  #postDetail .post-detail-top-nav.is-header-docked,
  #postDetail .post-detail-top-nav button,
  #postDetail .post-detail-pinned-reply {
    animation: none !important;
    transition-property: opacity, color, background-color, border-color;
    transition-duration: 0.14s;
  }

  #postDetail .post-detail-top-nav button:hover,
  #postDetail .post-detail-top-nav button:active {
    transform: none !important;
  }
}

/* Keep initial hash fragment routes (#home, etc.) clear of the sticky mobile header */
@media (max-width: 800px),
(max-height: 520px) {
  html {
    scroll-padding-top: 84px;
  }

  .page {
    scroll-margin-top: 84px;
  }
}

/* ==========================================================================
   PASSWORD SHOW/HIDE VISIBILITY TOGGLE FEATURE
   ========================================================================== */
.password-input-wrap {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}

.password-input-wrap input {
  width: 100% !important;
  padding-right: 42px !important;
}

.password-toggle-btn {
  position: absolute !important;
  right: 6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  color: var(--muted, #64748b) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: color 0.18s ease, background 0.18s ease !important;
  z-index: 5 !important;
}

.password-toggle-btn:hover {
  color: var(--ink, #123d30) !important;
  background: rgba(0, 0, 0, 0.05) !important;
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--primary, #123d30) !important;
  outline-offset: 1px !important;
}

body.dark-theme .password-toggle-btn {
  color: #94a3b8 !important;
}

body.dark-theme .password-toggle-btn:hover {
  color: #f1f5f9 !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ==========================================================================
   POST DETAIL VIEW: DESKTOP HEADER ELEVATION ABOVE CHRISTMAS DECORATIONS & MOBILE NAV SUPPRESSION
   ========================================================================== */
body.page-post-detail main,
main:has(#postDetail.active-page) {
  position: static !important;
  z-index: auto !important;
}

body.page-post-detail #postDetail,
#postDetail.active-page {
  position: static !important;
  z-index: auto !important;
}

body.page-post-detail .post-detail-container,
#postDetail.active-page .post-detail-container {
  position: relative !important;
  z-index: 10 !important;
}

/* Desktop & Mobile: Thanh điều hướng bài đăng (Quay lại, Link, Lưu) luôn nổi trên cùng, không bị che bởi đèn */
body.page-post-detail #postDetail .post-detail-top-nav,
#postDetail.active-page .post-detail-top-nav {
  z-index: 2500 !important;
}

/* Desktop: Thanh điều hướng ở trạng thái chưa dock hoặc dock đều đưa lên đầu trên cùng */
@media (min-width: 801px) and (min-height: 521px) {
  #postDetail.post-detail-page {
    padding-top: 18px !important;
  }

  body.page-post-detail #postDetail .post-detail-top-nav:not(.is-header-docked),
  #postDetail.active-page .post-detail-top-nav:not(.is-header-docked) {
    position: relative !important;
    z-index: 2500 !important;
  }

  body.page-post-detail #postDetail .post-detail-top-nav.is-header-docked,
  #postDetail.active-page .post-detail-top-nav.is-header-docked {
    position: fixed !important;
    top: 70px !important;
    left: 50% !important;
    transform: translate3d(-50%, 0, 0) scale(1) !important;
    width: min(740px, calc(100vw - 44px)) !important;
    max-width: calc(100vw - 44px) !important;
    z-index: 1001 !important;
  }
}

/* Ẩn hoàn toàn dải đèn garland khi đang xem bài viết để dải nút Quay lại, Link & Lưu sáng rõ */
body.page-post-detail #christmasHeaderGarland,
body:has(#postDetail.active-page) #christmasHeaderGarland,
body.christmas-season.page-post-detail header#siteHeader .christmas-header-garland,
body.christmas-season:not(.christmas-effects-off).page-post-detail header#siteHeader .christmas-header-garland,
body.page-post-detail header#siteHeader .christmas-header-garland,
body:has(#postDetail.active-page) header#siteHeader .christmas-header-garland,
body.page-post-detail .christmas-header-garland,
body:has(#postDetail.active-page) .christmas-header-garland {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Mobile Post Detail:
   1. Thanh điều hướng (Quay lại, Share, Lưu) bo tròn hoàn toàn dạng capsule, khớp 100% chiều rộng với container bài đăng
   2. Nằm ngay trên card với khoảng cách 12px tự nhiên, không đè tiêu đề và không bị hở khoảng trống lớn
   3. Sticky mượt mà ngay dưới header khi cuộn xuống */
@media (max-width: 800px),
(max-height: 520px) {
  #postDetail.post-detail-page {
    padding: 10px 16px 120px !important;
  }

  #postDetail .post-detail-container {
    padding: 0 0 40px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }

  #postDetail .post-detail-top-nav-slot {
    display: block !important;
    width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    margin-top: 0 !important;
    margin-bottom: 18px !important;
  }

  #postDetail .post-detail-top-nav,
  #postDetail .post-detail-top-nav.top-nav-hidden {
    position: fixed !important;
    top: calc(64px + env(safe-area-inset-top, 0px) + 8px) !important;
    left: 20px !important;
    right: 20px !important;
    width: calc(100% - 40px) !important;
    max-width: calc(100% - 40px) !important;
    height: 44px !important;
    min-height: 44px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 4px 8px !important;
    border-radius: 9999px !important;
    box-sizing: border-box !important;
    background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.95)) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08) !important;
    z-index: 990 !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: flex !important;
  }

  #postDetail .post-detail-card {
    margin-top: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 18px !important;
  }
}

/* Mobile: Trong giao diện xem bài đăng, thanh điều hướng đáy và nút fab ẩn đi */
body.page-post-detail .mobile-nav,
body.page-post-detail .mobile-fab,
body:has(#postDetail.active-page) .mobile-nav,
body:has(#postDetail.active-page) .mobile-fab {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(120%) !important;
}

/* ==========================================================================
   CHRISTMAS TREE STUDIO FULLSCREEN OVERRIDES (MOBILE & DESKTOP)
   ========================================================================== */
html.tree-stage-fullscreen body #siteHeader,
html.tree-stage-fullscreen body .site-header,
html.tree-stage-fullscreen body .brand,
html.tree-stage-fullscreen body .header-actions,
html.tree-stage-fullscreen body .mobile-nav,
html.tree-stage-fullscreen body .mobile-fab,
html.tree-stage-fullscreen body .christmas-floating-widget,
html.tree-stage-fullscreen body #floatingMusicPlayer,
body.tree-stage-fullscreen #siteHeader,
body.tree-stage-fullscreen .site-header,
body.tree-stage-fullscreen .brand,
body.tree-stage-fullscreen .header-actions,
body.tree-stage-fullscreen .mobile-nav,
body.tree-stage-fullscreen .mobile-fab,
body.tree-stage-fullscreen .christmas-floating-widget,
body.tree-stage-fullscreen #floatingMusicPlayer {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -9999 !important;
}

#christmasTreePage.is-stage-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000000 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Đồng nhất kích cỡ cây thông ở Mobile */
@media (max-width: 860px) {
  #christmasTreePage:not(.is-stage-fullscreen) .xmas-tree-card-stage {
    height: 380px !important;
    min-height: 380px !important;
    max-height: 380px !important;
    flex: none !important;
  }

  #christmasTreePage:not(.is-stage-fullscreen) .xmas-tree-stage-body {
    height: 334px !important;
    min-height: 334px !important;
    max-height: 334px !important;
  }

  #christmasTreePage.is-stage-fullscreen .xmas-tree-card-stage {
    height: 100dvh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }

  #christmasTreePage.is-stage-fullscreen .xmas-tree-stage-body {
    height: calc(100dvh - 54px) !important;
    min-height: calc(100dvh - 54px) !important;
    max-height: calc(100dvh - 54px) !important;
  }
}

/* ==========================================================================
   MOBILE FAB 4-SQUARE GRID ICON & SPEED-DIAL ACTION MENU
   ========================================================================== */
/* Ẩn widget 3 nút nhạc/tuyết/cây thông riêng biệt trên toàn bộ web (thay bằng menu thao tác nhanh) */
.christmas-floating-widget {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

/* Mobile FAB: Chứa 4 ô vuông với animation xoay 45 độ mỗi 3 giây */
.mobile-fab-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-fab.is-active .mobile-fab-icon-wrap {
  transform: rotate(45deg);
}

.fab-sq {
  transform-origin: center;
  transform-box: fill-box;
  transition: transform 0.3s ease;
}

/* Hiệu ứng xoay 45 độ mỗi 3 giây:
   Nghỉ 3.0s ở 0deg -> Xoay mượt 0.4s sang 45deg -> Nghỉ 3.0s ở 45deg -> Xoay mượt 0.4s về 0deg (Tổng chu kỳ 6.8s) */
@keyframes fabSqRotatePulse {

  0%,
  44% {
    transform: rotate(0deg);
  }

  50%,
  94% {
    transform: rotate(45deg);
  }

  100% {
    transform: rotate(0deg);
  }
}

.mobile-fab:not(.is-active) .fab-sq-1 {
  animation: fabSqRotatePulse 6.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Khi menu mở ra, dừng hoạt ảnh xoay idle */
.mobile-fab.is-active .fab-sq {
  animation: none !important;
}

/* 4 Cục vuông có sọc đỏ/trắng kẹo Giáng sinh (Candy Cane Stripes) khi bật Giáng sinh */
body.christmas-season:not(.christmas-effects-off) .mobile-fab .fab-sq,
html.christmas-season:not(.christmas-effects-off) .mobile-fab .fab-sq {
  fill: url(#fabCandyCanePattern) !important;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.5px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

/* ==========================================================================
   MÀU SẮC MENU THAO TÁC NHANH THEO THEME (DEFAULT XANH LÁ, RUBY ĐỎ, MYTHIC TÍM ĐỎ)
   ========================================================================== */

/* 1. Mặc định (Default: Xanh lá) */
.mobile-fab {
  background: linear-gradient(135deg, #123d30 0%, #1a5743 100%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.35) !important;
  box-shadow: 0 10px 28px rgba(18, 61, 48, 0.32), 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.24s ease, background 0.3s ease !important;
}

.mobile-fab:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 14px 34px rgba(18, 61, 48, 0.44) !important;
}

/* 2. Đổi theo chuỗi: Đỏ (Ruby / Chuỗi 30) */
[data-user-theme="ruby"] .mobile-fab,
body[data-user-theme="ruby"] .mobile-fab,
html[data-user-theme="ruby"] .mobile-fab {
  background: linear-gradient(135deg, #a61e32 0%, #c92a2a 50%, #e03131 100%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
  box-shadow: 0 10px 28px rgba(201, 42, 42, 0.38), 0 2px 8px rgba(166, 30, 50, 0.2) !important;
}

[data-user-theme="ruby"] .mobile-fab:hover,
body[data-user-theme="ruby"] .mobile-fab:hover,
html[data-user-theme="ruby"] .mobile-fab:hover {
  box-shadow: 0 14px 34px rgba(201, 42, 42, 0.52) !important;
}

/* 3. Đổi theo chuỗi: Tím đỏ (Mythic / Chuỗi 50) */
[data-user-theme="mythic"] .mobile-fab,
body[data-user-theme="mythic"] .mobile-fab,
html[data-user-theme="mythic"] .mobile-fab {
  background: linear-gradient(135deg, #5f3dc4 0%, #9c1c68 50%, #d6336c 100%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.45) !important;
  box-shadow: 0 10px 28px rgba(112, 72, 232, 0.42), 0 2px 10px rgba(214, 51, 108, 0.3) !important;
}

[data-user-theme="mythic"] .mobile-fab:hover,
body[data-user-theme="mythic"] .mobile-fab:hover,
html[data-user-theme="mythic"] .mobile-fab:hover {
  box-shadow: 0 14px 34px rgba(112, 72, 232, 0.55), 0 4px 14px rgba(214, 51, 108, 0.4) !important;
}

/* Tùy biến bảng menu thao tác nhanh theo Theme Đỏ (Ruby) */
[data-user-theme="ruby"] .mobile-fab-menu-sheet {
  border-color: rgba(201, 42, 42, 0.18) !important;
  box-shadow: 0 24px 60px rgba(166, 30, 50, 0.22), 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

[data-user-theme="ruby"] .mobile-fab-menu-eyebrow {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .mobile-fab-action-btn:hover {
  background: rgba(201, 42, 42, 0.08) !important;
  border-color: rgba(201, 42, 42, 0.22) !important;
}

[data-user-theme="ruby"] .mobile-fab-action-btn:hover .mobile-fab-action-name {
  color: #c92a2a !important;
}

[data-user-theme="ruby"] .mobile-fab-sub-pill.is-active {
  background: rgba(201, 42, 42, 0.08) !important;
  border-color: rgba(201, 42, 42, 0.32) !important;
}

[data-user-theme="ruby"] .mobile-fab-sub-pill.is-active:hover {
  background: rgba(201, 42, 42, 0.14) !important;
}

[data-user-theme="ruby"] .mobile-fab-sub-pill .theme-toggle-switch.active {
  background: #c92a2a !important;
}

[data-user-theme="ruby"] .mobile-fab-sub-pill .theme-switch-slider {
  background: transparent !important;
}

[data-user-theme="ruby"] .mobile-fab-sub-pill:hover .sub-pill-arrow {
  color: #c92a2a !important;
}

/* Tùy biến bảng menu thao tác nhanh theo Theme Tím đỏ (Mythic) */
[data-user-theme="mythic"] .mobile-fab-menu-sheet {
  border-color: rgba(156, 28, 104, 0.22) !important;
  box-shadow: 0 24px 60px rgba(95, 61, 196, 0.24), 0 4px 16px rgba(0, 0, 0, 0.06) !important;
}

[data-user-theme="mythic"] .mobile-fab-menu-eyebrow {
  color: #9c1c68 !important;
}

[data-user-theme="mythic"] .mobile-fab-action-btn:hover {
  background: rgba(112, 72, 232, 0.08) !important;
  border-color: rgba(112, 72, 232, 0.25) !important;
}

[data-user-theme="mythic"] .mobile-fab-action-btn:hover .mobile-fab-action-name {
  color: #7048e8 !important;
}

[data-user-theme="mythic"] .mobile-fab-sub-pill.is-active {
  background: rgba(156, 28, 104, 0.1) !important;
  border-color: rgba(214, 51, 108, 0.35) !important;
}

[data-user-theme="mythic"] .mobile-fab-sub-pill.is-active:hover {
  background: rgba(156, 28, 104, 0.16) !important;
}

[data-user-theme="mythic"] .mobile-fab-sub-pill .theme-toggle-switch.active {
  background: linear-gradient(135deg, #7048e8, #d6336c) !important;
}

[data-user-theme="mythic"] .mobile-fab-sub-pill .theme-switch-slider {
  background: transparent !important;
}

[data-user-theme="mythic"] .mobile-fab-sub-pill:hover .sub-pill-arrow {
  color: #9c1c68 !important;
}

/* Rose Quartz Mobile FAB & Sheet */
[data-user-theme="rosequartz"] .mobile-fab,
body[data-user-theme="rosequartz"] .mobile-fab,
html[data-user-theme="rosequartz"] .mobile-fab {
  background: linear-gradient(135deg, #57223b 0%, #8a3157 50%, #c45b83 100%) !important;
  box-shadow: 0 10px 28px rgba(138, 49, 87, 0.4) !important;
}
[data-user-theme="rosequartz"] .mobile-fab-menu-sheet {
  border-color: rgba(138, 49, 87, 0.2) !important;
}
[data-user-theme="rosequartz"] .mobile-fab-menu-eyebrow {
  color: #8a3157 !important;
}
[data-user-theme="rosequartz"] .mobile-fab-action-btn:hover {
  background: rgba(138, 49, 87, 0.08) !important;
}
[data-user-theme="rosequartz"] .mobile-fab-action-btn:hover .mobile-fab-action-name {
  color: #8a3157 !important;
}
[data-user-theme="rosequartz"] .mobile-fab-sub-pill.is-active {
  background: rgba(138, 49, 87, 0.08) !important;
  border-color: rgba(138, 49, 87, 0.3) !important;
}
[data-user-theme="rosequartz"] .mobile-fab-sub-pill .theme-toggle-switch.active {
  background: #8a3157 !important;
}

/* Super Neon Mobile FAB & Sheet */
[data-user-theme="super"] .mobile-fab,
body[data-user-theme="super"] .mobile-fab,
html[data-user-theme="super"] .mobile-fab {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 50%, #6366f1 100%) !important;
  box-shadow: 0 10px 28px rgba(0, 206, 201, 0.45) !important;
}
[data-user-theme="super"] .mobile-fab-menu-sheet {
  border-color: rgba(0, 206, 201, 0.25) !important;
}
[data-user-theme="super"] .mobile-fab-menu-eyebrow {
  color: #00b894 !important;
}
[data-user-theme="super"] .mobile-fab-action-btn:hover {
  background: rgba(0, 206, 201, 0.1) !important;
}
[data-user-theme="super"] .mobile-fab-action-btn:hover .mobile-fab-action-name {
  color: #00897b !important;
}
[data-user-theme="super"] .mobile-fab-sub-pill.is-active {
  background: rgba(0, 206, 201, 0.1) !important;
  border-color: rgba(0, 184, 148, 0.35) !important;
}
[data-user-theme="super"] .mobile-fab-sub-pill .theme-toggle-switch.active {
  background: linear-gradient(135deg, #00b894, #00cec9) !important;
}

/* Diamond Celestial Mobile FAB & Sheet */
[data-user-theme="diamond"] .mobile-fab,
body[data-user-theme="diamond"] .mobile-fab,
html[data-user-theme="diamond"] .mobile-fab {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.4) !important;
}
[data-user-theme="diamond"] .mobile-fab-menu-sheet {
  border-color: rgba(15, 23, 42, 0.22) !important;
}
[data-user-theme="diamond"] .mobile-fab-menu-eyebrow {
  color: #0f172a !important;
}
[data-user-theme="diamond"] .mobile-fab-action-btn:hover {
  background: rgba(15, 23, 42, 0.08) !important;
}
[data-user-theme="diamond"] .mobile-fab-action-btn:hover .mobile-fab-action-name {
  color: #0f172a !important;
}
[data-user-theme="diamond"] .mobile-fab-sub-pill.is-active {
  background: rgba(15, 23, 42, 0.08) !important;
  border-color: rgba(15, 23, 42, 0.3) !important;
}
[data-user-theme="diamond"] .mobile-fab-sub-pill .theme-toggle-switch.active {
  background: #0f172a !important;
}

/* Dark theme overrides cho Ruby và Mythic FAB sheet */
[data-user-theme="ruby"] body.dark-theme .mobile-fab-menu-sheet {
  border-color: rgba(201, 42, 42, 0.3) !important;
}

[data-user-theme="ruby"] body.dark-theme .mobile-fab-action-btn:hover {
  background: rgba(201, 42, 42, 0.18) !important;
}

[data-user-theme="ruby"] body.dark-theme .mobile-fab-sub-pill.is-active {
  background: rgba(201, 42, 42, 0.2) !important;
  border-color: rgba(201, 42, 42, 0.45) !important;
}

[data-user-theme="mythic"] body.dark-theme .mobile-fab-menu-sheet {
  border-color: rgba(214, 51, 108, 0.35) !important;
}

[data-user-theme="mythic"] body.dark-theme .mobile-fab-action-btn:hover {
  background: rgba(112, 72, 232, 0.2) !important;
}

[data-user-theme="mythic"] body.dark-theme .mobile-fab-sub-pill.is-active {
  background: rgba(156, 28, 104, 0.22) !important;
  border-color: rgba(214, 51, 108, 0.45) !important;
}

/* Mobile & Desktop FAB Speed Dial Menu Sheet (Góc dưới bên phải, không mờ nền, nảy bậc thang) */
.mobile-fab-menu {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: auto;
}

.mobile-fab-menu[hidden] {
  display: none !important;
}

.mobile-fab-menu-backdrop {
  position: fixed;
  inset: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: auto;
}

.mobile-fab-menu-sheet {
  position: fixed;
  right: 28px;
  left: auto;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  width: min(340px, calc(100vw - 40px));
  background: var(--glass-bg-elevated, rgba(255, 255, 255, 0.94));
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.65));
  box-shadow:
    0 24px 50px -10px rgba(18, 61, 48, 0.22),
    0 10px 24px -5px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  border-radius: 24px;
  padding: 16px;
  transform-origin: bottom right;
  animation: fabSheetSpringIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: hidden;
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
}

@media (max-width: 800px) {
  .mobile-fab-menu-sheet {
    left: auto;
    right: 16px;
    bottom: calc(146px + env(safe-area-inset-bottom, 0px));
    width: min(340px, calc(100vw - 32px));
    max-height: calc(100dvh - 180px);
  }
}

body.dark-theme .mobile-fab-menu-sheet {
  background: rgba(17, 24, 39, 0.94);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 56px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Hiệu ứng nảy bậc thang (cascade / stagger entrance) cho từng mục trong menu */
.mobile-fab-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  animation: fabItemStaggerIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) 0.03s both;
}

.mobile-fab-menu-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
}

.mobile-fab-menu-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.mobile-fab-menu-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.mobile-fab-menu-close:hover {
  background: rgba(0, 0, 0, 0.1);
  transform: scale(1.08);
}

body.dark-theme .mobile-fab-menu-close {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .mobile-fab-menu-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-fab-menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Từng tầng hành động nảy ra kiểu bậc thang */
.mobile-fab-menu-list>.mobile-fab-action-btn:nth-child(1) {
  animation: fabItemStaggerIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) 0.06s both;
}

.mobile-fab-menu-list>.mobile-fab-action-btn:nth-child(2) {
  animation: fabItemStaggerIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) 0.11s both;
}

.mobile-fab-menu-list>.mobile-fab-accordion-group {
  animation: fabItemStaggerIn 0.40s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

.mobile-fab-menu-list>.mobile-fab-action-btn:last-child {
  animation: fabItemStaggerIn 0.42s cubic-bezier(0.16, 1, 0.3, 1) 0.21s both;
}

.mobile-fab-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.18s ease, border-color 0.18s ease, box-shadow 0.2s ease;
}

body.dark-theme .mobile-fab-action-btn {
  background: rgba(255, 255, 255, 0.04);
}

.mobile-fab-action-btn:hover {
  background: rgba(18, 61, 48, 0.08);
  border-color: rgba(18, 61, 48, 0.18);
  transform: translateX(-4px) scale(1.015);
  box-shadow: 0 4px 14px rgba(18, 61, 48, 0.09);
}

body.dark-theme .mobile-fab-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.mobile-fab-action-btn:active {
  transform: translateX(-2px) scale(0.985);
}

.mobile-fab-action-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.fab-icon-post {
  background: #ecfdf5;
  color: #059669;
}

.fab-icon-doc {
  background: #eff6ff;
  color: #2563eb;
}

.fab-icon-xmas {
  background: #fef2f2;
}

.fab-icon-contest {
  background: #fefce8;
  color: #ca8a04;
}

body.dark-theme .fab-icon-post {
  background: rgba(5, 150, 105, 0.2);
}

body.dark-theme .fab-icon-doc {
  background: rgba(37, 99, 235, 0.2);
}

body.dark-theme .fab-icon-xmas {
  background: rgba(220, 38, 38, 0.2);
}

body.dark-theme .fab-icon-contest {
  background: rgba(202, 138, 4, 0.2);
}

.mobile-fab-action-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-fab-action-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

.mobile-fab-action-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.mobile-fab-arrow {
  color: var(--muted);
  transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-fab-action-btn[aria-expanded="true"] .mobile-fab-arrow {
  transform: rotate(180deg);
}

.mobile-fab-sub-tray {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(220, 38, 38, 0.05);
  border: 1px dashed rgba(220, 38, 38, 0.25);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fabTrayExpand 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.mobile-fab-sub-tray[hidden] {
  display: none !important;
}

.mobile-fab-sub-pill {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--surface, #ffffff);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.sub-pill-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.sub-pill-left .sub-icon {
  font-size: 15px;
  line-height: 1;
}

.sub-pill-left .sub-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-fab-sub-pill .theme-toggle-switch {
  flex-shrink: 0;
  pointer-events: none;
  transform: scale(0.85);
  transform-origin: right center;
  margin: 0;
  overflow: hidden;
}

#mobileFabContestCountdown {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.edit-timer-btn.is-privileged-edit {
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.edit-timer-btn.is-privileged-edit:hover {
  background: var(--sage-2, rgba(0, 0, 0, 0.06));
  opacity: 1 !important;
  transform: scale(1.08);
}

.edit-doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.edit-doc-btn:hover {
  opacity: 1 !important;
  background: var(--sage-2, rgba(0, 0, 0, 0.06));
  transform: scale(1.08);
}

.mobile-fab-sub-pill.is-active {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.3);
}

.mobile-fab-sub-pill:hover {
  background: rgba(18, 61, 48, 0.06);
  border-color: rgba(18, 61, 48, 0.2);
  transform: translateX(-2px);
}

.mobile-fab-sub-pill.is-active:hover {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.4);
}

body.dark-theme .mobile-fab-sub-pill {
  background: #1f2937;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f3f4f6;
}

body.dark-theme .mobile-fab-sub-pill .sub-pill-left .sub-label {
  color: #f3f4f6;
}

body.dark-theme .mobile-fab-sub-pill.is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.35);
}

body.dark-theme .mobile-fab-sub-pill:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .mobile-fab-sub-pill.is-active:hover {
  background: rgba(16, 185, 129, 0.22);
}

.sub-pill-arrow {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: transform 0.18s ease;
}

.mobile-fab-sub-pill:hover .sub-pill-arrow {
  transform: translateX(3px);
  color: var(--primary);
}

@keyframes fabSheetSpringIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(24px);
  }

  68% {
    opacity: 1;
    transform: scale(1.025) translateY(-3px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fabItemStaggerIn {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }

  62% {
    opacity: 1;
    transform: translateY(-2px) scale(1.015);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fabTrayExpand {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================================================
   PERFORMANCE LAG WARNING MODAL (CHRISTMAS THEME)
   ========================================================================== */
.xmas-lag-warning-modal,
dialog.modal.xmas-lag-warning-modal {
  width: min(440px, calc(100vw - 32px)) !important;
  border-radius: 20px !important;
  padding: 0 !important;
  background: var(--surface, #ffffff) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
  overflow: hidden;
}

.xmas-lag-card {
  padding: 24px 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.xmas-lag-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fef3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.xmas-lag-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.xmas-lag-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.xmas-lag-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.xmas-lag-turnoff-btn {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  border-color: #b45309 !important;
  color: #ffffff !important;
  font-weight: 600;
}

/* ==========================================================================
   THEME CUSTOMIZER MODAL & NAVBAR STYLE SWITCHER
   ========================================================================== */
.theme-customizer-modal,
dialog.modal.theme-customizer-modal {
  width: min(640px, calc(100vw - 32px)) !important;
  max-width: 640px !important;
  height: auto !important;
  max-height: min(88vh, 720px) !important;
  border-radius: 22px !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25) !important;
}

.theme-customizer-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 720px);
}

.theme-customizer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.theme-customizer-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
}

.theme-customizer-title {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.theme-customizer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-theme .theme-customizer-close {
  background: rgba(255, 255, 255, 0.1);
}

.theme-customizer-body {
  padding: 20px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.theme-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.theme-section-subtitle {
  margin: 3px 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.theme-options-grid,
.theme-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#themeColorOptionsGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 580px) {

  .theme-options-grid,
  .theme-nav-grid,
  #themeColorOptionsGrid {
    grid-template-columns: 1fr !important;
  }
}

.theme-card,
.theme-nav-card {
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  background: rgba(0, 0, 0, 0.015);
  transition: all 0.2s ease;
}

.theme-card:hover:not(.is-locked),
.theme-nav-card:hover {
  border-color: var(--primary, #123d30);
  background: rgba(18, 61, 48, 0.03);
  transform: translateY(-2px);
}

.theme-card.active,
.theme-nav-card.active {
  border-color: var(--primary, #123d30);
  background: rgba(18, 61, 48, 0.05);
  box-shadow: 0 4px 14px rgba(18, 61, 48, 0.12);
}

body.dark-theme .theme-card,
body.dark-theme .theme-nav-card {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .theme-card:hover:not(.is-locked),
body.dark-theme .theme-nav-card:hover {
  border-color: var(--primary, #34d399) !important;
  background: rgba(52, 211, 153, 0.08) !important;
}

body.dark-theme .theme-card.active,
body.dark-theme .theme-nav-card.active {
  border-color: var(--primary, #34d399) !important;
  background: rgba(52, 211, 153, 0.12) !important;
  box-shadow: 0 4px 14px rgba(52, 211, 153, 0.18) !important;
}

body.dark-theme .theme-card-status-badge {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8 !important;
}

body.dark-theme .theme-card.active .theme-card-status-badge,
body.dark-theme .theme-nav-card.active .theme-card-status-badge {
  background: var(--primary, #34d399) !important;
  color: #042f2e !important;
  font-weight: 700 !important;
}

.theme-card.is-locked {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.theme-demo-preview {
  height: 70px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.preview-emerald {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.preview-ruby {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
}

.preview-rosequartz {
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 50%, #fbcfe8 100%);
}

.preview-mythic {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

.preview-super {
  background: linear-gradient(135deg, #0b0d28 0%, #15133c 50%, #201358 100%);
}

.preview-diamond {
  background: linear-gradient(135deg, #080b11 0%, #111827 50%, #1e293b 100%);
}

.preview-christmas {
  background: linear-gradient(135deg, #f0fdf4 0%, #fee2e2 100%);
}

.demo-mock-bar {
  height: 18px;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mock-xmas-garland {
  background: repeating-linear-gradient(90deg, #15803d 0px, #dc2626 12px, #15803d 24px);
}

.demo-mock-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
}

.mock-line {
  width: 50px;
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.1);
}

.mock-btn {
  width: 28px;
  height: 16px;
  border-radius: 8px;
}

.mock-btn-emerald {
  background: #059669;
}

.mock-btn-ruby {
  background: #dc2626;
}

.mock-btn-rosequartz {
  background: linear-gradient(135deg, #8a3157 0%, #c45b83 100%);
}

.mock-btn-mythic {
  background: #9333ea;
}

.mock-btn-super {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%);
}

.mock-btn-diamond {
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #94a3b8 100%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
}

.mock-btn-xmas {
  font-size: 13px;
  line-height: 16px;
  text-align: center;
}

.theme-lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(0, 0, 0, 0.25);
}

/* Nav Previews */
.preview-nav-classic {
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.nav-demo-band {
  width: 100%;
  height: 28px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.nav-demo-logo {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #059669;
}

.nav-demo-links {
  width: 44px;
  height: 6px;
  border-radius: 3px;
  background: #94a3b8;
}

.nav-demo-avatar {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f59e0b;
}

.preview-nav-glass {
  background: linear-gradient(135deg, #e0f2fe 0%, #f0fdf4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.nav-demo-island {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-demo-pill {
  height: 22px;
  width: 22px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.nav-demo-pill.wide {
  width: 65px;
}

.theme-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.theme-card-tier {
  font-size: 11px;
  color: var(--muted);
}

.theme-card-tier.tier-limited {
  color: #dc2626;
  font-weight: 600;
}

.theme-card-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
}

.theme-card.active .theme-card-status-badge,
.theme-nav-card.active .theme-card-status-badge {
  background: var(--primary, #123d30);
  color: #ffffff;
}

/* Tuỳ biến thanh Navigation Bar chỉ hiển thị trên máy tính (Desktop) */
@media (max-width: 800px) {
  #themeNavSection {
    display: none !important;
  }
}

/* Nav style classic overrides - Restores authentic pre-glass RE:SEARCH header on desktop matching original reference */
@media (min-width: 801px) and (min-height: 521px) {

  html.nav-style-classic {
    scroll-padding-top: 76px !important;
  }

  html.nav-style-classic:not(.tree-stage-fullscreen) main,
  body.nav-style-classic:not(.study-zen-fullscreen):not(.tree-stage-fullscreen) main {
    padding-top: 68px !important;
  }

  html.nav-style-classic header#siteHeader.site-header,
  body.nav-style-classic header#siteHeader.site-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 68px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 calc(max(36px, (100% - 1280px) / 2 + 36px)) !important;
    box-sizing: border-box !important;
    border: none !important;
    border-bottom: 1px solid var(--line, rgba(0, 0, 0, 0.08)) !important;
    border-radius: 0 !important;
    background: #faf8f5 !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 1px 3px rgba(10, 44, 30, 0.04) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    pointer-events: auto !important;
    cursor: default !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    transform: none !important;
    z-index: 1000 !important;
  }

  html.nav-style-classic header#siteHeader .site-header-inner,
  body.nav-style-classic header#siteHeader .site-header-inner {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    position: relative !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    pointer-events: auto !important;
  }

  html.nav-style-classic header#siteHeader .brand,
  body.nav-style-classic header#siteHeader .brand {
    pointer-events: auto !important;
    flex: 0 0 auto !important;
    height: auto !important;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transform: none !important;
    color: var(--ink, #0f172a) !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
    font-size: 17px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
    cursor: pointer !important;
  }

  html.nav-style-classic header#siteHeader .brand:hover,
  body.nav-style-classic header#siteHeader .brand:hover {
    background: transparent !important;
    transform: none !important;
  }

  html.nav-style-classic header#siteHeader .brand-mark,
  body.nav-style-classic header#siteHeader .brand-mark {
    width: 23px !important;
    height: 23px !important;
    border-radius: 0 !important;
    overflow: visible !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  html.nav-style-classic header#siteHeader .brand-mark img,
  body.nav-style-classic header#siteHeader .brand-mark img {
    width: 23px !important;
    height: 23px !important;
    border-radius: 0 !important;
    object-fit: contain !important;
  }

  html.nav-style-classic header#siteHeader .brand-colon,
  body.nav-style-classic header#siteHeader .brand-colon {
    color: #8faf82 !important;
  }

  html.nav-style-classic header#siteHeader .nav-spacer,
  body.nav-style-classic header#siteHeader .nav-spacer {
    display: none !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav,
  body.nav-style-classic header#siteHeader .desktop-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin-left: clamp(24px, 3.5vw, 44px) !important;
    margin-right: auto !important;
    padding: 0 !important;
    height: auto !important;
    width: auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    pointer-events: auto !important;
    z-index: 10 !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-shell,
  body.nav-style-classic header#siteHeader .desktop-nav-shell {
    position: static !important;
    transform: none !important;
    height: auto !important;
    width: auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: auto !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-shell::before,
  html.nav-style-classic header#siteHeader .desktop-nav-shell::after,
  html.nav-style-classic header#siteHeader .nav-active-glider,
  html.nav-style-classic header#siteHeader .desktop-nav-compact-trigger,
  html.nav-style-classic header#siteHeader .compact-nav-popover,
  body.nav-style-classic header#siteHeader .desktop-nav-shell::before,
  body.nav-style-classic header#siteHeader .desktop-nav-shell::after,
  body.nav-style-classic header#siteHeader .nav-active-glider,
  body.nav-style-classic header#siteHeader .desktop-nav-compact-trigger,
  body.nav-style-classic header#siteHeader .compact-nav-popover {
    display: none !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-links,
  body.nav-style-classic header#siteHeader .desktop-nav-links {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    visibility: visible !important;
    height: auto !important;
    width: auto !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-links .nav-link,
  body.nav-style-classic header#siteHeader .desktop-nav-links .nav-link {
    color: #4b5563 !important;
    text-decoration: none !important;
    padding: 6px 14px !important;
    border-radius: 9999px !important;
    border: 1.5px solid transparent !important;
    background: transparent !important;
    font-weight: 500 !important;
    font-size: 13.5px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    box-shadow: none !important;
    height: auto !important;
    transform: none !important;
    transition: all 0.16s ease !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-links .nav-link:hover,
  body.nav-style-classic header#siteHeader .desktop-nav-links .nav-link:hover {
    color: var(--ink, #0f172a) !important;
    background: rgba(0, 0, 0, 0.04) !important;
    border-color: transparent !important;
  }

  /* Active link: Outlined pill with transparent background exactly matching original reference photo */
  html.nav-style-classic header#siteHeader .desktop-nav-links .nav-link.active,
  body.nav-style-classic header#siteHeader .desktop-nav-links .nav-link.active {
    color: var(--primary, #123d30) !important;
    border: 1.5px solid var(--primary, #123d30) !important;
    background: transparent !important;
    border-radius: 9999px !important;
    font-weight: 700 !important;
    padding: 6px 18px !important;
    box-shadow: none !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-links .nav-link-icon,
  body.nav-style-classic header#siteHeader .desktop-nav-links .nav-link-icon {
    display: none !important;
  }

  html.nav-style-classic header#siteHeader .desktop-nav-links .nav-link-text,
  body.nav-style-classic header#siteHeader .desktop-nav-links .nav-link-text {
    display: inline !important;
    opacity: 1 !important;
  }

  html.nav-style-classic header#siteHeader .header-actions,
  body.nav-style-classic header#siteHeader .header-actions {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    pointer-events: auto !important;
    margin-left: auto !important;
  }

  html.nav-style-classic header#siteHeader .desktop-search,
  body.nav-style-classic header#siteHeader .desktop-search {
    width: 38px !important;
    height: 38px !important;
    border: 1px solid transparent !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--ink, #0f172a) !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  html.nav-style-classic header#siteHeader .desktop-search:hover,
  body.nav-style-classic header#siteHeader .desktop-search:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: var(--primary, #123d30) !important;
    transform: none !important;
  }

  html.nav-style-classic header#siteHeader .profile-chip,
  body.nav-style-classic header#siteHeader .profile-chip {
    border: 1px solid var(--line, #e2e8f0) !important;
    background: #ffffff !important;
    padding: 4px 12px 4px 6px !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: none !important;
    height: 38px !important;
    color: var(--ink, #0f172a) !important;
    transform: none !important;
    cursor: pointer !important;
  }

  html.nav-style-classic header#siteHeader .profile-chip:hover,
  body.nav-style-classic header#siteHeader .profile-chip:hover {
    border-color: rgba(18, 61, 48, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    transform: none !important;
  }

  html.nav-style-classic header#siteHeader .profile-chip .avatar,
  body.nav-style-classic header#siteHeader .profile-chip .avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
  }

  html.nav-style-classic header#siteHeader .profile-chip .profile-chip-text,
  body.nav-style-classic header#siteHeader .profile-chip .profile-chip-text {
    width: auto !important;
    opacity: 1 !important;
    margin-left: 0 !important;
    display: inline-flex !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--ink, #0f172a) !important;
    max-width: 240px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  html.nav-style-classic header#siteHeader .profile-chip .profile-chip-text b,
  body.nav-style-classic header#siteHeader .profile-chip .profile-chip-text b {
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 2px 8px !important;
    border-radius: 9999px !important;
    background: var(--sage-2) !important;
    color: var(--primary) !important;
  }

  html.nav-style-classic header#siteHeader .quick-menu-btn,
  body.nav-style-classic header#siteHeader .quick-menu-btn {
    width: 38px !important;
    height: 38px !important;
    border: 1px solid transparent !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--ink, #0f172a) !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  html.nav-style-classic header#siteHeader .quick-menu-btn:hover,
  html.nav-style-classic header#siteHeader .quick-menu-btn.active,
  body.nav-style-classic header#siteHeader .quick-menu-btn:hover,
  body.nav-style-classic header#siteHeader .quick-menu-btn.active {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: var(--line) !important;
    color: var(--primary, #123d30) !important;
    transform: none !important;
  }

  html.nav-style-classic header#siteHeader .quick-menu-dropdown,
  body.nav-style-classic header#siteHeader .quick-menu-dropdown {
    top: calc(100% + 12px) !important;
    right: 0 !important;
  }

  /* Post detail top nav in Classic desktop mode:
     - Trạng thái chưa dock: capsule bo tròn hoàn toàn, nằm tách biệt trên modal bài đăng với khoảng cách chuẩn, không đè tiêu đề
     - Trạng thái dock khi cuộn xuống: tự động nhảy ra thành capsule kính mờ nổi dưới thanh header 64px */
  html.nav-style-classic #postDetail .post-detail-top-nav-slot,
  body.nav-style-classic #postDetail .post-detail-top-nav-slot {
    min-height: 48px !important;
    height: 48px !important;
    margin-bottom: 20px !important;
    display: block !important;
  }

  html.nav-style-classic #postDetail .post-detail-top-nav:not(.is-header-docked),
  body.nav-style-classic #postDetail .post-detail-top-nav:not(.is-header-docked) {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    border-radius: 9999px !important;
    margin-bottom: 0 !important;
    z-index: 90 !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  html.nav-style-classic #postDetail .post-detail-top-nav.is-header-docked,
  body.nav-style-classic #postDetail .post-detail-top-nav.is-header-docked {
    position: fixed !important;
    top: 76px !important;
    left: 50% !important;
    transform: translate3d(-50%, 0, 0) !important;
    width: min(740px, calc(100vw - 120px)) !important;
    max-width: calc(100vw - 44px) !important;
    border-radius: 9999px !important;
    z-index: 2500 !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    transition:
      opacity 0.22s ease,
      transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
      width 0.24s ease-out,
      background 0.24s ease,
      border-color 0.24s ease !important;
  }

  html.nav-style-classic #postDetail .post-detail-top-nav.top-nav-hidden,
  body.nav-style-classic #postDetail .post-detail-top-nav.top-nav-hidden {
    transform: translate3d(-50%, -20px, 0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Dark Theme for Classic Navbar */
  html.dark-theme.nav-style-classic header#siteHeader.site-header,
  body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: #11161b !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .brand,
  body.dark-theme.nav-style-classic header#siteHeader .brand {
    color: #f1f5f9 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .brand-colon,
  body.dark-theme.nav-style-classic header#siteHeader .brand-colon {
    color: #34d399 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link,
  body.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link {
    color: #94a3b8 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link:hover,
  body.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #f1f5f9 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link.active,
  body.dark-theme.nav-style-classic header#siteHeader .desktop-nav-links .nav-link.active {
    border-color: #34d399 !important;
    color: #34d399 !important;
    background: transparent !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .profile-chip,
  body.dark-theme.nav-style-classic header#siteHeader .profile-chip {
    background: #1e293b !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f1f5f9 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .profile-chip .profile-chip-text b,
  body.dark-theme.nav-style-classic header#siteHeader .profile-chip .profile-chip-text b {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #34d399 !important;
  }

  html.dark-theme.nav-style-classic header#siteHeader .desktop-search,
  html.dark-theme.nav-style-classic header#siteHeader .quick-menu-btn,
  body.dark-theme.nav-style-classic header#siteHeader .desktop-search,
  body.dark-theme.nav-style-classic header#siteHeader .quick-menu-btn {
    color: #94a3b8 !important;
  }

  [data-user-theme="ruby"] html.dark-theme.nav-style-classic header#siteHeader.site-header,
  [data-user-theme="ruby"] body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: rgba(21, 13, 16, 0.95) !important;
    border-bottom-color: rgba(251, 113, 133, 0.2) !important;
  }

  [data-user-theme="mythic"] html.dark-theme.nav-style-classic header#siteHeader.site-header,
  [data-user-theme="mythic"] body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: rgba(17, 13, 25, 0.95) !important;
    border-bottom-color: rgba(192, 132, 252, 0.2) !important;
  }

  [data-user-theme="rosequartz"] html.dark-theme.nav-style-classic header#siteHeader.site-header,
  [data-user-theme="rosequartz"] body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: rgba(25, 7, 16, 0.95) !important;
    border-bottom-color: rgba(244, 114, 182, 0.28) !important;
  }

  [data-user-theme="super"] html.dark-theme.nav-style-classic header#siteHeader.site-header,
  [data-user-theme="super"] body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: rgba(11, 13, 40, 0.95) !important;
    border-bottom-color: rgba(0, 210, 255, 0.3) !important;
  }

  [data-user-theme="diamond"] html.dark-theme.nav-style-classic header#siteHeader.site-header,
  [data-user-theme="diamond"] body.dark-theme.nav-style-classic header#siteHeader.site-header {
    background: rgba(8, 11, 17, 0.95) !important;
    border-bottom-color: rgba(255, 255, 255, 0.2) !important;
  }
}

/* Theme Confirm Modal */
.theme-confirm-modal,
dialog.modal.theme-confirm-modal {
  width: min(400px, calc(100vw - 32px)) !important;
  border-radius: 20px !important;
  padding: 24px 22px !important;
  text-align: center;
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
}

.theme-confirm-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.theme-confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-soft, #ecfdf5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.theme-confirm-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.theme-confirm-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}

.theme-confirm-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.theme-confirm-actions .button {
  flex: 1;
}

/* ==========================================================================
   NAMECARD STUDIO: DESKTOP CLEANUP & 2-LINE COVER UPLOAD BUTTON
   ========================================================================== */
/* Nút Đóng 'x' nằm ở góc trên bên phải toàn bộ khung modal */
.studio-modal-close-btn {
  position: absolute !important;
  top: 16px !important;
  right: 20px !important;
  z-index: 50 !important;
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1)) !important;
  background: var(--paper, rgba(255, 255, 255, 0.92)) !important;
  color: var(--ink) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
  transition: all 0.18s ease !important;
}

.studio-modal-close-btn:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
  transform: scale(1.06) !important;
}

body.dark-theme .studio-modal-close-btn {
  background: rgba(30, 41, 59, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
}

body.dark-theme .studio-modal-close-btn:hover {
  background: rgba(220, 38, 38, 0.25) !important;
  color: #f87171 !important;
}

/* Căn giữa demo namecard theo chiều dọc và tối ưu diện tích trống desktop */
@media (min-width: 861px) {

  .namecard-studio-modal,
  dialog.modal.namecard-studio-modal {
    position: fixed !important;
    inset: 0 !important;
    margin: auto !important;
    width: min(980px, calc(100vw - 36px)) !important;
    max-width: 980px !important;
    height: min(82vh, 670px) !important;
    max-height: 670px !important;
  }
}

.namecard-studio-preview {
  flex: 1 1 440px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 24px !important;
}

/* Nút tải ảnh bìa chia 2 dòng trên mobile, chống tràn ngang */
.custom-cover-upload-section {
  width: 100%;
  overflow-x: hidden;
}

.studio-upload-btn {
  width: 100% !important;
  height: auto !important;
  white-space: normal !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  padding: 10px 12px !important;
  text-align: center !important;
  line-height: 1.35 !important;
}

.studio-upload-btn-line1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.studio-upload-btn-line2 {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.82;
}

/* ============================================================
   ATHEROS GLASS POSTCARDS (PILL PAGINATION) FOR RE:SEARCH
   ============================================================ */

@property --pag-sweep {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

@keyframes pag-ring-draw {
  0% {
    --pag-sweep: 0deg;
  }

  100% {
    --pag-sweep: 360deg;
  }
}

:root {
  --pag-chip: rgba(15, 23, 42, 0.06);
  --pag-chip-ink: var(--ink, #1e293b);
  --pag-hover-fill: rgba(15, 23, 42, 0.11);
  --pag-ramp: var(--primary, #123f31);
  --pag-faint: rgba(100, 116, 139, 0.45);
}

body.dark-theme,
html.dark-theme {
  --pag-chip: rgba(255, 255, 255, 0.08);
  --pag-chip-ink: #f1f5f9;
  --pag-hover-fill: rgba(255, 255, 255, 0.15);
  --pag-ramp: #34d399;
  --pag-faint: rgba(255, 255, 255, 0.35);
}

html[data-user-theme="ruby"],
body[data-user-theme="ruby"] {
  --pag-ramp: #dc2626 !important;
}

html[data-user-theme="ruby"].dark-theme,
body[data-user-theme="ruby"].dark-theme {
  --pag-ramp: #f87171 !important;
}

html[data-user-theme="mythic"],
body[data-user-theme="mythic"] {
  --pag-ramp: #7c3aed !important;
}

html[data-user-theme="mythic"].dark-theme,
body[data-user-theme="mythic"].dark-theme {
  --pag-ramp: #a78bfa !important;
}

html[data-user-theme="rosequartz"],
body[data-user-theme="rosequartz"] {
  --pag-ramp: #8a3157 !important;
}

html[data-user-theme="rosequartz"].dark-theme,
body[data-user-theme="rosequartz"].dark-theme {
  --pag-ramp: #f472b6 !important;
}

html[data-user-theme="super"],
body[data-user-theme="super"] {
  --pag-ramp: #00b894 !important;
}

html[data-user-theme="super"].dark-theme,
body[data-user-theme="super"].dark-theme {
  --pag-ramp: #00f59b !important;
}

html[data-user-theme="diamond"],
body[data-user-theme="diamond"] {
  --pag-ramp: #0f172a !important;
}

html[data-user-theme="diamond"].dark-theme,
body[data-user-theme="diamond"].dark-theme {
  --pag-ramp: #ffffff !important;
}

body.christmas-season:not(.christmas-effects-off) {
  --pag-ramp: #dc2626 !important;
}

.forum-feed-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Accessibility screen-reader only helper */
.sr-only,
.pag-status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Container-free pagination bar: no bar background, border, shadow, label or page counter */
.pag-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 0 24px;
  user-select: none;
}

.pag.pag--pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible;
}

/* Arrows: neutral, change color on hover, never scale or move */
.pag__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  padding: 0;
  transition: color 0.18s ease, background 0.18s ease;
  transform: none !important;
}

.pag__arrow:hover:not(.pag__arrow--off) {
  background: var(--pag-chip);
  color: var(--pag-ramp);
  transform: none !important;
}

body.dark-theme .pag__arrow:hover:not(.pag__arrow--off) {
  background: var(--pag-hover-fill);
  color: var(--pag-ramp);
}

.pag__arrow.pag__arrow--off {
  opacity: 0.22;
  cursor: not-allowed;
  pointer-events: none;
}

/* Chips: neutral gray chips with 12px caption numbers */
.pag__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 9999px;
  border: none;
  background: var(--pag-chip);
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--pag-chip-ink);
  cursor: pointer;
  transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  transform: none !important;
}

.pag__item:hover:not(.active) {
  background: var(--pag-hover-fill);
  color: var(--text, #0f172a);
  transform: none !important;
}

body.dark-theme .pag__item:hover:not(.active) {
  color: #ffffff;
}

/* Current page: outline ring drawn clockwise from 12 o'clock, number turns bold */
.pag__item.active {
  background: var(--surface, #ffffff) !important;
  color: var(--text, #0f172a) !important;
  font-weight: 700 !important;
  cursor: default;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transform: none !important;
}

body.dark-theme .pag__item.active {
  background: var(--surface-card, #1c2632) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Conic sweep outline ring animated through --pag-sweep */
.pag__item.active::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 9999px;
  padding: 1.5px;
  background: conic-gradient(from 0deg,
      var(--pag-ramp) var(--pag-sweep, 360deg),
      transparent 0deg);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: pag-ring-draw 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  pointer-events: none;
}

/* Fallback for browsers that do not animate @property */
@supports not (background: paint(something)) {
  .pag__item.active {
    box-shadow: 0 0 0 1.5px var(--pag-ramp);
  }
}

/* Ellipsis: neutral faint glyph */
.pag__ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 32px;
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--pag-faint);
  user-select: none;
}

/* ============================================================
   OMNI SEARCH MODAL — HỘP TÌM KIẾM ĐA NĂNG RE:SEARCH
   ============================================================ */
dialog.modal.omni-search-modal {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: min(680px, calc(100vw - 32px)) !important;
  max-width: 680px !important;
  height: min(600px, 80vh) !important;
  max-height: 80vh !important;
  padding: 0 !important;
  border: 1px solid var(--line, #e2e8f0) !important;
  border-radius: 20px !important;
  background: #ffffff !important;
  box-shadow: 0 25px 70px -15px rgba(15, 23, 42, 0.35) !important;
  overflow: hidden !important;
  z-index: 1000 !important;
}

body.dark-theme dialog.modal.omni-search-modal {
  background: #18222d !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.6) !important;
}

.omni-search-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.omni-search-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface-card, #ffffff);
}

body.dark-theme .omni-search-header {
  background: #18222d;
  border-color: rgba(255, 255, 255, 0.08);
}

.omni-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.omni-search-icon {
  color: var(--primary, #123f31);
  flex-shrink: 0;
}

body.dark-theme .omni-search-icon {
  color: #34d399;
}

.omni-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink, #1e293b);
  min-width: 0;
}

body.dark-theme .omni-search-input {
  color: #f1f5f9;
}

.omni-search-input::placeholder {
  color: var(--muted, #94a3b8);
  font-weight: 400;
}

.omni-search-clear {
  background: none;
  border: none;
  color: var(--muted, #94a3b8);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.omni-search-clear:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink, #1e293b);
}

.omni-search-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 8px;
  background: var(--surface-bg, #f8fafc);
  color: var(--muted, #64748b);
  cursor: pointer;
  font-family: var(--sans, 'Inter', sans-serif) !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  transition: all 0.2s ease;
}

.omni-search-close-btn span {
  font-family: var(--sans, 'Inter', sans-serif) !important;
}

.omni-search-close-btn:hover {
  border-color: var(--primary, #123f31);
  color: var(--primary, #123f31);
  background: var(--surface-hover, #f1f5f2);
}

body.dark-theme .omni-search-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

.omni-search-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--surface-bg, #f8fafc);
  overflow-x: auto;
  scrollbar-width: none;
}

body.dark-theme .omni-search-tabs {
  background: #141c24;
  border-color: rgba(255, 255, 255, 0.08);
}

.omni-search-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.omni-search-tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink, #1e293b);
}

.omni-search-tab.active {
  background: var(--primary, #123f31);
  color: #ffffff;
}

body.dark-theme .omni-search-tab.active {
  background: #10b981;
  color: #ffffff;
}

.omni-tab-badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.omni-search-tab.active .omni-tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.omni-search-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  min-height: 0;
}

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

.omni-group-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #94a3b8);
  padding: 10px 12px 4px;
}

.omni-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.omni-item:hover,
.omni-item.selected {
  background: var(--surface-bg, #f1f5f9);
  border-color: var(--line, #e2e8f0);
}

body.dark-theme .omni-item:hover,
body.dark-theme .omni-item.selected {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.omni-item-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(18, 63, 49, 0.08);
  color: var(--primary, #123f31);
}

.omni-item-icon-box.doc-icon-box {
  background: rgba(20, 184, 166, 0.1);
  color: #0d9488;
}

.omni-item-icon-box.comm-icon-box {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

body.dark-theme .omni-item-icon-box {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

body.dark-theme .omni-item-icon-box.doc-icon-box {
  background: rgba(45, 212, 191, 0.15);
  color: #2dd4bf;
}

body.dark-theme .omni-item-icon-box.comm-icon-box {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.omni-item-content {
  flex: 1;
  min-width: 0;
}

.omni-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.omni-item-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-bg, #e2e8f0);
  color: var(--ink, #334155);
}

body.dark-theme .omni-item-badge {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.omni-item-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink, #0f172a);
  line-height: 1.35;
  margin: 0;
}

body.dark-theme .omni-item-title {
  color: #f8fafc;
}

.omni-item-snippet {
  font-size: 12.5px;
  color: var(--muted, #64748b);
  line-height: 1.4;
  margin: 4px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.omni-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted, #94a3b8);
}

.omni-meta-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.omni-meta-stat svg {
  opacity: 0.75;
  flex-shrink: 0;
}

.omni-author-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.omni-author-tag svg {
  opacity: 0.65;
  flex-shrink: 0;
}

.omni-highlight {
  background: rgba(250, 204, 21, 0.35);
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

body.dark-theme .omni-highlight {
  background: rgba(234, 179, 8, 0.35);
}

.omni-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted, #64748b);
}

.omni-empty-state h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #1e293b);
  margin: 8px 0 4px;
}

body.dark-theme .omni-empty-state h4 {
  color: #f1f5f9;
}

.omni-empty-state p {
  font-size: 13px;
  margin: 0;
}

.omni-suggestions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.omni-sug-chip {
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--surface-bg, #f1f5f9);
  border: 1px solid var(--line, #e2e8f0);
  font-size: 12px;
  color: var(--ink, #334155);
  cursor: pointer;
  transition: all 0.15s ease;
}

.omni-sug-chip:hover {
  border-color: var(--primary, #123f31);
  color: var(--primary, #123f31);
}

body.dark-theme .omni-sug-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.omni-search-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--line, #e2e8f0);
  background: var(--surface-bg, #f8fafc);
}

body.dark-theme .omni-search-footer {
  background: #141c24;
  border-color: rgba(255, 255, 255, 0.08);
}

.omni-footer-hint {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-family: var(--sans, 'Inter', sans-serif) !important;
  color: var(--muted, #94a3b8);
}

.omni-footer-hint kbd {
  font-family: var(--sans, 'Inter', sans-serif) !important;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line, #cbd5e1);
  background: #ffffff;
  color: var(--ink, #475569);
}

body.dark-theme .omni-footer-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}


/* ==========================================================================
   PUSH NOTIFICATIONS SYSTEM (FLOATING POPOVER & DOCK CONTROLS)
   ========================================================================== */

.notification-trigger-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-notification-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 9999px;
  color: var(--glass-control-ink, var(--ink));
  background: var(--glass-control-bg, var(--surface));
  border: 1px solid var(--glass-border, rgba(0, 0, 0, 0.08));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-notification-btn:hover,
.nav-notification-btn.active,
.notification-trigger-wrap.open .nav-notification-btn {
  background: var(--glass-control-hover-bg, var(--surface-hover));
  border-color: var(--glass-border-strong, rgba(0, 0, 0, 0.16));
  transform: translateY(-1px);
  color: var(--primary);
}

.nav-notification-btn:active {
  transform: scale(0.95);
}

.nav-notification-btn .notif-bell-icon {
  width: 17px;
  height: 17px;
  transition: transform 0.2s ease;
}

.nav-notification-btn:hover .notif-bell-icon {
  transform: rotate(12deg);
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  border: 1.5px solid var(--surface, #ffffff);
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.4);
  animation: notifBadgePop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes notifBadgePop {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Floating Non-Modal Popover Window */
.notification-popover {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 420px;
  max-width: calc(100vw - 20px);
  max-height: min(600px, calc(100vh - 90px));
  background: var(--surface, #ffffff);
  border: 1px solid var(--glass-border, rgba(0, 0, 0, 0.1));
  border-radius: 22px;
  box-shadow: 0 20px 48px -12px rgba(18, 63, 49, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  z-index: 10050;
  flex-direction: column;
  animation: notifPopoverSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.notification-trigger-wrap.open .notification-popover {
  display: flex;
}

@keyframes notifPopoverSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header & Segmented Pill Control (Strict Single Line) */
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.015);
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap !important;
}

.notif-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px;
  border-radius: 9999px;
  gap: 2px;
  flex-shrink: 0;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
}

.notif-seg-btn {
  border: none;
  background: transparent;
  padding: 5px 11px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.16s ease;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.notif-seg-btn span {
  white-space: nowrap !important;
}

.notif-seg-btn.active {
  background: var(--primary, #123f31);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.notif-seg-count {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.28);
  color: currentColor;
  line-height: 1.2;
}

.notif-seg-btn:not(.active) .notif-seg-count {
  background: rgba(0, 0, 0, 0.08);
  color: var(--ink);
}

.notif-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.notif-header-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notif-header-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  border-color: rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.notif-header-action-btn.active {
  background: rgba(18, 63, 49, 0.12);
  color: var(--primary, #123f31);
  border-color: var(--primary, #123f31);
}

.notif-clear-all-btn:hover {
  color: var(--error, #ef4444);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}

.notif-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
}

.notif-close-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  transform: scale(1.05);
}

/* Category Filter Bar */
.notif-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(0, 0, 0, 0.01);
  flex-shrink: 0;
}

.notif-filter-bar::-webkit-scrollbar {
  display: none;
}

.notif-filter-chip {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  color: var(--muted, #64748b);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notif-filter-chip:hover {
  border-color: rgba(0, 0, 0, 0.16);
  color: var(--ink);
}

.notif-filter-chip.active {
  background: var(--primary, #123f31);
  color: #ffffff;
  border-color: var(--primary, #123f31);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Admin Broadcast Trigger Bar */
.notif-admin-bar {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(18, 63, 49, 0.04);
  flex-shrink: 0;
}

.notif-admin-create-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--primary, #123f31);
  color: #ffffff;
  border: none;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.notif-admin-create-btn:hover {
  opacity: 0.92;
  transform: translateY(-0.5px);
}

/* Multi-Select Batch Bar */
.notif-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: rgba(18, 63, 49, 0.08);
  border-bottom: 1px solid rgba(18, 63, 49, 0.14);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--primary, #123f31);
  flex-shrink: 0;
  animation: notifSlideDown 0.15s ease;
}

@keyframes notifSlideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notif-batch-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.notif-batch-select-all input[type="checkbox"],
.notif-item-select-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--primary, #123f31);
  cursor: pointer;
}

.notif-batch-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.notif-batch-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(18, 63, 49, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary, #123f31);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notif-batch-btn:hover {
  background: #ffffff;
  transform: scale(1.02);
}

.notif-batch-btn.notif-batch-delete:hover {
  color: var(--error, #ef4444);
  border-color: rgba(239, 68, 68, 0.35);
  background: #fff;
}

.notif-batch-btn.notif-batch-cancel {
  border-color: transparent;
  background: transparent;
  color: var(--muted, #64748b);
}

.notif-batch-btn.notif-batch-cancel:hover {
  color: var(--ink);
}

/* Notification List & Items */
.notif-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: 420px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.14s ease;
  position: relative;
}

.notif-item:hover {
  background: rgba(0, 0, 0, 0.02);
}

.notif-item.is-unread {
  background: rgba(18, 63, 49, 0.035);
}

.notif-item.is-selected {
  background: rgba(18, 63, 49, 0.07);
}

.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #123f31);
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-item:not(.is-unread) .notif-unread-dot {
  visibility: hidden;
}

.notif-item-select-wrap {
  display: flex;
  align-items: center;
  padding-top: 4px;
  flex-shrink: 0;
}

.notif-item-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(18, 63, 49, 0.08);
  color: var(--primary, #123f31);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-icon-box svg {
  width: 15px;
  height: 15px;
}

.notif-item-body {
  flex: 1 1 auto;
  min-width: 0;
}

.notif-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 3px;
  line-height: 1.35;
}

.notif-item-content {
  font-size: 11.5px;
  color: var(--muted, #64748b);
  line-height: 1.45;
  margin-bottom: 6px;
  word-break: break-word;
}

.notif-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.notif-item-time {
  color: var(--muted, #94a3b8);
  font-size: 10.5px;
}

.notif-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.notif-action-btn-go {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: 9999px;
  background: var(--primary, #123f31);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  text-decoration: none;
  line-height: 1.3;
}

.notif-action-btn-go:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

.notif-action-btn-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  color: var(--muted, #94a3b8);
  cursor: pointer;
  transition: all 0.12s ease;
}

.notif-action-btn-del:hover {
  color: var(--error, #ef4444);
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
}

/* Empty State */
.notif-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted, #94a3b8);
}

.notif-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--muted, #94a3b8);
}

.notif-empty-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.notif-empty-desc {
  font-size: 11.5px;
  max-width: 240px;
  line-height: 1.45;
}

/* Popover Footer & Pagination */
.notif-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.015);
  font-size: 11px;
  color: var(--muted, #94a3b8);
  flex-shrink: 0;
}

.notif-pagination-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.notif-page-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.notif-page-pill-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.notif-page-pill-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Mobile Hamburger Menu Group */
.quick-menu-mobile-tools {
  display: none;
}

.quick-menu-mobile-group-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted, #94a3b8);
  padding: 6px 14px 4px;
}

.quick-menu-badge-shortcut {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted, #64748b);
  margin-left: auto;
}

.quick-menu-notif-count {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #ef4444;
  color: #ffffff;
  margin-left: auto;
}

/* Admin Broadcast Modal Container & Card (Guaranteed Top Layer) */
.modal#adminBroadcastModal,
#adminBroadcastModal,
.modal#versionChangelogModal,
#versionChangelogModal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 16px !important;
  background: rgba(10, 44, 30, 0.6) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  z-index: 10080 !important;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow-y: auto;
}

#adminBroadcastModal.open,
#adminBroadcastModal[style*="display: flex"],
#versionChangelogModal.open,
#versionChangelogModal[style*="display: flex"] {
  display: flex !important;
}

#adminBroadcastModal .admin-broadcast-modal-card,
#versionChangelogModal .modal-card {
  position: relative !important;
  z-index: 10081 !important;
  max-width: 480px !important;
  width: 100% !important;
  margin: auto !important;
  background: var(--surface, #ffffff) !important;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08)) !important;
  border-radius: 20px !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35) !important;
  animation: notifPopoverSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  overflow: hidden;
}

#adminBroadcastModal .modal-header,
#versionChangelogModal .modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 18px 22px 14px !important;
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08)) !important;
}

#adminBroadcastModal .modal-header h3,
#versionChangelogModal .modal-header h3 {
  font-family: var(--sans) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: var(--ink, #1e293b) !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
}

#adminBroadcastModal .modal-close,
#versionChangelogModal .modal-close {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  background: rgba(0, 0, 0, 0.04) !important;
  color: var(--muted, #64748b) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
}

body.dark-theme #adminBroadcastModal,
body.dark-theme #versionChangelogModal {
  background: rgba(5, 15, 25, 0.75) !important;
}

body.dark-theme #adminBroadcastModal .admin-broadcast-modal-card,
body.dark-theme #versionChangelogModal .modal-card {
  background: #182230 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
}

body.dark-theme #adminBroadcastModal .modal-header,
body.dark-theme #versionChangelogModal .modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme #adminBroadcastModal .modal-header h3,
body.dark-theme #versionChangelogModal .modal-header h3 {
  color: #f1f5f9 !important;
}

body.dark-theme #adminBroadcastModal .modal-close,
body.dark-theme #versionChangelogModal .modal-close {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #94a3b8 !important;
}

body.dark-theme #adminBroadcastModal .modal-close:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #ffffff !important;
}

body.dark-theme #adminBroadcastModal label {
  color: #cbd5e1 !important;
}

body.dark-theme #adminBroadcastModal .input,
body.dark-theme #adminBroadcastModal .textarea {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme #adminBroadcastModal .input:focus,
body.dark-theme #adminBroadcastModal .textarea:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25) !important;
}

/* ==========================================================================
   THEME ADAPTATIONS FOR NOTIFICATIONS
   ========================================================================== */

/* 1. DARK THEME OVERRIDES */
body.dark-theme .nav-notification-btn {
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .nav-notification-btn:hover,
body.dark-theme .notification-trigger-wrap.open .nav-notification-btn {
  background: rgba(51, 65, 85, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
  color: #34d399;
}

body.dark-theme .notification-popover {
  background: #182230;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 50px -10px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

body.dark-theme .notif-header,
body.dark-theme .notif-footer {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

body.dark-theme .notif-segmented-control {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .notif-seg-btn {
  color: #94a3b8;
}

body.dark-theme .notif-seg-btn.active {
  background: #34d399;
  color: #0f172a;
}

body.dark-theme .notif-seg-btn:not(.active) .notif-seg-count {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body.dark-theme .notif-header-action-btn {
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

body.dark-theme .notif-header-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

body.dark-theme .notif-header-action-btn.active {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

body.dark-theme .notif-filter-bar {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.015);
}

body.dark-theme .notif-filter-chip {
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

body.dark-theme .notif-filter-chip:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

body.dark-theme .notif-filter-chip.active {
  background: #34d399;
  color: #0f172a;
  border-color: #34d399;
}

body.dark-theme .notif-admin-bar {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(52, 211, 153, 0.06);
}

body.dark-theme .notif-admin-create-btn {
  background: #34d399;
  color: #0f172a;
}

body.dark-theme .notif-batch-bar {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.2);
  color: #34d399;
}

body.dark-theme .notif-batch-btn {
  border-color: rgba(52, 211, 153, 0.25);
  background: #1e293b;
  color: #34d399;
}

body.dark-theme .notif-item {
  border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .notif-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

body.dark-theme .notif-item.is-unread {
  background: rgba(52, 211, 153, 0.06);
}

body.dark-theme .notif-item.is-selected {
  background: rgba(52, 211, 153, 0.1);
}

body.dark-theme .notif-unread-dot {
  background: #34d399;
}

body.dark-theme .notif-item-icon-box {
  background: rgba(52, 211, 153, 0.14);
  color: #34d399;
}

body.dark-theme .notif-item-title {
  color: #f1f5f9;
}

body.dark-theme .notif-item-content {
  color: #94a3b8;
}

body.dark-theme .notif-action-btn-go {
  background: #34d399;
  color: #0f172a;
}

body.dark-theme .notif-action-btn-del {
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

body.dark-theme .notif-action-btn-del:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #f87171;
}

body.dark-theme .notif-page-pill-btn {
  border-color: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body.dark-theme .quick-menu-badge-shortcut {
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

/* 2. RUBY THEME OVERRIDES */
[data-user-theme="ruby"] .notif-seg-btn.active,
[data-user-theme="ruby"] .notif-filter-chip.active,
[data-user-theme="ruby"] .notif-admin-create-btn,
[data-user-theme="ruby"] .notif-action-btn-go {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #e11d48 !important;
}

[data-user-theme="ruby"] .notif-unread-dot {
  background: #e11d48 !important;
}

[data-user-theme="ruby"] .notif-item-icon-box {
  background: rgba(225, 29, 72, 0.1) !important;
  color: #e11d48 !important;
}

[data-user-theme="ruby"] .nav-notification-btn:hover,
[data-user-theme="ruby"] .notification-trigger-wrap.open .nav-notification-btn,
[data-user-theme="ruby"] .notif-header-action-btn.active {
  color: #e11d48 !important;
}

[data-user-theme="ruby"] .notif-batch-bar {
  background: rgba(225, 29, 72, 0.08) !important;
  border-color: rgba(225, 29, 72, 0.18) !important;
  color: #e11d48 !important;
}

[data-user-theme="ruby"] .notif-batch-btn {
  border-color: rgba(225, 29, 72, 0.25) !important;
  color: #e11d48 !important;
}

/* 3. MYTHIC THEME OVERRIDES */
[data-user-theme="mythic"] .notif-seg-btn.active,
[data-user-theme="mythic"] .notif-filter-chip.active,
[data-user-theme="mythic"] .notif-admin-create-btn,
[data-user-theme="mythic"] .notif-action-btn-go {
  background: #7c3aed !important;
  color: #ffffff !important;
  border-color: #7c3aed !important;
}

[data-user-theme="mythic"] .notif-unread-dot {
  background: #7c3aed !important;
}

[data-user-theme="mythic"] .notif-item-icon-box {
  background: rgba(124, 58, 237, 0.1) !important;
  color: #7c3aed !important;
}

[data-user-theme="mythic"] .nav-notification-btn:hover,
[data-user-theme="mythic"] .notification-trigger-wrap.open .nav-notification-btn,
[data-user-theme="mythic"] .notif-header-action-btn.active {
  color: #7c3aed !important;
}

[data-user-theme="mythic"] .notif-batch-bar {
  background: rgba(124, 58, 237, 0.08) !important;
  border-color: rgba(124, 58, 237, 0.18) !important;
  color: #7c3aed !important;
}

[data-user-theme="mythic"] .notif-batch-btn {
  border-color: rgba(124, 58, 237, 0.25) !important;
  color: #7c3aed !important;
}

/* Rose Quartz Theme Notification Overrides */
[data-user-theme="rosequartz"] .notif-seg-btn.active,
[data-user-theme="rosequartz"] .notif-filter-chip.active,
[data-user-theme="rosequartz"] .notif-admin-create-btn,
[data-user-theme="rosequartz"] .notif-action-btn-go {
  background: #8a3157 !important;
  color: #ffffff !important;
  border-color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .notif-unread-dot {
  background: #c45b83 !important;
}

[data-user-theme="rosequartz"] .notif-item-icon-box {
  background: rgba(138, 49, 87, 0.1) !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .nav-notification-btn:hover,
[data-user-theme="rosequartz"] .notification-trigger-wrap.open .nav-notification-btn,
[data-user-theme="rosequartz"] .notif-header-action-btn.active {
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .notif-batch-bar {
  background: rgba(138, 49, 87, 0.08) !important;
  border-color: rgba(138, 49, 87, 0.18) !important;
  color: #8a3157 !important;
}

[data-user-theme="rosequartz"] .notif-batch-btn {
  border-color: rgba(138, 49, 87, 0.25) !important;
  color: #8a3157 !important;
}

/* Super Neon Theme Notification Overrides */
[data-user-theme="super"] .notif-seg-btn.active,
[data-user-theme="super"] .notif-filter-chip.active,
[data-user-theme="super"] .notif-admin-create-btn,
[data-user-theme="super"] .notif-action-btn-go {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 50%, #6366f1 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

[data-user-theme="super"] .notif-unread-dot {
  background: #00cec9 !important;
}

[data-user-theme="super"] .notif-item-icon-box {
  background: rgba(0, 206, 201, 0.12) !important;
  color: #00897b !important;
}

[data-user-theme="super"] .nav-notification-btn:hover,
[data-user-theme="super"] .notification-trigger-wrap.open .nav-notification-btn,
[data-user-theme="super"] .notif-header-action-btn.active {
  color: #00b894 !important;
}

[data-user-theme="super"] .notif-batch-bar {
  background: rgba(0, 184, 148, 0.08) !important;
  border-color: rgba(0, 206, 201, 0.2) !important;
  color: #00897b !important;
}

[data-user-theme="super"] .notif-batch-btn {
  border-color: rgba(0, 206, 201, 0.3) !important;
  color: #00897b !important;
}

/* Diamond Celestial Theme Notification Overrides */
[data-user-theme="diamond"] .notif-seg-btn.active,
[data-user-theme="diamond"] .notif-filter-chip.active,
[data-user-theme="diamond"] .notif-admin-create-btn,
[data-user-theme="diamond"] .notif-action-btn-go {
  background: #0f172a !important;
  color: #ffffff !important;
  border-color: #334155 !important;
}

[data-user-theme="diamond"] .notif-unread-dot {
  background: #475569 !important;
}

[data-user-theme="diamond"] .notif-item-icon-box {
  background: rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .nav-notification-btn:hover,
[data-user-theme="diamond"] .notification-trigger-wrap.open .nav-notification-btn,
[data-user-theme="diamond"] .notif-header-action-btn.active {
  color: #0f172a !important;
}

[data-user-theme="diamond"] .notif-batch-bar {
  background: rgba(15, 23, 42, 0.06) !important;
  border-color: rgba(15, 23, 42, 0.18) !important;
  color: #0f172a !important;
}

[data-user-theme="diamond"] .notif-batch-btn {
  border-color: rgba(15, 23, 42, 0.25) !important;
  color: #0f172a !important;
}

/* Dark mode overrides for Notifications */
body.dark-theme [data-user-theme="rosequartz"] .notif-seg-btn.active,
body.dark-theme [data-user-theme="rosequartz"] .notif-filter-chip.active,
body.dark-theme [data-user-theme="rosequartz"] .notif-action-btn-go {
  background: #c45b83 !important;
  color: #ffffff !important;
}
body.dark-theme [data-user-theme="rosequartz"] .notif-unread-dot {
  background: #f472b6 !important;
}

body.dark-theme [data-user-theme="super"] .notif-seg-btn.active,
body.dark-theme [data-user-theme="super"] .notif-filter-chip.active,
body.dark-theme [data-user-theme="super"] .notif-action-btn-go {
  background: linear-gradient(135deg, #00f59b 0%, #00d2ff 50%, #818cf8 100%) !important;
  color: #090d16 !important;
  font-weight: 800 !important;
}
body.dark-theme [data-user-theme="super"] .notif-unread-dot {
  background: #00f59b !important;
}

body.dark-theme [data-user-theme="diamond"] .notif-seg-btn.active,
body.dark-theme [data-user-theme="diamond"] .notif-filter-chip.active,
body.dark-theme [data-user-theme="diamond"] .notif-action-btn-go {
  background: #ffffff !important;
  color: #090d16 !important;
  font-weight: 800 !important;
}
body.dark-theme [data-user-theme="diamond"] .notif-unread-dot {
  background: #ffffff !important;
}
body.dark-theme [data-user-theme="diamond"] .nav-notification-btn:hover {
  color: #ffffff !important;
}

/* 4. CHRISTMAS SEASON OVERRIDES (Isolated when no custom theme is active) */
body.christmas-season:not([data-user-theme]):not(.christmas-effects-off) .notif-seg-btn.active,
html:not([data-user-theme]) body.christmas-season:not(.christmas-effects-off) .notif-seg-btn.active {
  background: #15803d !important;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25), inset 0 0 0 1px rgba(220, 38, 38, 0.4) !important;
}

body.christmas-season:not([data-user-theme]):not(.christmas-effects-off) .notif-unread-dot,
html:not([data-user-theme]) body.christmas-season:not(.christmas-effects-off) .notif-unread-dot {
  background: #dc2626 !important;
}

body.christmas-season:not([data-user-theme]):not(.christmas-effects-off) .notif-item-icon-box,
html:not([data-user-theme]) body.christmas-season:not(.christmas-effects-off) .notif-item-icon-box {
  background: rgba(22, 101, 52, 0.1) !important;
  color: #15803d !important;
}

body.christmas-season:not([data-user-theme]):not(.christmas-effects-off) .notification-badge,
html:not([data-user-theme]) body.christmas-season:not(.christmas-effects-off) .notification-badge {
  background: #dc2626 !important;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (SEARCH & NOTIFICATIONS IN HAMBURGER)
   ========================================================================== */

@media (max-width: 800px) {

  /* Header actions trên mobile: Tìm kiếm & Thông báo nằm bên trái avatar */
  header#siteHeader .header-actions,
  .site-header .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 3px 6px !important;
  }

  /* Đưa 2 nút tìm kiếm đa năng và thông báo ra ngoài, bên trái avatar */
  #openSearch.desktop-search,
  .site-header .desktop-search {
    display: inline-flex !important;
    order: 1 !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .notification-trigger-wrap {
    display: inline-flex !important;
    order: 2 !important;
  }

  .notification-trigger-wrap > .nav-notification-btn,
  .site-header .nav-notification-btn {
    display: inline-flex !important;
    order: 2 !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #navProfileChip,
  .site-header .profile-chip {
    order: 3 !important;
    margin: 0 !important;
  }

  .quick-user-menu-wrap {
    order: 4 !important;
  }

  .quick-menu-btn,
  .site-header .quick-menu-btn {
    order: 4 !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Ẩn công cụ trùng lặp trong quick menu vì đã đưa ra ngoài header */
  .quick-menu-mobile-tools {
    display: none !important;
  }

  /* Floating Popover on mobile anchored under top header */
  .notification-popover {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 58px);
    right: 12px;
    left: 12px;
    width: auto;
    max-width: 440px;
    margin: 0 auto;
    max-height: calc(100vh - 75px);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  }
}

/* ==========================================================================
   BẢNG VINH DANH HỌC THUẬT TRANG CHỦ (HOMEPAGE GRAND LEADERBOARD)
   ========================================================================== */

.home-leaderboard-section {
  width: 100%;
  max-width: 100%;
  margin: 18px 0 16px;
  padding: 0;
  box-sizing: border-box;
}

.home-lb-container {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 28px;
  padding: 24px 32px 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .home-lb-container,
body.dark-theme .home-lb-container,
html.dark-theme .home-lb-container {
  background: var(--surface, #182028);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .home-lb-title,
body.dark-theme .home-lb-title,
html.dark-theme .home-lb-title {
  color: #f8fafc;
}

[data-theme="dark"] .home-lb-subtitle,
body.dark-theme .home-lb-subtitle,
html.dark-theme .home-lb-subtitle {
  color: #94a3b8;
}

.home-lb-header {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 16px;
}

.home-lb-header-text {
  flex: 1;
  min-width: 280px;
}

.home-lb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  margin-bottom: 8px;
}

[data-theme="dark"] .home-lb-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.home-lb-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--text, #0f172a);
  letter-spacing: -0.01em;
  text-align: center;
  width: 100%;
}

.home-lb-subtitle {
  font-size: 14px;
  color: var(--muted, #64748b);
  margin: 0;
  line-height: 1.5;
  max-width: 620px;
}

/* Period Navigation: Tuần / Tháng / Quý & Period Detail Info */
.home-lb-period-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.home-lb-period-tabs {
  display: inline-flex;
  background: var(--bg-alt, #f1f5f9);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
  border: 1px solid var(--border, #e2e8f0);
}

.home-lb-period-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: #0284c7;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

[data-theme="dark"] .home-lb-period-detail,
body.dark-theme .home-lb-period-detail,
html.dark-theme .home-lb-period-detail,
body:not(.christmas-effects-off) .home-lb-period-detail {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.28);
  color: #38bdf8;
}

[data-theme="dark"] .home-lb-period-tabs,
body.dark-theme .home-lb-period-tabs,
html.dark-theme .home-lb-period-tabs,
body:not(.christmas-effects-off) .home-lb-period-tabs {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.home-lb-tab-btn {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

[data-theme="dark"] .home-lb-tab-btn,
body.dark-theme .home-lb-tab-btn,
html.dark-theme .home-lb-tab-btn,
body:not(.christmas-effects-off) .home-lb-tab-btn {
  color: #94a3b8;
}

.home-lb-tab-btn .tab-icon {
  font-size: 14px;
}

.home-lb-tab-btn:hover {
  color: var(--text, #0f172a);
}

[data-theme="dark"] .home-lb-tab-btn:hover,
body.dark-theme .home-lb-tab-btn:hover,
html.dark-theme .home-lb-tab-btn:hover,
body:not(.christmas-effects-off) .home-lb-tab-btn:hover {
  color: #f8fafc;
}

.home-lb-tab-btn.active {
  background: #ffffff;
  color: var(--primary, #059669);
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .home-lb-tab-btn.active,
body.dark-theme .home-lb-tab-btn.active,
html.dark-theme .home-lb-tab-btn.active,
body:not(.christmas-effects-off) .home-lb-tab-btn.active {
  background: #1e293b;
  color: #38bdf8;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* Podium Top 3 */
.home-lb-podium-wrap {
  margin: 14px 0 0;
}

.home-lb-podium-wrap .arena-top3-cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 20px;
  padding: 24px 8px 0;
  flex-wrap: nowrap;
}

.home-lb-loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted, #64748b);
  font-size: 14px;
}

/* List Top 4 - 10 */
.home-lb-list-wrap {
  margin-top: 3px;
  border-top: none;
  padding-top: 0;
}

[data-theme="dark"] .home-lb-list-wrap,
body.dark-theme .home-lb-list-wrap,
html.dark-theme .home-lb-list-wrap {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .home-lb-list-title,
body.dark-theme .home-lb-list-title,
html.dark-theme .home-lb-list-title {
  color: #94a3b8;
}

.home-lb-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.home-lb-list-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
}

.home-lb-list-hint {
  font-size: 12px;
  color: var(--muted, #94a3b8);
}

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

/* Expanded Mini Cover Canvas for Homepage Leaderboard Rows (Top 4 - 10) */
.home-lb-list .comp-lb-capsule {
  height: 48px;
  padding: 4px 14px 4px 6px;
  border-radius: 9999px;
}

.home-lb-list .comp-lb-avatar-wrap .avatar {
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.home-lb-list .lb-cover-art {
  width: 84%;
  background-size: cover;
  background-position: center center;
  opacity: 0.98;
}

.home-lb-list .lb-cover-overlay {
  background: linear-gradient(90deg,
      #ffffff 0%,
      #ffffff 22%,
      rgba(255, 255, 255, 0.88) 34%,
      rgba(255, 255, 255, 0.45) 50%,
      rgba(255, 255, 255, 0.12) 70%,
      rgba(255, 255, 255, 0) 90%);
}

[data-theme="dark"] .home-lb-list .lb-cover-overlay,
body.dark-theme .home-lb-list .lb-cover-overlay,
html.dark-theme .home-lb-list .lb-cover-overlay,
body:not(.christmas-effects-off) .home-lb-list .lb-cover-overlay {
  background: linear-gradient(90deg,
      #202c39 0%,
      #202c39 22%,
      rgba(32, 44, 57, 0.88) 34%,
      rgba(32, 44, 57, 0.45) 50%,
      rgba(32, 44, 57, 0.12) 70%,
      rgba(32, 44, 57, 0) 90%) !important;
}

.home-lb-list .comp-lb-row.is-current-user .lb-cover-overlay {
  background: linear-gradient(90deg,
      #f0fdf4 0%,
      #f0fdf4 22%,
      rgba(240, 253, 244, 0.88) 34%,
      rgba(240, 253, 244, 0.45) 50%,
      rgba(240, 253, 244, 0.12) 70%,
      rgba(240, 253, 244, 0) 90%);
}

[data-theme="dark"] .home-lb-list .comp-lb-row.is-current-user .lb-cover-overlay,
body.dark-theme .home-lb-list .comp-lb-row.is-current-user .lb-cover-overlay,
html.dark-theme .home-lb-list .comp-lb-row.is-current-user .lb-cover-overlay,
body:not(.christmas-effects-off) .home-lb-list .comp-lb-row.is-current-user .lb-cover-overlay {
  background: linear-gradient(90deg,
      #0f241a 0%,
      #0f241a 22%,
      rgba(15, 36, 26, 0.88) 34%,
      rgba(15, 36, 26, 0.45) 50%,
      rgba(15, 36, 26, 0.12) 70%,
      rgba(15, 36, 26, 0) 90%) !important;
}

/* Dòng thông báo làm mới bảng xếp hạng phía cuối BXH */
.home-lb-refresh-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--bg-alt, #f8fafc);
  border: 1px dashed var(--border, #e2e8f0);
  color: var(--muted, #64748b);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: all 0.2s ease;
}

[data-theme="dark"] .home-lb-refresh-notice,
body.dark-theme .home-lb-refresh-notice,
html.dark-theme .home-lb-refresh-notice,
body:not(.christmas-effects-off) .home-lb-refresh-notice {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.home-lb-refresh-notice svg {
  color: var(--primary, #059669);
  flex-shrink: 0;
}

[data-theme="dark"] .home-lb-refresh-notice svg,
body.dark-theme .home-lb-refresh-notice svg,
html.dark-theme .home-lb-refresh-notice svg,
body:not(.christmas-effects-off) .home-lb-refresh-notice svg {
  color: #38bdf8;
}

/* ==========================================================================
   CỘNG ĐỒNG HỌC THUẬT (COMMUNITIES / SUBREDDITS)
   ========================================================================== */

/* Forum Aside Card */
.forum-communities-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px !important;
}

.communities-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.communities-card-header .eyebrow {
  margin: 0 !important;
  line-height: 1 !important;
}

.btn-create-community {
  border: 1px solid var(--primary, #059669);
  background: rgba(5, 150, 105, 0.08);
  color: var(--primary, #059669);
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-create-community:hover {
  background: var(--primary, #059669);
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 3px 8px rgba(5, 150, 105, 0.25);
}

/* Community Tabs in Sidebar */
.community-tabs {
  display: flex;
  background: var(--bg-alt, #f1f5f9);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

[data-theme="dark"] .community-tabs,
body.dark-theme .community-tabs,
html.dark-theme .community-tabs,
body:not(.christmas-effects-off) .community-tabs {
  background: rgba(255, 255, 255, 0.05);
}

.comm-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

[data-theme="dark"] .comm-tab,
body.dark-theme .comm-tab,
html.dark-theme .comm-tab,
body:not(.christmas-effects-off) .comm-tab {
  color: #94a3b8;
}

[data-theme="dark"] .comm-tab:hover,
body.dark-theme .comm-tab:hover,
html.dark-theme .comm-tab:hover,
body:not(.christmas-effects-off) .comm-tab:hover {
  color: #f8fafc;
}

.comm-tab.active {
  background: #ffffff;
  color: var(--text, #0f172a);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .comm-tab.active,
body.dark-theme .comm-tab.active,
html.dark-theme .comm-tab.active,
body:not(.christmas-effects-off) .comm-tab.active {
  background: #1e293b;
  color: #f1f5f9;
}

/* Community List items */
.community-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 2px;
}

.community-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.community-sidebar-item:hover {
  background: var(--bg-alt, #f8fafc);
  border-color: var(--border, #e2e8f0);
}

[data-theme="dark"] .community-sidebar-item:hover,
body.dark-theme .community-sidebar-item:hover,
html.dark-theme .community-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.community-sidebar-item.active {
  background: rgba(5, 150, 105, 0.08);
  border-color: var(--primary, #059669);
}

[data-theme="dark"] .community-sidebar-item.active,
body.dark-theme .community-sidebar-item.active,
html.dark-theme .community-sidebar-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
}

.comm-item-avatar {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-alt, #f1f5f9);
  border-radius: 8px;
}

[data-theme="dark"] .comm-item-avatar,
body.dark-theme .comm-item-avatar,
html.dark-theme .comm-item-avatar {
  background: rgba(255, 255, 255, 0.06);
}

.comm-item-info {
  flex: 1;
  min-width: 0;
}

.comm-item-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.comm-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .comm-item-name,
body.dark-theme .comm-item-name,
html.dark-theme .comm-item-name {
  color: #f1f5f9;
}

.comm-item-lock {
  font-size: 11px;
}

.comm-item-role-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.comm-item-role-badge.admin {
  background: #fef3c7;
  color: #b45309;
}

[data-theme="dark"] .comm-item-role-badge.admin,
body.dark-theme .comm-item-role-badge.admin,
html.dark-theme .comm-item-role-badge.admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.comm-item-role-badge.mod {
  background: #e0e7ff;
  color: #4338ca;
}

.comm-item-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 1px;
}

.comm-item-slug {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-item-dot {
  opacity: 0.6;
}

.comm-item-members {
  white-space: nowrap;
}

.btn-comm-join {
  border: 1px solid var(--border, #cbd5e1);
  background: #ffffff;
  color: var(--text, #0f172a);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-comm-join:hover {
  border-color: var(--primary, #059669);
  color: var(--primary, #059669);
}

.btn-comm-join.joined {
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary, #059669);
  border-color: transparent;
}

[data-theme="dark"] .btn-comm-join,
body.dark-theme .btn-comm-join,
html.dark-theme .btn-comm-join {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

[data-theme="dark"] .btn-comm-join.joined,
body.dark-theme .btn-comm-join.joined,
html.dark-theme .btn-comm-join.joined {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.btn-all-forum-link {
  width: 100%;
  border: 1px dashed var(--border, #cbd5e1);
  background: transparent;
  color: var(--muted, #64748b);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-all-forum-link:hover {
  background: var(--bg-alt, #f1f5f9);
  color: var(--text, #0f172a);
}

[data-theme="dark"] .btn-all-forum-link,
body.dark-theme .btn-all-forum-link,
html.dark-theme .btn-all-forum-link {
  border-color: rgba(255, 255, 255, 0.12);
}

.community-empty-state {
  padding: 16px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted, #64748b);
}

/* Separate Community Badge Row in Post Cards */
.post-community-badge-row {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.post-community-badge-row .post-comm-tag {
  border-radius: 9999px;
  padding: 3px 9px;
  font-size: 11px;
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.post-community-badge-row .post-comm-tag.is-private {
  border-color: rgba(168, 85, 247, 0.25);
}

[data-theme="dark"] .post-community-badge-row .post-comm-tag,
body.dark-theme .post-community-badge-row .post-comm-tag,
html.dark-theme .post-community-badge-row .post-comm-tag {
  border-color: rgba(56, 189, 248, 0.28);
}

[data-theme="dark"] .post-community-badge-row .post-comm-tag.is-private,
body.dark-theme .post-community-badge-row .post-comm-tag.is-private,
html.dark-theme .post-community-badge-row .post-comm-tag.is-private {
  border-color: rgba(192, 132, 252, 0.28);
}

/* Reddit-Style Community Pill on Post Cards */
.post-comm-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(14, 165, 233, 0.1) !important;
  color: #0284c7 !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
  border-radius: 6px;
  padding: 2px 7px;
}

.post-comm-tag:hover {
  background: rgba(14, 165, 233, 0.2) !important;
  transform: translateY(-1px);
}

.post-comm-tag.is-private {
  background: rgba(168, 85, 247, 0.1) !important;
  color: #9333ea !important;
}

[data-theme="dark"] .post-comm-tag,
body.dark-theme .post-comm-tag,
html.dark-theme .post-comm-tag {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #38bdf8 !important;
}

[data-theme="dark"] .post-comm-tag.is-private,
body.dark-theme .post-comm-tag.is-private,
html.dark-theme .post-comm-tag.is-private {
  background: rgba(192, 132, 252, 0.15) !important;
  color: #c084fc !important;
}

.comm-tag-avatar {
  font-size: 12px;
}

.comm-tag-name {
  font-size: 11px;
}

.comm-tag-lock {
  font-size: 10px;
}

/* Community Detail Hero Banner in Forum */
.community-detail-hero {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card-bg, #ffffff);
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .community-detail-hero,
body.dark-theme .community-detail-hero,
html.dark-theme .community-detail-hero {
  background: var(--surface, #182028);
  border-color: rgba(255, 255, 255, 0.08);
}

.community-hero-cover {
  height: 120px;
  width: 100%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #93c5fd 100%);
  position: relative;
}

.community-hero-content {
  padding: 0 20px 18px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.community-hero-avatar-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--card-bg, #ffffff);
  border: 3px solid var(--card-bg, #ffffff);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-top: -28px;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}

[data-theme="dark"] .community-hero-avatar-box,
body.dark-theme .community-hero-avatar-box,
html.dark-theme .community-hero-avatar-box {
  background: #111827;
  border-color: #111827;
}

.community-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.community-hero-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.community-hero-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text, #0f172a);
}

[data-theme="dark"] .community-hero-title,
body.dark-theme .community-hero-title,
html.dark-theme .community-hero-title {
  color: #f8fafc;
}

.community-privacy-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
  vertical-align: middle;
}

.community-privacy-pill .privacy-pill-icon {
  display: block;
  flex-shrink: 0;
}

.community-privacy-pill.is-public {
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary, #059669);
}

.community-privacy-pill.is-private {
  background: rgba(168, 85, 247, 0.1);
  color: #9333ea;
}

[data-theme="dark"] .community-privacy-pill.is-public,
body.dark-theme .community-privacy-pill.is-public,
html.dark-theme .community-privacy-pill.is-public {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

[data-theme="dark"] .community-privacy-pill.is-private,
body.dark-theme .community-privacy-pill.is-private,
html.dark-theme .community-privacy-pill.is-private {
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
}

.community-hero-slug {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted, #64748b);
  margin: 0;
}

.community-hero-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text, #334155);
  margin: 6px 0 8px 0;
}

[data-theme="dark"] .community-hero-desc,
body.dark-theme .community-hero-desc,
html.dark-theme .community-hero-desc {
  color: #cbd5e1;
}

.community-hero-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 12px;
}

.community-hero-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.comm-hero-left-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comm-hero-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.btn-comm-icon-action {
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  flex-shrink: 0 !important;
}

.btn-leave-comm {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-leave-comm:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

body.dark-theme .btn-leave-comm,
html.dark-theme .btn-leave-comm {
  background: rgba(239, 68, 68, 0.18) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

body.dark-theme .btn-leave-comm:hover,
html.dark-theme .btn-leave-comm:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.comm-admin-tag-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  background: #eab308;
  color: #1e1b4b;
  box-shadow: 0 2px 8px rgba(234, 179, 8, 0.25);
  pointer-events: none;
  user-select: none;
  cursor: default;
}

body.dark-theme .comm-admin-tag-hero,
html.dark-theme .comm-admin-tag-hero {
  background: #f59e0b;
  color: #0f172a;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

/* Create Community Modal */
.create-community-modal {
  max-width: 540px;
  width: 95%;
}

.comm-create-preview {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-alt, #f8fafc);
  margin-bottom: 16px;
}

[data-theme="dark"] .comm-create-preview,
body.dark-theme .comm-create-preview,
html.dark-theme .comm-create-preview {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.comm-preview-cover {
  height: 64px;
  width: 100%;
}

.comm-preview-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.comm-preview-avatar {
  font-size: 26px;
  width: 42px;
  height: 42px;
  background: var(--card-bg, #ffffff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .comm-preview-avatar,
body.dark-theme .comm-preview-avatar,
html.dark-theme .comm-preview-avatar {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  color: #f8fafc;
}

.comm-preview-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

[data-theme="dark"] .comm-preview-name,
body.dark-theme .comm-preview-name,
html.dark-theme .comm-preview-name {
  color: #f8fafc;
}

.comm-preview-slug {
  font-size: 12px;
  color: var(--muted, #64748b);
}

[data-theme="dark"] .comm-preview-slug,
body.dark-theme .comm-preview-slug,
html.dark-theme .comm-preview-slug {
  color: #94a3b8;
}

.input-prefix-wrap {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}

.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  line-height: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted, #64748b);
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

.input-prefix-wrap input {
  padding-left: 42px !important;
  width: 100%;
  box-sizing: border-box;
}

.emoji-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.emoji-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.emoji-chip {
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card-bg, #ffffff);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.emoji-chip:hover {
  transform: scale(1.15);
  border-color: var(--primary, #059669);
}

[data-theme="dark"] .emoji-chip,
body.dark-theme .emoji-chip,
html.dark-theme .emoji-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.cover-presets-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cover-chip {
  width: 44px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cover-chip:hover {
  transform: translateY(-2px);
}

.cover-chip.active {
  border-color: var(--text, #0f172a);
  box-shadow: 0 0 0 2px var(--primary, #059669);
}

/* Category Navigation (5 danh mục) trên Homepage Grand Leaderboard */
.home-lb-cat-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 20px;
  margin-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.home-lb-cat-nav::-webkit-scrollbar {
  display: none;
}

.home-lb-cat-btn {
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-alt, #f8fafc);
  color: var(--muted, #64748b);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.home-lb-cat-btn:hover {
  border-color: var(--primary, #059669);
  color: var(--text, #0f172a);
}

.home-lb-cat-btn.active {
  background: var(--primary, #059669);
  border-color: var(--primary, #059669);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

[data-theme="dark"] .home-lb-cat-btn,
body.dark-theme .home-lb-cat-btn,
html.dark-theme .home-lb-cat-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.09);
  color: #94a3b8;
}

[data-theme="dark"] .home-lb-cat-btn:hover,
body.dark-theme .home-lb-cat-btn:hover,
html.dark-theme .home-lb-cat-btn:hover {
  border-color: #38bdf8;
  color: #f8fafc;
}

[data-theme="dark"] .home-lb-cat-btn.active,
body.dark-theme .home-lb-cat-btn.active,
html.dark-theme .home-lb-cat-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
}

/* Một lưu ý nhỏ đặt sau phân trang diễn đàn */
.forum-guide-notice-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 16px;
  margin-top: 32px;
  border: 1px dashed var(--border, #cbd5e1);
  background: var(--bg-alt, #f8fafc);
}

.guide-notice-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(5, 150, 105, 0.1);
  color: var(--primary, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-notice-body {
  flex: 1;
}

.guide-notice-body .eyebrow {
  margin: 0 0 4px 0;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--primary, #059669);
  font-weight: 700;
}

.guide-notice-body h3 {
  margin: 0 0 6px 0;
  font-size: 16px;
  color: var(--text, #0f172a);
}

.guide-notice-body p {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

[data-theme="dark"] .forum-guide-notice-card,
body.dark-theme .forum-guide-notice-card,
html.dark-theme .forum-guide-notice-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .guide-notice-icon-box,
body.dark-theme .guide-notice-icon-box,
html.dark-theme .guide-notice-icon-box {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}

[data-theme="dark"] .guide-notice-body .eyebrow,
body.dark-theme .guide-notice-body .eyebrow,
html.dark-theme .guide-notice-body .eyebrow {
  color: #38bdf8;
}

[data-theme="dark"] .guide-notice-body h3,
body.dark-theme .guide-notice-body h3,
html.dark-theme .guide-notice-body h3 {
  color: #f8fafc;
}

/* Avatar Stack cạnh số thành viên */
.comm-stats-members-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  vertical-align: middle;
}

.comm-stats-posts-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.comm-hero-avatar-stack {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.comm-avatar-pill {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.95), rgba(226, 232, 240, 0.9));
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-left: -9px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.comm-avatar-pill:first-child {
  margin-left: 0;
  z-index: 10;
}

.comm-avatar-pill:hover {
  transform: scale(1.3) translateY(-3px);
  z-index: 30;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.25);
}

.comm-avatar-pill.is-creator {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.45), 0 3px 8px rgba(245, 158, 11, 0.3);
}

.comm-avatar-pill .creator-badge {
  position: absolute;
  bottom: -4px;
  right: -5px;
  font-size: 10px;
  line-height: 1;
}

.comm-avatar-pill.comm-avatar-more {
  background: linear-gradient(135deg, #334155, #1e293b);
  border-color: rgba(255, 255, 255, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  z-index: 1;
}

[data-theme="dark"] .comm-avatar-pill,
body.dark-theme .comm-avatar-pill {
  border-color: rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .comm-avatar-pill.is-creator,
body.dark-theme .comm-avatar-pill.is-creator {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(217, 119, 6, 0.25));
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.5), 0 4px 12px rgba(245, 158, 11, 0.4);
}

/* Nút hành động trên Banner Cộng đồng */
.btn-comm-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
  vertical-align: middle;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  white-space: nowrap;
}

.btn-comm-action.is-hidden,
.btn-comm-action[style*="display: none"] {
  display: none !important;
}

.btn-comm-action svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Trạng thái cộng đồng đã giải tán */
.comm-status-pill.is-dissolved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
}

[data-theme="dark"] .comm-status-pill.is-dissolved,
body.dark-theme .comm-status-pill.is-dissolved {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Trạng thái quyền riêng tư */
.community-privacy-pill.is-restricted {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .community-privacy-pill.is-restricted,
body.dark-theme .community-privacy-pill.is-restricted {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

/* Tối ưu hiển thị Modal tạo cộng đồng & các nút Công khai / Hạn chế / Riêng tư */
.privacy-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.privacy-options-grid-3 {
  grid-template-columns: repeat(3, 1fr) !important;
}

.privacy-option-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.privacy-option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.privacy-card-inner {
  border: 1.5px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--card-bg, #ffffff);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.privacy-card-header-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.privacy-icon-svg {
  color: var(--primary, #059669);
  display: flex;
  align-items: center;
}

.privacy-title-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0f172a);
  flex: 1;
}

.privacy-radio-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border, #cbd5e1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.privacy-radio-indicator::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.15s ease;
}

.privacy-desc-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted, #64748b);
}

.privacy-option-card:hover .privacy-card-inner {
  border-color: var(--primary, #059669);
  transform: translateY(-1px);
}

.privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner {
  border-color: var(--primary, #059669);
  background: rgba(5, 150, 105, 0.05);
  box-shadow: 0 0 0 1px var(--primary, #059669), 0 4px 12px rgba(5, 150, 105, 0.1);
}

.privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner .privacy-radio-indicator {
  border-color: var(--primary, #059669);
  background: var(--primary, #059669);
}

.privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner .privacy-radio-indicator::after {
  background: #ffffff;
}

[data-theme="dark"] .privacy-card-inner,
body.dark-theme .privacy-card-inner,
html.dark-theme .privacy-card-inner {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .privacy-title-text,
body.dark-theme .privacy-title-text,
html.dark-theme .privacy-title-text {
  color: #f8fafc;
}

[data-theme="dark"] .privacy-desc-text,
body.dark-theme .privacy-desc-text,
html.dark-theme .privacy-desc-text {
  color: #94a3b8;
}

[data-theme="dark"] .privacy-icon-svg,
body.dark-theme .privacy-icon-svg,
html.dark-theme .privacy-icon-svg {
  color: #38bdf8;
}

[data-theme="dark"] .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner,
body.dark-theme .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner,
html.dark-theme .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 1px #38bdf8, 0 4px 16px rgba(56, 189, 248, 0.15);
}

[data-theme="dark"] .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner .privacy-radio-indicator,
body.dark-theme .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner .privacy-radio-indicator,
html.dark-theme .privacy-option-card input[type="radio"]:checked ~ .privacy-card-inner .privacy-radio-indicator {
  border-color: #38bdf8;
  background: #38bdf8;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (HOMEPAGE LEADERBOARD & COMMUNITIES)
   ========================================================================== */

@media (max-width: 768px) {
  .home-leaderboard-section {
    padding: 0;
    margin: 24px 0 20px;
    width: 100%;
    max-width: 100%;
  }

  .home-lb-container {
    padding: 18px 16px 18px;
    border-radius: 20px;
  }

  .home-lb-header {
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 14px;
  }

  .home-lb-title {
    font-size: 22px;
    text-align: center;
  }

  .home-lb-subtitle {
    font-size: 13px;
  }

  .home-lb-period-tabs {
    width: 100%;
    display: flex;
  }

  .home-lb-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }

  .home-lb-cat-nav {
    padding-bottom: 14px;
    gap: 6px;
  }

  .home-lb-cat-btn {
    padding: 6px 14px;
    font-size: 12px;
  }

  .home-lb-podium-wrap .arena-top3-cards {
    gap: 6px !important;
    padding: 22px 0 0 !important;
    justify-content: center !important;
    width: 100% !important;
  }

  .home-lb-podium-wrap .arena-champion-card.mini-namecard.rank-1 {
    --mini-scale: 0.165 !important;
    width: calc(680px * var(--mini-scale)) !important;
    height: calc(760px * var(--mini-scale)) !important;
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }

  .home-lb-podium-wrap .arena-champion-card.mini-namecard.rank-2,
  .home-lb-podium-wrap .arena-champion-card.mini-namecard.rank-3 {
    --mini-scale: 0.138 !important;
    width: calc(680px * var(--mini-scale)) !important;
    height: calc(760px * var(--mini-scale)) !important;
    flex: 0 0 calc(680px * var(--mini-scale)) !important;
  }

  .privacy-options-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .privacy-options-grid-3 {
    grid-template-columns: 1fr !important;
  }

  .forum-guide-notice-card {
    padding: 16px;
    gap: 12px;
  }
}

/* ==========================================================================
   COMMUNITY MODALS & MANAGEMENT (MEMBERS, RULES, EDIT, DISSOLVE)
   ========================================================================== */

dialog.modal.comm-members-modal,
dialog.modal.comm-rules-modal,
dialog.modal.edit-community-modal,
dialog.modal.create-community-modal {
  max-width: 640px !important;
  width: min(640px, calc(100vw - 28px)) !important;
  max-height: min(88vh, 760px) !important;
  padding: 22px 24px !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

dialog.modal.comm-members-modal:not([open]),
dialog.modal.comm-rules-modal:not([open]),
dialog.modal.edit-community-modal:not([open]),
dialog.modal.create-community-modal:not([open]) {
  display: none !important;
}

#createCommunityForm,
#editCommunityForm {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  gap: 12px;
}

.comm-members-tabs-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--bg-alt, #f1f5f9);
  padding: 4px;
  border-radius: 12px;
  flex-shrink: 0;
}

.comm-members-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted, #64748b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.comm-members-tab.active {
  background: var(--card-bg, #ffffff);
  color: var(--text, #0f172a);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .comm-members-tabs-bar,
body.dark-theme .comm-members-tabs-bar,
html.dark-theme .comm-members-tabs-bar,
body:not(.christmas-effects-off) .comm-members-tabs-bar {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .comm-members-tab,
body.dark-theme .comm-members-tab,
html.dark-theme .comm-members-tab,
body:not(.christmas-effects-off) .comm-members-tab {
  color: #94a3b8;
}

[data-theme="dark"] .comm-members-tab:hover,
body.dark-theme .comm-members-tab:hover,
html.dark-theme .comm-members-tab:hover,
body:not(.christmas-effects-off) .comm-members-tab:hover {
  color: #f8fafc;
}

[data-theme="dark"] .comm-members-tab.active,
body.dark-theme .comm-members-tab.active,
html.dark-theme .comm-members-tab.active,
body:not(.christmas-effects-off) .comm-members-tab.active {
  background: #1e293b;
  color: #f8fafc;
}

.comm-members-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card-bg, #ffffff);
  padding: 8px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

[data-theme="dark"] .comm-members-search-wrap,
body.dark-theme .comm-members-search-wrap,
html.dark-theme .comm-members-search-wrap {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.comm-members-search-wrap svg {
  color: var(--muted, #64748b);
  flex-shrink: 0;
}

.comm-members-search-wrap input {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-size: 13px;
  width: 100%;
  outline: none;
  box-shadow: none !important;
}

[data-theme="dark"] .comm-members-search-wrap input,
body.dark-theme .comm-members-search-wrap input,
html.dark-theme .comm-members-search-wrap input {
  color: #f8fafc !important;
}

[data-theme="dark"] .comm-members-search-wrap input::placeholder,
body.dark-theme .comm-members-search-wrap input::placeholder,
html.dark-theme .comm-members-search-wrap input::placeholder {
  color: #94a3b8;
}

.comm-members-list-scroll {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  flex: 1;
  scrollbar-width: thin;
}

.comm-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card-bg, #ffffff);
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.15s ease;
}

.comm-member-cover-mini {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
}

.comm-member-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.comm-member-avatar-box {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border, #e2e8f0);
  background: var(--surface, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.comm-member-names {
  min-width: 0;
}

.comm-member-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.comm-member-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.comm-member-id-tag {
  font-size: 11px;
  color: var(--muted, #64748b);
  background: var(--bg-alt, #f1f5f9);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--sans);
}

.comm-member-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-perm-toggle {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--bg-alt, #f8fafc);
  color: var(--muted, #64748b);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-perm-toggle.active {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.4);
  color: #059669;
}

.btn-kick-member {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
  transition: all 0.15s ease;
}

.btn-kick-member:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Edit Community Modal & Rules Modal */
.comm-edit-notice-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #2563eb;
  font-size: 12px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.comm-rules-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text, #0f172a);
  background: var(--bg-alt, #f8fafc);
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border, #e2e8f0);
  white-space: pre-wrap;
  max-height: 340px;
  overflow-y: auto;
}

.comm-danger-zone {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.04);
}

.comm-danger-zone h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #dc2626;
  font-weight: 700;
}

.comm-danger-zone p {
  margin: 0 0 10px 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.45;
}

.btn-dissolve-community {
  border-color: #ef4444 !important;
  color: #dc2626 !important;
  font-weight: 600;
  padding: 7px 14px;
}

.btn-dissolve-community:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

html.dark-theme .comm-member-row,
body.dark-theme .comm-member-row,
[data-theme="dark"] .comm-member-row,
body:not(.christmas-effects-off) .comm-member-row {
  background: #111c2e;
  border-color: rgba(255, 255, 255, 0.08);
}

html.dark-theme .comm-member-name,
body.dark-theme .comm-member-name,
[data-theme="dark"] .comm-member-name,
body:not(.christmas-effects-off) .comm-member-name {
  color: #f8fafc;
}

html.dark-theme .comm-member-avatar-box,
body.dark-theme .comm-member-avatar-box,
[data-theme="dark"] .comm-member-avatar-box,
body:not(.christmas-effects-off) .comm-member-avatar-box {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.12);
}

html.dark-theme .comm-member-id-tag,
body.dark-theme .comm-member-id-tag,
[data-theme="dark"] .comm-member-id-tag,
body:not(.christmas-effects-off) .comm-member-id-tag {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

html.dark-theme .comm-rules-body,
body.dark-theme .comm-rules-body,
[data-theme="dark"] .comm-rules-body,
body:not(.christmas-effects-off) .comm-rules-body {
  background: #0d1522;
  border-color: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
}

html.dark-theme .comm-edit-notice-box,
body.dark-theme .comm-edit-notice-box,
[data-theme="dark"] .comm-edit-notice-box,
body:not(.christmas-effects-off) .comm-edit-notice-box {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

html.dark-theme .comm-danger-zone,
body.dark-theme .comm-danger-zone,
[data-theme="dark"] .comm-danger-zone,
body:not(.christmas-effects-off) .comm-danger-zone {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Dark theme overrides for community modal inputs and labels */
body.dark-theme #createCommunityModal .input,
html.dark-theme #createCommunityModal .input,
body.dark-theme #editCommunityModal .input,
html.dark-theme #editCommunityModal .input,
body.dark-theme #communityRulesModal textarea,
html.dark-theme #communityRulesModal textarea {
  background: #11161b !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #f1f5f9 !important;
}

body.dark-theme #createCommunityModal label,
html.dark-theme #createCommunityModal label,
body.dark-theme #editCommunityModal label,
html.dark-theme #editCommunityModal label,
body.dark-theme #communityRulesModal label,
html.dark-theme #communityRulesModal label {
  color: #e2e8f0 !important;
}

/* ==========================================================================
   MOBILE FORUM SUB-NAVIGATION (DIỄN ĐÀN CHUNG vs CỘNG ĐỒNG)
   ========================================================================== */

.mobile-forum-subnav {
  display: none;
}

@media (max-width: 860px) {
  .mobile-forum-subnav {
    display: flex;
    background: var(--bg-alt, #f1f5f9);
    padding: 4px;
    border-radius: 12px;
    gap: 6px;
    margin: 14px 0 18px;
    border: 1px solid var(--border, #e2e8f0);
    box-sizing: border-box;
  }

  [data-theme="dark"] .mobile-forum-subnav,
  body.dark-theme .mobile-forum-subnav,
  html.dark-theme .mobile-forum-subnav,
  body:not(.christmas-effects-off) .mobile-forum-subnav {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .mobile-subnav-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border-radius: 9px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted, #64748b);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  [data-theme="dark"] .mobile-subnav-btn,
  body.dark-theme .mobile-subnav-btn,
  html.dark-theme .mobile-subnav-btn,
  body:not(.christmas-effects-off) .mobile-subnav-btn {
    color: #94a3b8;
  }

  .mobile-subnav-btn.active {
    background: #ffffff;
    color: var(--primary, #059669);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  [data-theme="dark"] .mobile-subnav-btn.active,
  body.dark-theme .mobile-subnav-btn.active,
  html.dark-theme .mobile-subnav-btn.active,
  body:not(.christmas-effects-off) .mobile-subnav-btn.active {
    background: #1e293b;
    color: #38bdf8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  /* Phân nhánh hiển thị trên mobile theo subnav */
  #forum:not(.mobile-show-communities) .forum-layout > .forum-aside {
    display: none !important;
  }
  #forum:not(.mobile-show-communities) .forum-feed-col {
    display: block !important;
    width: 100% !important;
  }

  #forum.mobile-show-communities .forum-heading button#askFromForum {
    display: none !important;
  }
  #forum.mobile-show-communities .forum-tools,
  #forum.mobile-show-communities .filters,
  #forum.mobile-show-communities .forum-layout > .forum-feed-col {
    display: none !important;
  }
  #forum.mobile-show-communities .forum-layout > .forum-aside {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
  }
  #forum.mobile-show-communities .forum-layout {
    display: block !important;
  }
}

/* QUẢN TRỊ badge trong danh sách cộng đồng */
.btn-comm-join.is-admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.03em;
  user-select: none;
}

[data-theme="dark"] .btn-comm-join.is-admin-badge,
body.dark-theme .btn-comm-join.is-admin-badge,
html.dark-theme .btn-comm-join.is-admin-badge,
body:not(.christmas-effects-off) .btn-comm-join.is-admin-badge {
  background: rgba(245, 158, 11, 0.2) !important;
  color: #fbbf24 !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

/* Leaderboard units responsiveness: desktop vs mobile */
.lb-score-desktop {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lb-score-mobile {
  display: none;
  align-items: center;
  gap: 3px;
}

@media (max-width: 768px) {
  .lb-score-desktop {
    display: none !important;
  }
  .lb-score-mobile {
    display: inline-flex !important;
  }
}

/* Post Card Author Community Row */
.post-author-comm-row {
  display: inline-flex;
  align-items: center;
  margin-top: 3px;
  margin-bottom: 2px;
}

.post-author-comm-row .post-comm-tag {
  border-radius: 9999px;
  padding: 1.5px 7px;
  font-size: 10.5px;
  line-height: 1.3;
}

/* Post Detail Community Tag (beside share link button) */
.post-detail-community-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  font-weight: 600;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid rgba(14, 165, 233, 0.25);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  flex-shrink: 0;
}

.post-detail-community-tag:hover {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

.post-detail-community-tag.is-private {
  background: rgba(168, 85, 247, 0.1);
  color: #9333ea;
  border-color: rgba(168, 85, 247, 0.25);
}

.post-detail-community-tag.is-private:hover {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.4);
}

[data-theme="dark"] .post-detail-community-tag,
body.dark-theme .post-detail-community-tag,
html.dark-theme .post-detail-community-tag {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

[data-theme="dark"] .post-detail-community-tag.is-private,
body.dark-theme .post-detail-community-tag.is-private,
html.dark-theme .post-detail-community-tag.is-private {
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.3);
}

/* Mobile Community Action Buttons Override & Visibility */
.btn-comm-action span,
.btn-join-comm-hero span,
.btn-leave-comm span,
.comm-admin-tag-hero span,
.btn-comm-join span {
  display: inline !important;
}

.btn-join-comm-hero,
.btn-leave-comm,
.comm-admin-tag-hero {
  min-height: 32px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  white-space: nowrap !important;
  display: inline-flex;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
}

.btn-join-comm-hero[style*="display: none"],
.btn-leave-comm[style*="display: none"],
.comm-admin-tag-hero[style*="display: none"],
#btnCommJoinHero[style*="display: none"],
#btnCommLeaveHero[style*="display: none"],
#tagCommAdminHero[style*="display: none"] {
  display: none !important;
}

@media (max-width: 768px) {
  .community-hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .comm-hero-left-actions,
  .comm-hero-right-actions {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 0 !important;
  }
  .btn-join-comm-hero,
  .btn-leave-comm,
  .comm-admin-tag-hero {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }
  .comm-item-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .btn-comm-join {
    flex-shrink: 0;
    white-space: nowrap;
  }
}

/* ==========================================================================
   SITE-WIDE COMPACT FOOTER (FULL WIDTH, SLIM HEIGHT)
   ========================================================================== */
.site-footer {
  width: 100%;
  margin-top: auto;
  flex-shrink: 0;
  background: var(--card, #ffffff);
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  color: var(--muted, #64748b);
  font-size: 12.5px;
  line-height: 1.4;
  padding: 10px 84px 10px 28px;
  box-sizing: border-box;
  position: relative;
  z-index: 5;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.site-footer-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 24px;
}

.site-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  white-space: nowrap;
}

.site-footer-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.site-footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.site-footer-version {
  font-style: italic;
  color: var(--muted, #64748b);
  cursor: default;
  user-select: none;
  transition: color 0.15s ease;
}

.site-footer-version.is-clickable {
  cursor: pointer;
}

.site-footer-version.is-clickable:hover {
  color: var(--primary, #1e5d46);
  text-decoration: underline;
}

/* Dark mode */
[data-user-theme="dark"] .site-footer,
[data-user-theme="midnight"] .site-footer,
body.dark-theme .site-footer {
  background: #0d1319;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

[data-user-theme="dark"] .site-footer-version.is-clickable:hover,
[data-user-theme="midnight"] .site-footer-version.is-clickable:hover,
body.dark-theme .site-footer-version.is-clickable:hover {
  color: #38bdf8;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .site-footer {
    width: 100% !important;
    margin-top: auto !important;
    margin-bottom: 0 !important;
    padding: 12px 16px calc(84px + env(safe-area-inset-bottom, 0px)) 16px !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
    font-size: 11.5px;
  }

  .site-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .site-footer {
    font-size: 11px;
  }
  .site-footer-inner {
    font-size: 11px;
  }
}
