/* --- GLOBAL STYLES --- */
body {
  margin: 0;
  padding: 2rem 1rem;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Helvetica,
    Arial,
    sans-serif;
  line-height: 1.6;
  color: #374151; /* Gray-700 */
  background: linear-gradient(
    to right,
    #f3f4f6 0%,
    #ede9fe 20%,
    #ede9fe 80%,
    #f3f4f6 100%
  );
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-sizing: border-box;
}

/* --- UNIVERSAL SPLASH SCREEN --- */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    to right,
    #f3f4f6 0%,
    #ede9fe 20%,
    #ede9fe 80%,
    #f3f4f6 100%
  );
  z-index: 100000; /* Extremely high to cover everything */
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    opacity 0.5s ease-out,
    visibility 0.5s ease-out;
}
#splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: pulse-splash 1.5s infinite;
}
.splash-content img {
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  border: 2px solid #a855f7;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
@keyframes pulse-splash {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.98);
  }
}

/* --- MAIN CARD CONTAINER --- */
.container {
  max-width: 768px;
  width: 100%;
  position: relative;
  z-index: 10; /* Keep the card above the ambient vibe background */
  background: #ffffff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 1.5rem;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.8);
  padding: 3rem 3.5rem;
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .container {
    padding: 2.5rem 1.5rem;
    border-radius: 1.25rem;
  }
}

@media (max-width: 480px) {
  #inject-perfect-for li {
    padding: 0.6rem 1rem;
  }
  #inject-explore-list li {
    padding: 1rem;
  }
  .resource-link-block {
    padding: 0.75rem 1rem;
  }
}

/* --- TYPOGRAPHY & HEADINGS --- */
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #6b46c1; /* Brand Purple */
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e9d5ff; /* Purple-200 */
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* The main title gets the gradient treatment */
h2#inject-title {
  font-size: 2.25rem;
  text-align: center;
  border-bottom: none;
  background: linear-gradient(135deg, #7c3aed 0%, #d946ef 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 2.25rem;
  margin-bottom: 0.25rem; /* Reduced from 1.5rem to pull the subtitle closer */
  justify-content: center;
  line-height: 1.2;
}

/* --- BRAND SUBTITLE --- */
.brand-subtitle {
  display: block;
  text-align: right;
  font-size: 0.85rem;
  color: #9ca3af; /* Gray-400 */
  margin-bottom: 1.5rem; /* Replaces the margin taken from the title */
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.brand-subtitle:hover {
  color: #9333ea; /* Purple-700 */
  text-decoration: underline;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937; /* Gray-800 */
  margin-top: 2rem;
  margin-bottom: 1rem;
}

p {
  margin: 1rem 0;
  color: #4b5563; /* Gray-600 */
}

/* --- BLOCKQUOTES --- */
blockquote {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  color: #581c87; /* Purple-900 */
  border-left: 4px solid #a855f7; /* Purple-500 */
  background-color: #faf5ff; /* Purple-50 */
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
  font-weight: 500;
}

/* --- LINKS --- */
a {
  color: #7c3aed; /* Purple-600 */
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

a:hover {
  color: #9333ea; /* Purple-700 */
  text-decoration: underline;
}

/* --- IMAGES --- */
#inject-img-link {
  display: block;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  margin: 1rem auto;
  transform: translateZ(0); /* Hardware acceleration for smooth edge clipping */
}

#inject-img-src {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  transform: scale(1);
  animation: slowZoom 12s ease-out forwards;
}

@keyframes slowZoom {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  #inject-img-src {
    animation: none;
  }
}

.photo-credit {
  text-align: center;
  font-size: 0.85rem;
  color: #9ca3af; /* Gray-400 */
  margin-top: -0.5rem;
  margin-bottom: 2rem;
}

/* --- LIST STYLES (Styled as UI Cards) --- */
ul {
  padding-left: 0;
  list-style-type: none;
  margin: 1rem 0;
}

#inject-perfect-for li {
  background: #f9fafb; /* Gray-50 */
  padding: 0.85rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #f3f4f6; /* Gray-100 */
  margin-bottom: 0.75rem;
  color: #374151;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

#inject-perfect-for li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border-color: #e5e7eb;
}

#inject-explore-list li {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0; /* Slate-200 */
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

#inject-explore-list li strong {
  color: #6b46c1;
  font-size: clamp(1rem, 1.1rem, 1.4rem);
  display: block;
  margin-bottom: 0.25rem;
}

#inject-explore-list li em {
  display: block;
  margin-top: 0.5rem;
  color: #6b7280;
  font-size: clamp(0.9rem, 0.95rem, 1.3rem);
  border-left: 2px solid #e5e7eb;
  padding-left: 0.75rem;
}

/* --- ACTION LINKS (Bottom Buttons) --- */
hr {
  border: 0;
  height: 1px;
  background: #e5e7eb;
  margin: 2.5rem 0;
}

.resource-link-block {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  text-decoration: none !important;
  transition: all 0.2s ease;
  color: #334155;
}

.resource-link-block:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.resource-link-block i {
  font-size: 1.25rem;
  color: #8b5cf6;
  margin-right: 1rem;
  width: 24px;
  text-align: center;
}

.resource-link-block strong {
  display: block;
  color: #1e293b;
  font-size: clamp(0.9rem, 0.95rem, 1.3rem);
  margin-bottom: 0.1rem;
}

.resource-link-block span.link-text {
  color: #6b46c1;
  font-size: clamp(0.8rem, 0.85rem, 1.2rem);
  font-weight: 600;
}

/* --- Make the inner text div responsive --- */
.resource-link-block div {
  flex-grow: 1;
  min-width: 0; /* CRITICAL: Prevents flexbox from blowing out the container width */
  padding-right: 1rem; /* Keeps text from touching the external icon */
}

