body { margin: 0; padding: 0; }

html, body {
    height: 100%;
    height: 100dvh;
    margin: 0; overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
    background: #eef4ff;
    color: #0c1833;
}

.lh { display: inline-block; transform: scaleX(0.50); margin: 0 -0.14em; font-size: 1.18em; line-height: 1; -webkit-text-stroke: 1.3px #1d4ed8; paint-order: stroke fill; }
.wc { display: inline-block; }
.kv-hi { -webkit-text-stroke: 1.3px #1d4ed8; paint-order: stroke fill; }
.logo-sparkle-wrap { position: relative; display: inline-block; }
.sp {
  position: absolute; font-size: 7px; line-height: 1;
  pointer-events: none; animation: sp-blink 2s ease-in-out infinite;
}
.sp1  { top:-6px;  left:4%;   color:#d97706; animation-delay:0s;   }
.sp2  { top:-7px;  left:25%;  color:#1d4ed8; animation-delay:.5s;  }
.sp3  { top:-5px;  left:52%;  color:#d97706; animation-delay:1s;   }
.sp4  { top:-6px;  left:76%;  color:#1d4ed8; animation-delay:.3s;  }
.sp5  { top:-5px;  right:3%;  color:#d97706; animation-delay:.7s;  }
.sp6  { bottom:-6px; left:12%; color:#1d4ed8; animation-delay:.15s;}
.sp7  { bottom:-7px; left:38%; color:#d97706; animation-delay:.6s; }
.sp8  { bottom:-5px; left:63%; color:#1d4ed8; animation-delay:.9s; }
.sp9  { bottom:-6px; right:7%; color:#d97706; animation-delay:.4s; }
.sp10 { bottom:-5px; left:86%; color:#1d4ed8; animation-delay:1.2s;}
@keyframes sp-blink {
  0%,100% { opacity:.15; transform:scale(.6); }
  50%     { opacity:1;   transform:scale(1.4); }
}
.prose p         { margin-bottom: 0.5rem; }
.prose p:last-child { margin-bottom: 0; }
.prose strong    { font-weight: 700; }
.prose em        { font-style: italic; }
.prose ul        { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 0.5rem; }
.prose ol        { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 0.5rem; }
.prose li        { margin-bottom: 0.2rem; }
.prose h3        { font-weight: 700; font-size: 1rem; margin: 0.75rem 0 0.25rem; }

@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}
.dot-1 { animation: bounce-dot 1.2s infinite 0ms; }
.dot-2 { animation: bounce-dot 1.2s infinite 200ms; }
.dot-3 { animation: bounce-dot 1.2s infinite 400ms; }

#illustPanel {
    width: 152px;
    flex-shrink: 0;
    background: linear-gradient(160deg, #070d1f 0%, #0d2460 50%, #1a4baa 100%);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px 8px;
    border-right: 1px solid rgba(26,75,170,0.2);
}
#illustPanel .panel-title {
    font-size: 8px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    flex-shrink: 0;
    margin-bottom: 10px;
}
.reel-strip {
    width: 100%;
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 8px;
}
.reel-hole {
    width: 9px; height: 9px;
    border-radius: 2px;
    background: rgba(200,146,26,0.35);
    border: 1px solid rgba(200,146,26,0.55);
}
#nameTrackWrap {
    flex: 1;
    overflow: hidden;
    width: 100%;
    position: relative;
}
#nameTrackWrap::before,
#nameTrackWrap::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 36px;
    z-index: 2;
    pointer-events: none;
}
#nameTrackWrap::before {
    top: 0;
    background: linear-gradient(to bottom, #0d1f4e, transparent);
}
#nameTrackWrap::after {
    bottom: 0;
    background: linear-gradient(to top, #0d2460, transparent);
}
#nameTrack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
}
#nameTrack.scrolling {
    animation: nameScrollUp var(--scroll-dur, 30s) linear infinite;
}
#nameTrack.scrolling:hover { animation-play-state: paused; }
@keyframes nameScrollUp {
    0%   { transform: translateY(0); }
    100% { transform: translateY(var(--scroll-offset, -50%)); }
}
.name-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 0 6px;
    cursor: pointer;
    user-select: none;
    background: none;
    border: none;
    transition: opacity 0.15s;
}
.name-card:hover { opacity: 0.75; }
.hist-item-btn { color: #374151; }
.hist-item-btn:hover { background: #eef4ff; color: #1a4baa; }
.trend-item-btn { color: #374151; }
.trend-item-btn:hover { background: #eef4ff; }

/* ── Smart suggestion chips (right panel) ──────────────────────────────────── */
.suggestion-btn {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    text-align: left;
    padding: 7px 8px;
    border-radius: 8px;
    border: 1px solid rgba(26,75,170,0.1);
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-bottom: 5px;
}
.suggestion-btn:hover { background: #eef4ff; border-color: rgba(26,75,170,0.3); }
.suggestion-icon { font-size: 0.75rem; flex-shrink: 0; margin-top: 1px; line-height: 1.4; }
.suggestion-text { font-size: 0.72rem; color: #374151; line-height: 1.4; }
/* KG-sourced suggestions get a subtle gold-left-border to signal uniqueness */
.suggestion-graph { border-left: 2px solid #c8921a; background: #fffdf5; }
.suggestion-graph:hover { background: #fef9ec; border-color: #c8921a; }
.welcome-chip { border-color: rgba(26,75,170,0.15); color: #0c1833; }
.welcome-chip:hover { background: #eef4ff; border-color: rgba(26,75,170,0.4); color: #1a4baa; }
.news-link:hover { color: #1a4baa; }
.news-more-link:hover { color: #c8921a !important; }
.bo-source-link:hover { color: #1a4baa !important; }
.name-avatar {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    font-family: 'Inter', system-ui, sans-serif;
    color: rgba(255,255,255,0.92);
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
    position: relative;
    overflow: hidden;
}
.name-avatar::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.18), transparent 65%);
    border-radius: 50%;
}
.name-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    font-family: 'Inter', system-ui, sans-serif;
    text-align: center;
    line-height: 1.3;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.name-role {
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    text-align: center;
}
.headline-card {
    width: 100%;
    padding: 8px 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
a.headline-card:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}
.headline-card .hc-label {
    font-size: 7.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
}
.headline-card .hc-text {
    font-size: 9.5px;
    line-height: 1.4;
    color: rgba(255,255,255,1);
    font-family: 'Inter', system-ui, sans-serif;
}
.headline-card .hc-source {
    font-size: 8px;
    color: rgba(255,255,255,0.55);
}

.people-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px 3px 4px;
    border: 1px solid rgba(26,75,170,0.15); border-radius: 999px;
    background: white; font-size: 11px; color: #0c1833;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    white-space: nowrap;
    animation: fadeInUp 0.3s ease both;
}

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

#chatThread {
    scroll-behavior: smooth;
}

/* Code blocks in LLM responses: scroll within their own box (applies to all screen sizes) */
.prose pre { overflow-x: auto; max-width: 100%; }

/* Hover effects only on devices with real hover support (desktop + mouse).
   On iOS, inline onmouseover fires on first tap and can interrupt navigation
   compositing — replaced with @media (hover: hover) CSS to prevent crashes. */
@media (hover: hover) {
    .chat-home-link:hover   { color: #c8921a !important; }
    .chat-social-link:hover { background: #dbeafe !important; }
}

.input-bar-wrapper {
    background: rgba(238,244,255,0.97);
    border-top: 1px solid rgba(26,75,170,0.1);
    box-shadow: 0 -4px 20px rgba(26,75,170,0.06);
}

@media (max-width: 768px) {
    #illustPanel   { display: none !important; }
    #rightPanel    { display: none !important; }
    #headerTagline {
        position: static !important;
        transform: none !important;
        flex: 1;
        justify-content: center;
    }
    #headerTagline svg { display: none !important; }
    #headerTagline > span { font-size: 0.85rem !important; }
    header { padding: 8px 12px !important; gap: 8px !important; }
    .input-bar-wrapper { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    .home-label     { display: none; }
    .new-chat-label { display: none; }
    header .logo-sparkle-wrap { font-size: 1.55rem !important; }
    header .flex-shrink-0:nth-child(2) > span { padding: 5px 8px !important; }
    header .flex-shrink-0:nth-child(2) > div:first-child {
        width: 36px !important; height: 36px !important; font-size: 18px !important;
    }
    /* Prevent the chat thread from scrolling horizontally — the thread only needs
       vertical scroll; overflow-y:auto (set via Tailwind) implicitly makes
       overflow-x:auto too, which enables horizontal scroll on wide content. */
    #chatThread { overflow-x: hidden; }
    /* Long words and URLs wrap instead of overflowing message bubbles */
    .prose { word-break: break-word; overflow-wrap: anywhere; }
}
