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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --bg: #fafafa;
  --bg-gradient: linear-gradient(180deg, #fafafa 0%, #f5f5f7 100%);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-hover: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #1a1a1a;
  --text-muted: #8e8e8e;
  --border: rgba(0, 0, 0, 0.04);
  --border-outer: rgba(255, 255, 255, 0.9);
  --glass-blur: blur(24px) saturate(180%);
  --glass-bg: rgba(255, 255, 255, 0.5);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.03), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 4px 24px rgba(0, 0, 0, 0.06);
  --gold: #eab308;
  --silver: #94a3b8;
  --bronze: #d97706;
  --container-padding: clamp(0.75rem, 3vw, 1.25rem);
  --glow-primary: 0 0 12px rgba(99, 102, 241, 0.08);
  --heart-color: #ed4956;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 15% 30%, rgba(99, 102, 241, 0.04) 0%, transparent 45%),
              radial-gradient(ellipse at 85% 70%, rgba(168, 85, 247, 0.03) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 15% 40%, rgba(99, 102, 241, 0.07) 0%, transparent 45%),
              radial-gradient(ellipse at 85% 15%, rgba(168, 85, 247, 0.05) 0%, transparent 45%),
              radial-gradient(ellipse at 50% 90%, rgba(6, 182, 212, 0.04) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  width: min(100% - 2rem, 58rem);
  margin: 0 auto;
  padding: 0 clamp(0.5rem, 2vw, 1rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(3rem, 7vw, 3.5rem);
  position: relative;
}

.nav-brand {
  display: none;
}

.nav-brand-left {
  display: none;
}

.nav-brand-center {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  text-decoration: none;
}

.nav-container.centered .nav-brand-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-title {
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav-logo {
  height: clamp(2rem, 6vw, 2.5rem);
  width: auto;
  border-radius: 8px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1.5vw, 0.5rem);
  position: relative;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  padding: clamp(0.25rem, 1vw, 0.4rem) clamp(0.4rem, 2vw, 0.9rem);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.auth-form input {
  padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(0.6rem, 2vw, 0.9rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  outline: none;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input::placeholder {
  color: var(--text-muted);
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), var(--glow-primary);
}

.nav-user {
  display: none;
}

.nav-signout {
  display: none;
}

/* Container */
.container {
  width: min(100% - 2rem, 58rem);
  margin: 0 auto;
  padding: clamp(0.75rem, 3vw, 1.25rem) var(--container-padding) clamp(2rem, 6vw, 2.5rem);
  flex: 1;
}

.card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: var(--shadow);
  margin-bottom: clamp(0.75rem, 2vw, 1rem);
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  padding: clamp(0.25rem, 1vw, 0.35rem) clamp(0.5rem, 2vw, 0.75rem);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: clamp(0.8rem, 2.3vw, 0.9rem);
  transition: all 0.15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
  font-weight: 600;
}

/* Cards */
.card {
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-top: 1px solid var(--border-outer);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.5rem);
  box-shadow: var(--shadow);
  margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

/* Auth */
.auth-card {
  max-width: min(100%, 36rem);
  margin: 0 auto clamp(1rem, 3vw, 1.5rem);
}

.auth-card-inner {
  display: flex;
  align-items: stretch;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.auth-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.auth-logo-img {
  width: clamp(7rem, 24vw, 11rem);
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
}

.auth-separator {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  flex-shrink: 0;
}

.auth-content {
  flex: 1;
  min-width: 0;
}

.auth-content h2 {
  text-align: center;
}

.container.centered-auth {
  display: flex;
  align-items: center;
  justify-content: center;
}

.container.centered-auth .auth-card {
  margin: 0;
  width: 100%;
}

.auth-logo {
  text-align: center;
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.auth-logo-img {
  width: clamp(4rem, 15vw, 6rem);
  height: clamp(4rem, 15vw, 6rem);
  border-radius: 16px;
  object-fit: cover;
}

.auth-tabs {
  display: flex;
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
  border-bottom: 2px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: clamp(0.5rem, 1.5vw, 0.6rem);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.auth-form input {
  padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(0.6rem, 2vw, 0.9rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  outline: none;
  transition: border-color 0.15s;
}

.auth-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.45rem, 1.3vw, 0.55rem) clamp(0.75rem, 2vw, 1.25rem);
  border: none;
  border-radius: 10px;
  font-size: clamp(0.82rem, 2.5vw, 0.9rem);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  letter-spacing: -0.01em;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--glow-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.15);
}

.btn-sm {
  padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.5rem, 1.5vw, 0.9rem);
  font-size: clamp(0.75rem, 2.3vw, 0.85rem);
}

.btn-full {
  width: 100%;
}

/* Welcome */
.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.welcome-actions {
  display: flex;
  gap: clamp(0.25rem, 1vw, 0.5rem);
}

/* Leaderboard */
.leaderboard-section h2 {
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.table-wrapper {
  overflow-x: auto;
  margin-top: clamp(0.75rem, 2vw, 1rem);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.78rem, 2.3vw, 0.9rem);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.5rem, 2vw, 1rem);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
  font-weight: 600;
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.03);
}