/* --- Truncate long text gracefully on tiny screens --- */
.resource-link-block div strong,
.resource-link-block div span.link-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Prevent icons from getting squished --- */
.resource-link-block i:first-child,
.resource-link-block .external-icon {
  flex-shrink: 0;
}

/* --- External Link Icon Styles --- */
.resource-link-block .external-icon {
  margin-left: auto;
  color: #cbd5e1;
  font-size: 0.85rem;
  transition: color 0.2s ease;
  margin-right: 0;
}

.resource-link-block:hover .external-icon {
  color: #7c3aed;
}

/* --- TOP LEFT BACK BUTTON --- */
.top-left-back-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #e5e7eb;
  color: #6b7280;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border-radius: 9999px;
  transition: all 0.2s ease;
  z-index: 50;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.top-left-back-btn:hover {
  background: #ffffff;
  color: #7c3aed; /* Purple-600 */
  border-color: #d8b4fe; /* Purple-300 */
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

@media (max-width: 768px) {
  .top-left-back-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }
}

/* --- MODAL STYLES --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent dark background */
  z-index: 10050; /* Fix: Elevate above the 9999 bottom nav */
  display: none; /* Hidden by default */
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: #ffffff;
  border-radius: 1rem;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* --- Adjust the photo credit link to align the icon --- */
.photo-credit a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Style the external icon to match the bottom links --- */
.photo-credit a i {
  font-size: 0.7rem;
  color: #cbd5e1; /* Slate-300 */
  transition: color 0.2s ease;
}

.photo-credit a:hover i {
  color: #9333ea; /* Purple-700 (Matches your global a:hover) */
}

/* --- PRIMARY CTA BUTTON --- */
.primary-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #7c3aed 0%, #d946ef 100%);
  color: #ffffff;
  text-decoration: none;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2rem;
  border: none;
  border-radius: 9999px; /* Pill shape */
  cursor: pointer;
  box-shadow:
    0 4px 6px -1px rgba(124, 58, 237, 0.3),
    0 2px 4px -1px rgba(124, 58, 237, 0.2);
  transition: all 0.2s ease;
  width: 100%;
  max-width: 300px;
}

.primary-cta-btn:hover {
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow:
    0 10px 15px -3px rgba(124, 58, 237, 0.4),
    0 4px 6px -2px rgba(124, 58, 237, 0.2);
}

.primary-cta-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px -1px rgba(124, 58, 237, 0.3);
}

/* --- BACK TO TOP BUTTON --- */
#back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  font-size: 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: all 0.3s ease-in-out;
  z-index: 1000;
  /* Sync spatial coordinates with app.css mobile dock offset */
  margin-bottom: calc(65px + env(safe-area-inset-bottom)) !important;
}

#back-to-top:hover {
  background-color: #ffffff;
  color: #7c3aed;
  border-color: #d8b4fe;
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  opacity: 1;
}

/* =========================================================
   LIVE BOARD BANNER (TLI) - PURE CSS
   ========================================================= */
#topics-live-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: #9333ea;
  color: white;
  font-size: 11px;
  font-weight: bold;
  padding: 0.5rem 1rem;
  z-index: 9900;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(88, 28, 135, 0.2);
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}
.tli-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}
.tli-dot-wrap {
  position: relative;
  display: flex;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}
.tli-dot-ping {
  position: absolute;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  opacity: 0.75;
  animation: tli-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.tli-dot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}
.tli-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tli-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}
.tli-broadcast-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.tli-broadcast-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e9d5ff;
  line-height: 1;
  margin-bottom: 2px;
}
.tli-broadcast-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: white;
}
.tli-interactive {
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  margin-left: -0.25rem;
}
.tli-interactive:hover {
  background-color: #7e22ce;
}
.tli-board-btn {
  background: #6b21a8;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #a855f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.2s;
  font-size: 11px;
}
.tli-board-btn:hover {
  background: #581c87;
  color: white;
  text-decoration: none;
}
.tli-disconnect-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tli-disconnect-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
@keyframes tli-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

@media (max-width: 480px) {
  #back-to-top {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
    font-size: 1.15rem;
    padding: 0;
  }
}

/* Sync spatial coordinates with app.css desktop dock offset */
@media (min-width: 600px) {
  #back-to-top {
    margin-bottom: 90px !important;
    /* Keep floating button tethered to the main app container instead of the far screen edge */
    /* Using max() ensures it doesn't get pushed off-screen on browser widths between 600px and 768px */
    right: max(20px, calc(50% - 384px + 20px)) !important;
  }
}

/* =========================================================
   LIVE BOARD BANNER (TLI)
   ========================================================= */
.tli-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}
.tli-dot-wrap {
  position: relative;
  display: flex;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}
.tli-dot-ping {
  position: absolute;
  display: inline-flex;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  opacity: 0.75;
  animation: tli-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.tli-dot {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
}
.tli-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tli-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
}
.tli-broadcast-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
}
.tli-broadcast-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e9d5ff;
  line-height: 1;
  margin-bottom: 2px;
}
.tli-broadcast-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  color: white;
}
.tli-interactive {
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 0.25rem;
  padding: 0 0.25rem;
  margin-left: -0.25rem;
}
.tli-interactive:hover {
  background-color: #7e22ce;
}
.tli-board-btn {
  background: #6b21a8;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #a855f7;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.2s;
  font-size: 11px;
}
.tli-board-btn:hover {
  background: #581c87;
  color: white;
  text-decoration: none;
}
.tli-disconnect-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tli-disconnect-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}
@keyframes tli-ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}
