*,
::after,
::before {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
}

button,
input {
  font: inherit;
}

.wrap {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  padding: 56px 18px 80px;
}

.updates-btn {
  position: sticky;
  top: 90px;
  z-index: 90;
  display: block;
  margin: 0 auto 16px;
  padding: 10px 18px;
  color: #fff;
  background: #1f6feb;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.updates-btn[hidden] {
  display: none;
}
.top-bar {
  position: sticky;
  top: 8px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  margin-bottom: 14px;
}

.auth-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-status {
  color: #555;
  font-size: 14px;
}

.back-floating-btn {
  top: 12px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  margin-bottom: 12px;
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.back-floating-btn[hidden] {
  visibility: hidden;
}
@media (max-width: 700px) {
  .top-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .nav-actions,
  .auth-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 28px;
}

.brand-title {
  margin: 0;
  font-size: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.post-count {
  margin: 0;
  white-space: nowrap;
}

.upload-btn {
  padding: 12px 18px;
  color: white;
  background: linear-gradient(135deg, #8066ff, #9a8da5);
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(124, 106, 106, 0.35);
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.upload-btn:hover {
  opacity: 0.92;
  transform: scale(1.04);
}

.item {
  padding: 18px;
  margin-bottom: 24px;
  background: #fff;
  border: none;
  border-radius: 22px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.3s ease;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.item:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.post-user {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.avatar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: white;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border-radius: 50%;
  font-weight: bold;
}

.post-meta {
  min-width: 0;
}

.post-author,
.post-time {
  margin: 0;
}

.post-author {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-time {
  margin-top: 4px;
  color: #666;
  font-size: 13px;
}

.post-image {
  display: block;
  width: 100%;
  max-width: 640px;
  max-height: 640px;
  object-fit: contain;
  margin: 16px auto 0;
  background: #f2f2f2;
  border-radius: 20px;
  transition: transform 0.3s ease;
}

.post-image:hover {
  transform: scale(1.01);
}

.post-caption {
  margin: 14px 2px 0;
  overflow-wrap: anywhere;
}

.delete-post-btn {
  flex: 0 0 auto;
  padding: 7px 12px;
  color: #333;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  cursor: pointer;
}

.delete-post-btn:hover {
  background: #f3f3f3;
}

.delete-post-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.delete-post-btn,
.delete-comment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.delete-status,
.form-message {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #b42318;
  font-size: 14px;
}

.comments-wrap {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  margin-top: 14px;
  border-top: 1px solid #e6e6e6;
}

.toggle-comments-btn {
  justify-self: start;
  padding: 4px 0;
  color: #1f6feb;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.toggle-comments-btn:hover {
  text-decoration: underline;
}

.comments-content {
  display: grid;
  gap: 10px;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.comment-input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
}

.post-comment-btn {
  padding: 9px 14px;
  color: #fff;
  background: #8066ff;
  border: 1px solid #8066ff;
  border-radius: 8px;
  cursor: pointer;
}

.post-comment-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.comment-loading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 14px;
}

.comment-loading[hidden] {
  display: none;
}

.spinner-small {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.comment-message {
  min-height: 1.2em;
  margin: 0;
  color: #666;
  font-size: 14px;
}

.comments-list {
  display: grid;
  gap: 10px;
}

.inline-comment {
  padding: 12px;
  background: #f7f7f7;
  border-radius: 16px;
  animation: fadeIn 0.25s ease;
}

.comment-text {
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.comment-time {
  color: #777;
  font-size: 13px;
}

.delete-comment-btn {
  padding: 5px 9px;
  color: #333;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.delete-comment-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

.comments-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #666;
  font-size: 14px;
}

.comments-page-btn {
  padding: 7px 11px;
  color: #333;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 7px;
  cursor: pointer;
}

.comments-page-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.status {
  padding: 16px 0 24px;
  color: #666;
  text-align: center;
}

.load-more-btn {
  display: block;
  padding: 10px 20px;
  margin: 0 auto 30px;
  color: #fff;
  background: linear-gradient(135deg, #8066ff, #9a8da5);
  border: none;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(124, 106, 106, 0.25);
  cursor: pointer;
  font-weight: 600;
}

.load-more-btn:hover {
  transform: translateY(-1px);
}

.load-more-btn[hidden] {
  display: none;
}

.loading-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
  color: #666;
}

.loading-status[hidden] {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #d9d5e6;
  border-top-color: #8066ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.hidden {
  display: none;
}

.modal-content {
  width: min(92vw, 440px);
  padding: 22px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  animation: modalPop 0.22s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
}

.close-modal-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.close-modal-btn:hover {
  background: #f0f0f0;
}

.upload-form {
  display: grid;
  gap: 10px;
}

.form-label {
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.form-label input {
  width: 100%;
  padding: 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.primary-btn,
.secondary-btn {
  padding: 9px 15px;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: #8066ff;
  border: 1px solid #8066ff;
}

.secondary-btn {
  color: #333;
  background: #fff;
  border: 1px solid #ccc;
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

footer {
  margin-bottom: 40px;
  color: #777;
  text-align: center;
}

footer a,
.credits-card a {
  color: #6f54e8;
}

.credits-brand {
  color: inherit;
  text-decoration: none;
}

.credits-card h1 {
  margin-top: 0;
}

.credits-card li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.primary-link {
  display: inline-block;
  padding: 10px 16px;
  margin-top: 12px;
  color: #fff !important;
  background: #8066ff;
  border-radius: 999px;
  text-decoration: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 576px) {
  .wrap {
    padding: 14px 12px 60px;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
    width: 100%;
  }

  .brand-title {
    font-size: 21px;
  }

  .post-image {
    max-height: 70vh;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .post-comment-btn {
    justify-self: end;
  }
}