.leaderboard-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.03);
}

.current-user-row {
  background: rgba(99, 102, 241, 0.06);
}

.leaderboard-table tbody tr.current-user-row:hover {
  background: rgba(99, 102, 241, 0.1);
}

.leaderboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.5rem, 2vw, 1rem);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.current-user-row {
  background: rgba(99, 102, 241, 0.1);
}

.leaderboard-table tbody tr:hover {
  background: #f8fafc;
}

.leaderboard-table .rank-cell {
  font-weight: 700;
  font-size: clamp(0.95rem, 3vw, 1.1rem);
}

.rank-1 .rank-cell { color: var(--gold); }
.rank-2 .rank-cell { color: var(--silver); }
.rank-3 .rank-cell { color: var(--bronze); }

.rank-medal {
  font-size: clamp(1.1rem, 3.5vw, 1.3rem);
}

.score-cell {
  font-weight: 600;
  color: var(--primary);
}

.current-user-row {
  background: #eff6ff;
}

/* Upload */
.upload-card {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 8vw, 2.5rem) clamp(0.75rem, 3vw, 1.25rem);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}

.drop-zone-content {
  pointer-events: none;
}

.drop-icon {
  font-size: clamp(1.8rem, 7vw, 2.5rem);
  display: block;
  margin-bottom: 0.5rem;
}

.hint {
  font-size: clamp(0.7rem, 2vw, 0.8rem);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.preview-container {
  text-align: center;
}

.preview-image {
  max-width: 100%;
  max-height: clamp(12rem, 40vw, 18rem);
  border-radius: var(--radius);
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.progress {
  height: clamp(4px, 1vw, 6px);
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.status-text {
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  color: var(--text-muted);
  text-align: center;
}

.status-text.success {
  color: var(--success);
}

/* Recent uploads */
.recent-section {
  margin-top: clamp(1.5rem, 4vw, 2rem);
}

.recent-section h3 {
  margin-bottom: clamp(0.5rem, 1.5vw, 0.75rem);
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(7rem, 20vw, 11rem), 1fr));
  gap: clamp(0.5rem, 2vw, 0.75rem);
}

.recent-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.recent-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recent-item .recent-time {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: clamp(0.65rem, 1.8vw, 0.75rem);
}

/* Loading & states */
.loading {
  text-align: center;
  padding: clamp(1.5rem, 5vw, 2rem);
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: clamp(1.5rem, 5vw, 2rem);
  color: var(--text-muted);
  background: var(--surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0.25rem;
  margin-top: 0.25rem;
  background: var(--surface-solid);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: clamp(8rem, 25vw, 10rem);
  z-index: 200;
  overflow: hidden;
}

.empty-state .btn {
  margin-top: 0.75rem;
}

.error-text {
  color: var(--error);
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  text-align: center;
  padding: 0.5rem;
  background: var(--error-bg);
  border-radius: var(--radius);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1px, 0.3vw, 3px);
}

.gallery-card {
  background: var(--surface);
  overflow: hidden;
  transition: opacity 0.2s;
}

.gallery-card:hover {
  opacity: 0.88;
  transform: none;
}

.gallery-card-image {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
}

.gallery-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-card-image img {
  transform: scale(1.03);
  border-radius: var(--radius);
}

.gallery-card-info {
  padding: clamp(0.25rem, 1vw, 0.4rem) clamp(0.3rem, 1.5vw, 0.5rem);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.gallery-card-name {
  font-weight: 600;
  font-size: clamp(0.6rem, 1.6vw, 0.7rem);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.gallery-card-votes {
  display: none;
}

.gallery-card-time {
  font-size: clamp(0.55rem, 1.4vw, 0.65rem);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.2);
  border-top-color: var(--border-outer);
}

.gallery-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.gallery-card-info {
  padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.5rem, 2vw, 0.9rem);
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 0.5rem);
}

