.photo-library-stage {
  padding: clamp(1.5rem, 5vh, 3.5rem) 0;
}

.photo-library-container {
  max-width: 90rem;
}

.library-intro,
.library-card,
.photo-dialog,
.rename-dialog {
  border: 1px solid rgba(55, 71, 82, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 32px rgba(35, 48, 57, 0.17);
}

.library-intro {
  max-width: 38rem;
  margin: 0 auto 1.25rem;
  padding: clamp(0.9rem, 3vw, 1.25rem);
}

.library-intro h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
}

.library-intro p {
  color: #60717c;
  font-size: 0.95rem;
}

.library-kicker {
  margin: 0;
  color: #516f86;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.library-card {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.library-card h2 {
  margin: 0 0 0.85rem;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

.library-status {
  min-height: 1.5rem;
  max-width: 64rem;
  margin: 0 auto 1rem;
  padding: 0 0.8rem;
  color: #42515c;
  font-weight: 700;
  text-align: center;
}

.library-status:empty {
  display: none;
}

.library-status.is-error {
  color: #8b2f2f;
}

.library-status.is-success {
  color: #226340;
}

.auth-panel,
.verification-panel {
  display: grid;
  max-width: 64rem;
  margin: 0 auto 1.25rem;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 25rem);
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
}

.auth-panel[hidden],
.verification-panel[hidden],
.library-workspace[hidden],
.selected-folder[hidden],
.upload-progress[hidden],
[hidden] {
  display: none !important;
}

.auth-actions,
.verification-actions {
  display: grid;
  gap: 0.8rem;
}

.google-button svg {
  width: 1.35rem;
  height: 1.35rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: #71808b;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #dde3e7;
}

.auth-button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.library-button {
  display: inline-flex;
  min-height: 2.7rem;
  padding: 0.58rem 1rem;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: box-shadow 150ms ease, transform 150ms ease;
}

.library-button:hover:not(:disabled) {
  text-decoration: none;
  transform: translateY(-2px);
}

.library-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.library-button-primary {
  background: #456c86;
  color: #fff;
}

.library-button-primary:hover:not(:disabled) {
  box-shadow: 0 8px 18px rgba(69, 108, 134, 0.24);
  color: #fff;
}

.library-button-secondary,
.google-button {
  border-color: #587286;
  background: #fff;
  color: #314d61;
}

.library-text-button {
  width: max-content;
  padding: 0.3rem 0.2rem;
  border: 0;
  border-bottom: 2px solid rgba(0, 105, 217, 0.25);
  background: transparent;
  color: #0069d9;
  font-weight: 700;
}

.danger-text {
  border-bottom-color: rgba(143, 42, 42, 0.25);
  color: #8f2a2a;
}

.library-button:focus-visible,
.library-text-button:focus-visible,
.folder-button:focus-visible,
.photo-action:focus-visible,
.dialog-close:focus-visible,
.form-control:focus-visible,
.form-control-file:focus-visible {
  outline: 3px solid rgba(0, 105, 217, 0.62);
  outline-offset: 2px;
}

.library-field {
  margin-bottom: 0.85rem;
}

.library-field label {
  margin-bottom: 0.3rem;
  color: #334957;
  font-size: 0.87rem;
  font-weight: 700;
}

.library-workspace {
  display: grid;
  gap: 1.25rem;
}

.account-bar,
.folder-heading,
.section-heading-row,
.upload-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-bar span,
.account-bar strong {
  display: block;
}

.account-bar span {
  color: #6a7881;
  font-size: 0.78rem;
}

.library-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.folder-sidebar,
.folder-workspace,
.selected-folder {
  display: grid;
  gap: 1.25rem;
}

.compact-form .library-button,
.upload-panel .library-button {
  width: 100%;
}

.folder-list {
  display: grid;
  gap: 0.55rem;
}

.folder-button {
  display: grid;
  width: 100%;
  padding: 0.75rem;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  border: 1px solid #dae1e5;
  border-radius: 12px;
  background: #f8fafb;
  color: #273b48;
  text-align: left;
}

