:root {
  --rp-sidebar-start: #fbf3bd;
  --rp-sidebar-end: #f4e29b;
  --rp-bg: #fefad2;
  --rp-surface: #fffdf0;
  --rp-surface-muted: #fff7d6;
  --rp-text: #4f4530;
  --rp-border: #eadf9d;
  --rp-card-shadow: 0 8px 24px rgba(122, 103, 34, 0.08);
  --rp-card-hover: 0 12px 28px rgba(122, 103, 34, 0.14);
  --rp-topbar: rgba(254, 250, 210, .94);
  --rp-layout-link: rgba(79, 69, 48, .92);
  --rp-layout-active: #5f4e11;
  --rp-focus-ring: rgba(217, 199, 106, .22);
  --rp-focus-border: #d9c76a;
}

[data-theme="dark"] {
  --rp-bg: #0f172a;
  --rp-text: #e5e7eb;
  --rp-border: #1f2937;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .35);
  --rp-topbar: rgba(17, 24, 39, .88);
}

body { background: var(--rp-bg); color: var(--rp-text); font-size: .95rem; }
.app-shell { min-height: 100vh; }
.left-layout { background: linear-gradient(180deg, var(--rp-sidebar-start), var(--rp-sidebar-end)); color: var(--rp-text); min-height: 100vh; border-right: 1px solid rgba(79, 69, 48, .08); }
.sidebar-scroll { flex: 1; overflow-y: auto; }
.main-layout { min-height: 100vh; background: var(--rp-bg); }
.brand { display: block; line-height: 1; }
.brand-logo-full { display: block; width: min(100%, 180px); height: auto; object-fit: contain; }
.brand-icon { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; box-shadow: 0 4px 12px rgba(122, 103, 34, .14); background: rgba(255, 255, 255, .45); }
.brand-icon-sm { width: 22px; height: 22px; border-radius: 7px; box-shadow: none; background: transparent; }
.layout-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .85px; opacity: .8; margin: 1rem 0 .7rem; }
.layout-link { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .62rem .72rem; margin-bottom: .32rem; border-radius: .62rem; color: var(--rp-layout-link); text-decoration: none; border: 1px solid transparent; transition: all .2s ease; }
.layout-link:hover { color: var(--rp-text); background: rgba(255,255,255,.45); border-color: var(--rp-border); }
.layout-link.active { color: var(--rp-layout-active); background: var(--rp-surface); font-weight: 600; }

.topbar { background: var(--rp-topbar); border-bottom: 1px solid var(--rp-border); position: sticky; top: 0; z-index: 1010; backdrop-filter: blur(8px); }
.soft-card { border: 1px solid var(--rp-border); border-radius: 14px; box-shadow: var(--rp-card-shadow); background: var(--rp-surface); transition: box-shadow .2s ease, transform .2s ease; }
[data-theme="dark"] .soft-card { background: var(--rp-surface); color: var(--rp-text); }
.soft-card:hover { box-shadow: var(--rp-card-hover); transform: translateY(-1px); }

