/* The account app (index.html): sign in, feed, friends, inbox, profile, settings, help.
   Design language "cozy town": cream paper with a faint dot grid, warm brown ink, rounded Fredoka headings over
   Nunito text, chunky buttons that press down onto a ledge, cards that sit on a ledge instead of floating on a blur,
   and little landscape scenes (sky, hills, sun or moon) for identity moments: sign-in, the feed greeting, profile covers.
   Dark mode is the same town at night. Theme tokens up top; nothing below hard-codes a theme color. */
:root {
  --font-display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --bg: #f6efdf;
  --dots: rgba(150, 118, 76, 0.13);
  --panel: #fffcf4;
  --panel-2: #f8f1e1;       /* wells inside a card: comments, highlights, convo */
  --ink: #4a3928;
  --muted: #8a7560;
  --line: #ecdfc6;
  --edge: #e2d2b1;          /* the ledge a card or button sits on */
  --accent: #11897c;        /* teal: the one action color */
  --accent-deep: #0b6459;
  --accent-hover: #0f7d71;
  --accent-soft: #dcf2ec;
  --accent-ink: #ffffff;
  --sun: #f4c14f;
  --sun-deep: #d99a1e;
  --leaf: #7bbd5b;
  --coral: #ee8466;
  --sky: #6fbfe0;
  --plum: #a988d6;
  --good: #3b9a4e;
  --bad: #d6503f;
  --soft: #f1e6cd;          /* secondary buttons, icon wells */
  --soft-edge: #dccaa4;
  --soft-hover: #ebdcbd;
  --input: #fbf6ea;
  --hover: rgba(122, 88, 48, 0.07);
  --brand: linear-gradient(135deg, #3fbccb 0%, #11897c 55%, #0b6459 100%);
  --shadow: 0 4px 0 var(--edge);
  --shadow-pop: 0 6px 0 var(--edge), 0 18px 36px rgba(92, 66, 34, 0.2);
  --msg-error-bg: #fbe3dc; --msg-error-ink: #97321f;
  --msg-info-bg: #dcf2ec; --msg-info-ink: #0b5a50;
  --msg-success-bg: #e3f3d8; --msg-success-ink: #2e6a1d;
  --radius: 22px;
  --free: #34b46a;
  --busy: #e5533f;
  /* Scenes: sky, two hills and a sun */
  --sky-top: #8fd3ef;
  --sky-bot: #e4f5fb;
  --hill-1: #9ad27a;
  --hill-2: #7bbd5b;
  --orb: #ffd76a;
  --orb-glow: rgba(255, 215, 106, 0.45);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #232846;
  --dots: rgba(255, 255, 255, 0.05);
  --panel: #30365c;
  --panel-2: #292e51;
  --ink: #f4eadb;
  --muted: #b6adc6;
  --line: #414876;
  --edge: #1b1f3b;
  --accent: #45cdb9;
  --accent-deep: #22917f;
  --accent-hover: #5ad7c4;
  --accent-soft: #24475a;
  --accent-ink: #0f2e2a;
  --sun: #f4c14f;
  --leaf: #86c56a;
  --coral: #f08e72;
  --sky: #7cc6e6;
  --plum: #b797e0;
  --good: #6dd08a;
  --bad: #ff7a67;
  --soft: #3c4371;
  --soft-edge: #22264a;
  --soft-hover: #464e80;
  --input: #292e51;
  --hover: rgba(255, 255, 255, 0.06);
  --shadow: 0 4px 0 var(--edge);
  --shadow-pop: 0 6px 0 var(--edge), 0 18px 36px rgba(0, 0, 0, 0.45);
  --msg-error-bg: #4a2733; --msg-error-ink: #ffc2b6;
  --msg-info-bg: #24475a; --msg-info-ink: #b9efe5;
  --msg-success-bg: #294a37; --msg-success-ink: #c3ecc9;
  --free: #5fe095;
  --busy: #ff6b5a;
  --sky-top: #1a1f3e;
  --sky-bot: #3b3f72;
  --hill-1: #2f5a55;
  --hill-2: #234743;
  --orb: #f6efd2;
  --orb-glow: rgba(246, 239, 210, 0.25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scrollbar-gutter: stable; } /* a scrollbar appearing on a longer tab would otherwise shift everything sideways */
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dots) 1.3px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, .nav-title, .wordmark { font-family: var(--font-display); }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; font-weight: 700; }
a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
::selection { background: var(--sun); color: #3a2a18; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Brand mark (app/logo.svg): a street lamp whose post and lit sidewalk draw an L, two friends in its light */
.mark { width: 38px; height: 38px; border-radius: 12px; flex: none; display: block; box-shadow: 0 3px 0 var(--accent-deep); }
.mark.lg { width: 76px; height: 76px; border-radius: 24px; box-shadow: 0 6px 0 var(--accent-deep), 0 16px 30px rgba(11, 100, 89, 0.3); }
.wordmark { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }

/* A landscape scene: sky, two rolling hills and the sun (or moon at night). Used by .scene, covers, the stage. */
.scene, .profile-card .cover, .stage, .review-art {
  background:
    radial-gradient(circle at 84% 30%, var(--orb) 0 18px, var(--orb-glow) 19px 30px, transparent 31px),
    radial-gradient(62% 52% at 18% 108%, var(--hill-2) 98%, transparent 100%),
    radial-gradient(70% 44% at 76% 112%, var(--hill-1) 98%, transparent 100%),
    linear-gradient(180deg, var(--sky-top), var(--sky-bot));
}

/* ---- App bar (signed in): a shop awning with a scalloped edge, and a dock of app icons ---- */
.appbar {
  position: sticky; top: 0; z-index: 20; height: 72px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--panel);
}
.appbar::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; pointer-events: none;
  background: radial-gradient(circle at 12px 0, var(--panel) 11px, transparent 11.5px) 0 0 / 24px 10px repeat-x;
  filter: drop-shadow(0 3px 0 var(--edge));
}
.appbar .logo { display: flex; align-items: center; gap: 10px; font-size: 26px; text-decoration: none; }
.appbar .end { display: flex; justify-content: flex-end; }
.navtabs { display: flex; gap: 6px; align-items: center; }
.navtabs a {
  --tile: var(--sun);
  position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px;
  border-radius: 16px; color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 15px;
  text-decoration: none; transition: background 0.15s, color 0.15s;
}
.navtabs a:nth-child(2) { --tile: var(--plum); }
.navtabs a:nth-child(3) { --tile: var(--coral); }
.navtabs a:nth-child(4) { --tile: var(--sky); }
.navtabs a:nth-child(5) { --tile: var(--leaf); }
.navtabs a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.navtabs a:hover .tab-icon { transform: rotate(-6deg) scale(1.05); }
.tab-icon {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: var(--soft); color: var(--muted); transition: transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1), background 0.15s, box-shadow 0.15s;
}
.navtabs a[aria-current="page"] { color: var(--ink); }
.navtabs a[aria-current="page"] .tab-icon {
  background: var(--tile); color: #fff; transform: translateY(-2px);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--tile) 62%, #3a2a18);
}
.navtabs a[aria-current="page"] .tab-icon svg.i { stroke-width: 2.5; }
.menu-wrap { position: relative; }
.avatar-btn { border: none; background: none; padding: 0; border-radius: 50%; display: flex; box-shadow: none; }
.avatar-btn:hover:not(:disabled) { background: none; filter: brightness(1.04); transform: translateY(-1px); }
.avatar-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.avatar-btn .avatar { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--edge); }
.avatar-btn[aria-expanded="true"] .avatar { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent); }
.menu {
  position: absolute; right: 0; top: calc(100% + 32px); width: 320px; max-width: calc(100vw - 28px); padding: 10px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-pop); border: 2px solid var(--line);
  animation: pop-in 0.16s cubic-bezier(0.3, 1.4, 0.5, 1);
  transform-origin: top right;
}
@keyframes pop-in { from { opacity: 0; transform: scale(0.94) translateY(-4px); } }
.menu .menu-head {
  display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; border-radius: 16px;
  background: var(--panel-2); cursor: pointer; box-shadow: none;
}
.menu .menu-head:hover { background: var(--soft); }
.menu .menu-head .name { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.menu [role="menuitem"] {
  display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; border: none; background: none; box-shadow: none;
  padding: 8px; border-radius: 14px; font-weight: 700; color: var(--ink); justify-content: flex-start; font-family: var(--font-body);
}
.menu [role="menuitem"]:hover:not(:disabled), .menu [role="menuitem"]:focus-visible { background: var(--hover); outline: none; transform: none; }
.menu [role="menuitem"]:active:not(:disabled) { transform: none; box-shadow: none; }
.menu hr { border: none; border-top: 2px dashed var(--line); margin: 8px; }
.well { width: 38px; height: 38px; border-radius: 13px; background: var(--soft); color: var(--ink); display: grid; place-items: center; flex: none; }
.menu [role="menuitem"]:nth-of-type(2) .well { background: color-mix(in srgb, var(--coral) 24%, var(--panel)); }
.menu [role="menuitem"]:nth-of-type(3) .well { background: color-mix(in srgb, var(--sky) 26%, var(--panel)); }
.menu [role="menuitem"]:nth-of-type(4) .well { background: color-mix(in srgb, var(--plum) 26%, var(--panel)); }
.menu [role="menuitem"]:nth-of-type(5) .well { background: color-mix(in srgb, var(--sun) 32%, var(--panel)); }

/* ---- Page layout ---- */
.page { display: flex; justify-content: center; padding: 30px 16px 56px; }
.shell { width: 100%; max-width: 440px; display: grid; gap: 18px; align-content: start; }
.shell.wide { max-width: 940px; }
.shell.feed { max-width: 640px; }
.brand {
  position: relative; text-align: center; display: grid; justify-items: center; gap: 8px; padding: 34px 20px 64px;
  border-radius: 28px; overflow: hidden; box-shadow: var(--shadow);
}
.brand > * { position: relative; }
.brand h1 { margin: 6px 0 0; font-size: 46px; line-height: 1; font-weight: 700; color: #fff; text-shadow: 0 3px 0 rgba(11, 100, 89, 0.45); }
.brand p { margin: 0; color: #2f4a3a; font-size: 17px; font-weight: 700; background: rgba(255, 252, 244, 0.8); padding: 4px 14px; border-radius: 999px; }
:root[data-theme="dark"] .brand p { color: var(--ink); background: rgba(35, 40, 70, 0.7); }

.card {
  background: var(--panel); border-radius: var(--radius); padding: 22px; min-width: 0;
  border: 2px solid var(--line); box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 23px; font-weight: 600; letter-spacing: -0.005em; }
.card .sub { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
h3 { margin: 0 0 12px; font-size: 19px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 800; margin-bottom: 14px; }
input, select {
  font: inherit; font-weight: 600; width: 100%; padding: 11px 15px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--input); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; font-weight: 500; }
input:hover:not(:disabled):not(:focus) { border-color: var(--edge); }
input:focus, select:focus { outline: none; background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
input:disabled { color: var(--muted); }
input[type="search"], .pill input, input.pill { border-radius: 999px; }
.at-field { position: relative; }
.at-field span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 800; }
.at-field input { padding-left: 34px; }
.hint { font-weight: 500; color: var(--muted); font-size: 13px; }
.hint.ok { color: var(--good); font-weight: 700; }
.hint.bad { color: var(--bad); font-weight: 700; }

/* Buttons press down onto a ledge */
button {
  font: inherit; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; border: none;
  background: var(--soft); color: var(--ink); border-radius: 14px; padding: 9px 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 3px 0 var(--soft-edge);
  transition: background 0.12s, transform 0.08s, box-shadow 0.08s;
}
button:hover:not(:disabled) { background: var(--soft-hover); transform: translateY(-1px); box-shadow: 0 4px 0 var(--soft-edge); }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--soft-edge); }
button:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-deep); }
button.primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 5px 0 var(--accent-deep); }
button.primary:active:not(:disabled) { box-shadow: 0 0 0 var(--accent-deep); transform: translateY(4px); }
button.tonal { background: var(--accent-soft); color: var(--accent); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 35%, var(--accent-soft)); }
button.tonal:hover:not(:disabled) { background: color-mix(in srgb, var(--accent-soft) 82%, var(--accent) 12%); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 35%, var(--accent-soft)); }
button.full { width: 100%; padding: 13px 16px; font-size: 17px; border-radius: 16px; }
button.link, button.link:hover:not(:disabled), button.link:active:not(:disabled) { background: none; color: var(--accent); padding: 0; box-shadow: none; transform: none; font-family: var(--font-body); font-weight: 800; }
button.link:hover:not(:disabled) { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
button.small { padding: 7px 13px; font-size: 14px; border-radius: 12px; }
button.danger { color: var(--bad); }
button.danger-solid { background: var(--bad); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--bad) 60%, #2a1208); }
button.danger-solid:hover:not(:disabled) { background: color-mix(in srgb, var(--bad) 90%, #000); box-shadow: 0 5px 0 color-mix(in srgb, var(--bad) 60%, #2a1208); }
.actions-row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* Sign in / create account: a two-tab switch */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--panel-2); border-radius: 16px; margin: 0 0 20px; border: 2px solid var(--line); }
.tabs button { background: none; color: var(--muted); border-radius: 12px; padding: 10px; font-size: 15px; box-shadow: none; }
.tabs button:hover:not(:disabled) { background: var(--hover); box-shadow: none; transform: none; }
.tabs button:active:not(:disabled) { transform: none; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 3px 0 var(--edge); }

.msg { margin: 12px 0 0; font-size: 14px; font-weight: 700; padding: 10px 14px; border-radius: 14px; }
.msg.error { background: var(--msg-error-bg); color: var(--msg-error-ink); }
.msg.info { background: var(--msg-info-bg); color: var(--msg-info-ink); }
.msg.success { background: var(--msg-success-bg); color: var(--msg-success-ink); }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 15px; background: var(--accent);
}
.avatar.sm { width: 42px; height: 42px; font-size: 15px; }
.avatar.xs { width: 36px; height: 36px; font-size: 14px; }
.avatar.lg { width: 104px; height: 104px; font-size: 36px; }
/* Ring around a new town / highlighted person */
.ring { position: relative; padding: 4px; border-radius: 50%; background: conic-gradient(var(--sun), var(--coral), var(--plum), var(--sky), var(--leaf), var(--sun)); flex: none; display: grid; }
.ring > .avatar { box-shadow: 0 0 0 2px var(--panel); }
.handle { color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---- Profile card with a landscape cover ---- */
.profile-card { padding: 0; overflow: hidden; }
.profile-card .cover { height: 132px; position: relative; }
.me { display: flex; align-items: flex-start; gap: 16px; padding: 0 22px 12px; margin-top: -46px; position: relative; }
.me .avatar { box-shadow: 0 0 0 5px var(--panel), 0 7px 0 2px var(--edge); }
.me .who { flex: 1; min-width: 0; padding-top: 54px; }
.me > button { margin-top: 56px; }
.me .name { font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.1; }
.me .chips { margin-top: 8px; }

.row { display: flex; gap: 10px; }
.invite-code { margin-bottom: 4px; }
.invite-code input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: 0.12em; text-align: center; border-style: dashed; }
.row input { flex: 1; }

