/* ═══════════════════════════════════════════════
   R8 My Poo – Colorful Poop-Themed Stylesheet
   ═══════════════════════════════════════════════ */

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

:root {
  --poo-brown:  #6B3A2A;
  --poo-light:  #D2691E;
  --poo-gold:   #FFD700;
  --poo-dark:   #3B1A0A;
  --glass-bg:   rgba(255,255,255,0.18);
  --glass-blur: blur(14px);
}

/* ── Animated Rainbow Background ───────────────────────────── */

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  background: linear-gradient(
    130deg,
    #ff6b6b 0%,
    #feca57 14%,
    #48dbfb 28%,
    #ff9ff3 42%,
    #54a0ff 57%,
    #5f27cd 71%,
    #1dd1a1 85%,
    #ff6b6b 100%
  );
  background-size: 400% 400%;
  animation: rainbow-bg 22s ease infinite;
  overflow-x: hidden;
}

@keyframes rainbow-bg {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* ── Floating Poo Rain ─────────────────────────────────────── */

#poo-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.float-poo {
  position: absolute;
  bottom: -8%;
  user-select: none;
  animation: float-up linear forwards;
}

@keyframes float-up {
  from { transform: translateY(0)      rotate(0deg);   }
  to   { transform: translateY(-108vh) rotate(380deg); }
}

/* ── Site Header ───────────────────────────────────────────── */

.site-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 3.5rem 1.5rem 2rem;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 3px solid rgba(255,255,255,0.35);
  margin-bottom: 2.5rem;
}

.site-header h1 {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2.4rem, 9vw, 5.2rem);
  color: #fff;
  text-shadow:
    3px  3px  0 var(--poo-brown),
    6px  6px  0 var(--poo-dark),
    0    0   40px rgba(255,215,0,0.75);
  letter-spacing: 4px;
  margin-bottom: 0.6rem;
  animation: title-bounce 2.2s ease-in-out infinite;
}

@keyframes title-bounce {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-9px);}
}

.tagline {
  font-size: 1.2rem;
  color: #fff;
  font-weight: 700;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.45);
  margin-bottom: 1.1rem;
}

.poo-strip {
  font-size: 1.6rem;
  letter-spacing: 10px;
  opacity: 0.65;
}

/* ── Upload Box ────────────────────────────────────────────── */

.upload-box {
  position: relative;
  z-index: 10;
  background: rgba(255,255,255,0.94);
  border: 4px solid var(--poo-brown);
  border-radius: 26px;
  padding: 2.2rem 2rem;
  max-width: 580px;
  margin: 0 auto 3rem;
  text-align: center;
  box-shadow:
    0 0 0 7px var(--poo-gold),
    0 22px 70px rgba(107,58,42,0.30);
}

.upload-box h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.9rem;
  color: var(--poo-brown);
  margin-bottom: 1.3rem;
}

.error-banner {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  margin-bottom: 1.1rem;
  font-weight: 700;
  font-size: 0.95rem;
}

/* File drop zone */
.file-drop {
  display: block;
  cursor: pointer;
  border: 3px dashed var(--poo-light);
  border-radius: 18px;
  padding: 2rem 1rem;
  margin-bottom: 1.3rem;
  background: #fff9f5;
  transition: all 0.3s ease;
}

.file-drop:hover,
.file-drop.has-file {
  background: #fff0e0;
  border-color: var(--poo-brown);
  transform: scale(1.025);
}

.file-drop input[type="file"] { display: none; }

.drop-icon { font-size: 3.2rem; margin-bottom: 0.5rem; }

.drop-text {
  font-size: 1rem;
  font-weight: 800;
  color: var(--poo-brown);
  word-break: break-all;
  margin-bottom: 0.35rem;
}

