@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --font: 'DM Sans', sans-serif;

  /* Light mode (default) */
  --bg:           #ffffff;
  --bg-subtle:    #f8f8f8;
  --bg-hover:     #f1f1f1;
  --border:       #e0e0e0;
  --border-focus: #000000;
  --text:         #202020;
  --text-muted:   #5f6368;
  --text-link:    #1a0dab;
  --text-url:     #006621;
  --accent:       #000000;
  --accent-inv:   #ffffff;
  --shadow:       0 1px 6px rgba(32,32,32,.12), 0 2px 12px rgba(32,32,32,.08);
  --shadow-hover: 0 2px 12px rgba(32,32,32,.18), 0 4px 24px rgba(32,32,32,.12);
  --radius:       24px;
  --radius-sm:    12px;
  --mark-bg:      rgba(0,0,0,.08);
}

[data-theme="dark"] {
  --bg:           #111111;
  --bg-subtle:    #1a1a1a;
  --bg-hover:     #222222;
  --border:       #2a2a2a;
  --border-focus: #ffffff;
  --text:         #e8e8e8;
  --text-muted:   #9aa0a6;
  --text-link:    #8ab4f8;
  --text-url:     #81c995;
  --accent:       #ffffff;
  --accent-inv:   #111111;
  --shadow:       0 1px 6px rgba(0,0,0,.4), 0 2px 12px rgba(0,0,0,.3);
  --shadow-hover: 0 2px 12px rgba(0,0,0,.5), 0 4px 24px rgba(0,0,0,.4);
  --mark-bg:      rgba(255,255,255,.12);
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background .2s, color .2s;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font); }
input, textarea { font-family: var(--font); }

mark {
  background: var(--mark-bg);
  color: var(--text);
  border-radius: 2px;
  padding: 0 1px;
}

/* ── Header (Search pages) ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  white-space: nowrap;
  color: var(--text);
}

.header-logo span { opacity: .45; }

/* ── Search Bar ────────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 680px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px;
  gap: 10px;
  transition: box-shadow .2s, border-color .2s;
}

.search-bar:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-hover);
}

.search-bar svg { flex-shrink: 0; opacity: .5; }

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  padding: 12px 0;
  min-width: 0;
}

.search-input::placeholder { color: var(--text-muted); }

.search-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}

.search-btn:hover { background: var(--bg-hover); color: var(--text); }

/* ── Autocomplete Dropdown ─────────────────────────────────────────────────── */
.autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 200;
}

.autocomplete.open { display: block; }

.ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}

.ac-item:hover, .ac-item.active { background: var(--bg-hover); }
.ac-item svg { opacity: .4; flex-shrink: 0; }

/* ── Nav Tabs ──────────────────────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  border-radius: 0;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  transition: color .15s;
  text-decoration: none;
}

.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ── Search Results ────────────────────────────────────────────────────────── */
.results-layout {
  display: flex;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

.results-main { flex: 1; min-width: 0; max-width: 720px; }

.results-sidebar {
  width: 300px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .results-sidebar { display: none; }
}

.results-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-top: 4px;
}

/* ── Result Card ───────────────────────────────────────────────────────────── */
.result-card {
  margin-bottom: 28px;
}

.result-source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.result-favicon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: contain;
}

.result-favicon-placeholder {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
}

.result-domain { font-size: 13px; color: var(--text-muted); }
.result-url    { font-size: 12px; color: var(--text-url); margin-left: 2px; }

.result-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-link);
  line-height: 1.3;
  margin-bottom: 4px;
  display: block;
}

.result-title:hover { text-decoration: underline; }

.result-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ── ION Ask Panel — see full definition in iON AI Answer Panel section below ─ */

/* ── Homepage Layout ───────────────────────────────────────────────────────── */
.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  padding-bottom: 120px;
}

.home-logo {
  font-size: clamp(52px, 10vw, 86px);
  font-weight: 700;
  letter-spacing: -.04em;
  margin-bottom: 32px;
  line-height: 1;
  position: relative;
}

.home-logo .logo-i { opacity: .35; font-style: italic; }

.home-search-wrap {
  width: 100%;
  max-width: 580px;
  margin-bottom: 16px;
}

.home-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 20px;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}

.home-search-bar:focus-within {
  box-shadow: var(--shadow-hover);
}

.home-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  padding: 16px 0;
}

.home-search-input::placeholder { color: var(--text-muted); }

.home-btns {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  transition: background .15s, box-shadow .15s;
}

.btn:hover {
  background: var(--bg-hover);
  box-shadow: var(--shadow);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-inv);
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: .88;
}

/* ── Minions Grid ──────────────────────────────────────────────────────────── */
.minions-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px 0 4px;
  max-width: 580px;
}

.minions-bar::-webkit-scrollbar { display: none; }

.minion-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  background: var(--bg);
  transition: background .15s, border-color .15s;
  text-decoration: none;
}

.minion-chip:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.minion-icon { font-size: 14px; }

/* ── Minions Explorer Page ─────────────────────────────────────────────────── */
.minions-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.minions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.minion-card {
  padding: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.minion-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  background: var(--bg-subtle);
}

