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

:root {
  --pink: #e8a0b4;
  --rose: #c9607a;
  --cream: #fdf8f5;
  --dark: #3a2030;
  --mid: #7a5060;
  --light: #f5e8ed;
  --radius: 12px;
  --gap: 16px;
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
  padding: 0;
}

/* ── Layout ── */
.page { max-width: 480px; margin: 0 auto; padding: 24px var(--gap) 48px; }
.page-wide { max-width: 960px; margin: 0 auto; padding: 24px var(--gap) 48px; }

/* ── Header ── */
.site-header { text-align: center; margin-bottom: 32px; }
.site-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--rose); line-height: 1.2; }
.site-header p { color: var(--mid); margin-top: 8px; font-size: 0.95rem; }

/* ── Upload area ── */
.upload-area {
  border: 2px dashed var(--pink);
  border-radius: var(--radius);
  padding: 32px var(--gap);
  text-align: center;
  background: var(--light);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: block;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--rose);
  background: #fce8ef;
}
.upload-area svg { color: var(--pink); margin-bottom: 12px; }
.upload-area p { color: var(--mid); font-size: 0.9rem; }
.upload-area strong { color: var(--rose); }
#file-input { display: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--rose); color: white; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--light); color: var(--rose); border: 1.5px solid var(--pink); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; min-height: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }

/* ── Upload queue ── */
.upload-queue { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.upload-item {
  background: white;
  border: 1px solid #e8d0d8;
  border-radius: var(--radius);
  padding: 12px 14px;
}
.upload-item-name { font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-bar-track { height: 6px; background: var(--light); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--rose); border-radius: 3px; transition: width 0.2s; width: 0; }
.upload-item-status { font-size: 0.8rem; margin-top: 4px; }
.status-uploading { color: var(--mid); }
.status-done { color: #4a9e6a; }
.status-error { color: #c04040; }

/* ── Photo grid ── */
.section-title { font-size: 1rem; font-weight: 700; color: var(--dark); margin: 32px 0 16px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--light);
}
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card .download-btn {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--rose);
  min-height: 28px;
  min-width: 44px;
}
.photo-card .download-btn:hover { background: white; }

/* ── Auth form ── */
.auth-form { background: white; border-radius: var(--radius); padding: 32px 24px; box-shadow: 0 2px 16px rgba(0,0,0,0.07); }
.auth-form h2 { font-size: 1.25rem; margin-bottom: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; color: var(--mid); }
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e0c8d0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--rose); }
.auth-error { color: #c04040; font-size: 0.85rem; margin-top: 8px; display: none; }

/* ── Gallery header ── */
.gallery-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.gallery-count { color: var(--mid); font-size: 0.9rem; }

/* ── Pagination ── */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 32px; }

/* ── Notices ── */
.notice {
  background: var(--light);
  border: 1.5px solid var(--pink);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.notice-title { font-weight: 700; color: var(--rose); margin-bottom: 6px; }

/* ── Loading ── */
.loading { text-align: center; padding: 40px 0; color: var(--mid); }
.spinner {
  display: inline-block;
  width: 32px; height: 32px;
  border: 3px solid var(--pink);
  border-top-color: var(--rose);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 480px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
