/* LittleSpaceHub v4 additions — builds on main.css tokens */
.hide, [hidden] { display: none !important; }
main { padding: 16px 0 40px; }
main.bare { padding: 0; }
.container.narrow { max-width: 640px; }
.container > * { min-width: 0; }
img { max-width: 100%; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 8px 0 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.dl { justify-content: flex-start !important; }
.swatch-row { align-items: center; }
form.inline { display: inline; }

/* header icons */
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; font-size: 18px; text-decoration: none !important; border: 1.5px solid var(--border-2); background: var(--card); }
.icon-btn:hover { border-color: var(--brand); }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; margin-left: auto; }
.btn.active { background: var(--ring); border-color: var(--brand); color: var(--brand); }
.btn-danger { border-color: rgba(239,68,68,0.5); color: #dc2626; }
.btn-danger:hover { background: rgba(239,68,68,0.1); border-color: #dc2626; color: #dc2626; }
.btn-soft { background: var(--ring); border-color: transparent; color: var(--brand); }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 200; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(300px, 86vw); background: var(--card); padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-lg); }
.drawer-panel .section-title { margin: 8px 0 2px; }
.drawer-me { justify-content: flex-start; padding: 6px 12px; font-size: 13px; text-decoration: none !important; }
.drawer-grid { display: grid; gap: 6px; }
.drawer-grid .btn { justify-content: flex-start; }