.minion-card-icon {
  font-size: 28px;
  line-height: 1;
}

.minion-card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.minion-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── User Menu ─────────────────────────────────────────────────────────────── */
.user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border);
}

.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-inv);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.user-dropdown {
  position: relative;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  display: none;
  z-index: 300;
}

.user-menu.open { display: block; }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: background .1s;
}

.user-menu-item:hover { background: var(--bg-hover); }
.user-menu-divider { height: 1px; background: var(--border); }

/* ── Theme Toggle ──────────────────────────────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 14px 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-link { color: var(--text-muted); transition: color .15s; }
.footer-link:hover { color: var(--text); }

/* ── Home Footer ───────────────────────────────────────────────────────────── */
.home-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 16px 24px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

/* ── Home Nav Bar ──────────────────────────────────────────────────────────── */
.home-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 24px;
  gap: 12px;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-link);
  text-decoration: none;
  transition: background .15s;
}

.page-num:hover { background: var(--bg-hover); }
.page-num.active {
  background: var(--accent);
  color: var(--accent-inv);
}

/* ── Utility ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header { padding: 10px 12px; gap: 12px; }
  .header-logo { font-size: 18px; }
  .results-layout { padding: 16px 12px 40px; }
  .home-btns { flex-direction: column; }
  .nav-tabs { padding: 0 12px; }
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in .2s ease both; }

.result-card { animation: fade-in .25s ease both; }
.result-card:nth-child(2) { animation-delay: .04s; }
.result-card:nth-child(3) { animation-delay: .08s; }
.result-card:nth-child(4) { animation-delay: .12s; }
.result-card:nth-child(5) { animation-delay: .16s; }

/* ── No Results ────────────────────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results-icon { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.no-results-title { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }

/* ── PWA install banner ────────────────────────────────────────────────────── */
.install-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-inv);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
  z-index: 1000;
  white-space: nowrap;
}

.install-banner button {
  background: var(--accent-inv);
  color: var(--accent);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.install-dismiss {
  background: transparent !important;
  color: var(--accent-inv) !important;
  opacity: .7;
  font-size: 18px !important;
  padding: 0 !important;
  width: 24px;
  height: 24px;
}

/* ════════════════════════════════════════════════════════════════════════════
   iON AI Answer Panel
   ════════════════════════════════════════════════════════════════════════════ */
.ion-panel {
  margin-bottom: 20px;
}

.ion-box {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.65;
  animation: fade-in .25s ease both;
}

.ion-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.ion-box-header span { font-size: 14px; }

.ion-answer-body {
  color: var(--text);
  line-height: 1.7;
}

.ion-answer-body strong { font-weight: 600; }
.ion-answer-body a { color: var(--text-link); }

.ion-answer-meta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.ion-answer-meta a { color: var(--text-muted); text-decoration: underline; }

.ion-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 12px 0;
}

.ion-dots {
  display: inline-flex;
  gap: 3px;
}

.ion-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: ion-bounce .9s ease infinite;
}
.ion-dots span:nth-child(2) { animation-delay: .15s; }
.ion-dots span:nth-child(3) { animation-delay: .3s; }

@keyframes ion-bounce {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ════════════════════════════════════════════════════════════════════════════
   SYMBION — Academic Search Styles
   ════════════════════════════════════════════════════════════════════════════ */

/* Layout override for scholar */
.scholar-layout {
  display: block !important;
  padding: 0 !important;
}

.scholar-layout .results-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}

/* SYMBION bar */
.symbion-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.symbion-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.symbion-logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.symbion-count {
  font-size: 13px;
  color: var(--text-muted);
}

.symbion-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.symbion-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Filters */
.symbion-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.symbion-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.symbion-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}

.symbion-select {
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.symbion-select:focus { border-color: var(--border-focus); }

.symbion-input-sm {
  width: 80px;
  padding: 5px 8px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
}

.symbion-input-sm:focus { border-color: var(--border-focus); }

.symbion-clear-btn {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: all .15s;
}
.symbion-clear-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Paper Cards */
.paper-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color .15s, box-shadow .15s;
}

