/* The family page editor: the email sign-in card, child cards with a live
   cartoon, chunky look pickers, the sticky Save bar, the family link box,
   privacy and the confirm dialog.
   Loads after hub/hub.css and hub/pages.css. */

[hidden] { display: none !important; }

/* Big messages: loading, gone, couldn't reach, goodbye. */
.state { text-align: center; padding-top: 34px; }
.state-emoji { font-size: 64px; line-height: 1; margin: 6px 0 4px; }
.state h2 { font-size: 30px; }
.state p { max-width: 560px; margin-left: auto; margin-right: auto; }
.state .actions { justify-content: center; margin-top: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.intro p { margin: 0 0 10px; }

/* ---------- child cards ---------- */

.kid-card { padding-top: 22px; }
.kc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.kc-title { margin: 0 !important; font-size: 24px !important; }
.kc-remove { font-size: 16px; }

.kc-body { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.kc-left { position: sticky; top: 12px; }

/* The cartoon on a soft round stage. */
.kc-stage {
  display: flex; justify-content: center; align-items: flex-end;
  height: 250px; padding: 16px 0 10px; border-radius: 26px;
  background: radial-gradient(circle at 50% 42%, #fff 0 38%, #ffeef6 39% 60%, #fff3e2 61%);
  border: 3px solid var(--line);
}
.kc-stage .kid { position: static; width: auto; height: 100%; animation: none; overflow: visible; }
.kc-stage .kid-wave-l { animation: kidWaveL 0.42s ease-in-out infinite alternate; }
.kc-stage .kid-wave-r { animation: kidWaveR 0.42s ease-in-out -0.2s infinite alternate; }
.kc-stage .kid-body, .kc-stage .kid-shadow { animation-delay: calc(var(--k, 0) * -0.3s); }
.kc-stage .kid-head { animation-delay: calc(var(--k, 0) * -0.6s); }
.kc-stage .kid-eyes { animation-delay: calc(var(--k, 0) * 0.9s); }
.kc-stage.pop .kid { animation: kidPop 0.38s cubic-bezier(0.2, 1.8, 0.4, 1); }
@keyframes kidPop { from { transform: scale(0.88); } to { transform: none; } }

.kc-name { margin: 14px 0 6px; }
.kc-name .input { font-size: 22px; font-weight: 700; }
.input.bad { border-color: var(--red); background: #fff6f6; }
.hint.bad { color: var(--red-d); }
.hint.good { color: var(--green-d); }

/* Name approval chip. */
.chip { display: inline-block; margin: 8px 0 0; padding: 6px 14px; border-radius: 999px; font-size: 16px !important; line-height: 1.3 !important; font-weight: 700; }
.chip.ok { background: #e3f8e8; color: var(--green-d); }
.chip.wait { background: #fff3c4; color: #8a6a00; }
.chip.no { background: #ffe3e3; color: var(--red-d); border-radius: 16px; }
.chip.new { background: #eef1f7; color: var(--ink-soft); }

/* Look pickers. */
.pick { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.pick legend { padding: 0; margin: 0 0 8px; font-size: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 9px; }

.sw {
  width: 46px; height: 46px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--sw); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--line-d), 0 4px 0 var(--line-d);
  transition: transform 0.12s, box-shadow 0.12s;
}
.sw[aria-pressed="true"] { transform: scale(1.12); box-shadow: 0 0 0 4px var(--ink), 0 5px 0 rgba(61, 44, 85, 0.35); }

.sw-icon {
  width: 62px; height: 62px; padding: 3px; border-radius: 18px; cursor: pointer;
  background: #fff; border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line-d);
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.sw-icon svg { width: 100%; height: 100%; display: block; }
.sw-icon[aria-pressed="true"] { border-color: var(--green); background: #f0fbf2; box-shadow: 0 4px 0 var(--green-d); transform: translateY(-2px); }
.sw:active, .sw-icon:active { transform: translateY(3px); }
.sw:focus-visible, .sw-icon:focus-visible { outline: 4px solid rgba(77, 171, 247, 0.8); outline-offset: 3px; }

.add-kid {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 10px;
  min-height: 76px; margin: 0 0 22px; border-radius: 28px; cursor: pointer;
  border: 4px dashed #d9c6ae; background: rgba(255, 250, 242, 0.7); color: var(--ink);
  font: 700 22px var(--font);
}
.add-kid:hover { background: var(--paper); border-color: var(--green); }
.add-kid:active { transform: translateY(2px); }

/* ---------- sticky Save bar ---------- */

.save-bar {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 0 26px; padding: 12px 12px 12px 22px; border-radius: 26px;
  background: var(--paper); box-shadow: 0 10px 30px rgba(61, 44, 85, 0.22); border: 3px solid var(--line);
}
.save-bar.is-dirty { border-color: var(--yellow); }
.save-bar.flash { animation: savedFlash 0.7s ease; }
@keyframes savedFlash { 40% { transform: scale(1.03); background: #e9fbe9; } }
.save-msg { margin: 0; font-size: 18px; color: var(--ink-soft); }
.save-msg.pending { color: #8a6a00; }
.save-msg.saved { color: var(--green-d); font-weight: 700; }
.save-msg.bad { color: var(--red-d); }
.save-bar .btn { flex: none; min-width: 150px; }

/* ---------- links ---------- */

.link-box { padding: 16px 18px; margin: 0 0 14px; border-radius: 22px; background: #fff; border: 3px solid var(--line); }
.link-box h3 { margin: 0 0 4px; font-size: 21px; }
.link-box p { margin: 0 0 10px; font-size: 17px !important; line-height: 1.45 !important; }
.link-box.secret { background: #fff8e0; border-color: #f5dc8a; }
.url {
  margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: #f7f2ea;
  font: 600 16px/1.4 ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace; color: var(--ink);
  overflow-wrap: anywhere; user-select: all;
}
.link-box .hint { margin-top: 10px; color: var(--green-d); }
.link-box .hint:empty { display: none; }
.small-note { margin: 4px 2px 6px; font-size: 16px !important; line-height: 1.45 !important; }
.signout { margin: 6px 0 0; text-align: right; }
.linkish {
  padding: 4px 2px; border: 0; background: none; cursor: pointer;
  font: 600 16px var(--font); color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px;
}
.linkish:hover { color: var(--ink); }
.linkish:focus-visible { outline: 3px solid rgba(77, 171, 247, 0.8); outline-offset: 2px; border-radius: 6px; }

/* ---------- sign in by email ---------- */

.signin { max-width: 620px; margin-left: auto; margin-right: auto; text-align: center; padding-top: 30px; }
.signin h2 { font-size: 30px; }
.signin form, .signin-sent { text-align: left; }
.signin form .muted { margin: 0 0 16px; }
.signin .field .input { font-size: 20px; }
.signin form .btn { width: 100%; }
.signin-note { margin: 0 0 16px; padding: 12px 16px; border-radius: 16px; background: #fff3c4; color: #7a5d00; font-size: 17px !important; text-align: left; }
.signin-error { margin: -6px 0 14px; padding: 10px 14px; border-radius: 14px; background: #ffe3e3; color: var(--red-d); font-size: 17px !important; }
.signin-sent { padding: 18px 20px; border-radius: 22px; background: #eefaf0; border: 3px solid #bfe8ca; }
.sent-msg { margin: 0 0 10px; font-size: 20px !important; font-weight: 700; color: var(--green-d); }
.signin-sent::before { content: '📬'; display: block; font-size: 44px; line-height: 1; margin: 0 0 8px; }
.signin-sent ul { margin: 0 0 14px; padding-left: 22px; }
.signin-sent li { font-size: 17px; }
.dev-link { margin: 0 0 14px; font-size: 16px !important; }
.dev-link a { font-weight: 700; color: var(--purple-d, #6b3fb5); }
.signin-foot { margin: 22px 0 0; font-size: 16px !important; }
.signin-foot a { font-weight: 700; white-space: nowrap; }

.privacy ul { margin: 0 0 18px; padding-left: 22px; }
.privacy li { font-size: 18px; }

/* ---------- confirm dialog ---------- */

.ask { width: min(460px, calc(100vw - 32px)); padding: 26px 24px 24px; border: 0; border-radius: 28px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); text-align: center; font-family: var(--font); }
.ask::backdrop { background: rgba(61, 44, 85, 0.45); }
.ask-emoji { font-size: 52px; line-height: 1; }
.ask h2 { margin: 10px 0 8px; font-size: 26px; }
.ask p { margin: 0 0 20px; font-size: 18px; line-height: 1.5; font-weight: 600; }
.ask .actions { justify-content: center; }

/* ---------- smaller screens ---------- */

@media (max-width: 760px) {
  .kc-body { grid-template-columns: 1fr; gap: 14px; }
  .kc-left { position: static; }
  .kc-stage { height: 210px; }
}

@media (max-width: 480px) {
  .card { padding: 22px 16px 18px; }
  .card h2 { font-size: 23px; }
  .card p, .card li { font-size: 17px; }
  .kc-stage { height: 190px; }
  .swatches { gap: 6px; }
  .sw { width: 35px; height: 35px; border-width: 3px; }
  .sw[aria-pressed="true"] { transform: scale(1.08); box-shadow: 0 0 0 3px var(--ink), 0 4px 0 rgba(61, 44, 85, 0.35); }
  .sw-icon { width: 56px; height: 56px; border-radius: 16px; }
  .save-bar { padding: 10px 10px 10px 16px; }
  .save-msg { font-size: 16px; }
  .save-bar .btn { min-width: 0; padding: 0 20px; }
  .link-box { padding: 14px; }
  .link-box .actions .btn { flex: 1 1 auto; }
  .privacy .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .sw, .sw-icon { transition: none; }
}
.ask .btn:focus-visible { outline: 4px solid rgba(77, 171, 247, 0.8); outline-offset: 3px; }
.ask .btn:focus:not(:focus-visible) { outline: none; }

/* Hidden bits stay hidden even where a rule sets display. */
.signin [hidden], li[hidden] { display: none !important; }
