/* ============================================================
   South Park Homepage — Construction-Paper Aesthetic
   ============================================================ */

:root {
    --sp-blue: #5ba3d9;
    --sp-sky-top: #6ec6f0;
    --sp-sky-bottom: #b4dff0;
    --sp-snow: #f0f4f8;
    --sp-green: #4a8c3f;
    --sp-brown: #7a5c3a;
    --sp-red: #d94444;
    --sp-yellow: #f5d442;
    --sp-orange: #e8943a;
    --sp-paper: #f5efe0;
    --sp-paper-dark: #e8dcc8;
    --sp-dark: #2a2520;
    --sp-text: #2a2520;
    --sp-card-shadow: 0 4px 12px rgba(0,0,0,0.15);
    --font-title: 'Bangers', cursive;
    --font-body: 'Comic Neue', cursive, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    color: var(--sp-text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ── WebGL background canvas ─────────────────────────── */

#sp-bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    width: 100%;
    height: 100%;
}

#app {
    position: relative;
    z-index: 1;
    padding-bottom: 4rem;
}

/* ── Header ───────────────────────────────────────────── */

.sp-header {
    text-align: center;
    padding: 0.6rem 1rem 0.5rem;
    position: relative;
}

.sp-subtitle {
    font-family: var(--font-title);
    font-size: clamp(1.3rem, 3.2vw, 2rem);
    color: var(--sp-red);
    text-shadow:
        3px 3px 0 var(--sp-dark),
        -1px -1px 0 var(--sp-dark),
        1px -1px 0 var(--sp-dark),
        -1px 1px 0 var(--sp-dark);
    letter-spacing: 3px;
    margin-bottom: 0.1rem;
}

.sp-logo {
    display: block;
    margin: 0 auto;
    width: clamp(220px, 38vw, 380px);
    height: auto;
    filter: drop-shadow(3px 4px 0 var(--sp-dark));
    transition: transform 0.3s;
}

.sp-logo:hover {
    transform: rotate(-1.5deg) scale(1.03);
}

.sp-tagline {
    font-family: var(--font-body);
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    font-weight: 700;
    color: var(--sp-dark);
    background: rgba(245, 239, 224, 0.85);
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    margin-top: 0.2rem;
    letter-spacing: 0.3px;
    opacity: 0.9;
}

/* ── Main content ─────────────────────────────────────── */

.main-content {
    max-width: 900px;
    margin: 0.5rem auto 1rem;
    padding: 0 1rem;
}

/* ── Character grid ───────────────────────────────────── */

.character-grid {
    text-align: center;
}

.grid-hint,
.group-presets-label {
    font-family: var(--font-title);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--sp-paper);
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    background: var(--sp-red);
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 4px;
    border: 2px solid var(--sp-dark);
    box-shadow: 3px 3px 0 var(--sp-dark);
    transform: rotate(-0.5deg);
}

.group-presets-label {
    background: var(--sp-brown);
    transform: rotate(0.5deg);
}

.grid-hint,
.group-presets-label {
    margin-bottom: 0.8rem;
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.6rem;
    max-width: 700px;
    margin: 0 auto;
}

.persona-card {
    background: rgba(245, 239, 224, 0.92);
    border: 3px solid var(--sp-brown);
    border-radius: 8px;
    padding: 0.6rem 0.4rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--sp-card-shadow);
    text-align: center;
    position: relative;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    /* Construction-paper cutout feel */
    transform: rotate(calc((var(--card-tilt, 0)) * 1deg));
}

.persona-card:nth-child(odd)  { --card-tilt: -0.8; }
.persona-card:nth-child(even) { --card-tilt: 0.6; }
.persona-card:nth-child(3n)   { --card-tilt: -1.2; }
.persona-card:nth-child(4n)   { --card-tilt: 1.0; }

.persona-card:hover {
    transform: translateY(-5px) rotate(-1.5deg) scale(1.04);
    box-shadow: 0 10px 24px rgba(0,0,0,0.25);
    border-color: var(--sp-red);
}

.persona-card:active {
    transform: translateY(-1px);
}

.persona-card.selected {
    border-color: var(--sp-red);
    background: #fff5e8;
    box-shadow: 0 0 0 3px var(--sp-yellow), var(--sp-card-shadow);
}

.persona-portrait {
    width: 64px;
    height: 64px;
    object-fit: cover;
    object-position: top;
    border-radius: 50%;
    border: 2px solid var(--sp-brown);
    background: var(--sp-paper-dark);
    margin: 0 auto 0.3rem;
    display: block;
}

.persona-portrait-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid var(--sp-brown);
    background: var(--sp-paper-dark);
    margin: 0 auto 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.persona-name {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--sp-dark);
    letter-spacing: 0.5px;
    line-height: 1.15;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Resume dot — shows on cards with saved sessions */
.resume-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sp-blue);
    border: 2px solid var(--sp-paper);
    box-shadow: 0 0 4px rgba(91, 163, 217, 0.5);
}
.resume-dot.has-unread {
    background: var(--sp-red);
    border-color: #fff;
    animation: notifPulse 1.5s ease-in-out infinite;
}
@keyframes notifPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(204, 51, 51, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 10px rgba(204, 51, 51, 0.8); transform: scale(1.3); }
}

/* ── Group presets ────────────────────────────────────── */

.group-presets {
    max-width: 700px;
    margin: 1.5rem auto 0;
    text-align: center;
    padding-top: 1rem;
    border-top: 3px dashed rgba(122, 92, 58, 0.3);
}

.group-presets-label {
    font-size: 1.2rem;
}

.group-presets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.group-preset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(245, 239, 224, 0.92);
    border: 2px solid var(--sp-brown);
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--sp-card-shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.group-preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border-color: var(--sp-red);
}

.group-preset-avatars {
    display: flex;
    flex-shrink: 0;
}

.group-preset-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--sp-brown);
    object-fit: cover;
    margin-left: -8px;
    background: var(--sp-paper-dark);
}

.group-preset-avatar:first-child {
    margin-left: 0;
}

.group-preset-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.2;
}

.group-preset-label {
    font-family: var(--font-title);
    font-size: 0.85rem;
    color: var(--sp-dark);
    font-weight: 700;
}

.group-preset-desc {
    font-family: var(--font-body);
    font-size: 0.7rem;
    color: var(--sp-brown);
}

.group-preset-btn.has-session {
    border-color: var(--sp-blue);
}

