/* Trang chủ, thanh công cụ và các trang bên cạnh của Quiz Master. */
:root {
  --workspace-paper: #fff;
  --workspace-bg: #f6f8fc;
  --workspace-ink: #17172b;
  --workspace-muted: #5d687e;
  --workspace-line: #dce3ee;
  --workspace-purple: #7834c8;
  --workspace-lavender: #f1e7fc;
  --workspace-rail: 226px;
  --workspace-bar: 76px;
  --workspace-gutter: clamp(18px, 3vw, 42px);
  --workspace-shadow: 0 2px 5px #263a6310;
  --workspace-inset: #edf1f8;
  --workspace-hover: #fcf9ff;
  --workspace-strong: #6026a6;
  --workspace-danger: #ad2143;
  --workspace-positive: #087743;
}

:root[data-workspace-mode="dark"] {
  color-scheme: dark;
  --workspace-paper: #1c2031;
  --workspace-bg: #141727;
  --workspace-ink: #f1effa;
  --workspace-muted: #b5bdd3;
  --workspace-line: #373e55;
  --workspace-purple: #bd93fb;
  --workspace-lavender: #33234d;
  --workspace-inset: #242b40;
  --workspace-hover: #293047;
  --workspace-strong: #ddc6ff;
  --workspace-danger: #fda4af;
  --workspace-positive: #86e8ba;
  --workspace-shadow: 0 2px 8px #080a1450;
}

:root[data-workspace-mode="dark"] .workspace-coins {
  background: #362a1b;
  color: #ffcf7a;
}

:root[data-workspace-mode="dark"] .workspace-gems {
  background: #14314a;
  color: #9bdfff;
}

body.workspace-page {
  background-color: var(--workspace-bg) !important;
  color: var(--workspace-ink) !important;
}

:where(.workspace-header, .workspace-layout, .workspace-notifications),
:where(.workspace-header, .workspace-layout, .workspace-notifications) * {
  font-family: "Nunito", "Noto Sans", sans-serif !important;
}

:where(.workspace-header, .workspace-layout, .workspace-notifications) [hidden] {
  display: none !important;
}

:where(.workspace-header, .workspace-layout, .workspace-notifications) :focus-visible {
  outline: 2px solid var(--workspace-purple);
  outline-offset: 3px;
}

.workspace-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: var(--workspace-rail) minmax(0, 1fr);
  min-height: var(--workspace-bar);
  border-bottom: 1px solid var(--workspace-line);
  background: var(--workspace-paper);
  color: var(--workspace-ink);
}

body.in-quiz .workspace-header,
body.in-exam-mode .workspace-header {
  display: none;
}

.workspace-brand {
  display: flex;
  align-items: center;
  padding-inline: 18px;
  border-right: 1px solid var(--workspace-line);
}

.workspace-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--workspace-ink);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
}

.workspace-logo img {
  border-radius: 11px;
  object-fit: contain;
}

.workspace-logo strong {
  display: block;
  margin-top: 4px;
  color: var(--workspace-purple);
  font-size: 13px;
  letter-spacing: .03em;
}

.workspace-toolbar,
.workspace-tools,
.workspace-account {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.workspace-toolbar {
  justify-content: space-between;
  gap: clamp(12px, 2vw, 26px);
  padding: 8px var(--workspace-gutter);
}

.workspace-search {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 520px;
  min-height: 44px;
  padding-inline: 13px;
  border: 1px solid var(--workspace-line);
  border-radius: 13px;
  background: var(--workspace-bg);
  color: var(--workspace-muted);
}

.workspace-search:focus-within {
  border-color: var(--workspace-purple);
}

.workspace-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--workspace-ink);
  font-size: 15px;
  font-weight: 700;
}

.workspace-search input:focus-visible {
  outline: 0;
}

.workspace-tools {
  justify-content: flex-end;
  margin-left: auto;
}

