.archive-page,
.archive-action-dialog,
.archive-export-dialog,
.archive-image-source-dialog,
.archive-url-dialog,
.archive-history-dialog,
.archive-crop-dialog,
.archive-world-dialog {
  --archive-glass-bg: rgba(255, 255, 255, .045);
  --archive-glass-active-bg: rgba(255, 255, 255, .055);
  --archive-glass-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .025),
    inset -1px -1px 0 rgba(0, 0, 0, .045);
  --archive-glass-filter: none;
}

.archive-page {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  padding:
    max(54px, calc(env(safe-area-inset-top) + 40px))
    max(22px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
  color: #101010;
  background:
    linear-gradient(180deg, rgba(250, 250, 248, .90), rgba(237, 237, 234, .82)),
    var(--screen-wallpaper, var(--screen-default-wallpaper));
  background-position: center;
  background-size: cover;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  transform: none;
  transition: none;
  will-change: auto;
  contain: layout style;
}

.archive-page.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.archive-page.npc-editor {
  grid-template-rows: auto minmax(0, 1fr);
}

.archive-header {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 0;
  min-height: 42px;
}

.archive-header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.archive-back,
.archive-add,
.archive-export {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: currentColor;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.archive-back span {
  display: block;
  width: 12px;
  height: 12px;
  border-left: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  transform: rotate(45deg) translate(2px, -2px);
}

.archive-add span {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 31px;
  font-weight: 260;
  line-height: 1;
}

.archive-export svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.archive-add[hidden],
.archive-export[hidden] {
  display: none;
}

.archive-add:disabled,
.archive-export:disabled {
  color: rgba(0, 0, 0, .28);
  cursor: default;
}

.archive-title {
  justify-self: center;
  display: grid;
  place-items: center;
  width: min(180px, 58vw);
  max-width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 999px;
  background: rgba(255, 255, 255, .24);
  box-shadow:
    7px 8px 18px rgba(0, 0, 0, .055),
    inset 1px 1px 0 rgba(255, 255, 255, .86),
    inset -1px -1px 0 rgba(0, 0, 0, .085);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.archive-title,
.archive-nav-slot {
  isolation: isolate;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.archive-title span {
  max-width: 100%;
  overflow: hidden;
  color: #111;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}

.archive-nav-slot {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 46px;
  padding: 5px;
  border-radius: 999px;
}

.archive-nav-slot[hidden] {
  display: none;
}

.archive-tabs {
  position: relative;
  display: grid;
  grid-area: 1 / 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-height: 34px;
}

.archive-nav-slot {
  border: 1px solid rgba(255, 255, 255, .46);
  background: rgba(255, 255, 255, .24);
  box-shadow:
    6px 7px 18px rgba(0, 0, 0, .05),
    inset 1px 1px 0 rgba(255, 255, 255, .88),
    inset -1px -1px 0 rgba(0, 0, 0, .075);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.archive-tabs button {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  color: rgba(0, 0, 0, .56);
  border-radius: 999px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease;
}

.archive-tabs button:active,
.archive-dialog-option:active,
.archive-save-character:active,
.archive-secondary-action:active,
.archive-export:active {
  transform: translateY(1px);
}

.archive-tabs:not(.editor-mode) button[aria-selected="true"] {
  color: #080808;
  background: rgba(255, 255, 255, .48);
  box-shadow:
    3px 4px 12px rgba(0, 0, 0, .045),
    inset 1px 1px 0 rgba(255, 255, 255, .88),
    inset -1px -1px 0 rgba(0, 0, 0, .075);
}

.archive-tabs.editor-mode button[aria-selected="true"] {
  color: #080808;
}

.archive-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 1px 10px;
  scrollbar-width: none;
  contain: layout style;
}

.archive-content::-webkit-scrollbar,
.archive-dialog-card::-webkit-scrollbar,
.archive-history-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.archive-list-view,
.archive-editor-view,
.archive-character-form,
.archive-editor-panel {
  min-height: 0;
}

.archive-list-view {
  display: none;
}

.archive-list-view.active {
  display: grid;
}

.archive-editor-view {
  display: grid;
}

.archive-editor-view[hidden] {
  display: none;
}

.archive-record-list {
  display: none;
  align-content: start;
  gap: 10px;
}

.archive-record-list.active {
  display: grid;
}

.archive-empty,
.archive-record-card {
  border: 1px solid rgba(255, 255, 255, .44);
  background: rgba(255, 255, 255, .26);
  box-shadow:
    6px 8px 20px rgba(0, 0, 0, .05),
    inset 1px 1px 0 rgba(255, 255, 255, .86),
    inset -1px -1px 0 rgba(0, 0, 0, .075);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.archive-empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 22px;
  border-radius: 8px;
  color: rgba(0, 0, 0, .52);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.archive-record-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px;
  color: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  contain: layout paint style;
}

.archive-record-card img,
.archive-record-avatar {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, .42);
}

.archive-record-avatar {
  display: grid;
  place-items: center;
  color: rgba(0, 0, 0, .42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 720;
}

.archive-record-card h3,
.archive-record-card p,
.archive-world-entry h3,
.archive-world-entry p {
  margin: 0;
}

.archive-record-card h3 {
  overflow: hidden;
  color: #101010;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.archive-record-card p {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(0, 0, 0, .56);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 1.35;
}

.archive-record-kind {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: rgba(0, 0, 0, .45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
}

.archive-character-form {
  display: grid;
}

.archive-editor-panel {
  display: none;
}

.archive-editor-panel.active {
  display: grid;
  gap: 14px;
}

.archive-editor-view .archive-avatar-button,
.archive-editor-view .archive-role-tag,
.archive-editor-view .archive-field input,
.archive-editor-view .archive-field textarea,
.archive-editor-view .archive-field select,
.archive-editor-view .archive-toggle-field,
.archive-editor-view .archive-segment-field span,
.archive-editor-view .archive-expandable,
.archive-editor-view .archive-font-preview,
.archive-editor-view .archive-lock-picker,
.archive-editor-view .archive-secondary-action,
.archive-editor-view .archive-save-character,
.archive-editor-view .archive-world-entry,
.archive-editor-view .archive-world-meta span,
.archive-editor-view .archive-world-keywords span {
  border: 0;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
}

.archive-tabs.editor-mode button[aria-selected="true"],
.archive-editor-view .archive-segment-field input:checked + span,
.archive-editor-view .archive-save-character {
  background: var(--archive-glass-active-bg);
  box-shadow: var(--archive-glass-shadow);
}

.archive-profile-band {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 30px;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
}

.archive-avatar-button {
  position: relative;
  align-self: start;
  display: grid;
  place-items: center;
  width: 112px;
  height: auto;
  aspect-ratio: 1;
  overflow: hidden;
  color: rgba(0, 0, 0, .46);
  border-radius: 8px;
  cursor: pointer;
}

.archive-avatar-button img,
.archive-lock-picker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.archive-avatar-button span {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
}

.archive-primer-fields,
.archive-detail-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.archive-primer-fields {
  align-self: start;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  height: 112px;
  gap: 8px;
}

.archive-primer-fields .archive-field {
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.archive-primer-fields .archive-field > span {
  color: rgba(0, 0, 0, .62);
  text-align: left;
}

.archive-primer-fields .archive-field input {
  min-height: 32px;
  padding: 6px 10px;
}

.archive-role-tag {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 8px 5px;
  color: rgba(0, 0, 0, .50);
  border-radius: 999px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 9px;
  font-weight: 760;
  line-height: 1;
}

.archive-pulse-divider {
  display: grid;
  place-items: center;
  height: 42px;
  margin-block: 1px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 32%, #000 68%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 32%, #000 68%, transparent);
}

.archive-pulse-divider svg {
  width: min(66%, 360px);
  height: 42px;
}

.archive-pulse-divider path {
  fill: none;
  stroke: rgba(0, 0, 0, .32);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.archive-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

#archiveBoundCharacterField[hidden] {
  display: none;
}

.archive-inline-field {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.archive-inline-field > span {
  line-height: 1.2;
}

.archive-field > span,
.archive-field > label {
  color: rgba(0, 0, 0, .58);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 12px;
  line-height: 1;
}

.archive-field input,
.archive-field textarea,
.archive-field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 11px 12px;
  color: #101010;
  border-radius: 8px;
  font: 14px/1.35 "Noto Serif SC", "Songti SC", serif;
  outline: none;
}

.archive-field textarea {
  min-height: 118px;
  resize: vertical;
}

.archive-field select {
  appearance: none;
}

.archive-back:focus-visible,
.archive-add:focus-visible,
.archive-export:focus-visible,
.archive-tabs button:focus-visible,
.archive-world-entry:focus-visible,
.archive-avatar-button:focus-visible,
.archive-lock-picker:focus-visible,
.archive-dialog-option:focus-visible,
.archive-dialog-actions button:focus-visible,
.archive-save-character:focus-visible,
.archive-secondary-action:focus-visible {
  outline: 1px solid rgba(0, 0, 0, .34);
  outline-offset: 3px;
}

.archive-field input:focus,
.archive-field textarea:focus,
.archive-field select:focus-visible {
  outline: none;
}

.archive-field input::placeholder,
.archive-field textarea::placeholder {
  color: rgba(0, 0, 0, .32);
}

.archive-dialog-card .archive-field input,
.archive-dialog-card .archive-field textarea,
.archive-dialog-card .archive-field select,
.archive-dialog-card .archive-toggle-field,
.archive-dialog-card .archive-segment-field span {
  border: 0;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
}

.archive-dialog-card .archive-field input,
.archive-dialog-card .archive-field textarea,
.archive-dialog-card .archive-field select,
.archive-dialog-card .archive-toggle-field {
  border-radius: 8px;
}

.archive-dialog-card .archive-segment-field span {
  border-radius: 8px;
}

.archive-dialog-card .archive-segment-field input:checked + span {
  background: var(--archive-glass-active-bg);
  box-shadow: var(--archive-glass-shadow);
}

.archive-toggle-field {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 13px;
  border-radius: 8px;
}

.archive-toggle-field span {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.archive-toggle-field strong {
  color: rgba(0, 0, 0, .74);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  line-height: 1.2;
}

.archive-toggle-field small {
  color: rgba(0, 0, 0, .52);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 11px;
  line-height: 1.3;
}

.archive-toggle-field input,
.archive-segment-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.archive-toggle-field i {
  position: relative;
  display: block;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: rgba(20, 20, 20, .82);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, .28),
    inset -1px -1px 0 rgba(0, 0, 0, .16);
}

.archive-toggle-field i::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 24px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .90);
  box-shadow: 2px 3px 8px rgba(0, 0, 0, .14);
  transition: left .16s ease;
}

.archive-toggle-field input:not(:checked) + i {
  background: rgba(0, 0, 0, .11);
}

.archive-toggle-field input:not(:checked) + i::after {
  left: 4px;
}

.archive-keyword-field[hidden] {
  display: none;
}

.archive-range-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.archive-range-field b {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.archive-range-field input[type="range"] {
  height: 30px;
  min-height: 30px;
  padding: 0;
  accent-color: #111;
  background: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.archive-range-field input[type="range"]::-webkit-slider-runnable-track {
  height: 9px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .38);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, .08),
    inset -1px -1px 0 rgba(255, 255, 255, .82);
}

.archive-range-field input[type="range"]::-webkit-slider-thumb {
  width: 23px;
  height: 23px;
  margin-top: -8px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  background: #111;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, .14);
  appearance: none;
}

.archive-range-field input[type="range"]::-moz-range-track {
  height: 9px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .38);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, .08),
    inset -1px -1px 0 rgba(255, 255, 255, .82);
}

.archive-range-field input[type="range"]::-moz-range-thumb {
  width: 23px;
  height: 23px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 50%;
  background: #111;
  box-shadow: 2px 3px 8px rgba(0, 0, 0, .14);
}

.archive-segment-field {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.archive-export-format {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.archive-segment-field legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: rgba(0, 0, 0, .70);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 12px;
  line-height: 1;
}

.archive-segment-field label {
  position: relative;
  min-width: 0;
}

.archive-segment-field span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 8px;
  color: rgba(0, 0, 0, .58);
  border-radius: 8px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 12px;
  cursor: pointer;
}

.archive-segment-field input:checked + span {
  color: #111;
}

.archive-expandable {
  border-radius: 8px;
}

.archive-expandable summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  color: rgba(0, 0, 0, .72);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.archive-expandable summary::-webkit-details-marker {
  display: none;
}

.archive-expandable summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.3px solid currentColor;
  border-bottom: 1.3px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .16s ease;
}

.archive-expandable[open] {
  padding-bottom: 12px;
}

.archive-expandable[open] summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.archive-expandable .archive-field,
.archive-font-actions,
.archive-font-preview,
.archive-lock-image {
  margin: 0 12px 10px;
}

.archive-font-url-field {
  margin-bottom: 8px !important;
}

.archive-font-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.archive-font-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.archive-font-actions .archive-secondary-action {
  min-width: 0;
  padding-inline: 10px;
}

.archive-font-preview {
  display: grid;
  gap: 9px;
  min-height: 96px;
  padding: 13px;
  border-radius: 8px;
}

.archive-font-preview strong {
  overflow: hidden;
  color: rgba(0, 0, 0, .62);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-font-preview p {
  margin: 0;
  color: rgba(0, 0, 0, .80);
  font-size: 23px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.archive-font-status {
  margin-inline: 12px;
}

.archive-lock-image {
  display: grid;
  gap: 8px;
}

.archive-lock-picker {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 118px;
  overflow: hidden;
  color: rgba(0, 0, 0, .48);
  border-radius: 8px;
  cursor: pointer;
}

.archive-lock-picker span {
  padding: 14px;
  font-size: 12px;
}

.archive-secondary-action,
.archive-save-character {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.archive-secondary-action {
  color: rgba(0, 0, 0, .66);
}

.archive-save-character {
  color: rgba(0, 0, 0, .76);
}

.archive-status {
  min-height: 16px;
  margin: 0;
  color: rgba(0, 0, 0, .54);
  font-size: 12px;
  line-height: 1.35;
}

.archive-status[data-tone="error"] {
  color: #9f2d2d;
}

.archive-status[data-tone="success"] {
  color: #236f4d;
}

.archive-world-list {
  display: grid;
  gap: 10px;
}

.archive-world-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 14px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  outline: none;
}

.archive-world-entry-body {
  min-width: 0;
}

.archive-world-entry h3 {
  color: #101010;
  font-size: 15px;
  line-height: 1.25;
}

.archive-world-entry p {
  display: -webkit-box;
  overflow: hidden;
  color: rgba(0, 0, 0, .56);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 12px;
  line-height: 1.45;
}

.archive-world-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.archive-world-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.archive-world-meta span,
.archive-world-keywords span {
  max-width: 100%;
  padding: 5px 8px;
  overflow: hidden;
  color: rgba(0, 0, 0, .58);
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 11px;
}

.archive-world-entry-switch {
  position: relative;
  display: block;
  width: 50px;
  height: 30px;
  flex: none;
}

.archive-world-entry-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.archive-world-entry-switch span {
  position: relative;
  display: block;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: rgba(20, 20, 20, .82);
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, .28),
    inset -1px -1px 0 rgba(0, 0, 0, .16);
}

.archive-world-entry-switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 24px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .90);
  box-shadow: 2px 3px 8px rgba(0, 0, 0, .14);
  transition: left .16s ease;
}

.archive-world-entry-switch input:not(:checked) + span {
  background: rgba(0, 0, 0, .11);
}

.archive-world-entry-switch input:not(:checked) + span::after {
  left: 4px;
}

.archive-action-dialog,
.archive-export-dialog,
.archive-image-source-dialog,
.archive-url-dialog,
.archive-history-dialog,
.archive-crop-dialog,
.archive-world-dialog {
  position: absolute;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: end center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: rgba(247, 247, 245, .48);
  opacity: 0;
  pointer-events: none;
  transition: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.archive-action-dialog.open,
.archive-export-dialog.open,
.archive-image-source-dialog.open,
.archive-url-dialog.open,
.archive-history-dialog.open,
.archive-crop-dialog.open,
.archive-world-dialog.open {
  opacity: 1;
  pointer-events: auto;
}

.archive-dialog-card {
  display: grid;
  gap: 12px;
  width: min(100%, 430px);
  max-height: min(82dvh, 720px);
  overflow-y: auto;
  padding: 18px;
  color: #101010;
  border: 0;
  border-radius: 8px;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
  transform: translateY(18px) scale(.985);
  transition: none;
}

.archive-action-dialog.open .archive-dialog-card,
.archive-export-dialog.open .archive-dialog-card,
.archive-image-source-dialog.open .archive-dialog-card,
.archive-url-dialog.open .archive-dialog-card,
.archive-history-dialog.open .archive-dialog-card,
.archive-crop-dialog.open .archive-dialog-card,
.archive-world-dialog.open .archive-dialog-card {
  transform: translateY(0) scale(1);
}

.archive-dialog-card header h2,
.archive-dialog-card header p {
  margin: 0;
}

.archive-dialog-card header h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 17px;
  line-height: 1.25;
}

.archive-dialog-card header p {
  margin-top: 4px;
  color: rgba(0, 0, 0, .46);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
}

.archive-dialog-option {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 0 14px;
  color: rgba(0, 0, 0, .72);
  border: 0;
  border-radius: 8px;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}

.archive-dialog-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.archive-dialog-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.archive-action-card .archive-dialog-actions,
.archive-image-source-dialog .archive-dialog-actions,
.archive-history-dialog .archive-dialog-actions {
  grid-template-columns: minmax(0, 1fr);
}

.archive-dialog-actions button {
  min-height: 40px;
  padding: 0 14px;
  color: rgba(0, 0, 0, .68);
  border: 0;
  border-radius: 8px;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
  font-size: 13px;
  cursor: pointer;
}

.archive-dialog-actions button[type="submit"] {
  color: rgba(0, 0, 0, .76);
  background: var(--archive-glass-active-bg);
}

.archive-danger-action {
  color: #9f2d2d !important;
}

.archive-history-list {
  display: grid;
  gap: 8px;
  max-height: 48dvh;
  overflow-y: auto;
  padding-right: 1px;
}

.archive-history-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 76px;
  padding: 8px;
  color: inherit;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: var(--archive-glass-bg);
  box-shadow: var(--archive-glass-shadow);
  -webkit-backdrop-filter: var(--archive-glass-filter);
  backdrop-filter: var(--archive-glass-filter);
  cursor: pointer;
}

