/* Editable photo crop controls and matching display crop */

.photo-adjust-controls {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  font-size: 12px;
  color: #243c5d;
}
.photo-adjust-controls label {
  display: grid;
  gap: 2px;
}
.photo-adjust-controls input[type=range] {
  width: 100%;
  accent-color: #71afe8;
}
.image-preview,.combo-image-preview {
  overflow: hidden;
}
.image-preview img,.combo-image-preview img,.profile-photo img {
  transform-origin: center center;
}

/* Relationship detail is a clean white canvas; editor grid remains untouched. */

#relDetailCanvas {
  background-image: none;
  background-color: #ffffff ;
}

/* Relationship portrait and name use one connected, square-cornered profile card. */

.rel-node-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: none;
  max-height: none;
}
.wiki-png-export .rel-canvas {
  background-image: none !important;
}

/* List metadata bottom row: category left, modified time right. */

.character-card .card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.character-card .list-card-top {
  display: block;
}
.character-card .list-card-bottom {
  display: flex;
  margin-top: auto;
  min-width: 0;
}
.character-card .list-card-bottom .list-type-label {
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}
.character-card .list-card-bottom .list-modified {
  flex: 0 0 auto;
  width: auto;
  max-width: 58%;
  margin: 0;
  text-align: right;
  align-self: flex-end;
}

/* Vertically center relationship name inside its color band. */

/* Harmonize relationship editor with the other document editors. */

#relationshipEditorView .rel-toolbar button {
  border-radius: 10px;
}

/* Relationship detail matches the white document surface. */

#relationshipDetailView .rel-canvas {
  background: #ffffff ;
  background-image: none !important;
}
@media (max-width:700px) {
  .character-card .list-card-bottom {
    gap: 3px;
  }
}

/* List thumbnails and relationship card finishing touches. */

.character-card .card-image .rel-list-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Respect the document's saved image framing everywhere. */

.character-card .card-image {
  overflow: hidden;
  position: relative;
}
.character-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
  transform-origin: center center;
}
.combo-mini-photo {
  overflow: hidden;
  position: relative;
}
.combo-mini-photo img {
  max-width: none;
  transform-origin: center center;
}
.combo-mini-card {
  border: 2px solid var(--profile-color,#d2edff) !important;
  box-sizing: border-box;
}
.combo-mini-name,.combo-members-bottom .combo-mini-name {
  background: var(--profile-color,#d2edff) !important;
  color: var(--profile-contrast,#000000) !important;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px !important;
  line-height: 1.15;
}

/* Slightly lift the name visually to compensate for font baseline. */

.data-menu-wrap {
  position: relative;
  display: inline-flex;
}
.data-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 7px);
  right: 0;
  min-width: 142px;
  padding: 6px;
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  background: white;
  box-shadow: 0 8px 22px #243c5d22;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.data-menu.hidden {
  display: none !important;
}
.data-menu button {
  width: 100%;
  text-align: left;
  background: white;
  border: 0;
  border-radius: 7px;
  padding: 10px 12px;
  white-space: nowrap;
}
.data-menu button:hover {
  background: #d2edff;
}

.list-search-excerpt {
  font-size: 12px;
  color: #6983a6;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 3px;
}

/* Combo member cards use the same border weight as profile and body sections. */

#comboDetailView .combo-mini-card,
.wiki-png-export .combo-mini-card {
  border: 1.5px solid var(--profile-color,#d2edff) !important;
}

/* For 3+ members, align below the body column, leaving the profile column empty. */

#comboDetailView .combo-members-after,
.wiki-png-export .combo-members-after {
  display: grid;
  grid-template-columns: 330px minmax(0,1fr);
  gap: 22px;
  width: 100%;
  align-items: start;
  margin-top: 18px;
}
#comboDetailView .combo-members-after .combo-members-bottom,
.wiki-png-export .combo-members-after .combo-members-bottom {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 9px;
  margin: 0;
  min-width: 0;
}
@media (max-width:700px) {
  #comboDetailView .combo-members-after,
  .wiki-png-export .combo-members-after {
    grid-template-columns: minmax(0,1fr);
    gap: 0;
  }
  #comboDetailView .combo-members-after .combo-members-bottom,
  .wiki-png-export .combo-members-after .combo-members-bottom {
    grid-column: 1;
    grid-template-columns: repeat(5,minmax(0,1fr));
    gap: 5px;
  }
}

/* 3+ member combos: directly after the body sections, in the right column.
   Keep exactly five card slots per full row and align incomplete rows right. */

#comboDetailView .profile-body > .combo-members-after,
.wiki-png-export .profile-body > .combo-members-after {
  display: block !important;
  width: 100% !important;
  margin: 18px 0 0 !important;
  min-width: 0;
}
#comboDetailView .profile-body > .combo-members-after .combo-members-bottom,
.wiki-png-export .profile-body > .combo-members-after .combo-members-bottom {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  width: 100%;
}
#comboDetailView .profile-body > .combo-members-after .combo-mini-card,
.wiki-png-export .profile-body > .combo-members-after .combo-mini-card {
  flex: 0 0 calc((100% - 36px) / 5);
  width: calc((100% - 36px) / 5);
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width:700px) {
  #comboDetailView .profile-body > .combo-members-after .combo-members-bottom,
  .wiki-png-export .profile-body > .combo-members-after .combo-members-bottom {
    gap: 5px !important;
  }
  #comboDetailView .profile-body > .combo-members-after .combo-mini-card,
  .wiki-png-export .profile-body > .combo-members-after .combo-mini-card {
    flex-basis: calc((100% - 20px) / 5);
    width: calc((100% - 20px) / 5);
  }
}

/* Small combos moved under the left profile use the original two-card layout. */

#comboDetailView .combo-left-column > .combo-members-inline,
.wiki-png-export .combo-left-column > .combo-members-inline {
  display: grid !important;
  grid-template-columns: repeat(var(--combo-member-columns, 1),minmax(0,1fr)) !important;
  gap: 9px !important;
  margin: 18px 0 0 !important;
  justify-content: stretch !important;
}
#comboDetailView .combo-left-column > .combo-members-inline .combo-mini-card,
.wiki-png-export .combo-left-column > .combo-members-inline .combo-mini-card {
  width: auto;
  min-width: 0;
}

/* Relationship nodes: 3:4 portrait, smaller cards, uniform 1.5px outline. */

.rel-node-photo {
  box-sizing: border-box;
  width: 90px !important;
  height: 120px !important;
  border-width: 1.5px !important;
  border-radius: 8px 8px 0 0 !important;
}
.rel-node-name {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
  width: 90px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 3px 2px !important;
  line-height: 1.1 !important;
  font-size: 12px !important;
  border-radius: 0 0 8px 8px !important;
}
.wiki-png-export .rel-node {
  width: 90px !important;
}
.rel-crop-note {
  font-size: 12px;
  color: #6983a6;
  line-height: 1.5;
}
#editorView .rich-content .editor-spoiler.spoiler-continuation::before,
#comboEditorView .rich-content .editor-spoiler.spoiler-continuation::before {
  content: none !important;
}

/* Relationship detail: controls beside Edit, diagram heading fixed top-left of canvas. */

#relationshipDetailView .page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
#relationshipDetailView .detail-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#relationshipDetailView .detail-buttons .rel-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 5px 0 0;
}
#relationshipDetailView .rel-diagram-heading,.wiki-png-export .rel-diagram-heading {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 3;
  pointer-events: none;
  max-width: 550px;
}
.rel-diagram-heading h2 {
  font-size: 30px;
  line-height: 1.3;
  margin: 0 0 12px;
  color: #243c5d;
  overflow-wrap: anywhere;
}
@media (max-width:700px) {
  #relationshipDetailView .detail-buttons {
    gap: 5px;
  }
  #relationshipDetailView .detail-buttons .rel-zoom {
    gap: 4px;
  }
  #relationshipDetailView .detail-buttons .rel-zoom button {
    padding: 7px 8px;
  }
}

/* Relationship: match the 1.5px document card borders, on both detail and editor. */

#relationshipDetailView .rel-scroll {
  background: #d2edff;
  border: 1.5px solid var(--line,#a8d2f5) !important;
  border-radius: 12px !important;
}
#relationshipEditorView .rel-scroll {
  border: 1.5px solid var(--line,#a8d2f5) ;
  border-radius: 12px ;
}

/* Legend is part of the actual canvas, so it is also present during editing and export. */

.rel-diagram-categories {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 7px !important;
}
.rel-diagram-category {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
  min-height: 36px;
  box-sizing: border-box;
  font-size: 15px;
  font-weight: 700;
  background: var(--rel-category-color) !important;
  color: var(--rel-category-contrast) !important;
  border: 0 !important;
  border-radius: 6px !important;
  padding: 5px 12px !important;
}
#relationshipEditorView .rel-diagram-heading {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 3;
  pointer-events: none;
  max-width: 550px;
}

/* The relationship document uses the same OUTER article surface as other documents. */

#relationshipDetailView .rel-detail-surface {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  min-width: 0;
}
#relationshipDetailView .rel-detail-surface .rel-scroll {
  background: #d2edff;
  border: 0;
  border-radius: 0;
  max-height: 76vh;
  min-height: 380px;
}
#relationshipDetailView .rel-detail-surface .profile-modified-date {
  margin-top: 16px;
  text-align: right;
}
.rel-label-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.rel-lines {
  z-index: 0;
}
.rel-node {
  box-sizing: border-box;
  width: 90px !important;
  z-index: 2;
}
.rel-diagram-heading {
  z-index: 3;
}
@media (max-width:700px) {
  #relationshipDetailView .rel-detail-surface {
    padding: 14px;
  }
}

/* Relationship editor: match the shared document editor title and spacing. */

#relationshipEditorView .rel-namebar, #folderEditorView .rel-namebar {
  margin: 0 0 24px;
}
#relationshipEditorView .rel-namebar label, #folderEditorView .rel-namebar label {
  font-weight: 600;
  color: #243c5d;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
#relationshipEditorView .rel-namebar input, #folderEditorView .rel-namebar input {
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  background: #ffffff;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 13px 16px;
  margin: 0;
}
#relationshipEditorView .rel-setup-row {
  gap: 20px;
  margin: 0 0 24px;
  align-items: start;
}
#relationshipEditorView .rel-setup-group h3,#relationshipEditorView .rel-inspector-heading {
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--text);
}
#relationshipEditorView .rel-setup-group label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#relationshipEditorView .rel-setup-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #a8d2f5;
  border-radius: 9px;
}
#relationshipEditorView .rel-setup-group button {
  border: 1px solid #a8d2f5;
  background: #d2edff;
  border-radius: 9px;
  padding: 10px;
  cursor: pointer;
}
#relationshipEditorView #relAddCharacter,#relationshipEditorView #relAddCategory {
  margin-top: 10px;
  width: 100%;
}
#relationshipEditorView .rel-setup-group .rel-category-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0;
}
#relationshipEditorView .rel-category-row input[data-cat-name] {
  flex: 1;
  min-width: 0;
  padding: 9px;
  border: 1px solid #a8d2f5;
  border-radius: 8px;
}
#relationshipEditorView .rel-setup-group #relNodeList {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
  max-height: 230px;
  overflow: auto;
}
@media (max-width:700px) {
  #relationshipEditorView .rel-setup-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  #relationshipEditorView .rel-setup-group {
    padding: 14px;
  }
}

/* Relationship editor: same heading alignment as the other creation forms. */

