:root {
  --bg-primary: #0B0B12;
  --bg-secondary: #0f1218;
  --bg-card: #1a1f2e;
  --bg-elevated: #252b3d;

  --text-primary: #e9ecff;
  --text-secondary: #b7c0ff;
  --text-muted: #8b93b7;

  --accent-primary: #00fff0;
  --accent-secondary: #8c61ff;
  --accent-gold: #ffd534;
  --accent-success: #21bf96;
  --accent-danger: #ff4757;

  --border-subtle: #202437;
  --border-bright: #2a3342;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 255, 240, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Oxanium', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: 80px;
  /* Added to account for fixed header */
  background-image:
    radial-gradient(circle at center, var(--bg-primary) 0%, transparent 90%),
    linear-gradient(to bottom, var(--bg-primary) 0%, transparent 10%, transparent 90%, var(--bg-primary) 100%),
    url('../images/manga_circuitry_bg.png');
  background-size: 400px;
  /* Scale down for thinner lines */
  background-repeat: repeat;
  background-position: center;
  background-attachment: fixed;
  background-blend-mode: normal, normal, overlay;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.unified-header {
  position: fixed;
  /* Changed from sticky to fixed to guarantee it stays top even if parents have overflow */
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  /* Increased z-index to sit above overlays */
  background: linear-gradient(180deg, rgba(11, 11, 18, 0.98) 0%, rgba(15, 18, 24, 0.95) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.brand-logo:hover {
  transform: translateY(-2px);
}

.brand-logo img {
  height: 42px;
  width: auto;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 10px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  /* Chamfered Corners for Nav Items too */
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  border-radius: 0;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  position: relative;
  font-family: var(--font-hud);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}



.nav-link::before,
.nav-link::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: all 0.3s ease;
  color: var(--accent-cyan);
  font-weight: 700;
}

.nav-link::before {
  content: "[";
  left: 5px;
}

.nav-link::after {
  content: "]";
  right: 5px;
}

.nav-link:hover {
  color: var(--accent-primary);
  background: rgba(0, 255, 240, 0.08);
  padding-left: 24px;
  padding-right: 24px;
}

.nav-link:hover::before,
.nav-link:hover::after,
.nav-link.active::before,
.nav-link.active::after {
  opacity: 1;
}

.nav-link:hover::before,
.nav-link.active::before {
  left: 8px;
}

.nav-link:hover::after,
.nav-link.active::after {
  right: 8px;
}

.nav-link.active {
  color: var(--accent-primary);
  background: rgba(0, 255, 240, 0.12);
}



.btn {
  padding: 10px 24px;
  border: none;
  /* Chamfered Corners */
  clip-path: polygon(15px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 15px) 100%, 0 100%, 0 15px);
  border-radius: 0;
  /* Override standard radius */
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hud);
  /* Orbitron */
  position: relative;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn::before,
.btn::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: all 0.3s ease;
  color: currentColor;
  font-weight: 900;
}

.btn::before {
  content: "[";
  left: 10px;
}

.btn::after {
  content: "]";
  right: 10px;
}

.btn:hover {
  padding-left: 32px;
  padding-right: 32px;
}

.btn:hover::before,
.btn:hover::after {
  opacity: 1;
}

.btn:hover::before {
  left: 8px;
}

.btn:hover::after {
  right: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000;
  box-shadow: 0 4px 12px rgba(0, 255, 240, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 240, 0.5);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-bright);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
}

.btn-gold {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #febc15 100%);
  color: #000;
  box-shadow: 0 4px 12px rgba(255, 213, 52, 0.3);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 213, 52, 0.5);
}

.btn-danger {
  background: var(--accent-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #e63946;
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-bright);
}

.wallet-address {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.mobile-menu-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  margin: 5px 0;
  transition: all var(--transition-fast);
}

.page-hero {
  padding: 60px 0 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(140, 97, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.section {
  padding: 40px 0;
}

.section-header {
  margin-bottom: 32px;
}

.section-title {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding: 0;
}

.guardian-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-subtle);
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.guardian-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.guardian-card.selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 30px rgba(255, 213, 52, 0.5);
  transform: translateY(-8px);
}

.guardian-card-image {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: linear-gradient(135deg, #1a1f2e 0%, #252b3d 100%);
  overflow: hidden;
}

.guardian-card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.guardian-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-level {
  color: var(--accent-gold);
}

.guardian-card-body {
  padding: 20px;
}

.guardian-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 8px;
  flex-shrink: 0;
}