.paper-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.paper-meta-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.paper-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.badge-arxiv  { background: #e8f0fe; color: #1967d2; }
.badge-pubmed { background: #e6f4ea; color: #1e7e34; }
.badge-manual { background: #fef3e2; color: #b06000; }

[data-theme="dark"] .badge-arxiv  { background: #1a2a4a; color: #8ab4f8; }
[data-theme="dark"] .badge-pubmed { background: #1a3020; color: #81c995; }
[data-theme="dark"] .badge-manual { background: #3a2800; color: #fdd663; }

.paper-field {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.paper-year {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.paper-title {
  display: block;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-link);
  text-decoration: none;
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color .15s;
}

.paper-title:hover { text-decoration: underline; }

.paper-authors {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.paper-journal {
  font-style: italic;
}

.paper-abstract {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 10px;
  opacity: .85;
}

.paper-keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.paper-keyword {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: all .15s;
  background: var(--bg-subtle);
}

.paper-keyword:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.paper-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.paper-stats {
  display: flex;
  gap: 14px;
}

.paper-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.paper-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paper-action-btn {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  background: var(--bg);
  font-family: var(--font);
  transition: all .15s;
  cursor: pointer;
}

.paper-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.btn-primary-sm {
  background: var(--accent) !important;
  color: var(--accent-inv) !important;
  border-color: var(--accent) !important;
  font-weight: 600 !important;
}

.btn-primary-sm:hover {
  opacity: .85 !important;
}

/* Related web results in scholar */
.symbion-web-section {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.symbion-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ════════════════════════════════════════════════════════════════════════════
   SYMBION Homepage
   ════════════════════════════════════════════════════════════════════════════ */
.symbion-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.symbion-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 40px;
  text-align: center;
}

.symbion-home-logo {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.symbion-icon-hero { font-size: 42px; }

.symbion-tagline {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.symbion-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
  max-width: 640px;
}

.symbion-field-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  transition: all .15s;
}

.symbion-field-chip:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.symbion-field-count {
  font-size: 11px;
  opacity: .5;
  font-weight: 400;
}

/* Featured papers grid */
.symbion-featured {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.symbion-section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.symbion-papers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.symbion-paper-tile {
  padding: 18px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .15s, box-shadow .15s;
}

.symbion-paper-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.spt-field {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.spt-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.spt-authors {
  font-size: 12px;
  color: var(--text-muted);
}

.spt-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Responsive for scholar */
@media (max-width: 640px) {
  .scholar-layout .results-main { padding: 16px 12px 40px; }
  .symbion-filters { gap: 8px; }
  .paper-card { padding: 16px; }
  .symbion-home-logo { font-size: 36px; }
  .symbion-papers-grid { grid-template-columns: 1fr; }
}

/* ─── 360NE Creators Studio ─────────────────────────────────────────────────── */

.studio-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.studio-hero {
  display: flex;
  align-items: center;
  gap: 48px;
  padding: 48px 0 56px;
  flex-wrap: wrap;
}

.studio-hero-content {
  flex: 1;
  min-width: 280px;
}

.studio-logo {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -.04em;
  margin-bottom: 8px;
}

.studio-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 12px;
  line-height: 1.1;
}

.studio-tagline {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.65;
}

.studio-hero-visual {
  flex-shrink: 0;
}

.minion-diagram {
  position: relative;
  width: 220px;
  height: 220px;
}

.md-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  background: var(--accent);
  color: var(--accent-inv);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  z-index: 2;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.md-node {
  position: absolute;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
}

.md-n1 { top: 10px; left: 50%; transform: translateX(-50%); }
.md-n2 { top: 30%; right: 0; }
.md-n3 { bottom: 30%; right: 0; }
.md-n4 { bottom: 10px; left: 50%; transform: translateX(-50%); }
.md-n5 { top: 30%; left: 0; }

.studio-section {
  margin-bottom: 48px;
}

.studio-section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.how-card {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  transition: border-color .15s, transform .15s;
}

.how-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.how-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .1em;
  margin-bottom: 8px;
}

.how-icon {
  font-size: 28px;
  margin-bottom: 10px;
}

.how-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.how-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.studio-empty {
  padding: 60px 40px;
  text-align: center;
  color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  resize: vertical;
}

.form-input:focus {
  border-color: var(--accent);
}

/* Minion active panel */
.minion-active-panel {
  background: var(--bg-subtle);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 28px;
}

.minion-active-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.minion-active-icon {
  font-size: 20px;
}

.minion-results-area {
  min-height: 40px;
}

/* Minion capabilities */
.minion-search-panel {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.minion-capabilities {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}

.minion-cap-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.minion-cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.minion-cap-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  padding: 8px 0;
}

.minion-card-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.minion-card-featured {
  border-color: var(--accent) !important;
}

.minions-hero {
  text-align: center;
  padding: 40px 24px 48px;
}

.minions-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
}

/* ─── Marketplace ────────────────────────────────────────────────────────────── */

.marketplace-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.marketplace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.marketplace-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.market-cat-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.market-cat-chip:hover,
.market-cat-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-inv);
}

.market-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.market-featured-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
  position: relative;
}

.market-featured-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.market-feat-icon {
  font-size: 36px;
  flex-shrink: 0;
  line-height: 1;
}

.market-feat-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
}

.market-feat-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.market-install-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: var(--accent-inv);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}

.market-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.market-app-card {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.market-app-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.mac-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 6px;
}

.mac-name {
  font-size: 14px;
  font-weight: 700;
}

.mac-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.mac-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 6px;
}

.mac-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 6px;
  width: fit-content;
}

.mac-badge-special {
  background: var(--accent);
  color: var(--accent-inv);
  border-color: var(--accent);
}

/* Small button variant */
.btn-sm {
  padding: 5px 12px !important;
  font-size: 12px !important;
}

/* ── Alert / Flash Messages ─────────────────────────────────────────────────── */
.alert-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 14px;
}

.alert-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .alert-error {
  background: #3b1515;
  border-color: #7f1d1d;
  color: #fca5a5;
}

[data-theme="dark"] .alert-success {
  background: #14301f;
  border-color: #166534;
  color: #86efac;
}