#relationshipEditorView, #folderEditorView {
  background: #ffffff;
  border: 1px solid #a8d2f5;
}
#relationshipEditorView #relationshipEditorTitle, #folderEditorView #folderEditorHeading {
  color: var(--text);
}

/* Use the entire available width after temporarily removing selection inspector. */

#relationshipEditorView .rel-workspace {
  display: block;
  grid-template-columns: none;
}
#relationshipEditorView .rel-work-main {
  background: #f1faff;
  border: 1px solid #a8d2f5;
  border-radius: 14px;
  width: 100%;
  min-width: 0;
}
#relationshipEditorView .rel-sidepanel {
  border: 1px solid #a8d2f5;
  border-radius: 14px;
  min-height: 0;
  display: none !important;
}
@media (max-width:700px) {
  #relationshipEditorView {
    padding: 18px;
  }
  #relationshipEditorView #relationshipEditorTitle, #folderEditorView #folderEditorHeading {
    font-size: 24px;
  }
}

/* Relationship editor: matching section field blocks */

#relationshipEditorView .rel-setup-group {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-sizing: border-box;
}
#relationshipEditorView .rel-setup-group input,#relationshipEditorView .rel-setup-group textarea,#relationshipEditorView .rel-setup-group select {
  box-sizing: border-box;
  min-width: 0;
}
#relationshipEditorView .rel-category-row {
  width: 100%;
  box-sizing: border-box;
}
#relationshipEditorView .rel-category-row input[type=color] {
  flex-shrink: 0;
  width: 44px;
  height: 42px;
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  padding: 4px;
  background: #ffffff;
  cursor: pointer;
}
#relationshipEditorView .rel-category-row input[type=color]::-webkit-color-swatch-wrapper {
  padding: 0;
}
#relationshipEditorView .rel-category-row input[type=color]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}
#relationshipEditorView .rel-category-row button {
  flex: 0 0 42px;
  min-height: 42px;
}
#relationshipEditorView .rel-node-crop {
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  padding: 12px;
  margin: 5px 0 12px;
  background: #ffffff;
}
#relationshipEditorView .rel-node-crop label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
  font-size: 13px;
}
#relationshipEditorView .rel-node-crop input {
  width: 100%;
}
#relationshipEditorView .rel-crop-toggle {
  width: 100%;
  background: white;
  text-align: left;
}
.rel-scroll.rel-fully-fitted {
  overflow: hidden !important;
  overscroll-behavior: contain;
}

/* Smaller 1:1 diagram photos; preserve the color-linked name label. */

.rel-node,.wiki-png-export .rel-node {
  width: 76px !important;
}
.rel-node-photo,.wiki-png-export .rel-node-photo {
  width: 76px !important;
  height: 76px !important;
  aspect-ratio: 1/1 !important;
  border-width: 1.5px !important;
}
.rel-node-name,.wiki-png-export .rel-node-name {
  width: 76px !important;
  height: 25px !important;
  min-height: 25px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

/* Common controls shared by character, combo and setting editors. */

#editorView .add-field,#comboEditorView .add-field,#settingEditorView .add-field,
#relationshipEditorView #relAddCategory,#relationshipEditorView #relAddCharacter {
  background: #d2edff;
  border: 1px solid #a8d2f5;
  color: #243c5d;
  border-radius: 12px;
  padding: 12px 15px;
  cursor: pointer;
}
#editorView .field-row,#comboEditorView .field-row,#settingEditorView .field-row,
#editorView .section-row,#comboEditorView .section-row,#settingEditorView .section-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#editorView .field-row > *,#comboEditorView .field-row > *,#settingEditorView .field-row > * {
  min-width: 0;
}
#relNodeList.hidden {
  display: none !important;
}
.rel-zoom-input {
  width: 66px;
  min-width: 0;
  padding: 7px 5px;
  text-align: right;
  border: 1px solid #a8d2f5;
  border-radius: 8px;
  background: #ffffff;
  color: #243c5d;
  font: inherit;
}
.rel-percent {
  margin-left: -6px;
}

/* Keep the relationship export at exactly the same square card geometry as the live diagram. */

.wiki-png-export .rel-node,.wiki-png-export .rel-node-link {
  box-sizing: border-box !important;
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
}
.wiki-png-export .rel-node-photo {
  box-sizing: border-box !important;
  width: 76px !important;
  height: 76px !important;
  min-width: 76px !important;
  min-height: 76px !important;
  max-width: 76px !important;
  max-height: 76px !important;
  aspect-ratio: 1/1 !important;
}
.wiki-png-export .rel-node-name {
  box-sizing: border-box !important;
  width: 76px !important;
  height: 25px !important;
  min-height: 25px !important;
}

/* Shared editor blocks: full-width second row, aligned delete controls. */

#editorView .field-row, #comboEditorView .field-row, #settingEditorView .field-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 46px;
  gap: 9px;
  align-items: start;
}
#editorView .field-row > .field-name, #comboEditorView .field-row > .field-name, #settingEditorView .field-row > .field-name {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  max-width: none;
  min-width: 0;
}
#editorView .field-row > .remove-field, #comboEditorView .field-row > .remove-field, #settingEditorView .field-row > .remove-field {
  grid-column: 2;
  grid-row: 1;
}
#editorView .field-row > .rich-content, #comboEditorView .field-row > .rich-content, #settingEditorView .field-row > .rich-content {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
#editorView .section-row-top, #comboEditorView .section-row-top, #settingEditorView .section-row-top,
#comboEditorView .combo-section-head, #settingEditorView .combo-section-head {
  display: grid;
  grid-template-columns: minmax(0,1fr) 46px;
  gap: 9px;
}
#editorView .section-row > .section-content-input, #comboEditorView .section-row > .section-content-input, #settingEditorView .section-row > .section-content-input,
#comboEditorView .combo-section > .combo-rich-content, #settingEditorView .combo-section > .combo-rich-content {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
#editorView button.remove-field, #editorView button.remove-section,
#comboEditorView button.remove-field, #comboEditorView .combo-section-head button,
#settingEditorView button.remove-field, #settingEditorView .combo-section-head button {
  background: #d2edff;
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  color: #243c5d;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#editorView button.add-field,#comboEditorView button.add-field,#settingEditorView button.add-field {
  background: #d2edff;
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  color: #243c5d;
}

/* Only the zoom slider remains visible above the relationship canvas. */

#relationshipEditorView .rel-hidden-tools {
  display: none ;
}
#relationshipEditorView .rel-toolbar-zoom-only .rel-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
#relZoomSlider {
  width: clamp(120px,24vw,260px);
  accent-color: #71afe8;
  cursor: pointer;
}
#relZoomInput.rel-zoom-value {
  display: inline-block;
  min-width: 45px;
  text-align: center;
  color: #243c5d;
  font-size: 14px;
}

/* The PNG node image is pre-rendered into the square frame with its original aspect ratio. */

.wiki-png-export .rel-node-photo img {
  max-width: none !important;
  max-height: none !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  object-fit: fill !important;
}
#relViewZoomSlider {
  width: clamp(120px,24vw,260px);
  accent-color: #71afe8;
  cursor: pointer;
}

/* Relationship heading follows the same 22px editor card padding and heading scale. */

#relationshipEditorView, #folderEditorView {
  padding: 22px !important;
  border-radius: 12px;
}
#relationshipEditorView #relationshipEditorTitle, #folderEditorView #folderEditorHeading {
  margin: 0 0 20px;
  font-size: 24px;
  line-height: 1.35;
  font-weight: 700;
}
@media (max-width:700px) {
  #relationshipEditorView, #folderEditorView {
    padding: 18px;
  }
  #relationshipEditorView #relationshipEditorTitle, #folderEditorView #folderEditorHeading {
    font-size: 24px;
  }
}

/* A light-blue native slider across crop and relationship zoom controls. */

.photo-adjust-controls input[type="range"],
.rel-zoom input[type="range"],
#relationshipEditorView input[type="range"],
#relationshipDetailView input[type="range"] {
  accent-color: #a8d2f5;
  cursor: pointer;
}

/* Full-canvas fit disables scroll in both diagram views. */

#relationshipEditorView .rel-scroll.rel-fully-fitted,
#relationshipDetailView .rel-scroll.rel-fully-fitted {
  overflow: hidden !important;
  overscroll-behavior: contain;
}

/* The scaled relationship canvas must not retain its original 1500px layout footprint. */

#relEditorScroll, #relDetailScroll {
  position: relative;
  background: #d2edff;
}
#relEditorScroll > .rel-canvas, #relDetailScroll > .rel-canvas {
  position: absolute;
  top: 0;
  left: 0;
  background-color: #ffffff;
  box-shadow: 0 0 0 1px #a8d2f5;
}
#relEditorScroll > .rel-canvas-spacer, #relDetailScroll > .rel-canvas-spacer {
  position: relative !important;
  display: block;
  pointer-events: none;
}
#relEditorScroll.rel-fully-fitted, #relDetailScroll.rel-fully-fitted {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

/* 조합 캐릭터 선택 삭제 버튼: 다른 편집 블록의 × 버튼과 동일한 색상 */

#comboEditorView .combo-member-row button {
  background: #d2edff;
  border-color: #a8d2f5;
  color: #243c5d;
}

/* Relationship tool toggle uses the existing floating toolbar design. */

#relationshipTools #relMoveToggle.active {
  background: #d2edff;
  border-color: #a8d2f5;
  color: #243c5d;
  font-weight: 700;
}
#relationshipEditorView .rel-node {
  cursor: pointer;
}
#relationshipEditorView.rel-moving .rel-node {
  cursor: grab;
}
#relationshipEditorView.rel-moving .rel-node:active {
  cursor: grabbing;
}

/* Consistent spacing between the global header and each page's first control. */

#listView > .toolbar {
  margin-top: 0;
}
#listView > .list-filters {
  margin: 0 0 18px;
}
#relationshipEditorView .rel-namebar, #folderEditorView .rel-namebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rel-diagram-heading .rel-diagram-subtitle {
  margin: 3px 0 12px;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 400;
  color: #6983a6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rel-diagram-heading:has(.rel-diagram-subtitle) h2 {
  margin-bottom: 0;
}

/* Consistent header-to-page spacing: every view starts at the same baseline. */

main > .view {
  margin-top: 0;
}
#listView > .toolbar, #detailView > .page-actions,
#comboDetailView > .page-actions, #relationshipDetailView > .page-actions {
  margin-top: 0;
}
#relationshipEditorView {
  margin-top: 0;
}

/* List metadata: document type on its own right-aligned row above date. */

.character-card .list-card-bottom {
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}
.character-card .list-card-bottom .list-type-label,
.character-card .list-card-bottom .list-modified {
  width: 100%;
  max-width: 100%;
  text-align: right;
  align-self: flex-end;
}

/* Relationship multi-selection, including line and caption as a single target. */

#relationshipEditorView .rel-line-click.selected {
  stroke: rgba(113, 175, 232, .35);
  stroke-width: 12;
}
#relationshipEditorView .rel-line-label {
  pointer-events: auto;
  cursor: pointer;
  touch-action: none;
}
#relationshipEditorView .rel-line-label.selected {
  paint-order: stroke;
  stroke: #a8d2f5;
  stroke-width: 8;
}
#relationshipTools button {
  width: 100%;
}
.rel-delete-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}
.rel-delete-confirm-actions button {
  min-width: 84px;
}
#relationshipEditorView > .form-actions {
  display: flex;
  width: 100%;
}
#relationshipEditorView > .form-actions #relSave {
  flex: 1;
  min-width: 0;
  width: 100%;
}
@media(max-width:700px) {
  #relationshipTools {
    right: 6px;
  }
  #relationshipEditorView > .form-actions #relSave {
    width: 100%;
  }
}

