.overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background-color: var(--bg-modal);
  background-image: var(--texture-surface), var(--texture-speckle);
  background-size:
    256px 256px,
    128px 128px;
  background-repeat: repeat, repeat;
  border: 2px solid rgba(var(--gold-rgb), 0.3);
  border-radius: 4px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--gold-rgb), 0.2) transparent;
  box-shadow:
    0 8px 40px rgba(var(--shadow-rgb), 0.7),
    0 2px 8px rgba(var(--shadow-rgb), 0.5),
    inset 0 1px 0 rgba(var(--gold-rgb), 0.1),
    inset 0 0 60px rgba(var(--shadow-rgb), 0.2);
}

.modal::-webkit-scrollbar {
  width: 6px;
}

.modal::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb {
  background: rgba(var(--gold-rgb), 0.2);
  border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--gold-rgb), 0.35);
}

.topBar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.editBtn {
  font-family: "Cinzel", Georgia, serif;
  padding: 0.35rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(var(--gold-rgb), 0.4);
  border-radius: 3px;
  color: var(--gold);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.editBtn:hover {
  background: rgba(var(--gold-rgb), 0.1);
  box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.15);
}

.editBtn.active {
  background: rgba(var(--gold-rgb), 0.9);
  color: var(--btn-active-text);
  text-shadow: none;
}

.closeBtn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.closeBtn:hover {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .overlay {
    position: fixed;
    z-index: 10000;
  }

  .modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    padding: 1rem;
    border: none;
  }
}