.archive-history-item img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
}

.archive-history-item strong,
.archive-history-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-history-item strong {
  font-size: 13px;
  line-height: 1.25;
}

.archive-history-item span {
  margin-top: 5px;
  color: rgba(0, 0, 0, .52);
  font-size: 12px;
}

.archive-crop-card {
  place-self: center;
}

.archive-crop-stage {
  position: relative;
  width: min(100%, 330px);
  aspect-ratio: 1;
  justify-self: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(0, 0, 0, .10);
  touch-action: none;
  cursor: grab;
}

.archive-crop-stage:active {
  cursor: grabbing;
}

.archive-crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
}

.archive-crop-frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, .74);
  box-shadow:
    inset 0 0 0 999px rgba(0, 0, 0, .12),
    inset 1px 1px 0 rgba(255, 255, 255, .72),
    inset -1px -1px 0 rgba(0, 0, 0, .22);
  pointer-events: none;
}

.archive-crop-zoom input[type="range"] {
  padding: 0;
  min-height: 26px;
  accent-color: #111;
}


@media (max-width: 430px) {
  .archive-profile-band {
    grid-template-columns: 98px minmax(0, 1fr) 28px;
    gap: 10px;
  }

  .archive-avatar-button {
    width: 98px;
  }

  .archive-primer-fields {
    height: 98px;
    gap: 6px;
  }

  .archive-primer-fields .archive-field {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .archive-primer-fields .archive-field input {
    min-height: 28px;
    padding: 5px 9px;
  }

  .archive-field input,
  .archive-field textarea,
  .archive-field select {
    font-size: 13px;
  }

  .archive-inline-field {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
  }

  .archive-font-actions {
    grid-template-columns: 1fr;
  }

  .archive-font-preview p {
    font-size: 21px;
  }

  .archive-pulse-divider svg {
    width: 78%;
  }
}

html.night-mode .archive-page,
html.night-mode .archive-action-dialog,
html.night-mode .archive-export-dialog,
html.night-mode .archive-image-source-dialog,
html.night-mode .archive-url-dialog,
html.night-mode .archive-history-dialog,
html.night-mode .archive-crop-dialog,
html.night-mode .archive-world-dialog {
  --archive-glass-bg: rgba(238, 244, 255, .012);
  --archive-glass-active-bg: rgba(238, 244, 255, .018);
  --archive-glass-shadow:
    inset 0 0 0 1px rgba(238, 244, 255, .016),
    inset -1px -1px 0 rgba(0, 0, 0, .30);
  --archive-glass-filter: none;
}

html.night-mode .archive-page {
  color: #f5efe5;
  background:
    linear-gradient(180deg, rgba(16, 16, 16, .58), rgba(28, 26, 28, .72)),
    var(--screen-wallpaper, var(--screen-default-wallpaper));
}

html.night-mode .archive-title,
html.night-mode .archive-nav-slot,
html.night-mode .archive-empty,
html.night-mode .archive-record-card {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(26, 26, 26, .30);
  box-shadow:
    6px 8px 20px rgba(0, 0, 0, .18),
    inset 1px 1px 0 rgba(255, 255, 255, .12),
    inset -1px -1px 0 rgba(0, 0, 0, .32);
}

html.night-mode .archive-title span,
html.night-mode .archive-record-card h3,
html.night-mode .archive-world-entry h3,
html.night-mode .archive-font-preview p,
html.night-mode .archive-save-character,
html.night-mode .archive-editor-view .archive-field input,
html.night-mode .archive-editor-view .archive-field textarea,
html.night-mode .archive-editor-view .archive-field select,
html.night-mode .archive-dialog-card .archive-field input,
html.night-mode .archive-dialog-card .archive-field textarea,
html.night-mode .archive-dialog-card .archive-field select {
  color: #f5efe5;
}

html.night-mode .archive-tabs button,
html.night-mode .archive-field > span,
html.night-mode .archive-expandable summary,
html.night-mode .archive-record-card p,
html.night-mode .archive-role-tag,
html.night-mode .archive-status,
html.night-mode .archive-empty,
html.night-mode .archive-font-preview strong,
html.night-mode .archive-lock-picker,
html.night-mode .archive-toggle-field small,
html.night-mode .archive-segment-field span,
html.night-mode .archive-secondary-action {
  color: rgba(245, 239, 229, .68);
}

html.night-mode .archive-tabs:not(.editor-mode) button[aria-selected="true"] {
  color: #fff8eb;
  background: rgba(255, 255, 255, .12);
}

html.night-mode .archive-tabs.editor-mode button[aria-selected="true"] {
  color: #fff8eb;
}

html.night-mode .archive-pulse-divider path {
  stroke: rgba(245, 239, 229, .34);
}

html.night-mode .archive-toggle-field strong,
html.night-mode .archive-segment-field legend,
html.night-mode .archive-segment-field input:checked + span {
  color: #f5efe5;
}

html.night-mode .archive-toggle-field i,
html.night-mode .archive-world-entry-switch span {
  background: rgba(245, 239, 229, .86);
}

html.night-mode .archive-toggle-field i::after,
html.night-mode .archive-world-entry-switch span::after {
  background: #11100f;
}

html.night-mode .archive-toggle-field input:not(:checked) + i,
html.night-mode .archive-world-entry-switch input:not(:checked) + span {
  background: rgba(255, 255, 255, .16);
}

html.night-mode .archive-dialog-card .archive-segment-field input:checked + span {
  background: var(--archive-glass-active-bg);
}

html.night-mode .archive-range-field input[type="range"]::-webkit-slider-runnable-track,
html.night-mode .archive-range-field input[type="range"]::-moz-range-track {
  border-color: rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .10);
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, .26),
    inset -1px -1px 0 rgba(255, 255, 255, .04);
}

html.night-mode .archive-range-field input[type="range"]::-webkit-slider-thumb,
html.night-mode .archive-range-field input[type="range"]::-moz-range-thumb {
  border-color: rgba(255, 255, 255, .16);
  background: #f5efe5;
}

html.night-mode .archive-action-dialog,
html.night-mode .archive-export-dialog,
html.night-mode .archive-image-source-dialog,
html.night-mode .archive-url-dialog,
html.night-mode .archive-history-dialog,
html.night-mode .archive-crop-dialog,
html.night-mode .archive-world-dialog {
  background: rgba(10, 10, 10, .44);
}

html.night-mode .archive-dialog-card {
  color: #f5efe5;
}

html.night-mode .archive-dialog-option,
html.night-mode .archive-dialog-actions button,
html.night-mode .archive-history-item {
  color: rgba(245, 239, 229, .76);
}