/* List metadata stays visible, while long document names are truncated. */

.character-card .card-info {
  min-height: 0;
  overflow: hidden;
}
.character-card .list-card-top {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}
.character-card .list-title-group {
  min-width: 0;
  overflow: hidden;
}
.character-card .list-card-top h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.character-card .list-card-bottom {
  flex: 0 0 auto;
  gap: 1px;
  line-height: 1.2;
}
.character-card .list-card-bottom .list-type-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* All editor save/delete actions share equal-width columns on mobile. */

#editorView .form-actions,#comboEditorView .form-actions,#relationshipEditorView > .form-actions {
  width: 100%;
}
#editorView .form-actions > button,#comboEditorView .form-actions > button,#relationshipEditorView > .form-actions > button {
  flex: auto;
}
#editorView .form-actions > .hidden + button,#comboEditorView .form-actions > .hidden + button,#relationshipEditorView > .form-actions > .hidden + button {
  grid-column: 1/-1;
}

/* Relationship action dialogs use the existing modal visual language. */

.rel-action-body {
  display: grid;
  gap: 14px;
  margin: 14px 0;
  max-height: 55vh;
  overflow: auto;
}
.rel-action-body label {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.rel-action-body input,.rel-action-body select {
  width: 100%;
  min-width: 0;
}

/* Relationship editor: full-width relationship categories, hidden legacy picker. */

#relationshipEditorView .rel-setup-row {
  display: block;
  grid-template-columns: minmax(0,1fr);
  width: 100%;
}
#relationshipEditorView .rel-setup-row > .rel-setup-group {
  width: 100%;
  max-width: none;
}
#relationshipEditorView #relCharacterPanel {
  display: none;
}

/* The two actions must be equal-width, including narrow edit screens. */

#editorView .form-actions,#comboEditorView .form-actions,#relationshipEditorView > .form-actions {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 10px;
  align-items: stretch;
}
#editorView .form-actions > button,#comboEditorView .form-actions > button,#relationshipEditorView > .form-actions > button {
  grid-column: auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  margin: 0;
}
#editorView .form-actions > button.hidden + button,#comboEditorView .form-actions > button.hidden + button,#relationshipEditorView > .form-actions > button.hidden + button {
  grid-column: 1/-1;
}

/* Relationship caption size matches the 11px name labels. */

.rel-line-label {
  font-size: 11px;
}
.rel-path-handle {
  pointer-events: all;
  fill: #d2edff;
  stroke: #243c5d;
  stroke-width: 2;
  cursor: move;
}
#relationshipTools #relSelectToggle.active,#relationshipTools #relMoveToggle.active {
  background: #d2edff;
  border-color: #a8d2f5;
  color: #243c5d;
}

/* Modal crop preview uses the same vertical image-controls layout as the profile editor. */

.rel-crop-preview {
  width: 76px;
  aspect-ratio: 1/1;
  border-radius: 12px;
  background: #d2edff;
  overflow: hidden;
  margin: 0 auto 4px;
}
.rel-crop-preview-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6983a6;
  position: relative;
}
.rel-crop-preview-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center;
}
.rel-crop-controls {
  display: grid;
  gap: 14px;
}
.rel-crop-controls label {
  display: grid;
  gap: 12px;
  font-weight: 600;
}
.rel-crop-controls input[type=range] {
  accent-color: #a8d2f5;
}
.rel-crop-controls #relCropReset {
  width: 100%;
}
#relBendCountRow.hidden {
  display: none;
}

/* 관계도 수정창: 종류별로 동일한 폭·간격·스크롤을 사용합니다. */

#relActionDialog {
  align-items: center;
  padding: 16px;
}
#relActionDialog .spoiler-dialog-card {
  box-sizing: border-box;
  width: min(520px,calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#relActionDialog .spoiler-dialog-card > h2 {
  margin: 0 0 12px;
  flex-shrink: 0;
}
#relActionDialog .rel-action-body {
  display: grid;
  margin: 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 3px 8px;
}
#relActionDialog .rel-action-body > label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  margin: 0;
}
#relActionDialog .rel-crop-controls {
  display: grid;
}
#relActionDialog .rel-crop-controls label {
  gap: 7px;
}
#relActionDialog .rel-crop-controls input[type=range] {
  margin: 0;
}
#relActionDialog .rel-crop-controls #relCropReset {
  padding: 10px;
  width: 100%;
}
#relActionDialog .rel-delete-confirm-actions {
  margin-top: 14px;
  flex-shrink: 0;
}
#relActionDialog .rel-crop-preview,
#relActionDialog .rel-crop-preview-inner,
#relActionDialog .rel-crop-preview-inner.rel-node-photo {
  aspect-ratio: 1/1;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
}
#relActionDialog .rel-crop-preview-inner img {
  object-position: center;
  transform-origin: center;
}
@media(max-width:480px) {
  #relActionDialog .spoiler-dialog-card {
    padding: 18px;
  }
}
.photo-slider-number {
  display: inline-block;
  min-width: 46px;
  text-align: right;
  font-size: 12px;
  color: #243c5d;
  font-variant-numeric: tabular-nums;
}
.photo-adjust-controls label,.rel-crop-controls label {
  position: relative;
}
.wiki-toast {
  position: fixed;
  z-index: 100000;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%,12px);
  background: #243c5d;
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 20px;
  max-width: min(90vw,520px);
  text-align: center;
  box-shadow: 0 4px 18px #243c5d33;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s,transform .18s;
}
.wiki-toast.visible {
  opacity: 1;
  transform: translate(-50%,0);
}

/* Relationship dialog controls: override browser-native select appearance consistently. */

#relActionDialog #relActionBody select,
#relActionDialog #relActionBody input:not([type="range"]):not([type="checkbox"]) {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 14px;
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  background-color: #ffffff;
  color: #243c5d;
  font: inherit;
  outline-offset: 2px;
}
#relActionDialog #relActionBody select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23243e55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
#relActionDialog #relActionBody input[type="number"] {
  padding-right: 12px;
}
#relActionDialog #relReplaceCharacter {
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 38px 10px 14px;
  background-color: #ffffff;
  appearance: none;
  -webkit-appearance: none;
}
#relActionDialog #relReplaceCharacter:focus-visible {
  outline: 2px solid #a8d2f5;
  outline-offset: 2px;
}
#relActionDialog .rel-pair-fields {
  min-width: 0;
  margin: 0;
  padding: 9px 12px 11px;
  border: 1px solid #a8d2f5;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
#relActionDialog .rel-pair-fields legend {
  font-weight: 700;
  color: #243c5d;
  padding: 0 6px;
  margin: 0;
}
#relActionDialog .rel-pair-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  line-height: 1.35;
}
#relActionDialog .rel-pair-fields select,#relActionDialog .rel-pair-fields input {
  margin: 0;
}

/* Relationship crop preview: same square viewport and image rendering as the diagram. */

/* Handles must sit above labels and remain directly draggable. */

.rel-handle-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 4;
}
.rel-handle-layer .rel-path-handle {
  pointer-events: all;
  touch-action: none;
}
.rel-label-layer {
  z-index: 3;
}

/* Canvas size controls and draggable relationship captions. */

.rel-canvas-size-label .rel-size-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin-top: 0;
}
.rel-canvas-size-label input[type="number"] {
  width: 86px;
  min-width: 0;
}
#relationshipEditorView .rel-label-layer .rel-line-label {
  pointer-events: all;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}
#relationshipEditorView.rel-moving .rel-label-layer .rel-line-label {
  cursor: grab;
}

/* Relationship editing history controls, alongside zoom. */

#relationshipEditorView .rel-toolbar-zoom-only {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#relationshipEditorView .rel-history-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
#relationshipEditorView .rel-history-buttons button {
  min-width: 46px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
#relationshipEditorView .rel-history-buttons button:disabled {
  opacity: .4;
  cursor: default;
}

/* Relationship editor tools share the same toolbar visual language. */

#relationshipEditorView .rel-toolbar-zoom-only {
  justify-content: space-between;
}
#relationshipEditorView .rel-toolbar-zoom-only .rel-zoom {
  margin-left: auto;
}
#relationshipEditorView .rel-design-tools {
  margin: 0 0 10px;
}
#relationshipEditorView .rel-inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
#relationshipEditorView .rel-inline-actions button {
  border: 1px solid #a8d2f5;
  border-radius: 8px;
  background: white;
  color: #243c5d;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}
#relationshipEditorView .rel-inline-actions button.active {
  background: #d2edff;
  border-color: #a8d2f5;
  font-weight: 700;
}
#relationshipEditorView .rel-toolbar-zoom-only {
  margin-top: 12px;
  margin-bottom: 12px;
}
#relationshipDetailView .rel-detail-bottom-zoom {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}
#relationshipDetailView .rel-detail-bottom-zoom .rel-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
#relationshipDetailView .rel-detail-bottom-zoom .rel-zoom input[type="range"] {
  width: clamp(120px,24vw,260px);
  flex: 0 1 clamp(120px,24vw,260px);
  min-width: 0;
}
#relationshipDetailView .rel-detail-bottom-zoom .rel-zoom .rel-zoom-value {
  min-width: 48px;
  text-align: center;
}
#relationshipTools {
  width: 196px;
}
#relationshipTools #relAlignControls {
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
#relationshipTools #relAlignControls button {
  width: 48px;
  min-width: 48px;
  height: 38px;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #a8d2f5;
  border-radius: 7px;
  background: #ffffff;
  color: #243c5d;
  cursor: pointer;
}
#relationshipTools #relAlignControls button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#relationshipTools #relAlignControls button:disabled {
  opacity: .35;
  cursor: default;
}
#relationshipEditorView .rel-tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #243c5d;
}
#relationshipEditorView .rel-tool-group > span {
  margin-right: 5px;
  font-weight: 600;
}
#relationshipEditorView .rel-tool-group button {
  min-width: 32px;
  height: 32px;
  padding: 4px 7px;
  background: white;
  border: 1px solid #a8d2f5;
  border-radius: 7px;
  color: #243c5d;
  cursor: pointer;
}
#relationshipEditorView #relAlignControls button {
  width: 34px;
  min-width: 34px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#relationshipEditorView #relAlignControls button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#relationshipEditorView .rel-tool-group button.active {
  background: #d2edff;
  border-color: #71afe8;
}
#relationshipEditorView .rel-tool-group button:disabled {
  opacity: .35;
  cursor: default;
}
#relationshipEditorView .rel-tool-group.hidden {
  display: none;
}

/* Detail and editor zoom toolbars stay anchored independently of the scaled canvas. */

#relationshipDetailView .page-actions .rel-zoom {
  flex-shrink: 0;
}
#relationshipDetailView .detail-buttons .rel-zoom {
  flex: 0 0 auto;
  min-width: 0;
  justify-content: flex-end;
}
#relationshipDetailView .detail-buttons .rel-zoom input[type="range"] {
  flex: 0 0 clamp(120px,24vw,260px);
  width: clamp(120px,24vw,260px);
  min-width: 0;
}
#relationshipDetailView .detail-buttons .rel-zoom .rel-zoom-value {
  flex: 0 0 48px;
  text-align: center;
}
#relationshipDetailView .detail-buttons .rel-zoom button {
  flex: 0 0 auto;
}
#relationshipEditorView .rel-toolbar-zoom-only .rel-zoom button {
  min-width: 46px;
  min-height: 46px;
}

/* Relationship toolbar: undo on left, editing tools on right. */

