:root {
  --ink: #1d1b26;
  --muted: #6b6878;
  --bg: #fff7e8;
  --card: #ffffff;
  --primary: #ff6b4a;
  --teal: #17b6a7;
  --yellow: #ffd23f;
  --purple: #6c4cf1;
  --error: #d62839;
  --error-bg: #ffe3e6;
  --success: #138a50;
  --success-bg: #ddf7e9;
  --info-bg: #eef0ff;
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Fredoka', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% 12%, #ffd23f66 0 110px, transparent 111px),
    radial-gradient(circle at 95% 28%, #17b6a74d 0 150px, transparent 151px),
    radial-gradient(circle at 14% 92%, #6c4cf133 0 130px, transparent 131px),
    radial-gradient(circle at 88% 90%, #ff6b4a33 0 90px, transparent 91px);
  background-attachment: fixed;
}

a { color: var(--purple); font-weight: 600; }

.page {
  flex: 1 0 auto; /* pushes the footer to the bottom on short pages */
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.page.wide { max-width: 640px; }

.brand img { display: block; width: min(280px, 78vw); height: auto; }

.card {
  width: 100%;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 28px 24px;
}

h1 { font-size: 1.8rem; line-height: 1.15; margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 1.3rem; margin: 0 0 8px; }
.subtitle { margin: 0 0 22px; color: var(--muted); }
.big-emoji { font-size: 3rem; line-height: 1; margin-bottom: 8px; }

.site-footer {
  padding: 20px 16px 24px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer span { margin: 0 6px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: 0.86rem; color: var(--muted); margin: 5px 0 0; }

input {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.15s;
}
input:focus { box-shadow: 0 0 0 4px var(--yellow); }
input[aria-invalid='true'] { border-color: var(--error); }
input:disabled { background: var(--success-bg); border-color: var(--success); color: var(--success); }

.field-error { color: var(--error); font-size: 0.88rem; margin: 6px 0 0; }
.field-error:empty { display: none; }

.form-error {
  background: var(--error-bg);
  border: 2px solid var(--error);
  color: var(--error);
  padding: 10px 12px;
  border-radius: 12px;
  margin: 0 0 16px;
  font-weight: 500;
}

.notice {
  background: var(--info-bg);
  border: 2px solid var(--purple);
  padding: 12px 14px;
  border-radius: 14px;
  margin: 0 0 18px;
}
.notice.success { background: var(--success-bg); border-color: var(--success); }
.notice.warning { background: #fff4cc; border-color: #d9a400; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 70px; }
.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
  padding: 6px 8px;
}

.checklist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 3px; font-size: 0.9rem; color: var(--muted); }
.checklist li::before { content: '○'; display: inline-block; width: 1.5em; font-weight: 700; }
.checklist li.met { color: var(--success); }
.checklist li.met::before { content: '✓'; }

.otp-input, .code-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.4em;
}
.code-input { letter-spacing: 0.2em; text-transform: uppercase; }
.verified-badge { color: var(--success); font-weight: 600; font-size: 0.9rem; margin: 6px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 13px 18px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: 4px 4px 0 var(--ink); }
.btn-teal { background: var(--teal); }
.btn-purple { background: var(--purple); }
.btn-white { background: #fff; color: var(--ink); }
.btn-small { width: auto; font-size: 0.95rem; padding: 8px 14px; box-shadow: 3px 3px 0 var(--ink); }

.btn-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--purple);
  text-decoration: underline;
  cursor: pointer;
}
.btn-link:disabled { color: var(--muted); text-decoration: none; cursor: default; }

.row-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: 0.95rem; }
.switch { text-align: center; margin: 18px 0 0; color: var(--muted); }

/* ---------- Landing ---------- */
.role-grid { display: grid; gap: 16px; }
.role-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.1s, box-shadow 0.1s;
}
.role-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.role-card.kid { background: var(--yellow); }
.role-card.parent { background: #c9f2ed; }
.role-card .emoji { font-size: 2.6rem; line-height: 1; }
.role-card strong { display: block; font-size: 1.25rem; }
.role-card span { color: #3d3a48; font-weight: 400; }

/* ---------- Start screen ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  animation: splash-out 0.45s ease-in 1.5s forwards;
}
.splash img { width: min(420px, 80vw); height: auto; animation: splash-logo 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.splash p { margin: 0; font-size: 1.2rem; font-weight: 600; color: var(--muted); animation: splash-fade 0.5s ease-out 0.5s both; }
.no-splash .splash { display: none; }
@keyframes splash-logo { from { opacity: 0; transform: scale(0.6) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes splash-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

.page.landing { max-width: 980px; align-items: stretch; gap: 36px; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; padding-top: 12px; }
.hero-logo { width: min(460px, 86vw); height: auto; }
.hero h1 { max-width: 720px; margin: 18px 0 10px; font-size: clamp(1.5rem, 4vw, 2.3rem); }
.hero .subtitle { max-width: 640px; font-size: 1.1rem; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 640px; text-align: left; }
#dashboard-actions { grid-template-columns: 1fr; max-width: 420px; }
.section-title { text-align: center; font-size: 1.6rem; margin: 0 0 18px; }
/* 6 columns: the safety card spans the row, then 3 cards, then the last 2 share a row. */
.feature-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.feature {
  grid-column: span 2;
  padding: 20px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 4px 4px 0 var(--ink);
}
.feature h3 { margin: 8px 0 6px; font-size: 1.15rem; }
.feature p { margin: 0; color: #3d3a48; font-size: 0.95rem; }
.feature-icon { font-size: 2.2rem; line-height: 1; }
.feature:nth-last-child(-n + 2) { grid-column: span 3; }
.feature.feature-safety { grid-column: 1 / -1; background: linear-gradient(90deg, #dff5f2, #fff 70%); }
.how-it-works h2 { margin-top: 0; }
.steps { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; font-size: 1.05rem; }
.steps li::marker { font-weight: 700; color: var(--primary); }

@media (max-width: 760px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature, .feature:nth-last-child(-n + 2), .feature.feature-safety { grid-column: auto; }
  .hero-actions { grid-template-columns: 1fr; }
}

/* ---------- Home ---------- */
.topbar { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .brand img { width: min(200px, 50vw); }

/* ---------- Parent dashboard ---------- */
.muted { color: var(--muted); margin: 0; }
.page.dashboard { max-width: 980px; align-items: stretch; }
.dashboard-body { display: flex; flex-direction: column; gap: 18px; }
.empty-state { text-align: center; }
.empty-state .btn { max-width: 280px; }

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 700;
  font-size: 1.1rem;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.9rem; border-width: 2px; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.8rem; border-width: 3px; background: var(--teal); color: #fff; }

.child-header { display: flex; align-items: center; gap: 16px; padding: 20px 22px; }
.child-header-text { flex: 1; min-width: 0; }
.child-header h1 { margin: 0; }
.child-header .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow { margin: 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.switcher { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10;
  min-width: 220px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 6px;
}
.menu hr { border: 0; border-top: 2px solid #eee; margin: 6px 0; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg); outline: none; }
.menu-item .check { margin-left: auto; color: var(--success); font-weight: 700; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  font: inherit;
  font-weight: 600;
  padding: 9px 18px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.tab[aria-selected='true'] { background: var(--ink); color: #fff; }
.tab:focus-visible { box-shadow: 0 0 0 4px var(--yellow); outline: none; }
.panel { display: flex; flex-direction: column; gap: 18px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
}
.stat:nth-child(1) { background: #fff4cc; }
.stat:nth-child(2) { background: #dff5f2; }
.stat:nth-child(3) { background: #ffe5de; }
.stat:nth-child(4) { background: var(--info-bg); }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: #3d3a48; font-size: 0.92rem; }

.friend-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.friend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 5px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  font-weight: 500;
}
.friend .avatar { width: 32px; height: 32px; font-size: 0.9rem; border-width: 2px; }

/* Chats: list + thread side by side; one at a time on phones. */
.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  padding: 0;
  overflow: hidden;
  min-height: 460px;
}
.chat-list { list-style: none; margin: 0; padding: 8px; border-right: 3px solid var(--ink); overflow-y: auto; max-height: 620px; }
.chat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 14px;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.chat-item:hover { background: var(--bg); }
.chat-item.active { background: #ffe5de; }
.chat-item:focus-visible { outline: 3px solid var(--yellow); }
.chat-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item-text strong, .chat-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-preview { font-size: 0.88rem; color: var(--muted); }
.chat-item time { flex: none; align-self: flex-start; font-size: 0.78rem; color: var(--muted); }

.thread { display: flex; flex-direction: column; min-width: 0; background: #fffdf8; }
.thread-placeholder { margin: auto; padding: 24px; }
.thread-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.thread-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 2px solid #eee; background: #fff; }
.thread-header h2 { margin: 0; font-size: 1.15rem; }
.thread-back { display: none; }
.read-only-note { margin: 0; padding: 8px 18px; font-size: 0.85rem; background: var(--info-bg); color: #3d3a48; }
.messages { flex: 1; overflow-y: auto; max-height: 520px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.load-older { align-self: center; margin-bottom: 6px; }
.message { display: flex; flex-direction: column; max-width: 75%; }
.message.from-other { align-self: flex-start; }
.message.from-child { align-self: flex-end; align-items: flex-end; }
.message .sender { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin: 0 0 2px 4px; }
.bubble {
  margin: 0;
  padding: 9px 14px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  background: #fff;
  overflow-wrap: anywhere;
}
.from-other .bubble { border-bottom-left-radius: 6px; }
.from-child .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.message time { font-size: 0.72rem; color: var(--muted); margin: 2px 6px 0; }

/* Requests */
.request-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.request { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid #eee; border-radius: 14px; }
.request-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.request-time { font-size: 0.82rem; }
.request-email { font-size: 0.88rem; color: #3d3a48; overflow-wrap: anywhere; }
.chip { flex: none; padding: 3px 12px; border: 2px solid var(--ink); border-radius: 999px; font-size: 0.82rem; font-weight: 600; }
.chip-pending { background: #fff4cc; }
.chip-accepted { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.chip-declined { background: #f1f0f4; color: var(--muted); border-color: #c9c6d3; }

.activity { margin: 4px 0 0; font-size: 0.88rem; font-weight: 500; color: var(--muted); }
.activity.is-active { color: var(--success); }
.activity.is-active::before { content: '●'; margin-right: 6px; }

.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
}

.request-actions { flex: none; display: flex; gap: 8px; }

/* Posts */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.post { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.post.is-hidden { background: #f7f6f9; }
.post.is-hidden .post-body { color: var(--muted); }
.post-header { display: flex; align-items: center; gap: 10px; width: 100%; }
.post-meta { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.post-meta .muted { font-size: 0.85rem; }
.post-body { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }

/* Screen time */
select {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}
select:focus { outline: none; box-shadow: 0 0 0 4px var(--yellow); }
.screen-time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.screen-time-grid .card { display: flex; flex-direction: column; }
.screen-time-grid h2 { margin-bottom: 4px; }
.hero-figure { margin: 4px 0 0; font-size: 3rem; font-weight: 600; line-height: 1.1; }
.meter {
  height: 14px;
  margin: 16px 0 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #e9e4ff;
  overflow: hidden;
}
.meter-fill { height: 100%; border-radius: 999px; background: var(--purple); transition: width 0.3s; }
.meter[data-level='near'] { background: #fff1c2; }
.meter[data-level='near'] .meter-fill { background: #d99a00; }
.meter[data-level='over'] { background: var(--error-bg); }
.meter[data-level='over'] .meter-fill { background: var(--error); }
.meter-status { margin: 0; font-weight: 500; }
.saved-note { margin: 12px 0 0; padding: 8px 12px; }
#limit-form .btn { margin-top: auto; }
#limit-form > .muted { margin-bottom: 14px; }

.usage-chart { position: relative; margin-top: 12px; min-height: 220px; }
.usage-svg { display: block; overflow: visible; font-family: inherit; }
.usage-svg .grid { stroke: #ecebef; stroke-width: 1; }
.usage-svg .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.usage-svg .tick-strong { fill: var(--ink); font-weight: 600; }
.usage-svg .column { fill: var(--purple); transition: opacity 0.15s; }
.usage-svg .hit { fill: transparent; }
.usage-svg .bar { cursor: default; outline: none; }
.usage-svg .bar.active .column { opacity: 0.75; }
.usage-svg .bar:focus-visible .hit { fill: rgb(108 76 241 / 0.08); }
.usage-svg .value-label { fill: var(--ink); font-size: 13px; font-weight: 600; }
.usage-svg .limit-line { stroke: var(--ink); stroke-width: 1.5; }
.usage-svg .limit-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 600;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}
.chart-tooltip {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  font-size: 0.85rem;
  white-space: nowrap;
  pointer-events: none;
}
.chart-tooltip strong { font-size: 1rem; }
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.table-view table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 0.95rem; }
.table-view th, .table-view td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #eee; }
.table-view td:last-child, .table-view th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Safety check */
.safety-note { margin: 0; }
.safety-card { border-color: var(--ink); background: linear-gradient(180deg, #f1fbf9 0%, #fff 55%); }
.safety-head { display: flex; gap: 14px; align-items: flex-start; }
.safety-head h2 { margin: 0 0 4px; }
.safety-icon { font-size: 2.2rem; line-height: 1; }
.safety-rules { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.safety-rules li { padding: 8px 12px; background: #fff; border: 2px solid #e3efec; border-radius: 12px; }
.safety-mode { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.safety-stats { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.safety-stats > div { display: flex; flex-direction: column; }
.safety-card h3 { margin: 18px 0 8px; font-size: 1.05rem; }
.blocked-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.blocked-item { padding: 12px 14px; border: 2px solid #f3d4d8; border-radius: 14px; background: #fff8f9; }
.blocked-who { margin: 0; }
.blocked-text {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 4px solid #e8b4bb;
  color: #3d3a48;
  overflow-wrap: anywhere;
}
.blocked-reason { margin: 0; font-size: 0.9rem; font-weight: 600; color: var(--error); }
.blocked-more { margin-top: 12px; }

/* Kid dashboard */
.linked-tick { color: var(--success); font-weight: 600; font-size: 0.9rem; }
.child-header .screen-time-pill { margin: 0; flex: none; }
.panel-actions { display: flex; justify-content: flex-end; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; min-width: 0; }
.inline-form .btn { flex: none; }
.hero-figure.small { font-size: 2rem; }
.thread-empty { margin: auto; }

.composer { border-top: 2px solid #eee; background: #fff; padding: 10px 14px 8px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea, .post-composer textarea {
  flex: 1;
  width: 100%;
  font: inherit;
  padding: 10px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  resize: none;
  outline: none;
}
.composer textarea:focus, .post-composer textarea:focus { box-shadow: 0 0 0 4px var(--yellow); }
.composer-warning {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--error-bg);
  color: var(--error);
  font-weight: 500;
}
.composer-hint { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }
.post-composer h2 { margin-top: 0; }
.post-composer .field { margin-bottom: 10px; }
.post-composer-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.post-composer-row .composer-hint { margin: 0; }

.friend-picker { border: 0; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; max-height: 280px; overflow-y: auto; }
.friend-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border: 2px solid #eee;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
}
.friend-option:has(input:checked) { border-color: var(--teal); background: #eefaf8; }
.friend-option input { width: 20px; height: 20px; accent-color: var(--teal); }

/* Kid screen time */
.screen-time-pill {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--info-bg);
  font-size: 0.9rem;
  font-weight: 600;
}
body.locked { overflow: hidden; }
.times-up {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--bg);
}
.times-up .card { max-width: 440px; text-align: center; }

/* Add-child dialog */
.dialog { max-width: 440px; width: calc(100% - 32px); color: var(--ink); }
.dialog::backdrop { background: rgb(29 27 38 / 0.45); }
.dialog h2 { margin-top: 0; }
.dialog .muted { margin-bottom: 16px; }
.dialog-actions { display: flex; gap: 12px; }

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .screen-time-grid { grid-template-columns: 1fr; }
  /* Tabs scroll sideways instead of wrapping onto several lines. */
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .tab { flex: none; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-list { border-right: 0; max-height: none; }
  .chat-layout .thread { display: none; }
  .chat-layout.showing-thread .chat-list { display: none; }
  .chat-layout.showing-thread .thread { display: flex; }
  .thread-back { display: inline; }
  .message { max-width: 88%; }
}

@media (max-width: 480px) {
  .child-header { flex-wrap: wrap; }
  .avatar-lg { width: 52px; height: 52px; font-size: 1.4rem; }
  .switcher { width: 100%; }
  .switcher .btn { width: 100%; }
  .menu { left: 0; right: 0; }
  .inline-form { flex-direction: column; }
  .child-header .screen-time-pill { width: 100%; text-align: center; }
  .request { flex-wrap: wrap; }
  .request-actions { width: 100%; padding-left: 54px; }
  .hero-figure { font-size: 2.4rem; }
}

@media (max-width: 400px) {
  .card { padding: 22px 16px; }
  h1 { font-size: 1.5rem; }
}
