/* ============================================
   bender loop — style.css
   Dark metallic theme inspired by Futurama
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800;900&display=swap');

/* --- RESET & BASE --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --bg-terminal: #0d0d12;
  --border: #2a2a3a;
  --border-light: #3a3a4a;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --accent: #f0a030;
  --accent-dim: #c07820;
  --accent-glow: rgba(240, 160, 48, 0.15);
  --green: #30d060;
  --green-dim: #20a040;
  --red: #e04040;
  --red-dim: #b03030;
  --blue: #4090f0;
  --purple: #9060e0;
  --cyan: #40c8e0;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1100px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--text-primary);
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* --- NAV --- */
#topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-live {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--green); }
  50% { opacity: 0.4; box-shadow: 0 0 0px var(--green); }
}

/* --- HERO --- */
#hero {
  padding: 140px 24px 80px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 60px;
  align-items: center;
}

h1 {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.04em;
  margin-bottom: 8px;
  line-height: 1;
}

.ca-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.hero-tagline {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 32px;
}

.hero-buttons {
  display: flex;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-image {
  display: flex;
  justify-content: center;
}

.hero-image-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

.hero-image-frame::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-glow), transparent 60%);
  pointer-events: none;
}

.hero-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  border-radius: 8px;
  filter: drop-shadow(0 4px 24px rgba(240, 160, 48, 0.2));
}

/* --- STATS BANNER --- */
#stats-banner {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 32px 24px;
}

.stats-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.profit {
  color: var(--green);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hw-stat {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}

.stat-value-sm {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stat-label-sm {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --- SECTIONS SHARED --- */
section {
  padding: 80px 24px;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}

section h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 600px;
  margin-bottom: 40px;
}

/* --- LORE --- */
#lore {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.lore-content {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
}

.lore-text p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.75;
}

.lore-text blockquote {
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 24px 0;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.lore-text blockquote cite {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: normal;
  font-family: var(--font-mono);
}

.lore-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gallery-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}

.gallery-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.gallery-placeholder {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  font-size: 3rem;
}

.gallery-caption {
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.tech-block {
  margin-top: 40px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.tech-block p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* --- PROFILE --- */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.profile-card .section-tag {
  margin-bottom: 16px;
}

.profile-table {
  width: 100%;
  border-collapse: collapse;
}

.profile-table td {
  padding: 8px 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.profile-table td:first-child {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: 120px;
}

.profile-table td:last-child {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.profile-table tr:last-child td {
  border-bottom: none;
}

/* --- CREDITS --- */
#credits {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.credits-dashboard {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
}

.credit-status {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.credit-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.credit-health {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.credit-health.healthy {
  background: rgba(48, 208, 96, 0.12);
  color: var(--green);
  border: 1px solid rgba(48, 208, 96, 0.2);
}

.credit-health.warning {
  background: rgba(240, 160, 48, 0.12);
  color: var(--accent);
  border: 1px solid rgba(240, 160, 48, 0.2);
}

.credit-health.critical {
  background: rgba(224, 64, 64, 0.12);
  color: var(--red);
  border: 1px solid rgba(224, 64, 64, 0.2);
}

.credit-amount {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--green);
}

.credit-details {
  display: flex;
  gap: 40px;
  margin-bottom: 24px;
}

.credit-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cd-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.cd-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.credit-bar-container {
  margin-bottom: 24px;
}

.credit-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.credit-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dim), var(--green));
  border-radius: 4px;
  transition: width 1s ease;
}

.credit-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.credit-explainer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.credit-explainer p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- PIPELINE --- */
.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.pipeline-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  transition: border-color 0.2s;
}

.pipeline-step:hover {
  border-color: var(--accent-dim);
}

.step-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 12px;
}

.pipeline-step h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.pipeline-step p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.pipeline-loop-label {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

/* --- TERMINAL --- */
#terminal {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.terminal-window {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-terminal);
}

.terminal-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  flex: 1;
}