#relationshipEditorView .rel-design-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
#relationshipEditorView .rel-design-tools .rel-history-buttons {
  order: 0;
  flex: 0 0 auto;
}
#relationshipEditorView .rel-design-tools .rel-inline-actions {
  order: 1;
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
#relationshipEditorView .rel-design-tools .rel-inline-actions button {
  min-height: 46px;
  padding: 8px 12px;
  white-space: nowrap;
}
#relationshipEditorView .rel-mode-switch {
  display: flex;
  align-items: stretch;
}
#relationshipEditorView .rel-mode-switch button {
  border-radius: 0;
  min-width: 78px;
}
#relationshipEditorView .rel-mode-switch button:first-child {
  border-radius: 9px 0 0 9px;
}
#relationshipEditorView .rel-mode-switch button:last-child {
  border-radius: 0 9px 9px 0;
  margin-left: -1px;
}
#relationshipEditorView .rel-action-divider {
  width: 1px;
  height: 29px;
  background: #a8d2f5;
  flex: none;
  margin: 0 5px;
}
#relationshipEditorView .rel-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
#relationshipEditorView .rel-action-group button {
  border-radius: 9px;
}
@media (max-width:700px) {
  #relationshipEditorView .rel-design-tools {
    align-items: flex-start;
  }
  #relationshipEditorView .rel-design-tools .rel-inline-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  #relationshipEditorView .rel-action-divider {
    display: none;
  }
}

/* The align panel uses the same inset spacing as the shared formatting tools. */

#relationshipTools {
  padding: 10px;
}
#relationshipTools #relAlignControls {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  column-gap: 6px;
  row-gap: 8px;
  align-content: start;
  justify-items: stretch;
}
#relationshipTools #relAlignControls button[data-align] {
  grid-column: span 2;
  width: 100%;
  min-width: 0;
  height: 38px;
}
#relationshipTools #relAlignControls #relTempGroup {
  grid-column: 1/-1;
  width: 100%;
  min-width: 0;
  height: 38px;
  font-size: 12px;
  font-weight: 700;
  background: #ffffff;
}
#relationshipTools #relAlignControls #relTempGroup.active {
  background: #d2edff;
  border-color: #a8d2f5;
  color: #243c5d;
}
#relationshipTools #relAlignControls button[data-align]:focus-visible,
#relationshipTools #relAlignControls #relTempGroup:focus-visible {
  outline: 2px solid #71afe8;
  outline-offset: 2px;
}
#relationshipTools #relAlignControls button[data-align="distribute-x"],
#relationshipTools #relAlignControls button[data-align="distribute-y"] {
  grid-column: span 3;
  width: 100%;
  min-width: 0;
}

/* Brand title and subtitle share a baseline without changing their typography. */

.site-header .site-brand {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 2px;
  min-width: 0;
}
.site-header .site-brand p {
  margin: 0;
  padding-left: 0;
  position: relative;
  top: -2px;
}

/* Compact crop sliders across character, combo and relationship editors. */

.photo-adjust-controls,.rel-crop-controls {
  display: grid;
  gap: 9px;
  align-content: start;
}
.photo-adjust-controls label,.rel-crop-controls label {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.35;
}
.photo-adjust-controls label input[type="range"],.rel-crop-controls label input[type="range"] {
  grid-column: 1/-1;
  grid-row: 2;
  display: block;
  width: 100%;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
}
.photo-adjust-controls label .photo-slider-number,.rel-crop-controls label .photo-slider-number {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  margin: 0;
  line-height: 1.35;
}
#relActionDialog .rel-crop-controls {
  gap: 11px;
}
#relActionDialog .rel-crop-preview {
  width: 156px;
  height: 156px;
  aspect-ratio: 1/1;
  overflow: hidden;
  margin: 0 auto 2px;
}
#relActionDialog .rel-crop-preview-inner.rel-node-photo {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}
#relActionDialog .rel-crop-preview-inner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-width: none;
  max-height: none;
}
#relActionDialog .rel-action-body {
  gap: 9px;
}

/* Shared reorder layout: the controls occupy their own grid track. */

.wiki-order-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  align-self: center;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
.wiki-order-controls > button,
#relationshipEditorView .rel-category-row .wiki-order-controls > button,
.combo-member-row .wiki-order-controls > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 29px;
  min-width: 34px;
  max-width: 34px;
  min-height: 29px;
  max-height: 29px;
  flex: 0 0 29px;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid #a8d2f5;
  border-radius: 8px;
  background: #ffffff;
  color: #243c5d;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.wiki-order-controls > button:hover {
  background: #d2edff;
}
#editorView .field-row,#comboEditorView .field-row,
#editorView .section-row-top,#comboEditorView .combo-section-head,
#comboEditorView .combo-member-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 34px 48px;
  align-items: center;
  column-gap: 8px;
  row-gap: 8px;
}
#editorView .field-row > .field-name,#comboEditorView .field-row > .field-name,
#editorView .section-row-top > .section-title-input,
#comboEditorView .combo-section-head > input,
#comboEditorView .combo-member-row > select {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  width: 100%;
}
#editorView .field-row > .wiki-order-controls,#comboEditorView .field-row > .wiki-order-controls,
#editorView .section-row-top > .wiki-order-controls,
#comboEditorView .combo-section-head > .wiki-order-controls,
#comboEditorView .combo-member-row > .wiki-order-controls {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}
#editorView .field-row > .remove-field,#comboEditorView .field-row > .remove-field,
#editorView .section-row-top > .remove-section,
#comboEditorView .combo-section-head > button:not(.wiki-order-controls button),
#comboEditorView .combo-member-row > button {
  grid-column: 3;
  grid-row: 1;
  width: 48px;
  height: 58px;
  min-width: 0;
  align-self: center;
  justify-self: stretch;
  margin: 0;
}
#editorView .field-row > .rich-content,#comboEditorView .field-row > .rich-content {
  grid-column: 1/-1;
  grid-row: 2;
  min-width: 0;
  width: 100%;
}
#relationshipEditorView .rel-category-row {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) 34px 48px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#relationshipEditorView .rel-category-row > input[type=color] {
  grid-column: 1;
  grid-row: 1;
  width: 44px;
  min-width: 0;
}
#relationshipEditorView .rel-category-row > input[data-cat-name] {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
}
#relationshipEditorView .rel-category-row > .wiki-order-controls {
  grid-column: 3;
  grid-row: 1;
}
#relationshipEditorView .rel-category-row > button[data-cat-remove] {
  grid-column: 4;
  grid-row: 1;
  width: 48px;
  height: 58px;
  min-width: 0;
  margin: 0;
}
@media(max-width:480px) {
  #editorView .field-row,#comboEditorView .field-row,
  #editorView .section-row-top,#comboEditorView .combo-section-head,
  #comboEditorView .combo-member-row {
    grid-template-columns: minmax(0,1fr) 34px 42px;
    column-gap: 6px;
  }
  #relationshipEditorView .rel-category-row {
    grid-template-columns: 38px minmax(0,1fr) 34px 42px;
    gap: 6px;
  }
  #editorView .field-row > .remove-field,#comboEditorView .field-row > .remove-field,
  #editorView .section-row-top > .remove-section,
  #comboEditorView .combo-section-head > button:not(.wiki-order-controls button),
  #comboEditorView .combo-member-row > button,
  #relationshipEditorView .rel-category-row > button[data-cat-remove] {
    width: 42px;
  }
}

/* Indented paragraphs wrap consistently at every viewport width. */

.rich-content .editor-indent,.body-content .wiki-indent-paragraph,
.profile-table .wiki-indent-paragraph,.combo-detail-content .wiki-indent-paragraph {
  display: inline;
  padding-left: 0.8em;
  margin-left: 0;
  line-height: inherit;
  overflow-wrap: anywhere;
}
.rich-content .editor-indent:empty::before {
  content: ' ';
  white-space: pre;
}
#formatIndent {
  min-height: 32px;
}
.rich-content .editor-indent-mark {
  line-height: inherit;
  overflow-wrap: anywhere;
}

/* Normalize order buttons across all editor rows; no global button styling leaks. */

#editorView .wiki-order-controls > button,
#comboEditorView .wiki-order-controls > button,
#relationshipEditorView .wiki-order-controls > button {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 29px;
  min-width: 34px;
  max-width: 34px;
  min-height: 29px;
  max-height: 29px;
  flex: 0 0 29px;
  padding: 0;
  margin: 0;
  border: 1px solid #a8d2f5;
  border-radius: 8px;
  background: #ffffff;
  color: #243c5d;
  font: 400 12px/1 sans-serif;
  box-shadow: none;
  transform: none;
  box-sizing: border-box;
}
#editorView .wiki-order-controls > button:hover,
#comboEditorView .wiki-order-controls > button:hover,
#relationshipEditorView .wiki-order-controls > button:hover {
  background: #d2edff;
}

/* The editor wrapper is inline, so nested indentation works with rich formatting. */

.rich-content .editor-indent {
  display: inline;
  margin-left: 0;
  padding-left: 0.8em;
}
.rich-content .editor-indent-mark {
  display: inline;
  margin-left: 0;
  padding-left: 0.8em;
}

/* Preserve the complete uploaded image in previews, profiles, and list cards. */

.image-preview img,.combo-image-preview img,.profile-photo img,
.combo-profile-card .profile-photo img,.character-card .card-image img,
.combo-mini-photo img {
  object-fit: contain;
}

/* Keep the saved background contrast on field headings, including document-specific overrides. */

.profile-card .profile-table th {
  color: var(--profile-contrast,#000000);
}

/* Touch drag of relationship labels must not be intercepted by mobile scrolling. */

#relationshipEditorView .rel-label-layer,
#relationshipEditorView .rel-label-layer .rel-line-label {
  touch-action: none;
}

/* Spoiler text retains its own indentation without introducing a block line break. */

.spoiler-revealed .wiki-indent-paragraph {
  display: inline;
  padding-left: 0.8em;
  line-height: inherit;
}

/* List-only thumbnails fill their frame, maintaining intrinsic proportions. */

.character-card .card-image img,
.character-card .card-image img.rel-list-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* List thumbnails use the complete frame without stretching; saved document framing is unaffected. */

.character-card .card-image > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Keep detail navigation visible even when the destination does not exist. */

.page-actions .history-controls button:disabled {
  opacity: .4;
  cursor: default;
}

/* Relationship list thumbnail: never stretch the rendered diagram. */

.character-card[data-type="relationship"] .card-image img.rel-list-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.rel-group-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.rel-group-layer [data-group] {
  pointer-events: visiblePainted;
  cursor: pointer;
}
.rel-group-member-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 230px;
  overflow: auto;
}
.rel-group-member {
  display: flex;
  align-items: center;
  gap: 8px;
}
@media(max-width:480px) {
  #relationshipEditorView .rel-category-row > button[data-group-cat-remove] {
    width: 42px;
  }
}
.rel-group-name {
  stroke-width: 2.5px;
  pointer-events: all;
  cursor: grab;
  touch-action: none;
}
.rel-group-handle {
  fill: #ffffff;
  stroke: #71afe8;
  stroke-width: 2;
  cursor: move;
  pointer-events: all;
  touch-action: none;
}
#relationshipEditorView .rel-group-member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}
#relationshipEditorView .rel-group-member-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 42px;
  gap: 8px;
}
#relationshipEditorView .rel-group-member-row select {
  min-width: 0;
  width: 100%;
}

/* Gomcoffee Editor-style spotlight manual, scoped to OC WIKI. */

