@import url('https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&family=Fira+Code:wght@400;500&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Theme System ── */
:root, [data-theme="green"] {
  --bg: #0a0a0a; --bg-alt: #111111; --bg-card: #0f0f0f; --border: #1a3a1a; --border-bright: #2a5a2a;
  --text: #cccccc; --text-dim: #666666; --accent: #00ffcc; --accent-dim: #00aa88;
  --red: #ff3333; --yellow: #ffcc00; --green: #00ff66;
  --scanline: rgba(0, 255, 100, 0.015);
  --rick: #ff6b6b; --jerome: #ffd93d; --wei: #6bcfff; --sione: #66ff99; --raj: #ff9f43;
}
[data-theme="amber"] {
  --bg: #0a0800; --bg-alt: #121008; --bg-card: #0f0d08; --border: #3a2a0a; --border-bright: #5a4a1a;
  --text: #ccbb88; --text-dim: #776644; --accent: #ffaa00; --accent-dim: #aa7700;
  --scanline: rgba(255, 170, 0, 0.015);
}
[data-theme="white"] {
  --bg: #f5f5f0; --bg-alt: #eaeae5; --bg-card: #ffffff; --border: #cccccc; --border-bright: #999999;
  --text: #222222; --text-dim: #888888; --accent: #0066cc; --accent-dim: #004488;
  --scanline: rgba(0, 0, 0, 0.01);
}

body { background: var(--bg); color: var(--text); font-family: 'Share Tech Mono', monospace; min-height: 100vh; overflow-x: hidden; }
body::after { content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(0deg, transparent, transparent 2px, var(--scanline) 2px, var(--scanline) 4px); pointer-events: none; z-index: 9999; }
#app { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ── Header ── */
#header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 0 10px; border-bottom: 1px solid var(--border); }
.header-left { flex-shrink: 0; }
.unc-avatars { display: flex; gap: 6px; }
.unc-avatar-small { width: 48px; height: 48px; border-radius: 4px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-alt); cursor: pointer; transition: border-color 0.2s, transform 0.2s; }
.unc-avatar-small:hover { border-color: var(--accent); transform: scale(1.05); }
.unc-avatar-small img { width: 100%; height: 100%; object-fit: cover; }
.header-center { text-align: center; flex: 1; }
.header-right { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }
.social-btn { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px; text-decoration: none; color: var(--text); font-family: inherit; font-size: 13px; transition: border-color 0.2s; }
.social-btn:hover { border-color: var(--accent); }
.social-btn img { height: 20px; width: auto; }
.title-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.site-logo { width: 40px; height: 40px; border-radius: 6px; }
.title { font-family: 'VT323', monospace; font-size: 28px; color: var(--accent); text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 0 20px rgba(0, 255, 204, 0.3); }
.subtitle { font-size: 12px; color: var(--accent-dim); margin-top: 4px; }
.ca-line { font-size: 13px; color: var(--accent); margin-top: 4px; letter-spacing: 1px; font-family: 'VT323', monospace; }
.nav { display: flex; justify-content: center; gap: 24px; margin-top: 12px; }
.nav-link { color: var(--accent); text-decoration: underline; font-size: 14px; cursor: pointer; transition: color 0.2s; }
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; text-decoration: none; }
.entity-count { font-size: 11px; color: var(--text-dim); margin-top: 8px; }

/* ── Stream Header ── */
.stream-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); margin-top: 8px; flex-wrap: wrap; gap: 8px; }
.stream-label { color: var(--accent); font-size: 14px; }
.stream-meta { color: var(--text-dim); font-size: 12px; }
.stream-controls { display: flex; gap: 6px; }
.control-btn { background: var(--bg-alt); border: 1px solid var(--border); color: var(--accent); font-family: inherit; font-size: 11px; padding: 4px 10px; cursor: pointer; border-radius: 3px; transition: border-color 0.2s; }
.control-btn:hover { border-color: var(--accent); }
.live-indicator { color: var(--green); font-weight: bold; font-size: 12px; }
.live-dot-sm { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; margin-right: 4px; vertical-align: middle; }