.gallery-card-name {
  font-weight: 600;
  font-size: clamp(0.75rem, 2.3vw, 0.9rem);
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.gallery-card-votes {
  display: flex;
  align-items: center;
  gap: clamp(0.1rem, 0.5vw, 0.2rem);
  flex-shrink: 0;
}

.card-vote-icon {
  color: var(--text-muted);
  font-size: clamp(0.55rem, 1.6vw, 0.65rem);
}

.card-vote-count {
  color: var(--text);
  font-size: clamp(0.7rem, 2vw, 0.82rem);
  font-weight: 600;
  min-width: 1rem;
  text-align: center;
}

.gallery-card-time {
  font-size: clamp(0.65rem, 1.8vw, 0.8rem);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.load-more-container {
  text-align: center;
  margin-top: clamp(1rem, 3vw, 1.5rem);
  padding: 0.5rem;
}

.load-more-container .status-text {
  margin-top: 0.5rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox-close {
  position: absolute;
  top: clamp(0.5rem, 2vw, 1rem);
  right: clamp(0.75rem, 3vw, 1.5rem);
  background: none;
  border: none;
  color: #fff;
  font-size: clamp(1.5rem, 5vw, 2rem);
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
  z-index: 1002;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-content {
  display: flex;
  align-items: stretch;
  width: min(100% - 1rem, 90vw);
  height: min(95vh, 95dvh);
  justify-content: center;
}

.lightbox-image-area {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.lightbox-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px 0 0 4px;
}

.lightbox-image-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(1.5rem, 5vw, 2rem) clamp(0.5rem, 2vw, 1rem) clamp(0.5rem, 1.5vw, 0.75rem);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  border-radius: 0 0 0 4px;
  display: flex;
  justify-content: center;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  width: clamp(2rem, 5vw, 3rem);
  height: clamp(3rem, 10vh, 5rem);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  z-index: 1001;
}

.lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-arrow-left {
  left: clamp(0.25rem, 1vw, 0.75rem);
}

.lightbox-arrow-right {
  right: clamp(0.25rem, 1vw, 0.75rem);
}

.lightbox-sidebar {
  flex: 0 0 clamp(16rem, 25vw, 20rem);
  width: clamp(16rem, 25vw, 20rem);
  background: var(--surface-solid);
  border-radius: 0 4px 4px 0;
  display: flex;
  flex-direction: column;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  gap: clamp(0.5rem, 1.5vw, 1rem);
  overflow-y: auto;
}

.lightbox-sidebar-header {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
  padding-bottom: clamp(0.5rem, 1.5vw, 1rem);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.lightbox-avatar {
  width: clamp(2rem, 5vw, 2.75rem);
  height: clamp(2rem, 5vw, 2.75rem);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  flex-shrink: 0;
}

.lightbox-name {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.lightbox-time-full {
  font-size: clamp(0.7rem, 1.8vw, 0.8rem);
  color: var(--text-muted);
}

.lightbox-sidebar-meta {
  padding-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.5rem, 1.5vw, 0.75rem);
}

.lightbox-counter {
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  color: var(--text-muted);
  font-weight: 500;
}

.lightbox-counter-overlay {
  position: absolute;
  top: clamp(0.5rem, 1.5vw, 0.75rem);
  right: clamp(0.5rem, 1.5vw, 0.75rem);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: clamp(0.68rem, 1.8vw, 0.8rem);
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  pointer-events: none;
}

/* Comments in lightbox sidebar */
.lightbox-comments {
  border-top: 1px solid var(--border);
  padding-top: clamp(0.5rem, 1.5vw, 0.75rem);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.comments-empty {
  color: var(--text-muted);
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  text-align: center;
  padding: 0.75rem 0;
}

.loading.small {
  padding: 0.5rem;
  font-size: clamp(0.75rem, 2vw, 0.85rem);
}

.comment-item {
  display: flex;
  gap: clamp(0.4rem, 1.3vw, 0.6rem);
  margin-bottom: clamp(0.5rem, 1.5vw, 0.9rem);
}

.comment-reply {
  margin-left: clamp(1.5rem, 5vw, 2.5rem);
  margin-bottom: clamp(0.4rem, 1.2vw, 0.6rem);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.1rem;
}

.comment-name {
  font-weight: 600;
  font-size: clamp(0.72rem, 2vw, 0.82rem);
}

.comment-time {
  font-size: clamp(0.65rem, 1.6vw, 0.72rem);
  color: var(--text-muted);
}

.comment-content {
  font-size: clamp(0.78rem, 2.2vw, 0.88rem);
  line-height: 1.4;
  color: var(--text);
  margin: 0;
  word-break: break-word;
}

.comment-form {
  border-top: 1px solid var(--border);
  padding-top: clamp(0.4rem, 1.2vw, 0.6rem);
  display: flex;
  gap: clamp(0.3rem, 1vw, 0.5rem);
  align-items: flex-end;
  flex-shrink: 0;
}

.comment-input {
  flex: 1;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

.comment-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Vote buttons */
.vote-buttons {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.35rem;
  border-radius: 50%;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.vote-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.vote-btn.voted {
  color: var(--heart-color);
}

.lightbox-image-footer .vote-count {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 1.5rem;
  text-align: center;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.vote-btn:hover {
  background: #f1f5f9;
}

.vote-btn.voted {
  color: var(--primary);
}

.vote-down-btn.voted {
  color: var(--error);
}

.vote-count {
  font-size: clamp(0.8rem, 2.3vw, 0.9rem);
  font-weight: 600;
  color: var(--text);
  min-width: 1.5rem;
  text-align: center;
}

/* Avatars */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm {
  width: clamp(1.5rem, 4vw, 2rem);
  height: clamp(1.5rem, 4vw, 2rem);
  font-size: clamp(0.6rem, 1.8vw, 0.75rem);
}

.avatar-xs {
  width: clamp(1.3rem, 3.5vw, 1.6rem);
  height: clamp(1.3rem, 3.5vw, 1.6rem);
  font-size: clamp(0.55rem, 1.5vw, 0.65rem);
}

.comment-avatar {
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

/* Reply button */
.reply-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: clamp(0.7rem, 1.8vw, 0.78rem);
  font-weight: 500;
  cursor: pointer;
  padding: 0.1rem 0;
  margin-left: 0.5rem;
}

.reply-btn:hover {
  color: var(--primary);
}

/* Comment vote controls */
.comment-actions {
  display: flex;
  align-items: center;
  gap: clamp(0.15rem, 0.5vw, 0.25rem);
  margin-top: 0.25rem;
}

.comment-vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: clamp(0.6rem, 1.6vw, 0.7rem);
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.comment-vote-btn:hover {
  background: #f1f5f9;
}

.comment-vote-btn.active {
  color: var(--primary);
}

.comment-vote-score {
  font-size: clamp(0.7rem, 1.8vw, 0.78rem);
  font-weight: 600;
  color: var(--text-muted);
  min-width: 1rem;
  text-align: center;
}

/* Delete buttons */
.comment-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

.comment-item:hover .comment-delete-btn {
  opacity: 1;
}

.comment-delete-btn:hover {
  color: var(--error);
}

.comment-deleted {
  opacity: 0.55;
}

.deleted-text {
  font-style: italic;
  color: var(--text-muted);
  font-size: clamp(0.72rem, 2vw, 0.82rem);
}

.delete-submission-btn {
  display: none;
}

.photo-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding: 0 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.photo-menu-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.photo-dropdown {
  position: absolute;
  top: 2.5rem;
  right: 0;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 200;
  overflow: hidden;
}

.photo-dropdown .dropdown-item:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
}

/* Reply input */
.reply-box {
  margin-top: 0.5rem;
}

.reply-input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-family: inherit;
  resize: none;
  outline: none;
}

.reply-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: clamp(0.25rem, 1vw, 0.4rem);
  margin-top: 0.4rem;
}

/* User menu dropdown */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.3rem, 1vw, 0.5rem);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: clamp(0.75rem, 2.3vw, 0.85rem);
  font-weight: 500;
  color: var(--text);
  transition: all 0.15s;
  position: relative;
  white-space: nowrap;
}

.user-menu-btn:hover {
  background: #f8fafc;
  border-color: var(--primary);
}

.dropdown-arrow {
  font-size: clamp(0.5rem, 1.5vw, 0.6rem);
  color: var(--text-muted);
  transition: transform 0.15s;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0.25rem;
  margin-top: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: clamp(8rem, 25vw, 10rem);
  z-index: 200;
  overflow: hidden;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.5rem, 2vw, 1rem);
  background: none;
  border: none;
  font-size: clamp(0.8rem, 2.3vw, 0.9rem);
  text-align: left;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.user-menu-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-light);
}

.vote-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.comment-vote-btn:hover {
  background: rgba(255, 255, 255, 0.06);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.error-text {
  color: var(--error);
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  text-align: center;
  padding: 0.5rem;
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
}

/* Auth checking spinner */
.auth-checking {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(3rem, 10vw, 4rem) clamp(1rem, 3vw, 1.25rem);
  color: var(--text-muted);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  gap: 1rem;
}

.spinner {
  width: clamp(1.8rem, 5vw, 2.25rem);
  height: clamp(1.8rem, 5vw, 2.25rem);
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Toast notifications */
.toast {
  position: fixed;
  bottom: clamp(1rem, 3vw, 1.5rem);
  right: clamp(1rem, 3vw, 1.5rem);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2000;
  transform: translateY(1rem);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: min(95vw, 24rem);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-text {
  font-size: clamp(0.78rem, 2vw, 0.88rem);
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.toast-link {
  font-size: clamp(0.75rem, 1.8vw, 0.82rem);
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* Footer */
.footer {
  text-align: center;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  border-top: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-muted);
  font-size: clamp(0.72rem, 2vw, 0.85rem);
}

.comment-input {
  flex: 1;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-family: inherit;
  resize: none;
  outline: none;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
  transition: border-color 0.15s;
}

.comment-input::placeholder {
  color: var(--text-muted);
}

.comment-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.reply-input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-family: inherit;
  resize: none;
  outline: none;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
}

.reply-input::placeholder {
  color: var(--text-muted);
}

.reply-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.gallery-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.05);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.vote-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.comment-vote-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.dropdown-item:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
}

.user-menu-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-light);
}

