:root {
  --pink: #ff6ec7;
  --orange: #ff9a3c;
  --yellow: #ffd93d;
  --green: #6bcb77;
  --blue: #4d96ff;
  --purple: #a66bff;
  --ink: #2e2340;
  --card: #ffffff;
  --radius: 22px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Quicksand', sans-serif;
  color: var(--ink);
  background: linear-gradient(-45deg, #ffe3f0, #e0f2ff, #fff8dd, #ece0ff);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  overflow-x: hidden;
}

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

/* floating decorative shapes */
.floating-shapes { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.shape { position: absolute; font-size: 2.2rem; opacity: 0.25; animation: floatUp linear infinite; }
.s1 { left: 5%;  color: var(--pink);   animation-duration: 14s; }
.s2 { left: 20%; color: var(--blue);   animation-duration: 18s; animation-delay: -4s; }
.s3 { left: 40%; color: var(--yellow); animation-duration: 12s; animation-delay: -8s; }
.s4 { left: 60%; color: var(--purple); animation-duration: 20s; animation-delay: -2s; }
.s5 { left: 80%; color: var(--green);  animation-duration: 16s; animation-delay: -10s; }
.s6 { left: 92%; color: var(--orange); animation-duration: 15s; animation-delay: -6s; }

@keyframes floatUp {
  from { transform: translateY(110vh) rotate(0deg); }
  to   { transform: translateY(-20vh) rotate(360deg); }
}

.hero { position: relative; z-index: 1; text-align: center; padding: 3rem 1.5rem 1.25rem; }

.title {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 800;
  margin: 0;
  background: linear-gradient(90deg, var(--pink), var(--orange), var(--yellow), var(--green), var(--blue), var(--purple));
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow 6s linear infinite;
  outline: none;
  filter: drop-shadow(0 2px 0 rgba(46,35,64,0.12));
}

@keyframes rainbow { to { background-position: 300% center; } }

.subtitle {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0.9rem 0 0;
  padding: 0.45rem 1.3rem;
  background: rgba(255,255,255,0.65);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(46,35,64,0.08);
  outline: none;
}

[contenteditable="true"] { box-shadow: inset 0 0 0 2px var(--blue); border-radius: 10px; }
.title[contenteditable="true"] { box-shadow: none; text-decoration: underline dotted var(--blue); }

main { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 3rem; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 1rem; margin-bottom: 2rem;
}
.toolbar[hidden] { display: none; }

.btn {
  font-family: 'Baloo 2', cursive;
  font-size: 1.05rem; font-weight: 700; color: #fff;
  border: none; border-radius: 999px; padding: 0.85rem 1.6rem;
  cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,0.14);
  display: inline-flex; align-items: center; gap: 0.5rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.14); }
.btn-upload { background: linear-gradient(135deg, var(--orange), var(--pink)); }
.btn-ghost  { background: rgba(46,35,64,0.55); }
.btn-small  { padding: 0.55rem 1.1rem; font-size: 0.95rem; background: linear-gradient(135deg, var(--blue), var(--purple)); box-shadow: 0 4px 0 rgba(0,0,0,0.14); }
.btn-block  { width: 100%; justify-content: center; margin-top: 0.8rem; }

.empty-state { text-align: center; padding: 3rem 1rem; opacity: 0.7; }
.empty-state.hidden { display: none; }
.empty-emoji { font-size: 3.5rem; margin-bottom: 0.5rem; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.7rem;
}

.card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.7rem 0.7rem 0.55rem;
  box-shadow: 0 8px 22px rgba(46,35,64,0.13);
  transform: rotate(var(--tilt, 0deg));
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: rotate(0deg) translateY(-5px);
  box-shadow: 0 16px 32px rgba(46,35,64,0.22);
  z-index: 2;
}

.card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  background: #f3f0fa;
  cursor: pointer;
}

.card .caption {
  font-family: 'Baloo 2', cursive;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  padding: 0.5rem 0.25rem 0.15rem;
  outline: none;
}

.art-date {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.5;
  margin: 0;
  padding-bottom: 0.15rem;
}
.lightbox-panel .art-date { font-size: 0.88rem; margin-top: -0.1rem; }

.action-row {
  display: flex; justify-content: center; gap: 0.5rem;
  padding: 0.3rem 0 0.2rem;
}

