/* Kindy B Play Date Ideas — v2 "playground" theme.
   No web fonts, no external assets, no inline styles (CSP style-src 'self'). */

:root {
  --sky-top: #6cc8ff;
  --sky-mid: #a8e1ff;
  --sky-low: #e3f6ff;
  --grass: #5cc23f;
  --card: #ffffff;
  --ink: #1d3557;
  --muted: #4a6283;
  --accent: #ff8a3d;
  --accent-dark: #f06d1d;
  --accent-ink: #ffffff;
  --heart: #ff3d6e;
  --heart-soft: #ffe3ea;
  --gold: #ffc300;
  --line: #d9ecfa;
  --ok: #1f8a4c;
  --err: #d62839;
  --shadow: 0 4px 0 rgba(29, 53, 87, 0.08), 0 8px 22px rgba(29, 53, 87, 0.12);
  --radius: 24px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Nunito Sans", "Varela Round", "Quicksand",
          "M PLUS Rounded 1c", "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN",
          system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 38%, var(--sky-low) 100%) fixed;
  background-color: var(--sky-low);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- sky: sun + clouds ---------------- */
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }

.sun { position: absolute; top: -34px; right: -30px; width: 150px; height: 150px; }
.sun-rays {
  position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 64, 0.95) 0deg 10deg, transparent 12deg 30deg);
  animation: spin 40s linear infinite;
}
.sun-face {
  position: absolute; inset: 30px; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fff3a8 0 18%, #ffd93d 45%, #ffbf1f 100%);
  box-shadow: 0 0 30px 8px rgba(255, 205, 50, 0.55);
}

.cloud {
  position: absolute; background: #fff; border-radius: 999px; opacity: 0.92;
  box-shadow: 0 6px 14px rgba(60, 120, 170, 0.12);
}
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud-1 { top: 64px; left: -20px; width: 120px; height: 36px; animation: drift 46s linear infinite; }
.cloud-1::before { width: 56px; height: 56px; top: -28px; left: 18px; }
.cloud-1::after  { width: 42px; height: 42px; top: -18px; left: 62px; }
.cloud-2 { top: 190px; right: -40px; width: 96px; height: 30px; opacity: 0.8; animation: drift 60s linear infinite reverse; }
.cloud-2::before { width: 44px; height: 44px; top: -22px; left: 14px; }
.cloud-2::after  { width: 34px; height: 34px; top: -14px; left: 50px; }
.cloud-3 { top: 420px; left: 12%; width: 80px; height: 26px; opacity: 0.6; animation: drift 75s linear infinite; }
.cloud-3::before { width: 38px; height: 38px; top: -19px; left: 10px; }
.cloud-3::after  { width: 28px; height: 28px; top: -12px; left: 42px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(40vw); }
  100% { transform: translateX(0); }
}

