/* Our Friendly Neighbourhood
   ==========================
   Ported from the design canvas. Every colour, radius, border width, shadow
   offset and animation curve below is carried over from that file unchanged —
   the design's inline styles became classes, and its `mob` (viewport <= 760px)
   conditionals became the media query at the bottom. Nothing was
   "cleaned up" on the way through, because the chunkiness is the point. */

/* --- foundations -------------------------------------------------------- */

:root {
  --cream: #FFF6E9;
  --paper: #FFFDF8;
  --sand: #FFF0DA;
  --ink: #3B2A20;
  --ink-soft: #6B5341;
  --ink-faint: #A98A63;
  --ink-fainter: #BBA68A;
  --rule: #F0D9B5;
  --rule-soft: #F5E6CD;
  --rule-hard: #E9D3B0;

  --orange: #FF6B4A;
  --orange-dark: #C4441F;
  --blue: #3B8FD4;
  --blue-dark: #2A6EA8;
  --purple: #9B6BD6;
  --purple-dark: #7A4FB5;
  --green: #5CB85C;
  --green-dark: #4A9E4A;
  --yellow: #FFC93C;
  --yellow-dark: #E0A400;
  --tan: #D8C6AE;
  --tan-dark: #A98A63;

  --accent: #FF6B4A;
  --accent-dark: #C4441F;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  font-family: Nunito, system-ui, sans-serif;
  color: var(--ink);
}