.oc-manual-overlay[hidden] {
  display: none!important;
}
.oc-manual-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}
.oc-manual-shade {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .77);
  pointer-events: auto;
}
.oc-manual-focus {
  position: fixed;
  border: 3px solid #ffcf64;
  border-radius: 10px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .28);
  pointer-events: none;
  z-index: 2;
  transition: top .12s,left .12s,width .12s,height .12s;
}
.oc-manual-popover {
  position: fixed;
  z-index: 3;
  width: min(360px,calc(100vw - 24px));
  padding: 18px;
  background: #ffffff;
  color: #243c5d;
  border: 2px solid #a8d2f5;
  border-radius: 14px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, .3);
  pointer-events: auto;
}
.oc-manual-popover h3 {
  margin: 8px 0;
  font-size: 17px;
}
.oc-manual-popover p {
  margin: 8px 0 15px;
  line-height: 1.65;
  white-space: pre-line;
  font-size: 14px;
}
.oc-manual-progress {
  font-size: 12px;
  color: #6983a6;
}
.oc-manual-buttons {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.oc-manual-buttons button {
  padding: 9px 12px;
  font-size: 13px;
  width: auto;
}
@media(max-width:600px) {
  .oc-manual-popover {
    padding: 13px;
  }
}

/* 목록의 문서 수는 데이터가 없어도 표시합니다. */

#countText {
  display: inline-block;
  visibility: visible;
  min-width: 3.4em;
  text-align: right;
}

/* Group categories use the exact same row sizing as relationship categories. */

#relationshipEditorView .rel-category-row > input[data-group-cat-name] {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
}
#relationshipEditorView .rel-category-row > button[data-group-cat-remove] {
  grid-column: 4;
  grid-row: 1;
  width: 48px;
  height: 58px;
  min-width: 0;
  margin: 0;
}
@media(max-width:480px) {
  #relationshipEditorView .rel-category-row > button[data-group-cat-remove] {
    width: 42px;
  }
}

/* Match the relationship caption's white outline, with a larger group name. */

.rel-group-name {
  font-size: 20px;
  stroke: #ffffff;
  stroke-width: 3.5px;
  paint-order: stroke;
  stroke-linejoin: round;
}

/* Group category controls share the same layout and button size as relation categories. */

#relationshipEditorView .rel-category-row > input[data-group-cat-name],
#relationshipEditorView .rel-category-row > input[data-cat-name] {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  width: 100%;
}
#relationshipEditorView .rel-category-row > button[data-group-cat-remove],
#relationshipEditorView .rel-category-row > button[data-cat-remove] {
  grid-column: 4;
  grid-row: 1;
  width: 48px;
  height: 58px;
  min-width: 0;
  margin: 0;
}
#relationshipEditorView #relAddGroupCategory,
#relationshipEditorView #relAddCategory {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
}
#relationshipEditorView #relGroupCategoryPanel {
  margin-top: 0;
}
#relationshipEditorView .rel-setup-group:has(#relGroupCategoryPanel) {
  margin-top: 32px;
}
@media(max-width:480px) {
  #relationshipEditorView .rel-category-row > button[data-group-cat-remove],
 #relationshipEditorView .rel-category-row > button[data-cat-remove] {
    width: 42px;
  }
}

/* Visible multi-selection feedback for captions and control points. */

#relationshipEditorView .rel-group-name.selected {
  stroke: #a8d2f5;
  stroke-width: 8px;
  paint-order: stroke;
}
#relationshipEditorView .rel-path-handle.selected,
#relationshipEditorView .rel-group-handle.selected {
  fill: #ffcf64;
  stroke: #243c5d;
  stroke-width: 3px;
  r: 10px;
}

/* Slightly smaller combination caption; keep the white outline. */

.rel-group-name {
  font-size: 16px;
  stroke-width: 3px;
}

/* 공지: 설명서 왼쪽의 읽지 않은 공지 표시와 본문 줄바꿈 */

#noticeOpen {
  position: relative;
}
.notice-unread {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: #a82d36;
  vertical-align: top;
}
.notice-unread.hidden {
  display: none;
}
.notice-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  margin: 12px 0 18px;
  text-align: left;
}
.notice-content a {
  color: #243c5d;
  text-decoration: underline;
}

/* Photo crop coordinates are percentages of the same aspect-ratio frame in editor and detail. */

.image-preview img,.combo-image-preview img,.profile-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex: none;
}

/* Preserve saved thumbnail framing: no later rule may discard the inline crop transform. */

.character-card .card-image > img:not(.rel-list-thumbnail) {
  transform-origin: center center;
}

/* Document folder controls */

.wiki-folder-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.wiki-folder-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.wiki-folder-toolbar select {
  max-width: 180px;
}
.wiki-folder-move {
  font-size: 11px;
  padding: 3px 7px;
  white-space: nowrap;
}

/* Relationship portraits must fill the square frame; zoom/translation are bounded in script.js. */

.rel-node-photo img,.wiki-png-export .rel-node-photo img,#relActionDialog .rel-crop-preview-inner img {
  object-fit: cover;
}

/* List filter bar: same compact bordered control language as the sort selector. */

.wiki-list-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 6px;
}
.wiki-list-toolbar .wiki-filter-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.wiki-list-toolbar select {
  width: auto;
  min-width: 105px;
  max-width: 170px;
  border-radius: 9px;
  padding: 7px 10px;
}
.wiki-list-toolbar #countText {
  margin-left: auto;
  white-space: nowrap;
}
.wiki-list-toolbar #searchInput {
  width: 210px;
  max-width: 100%;
}
#listView>.list-filters {
  display: none;
}
.wiki-folder-toolbar {
  margin: 4px 0 10px;
}
.wiki-editor-folder {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 14px;
}
.wiki-editor-folder select {
  max-width: 240px;
}
@media(max-width:700px) {
  .wiki-list-toolbar #countText {
    margin-left: 0;
  }
  .wiki-list-toolbar #searchInput {
    flex: 1 1 160px;
    width: auto;
  }
}

/* Relationship imports show the full original photo instead of pre-cropping it. */

.rel-node-photo img,.wiki-png-export .rel-node-photo img,#relActionDialog .rel-crop-preview-inner img {
  object-fit: contain;
}

/* Unified list filters: identical treatment to the existing sort control. */

.wiki-list-toolbar .wiki-filter-field {
  font-size: 13px;
  gap: 7px;
  color: inherit;
}
.wiki-list-toolbar .wiki-filter-field select {
  appearance: auto;
  box-sizing: border-box;
  min-width: 120px;
  max-width: 190px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  color: inherit;
  font: inherit;
  line-height: normal;
}
.wiki-list-toolbar #sortSelect {
  min-width: 120px;
}
.character-card .card-image > img[data-document-thumbnail] {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: none;
  position: static;
}

/* List actions and document grid breathing room */

.wiki-list-toolbar {
  margin-bottom: 26px;
  row-gap: 12px;
}
.wiki-list-toolbar .wiki-batch-toggle {
  padding: 9px 16px;
  border-radius: 9px;
  white-space: nowrap;
}
.wiki-batch-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
.wiki-batch-bar.hidden {
  display: none;
}
.wiki-batch-bar select {
  min-width: 150px;
  max-width: 240px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #ffffff;
  color: inherit;
}
.wiki-batch-bar button {
  border-radius: 9px;
  padding: 9px 14px;
}
.wiki-batch-bar .wiki-batch-danger {
  color: #a82d36;
  border: 1px solid #a82d36;
  background: #ffffff;
}
.wiki-batch-card {
  cursor: pointer;
  position: relative;
}
.wiki-batch-card.wiki-batch-selected {
  outline: 3px solid #71afe8;
  outline-offset: -3px;
}
.wiki-batch-check {
  display: none;
  position: absolute;
  z-index: 3;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border: 2px solid #777777;
  border-radius: 7px;
  background: white;
  color: transparent;
  text-align: center;
  line-height: 20px;
  font-weight: 800;
  box-shadow: 0 1px 4px #00000022;
}
.wiki-batch-card .wiki-batch-check {
  display: block;
}
.wiki-batch-selected .wiki-batch-check {
  border-color: #71afe8;
  background: #71afe8;
  color: white;
}
@media(max-width:700px) {
  .wiki-list-toolbar {
    margin-bottom: 22px;
  }
  .wiki-list-toolbar .wiki-batch-toggle {
    margin-left: 0;
  }
  .wiki-batch-bar select {
    flex: 1 1 150px;
  }
}

/* List-only scroll layout: keep the filter row and bulk actions visible. */

body:has(#listView:not(.hidden)) {
  height: 100dvh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body:has(#listView:not(.hidden)) > .site-header {
  flex: 0 0 auto;
  width: 100%;
}
body:has(#listView:not(.hidden)) > main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#listView:not(.hidden) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
#listView > .wiki-list-toolbar,#listView > .wiki-batch-bar {
  flex: 0 0 auto;
}
#listView > #characterList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
  padding: 3px 4px 20px;
}
#listView > #emptyState:not(.hidden) {
  flex: 0 0 auto;
}

/* Match the batch-edit action height to the adjacent selects. */

.wiki-list-toolbar .wiki-batch-toggle {
  box-sizing: border-box;
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Shared header dimensions on all pages; list-only flex layout must not stretch it. */

.site-header {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
  flex-shrink: 0;
}
.site-header .site-title-home {
  appearance: none;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}
.site-header .site-title-home:hover {
  color: var(--accent);
}
.site-header .site-title-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Search stays next to the right-hand edit action. */

.wiki-list-toolbar #searchInput {
  margin-left: 0;
}
.wiki-list-toolbar .wiki-batch-toggle {
  flex: 0 0 auto;
}

/* Keep viewport's scrollbar gutter identical between list and document views. */

html {
  scrollbar-gutter: stable;
}
body:has(#listView:not(.hidden)) > .site-header,
body:not(:has(#listView:not(.hidden))) > .site-header,
body > main {
  width: 100%;
  max-width: 1050px;
  margin-left: auto;
  margin-right: auto;
}

/* One shared control height, including search and all three dropdowns. */

.wiki-list-toolbar .wiki-filter-field select,
.wiki-list-toolbar #searchInput,
.wiki-list-toolbar .wiki-batch-toggle {
  box-sizing: border-box;
  height: 42px;
  min-height: 42px;
  margin-top: 0;
  margin-bottom: 0;
}
.wiki-list-toolbar .wiki-filter-field select {
  padding: 0 12px;
}
.wiki-list-toolbar #searchInput {
  padding: 0 12px;
}
.wiki-list-toolbar .wiki-batch-toggle {
  padding: 0 16px;
}

/* Do not display the raw photo before its final thumbnail is computed. */

.character-card .card-image > img[data-document-thumbnail].thumbnail-pending {
  visibility: hidden;
}
.character-card .card-image > img[data-document-thumbnail].thumbnail-ready {
  visibility: visible;
}

/* Folder pages: reuse the same document editor and card primitives. */

#folderEditorView .folder-editor-top {
  grid-template-columns: 220px minmax(0,1fr);
}
#folderEditorView .folder-editor-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d2edff;
  aspect-ratio: 3/4;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
#folderEditorView .folder-editor-preview .no-image {
  font-size: 14px;
}
#folderDocumentDescription {
  display: block;
  width: 100%;
  min-height: 120px;
  box-sizing: border-box;
  resize: vertical;
}
.folder-document-controls {
  display: grid;
  grid-template-columns: minmax(0,1fr) 170px;
  gap: 10px;
  align-items: center;
}
.folder-document-controls input,.folder-document-controls select {
  width: 100%;
  height: 42px;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
}
.folder-document-selection-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}
#folderDocumentSelectedCount {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-right: auto;
}
.folder-selected-only {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.folder-selected-only input {
  margin: 0;
  width: 16px;
  height: 16px;
}
.folder-document-selection-toolbar button {
  white-space: nowrap;
}
.folder-document-choices {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 3px;
}
.folder-document-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  min-height: 54px;
  box-sizing: border-box;
  transition: background .12s,border-color .12s;
}
.folder-document-choice:hover {
  background: #ffffff;
  border-color: #a8d2f5;
}
.folder-document-choice.is-selected {
  background: #d2edff;
  border-color: #a8d2f5;
}
.folder-document-choice input {
  width: 17px;
  height: 17px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}