.group-resume-badge {
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    background: var(--sp-blue);
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.group-resume-badge.has-unread {
    background: var(--sp-red);
    animation: notifPulse 1.5s ease-in-out infinite;
}

/* ── Life topics ─────────────────────────────────────── */

.life-topics {
    max-width: 700px;
    margin: 1.5rem auto 0;
    text-align: center;
    padding-top: 1rem;
    border-top: 3px dashed rgba(122, 92, 58, 0.3);
}

.life-topics-label {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sp-paper);
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    background: var(--sp-green);
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 4px;
    border: 2px solid var(--sp-dark);
    box-shadow: 3px 3px 0 var(--sp-dark);
    transform: rotate(0.5deg);
    margin-bottom: 0.8rem;
}

.life-topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.life-topic-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 500px;
    padding: 0.7rem 1rem;
    background: rgba(245, 239, 224, 0.92);
    border: 2px solid var(--sp-brown);
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--sp-card-shadow);
    text-align: left;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.life-topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border-color: var(--sp-green);
}

.life-topic-question {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--sp-dark);
    line-height: 1.3;
}

.life-topic-with {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.life-topic-names {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--sp-brown);
}

/* ── Shared sessions listing ──────────────────────────── */

.shared-sessions {
    max-width: 700px;
    margin: 1.5rem auto 0;
    text-align: center;
    padding-top: 1rem;
    border-top: 3px dashed rgba(122, 92, 58, 0.3);
}
.shared-sessions.hidden { display: none; }

.shared-sessions-label {
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sp-paper);
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
    background: var(--sp-orange);
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 4px;
    border: 2px solid var(--sp-dark);
    box-shadow: 3px 3px 0 var(--sp-dark);
    transform: rotate(-0.5deg);
    margin-bottom: 0.8rem;
}

.shared-sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

.shared-session-card {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    max-width: 500px;
    padding: 0.6rem 0.8rem;
    background: rgba(245, 239, 224, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid var(--sp-brown);
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    color: var(--sp-dark);
    transition: transform 0.15s, box-shadow 0.15s;
}
.shared-session-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    border-color: var(--sp-orange);
}

.shared-session-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--sp-brown);
}

.shared-session-info-block {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.shared-session-title {
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--sp-dark);
    letter-spacing: 0.5px;
}

.shared-session-meta {
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--sp-brown);
    opacity: 0.8;
}

.shared-session-host-badge {
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    background: var(--sp-orange);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* ── Chat area ────────────────────────────────────────── */

.chat-area {
    background: rgba(245, 239, 224, 0.95);
    border: 3px solid var(--sp-brown);
    border-radius: 12px;
    box-shadow: var(--sp-card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70vh;
    max-height: 600px;
    margin-top: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.chat-area.hidden { display: none; }

.chat-header-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: linear-gradient(135deg, var(--sp-brown) 0%, #5a3c1a 100%);
    color: white;
    border-bottom: 3px solid var(--sp-yellow);
    flex-wrap: wrap;
}

.chat-persona-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.chat-header-actions {
    display: flex;
    gap: 0.4rem;
    position: relative;
}

.chat-persona-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--sp-yellow);
    object-fit: cover;
    object-position: top;
    background: var(--sp-paper-dark);
}

.chat-persona-name {
    font-family: var(--font-title);
    font-size: 1.2rem;
    letter-spacing: 1px;
    white-space: normal;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Multi-persona chips ─────────────────────────────── */

.persona-chips {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    background: var(--sp-paper-dark);
    border-bottom: 1px solid #d8cdb8;
    overflow-x: auto;
    flex-shrink: 0;
}

.persona-chips:empty {
    display: none;
}

.persona-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px 3px 3px;
    border: 2px solid var(--sp-brown);
    border-radius: 20px;
    background: var(--sp-paper);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--sp-dark);
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.persona-chip img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 1px solid var(--sp-brown);
}

.persona-chip:hover {
    border-color: var(--sp-blue);
    background: #e8f2fa;
}

.persona-chip.active {
    border-color: var(--sp-blue);
    background: var(--sp-blue);
    color: white;
}

.persona-chip.active img {
    border-color: white;
}

.chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 2px;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    color: var(--sp-dark);
    opacity: 0.5;
    transition: all 0.15s;
}

.chip-remove:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.15);
    color: var(--sp-red, #c0392b);
}

.persona-chip.active .chip-remove {
    color: white;
    opacity: 0.7;
}

.persona-chip.active .chip-remove:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

.chat-error {
    color: var(--sp-red, #c0392b);
    font-style: italic;
}

/* ── Invite dropdown / bottom-sheet ──────────────────── */

.sp-btn-invite {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.8rem;
}

/* Pulsing red CTA when only one persona is active */
.sp-btn-invite.invite-cta {
    background: var(--sp-red, #c0392b);
    color: #fff;
    border-color: var(--sp-red, #c0392b);
    animation: invite-pulse 1.8s ease-in-out infinite;
}
.sp-btn-invite.invite-cta:hover {
    background: #a8312a;
    border-color: #a8312a;
}
@keyframes invite-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
    50% { box-shadow: 0 0 10px 4px rgba(192, 57, 43, 0.3); }
}

/* Backdrop — only visible on mobile via media query */
.invite-backdrop {
    display: none;
}

/* Desktop: fixed dropdown near top-right of chat area */
.invite-dropdown {
    position: fixed;
    z-index: 110;
    background: var(--sp-paper);
    border: 2px solid var(--sp-brown);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    max-height: 300px;
    overflow: hidden;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.invite-dropdown.hidden {
    display: none;
}

/* Sheet header — visible on mobile, hidden on desktop */
.invite-sheet-header {
    display: none;
}

.invite-list {
    overflow-y: auto;
    flex: 1;
}

.invite-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--sp-dark);
    text-align: left;
    transition: background 0.1s;
}

.invite-item:hover {
    background: var(--sp-paper-dark);
}

.invite-item img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 2px solid var(--sp-brown);
}