.terminal-live {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--green);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.terminal-body {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.85;
  max-height: 420px;
  overflow-y: auto;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.ts {
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  margin: 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag.sys { background: rgba(64, 144, 240, 0.15); color: var(--blue); }
.tag.cfg { background: rgba(144, 96, 224, 0.15); color: var(--purple); }
.tag.api { background: rgba(240, 160, 48, 0.15); color: var(--accent); }
.tag.net { background: rgba(64, 200, 224, 0.15); color: var(--cyan); }
.tag.ok { background: rgba(48, 208, 96, 0.15); color: var(--green); }
.tag.hand { background: rgba(240, 160, 48, 0.1); color: var(--accent-dim); }
.tag.win { background: rgba(48, 208, 96, 0.15); color: var(--green); }
.tag.lose { background: rgba(224, 64, 64, 0.15); color: var(--red); }
.tag.fold { background: rgba(136, 136, 160, 0.15); color: var(--text-secondary); }
.tag.train { background: rgba(144, 96, 224, 0.15); color: var(--purple); }
.tag.burn { background: rgba(224, 64, 64, 0.1); color: var(--red-dim); }

/* --- DASHBOARD --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

.dash-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
}

.dash-value.profit { color: var(--green); }

.chart-placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
}

.chart-area {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.chart-label {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-family: var(--font-mono);
}

/* --- GAME LOG --- */
#games {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.game-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-row {
  display: grid;
  grid-template-columns: 100px 1fr 80px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  align-items: center;
  transition: background 0.15s;
}

.game-row:hover {
  background: var(--bg-card-hover);
}

.game-result {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.game-row.win .game-result { color: var(--green); }
.game-row.loss .game-result { color: var(--red); }

.game-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.game-bb {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* --- ARCHIVE / HAND HISTORY --- */
.hand-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hand-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}

.hand-row:hover {
  border-color: var(--border-light);
}

.hand-summary {
  display: grid;
  grid-template-columns: 80px 80px 1fr 90px 30px;
  padding: 14px 16px;
  align-items: center;
  gap: 8px;
}

.hand-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hand-cards {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
}

.hand-vs {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.hand-result {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: right;
}

.hand-result.win { color: var(--green); }
.hand-result.loss { color: var(--red); }

.hand-expand {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-align: center;
  transition: transform 0.2s;
}

.hand-row.open .hand-expand {
  transform: rotate(180deg);
}

.hand-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.hand-row.open .hand-detail {
  max-height: 400px;
}

.hand-replay {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.hand-replay p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.6;
}

.hand-note {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  font-style: italic;
  margin-top: 8px;
}

/* --- ROADMAP --- */
#roadmap {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.roadmap-phases {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.phase {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  position: relative;
}

.phase.active {
  border-color: var(--accent-dim);
  background: linear-gradient(135deg, var(--bg-card), rgba(240, 160, 48, 0.04));
}

.phase-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.phase h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.phase p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 700px;
}

/* --- FOOTER --- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 16px;
  font-family: var(--font-mono);
}

.footer-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* --- SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero-image {
    display: none;
  }

  h1 {
    font-size: 2.5rem;
  }

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

  .lore-content {
    grid-template-columns: 1fr;
  }

  .lore-sidebar {
    display: none;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-steps {
    grid-template-columns: 1fr 1fr;
  }

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

  .nav-links {
    display: none;
  }

  .hand-summary {
    grid-template-columns: 60px 60px 1fr 70px 24px;
    font-size: 0.85rem;
  }
}

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

  .pipeline-steps {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2rem;
  }

  .hand-summary {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .hand-id, .hand-vs {
    display: none;
  }
}

/* --- PROFIT CHART (SVG-based) --- */
.chart-area svg {
  width: 100%;
  height: 100%;
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
}

.chart-fill {
  fill: url(#chartGradient);
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 0.5;
}

.chart-zero-line {
  stroke: var(--text-muted);
  stroke-width: 0.5;
  stroke-dasharray: 4 4;
}