.step-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .62rem; border-radius: 999px; background: #f7efbd; color: #745d11; font-size: .78rem; font-weight: 600; }
.result-box { border: 1px dashed #d8cb82; border-radius: .76rem; padding: .82rem .95rem; background: var(--rp-surface-muted); }
[data-theme="dark"] .result-box { background: var(--rp-surface-muted); border-color: var(--rp-border); }
.history-item { border: 1px solid var(--rp-border); border-radius: .72rem; padding: .72rem .8rem; background: var(--rp-surface); }
[data-theme="dark"] .history-item { background: var(--rp-surface-muted); }

.sidebar-footer {
  color: rgba(79, 69, 48, .82) !important;
  border-top-color: rgba(79, 69, 48, .16) !important;
}

.sidebar-footer .text-white,
.sidebar-footer .text-white-50,
.sidebar-footer a {
  color: inherit !important;
}

[data-theme="dark"] .sidebar-footer {
  color: rgba(229, 231, 235, .94) !important;
  border-top-color: rgba(229, 231, 235, .22) !important;
}

[data-theme="dark"] .sidebar-footer .opacity-75 {
  opacity: .95 !important;
}

[data-theme="dark"] .sidebar-footer a {
  color: #bfdbfe !important;
}

[data-theme="dark"] .sidebar-footer a:hover {
  color: #dbeafe !important;
  text-decoration: underline !important;
}

.main-layout .card,
.main-layout .modal-content,
.main-layout .dropdown-menu,
.main-layout .offcanvas,
.main-layout .list-group-item {
  background: var(--rp-surface);
  border-color: var(--rp-border);
}

.main-layout .bg-light,
.main-layout .text-bg-light,
.main-layout .table-light {
  background-color: var(--rp-surface-muted) !important;
  color: var(--rp-text) !important;
}

.main-layout .form-control,
.main-layout .form-select,
.main-layout .input-group-text {
  background-color: #fffef7;
  border-color: var(--rp-border);
  color: var(--rp-text);
}

.main-layout .form-control:focus,
.main-layout .form-select:focus {
  border-color: var(--rp-focus-border);
  box-shadow: 0 0 0 .25rem var(--rp-focus-ring);
}

.main-layout .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255, 255, 255, .35);
  --bs-table-hover-bg: rgba(255, 255, 255, .5);
  border-color: var(--rp-border);
}