.invite-empty {
    padding: 12px;
    text-align: center;
    color: var(--sp-brown);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ── Message persona tag (multi-persona) ─────────────── */

.chat-msg-persona-tag {
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--sp-blue);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Message bubbles */
.chat-msg {
    display: flex;
    gap: 0.5rem;
    max-width: 85%;
    animation: msgSlide 0.2s ease-out;
}

@keyframes msgSlide {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-assistant {
    align-self: flex-start;
    flex-wrap: wrap;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--sp-brown);
    flex-shrink: 0;
    object-fit: cover;
    object-position: top;
    background: var(--sp-paper-dark);
}

.chat-msg-bubble {
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    line-height: 1.45;
    font-size: 0.95rem;
    word-break: break-word;
}

.chat-msg-user .chat-msg-bubble {
    background: var(--sp-blue);
    color: white;
    border-bottom-right-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}

.chat-msg-assistant .chat-msg-bubble {
    background: white;
    color: var(--sp-dark);
    border: 2px solid var(--sp-brown);
    border-bottom-left-radius: 4px;
    box-shadow: 2px 2px 0 rgba(122, 92, 58, 0.15);
}

/* Action markers */
.chat-msg-bubble .action-marker {
    font-style: italic;
    color: var(--sp-brown);
    opacity: 0.85;
}

.chat-msg-bubble .action-marker::before,
.chat-msg-bubble .action-marker::after {
    content: '*';
}

/* System messages */
.chat-msg-system {
    text-align: center;
    font-size: 0.8rem;
    color: var(--sp-brown);
    opacity: 0.7;
    padding: 0.3rem;
    font-style: italic;
}

/* ── Tool Call Blocks (Claude-style) ─────────────────────────────── */

.tool-call-block {
    margin-bottom: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(74, 158, 255, 0.06);
    font-size: 0.75rem;
    color: var(--sp-blue);
    opacity: 0.7;
    width: 100%;
}

.tc-label {
    font-style: italic;
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 3px;
}
.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--sp-brown);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: var(--sp-paper-dark);
    border-top: 2px solid #d8cdb8;
}

.chat-input-bar input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 2px solid var(--sp-brown);
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: white;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input-bar input:focus {
    border-color: var(--sp-blue);
}

/* Buttons */
.sp-btn {
    font-family: var(--font-title);
    font-size: 1rem;
    padding: 0.5rem 1.2rem;
    border: 2px solid var(--sp-dark);
    border-radius: 6px;
    cursor: pointer;
    background: var(--sp-yellow);
    color: var(--sp-dark);
    transition: transform 0.1s, background 0.15s;
    letter-spacing: 0.5px;
}

.sp-btn:hover {
    background: var(--sp-orange);
    transform: scale(1.03);
}

.sp-btn:active {
    transform: scale(0.97);
}

.sp-btn-small {
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
    background: transparent;
    color: white;
    border-color: rgba(255,255,255,0.4);
}

.sp-btn-small:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

/* ── Raison d'être ───────────────────────────────────── */

.raison-detre {
    max-width: 900px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}

.raison-card {
    background: rgba(245, 239, 224, 0.92);
    border: 3px solid var(--sp-brown);
    border-radius: 12px;
    box-shadow: var(--sp-card-shadow);
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

/* Construction-paper torn edge — top border accent */
.raison-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 10px;
    right: 10px;
    height: 4px;
    background: var(--sp-red);
    border-radius: 2px;
    clip-path: polygon(
        0% 50%, 3% 0%, 6% 50%, 9% 0%, 12% 50%, 15% 0%,
        18% 50%, 21% 0%, 24% 50%, 27% 0%, 30% 50%, 33% 0%,
        36% 50%, 39% 0%, 42% 50%, 45% 0%, 48% 50%, 51% 0%,
        54% 50%, 57% 0%, 60% 50%, 63% 0%, 66% 50%, 69% 0%,
        72% 50%, 75% 0%, 78% 50%, 81% 0%, 84% 50%, 87% 0%,
        90% 50%, 93% 0%, 96% 50%, 100% 0%, 100% 100%, 0% 100%
    );
}

.raison-title {
    font-family: var(--font-title);
    font-size: 1.6rem;
    color: var(--sp-yellow);
    background: var(--sp-red);
    display: inline-block;
    padding: 0.15rem 0.8rem;
    border-radius: 3px;
    border: 2px solid var(--sp-dark);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    letter-spacing: 2px;
    margin-bottom: 0.8rem;
    transform: rotate(-0.8deg);
    box-shadow: 3px 3px 0 var(--sp-dark);
}

.raison-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--sp-dark);
    margin-bottom: 0.6rem;
}

.raison-text:last-child {
    margin-bottom: 0;
}

.raison-text em {
    color: var(--sp-brown);
    font-style: italic;
}

.raison-kicker {
    font-weight: 700;
    color: var(--sp-brown);
    border-top: 2px dashed var(--sp-paper-dark);
    padding-top: 0.6rem;
    margin-top: 0.3rem;
}

.raison-v1 {
    font-size: 0.88rem;
    color: var(--sp-brown);
    font-style: italic;
    opacity: 0.85;
    margin-top: 0.5rem;
}

/* ── FAQ Section — single collapsible block ──────────── */

.faq-block {
    max-width: 900px;
    margin: 1.5rem auto 0;
    padding: 0 1rem;
}

/* The toggle button — construction-paper label style */
.faq-toggle {
    display: block;
    width: 100%;
    font-family: var(--font-title);
    font-size: 1.5rem;
    color: var(--sp-paper);
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    text-align: center;
    background: var(--sp-red);
    border: 3px solid var(--sp-dark);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    box-shadow: 3px 3px 0 var(--sp-dark);
    transform: rotate(-0.4deg);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.faq-toggle:hover {
    background: #c83b3b;
    transform: rotate(0deg) scale(1.02);
    box-shadow: 4px 4px 0 var(--sp-dark);
}

.faq-toggle:active {
    transform: scale(0.98);
    box-shadow: 2px 2px 0 var(--sp-dark);
}

.faq-toggle::-webkit-details-marker { display: none; }

/* Arrow indicator */
.faq-toggle::after {
    content: ' \25BC';
    font-size: 0.7rem;
    vertical-align: middle;
    transition: transform 0.2s;
    display: inline-block;
    margin-left: 0.5rem;
}

.faq-block[open] .faq-toggle::after {
    transform: rotate(180deg);
}

.faq-block[open] .faq-toggle {
    border-radius: 8px 8px 0 0;
    transform: rotate(0deg);
    box-shadow: 3px 0 0 var(--sp-dark);
}

/* Content card — matches raison-card style */
.faq-content {
    background: rgba(245, 239, 224, 0.92);
    border: 3px solid var(--sp-dark);
    border-top: 2px dashed var(--sp-brown);
    border-radius: 0 0 12px 12px;
    padding: 1.5rem 2rem;
    box-shadow: 3px 3px 0 var(--sp-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
}

/* Red torn-edge accent at bottom of content */
.faq-content::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 10px;
    right: 10px;
    height: 4px;
    background: var(--sp-red);
    border-radius: 2px;
    clip-path: polygon(
        0% 50%, 3% 0%, 6% 50%, 9% 0%, 12% 50%, 15% 0%,
        18% 50%, 21% 0%, 24% 50%, 27% 0%, 30% 50%, 33% 0%,
        36% 50%, 39% 0%, 42% 50%, 45% 0%, 48% 50%, 51% 0%,
        54% 50%, 57% 0%, 60% 50%, 63% 0%, 66% 50%, 69% 0%,
        72% 50%, 75% 0%, 78% 50%, 81% 0%, 84% 50%, 87% 0%,
        90% 50%, 93% 0%, 96% 50%, 100% 0%, 100% 100%, 0% 100%
    );
}

/* Individual Q&A items */
.faq-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--sp-paper-dark);
}

