/* ========== Swing By 🛝 — playful, kid-app styling ========== */
:root {
  --teal: #4ECDC4;
  --teal-dark: #2BAFA6;
  --coral: #FF6B6B;
  --sun: #FFD93D;
  --grass: #6BCB77;
  --sky: #EAF9F7;
  --ink: #2D3142;
  --ink-soft: #6b7280;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 6px 20px rgba(45, 49, 66, 0.10);
  font-size: 16px;
}

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

html, body { height: 100%; }

body {
  font-family: "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  background: var(--sky);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 217, 61, .25) 0 120px, transparent 121px),
    radial-gradient(circle at 90% 20%, rgba(78, 205, 196, .18) 0 150px, transparent 151px),
    radial-gradient(circle at 20% 95%, rgba(255, 107, 107, .12) 0 130px, transparent 131px);
  background-attachment: fixed;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- layout ---------- */
.view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
}
.center-view { justify-content: center; align-items: center; padding: 24px; }
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: var(--sky); max-width: none;
}
.overlay .topbar, .overlay .chat-inputbar { max-width: 520px; width: 100%; margin: 0 auto; }

.page {
  flex: 1;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 10px;
  background: linear-gradient(180deg, var(--sky) 75%, transparent);
}
.topbar-title {
  font-size: 1.35rem; font-weight: 800; flex: 1;
  display: flex; align-items: center; gap: 8px;
}
.topbar-logo { width: 34px; height: 34px; border-radius: 11px; flex: none; }
.topbar-spacer { width: 40px; }
.back-btn {
  width: 40px; height: 40px; border: none; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow);
  font-size: 1.2rem; font-weight: 800; color: var(--ink); cursor: pointer;
}
.avatar-btn {
  width: 44px; height: 44px; border: 3px solid var(--sun); border-radius: 50%;
  background: var(--card); font-size: 1.4rem; cursor: pointer; box-shadow: var(--shadow);
}

/* ---------- typography ---------- */
.app-title { font-size: 2.6rem; font-weight: 800; letter-spacing: .5px; }
.page-title { font-size: 1.9rem; font-weight: 800; }
.tagline { color: var(--ink-soft); margin: 8px 0 20px; font-size: 1.05rem; }
.subtitle { color: var(--ink-soft); margin-bottom: 8px; }
.section-title { font-size: 1.15rem; font-weight: 800; margin-top: 14px; }
.field-label { font-weight: 700; margin-top: 10px; font-size: 1rem; }
.note { color: var(--ink-soft); font-size: .85rem; }
.note.center { text-align: center; }

/* ---------- inputs & buttons ---------- */
.input {
  width: 100%; padding: 14px 16px;
  border: 3px solid #d7ece9; border-radius: var(--radius);
  background: var(--card); font: inherit; font-weight: 600; color: var(--ink);
  outline: none;
}
.input:focus { border-color: var(--teal); }
.code-input { text-transform: uppercase; letter-spacing: 4px; font-weight: 800; text-align: center; }

.btn {
  border: none; border-radius: var(--radius); cursor: pointer;
  font: inherit; font-weight: 800; padding: 13px 18px;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 5px 0 var(--teal-dark); }
