.archive-page {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
}
body.show-archive .archive-page.active {
  transform: translateX(0);
  visibility: visible;
}
body.show-archive > .home-shell {
  display: none;
}
.archive-folders {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 4px;
}
.archive-folder-container {
  flex: 1;
  aspect-ratio: 1 / 1;
}
.archive-folder {
  width: 100%;
  height: 100%;
  position: relative;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.archive-folder:active {
  transform: scale(0.96);
}
.archive-folder-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: #fdfdfd;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.06));
  transition: filter 0.4s ease;
}
.archive-folder-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}
.archive-folder-image {
  width: 76%;
  height: 62%;
  margin-top: 14%;
  object-fit: cover;
  border-radius: 8px;
  z-index: 2;
  background: var(--paper, rgba(0,0,0,0.02));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  border: 2px solid #ffffff;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}
.archive-folder-image:not([src]), .archive-folder-image[src=""] {
  opacity: 0;
}
@media (hover: hover) {
  .archive-folder:hover {
    transform: translateY(-4px);
  }
  .archive-folder:hover .archive-folder-bg {
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
  }
  .archive-folder:hover .archive-folder-image {
    transform: translateY(-6px) rotate(3deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  }
}

.archive-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 16px;
}

.archive-action-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.archive-action-btn svg {
  width: 22px;
  height: 22px;
}

.archive-action-btn:active {
  transform: scale(0.92);
}

.archive-action-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.archive-action-delete.active {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

.archive-worldbooks {
  margin-top: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 2;
}

.worldbooks-scroll {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  overflow-y: auto;
  align-content: flex-start;
  padding: 4px;
}

.worldbook-item {
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.worldbook-item:active {
  transform: scale(0.96);
}

.worldbook-item:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.worldbook-item.delete-mode {
  border-color: var(--red);
  background: var(--paper);
  color: var(--red);
  animation: shake 0.4s infinite;
}

.worldbook-item.delete-mode:hover {
  background: var(--red);
  color: var(--white);
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

.worldbook-dialog {
  display: flex;
  flex-direction: column;
}

.worldbook-content-input {
  width: 100%;
  height: 240px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  margin-top: 16px;
}
.worldbook-content-input:focus {
  border-color: var(--ink);
}

