/**
 * Entity Page Styles
 * 
 * Shared styles for subject, league, and tag pages.
 * Card styles come from explore.css and index-shared.css
 */

/* ============================================================================
 * Page Layout
 * ============================================================================ */

.entity-page {
  position: relative;
  min-height: 100vh;
}

/* Ensure all main sections sit above ambient background */
.entity-page > section {
  position: relative;
  z-index: 1;
}

/* Topic timeline area - wrapper for animation and panels sections */
.topic-timeline-area {
  position: relative;
  width: 100%;
}

/* Topic page ambient animation - position behind panels */
.topic-timeline-area .ambient-animation-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Ensure panels section sits above ambient animation */
.topic-timeline-area .topic-panels-section {
  position: relative;
  z-index: 1;
  background: transparent;
}

/* ============================================================================
 * Entity Hero Section (Title + Search)
 * ============================================================================ */

/* Hide hero section on topic pages */
.topic-page .entity-hero {
  display: none;
}

/* Make timeline section transparent on topic pages */
.topic-page .explore-timeline-section {
  background: transparent;
}

.entity-hero {
  text-align: center;
  padding: 0 var(--spacing-xl);
  max-width: 900px;
  margin: 0 auto;
}

.entity-hero .hero-brand-title {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 3.5rem;
}

.entity-hero .brand-dash {
  font-size: 3rem;
}

