:root {
  --bg: #090d16;
  --card-bg: rgba(22, 31, 48, 0.6);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1.5rem;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.12), transparent 40%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
}

header {
  max-width: 800px;
  width: 100%;
  margin-bottom: 3.5rem;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease;
}

.back-link:hover {
  transform: translateX(-4px);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header p, .tagline {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.5;
}

main {
  max-width: 800px;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* Card Components */
.card, .action-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.75rem;
  text-decoration: none;
  color: inherit;
  backdrop-filter: blur(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card:hover, .action-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 30px -10px var(--accent-glow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.card h2, .action-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.card p, .action-card p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.card-footer, .action-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.arrow {
  transition: transform 0.2s ease;
}

.card:hover .arrow, .action-card:hover .arrow {
  transform: translateX(4px);
}

/* Badges */
.status-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
}

.status-badge.live {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.2);
}

.status-badge.soon {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.25);
}

.status-badge.external {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.4);
}

/* Overview Write-up Box */
.overview-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(12px);
  margin-bottom: 1.5rem;
  line-height: 1.7;
  color: #cbd5e1;
}

.overview-card h2 {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1rem;
}

.overview-card p {
  margin-bottom: 1rem;
}

.overview-card p:last-child {
  margin-bottom: 0;
}

.code-block {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  margin: 1.25rem 0;
  overflow-x: auto;
}

footer {
  margin-top: auto;
  padding-top: 4rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* Research Paper Formatting */
.paper-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 1rem 0;
}

/* Metadata Card at top of paper */
.paper-meta-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(8px);
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
  margin-top: 0.2rem;
}

/* Abstract and Body Prose */
.abstract-text {
  font-size: 1.1rem;
  line-height: 1.75;
  color: #cbd5e1; /* Brighter slate for high readability */
}

/* Expanded Section Spacing */
.paper-section {
  margin-bottom: 4.5rem;
}

/* Section Titles - Pure White & Larger */
.paper-section h2 {
  font-size: 1.6rem;
  color: #ffffff;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.5rem;
}

/* Paragraph Text - Larger & Brighter for comfortable long-form reading */
.paper-section p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: #cbd5e1;
  margin-bottom: 1.25rem;
}

/* Links inside Paper Container (Covers both Metadata Card & Prose Sections) */
.paper-container a:link,
.paper-container a:visited {
  color: var(--accent); /* Light blue for both clicked & unclicked */
  text-decoration: underline;
  text-underline-offset: 4px;
}

.paper-container a:hover,
.paper-container a:active {
  color: #7dd3fc; /* Slightly brighter highlight on hover */
}

/* Larger Section Divider Spacing */
.section-divider {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 3.5rem 0;
}

/* Figure & Image Styling */
.paper-figure {
  margin: 2.5rem 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.75rem;
  overflow: hidden;
}

.paper-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.paper-figure figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.75rem;
  padding: 0 0.25rem;
  line-height: 1.5;
}

/* Callout / Blockquotes */
blockquote {
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
  padding: 0.75rem 0 0.75rem 1.25rem;
  background: rgba(56, 189, 248, 0.05);
  border-radius: 0 8px 8px 0;
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text);
}

/* FIPI Specific Header Layout */
.fipi-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

/* Mode Toggle Switch */
.mode-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.toggle-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toggle-label.active {
  color: var(--accent);
  font-weight: 600;
}

.toggle-label.muted {
  color: var(--muted);
  opacity: 0.6;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* FIPI Hero Score Card */
.fipi-hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 3.5rem;
  backdrop-filter: blur(12px);
  gap: 2rem;
  flex-wrap: wrap;
}

.fipi-hero-content {
  display: flex;
  flex-direction: column;
}

.fipi-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fipi-score-display {
  display: flex;
  align-items: baseline;
  margin: 0.25rem 0;
}

.fipi-score {
  font-size: 4.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.fipi-max {
  font-size: 1.5rem;
  color: var(--muted);
  margin-left: 0.3rem;
  font-weight: 500;
}

.fipi-status-text {
  font-size: 1.1rem;
  color: var(--accent);
  font-weight: 600;
}

.fipi-quick-stats {
  display: flex;
  gap: 1.5rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding-left: 1.5rem;
}

.quick-stat {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #cbd5e1;
}

/* 48-Hour Chart Placeholder */
.fipi-chart-placeholder {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.placeholder-graphic {
  height: 160px;
  width: 100%;
  margin-bottom: 0.75rem;
}

.placeholder-graphic svg {
  width: 100%;
  height: 100%;
}

.placeholder-caption {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}

/* 7-Day Table Styling */
.fipi-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  backdrop-filter: blur(8px);
}

.fipi-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.fipi-table th,
.fipi-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fipi-table th {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.2);
}

.fipi-table td {
  color: #cbd5e1;
  font-size: 1.05rem;
}

.fipi-table tr:last-child td {
  border-bottom: none;
}

/* Score Badges */
.fipi-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.fipi-badge.high {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.fipi-badge.med {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.fipi-badge.low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Mobile responsive layout */
@media (max-width: 600px) {
  .fipi-quick-stats {
    border-left: none;
    padding-left: 0;
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
  }
}

footer {
  padding: 24px 16px;
  margin-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.footer-container p {
  margin: 0;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* Compact, Matching UI Button */
.bmc-custom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.bmc-custom-btn:hover {
  background-color: #334155;
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
  transform: translateY(-1px);
}

.bmc-custom-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.bmc-icon {
  font-size: 0.95rem;
}