ul.people { list-style: none; margin: 0 -8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
ul.people li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; transition: background 0.12s; }
ul.people li:hover { background: var(--hover); }
ul.people .who { flex: 1; min-width: 0; }
ul.people .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.people .handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.people .actions { display: flex; gap: 8px; }
/* Long lists scroll inside their card (about 6 rows) instead of stretching the page */
ul.people.scroll { max-height: 350px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.filter { margin-bottom: 10px; }
h3 .count { color: var(--muted); font-weight: 500; font-size: 16px; }
.empty { color: var(--muted); font-size: 14px; margin: 0; }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
  background: var(--coral); color: #fff; font-family: var(--font-display); font-size: 12.5px; font-weight: 600;
}
.section + .section { margin-top: 20px; padding-top: 20px; border-top: 2px dashed var(--line); }

ul.people li.town { cursor: pointer; }
ul.people li.town .name { font-size: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 13px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13.5px; font-weight: 800;
}
.chip:nth-child(5n+2) { background: color-mix(in srgb, var(--coral) 20%, var(--panel)); color: color-mix(in srgb, var(--coral) 70%, var(--ink)); }
.chip:nth-child(5n+3) { background: color-mix(in srgb, var(--sun) 30%, var(--panel)); color: color-mix(in srgb, var(--sun-deep, #d99a1e) 60%, var(--ink)); }
.chip:nth-child(5n+4) { background: color-mix(in srgb, var(--plum) 22%, var(--panel)); color: color-mix(in srgb, var(--plum) 65%, var(--ink)); }
.chip:nth-child(5n+5) { background: color-mix(in srgb, var(--leaf) 24%, var(--panel)); color: color-mix(in srgb, var(--leaf) 55%, var(--ink)); }
.chip button, .chip button:hover:not(:disabled), .chip button:active:not(:disabled) { background: none; padding: 0 0 0 2px; color: inherit; font-size: 16px; line-height: 1; opacity: 0.7; box-shadow: none; transform: none; }
.chip button:hover:not(:disabled) { opacity: 1; color: var(--bad); }
.chip-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px; border: 2px solid var(--line); border-radius: 14px; background: var(--input); }
.chip-input:focus-within { background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.chip-input input, .chip-input input:focus, .chip-input input:hover:not(:disabled):not(:focus) { border: none; padding: 4px 6px; flex: 1; min-width: 120px; width: auto; background: none; box-shadow: none; }

/* A bouncing house instead of a plain spinner */
.spinner {
  width: 40px; height: 40px; margin: 48px auto; border-radius: 12px; background: var(--accent);
  box-shadow: 0 4px 0 var(--accent-deep); animation: hop 0.7s cubic-bezier(0.3, 0, 0.5, 1) infinite alternate;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 11h3v11h6v-7h4v7h6V11h3z'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 11h3v11h6v-7h4v7h6V11h3z'/%3E%3C/svg%3E") center / 100% no-repeat;
}
@keyframes hop { from { transform: translateY(0) scaleY(0.92); } to { transform: translateY(-14px) scaleY(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Feed ---- */
.shell.home { max-width: 1000px; }
.feed-layout { display: grid; grid-template-columns: minmax(0, 620px) 330px; gap: 22px; justify-content: center; align-items: start; }
.feed-main { display: grid; gap: 18px; min-width: 0; }
.rail { position: sticky; top: 96px; display: grid; gap: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card-head a, .card-head .link { font-size: 14px; }
#join-form { margin-bottom: 14px; }

/* Greeting: a little landscape that says hello and what's up today */
.hello {
  position: relative; border-radius: 26px; padding: 24px 24px 60px; min-height: 168px; overflow: hidden;
  box-shadow: var(--shadow); color: #23413a;
}
:root[data-theme="dark"] .hello { color: var(--ink); }
.hello-date {
  display: inline-block; font-size: 12.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(255, 252, 244, 0.75); padding: 3px 10px; border-radius: 999px;
}
:root[data-theme="dark"] .hello-date { background: rgba(35, 40, 70, 0.6); }
.hello h1 { margin: 10px 0 4px; font-size: clamp(26px, 4.4vw, 34px); font-weight: 600; line-height: 1.1; max-width: 80%; }
.hello p { margin: 0; font-weight: 700; max-width: 78%; }
.hello.scene {
  background:
    radial-gradient(circle at var(--orb-at, 86% 34%), var(--orb) 0 20px, var(--orb-glow) 21px 33px, transparent 34px),
    radial-gradient(60% 30% at 16% 104%, var(--hill-2) 98%, transparent 100%),
    radial-gradient(72% 26% at 78% 106%, var(--hill-1) 98%, transparent 100%),
    linear-gradient(180deg, var(--sky-top), var(--sky-bot));
}
.hello-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.hello .status-control { margin: 0; padding: 4px 6px 7px 12px; background: rgba(255, 252, 244, 0.82); border-radius: 999px; }
:root[data-theme="dark"] .hello .status-control { background: rgba(35, 40, 70, 0.72); }
.hello .status-control:empty { display: none; }
.hello-post { white-space: nowrap; }

/* Home's peek at the feed */
ul.latest { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 2px; }
ul.latest li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; cursor: pointer; min-width: 0; }
ul.latest li:hover { background: var(--hover); }
.latest-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 19px; flex: none; }
.latest-body { min-width: 0; flex: 1; }
.latest-text { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Feed tab: filter chips over the stream */
.feed-filters { gap: 8px; flex-wrap: nowrap; overflow-x: auto; margin: 0 -6px; padding: 2px 6px 6px; scrollbar-width: none; }
.feed-filters::-webkit-scrollbar { display: none; }
.feed-filters .chip { flex: none; }
.feed-none { text-align: center; padding: 12px 0; }

.hello .houses { position: absolute; left: 0; right: 0; bottom: 0; height: 60px; pointer-events: none; }

.tab-icon .dot-badge, .dot-badge {
  position: absolute; top: -6px; right: -8px; height: 20px; min-width: 20px; font-size: 11.5px; padding: 0 5px;
  box-shadow: 0 0 0 3px var(--panel); animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-12deg) scale(1.1); } 96% { transform: rotate(10deg) scale(1.1); } }

/* Composer: a speech-bubble prompt that opens into a short form */
.composer { padding: 16px 18px; }
.composer-top { display: flex; gap: 12px; align-items: center; }
.composer-open, .composer-open:hover:not(:disabled), .composer-open:active:not(:disabled) {
  flex: 1; justify-content: flex-start; border-radius: 18px 18px 18px 6px; background: var(--input); color: var(--muted);
  font-family: var(--font-body); font-weight: 600; font-size: 16px; padding: 12px 18px; border: 2px dashed var(--edge);
  box-shadow: none; transform: none;
}
.composer-open:hover:not(:disabled) { background: var(--panel-2); color: var(--ink); border-color: var(--accent); }
#composer-form { margin-top: 14px; display: grid; gap: 12px; }
textarea {
  font: inherit; font-weight: 600; font-size: 17px; width: 100%; resize: vertical; min-height: 88px; padding: 13px 15px;
  border: 2px solid var(--line); border-radius: 16px; background: var(--input); color: var(--ink);
}
textarea:focus { outline: none; background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.mood-chips button { padding: 6px 13px; border-radius: 999px; font-size: 14px; background: var(--soft); box-shadow: 0 2px 0 var(--soft-edge); }
.mood-chips button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-deep); }
.composer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 2px dashed var(--line); padding-top: 14px; }
.composer-foot .spacer { flex: 1; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--muted); }
label.inline select { width: auto; padding: 7px 30px 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink); }