a { color: #E0562F; text-decoration: none; }
a:hover { color: #B93D1B; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb {
  background: var(--rule-hard);
  border: 3px solid var(--cream);
  border-radius: 99px;
}

@keyframes ofnBob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}
@keyframes ofnWiggle {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
@keyframes ofnPop {
  0% { transform: scale(0.86) translateY(6px); opacity: 0; }
  60% { transform: scale(1.04) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes ofnDot {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}
@keyframes ofnDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes ofnFade { from { opacity: 0; } to { opacity: 1; } }

/* Everything animated here is decorative. Anyone who has asked their system
   to calm down gets a still page rather than a bobbing one. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.page {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 12% -10%, #FFE7B8 0%, rgba(255,231,184,0) 60%),
    radial-gradient(900px 500px at 95% 5%, #CFE9FF 0%, rgba(207,233,255,0) 55%),
    var(--cream);
}

.hidden { display: none !important; }

/* Visible only to screen readers — used for the live region that announces
   new messages, so the chat is followable without sight. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  font-family: Fredoka, sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.btn:focus-visible,
.chip-btn:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blue-dark);
  outline-offset: 2px;
}

.btn-big {
  font-size: 20px;
  padding: 16px 30px;
  border-radius: 20px;
  border: 4px solid var(--orange-dark);
  background: var(--orange);
  color: var(--cream);
  box-shadow: 0 7px 0 var(--orange-dark);
}
.btn-big:hover { transform: translateY(-4px) rotate(-1.5deg); box-shadow: 0 11px 0 var(--orange-dark); }
.btn-big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--orange-dark); }

.btn-big-alt {
  font-size: 20px;
  padding: 16px 30px;
  border-radius: 20px;
  border: 4px solid var(--tan-dark);
  background: var(--cream);
  color: var(--ink-soft);
  box-shadow: 0 7px 0 var(--tan-dark);
}
.btn-big-alt:hover { transform: translateY(-4px) rotate(1.5deg); box-shadow: 0 11px 0 var(--tan-dark); }
.btn-big-alt:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--tan-dark); }

/* --- header ------------------------------------------------------------- */

.header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px;
  background: rgba(255,246,233,0.94);
  backdrop-filter: blur(8px);
  border-bottom: 4px dotted var(--rule);
}

.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 16px;
  background: var(--blue); border: 3px solid var(--blue-dark);
  box-shadow: 0 4px 0 var(--blue-dark);
  display: grid; place-items: center;
  font-family: Fredoka, sans-serif; font-weight: 700; font-size: 22px;
  color: var(--cream);
  animation: ofnWiggle 2.4s ease-in-out infinite;
}
.brand-title { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 19px; line-height: 1.05; letter-spacing: -0.2px; }
.brand-sub { font-size: 12px; font-weight: 700; color: var(--ink-faint); letter-spacing: 1.4px; text-transform: uppercase; }

.nav { display: flex; gap: 8px; margin-left: auto; }
.tab {
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 16px;
  padding: 10px 20px; border-radius: 16px; cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  border: 3px solid var(--rule);
  background: var(--paper); color: #8A6C4E;
  box-shadow: 0 5px 0 var(--rule);
}
.tab:hover { transform: translateY(-3px) rotate(-1.5deg); }
.tab.on {
  border-color: var(--blue-dark); background: var(--blue);
  color: var(--cream); box-shadow: 0 5px 0 var(--blue-dark);
}

.user-chip {
  display: flex; align-items: center; gap: 10px; margin-left: auto;
  cursor: pointer; background: none; border: 0;
  padding: 0 0 0 14px; border-left: 3px dotted var(--rule);
}
.user-name { font-weight: 800; font-size: 14px; color: var(--ink); }

/* --- avatars ------------------------------------------------------------ */

.av {
  flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-family: Fredoka, sans-serif; font-weight: 600;
  border: 3px solid rgba(0,0,0,0.22);
  background-size: cover; background-position: 50% 40%;
  overflow: hidden; color: var(--cream);
}
.av-40 { width: 40px; height: 40px; font-size: 14px; }
.av-34 { width: 34px; height: 34px; font-size: 12px; }
.av-44 { width: 44px; height: 44px; font-size: 16px; }
.av-118 {
  width: 118px; height: 118px; margin: 0 auto; font-size: 40px;
  border-width: 5px; animation: ofnBob 4s ease-in-out infinite;
}
.av-empty { background: var(--sand); border-color: var(--rule-hard); color: var(--ink-faint); }

/* --- home --------------------------------------------------------------- */

.home-main { max-width: 1240px; margin: 0 auto; padding: 44px 28px 80px; }

.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 99px;
  background: #FFE0D6; border: 3px solid #FFB49E;
  font-weight: 800; font-size: 13px; color: var(--orange-dark);
  letter-spacing: 0.6px; text-transform: uppercase;
  animation: ofnBob 3s ease-in-out infinite;
}
.hero-h1 {
  font-family: Fredoka, sans-serif; font-weight: 700; font-size: 76px;
  line-height: 0.96; letter-spacing: -2px; margin: 22px 0 0; text-wrap: balance;
}
.hero-h1 span { color: var(--blue); }
.hero-p {
  font-size: 20px; line-height: 1.5; max-width: 32ch;
  margin: 14px 0 0; color: var(--ink-soft); text-wrap: pretty;
}
.hero-cta { display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap; }