.faq-item:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.faq-item h3 {
    font-family: var(--font-title);
    font-size: 1.05rem;
    color: var(--sp-red);
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1);
    margin-bottom: 0.25rem;
}

.faq-item p {
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--sp-dark);
    margin: 0;
}

/* About / who's behind this */
.faq-about {
    margin-top: 1.5rem;
    padding-top: 1.2rem;
    border-top: 3px solid var(--sp-brown);
    text-align: center;
}

.faq-about-hook {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--sp-yellow);
    background: var(--sp-brown);
    display: inline-block;
    padding: 0.15rem 0.8rem;
    border-radius: 3px;
    border: 2px solid var(--sp-dark);
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
    letter-spacing: 1.5px;
    margin-bottom: 0.7rem;
    transform: rotate(0.6deg);
    box-shadow: 3px 3px 0 var(--sp-dark);
}

.faq-about-text {
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--sp-dark);
    margin-bottom: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.faq-about-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-title);
    font-size: 1rem;
    letter-spacing: 0.5px;
    color: var(--sp-paper);
    text-decoration: none;
    background: #0a66c2;
    border: 2px solid var(--sp-dark);
    border-radius: 6px;
    padding: 0.45rem 1rem;
    box-shadow: 3px 3px 0 var(--sp-dark);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.faq-about-link:hover {
    background: #094d92;
    transform: translateY(-2px);
    box-shadow: 4px 5px 0 var(--sp-dark);
}

.faq-about-link:active {
    transform: scale(0.97);
    box-shadow: 2px 2px 0 var(--sp-dark);
}

.faq-about-link .linkedin-icon {
    width: 16px;
    height: 16px;
}

/* ── Combined Promo Spot — v1 + voice mode ───────────── */
/* Desktop: spinning starburst, fixed top-left.           */
/* Mobile: inline banner in page flow.                    */

.promo-spot {
    position: fixed;
    top: 90px;
    left: 20px;
    z-index: 15;
}

/* Starburst — desktop */
.promo-starburst {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    background: var(--sp-red);
    color: var(--sp-yellow);
    border-radius: 50%;
    text-align: center;
    font-family: var(--font-title);
    animation: promo-spin 14s linear infinite, promo-pulse 2.5s ease-in-out infinite;
    box-shadow:
        0 0 0 4px var(--sp-yellow),
        0 0 20px rgba(255, 0, 0, 0.4),
        0 0 40px rgba(255, 0, 0, 0.15);
    cursor: default;
    clip-path: polygon(
        50% 0%, 63% 13%, 79% 2%, 81% 21%, 98% 22%, 89% 38%,
        100% 50%, 89% 62%, 98% 78%, 81% 79%, 79% 98%, 63% 87%,
        50% 100%, 37% 87%, 21% 98%, 19% 79%, 2% 78%, 11% 62%,
        0% 50%, 11% 38%, 2% 22%, 19% 21%, 21% 2%, 37% 13%
    );
    padding: 22px;
}

.promo-starburst-main {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.1;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.4);
}

.promo-starburst-sub {
    font-size: 0.55rem;
    letter-spacing: 2px;
    color: white;
    margin-top: 3px;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

.promo-starburst-version {
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--sp-dark);
    background: var(--sp-yellow);
    border-radius: 4px;
    padding: 1px 7px;
    margin-top: 5px;
    font-weight: 900;
    box-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

@keyframes promo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes promo-pulse {
    0%, 100% { scale: 1; }
    50% { scale: 1.05; }
}

/* Counter-rotate text so it stays readable */
.promo-starburst-main,
.promo-starburst-sub,
.promo-starburst-version {
    animation: promo-counter-spin 14s linear infinite;
}

@keyframes promo-counter-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* Banner — mobile only, hidden on desktop */
.promo-banner {
    display: none;
}

/* ── Floating Tech Panel — Under the Hood ────────────── */
/* Fixed bottom-left dark terminal window. Shows the live  */
/* knowledge graph and stats. Non-disruptive but clearly   */
/* signals a technical product underneath.                 */

.tech-panel {
    position: fixed;
    bottom: 32px; /* above footer */
    left: 16px;
    z-index: 20;
    width: 400px;
    background: #0b0f15;
    border: 1px solid rgba(74, 158, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(74, 158, 255, 0.05);
    /* Scan-line texture */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(74, 158, 255, 0.012) 2px,
            rgba(74, 158, 255, 0.012) 4px
        );
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Collapsed state */
.tech-panel.collapsed .tech-panel-body {
    display: none;
}
.tech-panel.collapsed {
    width: auto;
    min-width: 180px;
}
.tech-panel.collapsed .tech-panel-btn {
    transform: rotate(-90deg);
}

/* Header bar */
.tech-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(74, 158, 255, 0.1);
    cursor: pointer;
    user-select: none;
}

.tech-panel-header:hover {
    background: rgba(74, 158, 255, 0.04);
}

.tech-panel-tag {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(74, 158, 255, 0.6);
}

.tech-panel-btn {
    background: none;
    border: none;
    color: rgba(74, 158, 255, 0.4);
    font-size: 0.6rem;
    cursor: pointer;
    padding: 2px;
    transition: transform 0.2s, color 0.15s;
    line-height: 1;
}
.tech-panel-btn:hover {
    color: #4a9eff;
}

/* Body */
.tech-panel-body {
    display: flex;
    flex-direction: column;
}

/* Mini graph area */
.tech-panel-graph {
    height: 160px;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(74, 158, 255, 0.08);
}

.tech-panel-graph svg {
    width: 100%;
    height: 100%;
}

/* Ambient glow */
.tech-panel-graph::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 80% 80% at 50% 50%,
        rgba(74, 158, 255, 0.04) 0%,
        transparent 70%
    );
    pointer-events: none;
}