.folder-choice-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.folder-choice-name small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 4px;
}
.folder-choice-kind {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 400;
}
.folder-document-empty {
  color: var(--muted);
  text-align: center;
  padding: 22px;
}
.folder-document-detail h2 {
  margin: 0 0 8px;
}
.folder-detail-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.folder-detail-list-title h3 {
  margin: 0;
  font-size: 17px;
}
.folder-detail-documents {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.folder-detail-document {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 9px;
  padding: 13px 16px;
  cursor: pointer;
  color: var(--text);
}
.folder-detail-document:hover {
  background: #ffffff;
}
@media(max-width:700px) {
  #folderEditorView .folder-editor-top {
    grid-template-columns: minmax(0,1fr);
  }
  #folderEditorView .folder-editor-image {
    width: 220px;
    max-width: 100%;
  }
  .folder-document-controls {
    grid-template-columns: minmax(0,1fr);
  }
  .folder-document-selection-toolbar {
    gap: 8px;
  }
}

/* Folder selection: existing list toolbar pattern. */

#folderEditorView .folder-member-section {
  margin-top: 26px;
  min-width: 0;
}
#folderEditorView .folder-document-controls .wiki-filter-field {
  font-size: 14px;
  font-weight: 600;
}
#folderEditorView .folder-document-controls select,#folderEditorView #folderDocumentSearch {
  font-size: 14px;
}
#folderEditorView #folderDocumentSelectedCount {
  white-space: nowrap;
}
#folderEditorView #folderDocumentSearch {
  max-width: 100%;
}
#folderEditorView .folder-selected-only {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
#folderEditorView .folder-document-choices {
  display: grid;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}
#folderEditorView .folder-document-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  min-height: 54px;
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  box-sizing: border-box;
}
#folderEditorView .folder-document-choice:hover {
  background: #ffffff;
}
#folderEditorView .folder-document-choice.is-selected {
  background: #d2edff;
  border-color: #a8d2f5;
}
#folderEditorView .folder-document-choice input {
  width: 17px;
  height: 17px;
  flex: none;
  margin: 0;
}
#folderEditorView .folder-choice-name {
  flex: 1;
  min-width: 0;
}
#folderEditorView .folder-choice-kind {
  font-size: 12px;
  color: #6983a6;
  white-space: nowrap;
}
@media(max-width:700px) {
  #folderEditorView #folderDocumentSearch {
    flex: 1 1 200px;
    width: auto;
  }
  #folderEditorView #folderDocumentSelectedCount {
    margin-left: 0;
  }
}

/* Folder member picker: controls above, selectable list in middle, actions below. */

#folderEditorView .folder-document-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
#folderEditorView .folder-document-controls .wiki-filter-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
#folderEditorView .folder-document-controls select,#folderEditorView #folderDocumentSearch {
  height: 42px;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  background: #ffffff;
  padding: 0 12px;
}
#folderEditorView .folder-document-controls select {
  width: 145px;
}
#folderEditorView #folderDocumentSearch {
  flex: 1 1 190px;
  min-width: 160px;
}
#folderEditorView .folder-document-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 2px;
}
#folderEditorView #folderDocumentSelectedCount {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
#folderEditorView .folder-select-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#folderEditorView .folder-select-actions button {
  border-radius: 10px;
}

/* Folder membership: compact multi-select at the bottom of each document editor. */

.wiki-folder-membership-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}
.wiki-folder-membership-choice {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  font-size: 14px;
}
.wiki-folder-membership-choice:has(input:checked) {
  border-color: #71afe8;
  background: #d2edff;
}
.wiki-folder-membership-choice input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #71afe8;
}
.wiki-folder-empty {
  color: #6983a6;
  font-size: 13px;
}
.wiki-backup-dialog {
  width: min(460px,calc(100vw - 32px));
  border: 1px solid #a8d2f5;
  border-radius: 16px;
  padding: 24px;
  background: #ffffff;
  color: #243c5d;
  box-shadow: 0 16px 60px #243c5d33;
}
.wiki-backup-dialog::backdrop {
  background: #243c5d70;
}
.wiki-backup-dialog h2 {
  margin: 0 0 12px;
}
.wiki-backup-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 10px;
  align-items: center;
  padding: 13px 12px;
  margin: 9px 0;
  border: 1px solid #d2edff;
  border-radius: 10px;
  cursor: pointer;
}
.wiki-backup-option input {
  grid-row: span 2;
  margin: 0;
  accent-color: #71afe8;
}
.wiki-backup-option small {
  grid-column: 2;
  color: #6983a6;
  margin-top: 3px;
}
#wikiBackupFolderWrap {
  margin: 14px 0;
}
#wikiBackupFolderWrap label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}
#wikiBackupFolder {
  width: 100%;
  height: 42px;
  border: 1px solid #a8d2f5;
  border-radius: 10px;
  padding: 0 12px;
  background: #ffffff;
}
.wiki-backup-hint {
  font-size: 12px;
  color: #6983a6;
  line-height: 1.5;
}