.entity-hero .hero-brand-tagline {
  margin-top: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

.entity-hero .search-container {
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

/* ============================================================================
 * Header Section
 * ============================================================================ */

/* Entity header section wrapper */
.entity-header-section {
  margin: 1.5rem 0 2rem;
}

/* Ensure section-container constrains entity-header correctly */
.entity-header-section .section-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.entity-header {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 480px;
  overflow: hidden;
  background: linear-gradient(135deg,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

.entity-header-image {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center 35%; /* Show slightly above center */
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius-lg);
}

.entity-header-image.loaded {
  opacity: 1;
}

/* Brand placeholder - larger size for the big entity header */
.entity-header .entity-brand-placeholder img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.entity-header .entity-brand-placeholder span {
  font-size: 1.75rem;
}

.entity-header-image[href]:hover {
  transform: scale(1.01);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.entity-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  display: flex;
  align-items: flex-end;
  padding: 2rem;
}

.entity-header-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.entity-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.entity-type-icon {
  font-size: 1.25rem;
}

/* Type-specific badge colors */
.subject-badge {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.league-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tag-badge {
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.entity-name {
  font-size: 3rem;
  font-weight: 800;
  color: white;
  margin: 0 0 1rem 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.entity-featured-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.featured-index-title {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.2s;
  text-align: left;
  line-height: 1.3;
}

.featured-index-title:hover {
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(0, 168, 255, 0.6);
}

.entity-creator-attribution {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.attribution-label {
  opacity: 0.8;
}

.attribution-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  transition: color 0.2s ease;
}

.attribution-link:hover {
  color: #33c4ff;
}

.attribution-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.attribution-link:hover .attribution-avatar {
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
}

.attribution-username {
  font-weight: 600;
}

.entity-no-image-message {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-style: italic;
  margin-top: 0.75rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  max-width: 350px;
  line-height: 1.4;
}

.no-image-cta-link {
  color: var(--color-primary);
  text-decoration: underline;
  font-style: italic;
  transition: opacity 0.2s ease;
}

.no-image-cta-link:hover {
  opacity: 0.8;
}

/* ============================================================================
 * Topic Library Grid Cards
 * ============================================================================ */

.topic-page .library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding: 0;
}

@media (max-width: 1200px) {
  .topic-page .library-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .topic-page .library-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .topic-page .library-grid {
    grid-template-columns: 1fr;
  }
}

.library-grid-card {
  background: var(--color-bg-secondary, #0c0c0e);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.library-grid-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.library-grid-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--color-bg-tertiary, #16213e);
}

.library-grid-card-type-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.library-grid-card-type-badge svg {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.library-grid-card-content {
  padding: 0.875rem 1rem;
}

.library-grid-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-grid-card-creator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-tertiary, rgba(255, 255, 255, 0.6));
}

.library-grid-card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.library-grid-card-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Library Empty State */
.topic-page .library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--color-text-tertiary, rgba(255, 255, 255, 0.5));
}

.topic-page .library-empty svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.topic-page .library-empty h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
  margin: 0 0 0.5rem 0;
}

.topic-page .library-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.library-empty-link {
  color: var(--color-primary, #00a8ff);
  text-decoration: underline;
}

/* Library Loading */
.topic-page .library-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  width: 100%;
  gap: 1rem; /* Explicit gap to prevent inheritance issues */
}

.topic-page .library-loading .profile-loading-text {
  line-height: 1.4; /* Fixed line-height prevents reflow from dots animation */
}

.topic-page .library-loading .profile-loading-bar {
  margin: 0 auto;
}

/* ============================================================================
 * Data Section (for subjects/leagues with data mappings)
 * ============================================================================ */

.entity-data-section {
  background: var(--color-bg-secondary);
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.data-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.data-card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--color-border);
}

/* ============================================================================
 * Indexes Section
 * ============================================================================ */

.entity-indexes-section {
  padding: 1.5rem 2rem;
  min-height: 400px;
}

.indexes-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.index-count {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Use fixed-width columns for consistent card sizing */
.indexes-grid {
  display: grid;
  grid-template-columns: repeat(3, 340px);
  gap: 2rem;
  margin-bottom: 2rem;
  justify-content: center;
}

/* Ensure cards don't exceed grid column width */
.indexes-grid .index-card {
  width: 100%;
  max-width: 340px;
}

/* ============================================================================
 * Load More
 * ============================================================================ */

.load-more-container {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.btn-load-more {
  padding: 0.75rem 2rem;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-load-more:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============================================================================
 * Empty State
 * ============================================================================ */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

/* ============================================================================
 * Entity Timeline Section
 * ============================================================================ */

.entity-timeline-section {
  padding: 1.5rem 2rem;
}

.entity-timeline-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.view-all-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.view-all-link:hover {
  opacity: 0.8;
  color: var(--color-text-primary);
}

/* Entity Timeline Section uses timeline.css classes directly */
/* Timeline viewport is outside section-container for full-width scrolling */

/* ============================================================================
 * Related Topics Section
 * ============================================================================ */

.related-topics-section {
  padding: 1.5rem 2rem;
}

.related-topics-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.related-topics-section .section-header h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.related-topics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

/* Square topic preview card */
.related-topic-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.related-topic-card:hover {
  border-color: rgba(0, 168, 255, 0.5);
  box-shadow: 0 4px 20px rgba(0, 168, 255, 0.15);
  transform: translateY(-2px);
}

.related-topic-media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease;
}

.related-topic-card:hover .related-topic-media {
  transform: scale(1.05);
}

.related-topic-overlay {
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.3) 50%,
    transparent 100%
  );
  z-index: 1;
}

.related-topic-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  z-index: 2;
}

.related-topic-name {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fallback for topics without media */
.related-topic-card-no-media {
  background: linear-gradient(135deg, var(--color-bg-base-light) 0%, var(--color-bg-base-mid) 100%);
}

.related-topic-card-no-media .related-topic-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 100%);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .related-topics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .related-topics-section {
    padding: 1rem;
  }
  
  .related-topics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .related-topic-name {
    font-size: 0.8rem;
  }
  
  .related-topic-content {
    padding: 0.5rem;
  }
}

/* ============================================================================
 * Entity Leaderboard Section
 * ============================================================================ */

.entity-leaderboard-section {
  padding: 1.5rem 2rem;
}