/* Info section */
.tech-panel-info {
    padding: 10px 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tech-panel-stats {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tech-num {
    color: #4a9eff;
    font-weight: 700;
    font-size: 0.9rem;
}

.tech-sep {
    color: rgba(74, 158, 255, 0.25);
}

.tech-panel-pipe {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px;
}

.tech-panel-cta {
    display: block;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.35);
    border-radius: 6px;
    padding: 7px 14px;
    margin-top: 4px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.tech-panel-cta:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: #4a9eff;
    box-shadow: 0 0 12px rgba(74, 158, 255, 0.2);
    color: #fff;
}

/* ── Footer ───────────────────────────────────────────── */

.sp-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(42, 37, 32, 0.88);
    backdrop-filter: blur(8px);
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}

.footer-note {
    opacity: 0.7;
}

.footer-sep {
    margin: 0 0.5rem;
    opacity: 0.35;
}

.footer-credit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--sp-yellow);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.15s;
    font-style: italic;
    font-size: 0.85rem;
}

.footer-credit:hover {
    opacity: 1;
    text-decoration: underline;
}

.linkedin-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.9;
}

.footer-terms {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.15s;
}
.footer-terms:hover {
    color: var(--sp-yellow);
    text-decoration: underline;
}

/* ── Scrollbar ────────────────────────────────────────── */

.chat-messages::-webkit-scrollbar {
    width: 8px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--sp-brown);
    border-radius: 4px;
    opacity: 0.5;
}

/* ── Chat welcome (empty state) ───────────────────────── */

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2rem 1.5rem;
    text-align: center;
    flex: 1;
}

.chat-welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--sp-yellow);
    object-fit: cover;
    object-position: top;
    background: var(--sp-paper-dark);
}

.chat-welcome-name {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--sp-dark);
    letter-spacing: 1px;
}

.chat-welcome-hint {
    font-size: 0.85rem;
    color: var(--sp-brown);
    opacity: 0.8;
    max-width: 260px;
    line-height: 1.4;
}

/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
    /* Promo spot: swap starburst for inline banner */
    .promo-spot {
        position: relative;
        top: auto;
        left: auto;
        margin: 0.8rem 1rem 0;
    }

    .promo-starburst {
        display: none;
    }

    .promo-banner {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
        background: linear-gradient(135deg, var(--sp-red), #e63946);
        border: 3px solid var(--sp-yellow);
        border-radius: 8px;
        box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
        animation: promo-banner-flash 1.5s ease-in-out infinite;
    }

    .promo-banner-icon {
        font-size: 1.3rem;
    }

    .promo-banner-text {
        font-family: var(--font-title);
        font-size: 1rem;
        color: var(--sp-yellow);
        letter-spacing: 2px;
        text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
    }

    .promo-banner-badge {
        font-size: 0.65rem;
        font-weight: 700;
        color: var(--sp-dark);
        background: var(--sp-yellow);
        border-radius: 3px;
        padding: 0.1rem 0.4rem;
        margin-left: auto;
        letter-spacing: 1px;
    }

    @keyframes promo-banner-flash {
        0%, 100% { box-shadow: 0 0 8px rgba(255, 0, 0, 0.3); }
        50% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.5), 0 0 4px var(--sp-yellow); }
    }

    /* Hide promo when chat is open */
    body.chat-active .promo-spot {
        display: none;
    }

    .persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 0.5rem;
    }
    .persona-portrait, .persona-portrait-placeholder {
        width: 52px;
        height: 52px;
    }
    .persona-name {
        font-size: 0.7rem;
    }
    .persona-card {
        padding: 0.4rem 0.3rem;
    }

    /* Collapse header when chat is visible — reclaim vertical space */
    .sp-header:has(~ .main-content .chat-area:not(.hidden)) {
        display: none;
    }
    /* Fallback for browsers without :has — JS adds this class */
    body.chat-active .sp-header {
        display: none;
    }

    /* ── Fullscreen chat on mobile ──────────────────────── */
    /* Take over the entire viewport so every pixel goes to
       the conversation instead of fighting the page scroll. */
    body.chat-active .chat-area {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;  /* let JS control height via visualViewport */
        z-index: 50;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        margin: 0;
        border: none;
        border-radius: 0;
    }

    /* Hide page chrome while chatting */
    body.chat-active .sp-header,
    body.chat-active .sp-footer,
    body.chat-active .promo-spot,
    body.chat-active .raison-detre,
    body.chat-active .faq-block,
    body.chat-active .tech-panel {
        display: none;
    }

    /* Prevent body scroll behind the fixed chat */
    body.chat-active {
        overflow: hidden;
    }

    /* Fallback for non-chat-active state (grid visible) */
    .chat-area {
        height: calc(100vh - 40px);
        height: calc(100dvh - 40px);
        max-height: none;
        border-radius: 8px;
        margin-top: 0.5rem;
    }

    /* Header bar — compact */
    .chat-header-bar {
        gap: 0.3rem;
        padding: 0.35rem 0.5rem;
        flex-wrap: nowrap;
        border-bottom-width: 2px;
    }

    .chat-persona-avatar {
        width: 26px;
        height: 26px;
    }

    .chat-persona-name {
        font-size: 0.85rem;
    }

    /* Smaller buttons */
    .sp-btn-small {
        font-size: 0.7rem;
        padding: 0.2rem 0.45rem;
    }

    .sp-btn-invite {
        font-size: 0.7rem;
    }

    /* ── Invite bottom sheet (mobile) ─────────────────── */

    .invite-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(0, 0, 0, 0.5);
    }
    .invite-backdrop.hidden {
        display: none;
    }

    .invite-dropdown {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        margin: 0;
        max-height: 55vh;
        min-width: 0;
        width: 100%;
        border: none;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
        z-index: 110;
        /* Slide-up animation */
        animation: invite-slide-up 0.2s ease-out;
    }

    @keyframes invite-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .invite-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 1rem 0.4rem;
        border-bottom: 1px solid var(--sp-paper-dark);
        position: relative;
    }

    .invite-sheet-handle {
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: var(--sp-brown);
        opacity: 0.3;
    }

    .invite-sheet-title {
        font-family: var(--font-title);
        font-size: 1rem;
        color: var(--sp-dark);
        letter-spacing: 0.5px;
    }

    .invite-sheet-close {
        background: none;
        border: none;
        font-size: 1.4rem;
        color: var(--sp-brown);
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
        border-radius: 4px;
    }
    .invite-sheet-close:active {
        background: var(--sp-paper-dark);
    }

    .invite-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 2px;
        padding: 0.5rem;
        overflow-y: auto;
    }

    .invite-item {
        flex-direction: column;
        gap: 4px;
        padding: 0.6rem 0.4rem;
        text-align: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 0.75rem;
        /* Larger touch target */
        min-height: 44px;
    }

    .invite-item:active {
        background: var(--sp-paper-dark);
    }

    .invite-item img {
        width: 36px;
        height: 36px;
    }

    .invite-empty {
        padding: 2rem 1rem;
    }

    /* Chat messages — tighter */
    .chat-messages {
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .chat-msg {
        max-width: 92%;
        gap: 0.3rem;
    }

    .chat-msg-bubble {
        padding: 0.4rem 0.65rem;
        font-size: 0.85rem;
        line-height: 1.35;
    }

    .chat-msg-avatar {
        width: 26px;
        height: 26px;
    }

    .chat-msg-system {
        font-size: 0.7rem;
        padding: 0.15rem;
    }

    /* Welcome screen — compact */
    .chat-welcome {
        padding: 1.2rem 1rem;
        gap: 0.4rem;
    }

    .chat-welcome-avatar {
        width: 56px;
        height: 56px;
    }

    .chat-welcome-name {
        font-size: 1.1rem;
    }

    /* Input bar — slim */
    .chat-input-bar {
        padding: 0.4rem 0.5rem;
        gap: 0.35rem;
        /* Safe-area inset for devices with home indicator */
        padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
    }

    #chat-input {
        font-size: 0.85rem;
        padding: 0.45rem 0.75rem;
    }

    /* Tool call blocks */
    .tool-call-block {
        font-size: 0.7rem;
        padding: 2px 8px;
        margin-bottom: 2px;
    }

    /* Persona chips — single-row, compact */
    .persona-chips {
        padding: 2px 5px;
        gap: 3px;
    }

    .persona-chip {
        font-size: 0.7rem;
        padding: 2px 7px 2px 2px;
    }

    .persona-chip img {
        width: 18px;
        height: 18px;
    }

    .sp-header {
        padding: 0.4rem 0.6rem 0;
    }
    .sp-logo {
        width: clamp(180px, 52vw, 280px);
    }
    .sp-subtitle {
        font-size: clamp(1rem, 3.5vw, 1.3rem);
        letter-spacing: 2px;
    }
    .grid-hint,
    .group-presets-label,
    .life-topics-label {
        font-size: 1rem;
        padding: 0.2rem 0.7rem;
    }
    .life-topic-question { font-size: 0.85rem; }
    .sp-tagline {
        font-size: 0.7rem;
    }
    .raison-card {
        padding: 1rem 1.2rem;
    }
    .raison-title {
        font-size: 1.1rem;
    }
    .raison-text {
        font-size: 0.85rem;
    }
    .faq-toggle {
        font-size: 1.1rem;
        padding: 0.5rem 0.8rem;
    }
    .faq-content {
        padding: 1rem 1.2rem;
    }
    .faq-item h3 {
        font-size: 0.92rem;
    }
    .faq-item p {
        font-size: 0.85rem;
    }
    .faq-about-hook {
        font-size: 1.1rem;
    }
    .faq-about-text {
        font-size: 0.85rem;
    }
    .faq-about-link {
        font-size: 0.9rem;
    }
    /* Tech panel: inline on mobile instead of fixed overlay */
    .tech-panel {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        width: auto;
        max-width: none;
        margin: 1.5rem 1rem 0;
        border-radius: 10px;
    }
    .tech-panel.collapsed {
        min-width: 0;
        width: auto;
    }
    .tech-panel-graph {
        height: 100px;
    }
    .tech-panel-pipe {
        display: none;
    }
    /* Footer: stack vertically on mobile */
    .sp-footer {
        position: relative;
        flex-direction: column;
        gap: 0.2rem;
        padding: 0.6rem 1rem;
        margin-top: 1rem;
    }
    .footer-sep {
        display: none;
    }
}

