/* Character sheet. */

/* Center between the dice roller and panel buttons using their observed widths.
   Do not add the right-hand button row's height to this separate column. */
#play-bottom-stack {
  display: none;
  position: fixed;
  bottom: 1rem;
  left: calc(
    (
        var(--sidebar-w) + 12px + var(--dice-roller-w, 0px) + 100vw - 1rem -
          var(--play-btn-row-w, 0px)
      ) /
      2
  );
  transform: translateX(-50%);
  z-index: 100;
  flex-direction: column;
  /* Stretch the buttons and XP card to the same natural width. */
  align-items: stretch;
  gap: 0.45rem;
  transition: left 0.25s ease;
}
body.sidebar-collapsed #play-bottom-stack {
  left: calc((12px + var(--dice-roller-w, 0px) + 100vw - 1rem - var(--play-btn-row-w, 0px)) / 2);
}

#play-btns-bar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
#guide-btn,
#notebook-btn,
#party-btn,
#liveread-btn {
  background: rgba(31, 41, 55, 0.88);
  border: 1px solid #374151;
  border-radius: 7px;
  color: #9ca3af;
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
#guide-btn:hover,
#notebook-btn:hover,
#party-btn:hover,
#liveread-btn:not(:disabled):hover {
  background: #374151;
}
/* Keep unavailable live reading visible but disabled to prevent row-width changes. */
#liveread-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#party-btn.party-active {
  color: #34d399;
  border-color: #34d399;
}
#party-btn.party-active:hover {
  background: #064e3b;
}

#play-xp-summary {
  min-width: 0;
  /* Size the card from the buttons, not its longest XP label. */
  contain: inline-size;
  box-sizing: border-box;
  max-width: 92vw;
  width: 100%;
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 0.2rem 0.6rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0;
  color: #d1d5db;
}
#play-xp-summary:empty {
  display: none;
}
#play-xp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.play-xp-kicker {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.play-xp-collapse-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition:
    transform 0.15s,
    color 0.12s;
}
.play-xp-collapse-btn:hover {
  color: #d1d5db;
}
#play-xp-summary.play-xp-collapsed .play-xp-collapse-btn {
  transform: rotate(-90deg);
}
#play-xp-summary.play-xp-collapsed #play-xp-body {
  display: none;
}
#play-xp-summary.play-xp-collapsed {
  padding-bottom: 0.3rem;
  gap: 0;
}
.play-xp-mini-bars {
  display: none;
}
#play-xp-summary.play-xp-collapsed .play-xp-kicker {
  max-width: 50%;
}
#play-xp-summary.play-xp-collapsed .play-xp-mini-bars {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}
.play-xp-mini-track {
  height: 3px;
  background: #374151;
  border-radius: 2px;
  overflow: hidden;
}
.play-xp-mini-track[hidden] {
  display: none;
}
.play-xp-mini-track > div {
  height: 100%;
  width: 0;
  background: #f5a623;
  border-radius: inherit;
}
#play-xp-mini-job-fill {
  background: #fb7185;
}
#play-xp-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#play-xp-body > .job-xp-summary {
  gap: 0;
  margin-top: 0;
}
#play-xp-body :is(#play-xp-level-row, .job-xp-level-row) {
  line-height: 1.15;
}
#play-xp-level-row {
  display: flex;
  align-items: baseline;
  gap: 0.42rem;
}
#play-xp-hb-rate {
  margin-left: auto;
  font-size: 0.7rem;
  color: #22d3ee;
  white-space: nowrap;
}
#play-xp-level {
  font-size: 0.8rem;
  font-weight: 700;
  color: #f5a623;
  line-height: 1.15;
}
#play-xp-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#play-xp-bar {
  position: relative;
  height: 5px;
  background: #374151;
  border-radius: 3px;
  overflow: hidden;
}
#play-xp-bar-fill {
  position: relative;
  height: 100%;
  width: 0;
  background: #f5a623;
  border-radius: 3px;
}
#play-job-xp .job-xp-bar {
  background: #374151;
}
#play-xp-sub-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.12rem 0.4rem;
}
#play-xp-text {
  font-size: 0.76rem;
  color: #9ca3af;
  line-height: 1.15;
  white-space: nowrap;
}
#play-xp-boost {
  font-size: 0.74rem;
  color: #f59e0b;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

