/* Family Radio — warm, simple, large touch targets · Age 4+ feel */
:root {
  --bg: #F5E6D3;
  --bg-card: #FFFBF5;
  --ink: #2C1810;
  --ink-soft: #6B4F3A;
  --muted: #9A7B63;
  --accent: #E07A3D;
  --accent-deep: #C45A1E;
  --accent-soft: #F4C9A8;
  --listening: #3D8B6E;
  --recording: #D64545;
  --uploading: #C9A227;
  --danger: #B33A3A;
  --border: rgba(44, 24, 16, 0.10);
  --shadow: 0 8px 28px rgba(44, 24, 16, 0.10);
  --radius: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 64px;
  --banner-h: 28px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
a { color: var(--accent-deep); }
[hidden] { display: none !important; }

.prototype-banner {
  position: sticky; top: 0; z-index: 100;
  height: var(--banner-h);
  display: flex; align-items: center; justify-content: center;
  background: #2C1810; color: #F5E6D3;
  font-size: 11px; letter-spacing: 0.02em;
  padding-top: var(--safe-t);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--banner-h));
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px);
  position: relative;
}

.screen { padding: 16px 20px 24px; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Welcome */
.welcome-hero {
  text-align: center;
  padding: 48px 12px 32px;
}
.logo-mark {
  width: 88px; height: 88px; margin: 0 auto 16px;
  border-radius: 28px;
  background: linear-gradient(145deg, #FFE8D0, #F4C9A8);
  display: grid; place-items: center;
  font-size: 44px;
  box-shadow: var(--shadow);
}
.welcome-hero h1 {
  font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px;
}
.subtitle { margin: 0; font-size: 18px; color: var(--ink-soft); font-weight: 600; }
.tagline { margin: 8px 0 0; font-size: 16px; color: var(--accent-deep); font-weight: 600; }
.honest {
  margin: 20px auto 0; max-width: 280px;
  font-size: 14px; color: var(--muted); line-height: 1.4;
}
.welcome-actions { padding: 0 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px;
  border-radius: 16px; font-weight: 700; font-size: 16px;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(224,122,61,0.35); }
.btn-primary:active { background: var(--accent-deep); }
.btn-secondary { background: var(--bg-card); border: 1.5px solid var(--border); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-soft); min-height: 44px; }
.btn-danger { background: #FCE8E8; color: var(--danger); font-weight: 700; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep); }
.btn-apple {
  width: 100%;
  background: #000; color: #fff;
  border-radius: 14px; min-height: 54px; font-size: 17px;
}
.apple-logo::before { content: ""; display: inline-block; width: 18px; height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 17'%3E%3Cpath fill='%23fff' d='M13.1 5.8c-.1.1-1.7 1-1.7 3 0 2.3 2 3.1 2.1 3.2-.1.2-.3.9-.7 1.7-.4.8-.8 1.6-1.5 1.6-.7 0-.9-.4-1.7-.4s-1 .4-1.7.4c-.7 0-1.1-.7-1.5-1.5C5.5 12 4.7 9.3 4.7 6.8c0-2.4 1.6-3.7 3.1-3.7.8 0 1.5.5 2 .5s1.3-.6 2.2-.6c.4 0 1.7.1 2.6 1.4-.1 0-.4.2-.5.4zM9.5 2.5c.4-.5.7-1.2.6-1.9-.6 0-1.3.4-1.7.9-.4.4-.7 1.1-.6 1.8.7.1 1.3-.3 1.7-.8z'/%3E%3C/svg%3E") center/contain no-repeat;
  vertical-align: -4px; margin-right: 4px;
}

.proto-note {
  font-size: 12px; color: var(--muted); line-height: 1.45; margin: 12px 0 0;
}
.proto-note.center { text-align: center; }

.screen-header { margin-bottom: 18px; }
.screen-header h1 { margin: 0 0 4px; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.muted.small, .small { font-size: 13px; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 4px;
}
.section-label {
  font-size: 14px; font-weight: 700; color: var(--ink-soft);
  margin: 22px 0 10px; text-transform: uppercase; letter-spacing: 0.04em;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-stack { display: flex; flex-direction: column; gap: 16px; }
.stack-gap { display: flex; flex-direction: column; gap: 14px; }
.divider {
  display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 600;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field input {
  min-height: 48px; padding: 10px 14px;
  border-radius: 12px; border: 1.5px solid var(--border);
  background: #fff; font-size: 17px; color: var(--ink);
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.field.inline { flex-direction: row; align-items: center; gap: 10px; flex: 1; }
.field.inline input { flex: 1; min-width: 0; }
.code-input {
  letter-spacing: 0.28em; text-transform: uppercase; font-weight: 800;
  text-align: center; font-size: 22px !important;
}

/* Radio home */
.screen-radio { padding-bottom: 8px; }
.radio-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.radio-title { margin: 0; font-size: 26px; font-weight: 800; }
.status-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill {
  font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 999px;
  background: #E8F0EC; color: var(--listening);
}
.pill-mute { background: #FCE8E8; color: var(--danger); }

.ptt-stage {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 0 18px;
}
.ptt-state {
  margin: 0; font-size: 20px; font-weight: 800;
  color: var(--listening);
}
.ptt-state.recording { color: var(--recording); }
.ptt-state.uploading { color: var(--uploading); }
.ptt-hint {
  margin: 6px 0 28px; font-size: 13px; color: var(--muted); text-align: center;
  max-width: 260px; line-height: 1.35;
}

.ptt-btn {
  position: relative;
  width: min(72vw, 260px); height: min(72vw, 260px);
  border-radius: 50%;
  padding: 0;
  touch-action: none;
}
.ptt-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFE8D0, var(--accent-soft) 55%, var(--accent) 100%);
  box-shadow: 0 12px 40px rgba(224,122,61,0.35), inset 0 -6px 18px rgba(44,24,16,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ptt-btn:active .ptt-ring,
.ptt-btn.holding .ptt-ring {
  transform: scale(0.96);
  box-shadow: 0 6px 24px rgba(212,69,69,0.45), inset 0 -4px 14px rgba(44,24,16,0.12);
  background: radial-gradient(circle at 35% 30%, #FFD0D0, #F4A0A0 50%, var(--recording) 100%);
}
.ptt-inner {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.ptt-icon { font-size: 48px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12)); }
.ptt-label { font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.15); }

.ptt-timer {
  margin-top: 22px; width: min(72vw, 260px); text-align: center;
}
.ptt-timer-bar {
  height: 6px; border-radius: 999px; background: rgba(44,24,16,0.08); overflow: hidden;
}
#ptt-timer-fill {
  height: 100%; width: 0%; background: var(--recording); border-radius: 999px;
  transition: width 0.1s linear;
}
#ptt-timer-text {
  display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.last-drop {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
}
.last-drop-text { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.home-actions { margin-top: 18px; }

/* Tape */
.replay-bar { margin-bottom: 14px; }
.tape-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tape-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border-radius: 16px; padding: 14px;
  border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(44,24,16,0.05);
}
.tape-item.played { opacity: 0.72; }
.tape-avatar {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 20px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}
.tape-meta { flex: 1; min-width: 0; }
.tape-sender { margin: 0; font-weight: 800; font-size: 16px; }
.tape-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.tape-play {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 700;
  flex-shrink: 0; display: grid; place-items: center;
}
.tape-play.playing { background: var(--listening); }
.empty-state {
  text-align: center; color: var(--muted); padding: 40px 20px; font-size: 15px; line-height: 1.45;
}

/* Family */
.invite-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite-code {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.member-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card); border-radius: 14px; padding: 12px 14px;
  border: 1px solid var(--border);
}
.member-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 16px;
}
.member-name { margin: 0; font-weight: 700; }
.member-role { margin: 0; font-size: 12px; color: var(--muted); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-title { margin: 0; font-weight: 700; font-size: 16px; }
.quiet-times { display: flex; gap: 12px; }
.mute-row { display: flex; flex-direction: column; gap: 10px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: #F0E4D6; color: var(--ink-soft); min-height: 40px;
}
.chip.active { background: var(--accent); color: #fff; }
.chip-clear { background: transparent; border: 1.5px solid var(--border); }

.toggle { position: relative; width: 52px; height: 32px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-ui {
  position: absolute; inset: 0; border-radius: 999px; background: #D8C8B8;
  transition: background 0.2s;
}
.toggle-ui::after {
  content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-ui { background: var(--listening); }
.toggle input:checked + .toggle-ui::after { transform: translateX(20px); }

.link { display: block; font-weight: 600; padding: 4px 0; text-decoration: none; }

/* Tab bar */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 480px; margin: 0 auto;
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,251,245,0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700; color: var(--muted); min-height: 48px; border-radius: 12px;
}
.tab.active { color: var(--accent-deep); background: rgba(224,122,61,0.10); }
.tab-icon { font-size: 20px; line-height: 1; }

/* Incoming banner (fake lock-screen) */
.incoming-banner {
  position: fixed; left: 12px; right: 12px; top: calc(var(--banner-h) + 10px + var(--safe-t));
  z-index: 200; max-width: 456px; margin: 0 auto;
  animation: slideDown 0.35s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-24px); }
  to { opacity: 1; transform: none; }
}
.incoming-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,251,245,0.96);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 18px; padding: 12px 14px;
  box-shadow: 0 12px 40px rgba(44,24,16,0.22);
  border: 1px solid var(--border);
}
.incoming-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-soft); display: grid; place-items: center; font-size: 22px;
}
.incoming-body { flex: 1; min-width: 0; }
.incoming-app { margin: 0; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.incoming-title { margin: 2px 0 0; font-size: 15px; font-weight: 800; }
.incoming-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.incoming-play {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
}
.incoming-dismiss {
  width: 32px; height: 32px; border-radius: 50%; color: var(--muted); font-size: 14px;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; z-index: 300;
  max-width: calc(100% - 40px); text-align: center;
  box-shadow: var(--shadow);
  animation: fadeIn 0.2s ease;
}

/* Simple pages */
.simple-page { max-width: 560px; margin: 0 auto; padding: 24px 20px 48px; }
.simple-page h1 { font-size: 28px; margin: 0 0 12px; }
.simple-page p, .simple-page li { color: var(--ink-soft); line-height: 1.55; }
.simple-page a.back { display: inline-block; margin-bottom: 16px; font-weight: 700; text-decoration: none; color: var(--accent-deep); }