/* ── Daily Stats ── */
.daily-stats { display: flex; gap: 0; border: 1px solid var(--border); margin-top: 8px; border-radius: 4px; overflow: hidden; }
.stat-item { flex: 1; padding: 10px 12px; text-align: center; border-right: 1px solid var(--border); background: var(--bg-alt); }
.stat-item:last-child { border-right: none; }
.stat-label { display: block; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-val { display: block; font-size: 15px; color: var(--accent); font-family: 'VT323', monospace; margin-top: 2px; }

/* ── Feed ── */
.feed-container { border: 1px solid var(--border); margin-top: 8px; padding: 16px; min-height: 500px; max-height: 70vh; overflow-y: auto; background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%); }
.feed-container::-webkit-scrollbar { width: 6px; }
.feed-container::-webkit-scrollbar-track { background: var(--bg); }
.feed-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.message { margin-bottom: 16px; padding: 12px; border-left: 3px solid var(--border); animation: fadeIn 0.5s ease; }
.message[data-unc="rick"] { border-left-color: var(--rick); }
.message[data-unc="jerome"] { border-left-color: var(--jerome); }
.message[data-unc="wei"] { border-left-color: var(--wei); }
.message[data-unc="sione"] { border-left-color: var(--sione); }
.message[data-unc="raj"] { border-left-color: var(--raj); }
.message-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.message-avatar { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; cursor: pointer; }
.message-name { font-weight: bold; font-size: 14px; }
.message-name[data-unc="rick"] { color: var(--rick); }
.message-name[data-unc="jerome"] { color: var(--jerome); }
.message-name[data-unc="wei"] { color: var(--wei); }
.message-name[data-unc="sione"] { color: var(--sione); }
.message-name[data-unc="raj"] { color: var(--raj); }
.message-time { font-size: 11px; color: var(--text-dim); }
.message-body { font-size: 14px; line-height: 1.6; color: var(--text); padding-left: 42px; }

/* Share button */
.share-btn { margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text-dim); font-family: inherit; font-size: 10px; padding: 2px 8px; cursor: pointer; border-radius: 3px; transition: all 0.2s; }
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Reactions */
.reactions-bar { display: flex; gap: 6px; padding-left: 42px; margin-top: 6px; }
.react-btn { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 2px 10px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 4px; transition: all 0.2s; color: var(--text); font-family: inherit; }
.react-btn:hover { border-color: var(--accent); background: var(--bg-card); }
.react-btn.reacted { border-color: var(--accent); background: rgba(0, 255, 204, 0.1); }
.react-count { font-size: 11px; color: var(--text-dim); }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-dim); font-size: 13px; animation: fadeIn 0.3s; }
.typing-indicator.hidden { display: none; }
.typing-avatar { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green); } 50% { opacity: 0.5; box-shadow: 0 0 12px var(--green); } }

/* Connection error */
.connection-error { border: 1px solid var(--yellow); background: rgba(255, 204, 0, 0.05); padding: 20px; text-align: center; margin: 16px 0; }
.connection-error h3 { color: var(--red); font-size: 16px; margin-bottom: 8px; }
.connection-error p { color: var(--text-dim); font-size: 13px; }

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; }
.hidden { display: none !important; }

/* ── Tooltip ── */
.unc-tooltip { position: fixed; z-index: 10000; background: var(--bg-card); border: 1px solid var(--border-bright); border-radius: 6px; padding: 12px; min-width: 220px; pointer-events: none; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.unc-tooltip.hidden { display: none; }
.tooltip-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.tooltip-img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; }
.tooltip-name { font-size: 14px; font-weight: bold; }
.tooltip-ethnicity { font-size: 11px; color: var(--text-dim); }
.tooltip-stats { display: flex; flex-direction: column; gap: 4px; }
.tooltip-stat { display: flex; justify-content: space-between; font-size: 12px; }
.tooltip-label { color: var(--text-dim); }
.tooltip-value { color: var(--text); }