/* Selection border stays above thumbnails, without changing their crop. */
.character-card.wiki-batch-card.wiki-batch-selected{outline:none;position:relative;isolation:isolate}
.character-card.wiki-batch-card.wiki-batch-selected::after{content:"";position:absolute;inset:0;border:3px solid #71afe8;border-radius:inherit;pointer-events:none;z-index:4}
.character-card.wiki-batch-card .card-image{overflow:hidden}

/* Genre selection: centered compact tiles; document cards elsewhere are unchanged. */
#workspaceHome .genre-home-title{margin:14px 0 24px;text-align:center;font-size:20px;font-weight:700;color:var(--text)}
#workspaceHome .workspace-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,210px));justify-content:center;gap:18px;max-width:920px;margin:0 auto}
#workspaceHome .workspace-card{position:relative;display:flex;flex-direction:column;align-items:stretch;gap:0;padding:0;min-width:0;min-height:0;height:auto;width:100%;text-align:center;overflow:hidden}
#workspaceHome .workspace-card .card-image{flex:none;width:100%;min-width:0;height:148px;min-height:0;aspect-ratio:auto;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#d2edff}
#workspaceHome .workspace-folder-icon{width:76px;height:76px;max-width:80%}
#workspaceHome .workspace-card .card-info{display:flex;flex:1;min-width:0;flex-direction:column;justify-content:space-between;padding:14px 12px;gap:12px}
#workspaceHome .workspace-card .list-card-top{display:flex;justify-content:center;min-height:25px}
#workspaceHome .workspace-card-name{font-size:16px;font-weight:700;line-height:1.4;overflow-wrap:anywhere}
#workspaceHome .workspace-card .list-card-bottom{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px}
#workspaceHome .workspace-card .list-modified{white-space:nowrap;font-size:12px}
#workspaceHome .workspace-card .wiki-batch-check{position:absolute;top:10px;right:10px;z-index:5;pointer-events:none}
#workspaceHome .genre-home-actions{display:flex;justify-content:center;gap:10px;margin:24px auto 0}
#workspaceHome .genre-home-actions button{min-width:86px}
@media(max-width:480px){#workspaceHome .workspace-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}#workspaceHome .workspace-card .card-image{height:112px}#workspaceHome .workspace-card .card-info{padding:10px 8px}}

/* Existing workspace edit and backup controls retained. */
.workspace-card:hover{border-color:#a8d2f5}.workspace-card small{color:#6983a6}
.workspace-edit-panel{min-width:min(440px,80vw)}
.workspace-edit-panel h2{margin:0 0 8px}
.workspace-edit-panel p{color:#6983a6;margin:0 0 18px;font-size:13px}
.workspace-edit-items{display:grid;gap:9px;max-height:55vh;overflow:auto}
.workspace-edit-row{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:9px;padding:10px}
.workspace-edit-row strong{flex:1;min-width:0;overflow-wrap:anywhere}
.workspace-edit-row button{white-space:nowrap}
.workspace-edit-danger{color:#a82d36}
.workspace-backup-select{display:block;box-sizing:border-box;width:100%;min-width:0;margin-top:9px;padding:11px 35px 11px 13px;border:1px solid var(--line);border-radius:10px;background:#ffffff;color:inherit;font:inherit;cursor:pointer}
.workspace-backup-select:focus-visible{outline:2px solid #71afe8;outline-offset:2px}

/* List actions share identical dimensions regardless of their label. */
#listView #listBatchEdit,
#listView #newBtn{min-width:76px;box-sizing:border-box;}

/* Genre cards reuse the document thumbnail color and keep metadata in one row. */
#workspaceHome .workspace-card{text-align:left}
#workspaceHome .workspace-card .card-image{background:#d2edff}
#workspaceHome .workspace-card .card-info{padding:13px 14px 15px;gap:8px;justify-content:flex-start;min-height:76px;box-sizing:border-box}
#workspaceHome .workspace-card .list-card-top{justify-content:flex-start;align-items:flex-start;min-height:0}
#workspaceHome .workspace-card .list-card-bottom{display:flex;flex-direction:row;align-items:baseline;justify-content:flex-start;gap:0;flex-wrap:nowrap;min-width:0;margin-top:0;font-size:12px;color:var(--muted);white-space:nowrap}
#workspaceHome .workspace-card .list-type-label{flex:none;min-width:0;font-size:12px;white-space:nowrap}
#workspaceHome .workspace-card .list-modified{flex:none;max-width:none;width:auto;min-width:0;margin:0;align-self:auto;text-align:left;font-size:12px;white-space:nowrap}
#workspaceHome .workspace-card .list-modified:not(:empty)::before{content:'·';margin:0 6px;color:var(--muted)}
@media(max-width:480px){#workspaceHome .workspace-card .card-info{padding:11px 10px 13px;min-height:72px;gap:7px}#workspaceHome .workspace-card .list-card-bottom{font-size:11px}#workspaceHome .workspace-card .list-type-label,#workspaceHome .workspace-card .list-modified{font-size:11px}#workspaceHome .workspace-card .list-modified:not(:empty)::before{margin:0 4px}}
/* All pages share the same footer alignment; individual document dates remain inside documents. */
body > footer{width:100%;box-sizing:border-box;max-width:1050px;margin:0 auto;padding:16px 20px 25px;justify-content:center;text-align:center}
/* Genre move dialog: one padding layer and natural content height. */
#wikiGenreMoveDialog{width:min(460px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);padding:0;box-sizing:border-box;overflow-y:auto}
#wikiGenreMoveDialog .wiki-genre-move-content{padding:24px;min-width:0;box-sizing:border-box}
#wikiGenreMoveDialog h2{margin:0 0 10px}
#wikiGenreMoveDialog p{margin:0 0 14px}
#wikiGenreMoveDialog .wiki-genre-move-label{display:flex;flex-direction:column;gap:8px;font-weight:600;margin-bottom:14px}
#wikiGenreMoveDialog .wiki-genre-move-label select{width:100%;min-height:42px;border:1px solid var(--line);border-radius:10px;background:#ffffff;padding:9px 12px;color:var(--text);font:inherit;box-sizing:border-box}
#wikiGenreMoveDialog .wiki-genre-move-warning{white-space:pre-line;font-size:12px;line-height:1.6;color:var(--muted);margin-bottom:20px}
#wikiGenreMoveDialog .form-actions{margin-top:0}
@media(max-width:480px){#wikiGenreMoveDialog .wiki-genre-move-content{padding:20px 18px}}

/* Genre cards: explicit left alignment at every nested level, independent of document card defaults. */
#workspaceHome .workspace-card .card-info,#workspaceHome .workspace-card .list-card-top,#workspaceHome .workspace-card .list-card-bottom{align-items:flex-start;text-align:left;justify-content:flex-start;width:100%;box-sizing:border-box}
#workspaceHome .workspace-card .card-info{display:flex;flex-direction:column;gap:7px;padding:14px 13px 16px;min-height:74px}
#workspaceHome .workspace-card .list-card-top{display:block;flex:none;margin:0;padding:0}
#workspaceHome .workspace-card .workspace-card-name{display:block;text-align:left;margin:0;width:100%}
#workspaceHome .workspace-card .list-card-bottom{display:flex;flex-direction:row;flex:none;flex-wrap:nowrap;gap:0;margin:0;padding:0;white-space:nowrap}
#workspaceHome .workspace-card .list-type-label,#workspaceHome .workspace-card .list-modified{display:inline;flex:none;align-self:auto;margin:0;max-width:none;width:auto;text-align:left}
#workspaceHome .workspace-card .card-image{background:#d2edff}
#workspaceHome .workspace-thumbnail-photo{width:100%;height:100%;display:block}
#workspaceHome .workspace-folder-icon{width:72px;height:72px}
.genre-edit-dialog{box-sizing:border-box;width:min(460px,calc(100vw - 28px));max-height:calc(100dvh - 36px);overflow-y:auto;padding:22px 24px}
.genre-edit-dialog .genre-edit-name,.genre-edit-dialog .genre-image-editor>label{display:block;font-weight:600;font-size:14px;margin:12px 0 8px}
.genre-edit-dialog .genre-edit-name input{display:block;box-sizing:border-box;width:100%;margin-top:7px;padding:10px;border:1px solid #a8d2f5;border-radius:9px;font:inherit}
.genre-image-preview{width:100%;height:160px;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:10px;background:#d2edff;margin:8px 0 12px}
.genre-image-preview img{display:block;width:100%;height:100%;object-fit:contain}
.genre-image-preview .workspace-folder-icon{width:72px;height:72px}
.genre-image-editor>input[type=file]{display:block;max-width:100%;font-size:13px;margin-bottom:9px}
.genre-crop-controls{display:grid;gap:7px;margin-top:12px}
.genre-crop-controls label{display:grid;gap:4px;font-size:13px}
.genre-crop-controls input{width:100%}
.genre-dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
@media(max-width:480px){#workspaceHome .workspace-card .card-info{padding:12px 10px 14px;gap:6px}.genre-edit-dialog{padding:18px}}

/* Genre thumbnail: the editor preview has exactly the card thumbnail proportions. */
#workspaceHome .workspace-card .card-image{height:auto;aspect-ratio:210 / 148;min-height:0;background:#d2edff}
#workspaceHome .workspace-card .card-image .workspace-thumbnail-photo{width:100%;height:100%;object-fit:contain}
.genre-image-preview{width:min(100%,210px);height:auto;aspect-ratio:210 / 148;margin:9px auto 14px;box-sizing:border-box;background:#d2edff;border-radius:10px;overflow:hidden}
.genre-image-preview img{width:100%;height:100%;object-fit:contain}
.genre-image-editor #genreImageRemove,.genre-image-editor #genreImageReset{box-sizing:border-box;min-width:132px;min-height:36px}
.genre-image-editor #genreImageRemove{display:block;width:100%;margin:8px 0 4px}
.genre-image-editor #genreImageReset{width:100%}
/* Site-wide floating page navigation; unobtrusive until the page is scrolled. */
.page-scroll-controls{position:fixed;left:max(12px,env(safe-area-inset-left));bottom:max(18px,env(safe-area-inset-bottom));z-index:900;display:flex;flex-direction:column;gap:7px;opacity:0;visibility:hidden;pointer-events:none;transform:translateY(8px);transition:opacity .18s ease,transform .18s ease,visibility .18s}
.page-scroll-controls.is-visible{opacity:1;visibility:visible;pointer-events:auto;transform:none}
.page-scroll-controls button{display:flex;align-items:center;justify-content:center;width:38px;height:38px;min-width:38px;padding:0;border:1px solid #a8d2f5;border-radius:11px;background:rgba(255, 255, 255, .94);color:#6983a6;box-shadow:0 2px 10px rgba(36, 60, 93, .13);font-size:21px;line-height:1;cursor:pointer}
.page-scroll-controls button:hover{background:#d2edff}
.page-scroll-controls button:focus-visible{outline:2px solid #71afe8;outline-offset:2px}
@media(prefers-reduced-motion:reduce){.page-scroll-controls{transition:none}}

/* Final genre card: one consistent thumbnail frame and strictly left-aligned text. */
#workspaceHome .workspace-card{display:flex;flex-direction:column;text-align:left;align-items:stretch;height:auto}
#workspaceHome .workspace-card .workspace-card-image{display:flex;flex:0 0 auto;width:100%;height:auto;aspect-ratio:210/148;min-height:0;position:relative;overflow:hidden;background:#d2edff;align-items:center;justify-content:center}
#workspaceHome .workspace-card .workspace-card-image img.workspace-thumbnail-photo{display:block;position:relative;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}
#workspaceHome .workspace-card .card-info{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;text-align:left;width:100%;padding:14px 13px 16px;min-height:0;gap:7px;box-sizing:border-box}
#workspaceHome .workspace-card .list-card-top{display:block;flex:0 0 auto;width:100%;min-height:0;margin:0;text-align:left}
#workspaceHome .workspace-card .workspace-card-name{display:block;width:100%;text-align:left;margin:0}
#workspaceHome .workspace-card .list-card-bottom{display:flex;flex:0 0 auto;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:baseline;width:100%;margin:0;gap:0;text-align:left;white-space:nowrap}
#workspaceHome .workspace-card .list-card-bottom>*{display:inline-block;flex:0 0 auto;max-width:none;width:auto;margin:0;align-self:auto;text-align:left}
#workspaceHome .workspace-folder-icon,.genre-image-preview .workspace-folder-icon{width:72px;height:72px;max-width:70%;color:#71afe8;flex-shrink:0}
/* Preview and card share the same fixed aspect ratio, clipping and photo positioning. */
.genre-image-preview{display:flex;align-items:center;justify-content:center;width:min(100%,210px);height:auto;aspect-ratio:210/148;min-height:0;overflow:hidden;margin:10px auto 14px;border-radius:10px;background:#d2edff;box-sizing:border-box}
.genre-image-preview img{display:block;width:100%;height:100%;max-width:none;max-height:none;object-fit:contain}
.genre-image-editor #genreImageRemove,.genre-image-editor #genreImageReset{display:block;width:100%;min-width:0;min-height:36px;box-sizing:border-box;margin-left:0;margin-right:0}
@media(max-width:480px){#workspaceHome .workspace-card .card-info{padding:12px 10px 14px;gap:6px}}

/* Genre cards: isolate layout from document list defaults. */
#workspaceHome .workspace-card .card-info{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;text-align:left;gap:7px;padding:14px 13px 16px;width:100%;min-height:0;box-sizing:border-box}
#workspaceHome .workspace-card .list-card-top{display:block;width:100%;text-align:left;min-height:0;margin:0;padding:0}
#workspaceHome .workspace-card .workspace-card-name{display:block;text-align:left;width:100%;margin:0}
#workspaceHome .workspace-card .list-card-bottom{display:flex;flex-direction:row;align-items:baseline;justify-content:flex-start;text-align:left;gap:0;flex-wrap:nowrap;width:100%;min-width:0;margin:0;padding:0;white-space:nowrap}
#workspaceHome .workspace-card .list-card-bottom .list-type-label,#workspaceHome .workspace-card .list-card-bottom .list-modified{display:inline;flex:0 0 auto;width:auto;max-width:none;min-width:0;margin:0;text-align:left;align-self:auto}
#workspaceHome .workspace-card .workspace-card-image,.genre-image-preview{background:#d2edff}
#workspaceHome .workspace-card .workspace-card-image{aspect-ratio:210/148;height:auto;min-height:0}
.genre-image-preview{aspect-ratio:210/148;height:auto;min-height:0;width:min(100%,210px)}
.genre-image-editor #genreImageRemove,.genre-image-editor #genreImageReset{display:block;width:100%;min-width:0;box-sizing:border-box}

/* Genre editor: use the same image adjustment spacing as document image editor. */
.genre-edit-dialog .genre-image-preview{width:100%;max-width:210px;aspect-ratio:210/148;height:auto;margin:10px auto 14px;border-radius:12px;background:#d2edff}
.genre-edit-dialog .genre-image-editor>label{margin:14px 0 8px}
.genre-edit-dialog .genre-image-editor>input[type=file]{width:100%;box-sizing:border-box;padding:10px 12px;border:1px solid var(--line);border-radius:10px;background:#ffffff;margin:0 0 8px;font-size:14px}
.genre-edit-dialog .genre-crop-controls{display:flex;flex-direction:column;gap:14px;margin-top:18px}
.genre-edit-dialog .genre-crop-controls label{display:flex;flex-direction:column;gap:8px;margin:0;font-size:14px;font-weight:700}
.genre-edit-dialog .genre-crop-controls input[type=range]{padding:0;border:0;background:transparent;width:100%;height:20px}
.genre-edit-dialog #genreImageRemove,.genre-edit-dialog #genreImageReset{width:100%;min-height:42px;padding:9px 12px;font-size:14px;font-weight:400;border-radius:10px}
.genre-edit-dialog #genreImageReset{margin-top:2px}
/* Keep the shared folder-open icon at the same proportions in card and editor. */
#workspaceHome .workspace-folder-icon,.genre-image-preview .workspace-folder-icon{width:72px;height:72px;stroke:#71afe8}
/* Page controls must remain above page surfaces, but below dialogs. */
.page-scroll-controls{position:fixed!important;left:12px;bottom:18px;z-index:9999;display:flex;flex-direction:column;gap:7px}
.page-scroll-controls.is-visible{opacity:1;visibility:visible;pointer-events:auto}
/* Two notice pages, shared dialog and shared read-state. */
.notice-page-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:12px 0 16px}
.notice-page-tabs button{min-width:0;padding:10px 8px;border-radius:9px;font-weight:600;background:#ffffff}
.notice-page-tabs button.active{background:#d2edff;border-color:#a8d2f5;color:#243c5d}

/* 2026-11-15: genre editor uses the same two-row slider layout as the setting editor. */
.genre-edit-dialog .genre-image-editor{width:100%;min-width:0}
.genre-edit-dialog .genre-image-preview{width:100%;max-width:none;aspect-ratio:210/148;height:auto;margin:8px 0 12px;border-radius:12px}
.genre-edit-dialog .genre-crop-controls.photo-adjust-controls{display:grid;gap:9px;margin-top:14px}
.genre-edit-dialog .genre-crop-controls.photo-adjust-controls label{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;column-gap:8px;row-gap:4px;align-items:center;margin:0;padding:0;font-size:13px;line-height:1.35;font-weight:600}
.genre-edit-dialog .genre-crop-controls.photo-adjust-controls label .genre-range-value{grid-column:2;grid-row:1;text-align:right;color:#6983a6;font-variant-numeric:tabular-nums}
.genre-edit-dialog .genre-crop-controls.photo-adjust-controls label input[type=range]{grid-column:1/-1;grid-row:2;display:block;width:100%;height:20px;padding:0;margin:0;border:0;background:transparent}
.genre-edit-dialog #genreImageRemove,.genre-edit-dialog #genreImageReset{display:block;width:100%;box-sizing:border-box;min-height:38px;margin:8px 0 0}
/* Shared line icon with consistent dimensions. */
#workspaceHome .workspace-folder-icon,.genre-image-preview .workspace-folder-icon{width:72px;height:72px;fill:none;stroke:#71afe8;stroke-width:2}
/* Page navigation: bottom right on desktop, top right on compact screens. */
.page-scroll-controls{left:auto!important;right:max(16px,env(safe-area-inset-right));bottom:max(70px,calc(env(safe-area-inset-bottom) + 70px));z-index:950}
@media(max-width:700px){.page-scroll-controls{left:auto!important;right:max(12px,env(safe-area-inset-right));top:max(74px,calc(env(safe-area-inset-top) + 74px));bottom:auto}}

/* Fixed tools: desktop slightly higher; mobile near top, clear of bottom navigation. */
@media(min-width:701px){.spoiler-tools{top:35%}}
@media(max-width:700px){.spoiler-tools{top:max(118px,calc(env(safe-area-inset-top) + 118px));bottom:auto;max-height:calc(100dvh - 150px);overflow-y:auto}}
/* Scroll buttons remain at the lower right on all viewports. */
.page-scroll-controls{top:auto!important;bottom:max(18px,calc(env(safe-area-inset-bottom) + 18px))!important;right:max(12px,env(safe-area-inset-right))!important;left:auto!important}

/* Flat icons match the approved genre/book and document-folder pair. */
#workspaceHome .workspace-folder-icon,.genre-image-preview .workspace-folder-icon{width:72px;height:72px;fill:none;stroke:none}
.folder-list-card .document-folder-icon{width:72px;height:72px;display:block;flex-shrink:0}
.folder-list-card .card-image{display:flex;align-items:center;justify-content:center;background:#d2edff}
.folder-navigation-actions{display:flex;gap:8px;justify-content:flex-start;margin:10px 0}
.folder-navigation-actions:has(>button.hidden){margin:0}
.folder-navigation-actions button{border:1px solid #a8d2f5;border-radius:9px;background:#ffffff;color:#243c5d;padding:9px 14px;cursor:pointer}

/* Genre navigation and nested-folder controls. */
#workspaceTitleName .workspace-breadcrumb-link{appearance:none;border:0;background:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;text-decoration:none;vertical-align:baseline}
#workspaceTitleName .workspace-breadcrumb-link:hover{text-decoration:underline;text-underline-offset:3px}
#workspaceTitleName .workspace-breadcrumb-link:focus-visible{outline:2px solid #71afe8;border-radius:3px}
.folder-list-card .document-folder-icon{width:48px;height:48px;max-width:45%;max-height:55%}
#workspaceHome .workspace-card .list-card-bottom{justify-content:flex-start;text-align:left}
#workspaceHome .workspace-card .list-modified{margin:0;text-align:left;max-width:none}

/* Genre cards: date alone has no leading separator. */
#workspaceHome .workspace-card .list-card-bottom .list-modified::before{content:none;display:none}
/* Keep batch controls clickable to explain unavailable actions. */
.wiki-batch-bar button[aria-disabled="true"]{opacity:.52;cursor:not-allowed}

/* Genre titles truncate rather than expanding the card. */
#workspaceHome .workspace-card .list-card-top{min-width:0;width:100%;overflow:hidden}
#workspaceHome .workspace-card .workspace-card-name{display:block;min-width:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;overflow-wrap:normal;word-break:normal}
/* Empty-state messaging is centered within the available list area. */
#listView:has(#emptyState:not(.hidden)) > #characterList{display:none}
#listView > #emptyState:not(.hidden){display:flex;flex:1 1 auto;min-height:180px;padding:20px;flex-direction:column;justify-content:center;align-items:center;box-sizing:border-box}
#workspaceHome #workspaceEmptyState:not(.hidden){display:flex;min-height:40vh;flex-direction:column;align-items:center;justify-content:center;padding:20px}
#workspaceHome #workspaceEmptyState h2,#listView #emptyState h2{margin:0 0 10px}
#workspaceHome #workspaceEmptyState p,#listView #emptyState p{margin:0}
.add-choice-location-note{font-size:13px;color:var(--muted);text-align:center;margin:10px 0 18px}
#wikiFolderMoveDialog{width:min(460px,calc(100vw - 32px));max-width:calc(100vw - 32px);padding:0;box-sizing:border-box}
#wikiFolderMoveDialog .wiki-genre-move-content{padding:24px}
#wikiFolderMoveDialog .wiki-genre-move-label{display:flex;flex-direction:column;gap:8px;margin:16px 0}
#wikiFolderMoveDialog select{width:100%;padding:10px;border:1px solid var(--line);border-radius:8px}

/* Genre cards: constrain flex item width so text-overflow works at every breakpoint. */
#workspaceHome .workspace-cards > .workspace-card{min-width:0;max-width:100%;overflow:hidden}
#workspaceHome .workspace-card .card-info,
#workspaceHome .workspace-card .list-card-top{min-width:0;max-width:100%;overflow:hidden}
#workspaceHome .workspace-card .workspace-card-name{display:block;min-width:0;width:100%;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}
/* Empty states sit near the visual center of the content, not at the bottom of a tall scrolling list. */
#listView:has(#emptyState:not(.hidden)) > #characterList{display:none}
#listView > #emptyState:not(.hidden){flex:0 0 auto;min-height:0;height:auto;margin:clamp(36px,10vh,110px) auto 0;padding:20px 16px;justify-content:center;align-items:center}
#workspaceHome #workspaceEmptyState:not(.hidden){min-height:0;margin:clamp(35px,10vh,100px) auto 0;padding:20px 16px;justify-content:center;align-items:center}
#workspaceHome:has(#workspaceEmptyState:not(.hidden)) .genre-home-title{display:none}

/* 2026-11-15: genre home and add-dialog spacing refinement. */
/* Show the selection heading whenever at least one genre exists. */
#workspaceHome:not(:has(#workspaceEmptyState:not(.hidden))) .genre-home-title{display:block}
/* Empty state sits just above the action buttons, with balanced whitespace. */
#workspaceHome #workspaceEmptyState:not(.hidden){margin:16px auto 0;padding:12px 16px;min-height:0;height:auto}
#workspaceHome:has(#workspaceEmptyState:not(.hidden)) .genre-home-actions{margin-top:18px}
/* Match the left-aligned copy and heading spacing used in other dialogs. */
#addChoiceDialog .spoiler-dialog-card{box-sizing:border-box;padding:22px 22px 18px;width:min(400px,calc(100vw - 32px));text-align:left}
#addChoiceDialog #addChoiceTitle{margin:0 0 10px;padding:0;text-align:left;font-size:20px;line-height:1.4}
#addChoiceDialog .add-choice-location-note{margin:0 0 18px;padding:0;text-align:left;font-size:13px;line-height:1.55}
#addChoiceDialog .combo-choice-buttons{margin:0 0 18px;gap:10px}
#addChoiceDialog .spoiler-dialog-actions{margin-top:0}
@media(max-width:480px){#addChoiceDialog .spoiler-dialog-card{padding:20px 18px 16px}}

/* Custom list ordering */
.wiki-custom-order-dialog{border:1px solid var(--line);border-radius:14px;padding:22px;max-width:min(460px,92vw);width:100%;max-height:80vh;overflow:auto;color:inherit;background:#ffffff}
.wiki-custom-order-dialog::backdrop{background:rgba(0, 0, 0, .35)}
.wiki-custom-order-dialog h3{margin:0 0 10px}.wiki-custom-order-dialog p{margin:0 0 16px;font-size:13px}
.wiki-custom-order-items{display:flex;flex-direction:column;gap:8px}.wiki-custom-order-item{display:flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:9px;padding:8px}.wiki-custom-order-item span{flex:1;min-width:0;overflow-wrap:anywhere}.wiki-custom-order-item button{padding:6px 9px;border-radius:7px}.wiki-custom-order-actions{display:flex;justify-content:flex-end;margin-top:16px}
#customOrderEdit.hidden{display:none}

/* Shared wiki-style location picker: no browser-native dropdown chrome. */
#wikiDocumentMoveDialog .wiki-genre-move-label{display:block;font-weight:600;margin:14px 0 8px}
.wiki-pretty-picker{position:relative;margin-bottom:14px}
.wiki-pretty-picker-trigger{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:44px;padding:10px 13px;background:#ffffff;color:var(--text);font:inherit;text-align:left;border:1px solid var(--line);border-radius:10px;cursor:pointer}
.wiki-pretty-picker-trigger:focus-visible,.wiki-pretty-picker-option:focus-visible{outline:2px solid #71afe8;outline-offset:2px}
.wiki-pretty-picker-chevron{width:8px;height:8px;flex:none;border-right:2px solid #71afe8;border-bottom:2px solid #71afe8;transform:rotate(45deg);margin-right:3px;margin-top:-4px}
.wiki-pretty-picker-options{position:absolute;z-index:30;top:calc(100% + 5px);left:0;right:0;max-height:min(270px,45vh);overflow-y:auto;background:#ffffff;border:1px solid var(--line);border-radius:12px;padding:6px;box-shadow:0 8px 24px rgba(36, 60, 93, .13)}
.wiki-pretty-picker-options.hidden{display:none}
.wiki-pretty-picker-group{padding:9px 10px 5px;color:#71afe8;font-size:12px;font-weight:700}
.wiki-pretty-picker-option{display:block;width:100%;padding:10px 12px;text-align:left;background:transparent;color:var(--text);border:0;border-radius:8px;font:inherit;cursor:pointer}
.wiki-pretty-picker-option:hover,.wiki-pretty-picker-option[aria-selected="true"]{background:#d2edff}
.wiki-pretty-picker-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;overflow:hidden!important}

/* Document move modal: compact height and a separately scrollable destination list. */
#wikiDocumentMoveDialog{
  width:min(540px,calc(100vw - 28px));
  max-width:calc(100vw - 28px);
  max-height:calc(100dvh - 28px);
  box-sizing:border-box;
  padding:20px 22px;
  overflow-y:auto;
}
#wikiDocumentMoveDialog .wiki-genre-move-content{min-width:0}
#wikiDocumentMoveDialog h2{margin:0 0 8px}
#wikiDocumentMoveDialog .wiki-genre-move-content > p{margin:0 0 10px}
#wikiDocumentMoveDialog .wiki-genre-move-label{margin:10px 0 6px}
#wikiDocumentMoveDialog .wiki-pretty-picker{margin-bottom:10px}
#wikiDocumentMoveDialog .wiki-pretty-picker-trigger{min-height:42px;padding:8px 12px}
#wikiDocumentMoveDialog .wiki-pretty-picker-options{
  position:static;
  margin-top:6px;
  max-height:min(185px,30dvh);
  overflow-y:auto;
  overscroll-behavior:contain;
  box-shadow:none;
}
@media(max-height:550px){
  #wikiDocumentMoveDialog{padding:14px 16px}
  #wikiDocumentMoveDialog .wiki-pretty-picker-options{max-height:120px}
}