.hero-frame { position: relative; padding: 0 28px 28px 0; }
.hero-frame-back { position: absolute; inset: 34px -6px -6px 34px; border-radius: 42px; background: #CFE9FF; }
.hero-frame-front {
  position: relative; border-radius: 42px; background: var(--paper);
  border: 6px solid var(--blue); padding: 14px;
  box-shadow: 0 14px 0 rgba(42,110,168,0.25); overflow: hidden;
}
.hero-img {
  display: block; width: 100%; height: 460px;
  object-fit: cover; object-position: 50% 22%; border-radius: 28px;
}

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 76px; }
.feature {
  border-radius: 28px; padding: 26px; border: 4px solid;
  transition: transform 0.16s ease; cursor: default;
}
.feature:hover { transform: translateY(-8px) rotate(-1deg); }
.feature h3 { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 26px; margin: 16px 0 8px; }
.feature p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-soft); }
.feature-chip {
  display: inline-block; padding: 6px 14px; border-radius: 99px;
  font-weight: 800; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  background: var(--cream); border: 3px solid;
}
.feature-1 { background: #FFE0D6; border-color: #FFB49E; }
.feature-1 .feature-chip { border-color: #FFB49E; color: var(--orange-dark); }
.feature-2 { background: #CFE9FF; border-color: #9FD0FA; }
.feature-2 .feature-chip { border-color: #9FD0FA; color: #1F6194; }
.feature-3 { background: #DCF3DC; border-color: #A9E0A9; }
.feature-3 .feature-chip { border-color: #A9E0A9; color: #2F7A2F; }

.marquee {
  margin-top: 64px; overflow: hidden;
  border-top: 4px dotted var(--rule); border-bottom: 4px dotted var(--rule);
  padding: 18px 0;
}
.marquee-track {
  display: flex; gap: 40px; width: max-content;
  animation: ofnDrift 26s linear infinite;
  font-family: Fredoka, sans-serif; font-size: 22px; color: var(--ink-faint);
}

/* --- chat --------------------------------------------------------------- */

.chat-main {
  max-width: 1440px; margin: 0 auto; padding: 22px 22px 32px;
  display: grid; grid-template-columns: 300px 1fr; gap: 22px;
  height: calc(100vh - 79px);
}
.chat-main.no-rail { grid-template-columns: 1fr; }
.chat-main.focus {
  max-width: none; margin: 0; padding: 12px; gap: 14px; height: 93vh;
}

.scrim { display: none; }

.sidebar {
  background: var(--paper); border: 4px solid var(--rule); border-radius: 28px;
  padding: 18px; display: flex; flex-direction: column; gap: 18px; overflow: hidden;
}
.sidebar.off { display: none; }

.search {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 16px;
  background: var(--sand); border: 3px solid var(--rule);
}
.search input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-family: Nunito, sans-serif; font-weight: 700; font-size: 16px; color: var(--ink);
}

.side-scroll { overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.side-label {
  font-family: Fredoka, sans-serif; font-size: 13px; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px;
}
.side-list { display: flex; flex-direction: column; gap: 8px; }

.room-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px; border-radius: 16px; cursor: pointer;
  transition: transform 0.14s ease;
  font-family: Nunito, sans-serif; color: var(--ink);
  border: 3px solid transparent; background: transparent;
}
.room-btn:hover { transform: translateX(4px) rotate(-0.8deg); }
.room-dot {
  width: 34px; height: 34px; border-radius: 12px;
  display: grid; place-items: center; font-size: 17px; border: 2px solid;
}
.room-name { flex: 1; text-align: left; font-weight: 800; font-size: 15px; }
.room-badge {
  min-width: 24px; padding: 2px 7px; border-radius: 99px;
  background: var(--accent); color: var(--cream);
  font-weight: 800; font-size: 12px; text-align: center;
}
.room-badge.off { display: none; }

.friend {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 14px; transition: transform 0.14s ease;
}
.friend:hover { transform: translateX(4px); }
.friend-name { flex: 1; font-weight: 700; font-size: 15px; }
.friend-status { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--paper); }

.side-foot {
  margin-top: auto; font-size: 13px; font-weight: 700;
  color: var(--ink-faint); text-align: center; line-height: 1.5;
  padding: 12px; border-radius: 16px;
  background: var(--sand); border: 3px dotted var(--rule-hard);
}

.room-panel {
  background: var(--paper); border: 4px solid var(--rule); border-radius: 28px;
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}

.room-header {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 4px dotted var(--rule); background: var(--sand);
}
.room-emoji {
  width: 46px; height: 46px; border-radius: 16px;
  display: grid; place-items: center; font-size: 24px;
  background: #FFE0D6; border: 3px solid #FFB49E;
  animation: ofnWiggle 3s ease-in-out infinite;
}
.room-title { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 22px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-blurb { font-size: 13px; font-weight: 700; color: var(--ink-faint); }

.tool-btn {
  width: 42px; height: 42px; border-radius: 14px;
  border: 3px solid var(--rule); background: var(--paper);
  font-size: 17px; cursor: pointer; transition: transform 0.14s ease;
  color: var(--ink);
}
.tool-btn:hover { transform: translateY(-3px) rotate(-3deg); }
.tool-btn.on { border-color: var(--blue-dark); background: var(--blue); color: var(--cream); }
.rail-btn { width: 42px; height: 42px; flex: none; border-radius: 14px; font-size: 18px; cursor: pointer; transition: transform 0.14s ease; border: 3px solid var(--rule); background: var(--paper); color: var(--ink); }
.rail-btn:hover { transform: translateY(-3px); }
.rail-btn.on { border-color: var(--blue-dark); background: var(--blue); color: var(--cream); }

.jukebox {
  flex: none; padding: 16px 24px;
  border-bottom: 4px dotted var(--rule); background: #F3EEFE;
  animation: ofnPop 0.3s ease both;
}
.jukebox.off { display: none; }
.jukebox-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.jukebox-label { font-family: Fredoka, sans-serif; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--purple-dark); }
.jukebox-rule { flex: 1; height: 3px; border-radius: 99px; background: #E4DAFB; }
.jukebox-now { font-weight: 800; font-size: 13px; color: var(--purple); }
.jukebox-crate { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.jukebox-empty { font-weight: 700; font-size: 14px; color: #9B8AB5; }

.track {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 10px 16px 10px 10px; border-radius: 20px; cursor: pointer;
  font-family: Nunito, sans-serif; color: var(--ink);
  transition: transform 0.14s ease;
  border: 3px solid #E9DFFA; background: var(--paper); box-shadow: 0 5px 0 #EFE8FC;
}
.track:hover { transform: translateY(-4px) rotate(-1.5deg); }
.track.on { border-color: var(--purple-dark); background: #E4DAFB; box-shadow: 0 5px 0 #C3B0F3; }
.track-icon {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; color: var(--cream);
  background: var(--purple); border: 3px solid var(--purple-dark);
}
.track.on .track-icon { animation: ofnWiggle 1.6s ease-in-out infinite; }
.track-title { display: block; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 16px; text-align: left; }
.track-by { display: block; font-weight: 700; font-size: 13px; color: #8A6C4E; text-align: left; }

.msg-list {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 26px 26px 10px; display: flex; flex-direction: column; gap: 20px;
}

.msg { display: flex; gap: 12px; align-items: flex-start; animation: ofnPop 0.35s ease both; }
.msg.mine { flex-direction: row-reverse; }
.msg-col { max-width: 62%; min-width: 0; }
.msg.mine .msg-col { display: flex; flex-direction: column; align-items: flex-end; }
.msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.msg-name { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 15px; }
.msg-time { font-size: 12px; font-weight: 700; color: var(--ink-fainter); }
.msg-bubble {
  padding: 14px 18px; font-size: 17px; line-height: 1.45; font-weight: 600;
  border: 4px solid var(--rule); background: var(--sand); color: var(--ink);
  border-radius: 22px 22px 22px 6px; box-shadow: 0 5px 0 var(--rule-soft);
  overflow-wrap: anywhere;
}
.msg.mine .msg-bubble {
  border-color: var(--accent); background: var(--accent); color: var(--cream);
  border-radius: 22px 22px 6px 22px; box-shadow: 0 5px 0 rgba(0,0,0,0.12);
}
/* An away line from one of the puppets. Same bubble, quieter, so it never
   reads as the character actually being present. */
.msg.away .msg-bubble {
  background: var(--paper); border-style: dashed; color: var(--ink-soft);
  font-style: italic; box-shadow: none;
}
.msg-away-tag {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-faint); padding: 2px 8px; border-radius: 99px;
  background: var(--sand); border: 2px solid var(--rule);
}

.typing { display: flex; align-items: center; gap: 10px; padding-left: 4px; }
.typing.off { display: none; }
.typing-dots { display: flex; gap: 5px; }
.typing-dots span { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); animation: ofnDot 1s ease-in-out infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
.typing-label { font-weight: 700; font-size: 14px; color: var(--ink-faint); }

.composer-wrap { flex: none; padding: 16px 22px 20px; border-top: 4px dotted var(--rule); }
.composer {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px 10px 20px; border-radius: 22px;
  background: var(--sand); border: 4px solid var(--rule);
}
.composer input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-family: Nunito, sans-serif; font-weight: 700; font-size: 16px; color: var(--ink);
}
.sticker-btn {
  width: 44px; height: 44px; flex: none; border-radius: 15px;
  border: 3px solid var(--yellow-dark); background: var(--yellow);
  font-size: 19px; cursor: pointer; transition: transform 0.14s ease;
}
.sticker-btn:hover { transform: rotate(-10deg) scale(1.08); }
.send-btn {
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 17px;
  flex: none; padding: 11px 24px; border-radius: 16px;
  border: 4px solid var(--orange-dark); background: var(--orange);
  color: var(--cream); box-shadow: 0 5px 0 var(--orange-dark);
  cursor: pointer; transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.send-btn:hover { transform: translateY(-3px); }
.send-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange-dark); }

.sticker-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding: 12px;
  border-radius: 20px; background: var(--sand); border: 3px dotted var(--rule-hard);
  animation: ofnPop 0.22s ease both;
}
.sticker-row.off { display: none; }
.sticker {
  width: 46px; height: 46px; border-radius: 14px;
  border: 3px solid var(--rule); background: var(--paper);
  font-size: 22px; cursor: pointer; transition: transform 0.14s ease;
}
.sticker:hover { transform: translateY(-4px) rotate(-8deg); }

/* --- profile ------------------------------------------------------------ */

.profile-main { max-width: 980px; margin: 0 auto; padding: 40px 28px 80px; }
.profile-h1 { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 52px; letter-spacing: -1px; margin: 0 0 6px; }
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }

.card { background: var(--paper); border: 4px solid var(--rule); border-radius: 28px; padding: 26px; }
.card-label {
  font-family: Fredoka, sans-serif; font-size: 13px; letter-spacing: 1.6px;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 16px;
}
.profile-name { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 24px; margin-top: 14px; }
.profile-handle { font-weight: 700; font-size: 14px; color: var(--ink-faint); }

.card-btn {
  margin-top: 10px; width: 100%;
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 16px;
  padding: 12px; border-radius: 16px;
  border: 4px solid var(--tan); background: var(--cream); color: #8A6C4E;
  box-shadow: 0 5px 0 var(--tan); cursor: pointer; transition: transform 0.14s ease;
}
.card-btn:hover { transform: translateY(-3px) rotate(1.5deg); }

.field { display: block; }
.field span { font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.field input, .field .readonly {
  width: 100%; margin-top: 7px; padding: 13px 16px; border-radius: 16px;
  border: 3px solid var(--rule); background: var(--sand);
  font-family: Nunito, sans-serif; font-weight: 700; font-size: 16px;
  color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--blue); }
.field .readonly { color: var(--ink-faint); }
.field-note { font-size: 13px; font-weight: 700; color: var(--ink-faint); margin-top: 6px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  border: 4px solid transparent; transition: transform 0.14s ease;
}
.swatch:hover { transform: translateY(-4px); }
.swatch.on { border-color: var(--ink); transform: translateY(-2px); }

.toggle-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 4px; border-bottom: 3px dotted var(--rule-soft);
}
.toggle-label { font-weight: 800; font-size: 16px; }
.toggle-hint { font-size: 14px; color: var(--ink-faint); font-weight: 600; }
.toggle-track {
  width: 62px; height: 34px; flex: none; border-radius: 99px; cursor: pointer;
  padding: 3px; display: flex; justify-content: flex-start;
  transition: background 0.16s ease;
  border: 3px solid var(--tan); background: var(--sand);
}
.toggle-track.on { justify-content: flex-end; border-color: var(--green-dark); background: var(--green); }
.toggle-knob { width: 26px; height: 26px; border-radius: 50%; background: var(--cream); box-shadow: 0 2px 0 rgba(0,0,0,0.15); }

.save-row { display: flex; gap: 12px; align-items: center; }
.save-btn {
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 18px;
  padding: 14px 28px; border-radius: 18px;
  border: 4px solid var(--orange-dark); background: var(--orange);
  color: var(--cream); box-shadow: 0 6px 0 var(--orange-dark);
  cursor: pointer; transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.save-btn:hover { transform: translateY(-4px) rotate(-1.5deg); }
.save-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--orange-dark); }
.saved { font-weight: 800; color: var(--green-dark); animation: ofnPop 0.3s ease both; }
.saved.off { display: none; }

.signed-out {
  text-align: center; padding: 60px 28px;
  background: var(--paper); border: 4px solid var(--rule); border-radius: 32px;
}
.signed-out-door {
  width: 110px; height: 110px; margin: 0 auto; border-radius: 50%;
  background: var(--sand); border: 5px dashed var(--rule-hard);
  display: grid; place-items: center; font-size: 46px;
  animation: ofnBob 4s ease-in-out infinite;
}
.signed-out h1 { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 40px; margin: 22px 0 6px; }
.signed-out p { font-size: 18px; color: var(--ink-soft); margin: 0 0 26px; }

/* --- auth modal --------------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(59,42,32,0.45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px;
  animation: ofnFade 0.18s ease both;
}
.modal.off { display: none; }
.auth-card {
  width: 100%; max-width: 780px;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper); border: 6px solid var(--blue); border-radius: 34px;
  box-shadow: 0 16px 0 rgba(42,110,168,0.35);
  animation: ofnPop 0.3s ease both;
  max-height: 92dvh; overflow-y: auto;
}
.auth-aside {
  background: #CFE9FF; padding: 30px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
}
.auth-title { font-family: Fredoka, sans-serif; font-weight: 700; font-size: 30px; line-height: 1.05; letter-spacing: -0.6px; }
.auth-blurb { font-size: 16px; color: #2A5975; font-weight: 600; margin: 10px 0 0; }
.auth-img {
  width: 100%; height: 190px; object-fit: cover; object-position: 50% 18%;
  border-radius: 24px; border: 5px solid var(--paper);
  animation: ofnBob 4.5s ease-in-out infinite;
}
.auth-body { padding: 30px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.auth-tab {
  flex: 1; font-family: Fredoka, sans-serif; font-weight: 600; font-size: 16px;
  padding: 11px; border-radius: 14px; cursor: pointer;
  border: 3px solid var(--rule); background: var(--sand); color: #8A6C4E;
}
.auth-tab.on { border-color: var(--blue-dark); background: var(--blue); color: var(--cream); }
.auth-field { display: block; margin-bottom: 14px; }
.auth-field span { font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.auth-field input {
  width: 100%; margin-top: 7px; padding: 14px 16px; border-radius: 16px;
  border: 3px solid var(--rule); background: var(--sand);
  font-family: Nunito, sans-serif; font-weight: 700; font-size: 16px;
  color: var(--ink); outline: none;
}
.auth-field input:focus { border-color: var(--blue); }
.auth-submit {
  width: 100%; margin-top: 20px;
  font-family: Fredoka, sans-serif; font-weight: 600; font-size: 19px;
  padding: 15px; border-radius: 20px;
  border: 4px solid var(--orange-dark); background: var(--orange);
  color: var(--cream); box-shadow: 0 6px 0 var(--orange-dark);
  cursor: pointer; transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.auth-submit:hover { transform: translateY(-4px); }
.auth-submit:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--orange-dark); }
.auth-submit[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.auth-foot { text-align: center; font-size: 13px; font-weight: 700; color: var(--ink-faint); margin-top: 14px; }
.auth-error {
  margin-top: 14px; padding: 10px 14px; border-radius: 14px;
  background: #FFE0D6; border: 3px solid #FFB49E; color: var(--orange-dark);
  font-weight: 800; font-size: 14px; animation: ofnPop 0.25s ease both;
}
.auth-error.off { display: none; }

/* The join panel. Nothing here posts anywhere — it exists to tell somebody
   exactly what to send Beast and then get out of the way. */
.join-note {
  margin-top: 18px; padding: 18px; border-radius: 20px;
  background: var(--sand); border: 3px dotted var(--rule-hard);
  font-size: 15px; font-weight: 700; color: var(--ink-soft); line-height: 1.55;
}
.join-note strong { color: var(--ink); }
.join-summary {
  margin-top: 14px; padding: 14px 16px; border-radius: 16px;
  background: var(--paper); border: 3px solid var(--rule);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.7; color: var(--ink); overflow-wrap: anywhere;
}
.join-summary.off { display: none; }
.join-done { animation: ofnPop 0.3s ease both; }

/* --- mobile bottom nav -------------------------------------------------- */

.mobile-nav { display: none; }

/* --- 760px and under ---------------------------------------------------- */

@media (max-width: 760px) {
  .header { gap: 10px; padding: 10px 14px; }
  .brand-title { font-size: 16px; }
  .brand-sub, .nav, .user-name { display: none; }
  .user-chip { padding-left: 0; border-left: none; }

  .home-main, .profile-main { max-width: 100%; padding: 22px 16px 110px; }
  .hero-grid { display: flex; flex-direction: column; gap: 24px; }
  .hero-h1 { font-size: 42px; letter-spacing: -1px; margin: 16px 0 0; }
  .hero-p { font-size: 17px; }
  .hero-frame { padding: 0 10px 10px 0; }
  .hero-img { height: 260px; border-radius: 22px; }
  .feature-grid { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; }

  .chat-main, .chat-main.no-rail, .chat-main.focus {
    max-width: none; margin: 0; padding: 8px 8px 0;
    display: block; height: calc(100dvh - 152px); position: relative;
  }
  .chat-main.focus { height: calc(100dvh - 8px); }

  .sidebar, .sidebar.off {
    position: absolute; z-index: 30; top: 8px; bottom: 8px; left: 8px;
    display: flex; width: 280px; max-width: 84vw;
    border-radius: 26px; padding: 16px; gap: 16px;
    box-shadow: 0 12px 30px rgba(59,42,32,0.18);
    transition: transform 0.22s ease; transform: translateX(-115%);
  }
  .sidebar.drawer-open { transform: translateX(0); }
  .scrim.drawer-open { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(59,42,32,0.35); }

  .room-header { gap: 10px; padding: 12px 14px; }
  .room-title { font-size: 18px; }
  .room-blurb, .tool-btn { display: none; }
  .rail-btn { width: 44px; height: 44px; }
  .jukebox { padding: 12px 14px; }
  .msg-list { padding: 16px 14px 8px; gap: 16px; }
  .msg-col { max-width: 82%; }
  .composer-wrap { padding: 10px 12px 14px; }
  .composer { gap: 8px; padding: 8px 8px 8px 14px; }
  .send-btn { font-size: 15px; height: 46px; padding: 0 16px; }

  .profile-h1 { font-size: 34px; }
  .profile-grid { display: flex; flex-direction: column; gap: 18px; }

  .auth-card { max-width: 420px; grid-template-columns: 1fr; border-radius: 28px; }
  .auth-aside { padding: 16px 18px; display: block; }
  .auth-img { height: 110px; margin-top: 12px; }

  .mobile-nav {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255,246,233,0.96); backdrop-filter: blur(8px);
    border-top: 4px dotted var(--rule);
  }
  .mobile-nav.off { display: none; }
  .mobile-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 52px; border-radius: 18px; cursor: pointer;
    transition: transform 0.12s ease;
    border: 3px solid var(--rule); background: var(--paper); color: #8A6C4E;
  }
  .mobile-tab:active { transform: scale(0.94); }
  .mobile-tab.on { border-color: var(--blue-dark); background: var(--blue); color: var(--cream); }
  .mobile-tab-icon { font-size: 22px; line-height: 1; }
  .mobile-tab-label { font-family: Fredoka, sans-serif; font-weight: 600; font-size: 12px; }
}

/* Two fields side by side only where there is room for them. */
.fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) {
  .fields-grid { display: flex; flex-direction: column; gap: 14px; }
}