/* ── Small mobile (< 400px) ──────────────────────────── */

@media (max-width: 400px) {
    /* Chat header even tighter */
    .chat-header-bar {
        padding: 0.25rem 0.4rem;
    }

    .chat-persona-avatar {
        width: 22px;
        height: 22px;
    }

    .chat-persona-name {
        font-size: 0.8rem;
    }

    .chat-welcome-avatar {
        width: 48px;
        height: 48px;
    }

    .chat-welcome-name {
        font-size: 1rem;
    }

    .chat-welcome-hint {
        font-size: 0.8rem;
    }

    .chat-msg-avatar {
        width: 22px;
        height: 22px;
    }

    .chat-msg-bubble {
        font-size: 0.82rem;
    }

    .persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 0.4rem;
    }

    .persona-portrait, .persona-portrait-placeholder {
        width: 44px;
        height: 44px;
    }

    .persona-name {
        font-size: 0.6rem;
    }

    .sp-logo {
        width: clamp(160px, 56vw, 220px);
    }
    .sp-subtitle {
        font-size: 0.85rem;
        letter-spacing: 1.5px;
    }
    .grid-hint,
    .group-presets-label,
    .life-topics-label {
        font-size: 0.85rem;
        padding: 0.2rem 0.6rem;
    }
    .life-topic-question { font-size: 0.8rem; }
}


/* ═══════════════════════════════════════════════════════════════════════
   SHARED SESSION STYLES
   ═══════════════════════════════════════════════════════════════════════ */

/* Share button in home chat header */
.sp-btn-share {
    background: var(--sp-blue);
    color: white;
}
.sp-btn-share:hover {
    background: #3a7abf;
}

/* Share modals */
.share-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}
.share-modal.hidden { display: none; }

.share-modal-content {
    background: var(--sp-brown);
    border: 3px solid var(--sp-yellow);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    position: relative;
    color: white;
    font-family: 'Comic Neue', cursive;
}
.share-modal-content h2 {
    font-family: 'Bangers', cursive;
    color: var(--sp-yellow);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.share-modal-content p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
}
.share-modal-content input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--sp-yellow);
    border-radius: 6px;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    margin: 0.5rem 0;
    box-sizing: border-box;
}
.share-modal-content input::placeholder { color: rgba(255, 255, 255, 0.5); }
.share-modal-content .sp-btn { margin-top: 0.5rem; }

.share-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
}
.share-modal-close:hover { color: white; }

.share-link-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.share-link-row input {
    flex: 1;
    font-size: 0.85rem !important;
}
.share-link-note {
    font-size: 0.8rem !important;
    opacity: 0.7;
}