.pill {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700; font-size: 0.9rem;
  color: var(--ink);
  background: #f4f1fb;
  border: none; border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.pill:hover { background: #e9e3f8; transform: scale(1.06); }
.pill.liked { background: #ffe0ef; color: #d6336c; }
.pill.pop { animation: heartPop 0.35s ease; }

@keyframes heartPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.card .delete-btn {
  position: absolute; top: -9px; right: -9px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--pink); color: #fff;
  font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 3;
}
.card:hover .delete-btn { opacity: 1; }
.card .delete-btn:hover { transform: scale(1.15); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(46,35,64,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem; z-index: 100;
  overflow-y: auto;
}
.modal-backdrop.hidden { display: none; }

.modal-panel, .lightbox-panel {
  position: relative;
  background: #fff;
  border-radius: 26px;
  padding: 1.6rem;
  width: min(94vw, 440px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.lightbox-panel {
  width: min(94vw, 560px);
  max-height: 92vh;
  overflow-y: auto;
}

.lightbox-panel img {
  width: 100%;
  max-height: 48vh;
  object-fit: contain;
  border-radius: 16px;
  background: #f6f4fb;
}

.lightbox-caption {
  font-family: 'Baloo 2', cursive;
  font-size: 1.4rem; font-weight: 800;
  text-align: center; margin: 0.7rem 0 0.2rem;
  outline: none;
}

.modal-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.35rem; font-weight: 800;
  margin: 0 0 1rem; text-align: center;
}

.close-btn {
  position: absolute; top: 0.8rem; right: 0.8rem;
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: #f1edf9; color: var(--ink);
  font-size: 1rem; font-weight: 800; cursor: pointer;
  z-index: 2;
}
.close-btn:hover { background: var(--pink); color: #fff; }

/* comments */
.comments { margin-top: 0.9rem; border-top: 2px dashed #eee5fb; padding-top: 0.7rem; }
.comments-title {
  font-family: 'Baloo 2', cursive;
  font-size: 1.05rem; margin: 0 0 0.5rem;
}
.comment-list { list-style: none; margin: 0 0 0.8rem; padding: 0; max-height: 180px; overflow-y: auto; }
.comment-list li {
  background: #f8f5fe;
  border-radius: 14px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.45rem;
  font-size: 0.92rem;
  position: relative;
}
.comment-list .who { font-weight: 700; color: var(--purple); margin-right: 0.35rem; }
.comment-list .del-comment {
  position: absolute; top: 4px; right: 6px;
  border: none; background: none; color: #c9b8e8;
  font-weight: 800; cursor: pointer;
}
.comment-list .del-comment:hover { color: var(--pink); }
.no-comments { opacity: 0.55; font-size: 0.9rem; }

.comment-form { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.comment-form input {
  flex: 1 1 120px;
  font-family: 'Quicksand', sans-serif; font-weight: 600;
  border: 2px solid #ece5f9; border-radius: 12px;
  padding: 0.55rem 0.8rem; font-size: 0.92rem;
  outline: none;
}
.comment-form input:focus { border-color: var(--purple); }
#commentText { flex: 2 1 180px; }

#adminForm input {
  width: 100%;
  font-family: 'Quicksand', sans-serif; font-weight: 600;
  border: 2px solid #ece5f9; border-radius: 12px;
  padding: 0.7rem 0.9rem; font-size: 1rem; outline: none;
}
#adminForm input:focus { border-color: var(--purple); }

/* share */
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.share-btn {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem; font-weight: 700;
  color: var(--ink);
  background: #f4f1fb;
  border: none; border-radius: 16px;
  padding: 0.9rem 0.6rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.share-btn:hover { background: #e9e3f8; transform: scale(1.04); }
.share-hint { font-size: 0.82rem; opacity: 0.65; text-align: center; margin: 0.9rem 0 0; }

.footer {
  text-align: center; padding: 1.5rem;
  font-weight: 700; opacity: 0.65;
  position: relative; z-index: 1;
}
.admin-link {
  border: none; background: none;
  color: inherit; opacity: 0.5;
  font-size: 0.9rem; cursor: pointer;
  margin-left: 0.4rem;
}
.admin-link:hover { opacity: 1; }

.toast {
  position: fixed; bottom: 1.6rem; left: 50%;
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-weight: 700; font-size: 0.95rem;
  padding: 0.75rem 1.5rem; border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 200;
  animation: toastIn 0.25s ease;
}
.toast.hidden { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 480px) {
  .toolbar { flex-direction: column; }
  .btn { width: 100%; justify-content: center; }
  .share-buttons { grid-template-columns: 1fr; }
}