.folder-button::before {
  content: "";
  width: 1.3rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(to bottom, transparent 25%, #eef4f7 25%);
  clip-path: polygon(0 12%, 35% 12%, 45% 0, 100% 0, 100% 100%, 0 100%);
}

.folder-button:hover,
.folder-button.is-active {
  border-color: #5b7d94;
  background: #edf4f7;
}

.folder-button strong,
.folder-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-button span {
  color: #71808b;
  font-size: 0.76rem;
}

.empty-copy,
.folder-photo-empty {
  margin: 0.75rem 0 0;
  color: #71808b;
  font-size: 0.86rem;
}

.folder-empty-state {
  padding: clamp(2.5rem, 8vw, 5rem);
  text-align: center;
}

.folder-empty-state .tile-activity-icon {
  margin: 0 auto 1rem;
}

.folder-heading h2 {
  margin: 0.15rem 0 0.25rem;
  font-size: clamp(1.55rem, 4vw, 2.2rem);
}

.folder-heading-actions,
.section-heading-row,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.upload-panel form {
  min-width: min(100%, 22rem);
}

.upload-progress {
  grid-column: 1 / -1;
  width: 100%;
}

.progress-copy {
  display: flex;
  margin-bottom: 0.35rem;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.84rem;
}

.upload-progress progress {
  width: 100%;
  height: 0.75rem;
}

.private-badge,
.photo-count {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #eef3f6;
  color: #496273;
  font-size: 0.76rem;
  font-weight: 700;
}

.share-form {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) auto auto;
  gap: 0.9rem;
  align-items: end;
}

.share-form .library-field {
  margin: 0;
}

.download-checkbox {
  margin-bottom: 0.65rem;
}

.share-list {
  display: grid;
  margin-top: 1rem;
  gap: 0.55rem;
}

.share-row {
  display: grid;
  padding: 0.65rem 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid #e3e8eb;
}

.share-row:last-child {
  border-bottom: 0;
}

.share-row strong,
.share-row span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.share-row span {
  color: #71808b;
  font-size: 0.8rem;
}

.download-restriction {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #fff5dc;
  color: #6c531a;
  font-size: 0.88rem;
}

.library-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.9rem;
}

.library-photo-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid #dde3e7;
  border-radius: 14px;
  background: #fff;
}

.photo-preview-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #edf1f3;
}

.photo-preview-button img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  padding: 1rem;
  color: #6c7b84;
  font-size: 0.82rem;
  text-align: center;
}

.photo-card-copy {
  padding: 0.7rem;
}

.photo-card-copy strong,
.photo-card-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card-copy span {
  margin-top: 0.15rem;
  color: #71808b;
  font-size: 0.76rem;
}

.photo-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #e3e8eb;
}

.photo-card-actions.single-action {
  grid-template-columns: 1fr;
}

.photo-pagination {
  display: flex;
  margin-top: 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.photo-action {
  padding: 0.55rem 0.35rem;
  border: 0;
  border-right: 1px solid #e3e8eb;
  background: #fff;
  color: #345b74;
  font-size: 0.78rem;
  font-weight: 700;
}

.photo-action:last-child {
  border-right: 0;
}

.photo-action.is-danger {
  color: #8f2a2a;
}

.privacy-card {
  max-width: 64rem;
  margin: 1.25rem auto 0;
  color: #4d5d67;
  font-size: 0.9rem;
}

.photo-dialog,
.rename-dialog {
  width: min(calc(100% - 2rem), 70rem);
  max-height: calc(100vh - 2rem);
  padding: 1rem;
}

.rename-dialog {
  width: min(calc(100% - 2rem), 32rem);
}

.photo-dialog::backdrop,
.rename-dialog::backdrop {
  background: rgba(12, 19, 24, 0.72);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-heading h2 {
  margin: 0.15rem 0 0.7rem;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.dialog-close {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #cfd8dd;
  border-radius: 50%;
  background: #fff;
  color: #253b49;
  font-size: 1.6rem;
  line-height: 1;
}

.dialog-media {
  display: grid;
  min-height: 18rem;
  max-height: calc(100vh - 13rem);
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #172029;
  color: #fff;
}

.dialog-media img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 13rem);
  object-fit: contain;
}

.dialog-actions {
  margin-top: 0.8rem;
  justify-content: flex-end;
}

@media (max-width: 991.98px) {
  .library-layout {
    grid-template-columns: 1fr;
  }

  .folder-sidebar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .share-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .download-checkbox {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 767.98px) {
  .auth-panel,
  .verification-panel,
  .folder-sidebar,
  .share-form {
    grid-template-columns: 1fr;
  }

  .account-bar,
  .folder-heading,
  .section-heading-row,
  .upload-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-button-row {
    grid-template-columns: 1fr;
  }

  .library-button {
    width: 100%;
  }

  .account-bar .library-text-button,
  .folder-heading-actions .library-text-button,
  .share-row .library-text-button {
    width: max-content;
  }

  .share-form .download-checkbox {
    grid-column: auto;
    grid-row: auto;
  }

  .share-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .share-row span {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .library-button {
    transition: none;
  }
}