.comment-input::placeholder {
  color: var(--text-muted);
}

.comment-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.reply-input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: clamp(0.78rem, 2.2vw, 0.85rem);
  font-family: inherit;
  resize: none;
  outline: none;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.reply-input::placeholder {
  color: var(--text-muted);
}

.reply-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Layout breakpoints for column/row switching only, sizing is fluid via clamp() */
@media (max-width: 55rem) {
  .lightbox-content {
    flex-direction: column;
    max-width: 95vw;
  }

  .lightbox-image-area {
    flex: 0 0 auto;
  }

  .lightbox-image {
    border-radius: 4px 4px 0 0;
    max-height: 45vh;
  }

  .lightbox-image-footer {
    border-radius: 0;
  }

  .lightbox-counter-overlay {
    top: 0.5rem;
    right: 0.5rem;
    font-size: clamp(0.65rem, 1.6vw, 0.72rem);
    padding: 0.2rem 0.5rem;
  }

  .lightbox-sidebar {
    flex: 0 0 auto;
    width: 100%;
    max-height: 50vh;
    border-radius: 0 0 4px 4px;
  }
}

@media (max-width: 40rem) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .welcome-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .welcome-actions {
    flex-direction: column;
    width: 100%;
  }

  .welcome-actions .btn {
    width: 100%;
    text-align: center;
  }

  .user-menu-btn {
    order: 10;
  }

  .auth-card-inner {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .auth-separator {
    width: 100%;
    height: 1px;
    align-self: auto;
  }

  .auth-logo-img {
    width: clamp(3rem, 20vw, 5rem);
    height: clamp(3rem, 20vw, 5rem);
  }
}

@media (max-width: 30rem) {
  .gallery-card-image {
    aspect-ratio: 16 / 10;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
  }

  .recent-grid {
    gap: 0.5rem;
  }
}