.lights-panel {
  --lights-edge: #dce4ee;
  --lights-accent: #124bb8;
  --lights-surface: #ffffff;
  min-width: 0;
}

.lights-book-toolbar,
.lights-book-toolbar label,
.lights-bridge-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
}

.lights-book-toolbar {
  justify-content: space-between;
  margin: 5px 0 8px;
}

.lights-book-toolbar .v2-select {
  width: auto;
  min-height: 34px;
}

.lights-volume-heading {
  margin: 14px 0 6px;
  font-size: 15px;
}

.lights-book-page {
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
}

.lights-bridge-picker {
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--lights-edge, #dce4ee);
  border-radius: 9px;
  background: var(--lights-surface, #fff);
}

.lights-bridge-picker > summary {
  width: fit-content;
  color: var(--lights-accent, #124bb8);
  font-weight: 750;
  cursor: pointer;
}

.lights-bridge-actions {
  margin-top: 8px;
}

.lights-bridge-actions p {
  flex-basis: 100%;
  margin: 0;
}

.lights-bridge-related {
  margin-top: 12px;
}

.lights-bridge-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr));
  align-items: start;
  gap: 7px;
  margin-top: 8px;
}

.lights-bridge-group {
  min-width: 0;
  padding: 5px 8px;
  border: 1px solid var(--lights-edge, #dce4ee);
  border-radius: 8px;
  background: #fff;
}

.lights-bridge-group > summary {
  color: var(--text-sub, #405571);
  cursor: pointer;
  font-size: 13px;
}

.lights-bridge-group > summary span {
  margin-left: 5px;
}

.lights-bridge-group[data-m1-bridge-priority="true"],
.lights-bridge-chip[data-m1-bridge-priority="true"] {
  border-color: #f4bdbd;
  background: #fff3f3;
}

.lights-bridge-priority {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fce0e0;
  color: #9e1c1c;
  font-size: 11px;
  font-weight: 750;
}

.lights-bridge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--lights-edge, #dce4ee);
  border-radius: 999px;
  background: #fff;
  color: var(--text-main, #192c49);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.lights-bridge-chip:hover {
  border-color: #9cb4d4;
}

.lights-bridge-chip:focus-visible {
  outline: 2px solid var(--lights-accent, #124bb8);
  outline-offset: 1px;
}

.lights-bridge-chip > .lights-bridge-priority {
  flex: 0 0 auto;
}

.lights-bridge-note {
  margin: 8px 0;
  color: var(--text-muted, #50637a);
  font-size: 12px;
}

.shell-return-bridge {
  flex: 0 0 auto;
  white-space: nowrap;
}

.junior-question-figure {
  display: block;
  max-width: 100%;
  max-height: 250px;
  margin: 5px 0 10px;
  object-fit: contain;
}

.lights-heading,
.lights-utility-row,
.lights-subject-row,
.lights-filter-row,
.lights-stage,
.lights-fold-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lights-heading {
  margin: 10px 0;
  flex-wrap: wrap;
  justify-content: space-between;
}

.lights-toolbar {
  position: relative;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--lights-edge);
  border-radius: 12px;
  background: var(--lights-surface);
}

.lights-utility-row {
  flex-wrap: wrap;
  margin-bottom: 7px;
}

.lights-stage,
.lights-fold-actions,
.lights-filter-row {
  flex-wrap: wrap;
}

.lights-search {
  flex: 1 1 138px;
  min-width: min(100%, 138px);
  width: auto;
  height: 36px;
}

.lights-subject-row {
  flex-wrap: nowrap;
  gap: 5px;
  padding: 0 0 7px;
}

.lights-filter-row {
  gap: 4px;
  padding-top: 5px;
  border-top: 1px solid var(--lights-edge);
}

.lights-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 33px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-sub);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
}

.lights-control:hover,
.lights-node-trigger:hover {
  background: #f5f8fd;
}

.lights-control[aria-pressed="true"],
.lights-control[data-active="true"] {
  border-color: #cdddf6;
  background: #edf4ff;
  color: var(--lights-accent);
}

.lights-subject-row > .lights-control {
  min-width: 38px;
}

.lights-subject-menu,
.lights-node {
  position: relative;
}

.lights-subject-menu summary,
.lights-chapter > summary,
.lights-locked > summary {
  list-style: none;
}

.lights-subject-menu summary::-webkit-details-marker,
.lights-chapter > summary::-webkit-details-marker,
.lights-locked > summary::-webkit-details-marker {
  display: none;
}

.lights-subject-options,
.lights-node-popup {
  position: absolute;
  inset-block-start: 100%;
  z-index: 20;
  display: grid;
  min-width: 102px;
  padding: 5px;
  border: 1px solid var(--lights-edge);
  border-radius: 9px;
  background: var(--lights-surface);
  box-shadow: 0 6px 18px rgb(15 23 42 / 14%);
}

.lights-subject-options {
  inset-inline-end: 0;
}

.lights-node-popup[hidden] {
  display: none;
}

.lights-chapter {
  margin: 0 0 7px;
  border: 1px solid var(--lights-edge);
  border-radius: 10px;
  background: var(--lights-surface);
}

.lights-chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
}