.entity-leaderboard-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.leaderboard-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-select-mini {
  padding: 0.5rem 1rem;
  background: rgba(0, 168, 255, 0.1);
  border: 1px solid rgba(0, 168, 255, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.sort-select-mini:focus {
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.sort-select-mini option {
  background: #141416;
  color: #f1f5f9;
  padding: 0.5rem;
}

.entity-leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.leaderboard-card {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  border: 1px solid rgba(0, 168, 255, 0.3);
  box-shadow: 0 0 8px rgba(0, 168, 255, 0.15);
}

.leaderboard-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 24px rgba(0, 168, 255, 0.35), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.leaderboard-card-rank {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.leaderboard-card.rank-1 .leaderboard-card-rank {
  background: linear-gradient(135deg, #ffd700, #ffb800);
}

.leaderboard-card.rank-2 .leaderboard-card-rank {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
}

.leaderboard-card.rank-3 .leaderboard-card-rank {
  background: linear-gradient(135deg, #cd7f32, #b87333);
}

.leaderboard-card {
  position: relative;
}

.leaderboard-card-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 4px solid rgba(0, 168, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 168, 255, 0.4);
}

.leaderboard-card:hover .leaderboard-card-avatar {
  border-color: rgba(0, 168, 255, 0.8);
  box-shadow: 0 0 24px rgba(0, 168, 255, 0.6);
}

.leaderboard-card-username {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.leaderboard-card-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.leaderboard-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.leaderboard-card-stat-value {
  font-weight: 700;
  color: var(--color-text-primary);
  font-size: 1rem;
}

/* ============================================================================
 * Admin Controls - Topic Default Image
 * ============================================================================ */

.topic-admin-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-btn:hover {
  background: rgba(0, 168, 255, 0.3);
  border-color: rgba(0, 168, 255, 0.5);
}

.admin-btn svg {
  flex-shrink: 0;
}

/* ============================================================================
 * Default Image Modal
 * ============================================================================ */

/* Default Image Popup (matches Sign In popup style) */
.default-image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.default-image-popup {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 20px;
  padding: 32px;
  background: var(--color-bg-elevated, #141416);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.default-image-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.default-image-popup-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.default-image-popup-header {
  text-align: center;
  margin-bottom: 24px;
}

.default-image-popup-header h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
}

.default-image-popup-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.6));
}

.default-image-popup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.default-image-popup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.default-image-popup-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.7));
}

.default-image-popup-field input[type="text"] {
  padding: 12px 14px;
  background: var(--color-bg-base, #1e1f24);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--color-text-primary, #fff);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.default-image-popup-field input[type="text"]:focus {
  border-color: rgba(0, 168, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.1);
}

.default-image-popup-field input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.default-image-popup-field input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--color-bg-base, #1e1f24);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--color-text-primary, #fff);
  font-size: 0.9rem;
  cursor: pointer;
}

.default-image-popup-field input[type="file"]::file-selector-button {
  padding: 6px 14px;
  margin-right: 12px;
  background: rgba(0, 168, 255, 0.15);
  border: 1px solid rgba(0, 168, 255, 0.3);
  border-radius: 6px;
  color: #00a8ff;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.default-image-popup-field input[type="file"]::file-selector-button:hover {
  background: rgba(0, 168, 255, 0.25);
  border-color: rgba(0, 168, 255, 0.5);
}

.default-image-popup-field .upload-preview {
  margin-top: 8px;
}

.default-image-popup-field .upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.default-image-popup-field .current-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-bg-base, #1e1f24);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.default-image-popup-field .current-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.remove-default-btn {
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-default-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.default-image-popup-error {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 0.85rem;
  text-align: center;
  display: none;
}

.default-image-popup-error:not(:empty) {
  display: block;
}

.default-image-popup-submit {
  padding: 14px 20px;
  background: transparent;
  border: 2px solid rgba(0, 168, 255, 0.6);
  border-radius: 8px;
  color: #00a8ff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(0, 168, 255, 0.2), inset 0 0 15px rgba(0, 168, 255, 0.05);
}

.default-image-popup-submit:hover:not(:disabled) {
  background: rgba(0, 168, 255, 0.1);
  border-color: rgba(0, 168, 255, 0.8);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(0, 168, 255, 0.4), inset 0 0 20px rgba(0, 168, 255, 0.1);
}

.default-image-popup-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ============================================================================
 * Topic Page - Recent Uploads Header Width Constraint
 * ============================================================================ */