.guardian-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.stat-item {
  text-align: center;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.progress-bar {
  background: var(--bg-secondary);
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 12px;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: 10px;
  transition: width var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.energy-bar .progress-fill {
  background: linear-gradient(90deg, #ff6b6b 0%, var(--accent-gold) 100%);
}

.health-bar {
  background: var(--bg-secondary);
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  margin-top: 16px;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-success) 0%, var(--accent-gold) 100%);
  transition: width var(--transition-slow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #000;
}

.battle-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 40px;
  align-items: start;
  padding: 40px 20px;
}

.fighter-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 3px solid var(--border-bright);
  box-shadow: var(--shadow-lg);
}

.fighter-panel.player {
  border-color: var(--accent-success);
}

.fighter-panel.opponent {
  border-color: var(--accent-danger);
}

.fighter-image {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.fighter-image img {
  width: 100%;
  height: auto;
  display: block;
}

.vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.vs-text {
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-danger) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: pulse 2s ease-in-out infinite;
  text-shadow: 0 0 40px rgba(255, 213, 52, 0.5);
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.battle-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 300px;
  max-width: 400px;
}

.battle-log {
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  max-height: 400px;
  min-height: 250px;
  overflow-y: auto;
}

.battle-log::-webkit-scrollbar {
  width: 8px;
}

.battle-log::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}

.battle-log::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}

.battle-log::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

.log-entry {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border-left: 3px solid var(--text-muted);
  font-size: 0.9rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.log-entry.success {
  border-left-color: var(--accent-success);
  background: rgba(33, 191, 150, 0.1);
}

.log-entry.error {
  border-left-color: var(--accent-danger);
  background: rgba(255, 71, 87, 0.1);
}

.log-entry.info {
  border-left-color: var(--accent-primary);
  background: rgba(0, 255, 240, 0.1);
}

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

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 20px;
}

.ability-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-subtle);
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.ability-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(140, 97, 255, 0.3);
}

.ability-card.equipped {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(255, 213, 52, 0.4);
}

.ability-image {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #1a1f2e 0%, #252b3d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.ability-body {
  padding: 20px;
}

.ability-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 8px;
}

.ability-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.ability-stats {
  display: flex;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-bright);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-card);
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

@media (max-width: 1024px) {
  .battle-arena {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .vs-divider {
    order: 2;
  }

  .battle-controls {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 12px 16px;
  }

  .nav-main {
    display: none;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .nav-main.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0f1218;
    /* Match header bg */
    padding: 20px;
    border-bottom: 1px solid var(--border-bright);
    z-index: 1000;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
  }

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

  .hero-title {
    font-size: 2rem;
  }

  .section {
    padding: 30px 0;
  }

  .battle-log {
    max-height: 300px;
  }
}

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

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

.fade-in {
  animation: fadeIn 0.5s ease;
}

.slide-up {
  animation: slideUp 0.5s ease;
}

.attacking {
  animation: attackShake 0.6s ease;
}

@keyframes attackShake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

.defeated {
  opacity: 0.4;
  filter: grayscale(100%);
  transition: all 1s ease;
}

.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.5s ease;
}

.victory-content {
  text-align: center;
  padding: 40px;
  max-width: 500px;
}

.victory-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-20px);
  }
}

.victory-title {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

/* ==========================================================================
   MORRIGAN PROTOCOL FRONTEND OVERHAUL (LANDING PAGE)
   Aesthetic: Utopian Cypherpunk
   ========================================================================== */

:root {
  /* "Oxidized Mars" Palette */
  --bg-deep: #0B0F19;
  /* Deep Martian Slate */
  --bg-glass: rgba(15, 23, 42, 0.65);
  /* Aerogel Glass Base */

  --color-primary: #E2E8F0;
  /* High-contrast Text */
  --color-muted: #94A3B8;
  /* Secondary Text */

  --accent-cyan: #06B6D4;
  /* HUD Active State / Borders */
  --accent-amber: #F59E0B;
  /* Warnings / Highlights */
  --accent-purple: #6366f1;
  /* Terraformed Ocean Gradient */

  /* Fonts */
  --font-hud: 'Orbitron', sans-serif;
  /* Headlines */
  --font-code: 'JetBrains Mono', monospace;
  /* Data/Body */
}

/* --- 1. Background Layer --- */
.funnel-section {
  position: relative;
  min-height: 100vh;
  /* Use transparent background to let body background show through, but keep gradients for depth */
  background:
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
  overflow: hidden;
  padding-top: 80px;
  /* Header offset */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Optional: Add a subtle grid/hex overlay */
.funnel-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.funnel-container {
  position: relative;
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 2rem;
}

/* --- 2. Typography & Glitch --- */
.funnel-hero-text {
  text-align: center;
  margin-bottom: 2rem;
}

.funnel-headline {
  font-family: var(--font-hud);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--color-primary);
  margin: 0;
  position: relative;
  display: inline-block;
}

/* Glitch Effect */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-deep);
}