.drop-hint { font-size: 0.8rem; color: #aaa; }

/* Upload button */
.btn-upload {
  display: inline-block;
  background: linear-gradient(135deg, var(--poo-brown), var(--poo-light));
  color: #fff;
  border: none;
  padding: 1.05rem 2.8rem;
  border-radius: 50px;
  font-size: 1.15rem;
  font-weight: 900;
  font-family: 'Fredoka One', cursive;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 7px 22px rgba(107,58,42,0.45);
  transition: all 0.25s ease;
}

.btn-upload:hover   { transform: scale(1.07) rotate(-1.5deg); box-shadow: 0 12px 32px rgba(107,58,42,0.65); }
.btn-upload:active  { transform: scale(0.97); }
.btn-upload:disabled{ opacity: 0.7; cursor: not-allowed; transform: none; }

/* ── Gallery ───────────────────────────────────────────────── */

.gallery {
  position: relative;
  z-index: 10;
  max-width: 1320px;
  margin: 0 auto 3.5rem;
  padding: 0 1.5rem;
}

.gallery-title {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  text-align: center;
  text-shadow: 3px 3px 0 var(--poo-brown), 0 0 20px rgba(0,0,0,0.25);
  margin-bottom: 0.4rem;
}

.gallery-sub {
  text-align: center;
  color: rgba(255,255,255,0.88);
  font-weight: 700;
  margin-bottom: 2.2rem;
}

/* ── Empty State ───────────────────────────────────────────── */

.empty-state {
  text-align: center;
  background: rgba(255,255,255,0.88);
  border-radius: 26px;
  padding: 4rem 2rem;
  max-width: 420px;
  margin: 0 auto;
  box-shadow: 0 12px 45px rgba(0,0,0,0.15);
}

.empty-poo {
  font-size: 6rem;
  animation: title-bounce 1.8s ease-in-out infinite;
  display: block;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: 'Fredoka One', cursive;
  font-size: 2.1rem;
  color: var(--poo-brown);
  margin-bottom: 0.5rem;
}

.empty-state p { color: #666; font-weight: 700; font-size: 1.05rem; }

/* ── Image Grid ────────────────────────────────────────────── */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.6rem;
}

/* ── Image Card ────────────────────────────────────────────── */

.image-card {
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  border: 4px solid hsl(var(--card-hue), 80%, 55%);
  box-shadow:
    0 0 0 3px hsl(var(--card-hue), 80%, 78%),
    0 10px 32px rgba(0,0,0,0.14);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.image-card:hover {
  transform: translateY(-11px) rotate(0.4deg);
  box-shadow:
    0 0 0 5px hsl(var(--card-hue), 80%, 65%),
    0 22px 55px rgba(0,0,0,0.22);
}

/* #1 gets the golden treatment */
.top-poo {
  border-color: var(--poo-gold) !important;
  box-shadow:
    0 0 0 5px #FFD700,
    0 0 35px rgba(255,215,0,0.55),
    0 16px 45px rgba(0,0,0,0.18) !important;
  animation: golden-pulse 2.5s ease-in-out infinite;
}

@keyframes golden-pulse {
  0%, 100% { box-shadow: 0 0 0 5px #FFD700, 0 0 35px rgba(255,215,0,0.55), 0 16px 45px rgba(0,0,0,0.18); }
  50%       { box-shadow: 0 0 0 8px #FFD700, 0 0 55px rgba(255,215,0,0.80), 0 22px 55px rgba(0,0,0,0.22); }
}

.card-crown {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: var(--poo-dark);
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.45rem 0.5rem;
  letter-spacing: 1px;
}

.card-rank {
  color: #fff;
  font-family: 'Fredoka One', cursive;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.35rem;
  letter-spacing: 0.5px;
}

/* Image */
.img-wrap {
  height: 240px;
  overflow: hidden;
  background: #f4f4f4;
}

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

.image-card:hover .img-wrap img { transform: scale(1.07); }

/* Card body */
.card-body { padding: 1rem; }

.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.score-num {
  font-family: 'Fredoka One', cursive;
  font-size: 2.1rem;
  color: var(--poo-brown);
  line-height: 1;
}

.score-label {
  font-size: 0.75rem;
  color: #aaa;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  align-self: flex-end;
  padding-bottom: 5px;
}

/* Vote buttons */
.vote-row {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.btn-vote {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0.65rem 0.4rem;
  border: 2px solid transparent;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 900;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Up button */
.btn-up { background: linear-gradient(135deg,#c8f7c5,#a8e6cf); color:#1a7a40; border-color:#a8e6cf; }
.btn-up:hover:not(:disabled) { background: linear-gradient(135deg,#1dd1a1,#00b894); color:#fff; transform: scale(1.06); }
.btn-up.active {
  background: linear-gradient(135deg,#00b894,#1dd1a1);
  color:#fff;
  border-color:#00b894;
  box-shadow: 0 0 14px rgba(0,184,148,0.65);
}

/* Down button */
.btn-down { background: linear-gradient(135deg,#ffeaa7,#fdcb6e); color:#8B4513; border-color:#fdcb6e; }
.btn-down:hover:not(:disabled) { background: linear-gradient(135deg,#e17055,#d63031); color:#fff; transform: scale(1.06); }
.btn-down.active {
  background: linear-gradient(135deg,#d63031,#e17055);
  color:#fff;
  border-color:#d63031;
  box-shadow: 0 0 14px rgba(214,48,49,0.65);
}

/* Time bar */
.time-bar-wrap { text-align: center; }

.time-bar {
  height: 6px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.time-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #1dd1a1);
  border-radius: 6px;
  transition: width 0.5s ease;
}

.expiry-label {
  font-size: 0.78rem;
  color: #999;
  font-weight: 700;
}

/* ── Delete button ─────────────────────────────────────────── */

.btn-delete {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.5rem;
  background: none;
  border: 2px dashed #ffb8b8;
  border-radius: 50px;
  color: #c0392b;
  font-size: 0.85rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-delete:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff6b6b, #d63031);
  border-color: transparent;
  color: #fff;
  transform: scale(1.03);
}

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

/* ── Footer ────────────────────────────────────────────────── */

.site-footer {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255,255,255,0.82);
  font-weight: 700;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.4);
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 620px) {
  .image-grid  { grid-template-columns: 1fr; }
  .upload-box  { margin: 0 1rem 2.5rem; }
  .site-header { padding: 2.5rem 1rem 1.5rem; }
}
