/* ─── Reset & Variables ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --accent: #e94615;
  --forest: #1e2b1e;
  --body-bg: #ece8df;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #d8d4cb;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ────────────────────────────────────────────────────── */
.site-header {
  background: #ffffff;
  color: var(--text);
  text-align: center;
  padding: 2.5rem 0 0;
  position: relative;
  z-index: 2;
}

.header-inner {
  position: relative;
  z-index: 1;
  padding: 0 1.5rem;
}

.site-logo {
  max-height: 110px;
  max-width: 300px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.site-title-text {
  display: inline-block;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  line-height: 1.1;
}

.site-tagline {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #9b9890;
  margin-top: 0.6rem;
  font-weight: 500;
}

.header-divider {
  display: block;
  width: 100%;
  height: 70px;
  margin-top: 2.5rem;
  filter: drop-shadow(0 -3px 6px rgba(40, 35, 25, 0.06));
}

/* ─── Layout ────────────────────────────────────────────────────── */
.main-content { min-height: 60vh; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  padding: 2rem 0;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ─── Ich bin Card ──────────────────────────────────────────────── */
.hero-section { padding-top: 1.5rem; }

.ich-bin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.ich-bin-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

.ich-bin-form { display: flex; flex-direction: column; gap: 1rem; }

.select-wrapper {
  position: relative;
}

.name-select {
  width: 100%;
  padding: 0.875rem 2.5rem 0.875rem 1rem;
  font-size: 1rem;
  font-family: var(--font);
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.name-select:focus {
  outline: none;
  border-color: var(--accent);
}

.select-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.empty-hint { color: var(--text-muted); font-size: 0.9rem; }
.empty-hint a { color: var(--accent); }

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover  { opacity: 0.88; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-full { width: 100%; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0;
  transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

.accent-text { color: var(--accent); }

/* ─── Leaderboard ───────────────────────────────────────────────── */
.leaderboard-section { padding-top: 0; }

.leaderboard {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 480px;
  margin: 0 auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row.leader { background: rgba(233,70,21,0.05); }

.rank { font-weight: 700; color: var(--text-muted); width: 1.5rem; flex-shrink: 0; }
.lb-name { flex: 1; }
.lb-count { font-weight: 700; font-size: 0.95rem; }
.lb-label { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.crown { font-size: 1.1rem; }

/* ─── Photo Grid ────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
}

@media (min-width: 540px)  { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 780px)  { .photo-grid { grid-template-columns: repeat(4, 1fr); } }

.photo-card {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: #d0cfc9;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.photo-card:hover img  { transform: scale(1.05); }
.photo-card:active img { transform: scale(0.97); }

.photo-name-tag {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0,0,0,0.62);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 8px 4px;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(2px);
}

/* new photo animation */
.photo-card.new-photo {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.photo-card.new-photo.visible {
  opacity: 1;
  transform: scale(1);
}

/* ─── User Page ─────────────────────────────────────────────────── */
.user-header-section { padding-bottom: 1rem; }

.user-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.user-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}

.photo-count-badge {
  background: var(--forest);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
}

/* ─── Upload Zone ───────────────────────────────────────────────── */
.upload-zone { margin-bottom: 0.5rem; }

.btn-upload {
  font-size: 1.05rem;
  padding: 1rem 2rem;
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(233,70,21,0.3);
}

.upload-progress {
  margin-top: 1rem;
  max-width: 400px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0%;
  transition: width 0.2s;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }

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

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 95vw;
  max-height: 95vh;
}

.lightbox-content img {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-caption {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-close { top: 1rem; right: 1rem; font-size: 1.8rem; }
.lightbox-prev  { left: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; }
.lightbox-next  { right: 0.75rem; top: 50%; transform: translateY(-50%); font-size: 1.8rem; }

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.22); }

/* ─── Footer ────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}