.workspace-tool,
.workspace-balance {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border: 1px solid var(--workspace-line);
  border-radius: 12px;
  background: var(--workspace-paper);
  color: var(--workspace-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.workspace-tool {
  cursor: pointer;
}

.workspace-tool:hover {
  border-color: #cdb1f0;
  background: var(--workspace-lavender);
}

.workspace-tool .ui-icon,
.workspace-balance .ui-icon {
  width: 21px;
  height: 21px;
}

.workspace-balance {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.workspace-coins {
  background: #fffbec;
  color: #8a510b;
}

.workspace-coins #coinNum {
  color: inherit !important;
}

.workspace-gems {
  background: #eefaff;
  color: #096a92;
}

.workspace-bell {
  position: relative;
}

.workspace-bell #headerBellBadge {
  border-color: var(--workspace-paper);
}

.workspace-avatar {
  padding: 2px;
  border-radius: 50%;
  background: var(--workspace-lavender);
}

.workspace-avatar img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
}

.workspace-account-info {
  min-width: 0;
  max-width: 157px;
  font-size: 13px;
}

.workspace-account-info .u-name {
  color: var(--workspace-ink);
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.workspace-account-info :is(.vip-upgrade-badge, .vip-royal-badge) {
  margin: 0 0 0 4px;
  padding: 2px 5px;
  background: var(--workspace-lavender);
  color: var(--workspace-strong);
  border-color: var(--workspace-line);
  font-size: 8px;
  box-shadow: none;
  animation: none;
}

.workspace-account-info #deviceIdDisplay {
  margin: 2px 0 0;
  padding: 2px 5px !important;
  border-color: var(--workspace-line) !important;
  background: var(--workspace-bg) !important;
  color: var(--workspace-muted) !important;
  font-size: 10px !important;
}

.workspace-layout {
  display: grid;
  grid-template-columns: var(--workspace-rail) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100dvh - var(--workspace-bar));
  background: var(--workspace-bg);
}

.workspace-sidebar {
  position: sticky;
  top: var(--workspace-bar);
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: calc(100dvh - var(--workspace-bar));
  padding: 22px 12px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--workspace-line);
  background: var(--workspace-paper);
}

.workspace-sidebar nav {
  display: grid;
  gap: 5px;
}

.workspace-sidebar-tools {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--workspace-line);
}

.workspace-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--workspace-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.workspace-nav .ui-icon {
  width: 22px;
  height: 22px;
}

.workspace-nav:hover,
.workspace-nav[aria-current="page"] {
  background: var(--workspace-lavender);
  color: var(--workspace-strong);
}

.workspace-nav-count {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 16px;
  background: #fce7ef;
  color: #9f1745;
  font-size: 11px;
  font-weight: 900;
}

.workspace-drawer-heading,
.workspace-mobile-menu,
.workspace-collapse,
.workspace-scrim {
  display: none;
}

@media (min-width: 861px) {
  .workspace-collapse {
    display: flex;
    border-top: 1px solid var(--workspace-line);
    border-radius: 0;
  }

  :root[data-workspace-sidebar="compact"] {
    --workspace-rail: 72px;
  }

  :root[data-workspace-sidebar="compact"] .workspace-brand,
  :root[data-workspace-sidebar="compact"] .workspace-nav {
    justify-content: center;
    padding-inline: 0;
  }

  :root[data-workspace-sidebar="compact"] .workspace-logo > span,
  :root[data-workspace-sidebar="compact"] .workspace-nav-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  :root[data-workspace-sidebar="compact"] .workspace-nav {
    position: relative;
  }

  :root[data-workspace-sidebar="compact"] .workspace-nav-count {
    position: absolute;
    top: 3px;
    right: 0;
    padding-inline: 4px;
  }

  :root[data-workspace-sidebar="compact"] .workspace-collapse .ui-icon {
    transform: rotate(180deg);
  }
}

.workspace-main {
  width: min(100%, 1420px);
  min-width: 0;
  margin-inline: auto;
  padding: 28px var(--workspace-gutter) 44px;
  color: var(--workspace-ink);
}

.workspace-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 22px;
}