/* Share options dropdown (after sharing) */
.share-options-menu {
    position: absolute;
    top: 40px;
    right: 0.5rem;
    background: var(--sp-brown);
    border: 2px solid var(--sp-yellow);
    border-radius: 8px;
    padding: 0.3rem;
    z-index: 100;
    box-shadow: var(--sp-card-shadow);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.share-options-menu.hidden { display: none; }
.share-option {
    background: none;
    border: none;
    color: white;
    font-family: 'Comic Neue', cursive;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    text-align: left;
    white-space: nowrap;
}
.share-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Go to shared session button in share modal */
.sp-btn-go {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    background: var(--sp-green) !important;
    color: white !important;
    font-weight: 700;
    font-size: 0.95rem;
}
.sp-btn-go:hover {
    filter: brightness(1.15);
}

/* Waiting state for queued messages */
.chat-waiting {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    font-size: 0.85rem;
}

/* ── Shared Session Page ─────────────────────────────────────────────── */

.shared-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.2rem;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.25);
    border-bottom: 2px solid rgba(245, 212, 66, 0.3);
}
.shared-home-link {
    text-decoration: none;
    flex-shrink: 0;
}
.sp-logo-small {
    width: 90px;
    transition: transform 0.2s;
}
.sp-logo-small:hover {
    transform: scale(1.05);
}
.shared-session-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}
.shared-label {
    font-family: 'Bangers', cursive;
    color: var(--sp-yellow);
    font-size: 1.1rem;
    letter-spacing: 1px;
}
.shared-persona-label {
    font-family: 'Comic Neue', cursive;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}
.shared-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.shared-main {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.shared-chat-area {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.shared-chat-area .chat-messages {
    flex: 1;
    min-height: 300px;
    max-height: calc(100vh - 240px);
    padding: 0.75rem 1rem;
}

/* Error state */
.shared-error {
    text-align: center;
    padding: 3rem 1rem;
    color: white;
    font-family: 'Comic Neue', cursive;
}
.shared-error h2 {
    font-family: 'Bangers', cursive;
    color: var(--sp-red);
    font-size: 2rem;
    margin-bottom: 1rem;
}
.shared-error p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Name modal (join) — matches share-modal from homepage */
.name-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
}
.name-modal.hidden { display: none; }

.name-modal-content {
    background: var(--sp-brown);
    border: 3px solid var(--sp-yellow);
    border-radius: 12px;
    padding: 2rem 2rem 1.5rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    color: white;
    font-family: 'Comic Neue', cursive;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.name-modal-content h2 {
    font-family: 'Bangers', cursive;
    color: var(--sp-yellow);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.name-modal-content p { margin: 0.5rem 0; }
.name-modal-content strong { color: var(--sp-yellow); }
.name-modal-content input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--sp-yellow);
    border-radius: 6px;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    margin: 0.5rem 0;
    box-sizing: border-box;
    margin: 0.5rem 0;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.name-modal-content input:focus {
    border-color: #fff;
}
.name-modal-content input::placeholder { color: rgba(255, 255, 255, 0.5); }
.name-modal-content .sp-btn { margin-top: 0.5rem; }

/* Participants bar */
.shared-participants-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 0;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 0.5rem;
}

.participant-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem 0.25rem 0.35rem;
    border: 2px solid;
    border-radius: 16px;
    font-size: 0.8rem;
    font-family: 'Comic Neue', cursive;
    color: white;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}
.participant-chip:hover {
    background: rgba(255, 255, 255, 0.12);
}
.participant-self {
    background: rgba(255, 255, 255, 0.14);
    font-weight: 700;
}