/* Party invite cards in library */
#party-invites-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.party-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
}
.party-invite-text {
  font-size: 0.82rem;
  color: #d1fae5;
  line-height: 1.4;
}
.party-invite-text strong {
  color: #6ee7b7;
}
.party-invite-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.party-invite-accept {
  background: #065f46;
  border: 1px solid #34d399;
  color: #34d399;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.party-invite-accept:hover {
  background: #047857;
}
.party-invite-decline {
  background: transparent;
  border: 1px solid #4b5563;
  color: #9ca3af;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
}
.party-invite-decline:hover {
  background: #374151;
}

/* Party modal */
#party-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
#party-modal-overlay.active {
  display: flex;
}
#party-modal {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  width: min(280px, 92vw);
  max-height: 85vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#party-modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
}
#party-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}
#party-modal-close:hover {
  color: #e2e8f0;
}
#party-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: visible;
}
.party-member-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: #d1d5db;
}
.party-member-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #374151;
  object-fit: cover;
}
.party-member-you {
  font-size: 0.68rem;
  color: #6b7280;
  margin-left: 0.2rem;
}
.party-invite-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.party-invite-input {
  flex: 1;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 5px;
  color: #e2e8f0;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
}
.party-invite-input:focus {
  outline: none;
  border-color: #34d399;
}
.party-invite-send {
  background: #065f46;
  border: 1px solid #34d399;
  color: #34d399;
  border-radius: 5px;
  padding: 0.3rem 0.55rem;
  font-size: 0.76rem;
  cursor: pointer;
  white-space: nowrap;
}
.party-invite-send:hover {
  background: #047857;
}
.party-leave-btn {
  background: transparent;
  border: 1px solid #ef4444;
  color: #ef4444;
  border-radius: 5px;
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
  cursor: pointer;
  align-self: flex-start;
}
.party-leave-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}
#party-invite-msg {
  min-height: 0 !important;
}
.party-section-label[style*='margin-top'] {
  margin-top: 0.2rem !important;
}
.party-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
}
.party-msg {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.3;
}
.party-invite-wrap {
  position: relative;
  flex: 1;
}
.party-invite-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  z-index: 10;
  overflow: hidden;
}
.party-invite-dropdown button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.65rem;
  background: none;
  border: none;
  color: #d1d5db;
  font-size: 0.83rem;
  cursor: pointer;
  text-align: left;
}
.party-invite-dropdown button:hover {
  background: #1f2937;
}

/* Guide modal */
#guide-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
#guide-modal-overlay.active {
  display: flex;
}
#guide-modal {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  width: min(900px, 95vw);
  height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
#guide-modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid #374151;
  color: #f3f4f6;
  font-size: 0.88rem;
  font-weight: 600;
  flex-shrink: 0;
}
#guide-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
#guide-modal-close:hover {
  background: #374151;
  color: #f3f4f6;
}
#guide-modal-frame {
  flex: 1;
  min-height: 0;
  border: none;
  width: 100%;
}

/* Forum modal */
#forum-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
#forum-modal-overlay.active {
  display: flex;
}
#forum-modal {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 10px;
  width: min(680px, 90vw);
  height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}