.workspace-section-heading h1,
.workspace-card-title {
  margin: 0;
  color: var(--workspace-ink);
  font-weight: 900;
  letter-spacing: -.026em;
}

.workspace-section-heading h1 {
  font-size: clamp(28px, 3.4vw, 43px);
  line-height: 1.06;
}

.workspace-section-heading p {
  margin: 7px 0 0;
  color: var(--workspace-muted);
  font-size: 16px;
  font-weight: 700;
}

.workspace-primary,
.workspace-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border-radius: 11px;
  font: inherit;
  font-weight: 900;
  text-align: center;
}

.workspace-primary {
  --button-top: #8939da;
  --button-bottom: #7131c1;
  --button-edge: #52208e;
  border: 0;
  padding: 9px 15px;
  background: linear-gradient(180deg, var(--button-top), var(--button-bottom));
  box-shadow: inset 0 -4px var(--button-edge);
  color: white;
  cursor: pointer;
}

.workspace-primary:hover {
  filter: brightness(1.06);
}

.workspace-primary:active {
  transform: translateY(2px);
}

.workspace-section-heading .workspace-primary {
  flex-shrink: 0;
}

.workspace-secondary {
  border: 1px solid var(--workspace-line);
  padding: 8px 13px;
  background: var(--workspace-paper);
  color: var(--workspace-strong);
  cursor: pointer;
}

.workspace-secondary:hover:not(:disabled) {
  border-color: #d3b5ed;
  background: var(--workspace-lavender);
}

.workspace-secondary:disabled {
  color: #777d89;
  cursor: default;
}

.workspace-library-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-filter {
  max-width: 170px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--workspace-line);
  border-radius: 10px;
  background: var(--workspace-paper);
  color: var(--workspace-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr));
  gap: 16px;
}

.workspace-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: 340px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--workspace-line);
  border-radius: 16px;
  background: var(--workspace-paper);
  box-shadow: var(--workspace-shadow);
}

.workspace-cover {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border-radius: 10px;
  background: radial-gradient(circle at 72% 27%, #e5daff, transparent 43%), linear-gradient(140deg, #a294f3, #c6bbfe);
  color: #6333a9;
}

.workspace-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.workspace-cover .workspace-cover-icon {
  width: 16%;
  height: auto;
  aspect-ratio: 1;
  stroke-width: 1.4;
}

.workspace-card-blue .workspace-cover {
  background: linear-gradient(140deg, #8ba7ff, #a0edfb);
  color: #17468a;
}

.workspace-card-teal .workspace-cover {
  background: linear-gradient(140deg, #65d6d2, #c6f6df);
  color: #0f6759;
}

.workspace-card-blue .workspace-primary {
  --button-top: #1689d4;
  --button-bottom: #066aad;
  --button-edge: #075082;
}

.workspace-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 9px 2px 0;
}

.workspace-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 19px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.workspace-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 10px;
  min-height: 20px;
  color: var(--workspace-muted);
  font-size: 13px;
  font-weight: 800;
}

.workspace-card-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.workspace-progress {
  color: var(--workspace-positive);
}

.workspace-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
}

.workspace-card-actions > button {
  min-width: 0;
  padding-inline: 9px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.workspace-card-tools {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--workspace-line);
}

.workspace-text-button {
  min-height: 40px;
  padding: 3px 6px;
  border: 0;
  background: none;
  color: var(--workspace-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.workspace-text-button:hover {
  color: var(--workspace-purple);
  text-decoration: underline;
}

.workspace-delete:hover {
  color: var(--workspace-danger);
}

.workspace-review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--workspace-line);
  border-radius: 14px;
  background: var(--workspace-paper);
  box-shadow: var(--workspace-shadow);
  color: var(--workspace-ink);
  font-weight: 900;
}

.workspace-review-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--workspace-lavender);
  color: var(--workspace-strong);
  font-size: 22px;
}

.workspace-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px 18px;
  border: 1px solid var(--workspace-line);
  border-radius: 16px;
  background: var(--workspace-paper);
  color: var(--workspace-muted);
  text-align: center;
}

