/* WebSpace main site: landing, Studio and the info pages.
   A space's own page is styled by space.css, driven by its owner's theme. */

:root {
    --ink: #1d2130;
    --muted: #646b80;
    --line: #e3e6ef;
    --paper: #ffffff;
    --page: #f5f6fb;
    --brand: #6c4cf1;
    --brand-dark: #5638d8;
    --brand2: #19b8d6;
    --danger: #d43c4f;
    --ok: #1c9a5e;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--page);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

a { color: var(--brand); }

h1, h2, h3 { font-family: 'Poppins', 'Inter', sans-serif; line-height: 1.2; margin: 0 0 .5em; }

/* ── Logo ── */
.bs-logo { display: inline-flex; align-items: center; gap: 7px; color: inherit; }
.bs-logo-word { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; }
.bs-logo-word b { font-weight: 800; background: linear-gradient(90deg, #8b6cff, #19b8d6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── Top bar and footer ── */
.site-bar { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-bar-in { max-width: 1180px; margin: 0 auto; padding: 24px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-brand { color: var(--ink); text-decoration: none; }
.site-nav { position: relative; display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: .95rem; }
.site-nav a { text-decoration: none; color: var(--ink); }
.site-nav a.btn { color: #fff; }
.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 42px; padding: 0; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.menu-btn:hover { background: rgba(0, 0, 0, .05); }
.back-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 10px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line); color: var(--brand); text-decoration: none; box-shadow: 0 2px 6px rgba(0, 0, 0, .10); transition: border-color .15s, box-shadow .15s, transform .15s; }
.back-btn:hover { border-color: var(--brand); color: var(--brand-dark); box-shadow: 0 5px 14px rgba(0, 0, 0, .18); transform: translateX(-2px); }
.site-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 1050; min-width: 170px; display: flex; flex-direction: column; gap: 4px; padding: 10px; text-align: right; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.site-menu[hidden] { display: none; }
.site-menu a { padding: 8px 10px; border-radius: 6px; font-weight: 700; }
.site-menu a:hover { background: rgba(0, 0, 0, .06); }

.site-foot { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 10px; text-align: center; color: var(--muted); font-size: .85rem; padding: 22px 16px; border-top: 1px solid var(--line); background: var(--paper); }
.site-foot-logo { height: 32px; width: auto; display: block; }
.site-foot-line { display: block; font-size: inherit; line-height: 1.5; }
.site-foot a { color: var(--muted); }
.site-foot .dot { margin: 0 4px; }

/* ── Buttons and fields ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--brand); color: #fff; border: 0; border-radius: 10px;
    padding: 11px 20px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn:disabled:hover { background: #d9dbe5; color: #8b90a6; cursor: not-allowed; transform: none; }
.btn.is-saved:disabled { background: var(--ok); color: #fff; cursor: default; }   /* the "Saved!" flash stays green */
.btn-small { padding: 7px 14px; font-size: .9rem; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn-ghost:hover { background: rgba(108, 76, 241, .08); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn-danger:hover { background: rgba(212, 60, 79, .08); }

label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 5px; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }

input[type=text], input[type=email], input[type=url], textarea, select {
    width: 100%; font: inherit; color: var(--ink); background: #fff;
    border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108, 76, 241, .15); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }

.msg { font-size: .88rem; font-weight: 600; min-height: 1.3em; margin-top: 6px; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--danger); }

/* ── Landing ── */
/* White, like the AI News Agent page, with a stripe in that page's blue across the top. */
.hero {
    position: relative;
    background: #fff;
    color: var(--ink);
    padding: 44px 20px 48px;
    text-align: center;
}
.hero::before, .hero::after { content: ""; position: absolute; left: 0; right: 0; height: 14px; background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%); }
.hero::before { top: 0; }
.hero::after { bottom: 0; }
.hero h1 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 800; max-width: 820px; margin: 0 auto 14px; letter-spacing: -.02em; color: var(--ink); }
.hero p.lead { font-size: clamp(1rem, 2.2vw, 1.2rem); max-width: 620px; margin: 0 auto 30px; color: var(--muted); }

.claim { max-width: 560px; margin: 0 auto; }
.claim-row { display: flex; background: #fff; border-radius: 14px; padding: 6px; border: 1.5px solid var(--line); box-shadow: 0 10px 30px rgba(2, 132, 199, .14); }
.claim-prefix { align-self: center; padding: 0 2px 0 12px; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: .95rem; }
.claim-row input[type=text] { border: 0; box-shadow: none; padding: 10px 6px; font-weight: 700; min-width: 0; flex: 1; }
.claim-row input[type=text]:focus { box-shadow: none; }
.claim .msg { color: var(--muted); text-align: left; padding-left: 14px; }
.claim .msg.ok { color: var(--ok); }
.claim .msg.bad { color: var(--danger); }
.claim-signin { margin: 18px 0 0; color: var(--muted); font-size: .95rem; }
.claim-signin a { font-weight: 700; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn:not(.btn-ghost) { background: #ea580c; }
.hero .btn:not(.btn-ghost):hover { background: #c2410c; }
.hero .btn-ghost { color: #0284c7; box-shadow: inset 0 0 0 1.5px #0284c7; }
.hero .btn-ghost:hover { background: rgba(2, 132, 199, .08); }

.section { max-width: 1180px; margin: 0 auto; padding: 46px 20px; }
.section > h2 { font-size: 1.5rem; margin-bottom: 20px; }


.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.space-tile { display: block; text-decoration: none; color: inherit; border-radius: 16px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); transition: box-shadow .15s ease; }
.space-tile:hover { box-shadow: 0 12px 28px rgba(20, 24, 50, .14); }
.space-tile-banner { height: 70px; background-size: cover; background-position: center; }
.space-tile-body { padding: 0 16px 16px; }
.space-tile-avatar { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; margin-top: -28px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; object-fit: cover; }
.space-tile h3 { font-size: 1.02rem; margin: 8px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-tile p { margin: 0; color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-tile .addr { font-size: .78rem; color: var(--brand); font-weight: 600; margin-top: 6px; }

.empty { color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; }

/* ── Plain content pages ── */
.page { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }
.page h1 { font-size: 2rem; }
.page h2 { font-size: 1.2rem; margin-top: 1.6em; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }

/* ── Studio ── */
.studio { max-width: 1280px; margin: 0 auto; padding: 22px 20px 50px; display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }
.studio-side { min-width: 0; }
.studio-head { margin-bottom: 14px; }
.studio-head h1 { font-size: 1.45rem; margin: 0 0 2px; }
.studio-addr { font-weight: 700; text-decoration: none; word-break: break-all; }

.tabs { display: flex; gap: 4px; background: #e9ebf4; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); padding: 8px 4px; border-radius: 9px; cursor: pointer; }
.tab.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.tabpane { display: none; }
.tabpane.on { display: block; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.preset { border: 0; cursor: pointer; border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 700; font-size: .85rem; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .12); }
.preset:hover { box-shadow: 0 0 0 2.5px var(--brand); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-field { display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line); border-radius: 9px; padding: 5px 9px; background: #fff; }
.color-field input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }
.color-field span { font-size: .85rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; margin: 0; }
.check input { width: 17px; height: 17px; }
input[type=range] { width: 100%; accent-color: var(--brand); }

.pic-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.pic-thumb { flex: none; background: #e9ebf4 center/cover no-repeat; border: 1px solid var(--line); }
.pic-thumb.avatar { width: 72px; height: 72px; border-radius: 50%; }
.pic-thumb.banner { width: 132px; height: 48px; border-radius: 9px; }
.pic-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pic-thumb.avatar { background-color: #fff; }
.pick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.pick { width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%; background: #fff; cursor: pointer; box-shadow: 0 0 0 1.5px var(--line); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.pick:hover { transform: scale(1.08); box-shadow: 0 0 0 2.5px var(--brand); }
.pick.on { box-shadow: 0 0 0 3px var(--brand); }
.pick img { width: 100%; height: 100%; display: block; }
.save-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.studio-preview { position: sticky; top: 14px; }
.preview-frame { width: 100%; height: calc(100vh - 110px); min-height: 520px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 10px 34px rgba(20, 24, 50, .12); }
.preview-label { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.btn.is-saved, .btn.is-saved:hover { background: var(--ok); }
.studio-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 50;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--ok); color: #fff; font-weight: 800; font-size: 1.05rem;
    padding: 12px 26px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
    transition: transform .22s ease, opacity .22s ease;
}
.studio-toast.show { transform: translate(-50%, 0); opacity: 1; }

.danger-zone { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.block-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; }

/* ── Create (claim a name) ── */
.create { max-width: 560px; margin: 0 auto; padding: 50px 20px 70px; }
.create .claim-row { box-shadow: none; border: 1.5px solid var(--line); }
.create .claim .msg { color: var(--muted); }
.create .claim .msg.ok { color: var(--ok); }
.create .claim .msg.bad { color: var(--danger); }

@media (max-width: 900px) {
    .studio { grid-template-columns: 1fr; }
    .studio-preview { position: static; }
    .preview-frame { height: 560px; }
}

@media (max-width: 520px) {
    .site-nav { gap: 12px; font-size: .88rem; }
    .hero { padding: 26px 16px 28px; }
    .hero::before, .hero::after { height: 8px; }
    .hero h1 { font-size: 1.25rem; margin-bottom: 14px !important; }
    .hero .btn { padding: 8px 14px; font-size: .88rem; border-radius: 8px; }
    .hero-actions { gap: 8px; }

    /* The home page's space cards: two to a row and compact, instead of one huge card. */
    .section { padding: 20px 14px; }
    .section > h2 { font-size: 1.1rem; margin: 0 0 12px; }
    .space-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .space-tile { border-radius: 12px; }
    .space-tile-banner { height: 40px; }
    .space-tile-body { padding: 0 10px 10px; }
    .space-tile-avatar { width: 36px; height: 36px; margin-top: -18px; border-width: 2px; font-size: 1rem; }
    .space-tile h3 { font-size: .86rem; margin: 5px 0 1px; }
    .space-tile p { font-size: .74rem; }
    .space-tile .addr { display: none; }   /* too long for a half-width card; it cut off the name */
    .site-foot { font-size: .75rem; padding: 14px 12px; }
    .claim-prefix { font-size: .78rem; padding-left: 8px; }
    .claim-row .btn { padding: 10px 12px; font-size: .9rem; }
    .grid2 { grid-template-columns: 1fr; }
}
.media-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.media-add { display: flex; gap: 8px; margin: 8px 0 4px; }
.media-add input { flex: 1; min-width: 0; }
.media-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.media-thumb { flex: none; width: 44px; height: 44px; border-radius: 6px; object-fit: cover; }
.media-thumb-blank { display: flex; align-items: center; justify-content: center; background: #e9ebf4; color: var(--muted); font-size: 1.3rem; }
.media-text { flex: 1; min-width: 0; }
.media-title { font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-sub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-intro { margin: 0 0 14px; }
.media-group { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; background: #fff; }
.media-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.media-head h3 { margin: 0; font-size: 1.1rem; }
.media-count { font-size: .82rem; font-weight: 700; color: var(--muted); }
.media-add-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.media-add-title { font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.media-add-block .hint { margin: 8px 0 0; }
.media-add-block .msg { display: block; margin-top: 6px; }
.media-full { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: #fff3e0; color: #8a5300; font-size: .85rem; font-weight: 600; }
.media-full[hidden] { display: none; }
.media-add input:disabled { background: #f1f2f7; cursor: not-allowed; }
.media-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.media-or::before, .media-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.media-or + .media-add-block { border-top: 0; margin-top: 10px; padding-top: 0; }
#songResults:empty { margin: 0; }
#songMsg:empty { display: none; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; margin: 4px 0; }
.check-row input { width: 18px; height: 18px; margin: 0; }
#visibility .msg { display: block; }
#visibility .msg:empty { display: none; }
#visibility .hint { margin: 8px 0 0; }

.install-app-btn { flex-basis: 100%; margin: 4px auto 0; padding: 7px 16px; width: fit-content; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: #0066cc; font: inherit; font-weight: 700; cursor: pointer; }
.install-app-btn:hover { text-decoration: underline; }

/* Recent posts on the home page. */
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.recent { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; text-decoration: none; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; transition: box-shadow .15s ease; }
.recent:hover { box-shadow: 0 10px 24px rgba(20, 24, 50, .12); }
.recent { --c: var(--brand); border-left: 4px solid var(--c); }
.recent-title { font-weight: 800; font-size: 1.02rem; line-height: 1.3; color: var(--c); }
.recent-meta { font-size: .78rem; color: var(--muted); }
.recent-text { font-size: .9rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-more { font-size: .85rem; font-weight: 700; color: var(--c); }
.profile-picks { display: grid; gap: 8px; }
.profile-pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border, #d9dce8); border-radius: 12px; cursor: pointer; text-align: left; }
.profile-pick input { margin-top: 4px; }
.profile-pick small { display: block; color: var(--muted); font-weight: 400; }
.profile-pick:has(input:checked) { border-color: var(--accent, #6c4cf1); box-shadow: 0 0 0 1px var(--accent, #6c4cf1); }