#forum-modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.36rem 0.55rem;
  border-bottom: 1px solid #374151;
  color: #f3f4f6;
  font-size: 0.82rem;
  font-weight: 600;
  flex-shrink: 0;
}
#forum-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.84rem;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
}
#forum-modal-close:hover {
  background: #374151;
  color: #f3f4f6;
}
#forum-modal-frame {
  flex: 1;
  min-height: 0;
  border: none;
  width: 100%;
  background: #0b1020;
}
@media (max-width: 768px) {
  #forum-modal {
    width: 100vw;
    height: 100vh;
    /* Use dvh so browser chrome cannot hide the dialog's header or close button. */
    height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* Notebook modal */
#notebook-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
#notebook-modal-overlay.active {
  display: flex;
}
#notebook-modal {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  width: min(600px, 92vw);
  height: min(520px, 80vh);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.7rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
#notebook-modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
#notebook-modal-title {
  color: #f5a623;
  font-size: 0.82rem;
  font-weight: 600;
}
#notebook-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
#notebook-modal-close:hover {
  background: #374151;
  color: #f3f4f6;
}
#notebook-modal-input {
  flex: 1;
  min-height: 0;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #d1d5db;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  padding: 0.6rem 0.75rem;
  resize: none;
  outline: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}
#notebook-modal-input:focus {
  border-color: #6b7280;
}
#notebook-modal-input::placeholder {
  color: #4b5563;
}
#notebook-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
#notebook-modal-right-actions {
  display: flex;
  gap: 0.4rem;
}
#notebook-modal-cancel {
  background: #374151;
  color: #9ca3af;
  border: 1px solid #4b5563;
  border-radius: 7px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}
#notebook-modal-cancel:hover {
  background: #4b5563;
}
#notebook-modal-save {
  flex: none !important;
  width: auto !important;
  padding: 0.28rem 0.7rem !important;
  font-size: 0.78rem !important;
}
#notebook-pin-toggle {
  gap: 0.5rem;
  user-select: none;
}
#notebook-pin-label {
  font-size: 0.78rem;
  color: #9ca3af;
}

#notes-display {
  display: none;
  position: fixed;
  left: calc(var(--sidebar-w) + 1rem);
  top: 50%;
  transform: translateY(-50%);
  width: 20vw;
  max-height: 65vh;
  /* Above .liveread-panel's z-index (350) - a pinned notebook must always
     win over the reading panel, not get silently buried underneath it. */
  z-index: 400;
  border-radius: 6px;
  transition:
    left 0.25s ease,
    background-color 0.15s;
}
#notes-display.visible {
  display: flex;
  flex-direction: column;
}
#notes-display.hovering {
  height: 65vh;
  background: rgba(17, 24, 39, 0.78);
  border: 1px solid #374151;
}
body.sidebar-collapsed #notes-display {
  left: 1rem;
}
#notes-display-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  scrollbar-width: none;
}
#notes-display.hovering #notes-display-body {
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
#notes-display-text {
  font-size: 0.75rem;
  color: #e5e7eb;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.6);
}
#notes-display-input {
  display: none;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.65;
  resize: none;
  outline: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
#notes-display.hovering #notes-display-text {
  display: none;
}
#notes-display.hovering #notes-display-input {
  display: flex;
}
#notes-display-footer {
  display: none;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-top: 1px solid #374151;
  flex-shrink: 0;
}
#notes-display.hovering #notes-display-footer {
  display: flex;
}
#notes-display-cancel {
  background: #374151;
  color: #9ca3af;
  border: 1px solid #4b5563;
  border-radius: 6px;
  padding: 0.22rem 0.55rem;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
}
#notes-display-cancel:hover {
  background: #4b5563;
}
#notes-display-save {
  background: #1d4ed8;
  color: #e0e7ff;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
}
#notes-display-save:hover {
  background: #2563eb;
}

/* Wrap shared play actions upward on narrow screens. */
#play-btn-row {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap-reverse;
  justify-content: flex-start;
  gap: 0.4rem;
  max-width: calc(100vw - 2rem);
}

