/* ══════════════════════════════════════════════════════════════════════════
   Ivy's Frog Pond — a hand-drawn cartoon pond for a very important birthday list
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --pond-deep:   #0f6d63;
  --pond:        #1f9e8f;
  --pond-light:  #57c7b6;
  --sky:         #bfeaff;
  --sky-2:       #8fd6f2;
  --leaf:        #6cd147;
  --leaf-dark:   #3c8f2c;
  --lily:        #ff6f9c;
  --lily-dark:   #d63e73;
  --sunny:       #ffd23f;
  --sun-deep:    #ff9f1c;
  --cream:       #fffdf3;
  --ink:         #24402f;
  --ink-soft:    #4d6b52;

  --card-radius: 26px;
  --shadow-pop:  0 10px 0 rgba(30, 90, 60, .18), 0 18px 30px rgba(10, 60, 45, .22);
  --font-fun:    'Baloo 2', system-ui, sans-serif;
  --font-body:   'Nunito', system-ui, sans-serif;
  --font-logo:   'Chewy', 'Baloo 2', system-ui, cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* keep display:flex/grid classes from unhiding elements */
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-2) 22%, var(--pond-light) 40%, var(--pond) 68%, var(--pond-deep) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

/* ── Background pond scenery ─────────────────────────────────────────────── */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sun {
  position: absolute; top: 4%; right: 8%; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fff3b0, var(--sunny) 60%, var(--sun-deep));
  box-shadow: 0 0 0 14px rgba(255, 210, 63, .25), 0 0 60px rgba(255, 159, 28, .5);
  animation: bob 6s ease-in-out infinite;
}
.cloud {
  position: absolute; background: #fff; border-radius: 100px; opacity: .9;
  filter: drop-shadow(0 6px 0 rgba(180, 220, 235, .6));
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #fff; border-radius: 50%; }
.cloud--a { width: 120px; height: 34px; top: 10%; left: -140px; animation: drift 34s linear infinite; }
.cloud--a::before { width: 54px; height: 54px; top: -24px; left: 20px; }
.cloud--a::after  { width: 40px; height: 40px; top: -16px; left: 62px; }
.cloud--b { width: 90px; height: 26px; top: 20%; left: -160px; animation: drift 46s linear infinite 6s; transform: scale(.8); }
.cloud--b::before { width: 44px; height: 44px; top: -20px; left: 16px; }
.cloud--b::after  { width: 32px; height: 32px; top: -12px; left: 48px; }

.reeds { position: absolute; bottom: 0; width: 130px; height: 220px; opacity: .85;
  background:
    radial-gradient(6px 34px at 20px 40px, var(--leaf-dark) 60%, transparent 62%),
    radial-gradient(7px 40px at 44px 20px, #2f7a24 60%, transparent 62%),
    radial-gradient(6px 30px at 70px 50px, var(--leaf-dark) 60%, transparent 62%);
  background-repeat: no-repeat;
}
.reeds--left { left: -10px; }
.reeds--right { right: -10px; transform: scaleX(-1); }

.pad { position: absolute; width: 84px; opacity: .55; animation: bob 7s ease-in-out infinite; }
.pad--1 { top: 62%; left: 6%; width: 110px; animation-delay: -1s; }
.pad--2 { top: 78%; right: 10%; width: 70px; animation-delay: -3s; }
.pad--3 { top: 88%; left: 40%; width: 90px; animation-delay: -2s; opacity: .4; }

.bubbles { position: absolute; inset: 0; }
.bubbles span {
  position: absolute; bottom: -30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.9), rgba(255,255,255,.15));
  border: 1px solid rgba(255,255,255,.4);
  animation: rise linear infinite;
}