/* Presence dot */
.presence-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.presence-online { background: #51cf66; box-shadow: 0 0 4px rgba(81, 207, 102, 0.6); }
.presence-idle { background: #ffd43b; }
.presence-away { background: #868e96; }

/* Participant mini badge */
.participant-badge {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    line-height: 1;
}
.participant-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    color: #fff;
    text-shadow: none;
}

/* Shared persona chips */
.shared-persona-chips {
    margin-left: auto;
}

/* Human sender badges in messages */
.chat-msg-human-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.chat-msg-sender-name {
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'Comic Neue', cursive;
    margin-bottom: 0.15rem;
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    text-shadow: none;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Message timestamps + read receipts */
.chat-msg-meta {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.1rem;
    align-self: flex-end;
}
.chat-msg-time {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.35);
    font-family: 'Comic Neue', cursive;
    line-height: 1;
}
.chat-msg-assistant .chat-msg-time {
    color: rgba(0, 0, 0, 0.3);
}
.chat-msg-user .chat-msg-meta {
    justify-content: flex-end;
}

/* Read receipts — single icon per message */
.chat-msg-checks {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    line-height: 1;
    margin-left: 0.15rem;
    letter-spacing: -1px;
}
.chat-msg-checks .check-sent { color: rgba(255, 255, 255, 0.4); }
.chat-msg-checks .check-delivered { color: rgba(255, 255, 255, 0.6); }
.chat-msg-checks .check-read { color: #53bdeb; }

/* Shared footer */
.shared-footer {
    text-align: center;
    padding: 0.6rem;
    font-size: 0.75rem;
    opacity: 0.4;
    font-family: 'Comic Neue', cursive;
    color: white;
}
.shared-footer a { color: var(--sp-yellow); text-decoration: none; }
.shared-footer a:hover { text-decoration: underline; }

/* Chat error text */
.chat-error {
    color: var(--sp-red);
    font-style: italic;
}

/* ── Shared Session Mobile ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .shared-header {
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }
    .sp-logo-small {
        width: 60px;
    }
    .shared-label {
        font-size: 0.9rem;
    }
    .shared-persona-label {
        font-size: 0.75rem;
    }
    .shared-main {
        padding: 0 0.5rem;
    }
    .shared-chat-area .chat-messages {
        max-height: calc(100vh - 220px);
    }
    .shared-participants-bar {
        gap: 0.3rem;
        padding: 0.4rem 0;
    }
    .participant-chip {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem 0.2rem 0.25rem;
    }
    .participant-badge {
        width: 18px;
        height: 18px;
        font-size: 0.58rem;
    }
    .participant-name {
        max-width: 55px;
    }
    .chat-msg-sender-name {
        max-width: 80px;
    }
    .name-modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    .cb-modal {
        padding: 1rem 0.5rem;
    }
    .cb-modal-content {
        padding: 1rem;
        width: 95%;
    }
}


/* ============================================================
   Context Builder
   ============================================================ */

.context-builder-cta {
    margin: 1rem auto 1.2rem;
    max-width: 500px;
}

.context-cta-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    padding: 1rem 1.4rem;
    background: var(--sp-paper);
    border: 2.5px solid var(--sp-brown);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    box-shadow: var(--sp-card-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.context-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    border-color: var(--sp-orange);
}
.context-cta-icon {
    font-size: 2rem;
    line-height: 1;
}
.context-cta-text strong {
    display: block;
    font-family: var(--font-title);
    font-size: 1.25rem;
    color: var(--sp-brown);
    letter-spacing: 0.5px;
}
.context-cta-text small {
    display: block;
    font-size: 0.82rem;
    color: #666;
    margin-top: 2px;
}

/* Context Builder Modal Overlay */
.cb-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 2rem 1rem;
}
.cb-modal.hidden { display: none; }

.cb-modal-content {
    background: var(--sp-paper);
    border: 3px solid var(--sp-brown);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.cb-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    background: none;
    border: none;
    color: var(--sp-brown);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.cb-modal-close:hover {
    opacity: 1;
}

.cb-title {
    font-family: var(--font-title);
    font-size: 1.6rem;
    color: var(--sp-brown);
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 1.2rem;
}

.cb-section {
    background: var(--sp-paper);
    border: 2px solid var(--sp-brown);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.cb-label {
    display: block;
    font-family: var(--font-title);
    font-size: 1.05rem;
    color: var(--sp-brown);
    margin-bottom: 0.4rem;
}
.cb-label-mt {
    margin-top: 0.7rem;
}
.cb-optional {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: #999;
    font-weight: normal;
}

.cb-input, .cb-textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 2px solid var(--sp-paper-dark);
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    background: #fff;
    color: var(--sp-text);
    resize: vertical;
}
.cb-input:focus, .cb-textarea:focus {
    outline: none;
    border-color: var(--sp-blue);
}

/* Persona multi-select grid */
.cb-persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.3rem;
}

.cb-persona-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.1s;
}
.cb-persona-card:hover {
    transform: scale(1.05);
}
.cb-persona-card.cb-selected {
    border-color: var(--sp-blue);
    background: rgba(91, 163, 217, 0.1);
}
.cb-persona-card .persona-portrait {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    object-position: top;
    border: 2px solid var(--sp-brown);
}
.cb-persona-card .persona-name {
    font-size: 0.72rem;
    text-align: center;
    margin-top: 2px;
    line-height: 1.1;
}
.cb-check-mark {
    position: absolute;
    top: 2px;
    right: 4px;
    background: var(--sp-blue);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Artefact categories */
.cb-artefact-category {
    margin-top: 0.5rem;
    border: 1.5px solid var(--sp-paper-dark);
    border-radius: 6px;
    overflow: hidden;
}
.cb-artefact-category summary {
    padding: 0.5rem 0.7rem;
    font-family: var(--font-title);
    font-size: 0.95rem;
    color: var(--sp-brown);
    cursor: pointer;
    background: var(--sp-paper-dark);
    user-select: none;
}
.cb-artefact-category summary:hover {
    background: #ddd3c0;
}
.cb-artefact-category[open] summary {
    border-bottom: 1.5px solid var(--sp-paper-dark);
}

.cb-search-row {
    padding: 0.5rem 0.7rem;
}
.cb-search-input {
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1.5px solid var(--sp-paper-dark);
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    background: #fff;
}
.cb-search-input:focus {
    outline: none;
    border-color: var(--sp-blue);
}

.cb-search-results {
    max-height: 180px;
    overflow-y: auto;
}

.cb-search-result-item {
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--sp-paper-dark);
    transition: background 0.1s;
}
.cb-search-result-item:hover {
    background: rgba(91, 163, 217, 0.1);
}
.cb-search-result-item strong {
    color: var(--sp-brown);
}
.cb-result-desc {
    color: #888;
    font-size: 0.78rem;
}

.cb-no-results {
    padding: 0.5rem 0.7rem;
    color: #999;
    font-size: 0.82rem;
    font-style: italic;
}

.cb-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
}
.cb-selected-chips:empty {
    display: none;
}

.cb-artefact-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--sp-blue);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-family: var(--font-body);
}
.cb-chip-remove {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}
.cb-chip-remove:hover {
    opacity: 1;
}

/* Launch section */
.cb-launch-section {
    text-align: center;
    background: transparent;
    border: none;
    padding: 0.5rem 0;
}
.cb-launch-btn {
    font-size: 1.15rem;
    padding: 0.7rem 2.5rem;
    background: var(--sp-yellow);
    border: 2.5px solid var(--sp-brown);
    font-family: var(--font-title);
    letter-spacing: 0.5px;
    transition: transform 0.15s, background 0.15s;
}
.cb-launch-btn:hover {
    background: var(--sp-orange);
    transform: translateY(-2px);
}
.cb-launch-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cb-error {
    color: var(--sp-red);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Context Banner (shared page) */
.context-banner {
    background: var(--sp-paper);
    border: 2px solid var(--sp-brown);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin: 0 auto 0.5rem;
    max-width: 600px;
}

.context-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.context-banner-title {
    font-family: var(--font-title);
    font-size: 1rem;
    color: var(--sp-brown);
}
.context-banner-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--sp-brown);
    padding: 0 0.3rem;
}

.context-banner-body {
    margin-top: 0.5rem;
}
.context-banner-body.collapsed {
    display: none;
}

.context-banner-situation {
    font-size: 0.88rem;
    color: var(--sp-text);
    margin-bottom: 0.4rem;
    font-style: italic;
}

.context-banner-artefacts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.context-banner-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-family: var(--font-body);
    border: 1.5px solid;
}
.context-banner-chip[data-type="location"] { background: #e8f5e9; border-color: var(--sp-green); color: var(--sp-green); }
.context-banner-chip[data-type="episode"] { background: #e3f2fd; border-color: var(--sp-blue); color: var(--sp-blue); }
.context-banner-chip[data-type="concept"] { background: #fff3e0; border-color: var(--sp-orange); color: var(--sp-orange); }
.context-banner-chip[data-type="real_world"] { background: #fce4ec; border-color: var(--sp-red); color: var(--sp-red); }
.context-banner-chip[data-type="running_thread"] { background: #f3e5f5; border-color: #9c27b0; color: #9c27b0; }
.context-banner-chip[data-type="scene"] { background: #e0f2f1; border-color: #009688; color: #009688; }

.context-banner-human {
    font-size: 0.82rem;
    color: #777;
    margin-top: 0.3rem;
}

/* Mobile adjustments for context builder */
@media (max-width: 768px) {
    .context-builder {
        padding: 0.3rem 0.3rem 1.5rem;
    }
    .cb-persona-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        max-height: 220px;
    }
    .cb-persona-card .persona-portrait {
        width: 40px;
        height: 40px;
    }
    .context-cta-btn {
        padding: 0.8rem 1rem;
    }
    .context-cta-icon {
        font-size: 1.6rem;
    }
    .context-cta-text strong {
        font-size: 1.05rem;
    }
}
