/* ============ Gooner's Lagoon — pink / purple / yellow toon theme ============ */
:root {
  --pink: #ff6ec7;
  --pink-dark: #e843a8;
  --purple: #8854d0;
  --purple-dark: #6a3ab5;
  --yellow: #ffd32a;
  --yellow-dark: #f0b90b;
  --ink: #2d1b4e;
  --paper: #fff7fd;
  --card: #ffffff;
  --outline: 3px solid var(--ink);
  --shadow-toon: 6px 6px 0 var(--ink);
  --shadow-toon-sm: 4px 4px 0 var(--ink);
  --radius: 22px;
  --font-display: "Luckiest Guy", cursive;
  --font-body: "Fredoka", "Baloo 2", sans-serif;
}

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

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Floating blobs ---------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  z-index: -1;
  animation: blobFloat 18s ease-in-out infinite;
  will-change: transform;
  transform: translateZ(0);
}
.blob-pink   { width: 45vw; height: 45vw; background: var(--pink);   top: -10%; left: -10%; }
.blob-purple { width: 40vw; height: 40vw; background: var(--purple); top: 30%;  right: -12%; animation-delay: -6s; }
.blob-yellow { width: 38vw; height: 38vw; background: var(--yellow); bottom: -15%; left: 25%; animation-delay: -12s; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(4vw, -3vh) scale(1.08); }
  66%      { transform: translate(-3vw, 4vh) scale(0.94); }
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 247, 253, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: var(--outline);
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transform: rotate(-2deg);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo:hover { transform: rotate(2deg) scale(1.06); }
.logo-pop   { color: var(--pink);   -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink); }
.logo-burst { color: var(--yellow); -webkit-text-stroke: 1.5px var(--ink); text-shadow: 3px 3px 0 var(--ink); }
.logo-emoji { font-size: 0.9em; margin-left: 6px; animation: bob 2.4s ease-in-out infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.header-actions { display: flex; gap: 12px; }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  border: var(--outline);
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  color: var(--ink);
  box-shadow: var(--shadow-toon-sm);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s;
}
.btn:hover  { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.btn-primary { background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; }
.btn-ghost   { background: var(--yellow); }
.btn-block   { width: 100%; margin-top: 14px; }
.btn-sm      { padding: 6px 14px; font-size: 0.9rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(30px, 7vw, 70px) 16px 20px; }

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  letter-spacing: 2px;
  color: var(--purple);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 5px 5px 0 var(--ink);
}
.hero-amp { color: var(--pink); display: inline-block; animation: spinPulse 3s ease-in-out infinite; }
.wiggle-letter { display: inline-block; animation: wiggle 2.8s ease-in-out infinite; will-change: transform; }
.wiggle-letter:nth-child(odd)  { animation-delay: 0.15s; color: var(--pink); }
.wiggle-letter:nth-child(3n)   { animation-delay: 0.3s;  color: var(--yellow); }

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  25%      { transform: rotate(-6deg) translateY(-8px); }
  75%      { transform: rotate(6deg) translateY(2px); }
}
@keyframes spinPulse {
  0%, 100% { transform: rotate(0) scale(1); }
  50%      { transform: rotate(12deg) scale(1.25); }
}

.hero-sub {
  margin-top: 14px;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  color: var(--purple-dark);
}

/* ---------- Feed filters ---------- */
.filters-section {
  padding: 0 clamp(16px, 4vw, 48px) 18px;
  max-width: 1400px;
  margin: 0 auto;
}
.filters-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-toon-sm);
}
.filters-bar .text-input { flex: 1 1 140px; min-width: 130px; margin: 0; }
.filters-bar .select-input { flex: 0 1 160px; margin: 0; }
.filters-bar .btn { flex: 0 0 auto; }

/* ---------- Tag chips ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag-chip {
  display: inline-block;
  font-size: 0.7rem; font-weight: 700;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ---------- Category squares ---------- */