.glitch::before {
  left: 2px;
  text-shadow: -1px 0 var(--accent-cyan);
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.glitch::after {
  left: -2px;
  text-shadow: -1px 0 var(--accent-amber);
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% {
    clip: rect(12px, 9999px, 56px, 0);
  }

  20% {
    clip: rect(89px, 9999px, 12px, 0);
  }

  40% {
    clip: rect(45px, 9999px, 78px, 0);
  }

  60% {
    clip: rect(12px, 9999px, 34px, 0);
  }

  80% {
    clip: rect(67px, 9999px, 12px, 0);
  }

  100% {
    clip: rect(23px, 9999px, 89px, 0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip: rect(65px, 9999px, 100px, 0);
  }

  20% {
    clip: rect(12px, 9999px, 45px, 0);
  }

  40% {
    clip: rect(87px, 9999px, 23px, 0);
  }

  60% {
    clip: rect(34px, 9999px, 67px, 0);
  }

  80% {
    clip: rect(9px, 9999px, 12px, 0);
  }

  100% {
    clip: rect(56px, 9999px, 34px, 0);
  }
}

.funnel-subhead {
  font-family: var(--font-code);
  color: var(--color-muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* --- 3. Chamfered Tabs --- */
.funnel-tabs {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.funnel-tab-btn {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--color-muted);
  font-family: var(--font-hud);
  font-size: 1rem;
  padding: 1rem 2rem;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;

  /* Chamfered Corners (Strict 20px) */
  clip-path: polygon(20px 0, 100% 0,
      100% calc(100% - 20px), calc(100% - 20px) 100%,
      0 100%, 0 20px);
}

.funnel-tab-btn:hover,
.funnel-tab-btn.active {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.funnel-tab-btn::before,
.funnel-tab-btn::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: all 0.3s ease;
  color: var(--accent-cyan);
}

.funnel-tab-btn::before {
  content: "[";
  left: 20px;
}

.funnel-tab-btn::after {
  content: "]";
  right: 20px;
}

.funnel-tab-btn:hover::before,
.funnel-tab-btn.active::before {
  opacity: 0.5;
  left: 10px;
}

.funnel-tab-btn:hover::after,
.funnel-tab-btn.active::after {
  opacity: 0.5;
  right: 10px;
}

/* --- 4. Display Port (Glass Content) --- */
.funnel-display-port {
  /* Aerogel Glass Effect */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(6, 182, 212, 0.3);

  /* Chamfered Shape */
  clip-path: polygon(20px 0, 100% 0,
      100% calc(100% - 20px), calc(100% - 20px) 100%,
      0 100%, 0 20px);

  padding: 3rem;
  min-height: 400px;
  position: relative;
}

.funnel-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  height: 100%;
  align-items: center;
}

.funnel-content.hidden {
  display: none;
}

.funnel-content-text {
  z-index: 2;
}

.funnel-content-headline {
  font-family: var(--font-hud);
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.funnel-content-body {
  font-family: var(--font-code);
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.funnel-action-btn {
  display: inline-block;
  background: var(--accent-cyan);
  color: #000;
  font-family: var(--font-hud);
  font-weight: 700;
  padding: 1rem 2rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  clip-path: polygon(20px 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%, 0 20px);
  transition: all 0.3s ease;
  position: relative;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.funnel-action-btn::before,
.funnel-action-btn::after {
  position: absolute;
  opacity: 0;
  transition: all 0.3s ease;
  color: #000;
  font-weight: 900;
}

.funnel-action-btn::before {
  content: "[";
  left: 15px;
}

.funnel-action-btn::after {
  content: "]";
  right: 15px;
}

.funnel-action-btn:hover {
  background: #fff;
  box-shadow: 0 0 20px var(--accent-cyan);
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

.funnel-action-btn:hover::before {
  opacity: 1;
  left: 10px;
}

.funnel-action-btn:hover::after {
  opacity: 1;
  right: 10px;
}

/* --- 5. Genesis Block Terminal --- */
.funnel-visual {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.code-block {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(6, 182, 212, 0.2);
  padding: 1.5rem;
  font-family: var(--font-code);
  font-size: 0.9rem;
  color: var(--accent-cyan);
  border-radius: 4px;
  /* Slight rounding for inner element */
  min-height: 250px;
  overflow: hidden;
  position: relative;
}

.code-line {
  opacity: 0.7;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(6, 182, 212, 0.1);
  padding-bottom: 0.5rem;
}

.code-content {
  font-family: var(--font-code);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--accent-primary);
  height: 100%;
  overflow-y: auto;
  /* Scrollable if text overflows */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Start text from top like a standard terminal */
  padding-bottom: 20px;
}

.terminal-line {
  display: block;
  width: 100%;
  margin-bottom: 4px;
  word-break: break-word;
}

.code-content::-webkit-scrollbar {
  width: 8px;
}

.code-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.code-content::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 4px;
}

.signal-bar {
  margin-top: 1rem;
  font-family: var(--font-code);
  font-size: 0.8rem;
  color: var(--accent-amber);
  opacity: 0;
  transition: opacity 0.5s;
}

.signal-bar.active {
  opacity: 1;
  animation: blink 1s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  background-color: var(--accent-cyan);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 4px;
}

/* --- 6. Character Overlay --- */
.funnel-character-overlay {
  position: absolute;
  right: -50px;
  bottom: 0;
  height: 85vh;
  /* Fixed viewport height to prevent jumping */
  max-height: 900px;
  /* Taller than container to break out */
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

.character-img {
  height: 100%;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.5));
  max-width: none;
  /* Prevent container constraints from shrinking it */
}

.character-tag {
  position: absolute;
  bottom: 100px;
  right: 20px;
  text-align: right;
}

.tag-name {
  display: block;
  font-family: var(--font-hud);
  color: var(--color-primary);
  font-size: 0.8rem;
  letter-spacing: 1px;
}

.tag-brush {
  height: 40px;
  width: auto;
  margin-top: 5px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .funnel-section {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    padding-bottom: 80px;
    align-items: flex-start;
    justify-content: flex-start;
    /* Align left to prevent cutoff */
  }

  .funnel-container {
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 2rem;
    padding: 15px;
    /* Reduce padding for more space */
    width: 100%;
  }

  .funnel-content {
    display: flex;
    flex-direction: column;
    height: auto;
    /* Allow content to dictate height */
    gap: 2rem;
  }

  /* Fix Read Tab Cutoff */
  .funnel-visual {
    height: auto;
    min-height: 0;
    margin-top: 1rem;
  }

  .code-block {
    min-height: 200px;
  }

  /* Refine Hero Image */
  .funnel-character-overlay {
    position: relative;
    height: 280px;
    width: 280px;
    right: auto;
    bottom: auto;
    margin: 2rem auto 0;
    order: -1;
    overflow: visible;
    border: none;
    border-radius: 0;
  }

  .character-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
    border-radius: 0;
  }

  .character-tag {
    bottom: 0;
    right: 0;
    text-align: right;
    z-index: 11;
  }

  .funnel-display-port {
    padding: 1.5rem;
    /* Standard padding */
    height: auto;
    overflow: visible;
    clip-path: none;
    /* Remove chamfer on mobile to prevent text clipping */
    border: 1px solid rgba(6, 182, 212, 0.3);
    /* Ensure border is visible since clip-path removes it sometimes */
    border-radius: 8px;
    /* Use standard radius instead */
  }

  .funnel-headline {
    font-size: 2rem;
    /* Smaller main headline */
    word-break: break-word;
  }

  .funnel-content-headline {
    font-size: 1.5rem;
    word-break: break-word;
  }

  .funnel-content-body {
    font-size: 0.95rem;
    /* Slightly smaller body text */
    word-wrap: break-word;
    /* Ensure text wraps */
    width: 100%;
  }

  .funnel-content-text {
    width: 100%;
    /* Ensure full width */
  }

  .funnel-action-btn {
    width: 100%;
    text-align: center;
    white-space: normal;
    padding: 1rem;
    box-sizing: border-box;
  }

  .terminal-line {
    word-break: break-all;
    /* Force break for long hex strings */
    font-size: 0.8rem;
    /* Smaller font for code */
  }
}
