/* Spaces (brand book "Spaces"): picture tiles, a space's own page, its sheets. Reuses the app's tokens, .switch and .primary. */
.spaces-head { display: flex; align-items: center; justify-content: space-between; }
.spaces-head .owen { width: 56px; flex: 0 0 auto; }
.spaces-find { position: relative; margin: 0 0 14px; }
.spaces-find .icon { position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.spaces-find input { width: 100%; min-height: 44px; padding: 8px 12px 8px 38px; border-radius: 12px; font-size: 16px; }
.space-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 720px) { .space-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; } }
.space-tile { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; }
.space-tile[hidden] { display: none; }
.space-open { display: block; color: inherit; text-decoration: none; }
.space-cover { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.space-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.space-cover b { padding: 0 12px; font-size: var(--text-lg); font-weight: 650; overflow-wrap: anywhere; text-align: center; color: var(--ink-2); }
.space-foot { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; }
.space-name { flex: 0 1 auto; min-width: 0; overflow: hidden; font-size: var(--text-md); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.space-onfeed { flex: 0 0 auto; width: 16px; height: 16px; color: var(--accent); }
.space-dots { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; margin: -8px -8px -8px auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; }
.space-dots .icon { width: 20px; height: 20px; }
.space-tile.is-new .space-cover { border-style: dashed; background: none; color: var(--muted); }
.space-tile.is-new .icon { width: 28px; height: 28px; }
.space-tile.is-feed .space-cover .icon { width: 32px; height: 32px; color: var(--muted); }
.space-tile.is-new { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .space-open:hover .space-cover, .space-tile.is-feed:hover .space-cover, .space-tile.is-new:hover .space-cover { border-color: var(--accent); } }

.space-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 680px; margin: 0 auto 18px; }
.space-head.has-cover { align-items: flex-end; min-height: 140px; padding: 14px; overflow: hidden; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); }
.space-head h1 { position: relative; margin: 0; min-width: 0; overflow: hidden; font-size: var(--text-xl); text-overflow: ellipsis; white-space: nowrap; }
.space-head-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.space-head.has-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 20%, rgb(0 0 0 / .65)); }
.space-head.has-cover h1, .space-head.has-cover .space-dots { color: #fff; }
.space-head .space-dots, .space-head h1 { position: relative; z-index: 1; }
.space-head .space-dots { margin: -6px -6px -6px 0; }
.space-lead { margin: 0 0 22px; }
.lead-list { display: grid; gap: 4px; margin: 0 0 6px; padding: 0; list-style: none; }
.lead-list a { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.lead-list img { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.lead-list span { display: grid; gap: 2px; min-width: 0; }
.lead-list b { display: -webkit-box; overflow: hidden; font-size: var(--text-md); font-weight: 600; line-height: 1.35; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead-list small { color: var(--muted); font-size: var(--text-xs); }
.space-more { display: flex; align-items: center; justify-content: space-between; min-height: 52px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--text-md); font-weight: 600; text-decoration: none; }
.space-more .icon { width: 18px; height: 18px; transform: rotate(-90deg); color: var(--muted); }
.space-quiet { color: var(--muted); }
.space-empty .start-head { margin-top: 0; }

.space-form, .space-menu { display: grid; gap: 10px; padding: 4px 2px 8px; }
.space-form-title { margin: 0; font-size: var(--text-lg); letter-spacing: -.01em; }
.space-name-input, .space-new-inline input { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 12px; font-size: 16px; }
.space-picks { display: grid; gap: 2px; max-height: 40dvh; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.space-picks label { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: var(--text-md); }
.space-picks input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--accent); }
.space-picks span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-picks small { color: var(--muted); font-size: var(--text-xs); }
.space-form .primary, .space-new-inline .primary { min-height: 44px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--accent); color: var(--surface); font: 600 var(--text-sm) var(--ui); }
.space-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: var(--text-md); font-weight: 500; }
.space-switch > span:first-child { min-width: 0; }
.space-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 48px; padding: 0; border: 0; background: none; color: var(--ink); font: 500 var(--text-md) var(--ui); text-align: left; text-decoration: none; cursor: pointer; }
.space-row.on { color: var(--accent); font-weight: 600; }
.space-row .icon { width: 18px; height: 18px; }
.space-row.danger { color: var(--bad, #c0392b); }
.space-new-inline { display: flex; gap: 8px; margin-top: 6px; }
.space-new-inline input { flex: 1; min-width: 0; }

/* Owen's walk line: a speech bubble beside the page's Owen, or (walk-coach) a small Owen with it above the bottom bar. */
.space-walk { display: flex; align-items: center; gap: 4px; margin: 0; padding: 8px 6px 8px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--card-shadow); color: var(--ink); font-size: var(--text-sm); font-weight: 600; line-height: 1.4; }
.space-walk[hidden], .walk-coach[hidden] { display: none; }
.spaces-head > div { flex: none; }
.spaces-head .space-walk { flex: 0 1 auto; min-width: 0; margin-left: auto; border-bottom-right-radius: 6px; }
.walk-coach { position: fixed; z-index: 39; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.walk-coach .owen { flex: 0 0 auto; width: 44px; }
.walk-coach .space-walk { border-bottom-left-radius: 6px; pointer-events: auto; }
@media (min-width: 720px) { .walk-coach { left: auto; right: 32px; bottom: 32px; } }
.walk-ring { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 14px; animation: walk-pulse 1.6s ease-in-out infinite; }
.space-dots.walk-ring { outline-offset: -5px; border-radius: 50%; }
@keyframes walk-pulse { 50% { outline-color: color-mix(in srgb, var(--accent) 30%, transparent); } }
@media (prefers-reduced-motion: reduce) { .walk-ring { animation: none; } }
.lib-space { color: var(--muted); }
.space-pack { flex-wrap: wrap; }
.space-pack > span:not(.owen) { flex: 1 1 0; min-width: 0; }
.space-pack form { flex-basis: 100%; margin: 0 0 0 52px; }
.find-box.walk-ring { border-radius: 18px; }