/* notices */
.announce { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-md); margin-bottom: 12px; background: var(--card-2); border: 1px solid var(--border-2); font-size: 14px; color: var(--text); }
.announce.warn { background: rgba(251,191,36,0.14); border-color: rgba(251,191,36,0.45); }
.announce.party { background: linear-gradient(90deg, var(--ring), rgba(251,191,36,0.15)); }
.alert-warn { background: rgba(251,191,36,0.14); border: 1px solid rgba(251,191,36,0.45); color: var(--text); }
.alert-info { background: var(--card-2); border: 1px solid var(--border-2); color: var(--text); }
.impersonate { background: #fbbf24; color: #3a2600; padding: 8px 16px; font-weight: 700; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }

/* forms */
input[type="number"], input[type="time"], input[type="date"], input[type="datetime-local"], input[type="url"], input[type="tel"] {
  width: 100%; padding: 10px 14px; background: var(--card); color: var(--text); border: 1.5px solid var(--border-2); border-radius: var(--r-md);
  font-family: 'Nunito', sans-serif; font-size: 14px; outline: none;
}
input[type="file"] { font-size: 13px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.choice-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; }
.choice { position: relative; display: block; cursor: pointer; margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border: 1.5px solid var(--border-2); border-radius: var(--r-md); background: var(--card-2); color: var(--text); font-weight: 700; text-align: center; font-size: 14px; }
.choice span small { font-weight: 600; color: var(--muted); font-size: 11px; }
.choice span em { font-style: normal; font-size: 24px; }
.choice input:checked + span { border-color: var(--brand); background: var(--ring); color: var(--brand); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }
.legal-box { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; display: grid; gap: 8px; }
.honeypot { position: absolute !important; left: -9999px !important; height: 0; overflow: hidden; }
.emoji-input { max-width: 90px; text-align: center; font-size: 20px !important; }

/* lists & tables */
.list { display: grid; gap: 0; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: none; }
.list-item .av { font-size: 26px; width: 40px; text-align: center; flex-shrink: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; color: var(--text); }
.list-item .sub { font-size: 12px; color: var(--muted); }
.list-item.unread .title::after { content: ' •'; color: var(--brand); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .big { font-size: 42px; display: block; margin-bottom: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--border-2); background: var(--card-2); font-size: 13px; font-weight: 700; color: var(--text-2); text-decoration: none !important; cursor: pointer; }
.chip.on, .chip:hover { border-color: var(--brand); background: var(--ring); color: var(--brand); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 10px; }
.stat { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; }
.stat .n { font-family: 'Baloo 2', cursive; font-size: 1.6rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 700; }

/* hero */
.hero-card { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); border: none; color: #fff; }
.hero-card h1, .hero-card h2, .hero-card p { color: #fff; }
.hero-card p { opacity: .9; }
.hero-grid { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; }
.btn-glass { background: rgba(255,255,255,0.2) !important; border-color: rgba(255,255,255,0.4) !important; color: #fff !important; }
.glass { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); border-radius: var(--r-lg); padding: 14px; }
@media (max-width: 640px) { .hero-grid { grid-template-columns: minmax(0,1fr); } }

/* landing */
.landing-hero { text-align: center; padding: 40px 0 24px; }
.landing-hero .big { font-size: 64px; line-height: 1; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; }
.feature { text-align: left; }
.feature .i { font-size: 28px; }

/* auth */
.auth-card { margin: 24px auto; }
.auth-card.wide { max-width: 560px; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 220px); min-height: 360px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 2px; }
.msg { max-width: 78%; padding: 8px 12px; border-radius: 16px; background: var(--card-2); border: 1px solid var(--border); color: var(--text); word-wrap: break-word; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--brand); border-color: var(--brand); color: #fff; }
.msg .t { display: block; font-size: 10px; opacity: .7; margin-top: 2px; }
.msg .stk { font-size: 34px; line-height: 1.1; display: block; }
.chat-form { display: flex; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-form textarea { min-height: 44px; height: 44px; resize: none; }
.sticker-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px 0; }
.sticker-bar button { font-size: 22px; background: none; border: none; cursor: pointer; padding: 2px 4px; border-radius: 8px; }
.sticker-bar button:hover { background: var(--card-2); }
.typing { font-size: 12px; color: var(--muted); min-height: 16px; }

/* status board / stories */
.post { display: flex; gap: 10px; }
.post .av { font-size: 28px; flex-shrink: 0; }
.post .meta { font-size: 12px; color: var(--muted); }
.post .text { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.post-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.story-body { font-size: 16px; line-height: 1.8; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.cover { font-size: 56px; line-height: 1; }

/* stuffies */
.stuffie-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.stuffie-card { text-align: center; }
.stuffie-card .ph { width: 100%; aspect-ratio: 1; border-radius: var(--r-md); object-fit: cover; background: var(--card-2); display: flex; align-items: center; justify-content: center; font-size: 64px; }

/* integration widgets (Accident Tracker) */
.at-widget { border: 1.5px dashed var(--border-2); }
.at-sky { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.at-sky .wx { font-size: 34px; }
.at-meter { height: 12px; border-radius: 999px; background: var(--border); overflow: hidden; }
.at-meter > span { display: block; height: 100%; background: linear-gradient(90deg, #7dd3fc, #38bdf8, #f59e0b, #ef4444); }
.at-little { padding: 10px 0; border-bottom: 1px solid var(--border); }
.at-little:last-child { border-bottom: none; }

/* consent */
.consent-apps { display: flex; justify-content: center; align-items: center; gap: 14px; font-size: 40px; margin-bottom: 8px; }
.scope-list { list-style: none; display: grid; gap: 8px; margin: 12px 0; }
.scope-list li { display: flex; gap: 8px; color: var(--text); font-size: 14px; }

/* docs */
.doc-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.doc h2 { margin-top: 24px; }
.doc h3 { margin-top: 14px; }
.doc p, .doc li { color: var(--text-2); }
.doc ul, .doc ol { padding-left: 22px; display: grid; gap: 4px; margin: 6px 0; }
.qr { background: #fff; padding: 8px; border-radius: 12px; display: inline-block; }
code { background: var(--card-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 6px; font-size: 90%; }
pre { background: var(--card-2); border: 1px solid var(--border); padding: 10px; border-radius: 10px; overflow-x: auto; font-size: 13px; }

@media (max-width: 640px) {
  .chat { height: calc(100dvh - 250px); }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}

/* sparkle burst */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 600; overflow: hidden; }
.burst span { position: absolute; top: -40px; animation: fall 2.2s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(260deg); opacity: .2; } }

/* onboarding */
.onboard-slide { display: none; }
.onboard-slide.active { display: block; }
.onboard-dots { display: flex; gap: 8px; justify-content: center; margin: 24px 0 16px; }
.onboard-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); border: none; cursor: pointer; padding: 0; }
.onboard-dot.active { background: var(--brand); }

/* Little Buddy page: buddy beside its options on wide screens, stacked on phones */
.pet-layout { grid-template-columns: minmax(0, 1fr) 300px; }
@media (max-width: 760px) { .pet-layout { grid-template-columns: minmax(0, 1fr); } }
/* grids never let long content (paths, codes, tables) push the page wider than the screen */
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > * { min-width: 0; }
.kv { grid-template-columns: max-content minmax(0, 1fr); }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .kv { grid-template-columns: minmax(0, 1fr); } }
.kv dd { overflow-wrap: anywhere; }
.btn-wide { white-space: normal; text-align: left; }
/* inputs written without a type attribute get the same cozy styling */
input:not([type]) { width: 100%; padding: 10px 14px; background: var(--card); color: var(--text); border: 1.5px solid var(--border-2); border-radius: var(--r-md); font-family: 'Nunito', sans-serif; font-size: 14px; outline: none; }
input:not([type])::placeholder { color: var(--muted); text-transform: none; letter-spacing: normal; }
.row > input:not([type]), .row > select, .inline-form > input:not([type]) { width: auto; }