/* Open button */
#charsheet-btn {
  background: rgba(31, 41, 55, 0.88);
  border: 1px solid #374151;
  border-radius: 7px;
  color: #9ca3af;
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  /* Do not shrink buttons below their label width at reverse-wrap boundaries. */
  flex-shrink: 0;
}
#charsheet-btn:hover {
  background: #374151;
}

/* Position the HUD above the action row using its observed height. */
#stats-hud {
  position: fixed;
  bottom: calc(1rem + var(--play-btn-row-h, 2.1rem) + 0.4rem);
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  pointer-events: none;
}

/* Compact plain-text display - no background, just text */
#charsheet-display {
  position: static;
  font-size: 0.75rem;
  color: #e5e7eb;
  line-height: 1.65;
  pointer-events: none;
  text-align: right;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.6);
  /* Cap HUD width to the observed button row so long fields wrap on-screen. */
  max-width: var(--play-btn-row-w, 220px);
}
.cs-line {
  display: block;
}
.cs-label {
  color: #9ca3af;
}

/* Inventory on-screen display */
#inv-display {
  font-size: 0.75rem;
  color: #e5e7eb;
  line-height: 1.65;
  text-align: right;
  text-shadow:
    0 1px 4px rgba(0, 0, 0, 0.9),
    0 0 8px rgba(0, 0, 0, 0.6);
}
.inv-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
}
.inv-line-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.inv-line-icon svg {
  width: 16px;
  height: 16px;
}

/* Modal overlay */
.cs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.cs-overlay.active {
  display: flex;
}

.cs-modal {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  width: min(700px, 95vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.cs-modal-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid #374151;
  color: #f3f4f6;
  font-size: 0.88rem;
  font-weight: 600;
  flex-shrink: 0;
}
#cs-modal-close {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
#cs-modal-close:hover {
  background: #374151;
  color: #f3f4f6;
}

.cs-field-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 80px;
}
.cs-empty {
  color: #6b7280;
  font-size: 0.8rem;
  text-align: center;
  padding: 1.5rem 1rem;
  margin: 0;
}

/* Field rows */
.cs-field-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #111827;
  border: 1px solid #2d3748;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
}

/* Drag handle */
.cs-drag-handle {
  cursor: grab;
  color: #4b5563;
  font-size: 1rem;
  flex-shrink: 0;
  user-select: none;
  padding: 0 0.1rem;
}
.cs-drag-handle:active {
  cursor: grabbing;
}
.cs-field-row.cs-dragging {
  opacity: 0.35;
}
.cs-field-row.cs-drag-over {
  border-color: #f5a623;
  background: #1a2236;
}
.cs-ro-name {
  flex: 1;
  color: #9ca3af;
  font-size: 0.85rem;
}
.cs-ro-val {
  color: #e5e7eb;
  font-size: 0.85rem;
  font-weight: 600;
  padding-left: 1rem;
}

/* Visible toggle */
.cs-vis-toggle {
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.cs-vis-toggle input {
  display: none;
}
.cs-dot {
  display: inline-block;
  width: 2rem;
  height: 1.1rem;
  border-radius: 999px;
  background: #374151;
  border: 1px solid #4b5563;
  position: relative;
  transition:
    background 0.15s,
    border-color 0.15s;
  user-select: none;
}
.cs-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  transform: translateY(-50%);
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #6b7280;
  transition:
    left 0.15s,
    background 0.15s;
}
.cs-vis-toggle input:checked + .cs-dot {
  background: rgba(96, 165, 250, 0.2);
  border-color: #60a5fa;
}
.cs-vis-toggle input:checked + .cs-dot::after {
  left: calc(100% - 0.7rem - 3px);
  background: #60a5fa;
}

/* Name input */
.cs-name-inp {
  flex: 2;
  min-width: 80px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #f3f4f6;
  padding: 0.22rem 0.45rem;
  font-size: 0.8rem;
}