/* Override full-viewport width to match masonry wrapper */
.topic-page .recent-posts-header-grid {
  width: 100%;
  margin-left: 0;
  padding: 0.75rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Adjust divider line to not extend beyond content */
.topic-page .recent-posts-header-grid::after {
  left: 2rem;
  right: 2rem;
}

/* Match topic filter bar to masonry wrapper width */
.topic-page .topic-filter-bar-section .section-container {
  max-width: 1400px;
  padding: 0 2rem;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ============================================================================
 * Responsive Design
 * ============================================================================ */

@media (max-width: 1200px) {
  .indexes-grid {
    grid-template-columns: repeat(2, 340px);
  }
}

@media (max-width: 768px) {
  .entity-header {
    height: 360px;
  }

  .entity-name {
    font-size: 2rem;
  }

  .entity-header-overlay {
    padding: 1rem;
  }

  .indexes-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .indexes-grid .index-card {
    max-width: none;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .entity-indexes-section {
    padding: 2rem 1rem;
  }

  .entity-timeline-section,
  .entity-leaderboard-section {
    padding: 2rem 1rem;
  }

  .entity-leaderboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
 * Topic Page - Library Table View Adjustments
 * Match portfolio page proportions (no Creator column)
 * ============================================================================ */

/* Topic page tabs - transparent background (no dark strip) */
.topic-page .portfolio-tabs {
  background: transparent;
}

.topic-page .portfolio-tabs::before {
  display: none;
}

/* Topic page table - use fixed layout to force full width */
.topic-page .library-table {
  width: 100%;
  table-layout: fixed;
}

/* Topic page table column widths - Name column gets remaining space */
.topic-page .library-table .col-name {
  width: 25%;
}

.topic-page .library-table .col-type {
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-page .library-table .col-tags {
  width: 240px;
}

.topic-page .library-table .col-date {
  width: 100px;
}

/* Mobile - phone */
@media (max-width: 480px) {
  .entity-header {
    height: 280px;
  }

  .entity-name {
    font-size: 1.5rem;
  }

  .entity-header-overlay {
    padding: 0.75rem;
  }

  .entity-indexes-section,
  .entity-timeline-section,
  .entity-leaderboard-section {
    padding: 1.5rem 0.75rem;
  }

  .entity-leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .topic-page .library-table {
    table-layout: auto;
  }

  .topic-page .library-table .col-name {
    width: auto;
  }

  .topic-page .library-table .col-type {
    width: auto;
  }

  .topic-page .library-table .col-tags {
    display: none;
  }

  .topic-page .library-table .col-date {
    width: 80px;
  }

  .topic-page .portfolio-tabs {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ============================================================================
   League Browse Section
   ============================================================================ */

.league-browse-section {
  padding: 20px var(--spacing-lg) 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.league-browse-group {
  margin-bottom: 16px;
}

.league-browse-group-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.league-browse-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.league-browse-row::-webkit-scrollbar {
  height: 4px;
}

.league-browse-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.league-browse-card {
  flex: 0 0 auto;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.league-browse-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.league-browse-card-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.league-browse-card-placeholder {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.league-browse-card-name {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 768px) {
  .league-browse-section {
    padding: 16px var(--spacing-md) 4px;
  }

  .league-browse-card {
    width: 100px;
  }

  .league-browse-card-img {
    width: 52px;
    height: 52px;
  }
}


/* GPA narrative styles moved to collection-blocks.css (block-based rendering) */

/* ── Scores Tab ────────────────────────────────────────────────────────── */

.scores-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.scores-header {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.scores-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  margin-bottom: 0.75rem;
}

.scores-date-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.scores-arrow {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.scores-arrow:hover { background: rgba(255,255,255,0.05); color: #fff; }

.scores-event-strip {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}

.scores-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 14px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-radius: 6px;
  min-width: 0;
  flex: 1;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scores-day:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7); }
.scores-day.active {
  color: #fff;
  font-weight: 600;
}
.scores-day.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: #60a5fa;
  border-radius: 1px;
}
.scores-day.has-data .scores-day-date { color: rgba(255,255,255,0.8); }
.scores-day.active .scores-day-date { color: #fff; }


.scores-day-name {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.scores-day-date {
  font-size: 0.7rem;
  font-weight: 500;
}

.scores-filter {
  flex-shrink: 0;
  margin-left: auto;
}

.scores-format-select {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='rgba(255,255,255,0.5)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.scores-format-select:hover { border-color: rgba(255,255,255,0.2); }
.scores-format-select option { background: #1a1a2e; color: #fff; }

.scores-filters {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.scores-tournament-dates {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-left: 0.75rem;
}

.scores-tournament {
  margin-bottom: 1.5rem;
}

.scores-tournament-header {
  display: flex;
  align-items: center;
  padding: 1.25rem 0 0.75rem;
  margin-bottom: 0.5rem;
}

.scores-tournament-link {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
}
.scores-tournament-link:hover { text-decoration: underline; }

.scores-matchups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scores-matchup {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scores-matchup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.scores-matchup-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
}

.scores-matchup-record {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 1px;
}

.scores-match-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.scores-card {
  min-width: 0;
}
.scores-card .ce-pbs-block { height: auto; }

.scores-loading, .scores-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .scores-container { padding: 0 1rem; }
  .scores-header { flex-direction: column; align-items: stretch; }
  .scores-day { padding: 6px 8px; }
  .scores-day-name { font-size: 0.55rem; }
  .scores-day-date { font-size: 0.55rem; }
  .scores-match-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .scores-match-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Feed Tab
   ═══════════════════════════════════════════════════════════════════════════ */

.feed-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

.feed-section-header {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 12px;
}

/* Scores strip */
.feed-scores-section {
  margin-bottom: 32px;
}

.feed-scores-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.feed-score-card {
  flex: 0 0 auto;
  min-width: 200px;
  max-width: 260px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: default;
}

.feed-score-event {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-score-matchup {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.feed-score-team {
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-score-team.winner {
  color: #4ade80;
  font-weight: 600;
}

.feed-score-vs {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.feed-score-result {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-mono, monospace);
}

.feed-score-date {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  margin-top: 4px;
}

.feed-see-all {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.feed-see-all:hover { color: rgba(255,255,255,0.8); }

/* Articles list */
.feed-articles-section {
  margin-bottom: 24px;
}

.feed-articles-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.feed-article-item {
  display: flex;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.feed-article-item:hover {
  background: rgba(255,255,255,0.04);
}

.feed-article-thumb {
  width: 80px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.05);
}

.feed-article-info {
  flex: 1;
  min-width: 0;
}

.feed-article-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-article-meta {
  display: flex;
  gap: 8px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.4);
}

.feed-article-source {
  font-weight: 500;
}

.feed-article-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.feed-article-tag {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
  text-decoration: none;
}
.feed-article-tag:hover {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
}

.feed-empty {
  padding: 40px 0;
  text-align: center;
  color: rgba(255,255,255,0.3);
  font-size: 0.85rem;
}

.feed-loading-row {
  padding: 24px 0;
  text-align: center;
  color: rgba(255,255,255,0.4);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .feed-container { padding: 16px 12px; }
  .feed-score-card { min-width: 170px; }
  .feed-article-thumb { width: 64px; height: 44px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Storyline Timeline Explorer
   ═══════════════════════════════════════════════════════════════════════════ */

.storyline-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px;
  color: #fff;
}

.storyline-loading {
  padding: 60px 0;
  text-align: center;
  color: rgba(255,255,255,0.4);
}

/* ── Header (L3/L2 summaries) ── */

.storyline-header {
  margin-bottom: 40px;
}

/* Live state (L3) */
.storyline-live-state {
  padding: 16px 18px 24px;
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
}

.storyline-live-state-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 10px;
}

.storyline-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
  animation: storyline-pulse 2s ease-in-out infinite;
}

@keyframes storyline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.storyline-live-state-text {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #fff;
}

.storyline-live-state-text p,
.storyline-season-summary p,
.storyline-narrative p {
  color: #ffffff;
  margin: 0 0 8px;
}
.storyline-live-state-text p:last-child,
.storyline-season-summary p:last-child,
.storyline-narrative p:last-child {
  margin-bottom: 0;
}

.storyline-gpa-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.storyline-expand-toggle {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  margin-left: auto;
}
.storyline-expand-toggle:hover { opacity: 0.7; }

.storyline-expand-arrow {
  transition: transform 0.2s ease;
}
.storyline-expand-toggle[aria-expanded="true"] .storyline-expand-arrow {
  transform: rotate(180deg);
}

/* Season heading with divider */
.storyline-season-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  margin-bottom: 16px;
  position: relative;
}

.storyline-season-heading-text {
  font-size: 0.75rem;
  font-weight: 600;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

.storyline-season-heading-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
}

.storyline-year-toggle {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
}
.storyline-year-toggle:hover { color: rgba(255,255,255,0.7); }

.storyline-year-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  display: flex;
  gap: 4px;
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 8px;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.storyline-year-option {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  white-space: nowrap;
}
.storyline-year-option:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}
.storyline-year-option.active {
  background: rgba(0, 168, 255, 0.15);
  border-color: rgba(0, 168, 255, 0.3);
  color: #00a8ff;
}

/* L2 season summary state — no box */
.storyline-season-state {
  border: none;
  border-radius: 0;
  padding: 0 0 24px;
}

.storyline-season-state-label {
  color: rgba(255,255,255,0.5);
}

.storyline-tournaments-label {
  font-size: 0.75rem;
  font-weight: 600;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
}

.storyline-season-state .storyline-expand-toggle {
  color: rgba(255,255,255,0.4);
}

/* Legacy — keep for backwards compat */
.storyline-season-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 8px;
}

.storyline-season-select {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.storyline-season-select:hover {
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
}

.storyline-season-select:focus {
  outline: none;
  border-color: var(--accent-color, #00a8ff);
}

.storyline-season-select option {
  background: #1a1a2e;
  color: #fff;
}

.storyline-season-summary {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #fff;
}

/* ── Timeline axis ── */

.storyline-timeline {
  position: relative;
  padding-left: 48px;
}

.storyline-axis {
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
  z-index: 1;
}

/* ── Event nodes ── */

.storyline-event {
  position: relative;
  margin-bottom: 24px;
}

/* Horizontal tick connecting event to timeline bar */
.storyline-event-dot {
  position: absolute;
  left: -28px;
  top: 24px;
  width: 12px;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
  z-index: 1;
}

.storyline-event-content {
  position: relative;
  padding: 14px 18px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  overflow: visible;
  transition: all 0.2s ease;
}
.storyline-event-content:hover {
  border-color: rgba(0, 168, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.storyline-event-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.storyline-event-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
}

.storyline-event-meta {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
}

.storyline-event-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
}

.storyline-event-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storyline-event-excerpt {
  font-size: 0.8rem;
  line-height: 1.5;
  color: rgba(255,255,255,0.85);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Event media thumbnails ── */

.storyline-event-media {
  display: none;
}

.storyline-media-thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}
.storyline-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storyline-media-match {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.1);
}

.storyline-media-match-round {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.storyline-media-match-score {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-mono, monospace);
}

.storyline-media-article {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}

.storyline-media-article-source {
  font-size: 0.5rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tournament View (Expanded)
   ═══════════════════════════════════════════════════════════════════════════ */

.storyline-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  cursor: pointer;
  margin-bottom: 20px;
}
.storyline-back:hover { color: rgba(255,255,255,0.8); }

.storyline-tournament-header {
  margin-bottom: 24px;
}

.storyline-tournament-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  margin-bottom: 4px;
}

.storyline-tournament-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

.storyline-narrative {
  margin-bottom: 32px;
}

.storyline-narrative p {
  font-size: 0.88rem;
  line-height: 1.65;
  color: #fff;
  margin-bottom: 12px;
}

.storyline-narrative .gpa-cite-ref,
.storyline-live-state-text .gpa-cite-ref,
.storyline-season-summary .gpa-cite-ref {
  font-size: 0.65rem;
  color: rgba(0, 168, 255, 0.6);
  vertical-align: super;
  cursor: pointer;
  margin-left: 1px;
}

.storyline-sources-header {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* ── Mosaic grid for Sources & Results ── */

.storyline-sources-section {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 16px;
}

.storyline-mosaic-grid {
  position: relative;
  display: block;
}

.storyline-mosaic-grid .masonry-item {
  position: absolute;
}

.storyline-mosaic-grid .storyline-card {
  width: 100%;
}

.storyline-mosaic-grid .tweet-container {
  border-radius: 12px;
  overflow: hidden;
}

.storyline-mosaic-grid .tweet-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 16px;
  color: rgba(255,255,255,0.3);
  font-size: 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
}

.storyline-mosaic-grid .youtube-embed-container {
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.storyline-mosaic-grid .youtube-embed-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* "View All Scores" card in mosaic */
.storyline-scores-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  background: rgba(0, 168, 255, 0.04);
  border: 1px solid rgba(0, 168, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.storyline-scores-card:hover {
  background: rgba(0, 168, 255, 0.08);
  border-color: rgba(0, 168, 255, 0.3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.storyline-scores-card-icon {
  color: #00a8ff;
  opacity: 0.7;
}

.storyline-scores-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #00a8ff;
}

.storyline-scores-card-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

.storyline-scores-card-arrow {
  color: rgba(0, 168, 255, 0.5);
  transition: transform 0.15s;
}

.storyline-scores-card:hover .storyline-scores-card-arrow {
  transform: translateX(3px);
}

/* ── Day groups ── */

.storyline-day-group {
  margin-bottom: 20px;
}

.storyline-day-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.3);
  margin-bottom: 8px;
}

.storyline-day-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Cards ── */

.storyline-card {
  flex: 0 0 auto;
  width: 220px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
  text-decoration: none;
  color: inherit;
}
.storyline-card:hover {
  border-color: rgba(255,255,255,0.15);
}

.storyline-card-badge {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.35);
  padding: 8px 12px 0;
}

.storyline-card-thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
}

.storyline-card-info {
  padding: 8px 12px 10px;
}

.storyline-card-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  line-height: 1.35;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.storyline-card-source {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.35);
  margin-top: 4px;
}

/* Match cards */

.storyline-card-match {
  cursor: pointer;
  padding: 10px 12px;
  width: 220px;
}

.storyline-card-match-round {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  margin-top: 4px;
  margin-bottom: 6px;
}

.storyline-card-match-teams {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.7);
}

.storyline-card-match-teams .winner {
  color: #4ade80;
  font-weight: 600;
}

.storyline-card-vs {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.3);
  margin: 0 4px;
}

.storyline-card-match-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-mono, monospace);
  margin-top: 4px;
}

.storyline-player-link,
.storyline-entity-link {
  color: #00a8ff;
  text-decoration: none;
}
.storyline-player-link:hover,
.storyline-entity-link:hover {
  color: #00a8ff;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Moment View (Overlay)
   ═══════════════════════════════════════════════════════════════════════════ */

.storyline-moment-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.storyline-moment-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.storyline-moment-panel {
  position: relative;
  background: var(--card-bg, #1a1a2e);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 28px;
  max-width: 480px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

.storyline-moment-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 4px;
}
.storyline-moment-close:hover { color: rgba(255,255,255,0.8); }

.storyline-moment-round {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
}

.storyline-moment-date {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.3);
  margin-bottom: 20px;
}

.storyline-moment-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.storyline-moment-team {
  flex: 1;
  text-align: center;
}

.storyline-moment-team-names {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
}

.storyline-moment-team.winner .storyline-moment-team-names {
  color: #4ade80;
  font-weight: 600;
}

.storyline-moment-score {
  font-size: 1.3rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  font-family: var(--font-mono, monospace);
}

.storyline-moment-games {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.storyline-moment-game {
  text-align: center;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}

.storyline-moment-game-label {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.3);
  margin-bottom: 4px;
}

.storyline-moment-game-scores {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
  font-family: var(--font-mono, monospace);
}

.storyline-moment-game-scores .winner {
  color: #4ade80;
  font-weight: 600;
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .storyline-container { padding: 20px 12px; }
  .storyline-timeline { padding-left: 36px; }
  .storyline-event-dot { left: -20px; width: 10px; }
  .storyline-axis { left: 14px; }
  .storyline-card { width: 100%; }
  .storyline-day-cards { flex-direction: column; }
  .storyline-card-match { width: 100%; }
  .storyline-moment-matchup { flex-direction: column; gap: 8px; }
}