.ideas-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ideas-label { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--sun-deep, #d99a1e); }
:root[data-theme="dark"] .ideas-label { color: var(--sun); }
.ideas-row .chips { flex: 1; }
#composer-ideas button {
  background: color-mix(in srgb, var(--sun) 26%, var(--panel)); color: var(--ink); font-family: var(--font-body); font-weight: 700;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--sun) 60%, var(--edge));
}
#composer-ideas button:hover:not(:disabled) { background: color-mix(in srgb, var(--sun) 40%, var(--panel)); }
#composer-ideas.loading > * { animation: idea-wait 1.1s ease-in-out infinite alternate; pointer-events: none; }
#composer-ideas.loading > :nth-child(2) { animation-delay: .15s; }
#composer-ideas.loading > :nth-child(3) { animation-delay: .3s; }
#composer-ideas.loading > :nth-child(4) { animation-delay: .45s; }
@keyframes idea-wait { from { opacity: 1; } to { opacity: .45; } }
.idea-ghost { display: inline-block; height: 32px; border-radius: 999px; background: color-mix(in srgb, var(--sun) 22%, var(--panel)); }
@media (prefers-reduced-motion: reduce) { #composer-ideas.loading > * { animation: none; opacity: .6; } }
#composer-more-ideas { display: inline-block; transition: transform .2s; font-size: 18px; }
#composer-more-ideas.spinning { animation: spin .8s linear infinite; }
.audience-hint { margin: -4px 0 0; }
/* "Post to" picker: a pill that opens a menu like the account menu */
.audience-picker { position: relative; }
.audience-btn { gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 14px; }
.audience-btn .chev { width: 16px; height: 16px; color: var(--muted); }
.audience-btn[aria-expanded="true"] { background: var(--soft-hover); }
.audience-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); font-size: 13px; }
.audience-menu { left: 0; right: auto; top: calc(100% + 10px); width: 340px; max-width: calc(100vw - 32px); z-index: 30; max-height: 360px; overflow-y: auto; transform-origin: top left; }
.audience-menu .menu-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 8px 8px; }
.audience-menu [role="option"], .audience-menu [role="option"]:hover:not(:disabled), .audience-menu [role="option"]:active:not(:disabled) {
  display: flex; width: 100%; align-items: center; gap: 12px; text-align: left; background: none; padding: 8px;
  border-radius: 14px; font-family: var(--font-body); font-weight: 500; color: var(--ink); justify-content: flex-start; box-shadow: none; transform: none;
}
.audience-menu [role="option"]:hover:not(:disabled), .audience-menu [role="option"]:focus-visible { background: var(--hover); outline: none; }
.audience-menu [role="option"] .well { font-size: 17px; }
.audience-menu [role="option"] b { display: block; font-size: 15px; font-weight: 800; }
.audience-menu [role="option"] .hint { display: block; font-size: 12.5px; }
.audience-menu [role="option"] .check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px var(--edge); }
.audience-menu [role="option"][aria-selected="true"] .check { box-shadow: inset 0 0 0 7px var(--accent); }
.audience-menu hr { border: none; border-top: 2px dashed var(--line); margin: 6px 8px; }
/* While writing, the composer is just the form */
.composer.writing .composer-top, .composer.writing .status-control { display: none; }
.composer.writing #composer-form { margin-top: 0; }
#notices .name, #notices .handle { white-space: normal; }
.audience-hint:empty { display: none; }
/* Posts people wrote: their words as written, a bit bigger */
.post .audience { display: inline-flex; align-items: center; gap: 3px; }
.post .text.written { font-size: 17px; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.post.private { background: repeating-linear-gradient(-45deg, var(--panel), var(--panel) 12px, var(--panel-2) 12px, var(--panel-2) 24px); border-style: dashed; }
.notice-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--soft); font-size: 19px; flex: none; }