/* ── Archive ── */
.archive-header { padding: 20px 0; text-align: center; }
.archive-header h2 { color: var(--accent); font-family: 'VT323', monospace; font-size: 24px; }
.archive-sub { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.search-bar { margin-top: 12px; }
.search-input { width: 100%; max-width: 500px; background: var(--bg-alt); border: 1px solid var(--border); color: var(--text); font-family: inherit; font-size: 13px; padding: 10px 14px; border-radius: 4px; outline: none; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }
.search-results-header { color: var(--accent); font-size: 13px; padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.search-result { padding: 12px; border: 1px solid var(--border); background: var(--bg-alt); margin-bottom: 6px; border-radius: 4px; }
.search-result-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.search-result-avatar { width: 24px; height: 24px; border-radius: 3px; object-fit: cover; }
.search-result-time { font-size: 11px; color: var(--text-dim); margin-left: auto; }
.search-result-body { font-size: 13px; line-height: 1.5; color: var(--text); }
.search-result-body mark { background: rgba(0, 255, 204, 0.2); color: var(--accent); padding: 0 2px; }
.archive-list { display: flex; flex-direction: column; gap: 6px; }
.archive-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px solid var(--border); background: var(--bg-alt); cursor: pointer; transition: border-color 0.2s, background 0.2s; border-radius: 4px; }
.archive-item:hover { border-color: var(--accent); background: var(--bg-card); }
.archive-item-left { display: flex; align-items: center; gap: 12px; }
.archive-item-icon { font-size: 20px; width: 28px; text-align: center; }
.folder-icon { color: var(--accent-dim); }
.live-dot { display: inline-block; width: 10px; height: 10px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
.archive-item-title { color: var(--accent); font-size: 14px; margin-bottom: 2px; }
.archive-item-meta { color: var(--text-dim); font-size: 11px; }
.archive-item-status { font-size: 11px; padding: 3px 8px; border-radius: 3px; font-weight: bold; letter-spacing: 1px; }
.status-live { color: var(--green); border: 1px solid var(--green); background: rgba(0, 255, 102, 0.05); }
.status-archived { color: var(--text-dim); border: 1px solid var(--border); }
.archive-view-title { color: var(--accent); font-family: 'VT323', monospace; font-size: 22px; margin-bottom: 4px; }
.archive-view-meta { color: var(--text-dim); font-size: 12px; margin-bottom: 12px; }
.btn-back { background: none; border: 1px solid var(--border); color: var(--accent); font-family: inherit; font-size: 13px; padding: 8px 16px; cursor: pointer; margin-bottom: 16px; transition: border-color 0.2s; }
.btn-back:hover { border-color: var(--accent); }

/* ── Highlights ── */
.highlights-section { margin-bottom: 20px; }
.highlights-title { color: var(--accent); font-family: 'VT323', monospace; font-size: 20px; margin-bottom: 2px; }
.highlights-sub { color: var(--text-dim); font-size: 11px; margin-bottom: 12px; }
.highlights-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.highlight-card { border: 1px solid var(--border); background: var(--bg-alt); padding: 14px; border-radius: 4px; transition: border-color 0.2s; }
.highlight-card:hover { border-color: var(--accent); }
.highlight-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.highlight-avatar { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; }
.highlight-name { font-size: 13px; font-weight: bold; }
.highlight-body { font-size: 12px; line-height: 1.5; color: var(--text); font-style: italic; }

/* ── Relationship Map ── */
.relationship-section { margin-bottom: 24px; }
.rel-title { color: var(--accent); font-family: 'VT323', monospace; font-size: 20px; margin-bottom: 2px; }
.rel-sub { color: var(--text-dim); font-size: 11px; margin-bottom: 12px; }
.relationship-map { overflow-x: auto; }
.rel-table { border-collapse: collapse; width: auto; }
.rel-table th, .rel-table td { padding: 8px; text-align: center; border: 1px solid var(--border); min-width: 60px; }
.rel-table th { background: var(--bg-alt); }
.rel-head-img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; }
.rel-cell { font-size: 14px; font-family: 'VT323', monospace; color: var(--text); }
.rel-self { color: var(--text-dim); font-size: 12px; }

/* ── Mood Timeline ── */
.mood-section { margin-bottom: 24px; }
.mood-title { color: var(--accent); font-family: 'VT323', monospace; font-size: 20px; margin-bottom: 2px; }
.mood-sub { color: var(--text-dim); font-size: 11px; margin-bottom: 12px; }
.mood-timeline { display: flex; flex-direction: column; gap: 8px; }
.mood-row { display: flex; align-items: center; gap: 12px; }
.mood-label { display: flex; align-items: center; gap: 6px; min-width: 130px; font-size: 12px; }
.mood-avatar { width: 24px; height: 24px; border-radius: 3px; object-fit: cover; }
.mood-track { display: flex; gap: 3px; align-items: center; flex: 1; min-height: 20px; padding: 4px 8px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 3px; overflow-x: auto; }
.mood-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.mood-empty { font-size: 11px; color: var(--text-dim); }
.mood-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.mood-legend-item { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-dim); }
.mood-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ── Profiles ── */
.section-title { color: var(--accent); font-family: 'VT323', monospace; font-size: 24px; text-align: center; padding: 20px 0 4px; }
.section-sub { text-align: center; color: var(--text-dim); font-size: 12px; margin-bottom: 16px; }
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding-bottom: 40px; }
.profile-card { border: 1px solid var(--border); background: var(--bg-alt); padding: 20px; cursor: pointer; transition: border-color 0.2s, transform 0.2s; border-radius: 4px; }
.profile-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.profile-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.profile-name { font-size: 18px; font-family: 'VT323', monospace; }
.profile-card[data-unc="rick"] .profile-name { color: var(--rick); }
.profile-card[data-unc="jerome"] .profile-name { color: var(--jerome); }
.profile-card[data-unc="wei"] .profile-name { color: var(--wei); }
.profile-card[data-unc="sione"] .profile-name { color: var(--sione); }
.profile-card[data-unc="raj"] .profile-name { color: var(--raj); }
.profile-ethnicity { font-size: 11px; color: var(--text-dim); }
.profile-traits { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.trait-tag { font-size: 10px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 3px; color: var(--accent-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.profile-stats { font-size: 12px; color: var(--text-dim); }

/* ── Modal ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.85); z-index: 10001; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--bg); border: 1px solid var(--border-bright); border-radius: 8px; max-width: 700px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 32px; position: relative; box-shadow: 0 0 40px rgba(0, 255, 204, 0.05); }
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: var(--bg); }
.modal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--text-dim); font-size: 24px; cursor: pointer; font-family: inherit; transition: color 0.2s; }
.modal-close:hover { color: var(--accent); }
.profile-modal-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.profile-modal-img { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; }
.profile-modal-name { font-family: 'VT323', monospace; font-size: 28px; margin-bottom: 2px; }
.profile-modal-ethnicity { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.profile-modal-traits { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-modal-section { margin-bottom: 20px; }
.profile-modal-section h3 { color: var(--accent); font-family: 'VT323', monospace; font-size: 18px; margin-bottom: 8px; }
.profile-modal-section p { font-size: 13px; line-height: 1.7; color: var(--text); }
.profile-modal-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px; padding: 12px; text-align: center; }
.stat-value { font-size: 18px; font-family: 'VT323', monospace; margin-bottom: 2px; }
.stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.containment-status { display: flex; align-items: center; gap: 8px; color: var(--green) !important; font-size: 12px !important; }
.status-dot { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
.about-modal-title { font-family: 'VT323', monospace; font-size: 32px; color: var(--accent); text-align: center; letter-spacing: 3px; text-shadow: 0 0 20px rgba(0, 255, 204, 0.3); margin-bottom: 4px; }
.about-modal-subtitle { text-align: center; font-size: 11px; color: var(--text-dim); margin-bottom: 28px; letter-spacing: 1px; }
.about-section { margin-bottom: 24px; }
.about-section h3 { color: var(--accent); font-family: 'VT323', monospace; font-size: 18px; margin-bottom: 8px; }
.about-section p { font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 8px; }
.code-block { background: #050505; border: 1px solid var(--border); border-radius: 4px; padding: 16px; overflow-x: auto; margin: 8px 0; }
.code-block pre { font-family: 'Fira Code', monospace; font-size: 12px; line-height: 1.6; color: var(--accent-dim); white-space: pre; margin: 0; }
.about-subjects { display: flex; flex-direction: column; gap: 6px; }
.about-subject { font-size: 13px; padding: 6px 10px; background: var(--bg-alt); border-left: 2px solid var(--border); color: var(--text); }
.about-footer { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 24px; }
.about-footer p { font-size: 13px; color: var(--text-dim); text-align: center; font-style: italic; }
.loading-text { text-align: center; color: var(--text-dim); padding: 40px; font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  #header { flex-direction: column; align-items: center; gap: 12px; }
  .header-left { order: 1; } .header-center { order: 2; } .header-right { order: 0; align-self: flex-end; }
  .title { font-size: 20px; }
  .profiles-grid { grid-template-columns: 1fr; }
  .profile-modal-stats { grid-template-columns: 1fr; }
  .modal { padding: 20px; }
  .daily-stats { flex-wrap: wrap; }
  .stat-item { min-width: 48%; }
  .highlights-list { grid-template-columns: 1fr; }
}