.lights-chapter[open] > .lights-chapter-head {
  border-bottom: 1px solid var(--lights-edge);
  border-end-start-radius: 0;
  border-end-end-radius: 0;
  background: #f7f9fd;
}

.lights-chapter-title {
  min-width: 0;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.lights-chapter-counts,
.lights-chapter-count {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-sub);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lights-chapter-counts {
  gap: 10px;
}

.lights-chapter-chevron {
  color: var(--text-muted);
  font-size: 19px;
  line-height: 1;
}

.lights-chapter[open] > .lights-chapter-head .lights-chapter-chevron {
  transform: rotate(90deg);
}

.lights-node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 212px), 1fr));
  gap: 7px;
  padding: 9px;
}

.lights-node {
  min-width: 0;
}

.lights-node:has(.lights-node-popup:not([hidden])) {
  z-index: 15;
}

.lights-node-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 100%;
  min-height: 43px;
  padding: 6px 8px;
  border: 1px solid var(--lights-edge);
  border-radius: 8px;
  background: var(--lights-surface);
  color: var(--text-main);
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.lights-node-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lights-difficulty {
  padding: 2px 3px;
  border-radius: 4px;
  background: #f0f4f8;
  color: #3f5269;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.lights-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border: 1px solid transparent;
  border-radius: 50%;
}

.lights-dot[data-light="red"] { background: #dc2626; }
.lights-dot[data-light="yellow"] { background: #e5910c; }
.lights-dot[data-light="green"] { background: #15904a; }
.lights-dot[data-light="gray"] { background: #fff; border-color: #73839a; }
.lights-node-trigger .lights-dot { width: 12px; height: 12px; }

.lights-node-popup {
  inset-inline: 0;
}

.lights-node-popup button {
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
  text-align: start;
  cursor: pointer;
}

.lights-node-popup button:hover,
.lights-node-popup button:focus-visible {
  background: #edf4ff;
}

.lights-locked {
  margin: 0 9px;
  padding-bottom: 5px;
}

.lights-locked > summary {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 39px;
  color: var(--text-sub);
  font-size: 13px;
  cursor: pointer;
}

.lights-locked > summary::before {
  content: '›';
  margin-inline: 3px;
  font-size: 16px;
}

.lights-locked[open] > summary::before {
  transform: rotate(90deg);
}

.lights-locked .lights-node-grid {
  padding: 0 0 5px;
}

.lights-locked-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.lights-empty {
  padding: 16px;
  border: 1px solid var(--lights-edge);
  border-radius: 10px;
  background: var(--lights-surface);
}

.lights-empty p {
  margin: 0 0 6px;
}

.lights-panel :is(button, summary, input):focus-visible {
  outline: 2px solid var(--lights-accent);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .lights-control,
  .lights-node-popup button {
    min-height: 42px;
  }
}

@media (max-width: 440px) {
  .lights-toolbar { padding-inline: 7px; }
  .lights-subject-row { gap: 3px; }
  .lights-subject-row > .lights-control { min-width: 25px; }
  .lights-subject-row .lights-control { padding-inline: 5px; }
  .lights-chapter-head { gap: 6px; }
  .lights-chapter-counts { gap: 4px; }
}
