
.shelf.portal-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 350px);
  gap: 20px;
  align-items: start;
}
.shelf.portal-active > [data-home-section="hero"],
.shelf.portal-active > [data-home-section="continue"] {
  grid-column: auto;
}
#portal-sidebar {
  grid-column: 2;
  grid-row: 1 / span 6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
}
.shelf.portal-active > :not(#portal-sidebar):not([data-home-section="hero"]):not([data-home-section="continue"]) {
  grid-column: 1;
}

.portal-widget { margin-bottom: 22px; }
.portal-widget:last-child { margin-bottom: 0; }
.portal-widget-title {
  margin: 0 0 12px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding-left: 10px;
  line-height: 1.3;
}

.portal-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
}
.portal-search-box input {
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 100%;
  outline: none;
  font-size: 0.9rem;
}
.portal-search-results {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  max-height: 260px;
  overflow-y: auto;
}
.portal-search-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.portal-search-item:last-child { border-bottom: 0; }
.portal-search-item img { width: 34px; height: 46px; object-fit: cover; border-radius: 6px; }
.portal-search-empty { padding: 10px; margin: 0; color: var(--muted); font-size: 0.86rem; }

.portal-section-pills {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.portal-section-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.portal-section-pill:hover {
  border-color: var(--gold);
  background: rgba(31, 81, 67, 0.35);
  text-decoration: none;
}
.portal-section-pill b {
  background: rgba(31, 81, 67, 0.55);
  color: #cfe3dc;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 999px;
}

.portal-rank-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.portal-rank-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  text-decoration: none;
}
.portal-rank-item a:hover { border-color: var(--gold); text-decoration: none; }
.portal-rank-num {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(31, 81, 67, 0.65);
  color: var(--gold-bright);
  font-size: 0.8rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.portal-rank-item img {
  width: 38px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.portal-rank-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.portal-rank-copy strong {
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-rank-copy small { font-size: 0.76rem; color: var(--muted); }

@media (max-width: 960px) {
  .shelf.portal-active {
    grid-template-columns: 1fr;
  }
  #portal-sidebar {
    grid-column: auto;
    grid-row: auto;
    position: static;
  }
}