@keyframes bob   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes drift { to { transform: translateX(120vw); } }
@keyframes rise  { 0% { transform: translateY(0) scale(.6); opacity: 0; }
                   10% { opacity: .7; } 100% { transform: translateY(-102vh) scale(1); opacity: 0; } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  border: 3px solid var(--ink); border-radius: 999px; padding: 12px 20px;
  font-family: var(--font-fun); font-weight: 700; font-size: 1.02rem; color: var(--ink);
  background: var(--sunny); box-shadow: 0 5px 0 var(--ink); transition: transform .08s, box-shadow .08s;
  line-height: 1;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn--hop { background: var(--leaf); color: #123; }
.btn--add { background: var(--lily); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.15); font-size: 1.15rem; padding: 14px 26px; }
.btn--ghost { background: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.2); border-color: #fff; color: var(--ink); font-size: .95rem; }
.icon-btn { border: 2px solid var(--ink); background: #fff; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.18); transition: transform .1s, background .15s; }
.icon-btn:active { transform: translateY(2px); }
.icon-btn.on { background: var(--leaf); }

/* ── LOGIN ───────────────────────────────────────────────────────────────── */
.login { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); }
.login__card {
  width: min(480px, 100%); background: var(--cream); border: 4px solid var(--ink);
  border-radius: 34px; padding: 26px 22px 30px; box-shadow: var(--shadow-pop); text-align: center;
  animation: pop-in .5s cubic-bezier(.2,1.4,.4,1) both;
}
.wordmark { position: relative; display: inline-block; margin-top: 6px; line-height: .9; }
.wordmark__ivy  { display: block; font-family: var(--font-logo); font-size: clamp(2.8rem, 12vw, 4rem); color: var(--lily);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; transform: rotate(-4deg); }
.wordmark__pond { display: block; font-family: var(--font-logo); font-size: clamp(1.9rem, 8vw, 2.7rem); color: var(--leaf);
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; transform: rotate(2deg); margin-top: 2px; }
.wordmark__frog { position: absolute; width: 62px; right: -30px; top: -26px; animation: bob 4s ease-in-out infinite; }
.tagline { font-family: var(--font-fun); font-weight: 700; font-size: 1.15rem; color: var(--sun-deep); margin: 14px 0 4px; }
.login__prompt { font-family: var(--font-fun); font-weight: 700; font-size: 1.15rem; margin: 20px 0 12px; color: var(--ink); }

.personas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.persona {
  border: 3px solid var(--ink); background: #fff; border-radius: 20px; padding: 10px 6px 8px;
  display: grid; gap: 4px; justify-items: center; box-shadow: 0 4px 0 rgba(0,0,0,.18);
  transition: transform .1s, box-shadow .1s, background .15s;
}
.persona svg { width: 62px; height: 62px; }
.persona span { font-family: var(--font-fun); font-weight: 700; font-size: .92rem; }
.persona:hover { transform: translateY(-3px); }
.persona[aria-selected="true"] { background: var(--sunny); transform: translateY(-4px) scale(1.03); box-shadow: 0 8px 0 rgba(0,0,0,.2); }

.login__form { margin-top: 20px; animation: pop-in .3s ease both; }
.login__label { display: block; font-family: var(--font-fun); font-weight: 700; margin-bottom: 8px; }
.password-row { display: flex; gap: 8px; }
.password-row input { flex: 1; min-width: 0; }
input, textarea, select {
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 16px; padding: 12px 14px; background: #fff; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--sunny); outline-offset: 1px; }
.login__error { color: var(--lily-dark); font-weight: 700; min-height: 1.2em; margin: 10px 0 0; }

/* ── TOP BAR ─────────────────────────────────────────────────────────────── */
#app-view { position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255,253,243,.86); backdrop-filter: blur(8px); border-bottom: 4px solid var(--ink);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__frog { width: 44px; height: 44px; flex: none; animation: bob 4s ease-in-out infinite; }
.topbar__title { font-family: var(--font-logo); font-size: 1.25rem; color: var(--leaf); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; line-height: 1; }
.topbar__sub { font-family: var(--font-fun); font-weight: 600; font-size: .72rem; color: var(--ink-soft); }
.topbar__right { display: flex; align-items: center; gap: 8px; }
.badge { font-family: var(--font-fun); font-weight: 700; font-size: .78rem; background: var(--leaf); color: #123;
  border: 2px solid var(--ink); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.badge[data-role="admin"] { background: var(--lily); color: #fff; }
.badge[data-role="viewer"] { background: var(--sky-2); }

/* ── BOARD ───────────────────────────────────────────────────────────────── */
.board { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 16px 14px 60px; }
.board__actions { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; align-items: center; }
.btn--add { align-self: center; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; width: 100%; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; border: 3px solid var(--ink); background: #fff; border-radius: 999px; padding: 8px 14px;
  font-family: var(--font-fun); font-weight: 700; font-size: .9rem; box-shadow: 0 3px 0 rgba(0,0,0,.16);
  display: inline-flex; align-items: center; gap: 6px; transition: transform .1s;
}
.filter:active { transform: translateY(2px); }
.filter[aria-pressed="true"] { background: var(--leaf); color: #123; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

/* ── WISH CARD ───────────────────────────────────────────────────────────── */
.card {
  position: relative; background: var(--cream); border: 4px solid var(--ink); border-radius: var(--card-radius);
  box-shadow: var(--shadow-pop); overflow: hidden; display: flex; flex-direction: column;
  animation: pop-in .45s cubic-bezier(.2,1.3,.4,1) both;
}
.card:hover { animation: none; }
.card__imgwrap { position: relative; aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, #eafbcf, #eafbcf 12px, #dff3bf 12px, #dff3bf 24px); }
.card__img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.card__noimg { width: 100%; height: 100%; display: grid; place-items: center; }
.card__noimg svg { width: 84px; opacity: .9; }
.card__cat { position: absolute; top: 10px; left: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 999px;
  padding: 3px 10px; font-family: var(--font-fun); font-weight: 700; font-size: .74rem; box-shadow: 0 3px 0 rgba(0,0,0,.14); }
.card__price { position: absolute; bottom: 10px; right: 10px; background: var(--sunny); border: 3px solid var(--ink);
  border-radius: 999px; padding: 5px 12px; font-family: var(--font-fun); font-weight: 800; font-size: 1rem; box-shadow: 0 4px 0 rgba(0,0,0,.2); transform: rotate(-4deg); }
.card__secret { position: absolute; top: 10px; right: 10px; background: var(--lily-dark); color: #fff; border: 2px solid var(--ink);
  border-radius: 999px; padding: 3px 10px; font-family: var(--font-fun); font-weight: 700; font-size: .74rem; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.card.is-secret { box-shadow: var(--shadow-pop), inset 0 0 0 5px var(--lily); }

.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card__title { font-family: var(--font-fun); font-weight: 700; font-size: 1.12rem; line-height: 1.15; margin: 0; }
.card__stars { font-size: 1rem; letter-spacing: 1px; min-height: 1.1em; }
.card__stars .off { opacity: .25; }
/* Tappable stars right on the card — owners re-rank without opening the editor */
.card__stars--live { display: inline-flex; gap: 2px; letter-spacing: 0; margin: -2px 0; }
.starbtn { background: none; border: none; padding: 3px 4px; font-size: 1.35rem; line-height: 1; cursor: pointer;
  border-radius: 8px; transition: transform .1s; -webkit-tap-highlight-color: transparent; }
.starbtn:hover { transform: scale(1.18); }
.starbtn:active { transform: scale(.85); }
.starbtn:focus-visible { outline: 3px solid var(--sunny); outline-offset: 1px; }
.card__notes { background: #fff8dd; border: 2px dashed var(--sun-deep); border-radius: 12px; padding: 7px 10px;
  font-size: .88rem; font-weight: 600; color: var(--ink-soft); }
.card__notes b { color: var(--sun-deep); }
.card__buy { margin-top: auto; }
.card__buy a { display: block; text-align: center; text-decoration: none; }

.card__admin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { border: 2px solid var(--ink); border-radius: 999px; background: #fff; padding: 5px 10px; font-family: var(--font-fun);
  font-weight: 700; font-size: .78rem; box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.chip:active { transform: translateY(1px); }
.chip--danger { background: #ffe0e6; }

/* claim ribbon + button */
.card.is-claimed { box-shadow: var(--shadow-pop), inset 0 0 0 5px var(--leaf); }
.claim {
  display: flex; align-items: center; gap: 8px; border: 3px solid var(--ink); border-radius: 16px;
  padding: 8px 10px; font-family: var(--font-fun); font-weight: 700; font-size: .86rem;
}
.claim--open  { background: #fff; }
.claim--taken { background: #d8f6c6; }
.claim__frog { width: 26px; height: 26px; flex: none; }
.claim button { margin-left: auto; }

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty { text-align: center; color: var(--cream); padding: 40px 20px; }
.empty svg { width: 120px; animation: bob 4s ease-in-out infinite; }
.empty__title { font-family: var(--font-logo); font-size: 1.8rem; margin: 10px 0 4px; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.empty__msg { font-family: var(--font-fun); font-weight: 700; font-size: 1.05rem; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: end center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(15, 60, 45, .55); backdrop-filter: blur(3px); }
.modal__card {
  position: relative; z-index: 1; width: min(560px, 100%); max-height: 92dvh; overflow-y: auto;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 30px 30px 0 0; padding: 22px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-pop); animation: slide-up .3s cubic-bezier(.2,1.2,.4,1) both;
}
.modal__x { position: absolute; top: 14px; right: 14px; border: 3px solid var(--ink); background: #fff; border-radius: 50%;
  width: 38px; height: 38px; font-weight: 800; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.modal__title { font-family: var(--font-logo); color: var(--lily); font-size: 1.7rem; margin: 0 0 16px; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.field-label { display: block; font-family: var(--font-fun); font-weight: 700; margin: 12px 0 6px; }
.field-label .muted, .muted { color: var(--ink-soft); font-weight: 600; font-size: .85em; }
.fetch-status { min-height: 1.2em; font-weight: 700; margin: 8px 0 4px; }
.fetch-status.err { color: var(--lily-dark); }
.fetch-status.ok  { color: var(--leaf-dark); }
.linkish { background: none; border: none; color: var(--pond-deep); font-weight: 800; text-decoration: underline; padding: 6px 0; font-size: .95rem; }

.wish-form__preview { display: flex; gap: 12px; align-items: center; }
.wish-form__preview img { width: 84px; height: 84px; object-fit: contain; border: 3px solid var(--ink); border-radius: 14px; background: #fff; flex: none; }
.wish-form__preview img:not([src]), .wish-form__preview img[src=""] { display: none; }
.wish-form__imgfields { flex: 1; min-width: 0; }
.wish-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.price-input { display: flex; gap: 6px; }
.price-input select { width: 64px; flex: none; padding: 12px 6px; }
.wish-form__buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.star-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.star-pick button { border: 3px solid var(--ink); background: #fff; border-radius: 14px; width: 48px; height: 48px; font-size: 1.4rem; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.star-pick button[aria-checked="true"] { background: var(--sunny); }

/* Admin-only "hidden surprise" toggle in the add/edit form */
.secret-toggle {
  display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px;
  border: 3px dashed var(--lily-dark); border-radius: 16px; background: #fff2f6; cursor: pointer;
}
.secret-toggle input { width: 24px; height: 24px; flex: none; accent-color: var(--lily-dark); cursor: pointer; }
.secret-toggle__text { display: flex; flex-direction: column; gap: 2px; font-family: var(--font-fun); font-weight: 700; line-height: 1.25; }

/* ── Little frog dialog ──────────────────────────────────────────────────── */
.dialog__card {
  position: relative; z-index: 1; width: min(380px, 92%); background: var(--cream);
  border: 4px solid var(--ink); border-radius: 28px; padding: 30px 22px 22px; text-align: center;
  box-shadow: var(--shadow-pop); animation: pop-in .3s cubic-bezier(.2,1.3,.4,1) both;
}
.dialog__frog { width: 64px; position: absolute; top: -34px; left: 50%; transform: translateX(-50%); }
.dialog__title { font-family: var(--font-fun); font-weight: 800; font-size: 1.25rem; margin: 6px 0 8px; }
.dialog__msg { font-weight: 600; color: var(--ink-soft); margin: 0 0 14px; }
.dialog__input { text-align: center; margin-bottom: 4px; }
.dialog__buttons { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

/* ── TOAST + CONFETTI ────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(30px);
  background: var(--ink); color: #fff; font-family: var(--font-fun); font-weight: 700; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 40; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.confetti span { position: absolute; font-size: 1.4rem; will-change: transform; animation: fall 1.6s ease-in forwards; }
@keyframes fall { 0% { transform: translateY(-10vh) rotate(0); opacity: 1; } 100% { transform: translateY(110vh) rotate(540deg); opacity: 0; } }

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes pop-in  { 0% { transform: scale(.7) translateY(12px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes slide-up{ 0% { transform: translateY(40px); opacity: .4; } 100% { transform: translateY(0); opacity: 1; } }
.pupil { animation: blink 5s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.hop { animation: hop .5s ease; }
@keyframes hop { 0%,100% { transform: translateY(0); } 30% { transform: translateY(-16px) rotate(-6deg); } 60% { transform: translateY(0) rotate(4deg); } }

/* Desktop niceties */
@media (min-width: 720px) {
  .modal { place-items: center; }
  .modal__card { border-radius: 30px; }
  .board__actions { flex-direction: row; justify-content: space-between; align-items: center; }
  .filters { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