.workspace-empty-srs {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.workspace-empty-srs p,
.workspace-review-copy p,
.workspace-review-copy h3 {
  margin: 0;
}

.workspace-empty-srs strong,
.workspace-review-copy h3 {
  color: var(--workspace-ink);
  font-weight: 900;
}

.workspace-review-copy p {
  margin-top: 3px;
  color: var(--workspace-muted);
  font-size: 14px;
  font-weight: 700;
}

.workspace-review-list {
  display: grid;
  gap: 10px;
}

.workspace-review-copy {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}

.workspace-review-row .workspace-primary {
  flex-shrink: 0;
}

.workspace-notifications {
  padding: 16px;
  border-color: var(--workspace-line);
  background: var(--workspace-paper);
  color: var(--workspace-ink);
}

.workspace-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.workspace-dialog-heading h2 {
  margin: 0;
  color: var(--workspace-ink);
  font-weight: 900;
}

.workspace-notification-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 8px;
  color: var(--workspace-strong);
  font-weight: 900;
}

.workspace-profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.workspace-profile-actions button {
  min-height: 44px;
}

@media (max-width: 1080px) {
  .workspace-tools > .workspace-tool > span:not(#headerBellBadge) {
    display: none;
  }
}

@media (max-width: 1060px) {
  .workspace-account-info {
    display: none;
  }

  .workspace-toolbar {
    gap: 10px;
    padding-inline: 14px;
  }

  .workspace-tools {
    gap: 5px;
  }
}

@media (max-width: 860px) {
  body.workspace-drawer-open {
    overflow: hidden !important;
  }

  .workspace-header {
    position: relative;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 9px 6px;
    min-height: 0;
    padding: 8px 12px;
  }

  .workspace-brand {
    gap: 6px;
    padding: 0;
    border: 0;
  }

  .workspace-logo {
    gap: 6px;
    font-size: 17px;
  }

  .workspace-logo img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .workspace-logo strong {
    font-size: 10px;
  }

  .workspace-mobile-menu {
    display: inline-flex;
  }

  .workspace-toolbar {
    display: contents;
  }

  .workspace-search {
    max-width: none;
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .workspace-tools {
    gap: 5px;
    grid-column: 2;
    grid-row: 1;
  }

  .workspace-layout {
    display: block;
  }

  .workspace-sidebar {
    position: fixed;
    z-index: 500;
    inset: 0 auto 0 0;
    width: min(84vw, 280px);
    height: 100dvh;
    padding-top: 10px;
    visibility: hidden;
    transform: translateX(-100%);
  }

  .workspace-sidebar.is-open {
    visibility: visible;
    transform: translateX(0);
    box-shadow: 12px 0 35px #1b123025;
  }

  .workspace-scrim:not([hidden]) {
    position: fixed;
    z-index: 490;
    inset: 0;
    display: block;
    background: #19142b80;
  }

  .workspace-drawer-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-left: 10px;
    font-size: 19px;
  }

  .workspace-main {
    padding-top: 23px;
  }
}

@media (max-width: 550px) {
  .workspace-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: space-between;
    flex-wrap: wrap;
    width: 100%;
  }

  .workspace-search {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    gap: 5px;
    padding-inline: 8px;
  }

  .workspace-balance {
    padding-inline: 7px;
  }

  .workspace-section-heading {
    flex-wrap: wrap;
  }

  .workspace-section-heading .workspace-primary {
    padding-inline: 10px;
    font-size: 14px;
  }

  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .workspace-card {
    padding: 7px;
    border-radius: 13px;
  }

  .workspace-card-title {
    font-size: 15px;
  }

  .workspace-card-meta {
    font-size: 12px;
  }

  .workspace-card-actions {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .workspace-card-actions > button {
    font-size: 13px;
  }

  .workspace-review-row {
    gap: 8px;
    padding: 10px;
  }

  .workspace-review-row > .workspace-review-icon {
    display: none;
  }
}