/* ---------------- layout ---------------- */
.wrap {
  position: relative; z-index: 1; flex: 1 0 auto; width: 100%;
  max-width: 640px; margin: 0 auto;
  padding: max(26px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           20px max(16px, env(safe-area-inset-left));
}

.top { text-align: center; margin: 10px 0 22px; }

h1 {
  font-size: clamp(2rem, 8.4vw, 2.9rem);
  line-height: 1.08;
  margin: 0 0 10px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #ffffff;
  text-shadow: 0 3px 0 #2f8fd0, 0 6px 14px rgba(20, 80, 140, 0.35);
}

.lead {
  display: inline-block;
  margin: 0;
  padding: 8px 16px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
}

/* ---------------- add form ---------------- */
.add {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 10px;
  margin-bottom: 22px;
  border: 3px solid #ffe08a;
}
.add-label { display: block; font-weight: 800; font-size: 1.12rem; margin: 2px 4px 10px; }
.add-row { display: flex; gap: 10px; }

.add input {
  flex: 1; min-width: 0; min-height: 60px;
  padding: 12px 18px;
  font: inherit; font-size: 1.12rem; /* >= 16px stops iOS zoom */
  color: var(--ink);
  background: #f4fbff;
  border: 3px solid var(--line);
  border-radius: 18px;
  outline: none;
}
.add input::placeholder { color: #8aa0b8; }
.add input:focus { border-color: var(--accent); background: #fff; }
.add input[aria-invalid="true"] { border-color: var(--err); }

.btn-add {
  min-height: 60px; min-width: 96px;
  padding: 0 24px;
  font: inherit; font-size: 1.2rem; font-weight: 900;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0; border-radius: 18px;
  box-shadow: 0 4px 0 var(--accent-dark);
  cursor: pointer; touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn-add:hover { background: #ff7a26; }
.btn-add:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.btn-add:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-add:focus-visible, .heart:focus-visible { outline: 4px solid #1982c4; outline-offset: 3px; }

.counter { margin: 8px 6px 0; text-align: right; font-size: 0.9rem; font-weight: 700; color: var(--muted); }
.counter.near { color: #b26a00; }
.counter.over { color: var(--err); }

/* ---------------- idea cards ---------------- */
.status { text-align: center; color: var(--ink); font-weight: 700; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.card {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 12px 12px 12px;
  min-height: 84px;
  border: 3px solid transparent;
}
.card.is-top {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fffbe6 0%, #ffffff 70%);
}
.card.flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0%   { box-shadow: 0 0 0 6px rgba(255, 138, 61, 0.7), var(--shadow); }
  100% { box-shadow: var(--shadow); }
}

.badge {
  position: relative; flex: none;
  width: 60px; height: 60px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: #e8f6ff;
}
.place-icon { width: 46px; height: 46px; display: block; border-radius: 14px; overflow: hidden; }
.crown-icon {
  position: absolute; top: -17px; left: 50%;
  width: 38px; height: 25px;
  transform: translateX(-50%) rotate(-8deg);
  filter: drop-shadow(0 2px 1px rgba(160, 100, 0, 0.35));
}

/* per-icon badge colours */
.badge-park       { background: #e3f8de; }
.badge-playground { background: #efe8ff; }
.badge-beach      { background: #e0f4ff; }
.badge-zoo        { background: #fff1d6; }
.badge-farm       { background: #ffe5e3; }
.badge-playcentre { background: #fff6cc; }
.badge-pool       { background: #dcf6ff; }
.badge-library    { background: #f1f8dc; }
.badge-cafe       { background: #ffe8ef; }
.badge-museum     { background: #ece9ff; }
.badge-bowling    { background: #e9e3ff; }
.badge-trampoline { background: #e3f1ff; }
.badge-aquarium   { background: #dff7ff; }
.badge-bike       { background: #ffe9e6; }
.badge-picnic     { background: #fff0dc; }
.badge-balloon    { background: #ffe6ec; }

.card-body { flex: 1; min-width: 0; }
.idea-text {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.top-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #7a5200;
  background: #ffe58a;
  border-radius: 999px;
}
.top-tag[hidden] { display: none; }

/* ---------------- heart vote button ---------------- */
.heart {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 82px; min-height: 60px;
  padding: 0 16px;
  font: inherit; font-size: 1.2rem; font-weight: 900;
  color: var(--heart);
  background: #ffffff;
  border: 3px solid #ffc2d1;
  border-radius: 999px;
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.heart:disabled { cursor: progress; }
.heart-icon { width: 28px; height: 28px; transition: transform 0.12s ease; }
.heart-icon path { fill: none; stroke: var(--heart); stroke-width: 2.2; stroke-linejoin: round; }
.heart.on { background: var(--heart-soft); border-color: var(--heart); }
.heart.on .heart-icon path { fill: var(--heart); }
.heart:active .heart-icon { transform: scale(1.2); }
.heart.pop .heart-icon { animation: pop 0.45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  100% { transform: scale(1); }
}

/* ---------------- confetti ---------------- */
.confetti {
  position: absolute;
  left: var(--x); top: var(--y);
  width: 0; height: 0;
  pointer-events: none;
  z-index: 30;
}
.confetti .bit {
  position: absolute; left: -4px; top: -6px;
  width: 8px; height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: confetti 0.9s cubic-bezier(.2, .7, .3, 1) forwards;
}
.confetti .bit.round { width: 9px; height: 9px; border-radius: 50%; }
.confetti .c0 { background: #ff3d6e; }
.confetti .c1 { background: #ffc300; }
.confetti .c2 { background: #4cc9f0; }
.confetti .c3 { background: #8ac926; }
.confetti .c4 { background: #9b5de5; }
.confetti .c5 { background: #ff8a3d; }
@keyframes confetti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(0.6); }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 26px)) rotate(var(--rot)) scale(1); }
}

/* ---------------- empty state + footer ---------------- */
.empty {
  text-align: center; color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius);
  padding: 22px 16px 24px;
}
.empty[hidden] { display: none; }
.empty-art { width: 140px; height: 105px; display: block; margin: 0 auto 6px; }
.empty-big { font-size: 1.5rem; margin: 0 0 4px; font-weight: 900; }
.empty p { margin: 0; }

.foot {
  text-align: center; color: var(--ink);
  font-size: 0.98rem; font-weight: 600;
  margin: 26px 0 8px;
}

.grass {
  position: relative; z-index: 1; flex: none;
  height: 92px;
  margin-top: 8px;
  background: linear-gradient(180deg, transparent 0 34px, var(--grass) 34px);
  padding-bottom: env(safe-area-inset-bottom);
}
.grass-wave { position: absolute; left: 0; top: 0; width: 100%; height: 60px; display: block; }
.flowers { position: absolute; left: 50%; bottom: 14px; width: min(100%, 640px); height: 40px; transform: translateX(-50%); }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 14px 22px;
  border-radius: 18px;
  background: var(--ink); color: #fff;
  font-size: 1.05rem; font-weight: 800; text-align: center;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
  z-index: 40;
}
.toast-error { background: var(--err); }
.toast-ok { background: var(--ok); }

.noscript { text-align: center; padding: 20px; position: relative; z-index: 1; }

/* ---------------- desktop ---------------- */
@media (min-width: 720px) {
  .sun { top: -20px; right: 6vw; width: 190px; height: 190px; }
  .sun-face { inset: 38px; }
  .wrap { padding-top: 48px; }
}

/* ---------------- reduced motion: no animation at all ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .confetti { display: none !important; }
}

/* ---------------- admin page (admin.html) ---------------- */
.admin-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.admin-box label { font-weight: 800; }
.admin-box input { width: 100%; min-height: 52px; padding: 10px 14px; font: inherit; color: var(--ink); background: #f4fbff; border: 3px solid var(--line); border-radius: 14px; margin: 6px 0 12px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-plain { min-height: 52px; padding: 0 18px; font: inherit; font-weight: 700; color: var(--ink); background: #fff; border: 3px solid var(--line); border-radius: 14px; cursor: pointer; }
.btn-danger { min-height: 52px; padding: 0 16px; font: inherit; font-weight: 800; color: #fff; background: var(--err); border: 0; border-radius: 14px; cursor: pointer; flex: none; }
.admin-votes { color: var(--muted); font-size: 0.95rem; font-weight: 700; flex: none; }
.admin-page .wrap a { color: var(--ink); font-weight: 700; }
.admin-page .card > .idea-text { flex: 1; min-width: 0; }