/* Town cards: postcards of the real town; tap one to walk into it */
.town-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 14px; overflow-x: auto;
  margin: 0 -6px; padding: 6px 6px 12px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--edge) transparent;
}
.town-card, .town-card:hover:not(:disabled), .town-card:active:not(:disabled) {
  scroll-snap-align: start; display: grid; text-align: left; padding: 8px; overflow: hidden; background: var(--panel); color: var(--ink);
  border-radius: 20px; border: 2px solid var(--line); box-shadow: 0 4px 0 var(--edge); font-family: var(--font-body); font-weight: 500;
  align-content: start; justify-content: stretch; letter-spacing: 0;
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.2s;
}
.town-card:hover:not(:disabled):not(:has(.card-tool:hover)) { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 8px 0 var(--edge); background: var(--panel); }
.town-card:nth-child(even):hover:not(:disabled):not(:has(.card-tool:hover)) { transform: translateY(-4px) rotate(1deg); }
.town-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.town-card:active:has(.card-tool:active) { transform: none; } /* pressing the pin or + presses only that */
.town-card .banner { height: 96px; position: relative; display: flex; align-items: flex-end; padding: 10px 12px; overflow: hidden; border-radius: 14px; }
.town-card .banner svg, .town-icon svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.town-card .banner b { position: relative; z-index: 1; }
/* Real town art: the isometric drawing over a soft sky in the town's hue */
.town-card .banner.real { height: 128px; background-size: contain, cover; background-position: center bottom, center; background-repeat: no-repeat; } /* the whole town, never cropped; its sky fills around it */
.town-card .banner.real.hue-1 { --sky: linear-gradient(180deg, #8fd3ef, #e4f5fb); }
.town-card .banner.real.hue-2 { --sky: linear-gradient(180deg, #ffc9a3, #fff0d9); }
.town-card .banner.real.hue-3 { --sky: linear-gradient(180deg, #b7e3a4, #eef9e6); }
.town-card .banner.real.hue-4 { --sky: linear-gradient(180deg, #cdb8f0, #f4ecff); }
:root[data-theme="dark"] .town-card .banner.real { --sky: linear-gradient(180deg, #1a1f3e, #414678); }
.town-icon { overflow: hidden; }
.size-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.size-row .tier {
  font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
  background: var(--panel-2); padding: 2px 9px; border-radius: 999px;
}
.town-card .banner b {
  color: var(--ink); font-family: var(--font-display); font-size: 16px; font-weight: 600;
  background: var(--panel); padding: 3px 12px; border-radius: 10px; box-shadow: 0 3px 0 var(--edge);
  max-width: calc(100% - 60px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.town-card .new {
  position: absolute; top: 8px; right: 8px; background: var(--coral); color: #fff; font-family: var(--font-display);
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; box-shadow: 0 2px 0 color-mix(in srgb, var(--coral) 60%, #3a2a18);
}
.town-card .body { padding: 12px 6px 4px; display: grid; gap: 8px; }
.town-card .headline { font-size: 14px; font-weight: 600; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.town-card .enter {
  display: flex; align-items: center; justify-content: space-between; font-family: var(--font-display); font-size: 14px; font-weight: 600;
  color: var(--accent); border-top: 2px dashed var(--line); padding-top: 8px;
}
.town-card .enter span { transition: transform 0.2s; }
.town-card:hover .enter span { transform: translateX(4px); }
.stack { display: flex; }
.stack .avatar { width: 30px; height: 30px; font-size: 11px; box-shadow: 0 0 0 2.5px var(--panel); }
.stack .avatar + .avatar { margin-left: -6px; }
.stack .more { background: var(--soft); color: var(--muted); }
/* Town hues: each town gets its own little palette */
.hue-1 { background: linear-gradient(160deg, #6fbfe0, #11897c); }
.hue-2 { background: linear-gradient(160deg, #f4c14f, #ee8466); }
.hue-3 { background: linear-gradient(160deg, #9ad27a, #3a9a6a); }
.hue-4 { background: linear-gradient(160deg, #c3a6ec, #7d86d8); }

/* Feed posts */
.feed { display: grid; gap: 18px; }
.post { padding: 16px 18px; display: grid; gap: 12px; }
.post-head { display: flex; gap: 12px; align-items: center; }
.post-head .who { flex: 1; min-width: 0; }
.post-head .title { font-weight: 800; font-size: 15.5px; line-height: 1.3; }
.post-head .meta { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.post-head .meta a { color: inherit; font-weight: 800; }
.post .text { margin: 0; font-size: 15.5px; }
.kind-icon { position: relative; flex: none; }
.kind-icon .tag {
  position: absolute; right: -5px; bottom: -5px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; background: var(--panel); box-shadow: 0 0 0 2px var(--line);
}
.news-art { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; }
.convo { display: grid; gap: 8px; padding: 12px 14px; background: var(--panel-2); border-radius: 18px; border: 2px dashed var(--line); }
.convo .line { display: flex; gap: 8px; align-items: flex-end; }
.convo .line.right { flex-direction: row-reverse; }
.convo .avatar { width: 28px; height: 28px; font-size: 11px; }
.convo .bubble {
  max-width: 78%; padding: 8px 13px; border-radius: 18px 18px 18px 5px; background: var(--panel); font-size: 14.5px; font-weight: 600;
  box-shadow: 0 2px 0 var(--edge);
}
.convo .line.right .bubble { background: var(--accent); color: var(--accent-ink); border-radius: 18px 18px 5px 18px; box-shadow: 0 2px 0 var(--accent-deep); }
.post-actions { display: flex; gap: 6px; border-top: 2px dashed var(--line); padding-top: 8px; margin: 0 -6px -4px; }
.post-actions button, .post-actions button:active:not(:disabled) { flex: 1; background: none; color: var(--muted); font-size: 14px; box-shadow: none; transform: none; }
.post-actions button:hover:not(:disabled) { background: var(--hover); color: var(--ink); box-shadow: none; transform: none; }
/* Reactions and comments on posts people wrote */
.post-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; min-height: 20px; }
.post-summary .emojis { letter-spacing: 1px; }
.post-summary .link { color: var(--muted); font-size: 13px; font-weight: 700; height: auto; }
.post-summary + .post-actions { margin-top: -4px; }
.react-wrap { flex: 1; position: relative; display: flex; }
.post-actions .react-wrap > button.react { width: 100%; }
.post-actions button.react.on { color: var(--coral); }
.reaction-picker {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 5; display: flex; gap: 2px; padding: 5px;
  background: var(--panel); border-radius: 999px; border: 2px solid var(--line); box-shadow: var(--shadow-pop);
  animation: pop-in 0.16s cubic-bezier(0.3, 1.4, 0.5, 1); transform-origin: bottom left;
}
.reaction-picker[hidden] { display: none; }
.reaction-picker::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; } /* keeps hover alive on the way down */
.post-actions .reaction-picker button { flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 23px; transition: transform 0.15s cubic-bezier(0.3, 1.8, 0.5, 1); }
.post-actions .reaction-picker button:hover:not(:disabled) { transform: translateY(-4px) scale(1.25); background: none; }
.post-actions .reaction-picker button.on { background: var(--soft); }
.comments { display: grid; gap: 8px; border-top: 2px dashed var(--line); padding-top: 12px; margin-top: -4px; }
.comments .more-comments { justify-self: start; color: var(--muted); font-size: 13px; height: auto; }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment .avatar, .comment-form .avatar { width: 32px; height: 32px; font-size: 11px; flex: none; }
.comment-body { min-width: 0; }
.comment .bubble { background: var(--panel-2); border-radius: 5px 18px 18px 18px; padding: 8px 13px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment .bubble b { display: block; font-size: 13px; font-weight: 800; cursor: pointer; }
.comment-meta { color: var(--muted); font-size: 12px; font-weight: 600; padding: 2px 12px 0; }
.comment-meta .link { font-size: 12px; color: var(--muted); height: auto; }
.comment-form { display: flex; gap: 8px; align-items: center; }
.comment-form input { flex: 1; min-width: 0; border-radius: 999px; }

/* Rail: today's calendar reads like a timetable of little tickets */
ul.today { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 4px; }
ul.today li { display: grid; grid-template-columns: 66px 1fr; gap: 10px; padding: 8px; border-radius: 16px; align-items: start; }
ul.today li:hover { background: var(--hover); }
ul.today time {
  font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums;
  background: var(--accent-soft); border-radius: 10px; padding: 3px 0; text-align: center;
}
ul.today .what { font-weight: 800; font-size: 14px; }
ul.today .who-where { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* Profile schedule: one stacked day per row, the whole week in view */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav .range { font-weight: 800; font-size: 13px; min-width: 7.5em; text-align: center; }
.sched-day { padding: 12px 0 2px; border-top: 2px dashed var(--line); }
.sched-day:first-child { border-top: 0; padding-top: 0; }
.sched-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sched-when { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.sched-when span { color: var(--muted); font-family: var(--font-body); font-weight: 700; font-size: 13px; margin-left: 6px; }
.sched-day.today .sched-when { color: var(--accent); }
ul.sched { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 2px; }
ul.sched li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px; align-items: center; padding: 7px 8px; border-radius: 14px;
}
ul.sched li.now { background: var(--accent-soft); }
ul.sched li.past { opacity: 0.55; }
ul.sched time { font-weight: 800; font-size: 12.5px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sched-title { font-weight: 800; font-size: 14px; overflow-wrap: anywhere; }
.sched-meta { color: var(--muted); font-size: 12px; font-weight: 700; }
.sched-empty { margin: 0 0 6px 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.sched-form { display: grid; gap: 8px; margin: 8px 0 4px; padding: 12px; background: var(--panel-2); border-radius: 16px; }
.sched-row { display: flex; gap: 8px; flex-wrap: wrap; }
.sched-row > * { flex: 1; min-width: 0; width: auto; }
.sched-form input, .sched-form select { margin: 0; }
.rail-link { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; transition: transform 0.15s; }
.rail-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 0 var(--edge); }
.well.accent { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-deep); }

/* Inbox plans: tickets with a torn edge */
.plans { display: grid; gap: 12px; }
.plan {
  position: relative; border: 2px dashed var(--edge); border-radius: 18px; padding: 14px 16px; display: grid; gap: 10px;
  background: var(--panel-2);
}
.plan .title { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.plan .meta { color: var(--muted); font-size: 13px; font-weight: 600; }
.plan .actions { display: flex; gap: 8px; }
.plan .actions button { flex: 1; }

/* Profile: bio, highlights, closeness */
.profile-body { padding: 0 22px 22px; }
.profile-body .bio { margin: 0 0 12px; }
.bio { margin: 8px 0 0; font-size: 15.5px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.preview-row .bio { margin-top: 2px; font-size: 13px; color: var(--muted); }
.bio-add { display: inline-block; margin-bottom: 12px; font-size: 14px; }
.highlights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.highlight, button.highlight:active:not(:disabled) {
  display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 18px; background: var(--panel-2); min-width: 0;
  text-align: left; font-family: var(--font-body); font-weight: 500; justify-content: flex-start; box-shadow: none; border: 2px solid var(--line); transform: none;
}
button.highlight:hover:not(:disabled) { background: var(--soft); box-shadow: 0 3px 0 var(--edge); transform: translateY(-2px); }
.highlight .emoji { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; flex: none; color: #fff; box-shadow: 0 3px 0 rgba(58, 42, 24, 0.2); }
.highlight .label { font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.highlight .value { font-family: var(--font-display); font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.highlight .detail { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.highlight > div { min-width: 0; }
.bond { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; margin-top: 6px; max-width: 160px; }
.bond > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--sun), var(--coral)); }
#reconnect li { cursor: pointer; }
#reconnect .handle { white-space: normal; }
#set-bio { font-size: 15px; font-weight: 600; min-height: 64px; }

/* Profile photos */
.avatar.has-photo { background-size: cover !important; background-position: center !important; color: transparent !important; }
.avatar-wrap { position: relative; flex: none; }
.photo-edit, .photo-edit:active:not(:disabled) {
  position: absolute; right: -2px; bottom: 4px; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: var(--sun); color: #3a2a18; box-shadow: 0 0 0 4px var(--panel); transform: none;
}
.photo-edit:hover:not(:disabled) { background: color-mix(in srgb, var(--sun) 85%, #fff); box-shadow: 0 0 0 4px var(--panel); transform: rotate(-8deg); }
.photo-edit svg.i { width: 18px; height: 18px; }
.photo-row { display: flex; gap: 18px; align-items: center; padding: 4px 0 18px; margin-bottom: 16px; border-bottom: 2px dashed var(--line); }
.photo-row .k { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.avatar.uploading { opacity: 0.5; }

/* Free / busy: a ring that drains as the status runs out (--left: 1 → 0), like a story */
.avatar { position: relative; }
.avatar.st-free { --ring: var(--free); }
.avatar.st-busy { --ring: var(--busy); }
.avatar.st-free::before, .avatar.st-busy::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--ring) calc(var(--left, 1) * 1turn), color-mix(in srgb, var(--ring) 16%, transparent) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
}
.avatar.lg.st-free::before, .avatar.lg.st-busy::before {
  inset: -10px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
}
.status-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.free { background: var(--free); box-shadow: 0 0 0 3px color-mix(in srgb, var(--free) 25%, transparent); }
.status-dot.busy { background: var(--busy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--busy) 25%, transparent); }
.status-control { display: flex; align-items: center; gap: 6px; min-height: 30px; overflow: hidden; margin: 12px 0 0 54px; font-size: 13px; white-space: nowrap; padding-bottom: 3px; }
.profile-body .status-control { margin: 0 0 12px; }
.status-ask { color: var(--muted); font-weight: 700; }
.status-tap { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 999px; font-size: 13px; }
.status-tap::before, .status-on::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.status-tap.free { color: color-mix(in srgb, var(--free) 70%, var(--ink)); }
.status-tap.busy { color: color-mix(in srgb, var(--busy) 80%, var(--ink)); }
.status-tap.free:hover:not(:disabled) { background: color-mix(in srgb, var(--free) 18%, var(--panel)); }
.status-tap.busy:hover:not(:disabled) { background: color-mix(in srgb, var(--busy) 15%, var(--panel)); }
.status-on { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; }
.status-on.free { background: color-mix(in srgb, var(--free) 16%, var(--panel)); color: color-mix(in srgb, var(--free) 62%, var(--ink)); }
.status-on.busy { background: color-mix(in srgb, var(--busy) 13%, var(--panel)); color: color-mix(in srgb, var(--busy) 72%, var(--ink)); }
.status-control .link { font-size: 13px; color: var(--muted); height: 30px; padding: 0 6px; }
.plan .faces { display: flex; gap: 12px; flex-wrap: wrap; }
.plan .face { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.plan .face .avatar { width: 28px; height: 28px; font-size: 11px; }
.plan .nudge { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--panel); padding: 8px 12px; border-radius: 12px; }

/* Days since you crossed paths: a tear-off calendar page */
.days {
  flex: none; display: grid; justify-items: center; min-width: 54px; padding: 0 0 4px; border-radius: 12px; background: var(--panel);
  line-height: 1.1; overflow: hidden; border: 2px solid var(--line); box-shadow: 0 2px 0 var(--edge);
}
.days::before { content: ""; display: block; width: 100%; height: 7px; background: var(--coral); margin-bottom: 3px; }
.days b { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.days span { font-size: 10.5px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.days.new b { font-size: 13px; color: var(--accent); }
[data-person] { cursor: pointer; }

/* Someone else's profile */
#p-status:not(:empty) { margin-bottom: 12px; }
.p-actions { display: flex; gap: 8px; margin-top: 56px; flex-wrap: wrap; justify-content: flex-end; }
.chip.muted { background: var(--soft); color: var(--muted); }
.chip.shared { background: var(--sun); color: #3a2a18; }
.chip.shared::before { content: "★"; font-size: 11px; }
.you-two { display: flex; align-items: center; gap: 16px; font-weight: 700; }
.you-two .bond { flex: 1; max-width: none; height: 12px; margin: 0; border-radius: 6px; }
.private-note { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* Empty states + profile stats */
.empty-state { text-align: center; padding: 36px 24px; }
.empty-state .sub { max-width: 380px; margin: 4px auto 0; }
.empty-art {
  font-size: 40px; width: 84px; height: 84px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 28px;
  background: color-mix(in srgb, var(--sun) 28%, var(--panel)); box-shadow: 0 4px 0 color-mix(in srgb, var(--sun) 55%, var(--edge));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
.stats { display: flex; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); flex-wrap: wrap; }
.stats > span { background: var(--panel-2); border: 2px solid var(--line); padding: 5px 13px; border-radius: 999px; }
.stats b { color: var(--ink); font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-right: 2px; }

/* ---- Settings ---- */
.settings { display: grid; grid-template-columns: 270px 1fr; gap: 18px; align-items: start; }
.settings nav { position: sticky; top: 96px; display: grid; gap: 3px; padding: 10px; }
.settings nav .nav-title { font-size: 25px; font-weight: 600; padding: 6px 10px 10px; }
.settings nav a {
  --tile: var(--sun);
  display: flex; align-items: center; gap: 12px; padding: 7px; border-radius: 16px; color: var(--ink); text-decoration: none; font-weight: 800;
}
.settings nav a:nth-of-type(2) { --tile: var(--coral); }
.settings nav a:nth-of-type(3) { --tile: var(--leaf); }
.settings nav a:nth-of-type(4) { --tile: var(--sky); }
.settings nav a:nth-of-type(5) { --tile: var(--plum); }
.settings nav a:nth-of-type(6) { --tile: #7d86d8; }
.settings nav a:nth-of-type(7) { --tile: var(--accent); }
.settings nav a .well { background: color-mix(in srgb, var(--tile) 22%, var(--panel)); transition: transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1); }
.settings nav a:hover { background: var(--hover); text-decoration: none; }
.settings nav a:hover .well { transform: rotate(-6deg); }
.settings nav a[aria-current="page"] { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--line); }
.settings nav a[aria-current="page"] .well { background: var(--tile); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--tile) 60%, #3a2a18); }
.pane { display: grid; gap: 18px; }
.pane .card > h2 + .sub { margin-bottom: 20px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
.preview-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; border: 2px dashed var(--edge); background: var(--panel-2); }
.preview-row .name { font-weight: 800; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px 0; border-top: 2px dashed var(--line); }
.kv:first-of-type { border-top: none; padding-top: 0; }
.kv .k { font-weight: 800; }
.kv .v { color: var(--muted); font-size: 14px; font-weight: 600; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.danger-zone h2 { color: var(--bad); }
ul.plain { margin: 0; padding-left: 20px; display: grid; gap: 10px; color: var(--ink); font-size: 15px; }
ul.plain li::marker { color: var(--accent); }

.segmented { display: inline-grid; grid-auto-flow: column; background: var(--panel-2); border: 2px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button, .segmented button:active:not(:disabled) { background: none; color: var(--muted); padding: 7px 16px; border-radius: 999px; box-shadow: none; transform: none; }
.segmented button:hover:not(:disabled) { background: none; color: var(--ink); box-shadow: none; transform: none; }
.segmented button[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-deep); }

.character { display: grid; grid-template-columns: 270px 1fr; gap: 22px; align-items: start; }
.stage { position: relative; aspect-ratio: 1; border-radius: 22px; overflow: hidden; border: 2px solid var(--line); box-shadow: var(--shadow); }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage .tag {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 3px 12px; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 13px; white-space: nowrap; box-shadow: 0 3px 0 rgba(58, 42, 24, 0.2);
}
.stage .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.stage canvas { cursor: grab; touch-action: none; }
.stage canvas:active { cursor: grabbing; }
.stage .drag-hint {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); padding: 4px 11px; border-radius: 999px; white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--panel) 85%, transparent); pointer-events: none;
}
.wheel-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.wheel { position: relative; width: 170px; height: 170px; flex: none; }
.wheel canvas { width: 100%; height: 100%; border-radius: 50%; cursor: crosshair; touch-action: none; display: block; box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--line); }
.wheel canvas:focus-visible { outline: 3px solid var(--sun); outline-offset: 5px; }
.wheel-dots, .wheel-pick { position: absolute; inset: 0; pointer-events: none; }
.wheel-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: auto; }
.wheel-pick { width: 24px; height: 24px; inset: auto; margin: -12px 0 0 -12px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px #3a2a18, 0 3px 6px rgba(0, 0, 0, 0.3); }
.wheel-side { flex: 1; min-width: 150px; }
.wheel-side input[type="range"] { padding: 0; border: none; background: none; accent-color: var(--accent); box-shadow: none; }
dialog.wide-dialog { width: min(520px, calc(100vw - 32px)); }
.tag-preview { padding: 4px 13px; border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: 13px; box-shadow: 0 3px 0 rgba(58, 42, 24, 0.2); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; vertical-align: 0; margin-right: 5px; box-shadow: 0 0 0 2px var(--panel); }
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; }
button.look, button.look:active:not(:disabled) {
  padding: 0; aspect-ratio: 1; border-radius: 18px; background: var(--panel-2); overflow: hidden; display: grid; place-items: center;
  font-size: 12px; color: var(--muted); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--edge);
}
button.look:hover:not(:disabled) { background: var(--soft); box-shadow: 0 4px 0 var(--edge); }
button.look img { width: 100%; height: 100%; object-fit: cover; }
button.look[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 3px 0 var(--accent-deep), 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); background: var(--accent-soft); }

details { border-top: 2px dashed var(--line); padding: 14px 0; }
details:first-of-type { border-top: none; padding-top: 0; }
summary { cursor: pointer; font-weight: 800; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+"; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--soft); color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 18px; transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); background: var(--accent); color: var(--accent-ink); }
details p { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; font-weight: 600; }

/* ---- Dialog + toasts ---- */
dialog {
  border: 2px solid var(--line); border-radius: 26px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop);
}
dialog:focus, dialog:focus-visible, dialog form:focus, dialog form:focus-visible { outline: none; }
dialog[open] { animation: pop-in 0.2s cubic-bezier(0.3, 1.4, 0.5, 1); }
dialog::backdrop { background: rgba(74, 57, 40, 0.35); backdrop-filter: blur(3px); }
:root[data-theme="dark"] dialog::backdrop { background: rgba(10, 12, 28, 0.6); }
dialog form { padding: 24px; margin: 0; }
dialog h2 {
  margin: -24px -24px 18px; padding: 18px 24px 16px; font-size: 22px; font-weight: 600; text-align: center;
  background: var(--panel-2); border-bottom: 2px dashed var(--line);
}
dialog p { margin: 0 0 16px; color: var(--muted); font-size: 15px; font-weight: 600; }
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 8px; z-index: 50; width: max-content; max-width: calc(100vw - 40px); }
.toast {
  position: relative; padding: 12px 18px 12px 46px; border-radius: 18px; background: var(--panel); color: var(--ink);
  font-size: 15px; font-weight: 700; border: 2px solid var(--line); box-shadow: var(--shadow-pop);
  animation: toast-in 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.toast::before {
  content: "✓"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 800;
}
.toast.error::before { content: "!"; background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.9); } }

@media (max-width: 1040px) {
  .feed-layout { grid-template-columns: minmax(0, 620px); }
  .rail { position: static; }
  .rail .card:first-child:has(#no-today:not([hidden])) { display: none; }
}
@media (max-width: 900px) {
  .navtabs a { padding: 6px; }
  .navtabs a > span:not(.tab-icon) { display: none; }
  .settings { grid-template-columns: 1fr; }
  .settings nav { position: static; display: flex; overflow-x: auto; padding: 8px; }
  .settings nav .nav-title { display: none; }
  .settings nav a { white-space: nowrap; flex: none; padding-right: 14px; }
  .character { grid-template-columns: 1fr; }
  .stage { max-width: 290px; width: 100%; margin: 0 auto; }
  .field-grid { grid-template-columns: 1fr; }
}
/* Phones: the tabs become a floating dock at the bottom, like a phone's app bar */
@media (max-width: 640px) {
  .appbar { grid-template-columns: 1fr auto; height: 62px; padding: 0 14px; }
  #account-menu { top: calc(100% + 28px); }
  .navtabs {
    position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 25;
    padding: 8px; gap: 8px; border-radius: 24px; background: var(--panel); border: 2px solid var(--line); box-shadow: var(--shadow-pop);
  }
  .navtabs a { padding: 0; }
  .tab-icon { width: 50px; height: 50px; border-radius: 16px; }
  .page { padding-bottom: 110px; }
  .toasts { bottom: 100px; }
}
@media (max-width: 480px) {
  .appbar .logo .wordmark { font-size: 24px; }
  .page { padding: 18px 10px 110px; }
  .card { padding: 18px; }
  .card.profile-card { padding: 0; }
  .profile-card .cover { height: 108px; }
  .me { flex-wrap: wrap; gap: 12px; padding: 0 18px 16px; }
  .me .who { padding-top: 48px; }
  .me .name { font-size: 23px; }
  .me > button { order: 3; width: 100%; margin-top: 0; }
  .p-actions { order: 3; width: 100%; margin-top: 0; justify-content: stretch; }
  .p-actions button { flex: 1; }
  .profile-body { padding: 0 18px 18px; }
  .avatar.lg { width: 84px; height: 84px; font-size: 30px; }
  .highlights { grid-template-columns: 1fr; }
  .kv { flex-wrap: wrap; }
  .hello { padding: 20px 18px 56px; }
  .hello h1, .hello p { max-width: 100%; }
  .hello.scene { --orb-at: 92% 14%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---- Friend checklists (create a town, invite friends) ---- */
.field-label { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 6px 0 8px; }
ul.people li.pick { cursor: pointer; }
ul.people li.pick[aria-checked="true"] { background: var(--accent-soft); }
ul.people li.pick:focus-visible { outline: 3px solid var(--sun); outline-offset: -3px; }
ul.people li.pick input[type="checkbox"] { width: 22px; height: 22px; flex: none; margin: 0; padding: 0; accent-color: var(--accent); pointer-events: none; box-shadow: none; }
ul.people li.pick.locked { cursor: default; opacity: 0.55; }
ul.people li.pick.locked:hover { background: none; }
dialog ul.people.scroll { max-height: 240px; }
/* Long dialogs scroll inside themselves */
dialog.wide-dialog form { max-height: calc(100vh - 48px); overflow-y: auto; }
#create-prompt { font-size: 15px; font-weight: 600; }

/* ---- Toggle chips (pick places and looks when creating a town) ---- */
button.chip.toggle { padding: 6px 13px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--soft); color: var(--ink); box-shadow: 0 2px 0 var(--soft-edge); }
button.chip.toggle:hover:not(:disabled) { background: var(--soft-hover); box-shadow: 0 3px 0 var(--soft-edge); }
button.chip.toggle[aria-pressed="true"], button.chip.toggle[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-deep); }
button.chip.toggle:disabled { opacity: 0.4; cursor: default; }

/* ---- Towns card: header actions and the "create a town" tile ---- */
.head-actions { display: flex; align-items: center; gap: 14px; }
.town-card.create-tile, .town-card.create-tile:hover:not(:disabled), .town-card.create-tile:active:not(:disabled) {
  display: grid; place-items: center; align-content: center; gap: 8px; min-height: 230px; padding: 16px; text-align: center;
  background: transparent; border: 3px dashed var(--edge); box-shadow: none; color: var(--muted); font-family: var(--font-display); font-weight: 600;
}
.town-card.create-tile:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.create-tile .plus {
  width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center; background: var(--sun); color: #3a2a18;
  font-size: 30px; font-weight: 600; box-shadow: 0 4px 0 var(--sun-deep, #d99a1e); transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.create-tile:hover .plus { transform: rotate(90deg); }
.create-tile .hint { font-family: var(--font-body); font-weight: 600; }

/* Pin and "+" (invite friends) in the top-right of a town card, solid so they read over the town art */
.town-card .card-tools { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; }
.town-card .card-tool { position: relative; width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center;
  background: var(--panel); color: var(--accent); box-shadow: 0 3px 0 var(--edge); cursor: pointer; transition: transform 0.12s, background 0.12s, opacity 0.12s; }
.town-card .card-tool:hover, .town-card .card-tool:focus-visible { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); outline: none; }
.town-card .card-tool:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
/* Two bars crossing at the exact centre (a text "+" sits off-center depending on the font) */
.town-card .invite-plus::before, .town-card .invite-plus::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 3px; border-radius: 2px;
  background: currentColor; transform: translate(-50%, -50%); }
.town-card .invite-plus::after { transform: translate(-50%, -50%) rotate(90deg); }
/* The pin: faint until you hover the card (always shown on touch screens), solid once pinned */
.town-card .banner .card-tool svg { position: static; inset: auto; display: block; } /* not the full-banner art rule */
.town-card .card-tool.pin svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(35deg); }
.town-card .card-tool.pin:not(.on) { color: var(--muted); }
@media (hover: hover) { .town-card:not(:hover):not(:focus-within) .card-tool.pin:not(.on) { opacity: 0; } }
.town-card .card-tool.pin.on { background: var(--coral); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--coral) 60%, #3a2a18); }
.town-card .card-tool.pin.on svg { fill: currentColor; }
/* "N new" moves to the top-left, clear of the pin and + and the name */
.town-card .banner .new { top: 8px; bottom: auto; right: auto; left: 8px; }
.town-search { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0 16px; border-radius: 999px; background: var(--input); border: 2px solid var(--line); }
.town-search svg { width: 17px; height: 17px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; }
.town-search input, .town-search input:focus, .town-search input:hover:not(:disabled):not(:focus) { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; box-shadow: none; outline: none; }
.town-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
button.pin-toggle { display: inline-flex; align-items: center; gap: 5px; }
button.pin-toggle svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
button.pin-toggle.on { color: #fff; background: var(--coral); box-shadow: 0 3px 0 color-mix(in srgb, var(--coral) 60%, #3a2a18); }
button.pin-toggle.on svg { fill: currentColor; }

/* Create-town review: the whole designed map, drawn from its tiles (townart.js) */
.review-art { aspect-ratio: 760 / 470; border-radius: 20px; display: grid; place-items: center; overflow: hidden; margin: 4px 0 10px; border: 2px solid var(--line); }
.review-art img { width: 100%; height: 100%; display: block; }
.review-art .busy-note { color: #2f4a3a; font-size: 14px; font-weight: 700; text-align: center; background: rgba(255, 252, 244, 0.8); padding: 14px 18px; border-radius: 16px; }
.review-art .busy-note .spinner { margin: 0 auto 12px; }
#review-places { margin-bottom: 10px; }
.look-row { margin-bottom: 8px; }
#review-places .chip.look { font-weight: 800; }

/* ---- Desk decor: sticky notes, a lamp and a little garden in the empty space beside the page (app/decor.js) ----
   Each side is as wide as the gap next to the page for the current view; below 190px the side shows nothing. */
.page { position: relative; z-index: 1; pointer-events: none; } /* full width, so let clicks through to the notes beside the column */
.page > * { pointer-events: auto; }
.decor { --shell: 440px; --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive; }
body:has(#shell.home) .decor { --shell: 1000px; }
body:has(#shell.wide) .decor { --shell: 940px; }
body:has(#shell.feed) .decor { --shell: 640px; }
.decor-side {
  position: fixed; top: 72px; bottom: 0; z-index: 0; width: max(0px, calc((100vw - var(--shell)) / 2 - 20px));
  container-type: inline-size; overflow: hidden; pointer-events: none;
}
.decor-side.left { left: 0; }
.decor-side.right { right: 0; }
.decor-side.right .decor-notes { margin-left: auto; } /* anchored to the screen edge, not the page, so they stay put between tabs */
.decor-side > * { transition: opacity 0.3s; }
@container (max-width: 150px) { .decor-notes { display: none; } }
@container (max-width: 190px) { .decor-ground, .decor-sky { display: none; } }
/* Narrow gaps (small laptops): smaller notes instead of none */
@container (max-width: 240px) {
  .decor-notes { padding: 36px 10px 0; gap: 22px; }
  .sticky, .sticky:hover:not(:disabled), .sticky:active:not(:disabled) { font-size: 18px; padding: 22px 12px 12px; }
  .sticky-foot { font-size: 14px; }
  .sticky-kicker { font-size: 10.5px; }
  .check-item, .check-item:hover:not(:disabled), .check-item:active:not(:disabled) { font-size: 18px; gap: 7px; }
  .check-item .box { width: 15px; height: 15px; }
  .sticky .tape { width: 60px; }
}
.decor-notes {
  position: relative; z-index: 2; display: grid; justify-items: center; gap: 30px; padding: 44px 22px 0;
  width: min(100%, 264px);
}
.decor-ground { position: absolute; left: 0; bottom: 0; width: 300px; height: auto; /* narrow enough that the lamp and trees stay whole in a small gap */ max-height: 38vh; z-index: 1; }
.lamp-scene { max-height: 52vh; bottom: 30px; }
.decor-side.right .decor-ground { left: auto; right: 0; }
.lamp-light { fill: var(--orb); opacity: 0.12; }
.lamp-halo { fill: var(--orb-glow); opacity: 0.5; }
.lamp-bulb { fill: #ffd76a; }
:root[data-theme="dark"] .lamp-light { opacity: 0.2; }
:root[data-theme="dark"] .lamp-halo { opacity: 1; animation: flicker 5s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.85; } 50% { opacity: 0.6; } 53% { opacity: 0.9; } }
@media (max-height: 720px) { .decor-ground { display: none; } }
@media (max-height: 560px) { .sticky.list { display: none; } }

/* Sticky notes: handwritten, taped or pinned, a little crooked, straighten up when you point at them */
.sticky, .sticky:hover:not(:disabled), .sticky:active:not(:disabled) {
  --paper: #fff1a6; --paper-2: #f7e27d;
  position: relative; display: grid; gap: 6px; justify-items: start; width: 100%; max-width: 220px; padding: 26px 18px 16px;
  background: linear-gradient(170deg, var(--paper) 70%, var(--paper-2)); color: #4a3928; text-align: left;
  font-family: var(--font-hand); font-weight: 600; font-size: 23px; line-height: 1.12; letter-spacing: 0;
  border-radius: 3px 3px 18px 3px; box-shadow: 0 14px 20px -12px rgba(80, 58, 26, 0.45), 0 2px 0 rgba(80, 58, 26, 0.08);
  transform: rotate(var(--tilt, -3deg)); transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1), box-shadow 0.25s;
  pointer-events: auto; cursor: default;
}
button.sticky { cursor: pointer; }
.sticky:hover { --tilt: 0deg !important; transform: rotate(0deg) translateY(-4px) scale(1.03) !important; box-shadow: 0 22px 26px -14px rgba(80, 58, 26, 0.5) !important; }
.sticky.pink { --paper: #ffd6d0; --paper-2: #f9bdb3; --tilt: 2.5deg; }
.sticky.blue { --paper: #cfeefa; --paper-2: #b3e0f2; --tilt: 3deg; }
:root[data-theme="dark"] .sticky { filter: brightness(0.86) saturate(0.9); }
.sticky::after { /* the curled-up corner */
  content: ""; position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; border-radius: 0 0 18px 0;
  background: linear-gradient(315deg, transparent 45%, rgba(0, 0, 0, 0.08) 50%, var(--paper-2) 56%);
}
.sticky .tape {
  position: absolute; top: -11px; left: 50%; width: 78px; height: 24px; transform: translateX(-50%) rotate(-4deg);
  background: rgba(255, 255, 255, 0.55); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); border-left: 2px dotted rgba(0, 0, 0, 0.06); border-right: 2px dotted rgba(0, 0, 0, 0.06);
}
.sticky .pin {
  position: absolute; top: 8px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff9a8a, #d6503f 60%); box-shadow: 0 3px 3px rgba(0, 0, 0, 0.25);
}
.sticky-kicker { font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; }
.sticky-foot { font-size: 17px; opacity: 0.55; margin-top: 2px; }
.sticky.flip { animation: note-flip 0.34s ease-in-out; }
@keyframes note-flip { 50% { transform: rotate(var(--tilt, -3deg)) rotateX(80deg); } }

/* The weekly checklist: hand-drawn boxes you can tick */
#week-list { display: grid; gap: 4px; width: 100%; }
.check-item, .check-item:hover:not(:disabled), .check-item:active:not(:disabled) {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 2px 0; background: none; box-shadow: none; transform: none;
  font-family: var(--font-hand); font-weight: 600; font-size: 22px; color: #4a3928; justify-content: flex-start; text-align: left; border-radius: 6px;
}
.check-item .box { position: relative; width: 18px; height: 18px; flex: none; border: 2.5px solid #4a3928; border-radius: 4px 6px 3px 5px; opacity: 0.7; }
.check-item[aria-pressed="true"] { text-decoration: line-through; text-decoration-thickness: 2px; color: rgba(74, 57, 40, 0.55); }
.check-item[aria-pressed="true"] .box::after {
  content: "✓"; position: absolute; left: 1px; top: -12px; font-size: 26px; font-weight: 700; color: var(--good);
  animation: tick 0.25s cubic-bezier(0.3, 1.8, 0.5, 1);
}
@keyframes tick { from { transform: scale(0.2) rotate(-30deg); } }
.check-item:focus-visible { outline: 2px dashed #4a3928; outline-offset: 2px; }

/* Sky: clouds drifting by day, fireflies at night */
.decor-sky { position: absolute; inset: 0; z-index: 0; }
.cloud {
  position: absolute; width: 90px; height: 28px; border-radius: 20px; background: var(--panel); opacity: 0.9;
  box-shadow: 0 4px 0 var(--edge); animation: drift 60s linear infinite;
}
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 40px; height: 40px; left: 14px; top: -20px; }
.cloud::after { width: 30px; height: 30px; left: 44px; top: -13px; }
.cloud.c1 { top: 58%; animation-duration: 75s; animation-delay: -20s; }
.cloud.c2 { top: 72%; transform: scale(0.7); animation-duration: 95s; animation-delay: -60s; }
.cloud.c3 { top: 54%; animation-duration: 85s; animation-delay: -40s; }
@keyframes drift { from { left: -120px; } to { left: 100%; } }
.fly { display: none; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #ffe98a; box-shadow: 0 0 10px 3px rgba(255, 233, 138, 0.7); animation: float 7s ease-in-out infinite; }
:root[data-theme="dark"] .cloud { display: none; }
:root[data-theme="dark"] .fly { display: block; }
.fly.f1 { left: 20%; top: 62%; } .fly.f2 { left: 70%; top: 70%; animation-delay: -2s; animation-duration: 9s; } .fly.f3 { left: 45%; top: 78%; animation-delay: -4s; }
.fly.f4 { left: 30%; top: 60%; animation-delay: -1s; } .fly.f5 { left: 75%; top: 66%; animation-delay: -5s; animation-duration: 10s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); opacity: 0.3; } 30% { opacity: 1; } 50% { transform: translate(18px, -24px); } 80% { transform: translate(-10px, -8px); opacity: 0.9; } }
/* One rounded hill across the whole side, under the props, so the ground never ends in a hard edge */
.decor-side::after {
  content: ""; position: absolute; left: -110px; width: 560px; bottom: -70px; height: 160px; z-index: 0; border-radius: 50% 50% 0 0;
  background: var(--hill-2); box-shadow: inset 0 22px 0 -8px var(--hill-1);
}
@container (max-width: 190px) { .decor-side::after { display: none; } }
.decor-side.right::after { left: auto; right: -110px; }
@media (max-height: 720px) { .decor-side::after { display: none; } }

/* ---- Phones and touch screens ---- */
button, a, [role="button"], li[data-person], ul.latest li, ul.today li { -webkit-tap-highlight-color: transparent; }
/* Touch has no hover: a tap would leave cards tilted and buttons lifted until the next tap elsewhere */
@media (hover: none) {
  button:hover:not(:disabled) { transform: none; }
  .town-card:hover:not(:disabled):not(:has(.card-tool:hover)),
  .town-card:nth-child(even):hover:not(:disabled):not(:has(.card-tool:hover)) { transform: none; box-shadow: 0 4px 0 var(--edge); }
  .town-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
  .navtabs a:hover .tab-icon, .settings nav a:hover .well { transform: none; }
  .navtabs a[aria-current="page"] .tab-icon { transform: translateY(-2px); }
}
/* Bigger tap targets for fingers */
@media (pointer: coarse) {
  .status-tap, .status-on { height: 36px; padding: 0 15px; font-size: 14px; }
  .status-control { min-height: 38px; }
  button.small { padding: 9px 14px; }
  .post-actions button { padding: 11px 8px; }
  ul.people li, ul.latest li, ul.today li { padding: 10px 8px; }
  .comment-form input { padding: 11px 15px; }
}
@media (max-width: 640px) {
  /* iOS zooms into any text field under 16px; 16px keeps the page still */
  input, select, textarea, .composer-open { font-size: 16px !important; }
  /* The dock clears the iPhone home indicator, and gets out of the way while the keyboard is up */
  .navtabs { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .page { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  body:has(input:focus, textarea:focus, select:focus) .navtabs { display: none; }
  .appbar { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .toasts { bottom: calc(100px + env(safe-area-inset-bottom)); }

  /* Dialogs become bottom sheets: full width, sliding up, scrolling inside */
  dialog, dialog.wide-dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 26px 26px 0 0; border-bottom: none;
    max-height: 92dvh; animation: sheet-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  dialog form, dialog.wide-dialog form { max-height: 92dvh; overflow-y: auto; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); }
  dialog h2 { margin: -22px -18px 16px; position: sticky; top: -22px; z-index: 2; }
  dialog .actions-row { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 12px -18px calc(-18px - env(safe-area-inset-bottom));
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 2px dashed var(--line); }
  dialog .actions-row > button { flex: 1; }
  dialog .actions-row > span[style*="flex:1"] { display: none; }
  #review-dialog .actions-row { display: grid; grid-template-columns: 1fr 1fr; }
  #review-dialog .actions-row #review-ok { grid-column: 1 / -1; order: -1; }

  /* Profile header: photo on top, name under it, button full width */
  .me { flex-direction: column; align-items: flex-start; gap: 10px; }
  .me .who { padding-top: 0; }
  .me > button, .p-actions { width: 100%; margin-top: 0; }
  .p-actions button { flex: 1; }
  .profile-body .status-control:empty { display: none; }

  /* Rows with two buttons: let the buttons drop under the name instead of squeezing it */
  ul.people li:has(.actions > :nth-child(2)) { flex-wrap: wrap; }
  ul.people li:has(.actions > :nth-child(2)) .actions { width: 100%; padding-left: 54px; }
  ul.people li:has(.actions > :nth-child(2)) .actions > * { flex: 1; }
  .card-head { gap: 8px; }
  .head-actions { gap: 10px; }
  .hello-actions { gap: 8px; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (max-width: 360px) {
  .navtabs { gap: 5px; padding: 6px; }
  .tab-icon { width: 46px; height: 46px; }
  .card { padding: 16px; }
  .hello h1 { font-size: 24px; }
}

/* ---- Interactive desk: drag the notes around (app/decor.js) ---- */
.decor [data-note] { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.decor [data-note].dragging, .decor [data-note].dragging:hover {
  cursor: grabbing; transition: none !important; transform: rotate(0deg) scale(1.06) !important;
  box-shadow: 0 28px 34px -14px rgba(80, 58, 26, 0.55) !important;
}

/* A profile you haven't opened before: the header shows at once, placeholder lines stand in for the rest */
#view-person.loading .profile-body::after {
  content: ""; display: block; height: 58px; border-radius: 12px; margin-top: 4px;
  background: linear-gradient(90deg, var(--soft) 25%, var(--panel-2) 50%, var(--soft) 75%) 0 0 / 200% 100%;
  -webkit-mask: linear-gradient(#000 0 14px, transparent 14px 22px, #000 22px 36px, transparent 36px 44px, #000 44px) 0 0 / 70% 100% no-repeat;
  mask: linear-gradient(#000 0 14px, transparent 14px 22px, #000 22px 36px, transparent 36px 44px, #000 44px) 0 0 / 70% 100% no-repeat;
  animation: shimmer 1.2s linear infinite;
}
#view-person.loading #p-name:empty::before { content: ""; display: inline-block; width: 160px; height: 24px; border-radius: 8px; background: var(--soft); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Instagram / Facebook links on profiles */
.socials { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.socials a {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  border: 2px solid var(--line); background: var(--panel-2); color: inherit; text-decoration: none; font-size: 13px; font-weight: 700;
}
.socials a:hover { border-color: var(--accent); color: var(--accent); }
.socials a .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.socials a.fb .i { fill: currentColor; stroke: none; }