.rp-loading-overlay { position: fixed; inset: 0; background: rgba(16,24,40,.45); backdrop-filter: blur(3px); z-index: 1055; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.rp-loading-overlay.show { opacity: 1; pointer-events: all; }
.rp-loading-card { width: min(92vw, 360px); border-radius: 16px; background: var(--rp-surface); box-shadow: 0 18px 40px rgba(0,0,0,.25); padding: 1rem 1.1rem; }
.rp-loader { width: 100%; height: 6px; border-radius: 999px; background: #e8eef8; position: relative; overflow: hidden; }
.rp-loader::after { content: ''; position: absolute; top: 0; left: -35%; width: 35%; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #0d6efd, #3f8cff); animation: rp-slide 1s ease-in-out infinite; }
@keyframes rp-slide { 0% { left: -35%; } 100% { left: 100%; } }

.rp-toast-stack { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 1080; max-width: min(92vw, 360px); }
.rp-toast { border-radius: 12px; padding: 10px 12px; color: #fff; box-shadow: 0 10px 28px rgba(0,0,0,.2); opacity: 1; transform: translateY(0); transition: opacity 2s ease, transform 2s ease; }
.rp-toast.success { background: #15803d; }
.rp-toast.error { background: #b91c1c; }
.rp-toast.info { background: #1d4ed8; }
.rp-toast.fading { opacity: 0; transform: translateY(8px); }

.rp-swal-popup {
  border-radius: 18px !important;
  border: 1px solid var(--rp-border) !important;
  background: var(--rp-surface) !important;
  color: var(--rp-text) !important;
  box-shadow: var(--rp-card-hover) !important;
  padding-top: 1rem !important;
}
.rp-swal-title {
  color: var(--rp-text) !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
}
.rp-swal-content {
  color: var(--rp-text) !important;
  font-size: .95rem !important;
  line-height: 1.55 !important;
}
.rp-swal-confirm,
.rp-swal-cancel {
  border-radius: 10px !important;
  padding: .45rem .9rem !important;
  min-width: 96px;
}
.rp-swal-show { animation: rp-swal-in .16s ease-out both; }
.rp-swal-hide { animation: rp-swal-out .14s ease-in both; }
@keyframes rp-swal-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rp-swal-out { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-6px) scale(.985); } }
[data-theme="dark"] .swal2-popup { background: var(--rp-surface) !important; color: var(--rp-text) !important; }
[data-theme="dark"] .swal2-title,
[data-theme="dark"] .swal2-html-container { color: var(--rp-text) !important; }
[data-theme="dark"] .swal2-icon.swal2-warning { border-color: #f59e0b !important; color: #f59e0b !important; }
[data-theme="dark"] .swal2-icon.swal2-success [class^='swal2-success-line'] { background-color: #22c55e !important; }
[data-theme="dark"] .swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(34, 197, 94, .35) !important; }

.rp-mini-game-fab {
  position: fixed;
  right: 16px;
  bottom: 18px;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  border: 1px solid rgba(13,110,253,.25);
  background: var(--rp-surface);
  color: #0d6efd;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  z-index: 1081;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.rp-mini-game-menu {
  min-width: 320px;
}
.rp-mini-game-menu .dropdown-item {
  display: flex;
  align-items: center;
}
[data-theme="dark"] .rp-mini-game-fab {
  background: rgba(17,24,39,.92);
  border-color: rgba(59,130,246,.3);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
}
.rp-mini-game-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(0,0,0,.22);
}
.rp-mini-game-fab:active {
  transform: translateY(0);
}
.rp-mini-game-fab__ring {
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 6px solid rgba(13,110,253,.25);
  border-top-color: rgba(13,110,253,.95);
  animation: rp-mini-game-spin 1.1s linear infinite;
  pointer-events: none;
}
@keyframes rp-mini-game-spin { to { transform: rotate(360deg); } }

.rp-mini-game-list {
  display: grid;
  gap: 12px;
}
.rp-mini-game-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.rp-mini-game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.rp-mini-game-progress {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5edf7;
}
.rp-mini-game-progress .progress-bar {
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transition: width .28s ease;
}
.rp-mini-game-card {
  border: 1px solid var(--rp-border);
  border-radius: 14px;
  padding: 14px;
  background: var(--rp-surface);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
[data-theme="dark"] .rp-mini-game-card {
  background: #0b1220;
}
.rp-mini-game-card.is-correct {
  border-color: rgba(22, 163, 74, .55);
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .2);
  animation: rp-mini-game-pop .24s ease;
}
.rp-mini-game-card.is-wrong {
  border-color: rgba(220, 38, 38, .45);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .15);
  animation: rp-mini-game-shake .24s ease;
}
.rp-mini-game-sentence {
  font-size: 1rem;
  font-weight: 600;
}
.rp-mini-game-translation {
  color: #6b7280;
  font-size: .92rem;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(59, 130, 246, .08);
}
[data-theme="dark"] .rp-mini-game-translation {
  color: #9ca3af;
  background: rgba(59, 130, 246, .12);
}
.rp-mini-game-answer {
  font-size: .85rem;
}
.rp-mini-game-hint-btn {
  flex-shrink: 0;
}
.rp-mini-game-summary {
  padding: 10px 4px;
}
.rp-mini-game-summary-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: #f59e0b;
  background: rgba(245, 158, 11, .12);
}
.rp-mini-game-summary-stat {
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--rp-surface);
}
[data-theme="dark"] .rp-mini-game-summary-stat {
  background: #0b1220;
}
.rp-mini-game-leaderboard {
  border: 1px solid var(--rp-border);
  border-radius: 14px;
  padding: 12px;
  background: var(--rp-surface);
}
[data-theme="dark"] .rp-mini-game-leaderboard {
  background: #0b1220;
}
.rp-mini-game-leaderboard .table th,
.rp-mini-game-leaderboard .table td {
  white-space: nowrap;
}
.rp-mini-game-leaderboard tbody tr.is-current-user {
  background: rgba(37, 99, 235, .08);
}
[data-theme="dark"] .rp-mini-game-leaderboard tbody tr.is-current-user {
  background: rgba(59, 130, 246, .12);
}
.rp-mini-game-input-shake {
  animation: rp-mini-game-shake .24s ease;
}
.rp-mini-game-summary {
  position: relative;
  overflow: hidden;
}
.rp-mini-game-confetti {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  animation: rp-mini-game-confetti-fall 1.6s ease-in forwards;
}
.rp-mini-game-animate-in {
  animation: rp-mini-game-fade-in .2s ease;
}

.rp-mini-game-reaction-overlay {
  position: fixed;
  right: 18px;
  bottom: 138px;
  z-index: 1095;
  width: 180px;
  max-width: 38vw;
  opacity: 0;
  transform: translateY(10px) scale(.96);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.rp-mini-game-reaction-overlay.is-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.rp-mini-game-reaction-image {
  display: block;
  width: 100%;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,.9);
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
  background: #fff;
}

.rp-mini-game-reaction-overlay.is-correct .rp-mini-game-reaction-image {
  border-color: rgba(22,163,74,.9);
}

.rp-mini-game-reaction-overlay.is-wrong .rp-mini-game-reaction-image {
  border-color: rgba(220,38,38,.9);
}

@keyframes rp-mini-game-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rp-mini-game-pop {
  0% { transform: scale(.985); }
  60% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

@keyframes rp-mini-game-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

@keyframes rp-mini-game-confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(180px) rotate(240deg);
  }
}

.paired-word { display: block; width: 100%; padding: .25rem .35rem; border-radius: .4rem; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.paired-word.active-en { background: #dbeafe; color: #1e3a8a; }
.paired-word.active-vi { background: #dcfce7; color: #166534; }

.pairing-word-wrap { position: relative; display: inline-flex; align-items: center; gap: .35rem; }
.save-word-inline { display: inline-flex; padding: .12rem .35rem; font-size: .7rem; line-height: 1; }

.pairing-board { border: 1px dashed #cad7ea; border-radius: .7rem; background: #fff; overflow: hidden; }
.pairing-head, .pairing-row { display: grid; grid-template-columns: 1fr 1fr; }
.pairing-head { background: #f8fbff; border-bottom: 1px solid #e5edf7; font-size: .8rem; color: #6b7280; font-weight: 600; }
.pairing-head>div, .pairing-row>div { padding: .5rem .65rem; }
.pairing-row { border-bottom: 1px solid #eef3fa; }
.pairing-row:last-child { border-bottom: 0; }
.pairing-row>div:first-child, .pairing-head>div:first-child { border-right: 1px solid #eef3fa; }

@media (max-width: 1199.98px) {
  .brand-logo-full { width: min(100%, 160px); }
  .topbar { padding-top: .8rem !important; padding-bottom: .8rem !important; }
  .soft-card { border-radius: 12px; }
}

@media (max-width: 991.98px) {
  .left-layout { min-height: auto; }
  .sidebar-scroll { overflow-y: visible; }
  .layout-title { margin-top: .75rem; margin-bottom: .5rem; }
  .layout-link { padding: .55rem .65rem; margin-bottom: .25rem; font-size: .92rem; }
  .main-layout { min-height: auto; }
  .topbar { position: static; backdrop-filter: none; }
  .soft-card:hover { transform: none; }
  .rp-mini-game-fab { right: 14px; bottom: 14px; width: 70px; height: 70px; }
  .rp-mini-game-fab__ring { border-width: 5px; }
}

@media (max-width: 767.98px) {
  body { font-size: .92rem; }
  .app-shell > .row { --bs-gutter-x: 0; }
  .topbar { padding-right: 4.25rem !important; }
  .topbar h1 { font-size: 1.05rem; }
  .topbar .btn { padding: .28rem .55rem; }
  .pairing-head,
  .pairing-row { grid-template-columns: 1fr; }
  .pairing-row > div:first-child,
  .pairing-head > div:first-child { border-right: 0; border-bottom: 1px solid #eef3fa; }
  .table { font-size: .88rem; }
  .table .btn { white-space: nowrap; }
  .rp-toast-stack { right: 10px; bottom: 10px; max-width: calc(100vw - 20px); }
  .rp-mini-game-fab { right: 8px; bottom: 8px; width: 58px; height: 58px; }
  .rp-mini-game-fab__ring { border-width: 4px; }
}

@media (max-width: 575.98px) {
  .topbar { padding-right: 4.75rem !important; }
  .rp-mini-game-fab { right: 8px; bottom: 8px; width: 54px; height: 54px; }
  .rp-mini-game-fab i { font-size: 1rem; }
}

@media (max-width: 575.98px) {
  .container-fluid.app-shell,
  .main-layout .p-3,
  .main-layout .p-md-4 { padding-left: .75rem !important; padding-right: .75rem !important; }
  .brand-logo-full { width: min(100%, 140px); }
  .layout-link { font-size: .9rem; }
  .rp-mini-game-toolbar { flex-direction: column; }
  .rp-mini-game-meta { width: 100%; justify-content: space-between; }
  .rp-mini-game-fab { right: 10px; bottom: 10px; width: 64px; height: 64px; }
  .rp-mini-game-fab i { font-size: 1.1rem; }
}

/* --- Professional dark-mode readability overrides --- */
[data-theme="dark"] body,
[data-theme="dark"] .main-layout {
  color: var(--rp-text);
}

[data-theme="dark"] .main-layout .card,
[data-theme="dark"] .main-layout .soft-card,
[data-theme="dark"] .main-layout .modal-content,
[data-theme="dark"] .main-layout .dropdown-menu,
[data-theme="dark"] .main-layout .offcanvas,
[data-theme="dark"] .main-layout .list-group-item,
[data-theme="dark"] .main-layout .table,
[data-theme="dark"] .main-layout .table > :not(caption) > * > *,
[data-theme="dark"] .main-layout .form-control,
[data-theme="dark"] .main-layout .form-select,
[data-theme="dark"] .main-layout .input-group-text,
[data-theme="dark"] .main-layout textarea.form-control,
[data-theme="dark"] .main-layout .btn,
[data-theme="dark"] .main-layout .badge,
[data-theme="dark"] .main-layout .nav-link,
[data-theme="dark"] .main-layout .text-body,
[data-theme="dark"] .main-layout .text-dark {
  color: var(--rp-text);
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .small.text-muted {
  color: #9ca3af !important;
}

[data-theme="dark"] .topbar,
[data-theme="dark"] .soft-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .offcanvas,
[data-theme="dark"] .list-group-item,
[data-theme="dark"] .card {
  background: var(--rp-surface) !important;
  border-color: var(--rp-border) !important;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table > :not(caption) > * > * {
  color: #e5e7eb;
  border-color: var(--rp-border) !important;
}

[data-theme="dark"] .table-light,
[data-theme="dark"] .main-layout .table-light,
[data-theme="dark"] .table thead th,
[data-theme="dark"] .table thead td {
  background: #1f2937 !important;
  color: #e5e7eb !important;
}

[data-theme="dark"] .main-layout .form-control,
[data-theme="dark"] .main-layout .form-select,
[data-theme="dark"] .main-layout .input-group-text,
[data-theme="dark"] textarea.form-control,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .input-group-text,
[data-theme="dark"] textarea {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

[data-theme="dark"] .main-layout .form-control::placeholder,
[data-theme="dark"] .main-layout .form-select::placeholder,
[data-theme="dark"] textarea.form-control::placeholder {
  color: #9ca3af !important;
}

[data-theme="dark"] .main-layout .form-control:focus,
[data-theme="dark"] .main-layout .form-select:focus,
[data-theme="dark"] textarea.form-control:focus {
  background: #111827 !important;
  color: #f3f4f6 !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .2) !important;
}

[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-danger,
[data-theme="dark"] .btn-outline-success,
[data-theme="dark"] .btn-outline-warning {
  border-color: #4b5563;
  color: #e5e7eb;
  background: transparent;
}

[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-danger:hover,
[data-theme="dark"] .btn-outline-success:hover,
[data-theme="dark"] .btn-outline-warning:hover {
  color: #fff;
}

[data-theme="dark"] .badge.text-bg-light,
[data-theme="dark"] .badge.bg-light,
[data-theme="dark"] .text-bg-light {
  background: #1f2937 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

[data-theme="dark"] .alert,
[data-theme="dark"] .alert-warning,
[data-theme="dark"] .alert-info,
[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-success {
  background: #111827;
  border-color: #334155;
  color: #e5e7eb;
}

[data-theme="dark"] .paired-word,
[data-theme="dark"] .learned-word,
[data-theme="dark"] .alignment-word-note {
  color: #e5e7eb !important;
}
[data-theme="dark"] .paired-word.active-en {
  background: rgba(59, 130, 246, .22) !important;
  color: #dbeafe !important;
}
[data-theme="dark"] .paired-word.active-vi {
  background: rgba(34, 197, 94, .18) !important;
  color: #dcfce7 !important;
}
[data-theme="dark"] .pairing-head {
  background: #111827 !important;
  color: #e5e7eb !important;
}
[data-theme="dark"] .pairing-board {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .pairing-row,
[data-theme="dark"] .pairing-head > div,
[data-theme="dark"] .pairing-row > div {
  border-color: #334155 !important;
}

[data-theme="dark"] .alert-warning {
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .15);
}
[data-theme="dark"] .alert-info {
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .15);
}
[data-theme="dark"] .alert-danger {
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .15);
}

[data-theme="dark"] .rp-profile-page .border,
[data-theme="dark"] .rp-profile-page .rounded-4,
[data-theme="dark"] .rp-profile-page .rounded-3,
[data-theme="dark"] .rp-marked-words-page .border,
[data-theme="dark"] .rp-marked-words-page .rounded-4,
[data-theme="dark"] .rp-marked-words-page .rounded-3 {
  border-color: #334155 !important;
}

[data-theme="dark"] .rp-profile-page .text-muted,
[data-theme="dark"] .rp-marked-words-page .text-muted {
  color: #9ca3af !important;
}

[data-theme="dark"] .rp-profile-page .table-light,
[data-theme="dark"] .rp-marked-words-page .table-light {
  background: #1f2937 !important;
  color: #e5e7eb !important;
}

[data-theme="dark"] .rp-profile-page .table td,
[data-theme="dark"] .rp-profile-page .table th,
[data-theme="dark"] .rp-marked-words-page .table td,
[data-theme="dark"] .rp-marked-words-page .table th {
  color: #e5e7eb !important;
}

[data-theme="dark"] .rp-marked-words-page textarea.form-control {
  background: #111827 !important;
  color: #e5e7eb !important;
  border-color: #374151 !important;
}

[data-theme="dark"] .rp-marked-words-page .text-body,
[data-theme="dark"] .rp-marked-words-page .text-dark {
  color: #e5e7eb !important;
}

/* --- Accent palettes (light) --- */
[data-theme="light"][data-accent="ocean"] {
  --rp-sidebar-start: #dbeafe;
  --rp-sidebar-end: #93c5fd;
  --rp-bg: #eff6ff;
  --rp-surface: #ffffff;
  --rp-surface-muted: #e0f2fe;
  --rp-text: #1e3a5f;
  --rp-border: #bfdbfe;
  --rp-card-shadow: 0 8px 24px rgba(37, 99, 235, 0.1);
  --rp-card-hover: 0 12px 28px rgba(37, 99, 235, 0.16);
  --rp-topbar: rgba(239, 246, 255, .94);
  --rp-layout-link: rgba(30, 58, 95, .9);
  --rp-layout-active: #1d4ed8;
  --rp-focus-ring: rgba(59, 130, 246, .22);
  --rp-focus-border: #3b82f6;
}

[data-theme="light"][data-accent="forest"] {
  --rp-sidebar-start: #d1fae5;
  --rp-sidebar-end: #6ee7b7;
  --rp-bg: #ecfdf5;
  --rp-surface: #ffffff;
  --rp-surface-muted: #d1fae5;
  --rp-text: #14532d;
  --rp-border: #a7f3d0;
  --rp-card-shadow: 0 8px 24px rgba(22, 163, 74, 0.1);
  --rp-card-hover: 0 12px 28px rgba(22, 163, 74, 0.16);
  --rp-topbar: rgba(236, 253, 245, .94);
  --rp-layout-link: rgba(20, 83, 45, .9);
  --rp-layout-active: #15803d;
  --rp-focus-ring: rgba(34, 197, 94, .22);
  --rp-focus-border: #22c55e;
}

[data-theme="light"][data-accent="lavender"] {
  --rp-sidebar-start: #ede9fe;
  --rp-sidebar-end: #c4b5fd;
  --rp-bg: #f5f3ff;
  --rp-surface: #ffffff;
  --rp-surface-muted: #ede9fe;
  --rp-text: #4c1d95;
  --rp-border: #ddd6fe;
  --rp-card-shadow: 0 8px 24px rgba(124, 58, 237, 0.1);
  --rp-card-hover: 0 12px 28px rgba(124, 58, 237, 0.16);
  --rp-topbar: rgba(245, 243, 255, .94);
  --rp-layout-link: rgba(76, 29, 149, .88);
  --rp-layout-active: #6d28d9;
  --rp-focus-ring: rgba(139, 92, 246, .22);
  --rp-focus-border: #8b5cf6;
}

[data-theme="light"][data-accent="coral"] {
  --rp-sidebar-start: #ffe4e6;
  --rp-sidebar-end: #fda4af;
  --rp-bg: #fff1f2;
  --rp-surface: #ffffff;
  --rp-surface-muted: #ffe4e6;
  --rp-text: #881337;
  --rp-border: #fecdd3;
  --rp-card-shadow: 0 8px 24px rgba(225, 29, 72, 0.1);
  --rp-card-hover: 0 12px 28px rgba(225, 29, 72, 0.16);
  --rp-topbar: rgba(255, 241, 242, .94);
  --rp-layout-link: rgba(136, 19, 55, .88);
  --rp-layout-active: #e11d48;
  --rp-focus-ring: rgba(244, 63, 94, .22);
  --rp-focus-border: #f43f5e;
}

[data-theme="light"][data-accent="slate"] {
  --rp-sidebar-start: #e2e8f0;
  --rp-sidebar-end: #cbd5e1;
  --rp-bg: #f1f5f9;
  --rp-surface: #ffffff;
  --rp-surface-muted: #e2e8f0;
  --rp-text: #1e293b;
  --rp-border: #cbd5e1;
  --rp-card-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --rp-card-hover: 0 12px 28px rgba(15, 23, 42, 0.12);
  --rp-topbar: rgba(241, 245, 249, .94);
  --rp-layout-link: rgba(30, 41, 59, .88);
  --rp-layout-active: #334155;
  --rp-focus-ring: rgba(100, 116, 139, .22);
  --rp-focus-border: #64748b;
}

/* --- Accent palettes (dark) --- */
[data-theme="dark"][data-accent="warm"] {
  --rp-sidebar-start: #3a3318;
  --rp-sidebar-end: #252010;
  --rp-bg: #0f172a;
  --rp-text: #e5e7eb;
  --rp-border: #334155;
  --rp-surface: #111827;
  --rp-surface-muted: #1e293b;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .35);
  --rp-topbar: rgba(17, 24, 39, .88);
  --rp-layout-link: rgba(253, 230, 138, .88);
  --rp-layout-active: #fde68a;
  --rp-focus-ring: rgba(250, 204, 21, .2);
  --rp-focus-border: #ca8a04;
}

[data-theme="dark"][data-accent="ocean"] {
  --rp-sidebar-start: #1e3a5f;
  --rp-sidebar-end: #0f172a;
  --rp-bg: #0c1222;
  --rp-text: #e2e8f0;
  --rp-border: #1e3a5f;
  --rp-surface: #0f172a;
  --rp-surface-muted: #172554;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .38);
  --rp-topbar: rgba(15, 23, 42, .9);
  --rp-layout-link: rgba(147, 197, 253, .9);
  --rp-layout-active: #93c5fd;
  --rp-focus-ring: rgba(59, 130, 246, .25);
  --rp-focus-border: #3b82f6;
}

[data-theme="dark"][data-accent="forest"] {
  --rp-sidebar-start: #14532d;
  --rp-sidebar-end: #0f172a;
  --rp-bg: #0c1a12;
  --rp-text: #e2e8f0;
  --rp-border: #166534;
  --rp-surface: #0f1f17;
  --rp-surface-muted: #14532d;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .38);
  --rp-topbar: rgba(15, 31, 23, .9);
  --rp-layout-link: rgba(167, 243, 208, .88);
  --rp-layout-active: #86efac;
  --rp-focus-ring: rgba(34, 197, 94, .22);
  --rp-focus-border: #22c55e;
}

[data-theme="dark"][data-accent="lavender"] {
  --rp-sidebar-start: #4c1d95;
  --rp-sidebar-end: #1e1b4b;
  --rp-bg: #0f0a1a;
  --rp-text: #e9d5ff;
  --rp-border: #5b21b6;
  --rp-surface: #1a1033;
  --rp-surface-muted: #2e1065;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .38);
  --rp-topbar: rgba(26, 16, 51, .92);
  --rp-layout-link: rgba(216, 180, 254, .9);
  --rp-layout-active: #d8b4fe;
  --rp-focus-ring: rgba(168, 85, 247, .25);
  --rp-focus-border: #a855f7;
}

[data-theme="dark"][data-accent="coral"] {
  --rp-sidebar-start: #881337;
  --rp-sidebar-end: #1c0a10;
  --rp-bg: #14080f;
  --rp-text: #fce7f3;
  --rp-border: #9f1239;
  --rp-surface: #1c0f16;
  --rp-surface-muted: #4c0519;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .38);
  --rp-topbar: rgba(28, 15, 22, .92);
  --rp-layout-link: rgba(251, 207, 232, .88);
  --rp-layout-active: #fbcfe8;
  --rp-focus-ring: rgba(244, 63, 94, .22);
  --rp-focus-border: #fb7185;
}

[data-theme="dark"][data-accent="slate"] {
  --rp-sidebar-start: #334155;
  --rp-sidebar-end: #0f172a;
  --rp-bg: #0b1120;
  --rp-text: #e2e8f0;
  --rp-border: #334155;
  --rp-surface: #111827;
  --rp-surface-muted: #1e293b;
  --rp-card-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  --rp-card-hover: 0 12px 28px rgba(0, 0, 0, .38);
  --rp-topbar: rgba(17, 24, 39, .92);
  --rp-layout-link: rgba(203, 213, 225, .88);
  --rp-layout-active: #f1f5f9;
  --rp-focus-ring: rgba(148, 163, 184, .22);
  --rp-focus-border: #94a3b8;
}

/* Theme picker */
.rp-theme-picker {
  min-width: 240px;
}

.rp-accent-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, .12);
  padding: 0;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  flex-shrink: 0;
}

.rp-accent-swatch:hover {
  transform: scale(1.08);
}

.rp-accent-swatch.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--bs-primary, #0d6efd);
}

[data-theme="dark"] .rp-accent-swatch {
  border-color: rgba(255, 255, 255, .2);
}

[data-theme="dark"] .rp-accent-swatch.is-active {
  box-shadow: 0 0 0 2px #0f172a, 0 0 0 4px var(--bs-primary, #3b82f6);
}

.rp-accent-swatch--warm { background: linear-gradient(135deg, #fbf3bd, #f4e29b); }
.rp-accent-swatch--ocean { background: linear-gradient(135deg, #dbeafe, #3b82f6); }
.rp-accent-swatch--forest { background: linear-gradient(135deg, #d1fae5, #22c55e); }
.rp-accent-swatch--lavender { background: linear-gradient(135deg, #ede9fe, #8b5cf6); }
.rp-accent-swatch--coral { background: linear-gradient(135deg, #ffe4e6, #fb7185); }
.rp-accent-swatch--slate { background: linear-gradient(135deg, #e2e8f0, #64748b); }