.btn-primary:active { box-shadow: 0 2px 0 var(--teal-dark); }
.btn-big { font-size: 1.15rem; padding: 16px 20px; width: 100%; margin-top: 14px; }
.btn-ghost {
  background: var(--card); color: var(--ink);
  border: 3px dashed #cfe7e4;
}
.btn-ghost.danger { color: var(--coral); border-color: #ffd4d4; }
.btn.round { border-radius: 50%; width: 52px; height: 52px; padding: 0; font-size: 1.2rem; flex: none; }

/* ---------- sign in ---------- */
.signin-card {
  background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  padding: 36px 28px; text-align: center; width: 100%; max-width: 380px;
}
.logo-big { font-size: 4.5rem; line-height: 1; margin-bottom: 8px; }
.logo-big.small { font-size: 3rem; margin-top: 10px; }
.hero { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto 4px; }
.hero.small { max-width: 190px; margin: 6px auto 0; }

/* ---------- email auth + in-app browser warning ---------- */
.email-auth { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; text-align: left; }
.divider {
  display: flex; align-items: center; gap: 10px; color: var(--ink-soft);
  font-size: .85rem; font-weight: 700; margin-top: 6px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 3px; background: #e3f2f0; border-radius: 2px; }
.email-btns { display: flex; gap: 8px; }
.email-btns .btn { flex: 1; }
.inapp-warning {
  background: #fff6d9; border-radius: 14px; padding: 12px 14px;
  font-size: .9rem; font-weight: 600; color: #8a6d1a; text-align: left; margin-bottom: 12px;
}

/* ---------- big check-in CTA ---------- */
.cta-checkin {
  border: none; cursor: pointer; text-align: left;
  border-radius: 26px; padding: 20px 22px;
  background: linear-gradient(135deg, var(--sun), #ffb84d);
  box-shadow: 0 6px 0 #e0a52e, var(--shadow);
  display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-items: center;
  font: inherit; color: var(--ink);
  transition: transform .08s ease;
}
.cta-checkin:active { transform: scale(.97); }
.cta-emoji { font-size: 2.6rem; grid-row: span 2; }
.cta-text { font-size: 1.25rem; font-weight: 800; }
.cta-sub { font-size: .9rem; font-weight: 600; color: #7a5b13; }

/* ---------- cards / feed ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.form-card { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.form-card h3 { font-size: 1.05rem; }

#feed { display: flex; flex-direction: column; gap: 12px; }

.checkin-card { display: flex; flex-direction: column; gap: 8px; }
.checkin-head { display: flex; align-items: center; gap: 12px; }
.checkin-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background: var(--sky); border: 3px solid var(--teal);
  display: grid; place-items: center; font-size: 1.6rem;
}
.checkin-who { font-weight: 800; font-size: 1.05rem; }
.checkin-where { color: var(--teal-dark); font-weight: 700; }
.playdate-title { font-size: 1.15rem; }
.checkin-times { color: var(--ink-soft); font-size: .88rem; font-weight: 600; }
.checkin-groups { font-size: .8rem; color: var(--ink-soft); }
.omw-line {
  background: #fff6d9; border-radius: 14px; padding: 8px 12px;
  font-size: .9rem; font-weight: 700; color: #8a6d1a;
}
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions .btn { padding: 10px 14px; font-size: .92rem; flex: 1; white-space: nowrap; }
.btn-omw { background: var(--grass); color: #fff; box-shadow: 0 4px 0 #4da858; }
.btn-chat { background: var(--sky); color: var(--ink); }
.btn-map { background: var(--sky); color: var(--ink); text-decoration: none; text-align: center; }

.mine { border: 3px solid var(--sun); }
.mine .banner-title { font-weight: 800; font-size: 1.1rem; }

.empty-state {
  text-align: center; padding: 30px 16px; color: var(--ink-soft);
  background: rgba(255,255,255,.6); border-radius: var(--radius);
  font-weight: 600;
}
.empty-state .big { font-size: 2.6rem; display: block; margin-bottom: 6px; }

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 3px solid #d7ece9; background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font: inherit; font-weight: 700;
  cursor: pointer; font-size: .95rem;
}
.chip.selected { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- emoji grid ---------- */
.emoji-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.emoji-grid button {
  width: 48px; height: 48px; font-size: 1.5rem; cursor: pointer;
  border: 3px solid transparent; border-radius: 16px; background: var(--card);
  box-shadow: var(--shadow);
}
.emoji-grid.small button { width: 42px; height: 42px; font-size: 1.25rem; }
.emoji-grid button.selected { border-color: var(--coral); background: #fff1f1; }

/* ---------- kids list ---------- */
.kids-list { display: flex; flex-direction: column; gap: 8px; }
.kid-row { display: flex; gap: 8px; align-items: center; }
.kid-row .input { flex: 1; }
.kid-emoji-btn {
  width: 52px; height: 52px; flex: none; font-size: 1.5rem; cursor: pointer;
  border: 3px solid #d7ece9; border-radius: 16px; background: var(--card);
}
.kid-remove {
  width: 40px; height: 40px; flex: none; border: none; background: none;
  font-size: 1.1rem; cursor: pointer; color: var(--coral);
}

/* ---------- groups ---------- */
#groups-list { display: flex; flex-direction: column; gap: 12px; }
.group-card { display: flex; flex-direction: column; gap: 8px; }
.group-head { display: flex; align-items: center; gap: 10px; }
.group-emoji { font-size: 1.8rem; }
.group-name { font-weight: 800; font-size: 1.1rem; flex: 1; }
.group-members { color: var(--ink-soft); font-size: .9rem; font-weight: 600; }
.group-code-row { display: flex; align-items: center; gap: 8px; }
.group-code {
  background: var(--sky); border-radius: 12px; padding: 6px 14px;
  font-weight: 800; letter-spacing: 3px;
}

/* ---------- chat ---------- */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 520px; width: 100%; margin: 0 auto;
}
.msg { max-width: 82%; padding: 10px 14px; border-radius: 18px; background: var(--card); box-shadow: var(--shadow); }
.msg .msg-name { font-size: .75rem; font-weight: 800; color: var(--teal-dark); }
.msg.me { align-self: flex-end; background: var(--teal); color: #fff; }
.msg.me .msg-name { display: none; }
.msg.system {
  align-self: center; background: #fff6d9; color: #8a6d1a;
  font-weight: 700; font-size: .88rem; text-align: center;
}
.chat-inputbar {
  display: flex; gap: 8px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
}

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  max-width: 520px; margin: 0 auto;
  display: flex; justify-content: space-around;
  background: var(--card); border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 20px rgba(45,49,66,.12);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
.tab {
  border: none; background: none; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 1.3rem; color: var(--ink-soft); padding: 6px 18px; border-radius: 16px;
}
.tab span { font-size: .72rem; font-weight: 800; }
.tab.active { background: var(--sky); color: var(--ink); }

/* ---------- add-to-home-screen tip ---------- */
.a2hs { background: #fff6d9; }
.a2hs-row { display: flex; gap: 12px; align-items: flex-start; }
.a2hs-icon { font-size: 1.8rem; }
.a2hs-row > div { flex: 1; }

/* ---------- toasts ---------- */
#toasts {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 420px);
}
.toast {
  background: var(--ink); color: #fff; font-weight: 700;
  padding: 12px 18px; border-radius: 16px; box-shadow: var(--shadow);
  animation: toast-in .25s ease;
  text-align: center;
}
.toast.happy { background: var(--grass); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

@media (min-width: 560px) {
  body { background-color: #dff2ef; }
  .view { box-shadow: 0 0 40px rgba(45,49,66,.08); background: var(--sky); }
}