/* Type selector */
.cs-type-sel {
  flex: 0 0 90px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #d1d5db;
  padding: 0.22rem 0.3rem;
  font-size: 0.8rem;
}

/* Value wrapper */
.cs-val-wrap {
  flex: 3;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* Number field - hide native spinners, use custom ±  */
.cs-val-num,
.cs-num-wrap input[type='number'],
.cs-num-wrap input[type='text'] {
  -moz-appearance: textfield;
  text-align: center;
}
.cs-val-num::-webkit-inner-spin-button,
.cs-val-num::-webkit-outer-spin-button,
.cs-num-wrap input[type='number']::-webkit-inner-spin-button,
.cs-num-wrap input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sections-pages-row {
  display: flex;
  gap: 0.75rem;
}
.sections-pages-col {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.cs-num-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.cs-num-wrap .cs-val-num {
  flex: 1;
  min-width: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
}
.cs-num-btn {
  flex-shrink: 0;
  width: 26px;
  background: #2d3748;
  border: 1px solid #374151;
  color: #9ca3af;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.22rem 0;
  transition:
    background 0.1s,
    color 0.1s;
  font-family: inherit;
}
.cs-num-btn:first-child {
  border-radius: 4px 0 0 4px;
}
.cs-num-btn:last-child {
  border-radius: 0 4px 4px 0;
}
.cs-num-btn:hover {
  background: #374151;
  color: #f3f4f6;
}

/* Value inputs (shared) */
.cs-val {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #f3f4f6;
  padding: 0.22rem 0.45rem;
  font-size: 0.8rem;
  width: 100%;
  box-sizing: border-box;
}
select.cs-val {
  color: #d1d5db;
}

.cs-bool-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.cs-val-bool {
  accent-color: #3b82f6;
  cursor: pointer;
}
.cs-bool-label {
  font-size: 0.8rem;
  color: #d1d5db;
}

/* Enum options config (smaller, de-emphasised) */
.cs-enum-opts {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 4px;
  color: #6b7280;
  padding: 0.18rem 0.45rem;
  font-size: 0.72rem;
  width: 100%;
  box-sizing: border-box;
}

/* Delete button */
.cs-del-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.cs-del-btn:hover {
  background: #7f1d1d;
  color: #f87171;
}

/* Footer */
.cs-modal-ftr {
  padding: 0.7rem 1rem;
  border-top: 1px solid #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 0.5rem;
}
.cs-ftr-actions {
  display: flex;
  gap: 0.4rem;
}
.cs-btn-add {
  background: none;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0.25rem 0.65rem;
}
.cs-btn-add:hover {
  background: #374151;
  color: #f3f4f6;
}
.cs-btn-cancel {
  background: none;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #9ca3af;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0.25rem 0.65rem;
}
.cs-btn-cancel:hover {
  background: #374151;
  color: #f3f4f6;
}
.cs-btn-template {
  background: none;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #d1d5db;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0.25rem 0.65rem;
}
.cs-btn-template:hover {
  background: #374151;
  color: #f3f4f6;
}
.cs-btn-save {
  background: #1d4ed8;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0.25rem 0.65rem;
}
.cs-btn-save:hover {
  background: #2563eb;
}
.cs-btn-add:disabled,
.cs-btn-template:disabled,
.cs-btn-save:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.cs-series-char-section {
  border-top: 1px solid rgba(8, 145, 178, 0.4);
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.cs-sc-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: #38bdf8;
}
.cs-sc-sync-btn {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  background: rgba(14, 116, 144, 0.3);
  border: 1px solid #0e7490;
  border-radius: 4px;
  color: #7dd3fc;
  cursor: pointer;
}
.cs-sc-sync-btn:hover {
  background: rgba(14, 116, 144, 0.55);
}
.cs-sc-sync-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.cs-sc-status {
  font-size: 0.72rem;
  color: #6b7280;
}
.cs-sc-fields {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.8rem;
}