.categories-section {
  padding: 10px clamp(16px, 4vw, 48px) 0;
  max-width: 1400px;
  margin: 0 auto;
}
/* ---------- Section tabs (Videos / Pictures) ---------- */
.section-tabs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.section-tab {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  padding: 10px 26px;
  border: var(--outline);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-toon-sm);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s, background 0.18s;
}
.section-tab:hover { transform: translateY(-3px) rotate(-1deg); }
.section-tab.active {
  background: var(--pink);
  color: #fff;
  transform: rotate(-1.5deg) scale(1.06);
  box-shadow: 5px 6px 0 var(--ink);
}

.categories { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

.cat-square {
  width: 108px; height: 108px;
  border: var(--outline);
  border-radius: 20px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  box-shadow: var(--shadow-toon-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  animation: cardIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.cat-square:nth-child(3n+1) { background: #ffe3f4; }
.cat-square:nth-child(3n+2) { background: #e9dcff; }
.cat-square:nth-child(3n+3) { background: #fff3c4; }
.cat-square:hover { transform: translateY(-5px) rotate(-2deg); box-shadow: 6px 8px 0 var(--ink); }
.cat-square.active { background: var(--yellow); transform: rotate(-2deg) scale(1.07); }
.cat-emoji { font-size: 2rem; }
.cat-name { text-align: center; padding: 0 6px; line-height: 1.1; }

/* ---------- Feed grid ---------- */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 26px;
  padding: 30px clamp(16px, 4vw, 48px) 80px;
  max-width: 1400px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-toon);
  cursor: pointer;
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  content-visibility: auto;
  contain-intrinsic-size: auto 300px;
  contain: layout paint style;
}
.card:hover { transform: translateY(-8px) rotate(-1.2deg); box-shadow: 10px 12px 0 var(--ink); }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(40px) scale(0.85); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #ffe3f4, #e9dcff);
  overflow: hidden;
}
.card-media img, .card-media video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.card:hover .card-media img,
.card:hover .card-media video { transform: scale(1.08) rotate(1deg); }

.badge-video {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 3px 3px 0 var(--ink);
}
.badge-canva {
  position: absolute;
  top: 10px; right: 10px;
  background: linear-gradient(90deg, #7d5fff, #b57bff);
  color: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 3px 3px 0 var(--ink);
}

/* Canva embed in the viewer: responsive 16:9 frame */
.canva-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #7d5fff22, #ff7bd522);
}
.canva-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Category section select + group headings in admin */
.cat-section { flex: 0 1 150px; width: auto; margin-bottom: 0; }
.cat-group-heading {
  font-family: var(--font-display);
  color: var(--purple);
  font-size: 1rem;
  margin: 16px 0 8px;
}
.cat-group-heading:first-child { margin-top: 4px; }

.card-body { padding: 14px 16px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { font-weight: 700; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.like-btn {
  font-family: var(--font-body);
  font-weight: 700;
  border: 2px solid var(--ink);
  background: #ffe3f4;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}
.like-btn:hover { transform: scale(1.12) rotate(-3deg); background: var(--pink); color: #fff; }
.like-btn.liked { background: var(--pink); color: #fff; animation: heartPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5) rotate(-8deg); }
  100% { transform: scale(1); }
}

/* ---------- Loading / empty ---------- */
.loading-state { display: flex; justify-content: center; gap: 12px; padding: 60px 0; }
.loader-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  animation: dotBounce 0.9s ease-in-out infinite;
}
.loader-dot:nth-child(1) { background: var(--pink); }
.loader-dot:nth-child(2) { background: var(--purple); animation-delay: 0.15s; }
.loader-dot:nth-child(3) { background: var(--yellow); animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-18px); }
}

.empty-state { text-align: center; padding: 60px 20px 100px; }
.empty-emoji { font-size: 4rem; animation: bob 2s ease-in-out infinite; }
.empty-state h2 { font-family: var(--font-display); color: var(--purple); margin: 12px 0 6px; }
.empty-state p { margin-bottom: 18px; font-weight: 600; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(45, 27, 78, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card, .viewer-card {
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--ink);
  padding: 28px;
  width: min(480px, 100%);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.viewer-card { width: min(860px, 100%); }

.pop-in { animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.7) rotate(-3deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 38px; height: 38px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s;
  z-index: 2;
}
.modal-close:hover { transform: rotate(90deg) scale(1.1); background: var(--pink); color: #fff; }

.modal-title { font-family: var(--font-display); color: var(--pink); -webkit-text-stroke: 1px var(--ink); text-shadow: 3px 3px 0 var(--ink); margin-bottom: 18px; font-size: 1.8rem; }

.form-hint { font-size: 0.85rem; font-weight: 600; color: var(--purple-dark); margin: 8px 0 14px; }

.type-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.type-label { font-weight: 700; }
.type-toggle { display: flex; gap: 8px; }
.type-btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}
.type-btn:hover { transform: translateY(-2px); }
.type-btn.active { background: var(--yellow); transform: rotate(-2deg) scale(1.05); }

.url-preview {
  border: var(--outline);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #000;
  max-height: 220px;
}
.url-preview img, .url-preview video { width: 100%; max-height: 220px; object-fit: contain; display: block; }

/* ---------- Admin panel ---------- */
.admin-card { width: min(95vw, 1100px); }
.admin-tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tab {
  font-family: var(--font-body);
  font-weight: 700;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s;
}
.admin-tab:hover { transform: translateY(-2px); }
.admin-tab.active { background: var(--purple); color: #fff; transform: rotate(-1deg); }

.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; max-height: 55vh; overflow-y: auto; }

.batch-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.batch-bar .text-input { flex: 1 1 160px; min-width: 140px; }
.batch-check { font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.btn-danger { background: var(--pink); color: #fff; }

.pagination {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 16px;
}
.pagination .btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.page-info { font-weight: 700; font-size: 0.95rem; }

.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.analytics-card {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  box-shadow: 4px 4px 0 var(--ink);
}
.analytics-card .num { font-family: var(--font-display); font-size: 2.4rem; color: var(--purple); line-height: 1; }
.analytics-card .label { font-weight: 700; font-size: 0.9rem; color: var(--ink); margin-top: 6px; }
.analytics-sub { font-family: var(--font-display); color: var(--purple); margin: 0 0 10px; font-size: 1.2rem; }

.picker-selection { font-weight: 700; font-size: 0.85rem; color: var(--purple-dark); }
.picker-check { margin-right: 8px; width: 18px; height: 18px; accent-color: var(--purple); cursor: pointer; }
.admin-thumb {
  flex-shrink: 0;
  width: 96px; height: 56px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background: #1a1030;
  cursor: zoom-in;
  box-shadow: var(--shadow-toon-sm, 2px 2px 0 var(--ink));
}
.admin-thumb img, .admin-thumb video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.admin-thumb:hover { transform: scale(1.05); }
.admin-row {
  display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 8px 12px;
  background: #fff;
}
.row-label { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.75rem; color: var(--purple-dark); font-weight: 600; }

.icon-btn {
  width: 34px; height: 34px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.icon-btn:hover { transform: scale(1.12) rotate(-4deg); }
.icon-btn.danger { background: var(--pink); }

.category-form { display: flex; gap: 10px; align-items: stretch; }
.category-form .text-input { flex: 1; width: auto; min-width: 0; }
.category-form .emoji-input { flex: 0 0 68px; width: 68px; text-align: center; }
.category-form .btn-add { flex: 0 0 auto; padding: 10px 16px; }
.category-form .prio-input, .edit-row .prio-input { flex: 0 0 62px; width: 62px; text-align: center; }
.prio-badge {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--purple);
  background: var(--lavender);
  border-radius: 8px;
  padding: 2px 6px;
}
.select-input { margin-bottom: 14px; cursor: pointer; }
.or-hint { text-align: center; margin: 10px 0 8px; }

.emoji-picker {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 10px 0 18px;
  padding: 10px;
  background: #fff3c4;
  border: 2px solid var(--ink);
  border-radius: 16px;
}
.emoji-picker .icon-btn { width: 38px; height: 38px; font-size: 1.2rem; padding: 0; }

.edit-row { flex-wrap: wrap; }
.edit-row .text-input { flex: 1 1 120px; min-width: 0; }

/* ---------- Degoo picker ---------- */
.degoo-picker {
  border: var(--outline);
  border-radius: 16px;
  background: #fff;
  margin-top: 12px;
  overflow: hidden;
}
.picker-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: #e9dcff;
  border-bottom: 2px solid var(--ink);
  flex-wrap: wrap;
}
.picker-path { flex: 1; font-weight: 700; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 120px; }
.picker-list { max-height: 260px; overflow-y: auto; }
.picker-item.selected { background: #fff3c4; }
.picker-item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 0; border-bottom: 1px dashed #d9c8ff;
  background: transparent;
  font-family: var(--font-body); font-weight: 600; font-size: 0.9rem;
  color: var(--ink);
  text-align: left; cursor: pointer;
}
.picker-item:hover { background: #fff3c4; }
.picker-item .row-label { flex: 1; }
.picker-item.disabled { opacity: 0.45; cursor: default; }
.picker-empty { padding: 18px; text-align: center; font-weight: 600; color: var(--purple-dark); }
.form-stack { display: flex; flex-direction: column; gap: 12px; }

.text-input {
  width: 100%;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: var(--outline);
  border-radius: 14px;
  padding: 12px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.15s;
}
.text-input:focus { box-shadow: var(--shadow-toon-sm); border-color: var(--pink); }

.upload-progress {
  margin-top: 14px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  transition: width 0.2s;
}

/* ---------- Viewer ---------- */
.viewer-media { border: var(--outline); border-radius: 16px; overflow: hidden; background: #000; position: relative; }
.viewer-media img, .viewer-media video { width: 100%; max-height: 65vh; object-fit: contain; display: block; }

/* ±10s seek buttons overlaid on the video */
.vid-seek {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: #fff;
  background: rgba(20, 8, 40, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  backdrop-filter: blur(3px);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 2;
}
.vid-seek:hover { background: rgba(125, 95, 255, 0.85); transform: translateY(-50%) scale(1.08); }
.vid-seek:active { transform: translateY(-50%) scale(0.95); }
.vid-seek-back { left: 12px; }
.vid-seek-fwd { right: 12px; }
.viewer-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.viewer-meta h2 { font-family: var(--font-display); color: var(--purple); font-size: 1.5rem; }
.viewer-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* ---------- Storyboard (viewer) ---------- */
.viewer-story {
  margin-top: 14px;
  padding: 16px 18px;
  background: #fff8e1;
  border: 2px solid var(--ink);
  border-radius: 14px;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.story-heading { font-family: var(--font-display); color: var(--purple); font-size: 1.15rem; margin: 0; }
.story-block { position: relative; }
.story-text { font-weight: 500; line-height: 1.55; word-break: break-word; }
.story-text p { margin: 0 0 8px; }
.story-text p:last-child { margin-bottom: 0; }
.story-image {
  margin: 0;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-toon-sm);
}
.story-image img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: #000; }
.story-image figcaption { padding: 8px 12px; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.story-scene {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--yellow); color: var(--ink);
  border: 2px solid var(--ink); font-weight: 800; font-size: 0.85rem;
}

/* ---------- Story editor (admin + upload) ---------- */
.textarea-input { resize: vertical; min-height: 72px; font-family: inherit; line-height: 1.4; }
.story-editor {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px;
  border: 2px dashed var(--ink);
  border-radius: 12px;
  background: #fff;
}
.edit-row .story-editor { flex: 1 1 100%; }
#uploadForm > .type-label { display: block; margin: 12px 0 6px; }
#uploadForm > .story-editor { margin-bottom: 14px; }
.story-edit-block { display: flex; align-items: flex-start; gap: 8px; }
.story-edit-kind { font-size: 1.2rem; line-height: 1; padding-top: 10px; }
.story-edit-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.story-edit-fields .text-input { width: 100%; }
.story-edit-controls { display: flex; flex-direction: column; gap: 4px; }
.story-edit-controls .icon-btn { width: 30px; height: 30px; font-size: 0.9rem; padding: 0; }
.story-edit-controls .icon-btn[disabled] { opacity: 0.35; cursor: default; }
.story-edit-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.story-edit-empty { margin: 0; }

/* ---------- Site settings ---------- */
#tabSettings .type-label { display: block; font-weight: 700; margin-bottom: 4px; }
#tabSettings .text-input { margin-bottom: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  padding: 14px 26px;
  border-radius: 999px;
  border: 3px solid var(--yellow);
  box-shadow: var(--shadow-toon-sm);
  z-index: 200;
  animation: toastUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastUp {
  from { opacity: 0; transform: translate(-50%, 30px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Confetti ---------- */
#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ---------- Age gate ---------- */
.age-gate {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(45, 27, 78, 0.92);
  backdrop-filter: blur(8px);
}
.age-gate.hidden { display: none !important; }
.age-gate-box {
  max-width: 460px; width: 100%;
  background: var(--card);
  border: 4px solid var(--ink);
  border-radius: 28px;
  padding: 34px;
  text-align: center;
  box-shadow: var(--shadow-toon-lg);
}
.age-gate-icon { font-size: 4rem; margin-bottom: 12px; }
.age-gate-box h2 { margin: 0 0 14px; font-size: 1.9rem; color: var(--ink); }
.age-gate-box p { margin: 0 0 10px; color: #444; font-size: 1.05rem; }
.age-gate-actions { display: flex; gap: 12px; justify-content: center; margin: 24px 0 14px; }
.age-gate-actions .btn { flex: 1; min-width: 120px; }
.age-gate-note { color: #666; font-size: 0.8rem; }

/* ---------- Lagoon Bot chat ---------- */
.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 62px;
  height: 62px;
  border: var(--outline);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  font-size: 1.7rem;
  cursor: pointer;
  box-shadow: var(--shadow-toon);
  z-index: 150;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: cardIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.chat-fab:hover { transform: scale(1.1) rotate(-6deg); }
.chat-fab-open { transform: scale(0.9); }

.chat-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: min(360px, calc(100vw - 44px));
  height: min(480px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: var(--outline);
  border-radius: 22px;
  box-shadow: var(--shadow-toon);
  z-index: 150;
  overflow: hidden;
  animation: cardIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  color: #fff;
}
.chat-head .icon-btn { border-color: rgba(255,255,255,0.6); color: #fff; background: rgba(0,0,0,0.15); width: 32px; height: 32px; }
.chat-head-info { display: flex; flex-direction: column; min-width: 0; }
.chat-title { font-family: var(--font-display); font-size: 1.1rem; }
.chat-ctx { font-size: 0.72rem; opacity: 0.9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 250px; }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fdf4ff;
}
.chat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  animation: cardIn 0.2s ease backwards;
}
.chat-msg.bot {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--purple);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-typing {
  display: flex;
  gap: 5px;
  padding: 6px 16px 8px;
  background: #fdf4ff;
}
.chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  animation: chatDot 0.9s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-5px); opacity: 1; }
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 2px solid var(--ink);
  background: #fff;
}
.chat-form .text-input { flex: 1; margin-bottom: 0; }
.chat-form .btn { flex: 0 0 auto; }

@media (max-width: 560px) {
  .chat-fab { right: 14px; bottom: 14px; }
  .chat-panel { right: 8px; bottom: 86px; width: calc(100vw - 16px); }
}

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

@media (max-width: 560px) {
  .header-actions .btn { padding: 8px 14px; font-size: 0.9rem; }
  .feed { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
}
