/* ── FOSS Theme ───────────────────────────────────────────────────────── */
:root {
  --bg: #0c2444;
  --bg-card: #0f2a50;
  --bg-hover: #122f58;
  --fg: #f2f7fc;
  --fg-muted: #8ba0b8;
  --fg-dim: #5a7a96;
  --gold: #FFD022;
  --gold-light: #FDCE21;
  --gold-dark: #F69D1D;
  --teal: #379CA2;
  --blue: #2C7FDC;
  --olive: #C0AE42;
  --border: rgba(242, 247, 252, 0.08);
  --border-hover: rgba(172, 171, 79, 0.38);
  --gradient: linear-gradient(to right, var(--olive), var(--teal), var(--blue));
}

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

body {
  font-family: 'DM Mono', 'Geist Mono', 'SF Mono', 'Cascadia Code', monospace;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(242, 247, 252, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 247, 252, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 1.5rem;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
  margin-bottom: 2.5rem;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

h1 {
  font-family: 'Martian Mono', 'Geist Mono', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
  line-height: 1.2;
}

.subtitle {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-top: 0.15rem;
}

.marquee-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--olive), var(--teal), var(--blue), var(--olive));
  background-size: 300% 100%;
  animation: gradient-move 8s ease infinite;
  margin-top: 1.25rem;
  border-radius: 2px;
}

@keyframes gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── Main ────────────────────────────────────────────────────────────── */
main {
  display: flex;
  flex-direction: column;
  min-height: 580px;
  min-height: calc(100vh - 240px); /* Fill screen height minus header/footer spacing */
  background: rgba(15, 42, 80, 0.65);
  border: 1px solid rgba(242, 247, 252, 0.12);
  border-radius: 16px;
  padding: 0; /* Flush fit for terminal window header */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 
              inset 0 0 20px rgba(255, 255, 255, 0.02);
  overflow: hidden; /* Prevent header corners overflow */
}

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

.section-title {
  font-family: 'Martian Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.title-glow {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.count {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

/* ── Table ───────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
}

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

thead th {
  font-family: 'Martian Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.25s ease, transform 0.2s ease;
}

tbody tr:hover {
  background: rgba(242, 247, 252, 0.04);
  transform: scale(1.008) translateX(4px);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody td {
  padding: 0.7rem 0.75rem;
  font-size: 0.8rem;
  vertical-align: middle;
}

.col-rank { width: 3rem; }
.col-team { }
.col-players { width: 30%; }
.col-level { width: 5rem; }

.rank {
  color: var(--fg-dim);
  font-family: 'Martian Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
}

.rank-1 { color: var(--gold); }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

.team-name {
  font-weight: 500;
  color: var(--fg);
}

.player-list {
  color: var(--fg-muted);
  font-size: 0.75rem;
}

/* ── Level Badge ─────────────────────────────────────────────────────── */
.level-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-num {
  font-family: 'Martian Mono', monospace;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gold-light);
  white-space: nowrap;
}

.level-bar {
  flex: 1;
  height: 4px;
  background: rgba(242, 247, 252, 0.08);
  border-radius: 2px;
  overflow: hidden;
  max-width: 60px;
}

.level-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--gradient);
  transition: width 0.3s ease;
}

.level-bar-fill.complete {
  background: var(--teal);
}

/* ── Status ──────────────────────────────────────────────────────────── */
.status {
  font-size: 0.7rem;
  font-family: 'Martian Mono', monospace;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-playing {
  color: var(--gold-light);
}

.status-completed {
  color: var(--teal);
}

.status-waiting {
  color: var(--fg-dim);
}

/* ── Empty State ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fg-dim);
  display: none;
}

.empty-state.visible {
  display: block;
}

.empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.85rem;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 1.5rem;
}

.footer-text {
  font-size: 0.75rem;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot.live {
  background: var(--teal);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container {
    padding: 1.25rem 0.75rem;
  }

  .logo {
    width: 40px;
    height: 40px;
  }

  h1 {
    font-size: 1.15rem;
  }

  main {
    padding: 1rem;
  }

  tbody td {
    padding: 0.5rem 0.5rem;
    font-size: 0.72rem;
  }

  thead th {
    padding: 0.5rem;
    font-size: 0.6rem;
  }

  .col-players {
    display: none;
  }
}

/* ── Floating Side Stickers for Distros & Memes ──────────────────────────────── */

.floating-sticker {
  position: absolute;
  pointer-events: auto;
  z-index: 5;
  will-change: transform;
  animation: float var(--float-duration) ease-in-out var(--float-delay) infinite;
  cursor: pointer;
  user-select: none;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base floating animation keyframe */
@keyframes float {
  0%, 100% {
    transform: rotate(var(--rotation)) translateY(0);
  }
  50% {
    transform: rotate(calc(var(--rotation) + 2.5deg)) translateY(-12px);
  }
}

.sticker-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Larger, actual brand colored distro icons */
.distro-icon {
  width: 96px;
  height: 96px;
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.arch-sticker .distro-icon {
  fill: #1793D1; /* Arch Blue */
}

.debian-sticker .distro-icon {
  fill: #D70A53; /* Debian Pink/Crimson */
}

.fedora-sticker .distro-icon {
  fill: #3C6EB4; /* Fedora Blue */
}

.tux-sticker .distro-icon {
  fill: #FFD022; /* Gold/yellow Tux */
}

/* Bigger memes */
.meme-image {
  width: 100%;
  max-width: 165px;
  height: auto;
  border-radius: 6px;
  transition: transform 0.4s ease, filter 0.4s ease;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

/* Sarcastic Terminal Prompt Badges */
.terminal-badge {
  background: rgba(12, 36, 68, 0.85);
  border: 1px dashed rgba(57, 255, 20, 0.25);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'DM Mono', 'Geist Mono', monospace;
  font-size: 0.78rem;
  color: #39ff14; /* Neon green */
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  transition: border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.term-prompt {
  color: var(--gold);
  font-weight: bold;
  margin-right: 4px;
}

.terminal-badge:hover {
  border-color: rgba(57, 255, 20, 0.8);
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.4);
  color: #ffffff;
}

/* Special man women badge animations */
.man-women-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.man-women-badge .term-output {
  color: #ff5f56; /* Terminal red error output */
  font-size: 0.62rem;
  padding-left: 12px;
  opacity: 0;
  max-height: 0;
  transition: opacity 0.4s ease, max-height 0.4s ease;
  animation: extendOutput 8s infinite ease-in-out;
}

.man-women-badge:hover .term-output {
  opacity: 1;
  max-height: 25px;
  animation-play-state: paused; /* Pause periodic loop when hovered */
}

@keyframes extendOutput {
  0%, 15%, 85%, 100% {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
  }
  25%, 75% {
    opacity: 1;
    max-height: 25px;
    margin-top: 4px;
  }
}

/* Sticker text label */
.sticker-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: lowercase;
  background: rgba(12, 36, 68, 0.85);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(242, 247, 252, 0.08);
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

/* Hover effects */
.floating-sticker:hover {
  transform: scale(1.18) rotate(0deg) translateY(-5px);
  animation-play-state: paused;
  z-index: 50;
}

.arch-sticker:hover .distro-icon {
  filter: drop-shadow(0 0 12px rgba(23, 147, 209, 0.85)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.debian-sticker:hover .distro-icon {
  filter: drop-shadow(0 0 12px rgba(215, 10, 83, 0.85)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.fedora-sticker:hover .distro-icon {
  filter: drop-shadow(0 0 12px rgba(60, 110, 180, 0.85)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.tux-sticker:hover .distro-icon {
  filter: drop-shadow(0 0 12px rgba(253, 206, 33, 0.85)) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4));
}

.meme-sticker:hover .meme-image {
  filter: drop-shadow(0 0 12px rgba(44, 127, 220, 0.7)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
}

.floating-sticker:hover .sticker-label {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.2);
  background-color: var(--bg-hover);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .floating-sticker {
    display: none;
  }
}

/* ── Linux Terminal Simulation Aesthetics ──────────────────────────────────── */

.terminal-header {
  background: rgba(16, 28, 48, 0.95);
  border-bottom: 1px solid rgba(242, 247, 252, 0.08);
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  user-select: none;
}

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

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

.close-btn { background: #ff5f56; }
.minimize-btn { background: #ffbd2e; }
.maximize-btn { background: #27c93f; }

.terminal-title {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--fg-muted);
  letter-spacing: -0.01em;
  text-align: center;
  flex-grow: 1;
}

.terminal-action-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--fg-dim);
  text-transform: lowercase;
}

.terminal-body {
  flex: 1; /* Stretch to fill minimum height */
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: rgba(8, 15, 28, 0.85); /* Deep Console Black/Blue */
}

.terminal-command-line {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.terminal-footer-line {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.prompt-user {
  color: #39ff14; /* Neon green */
  font-weight: 500;
}

.prompt-dir {
  color: var(--blue);
}

.blinking-cursor {
  color: #39ff14;
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}

/* Console Styled Table Output */
.terminal-table {
  width: 100%;
  border-collapse: collapse;
}

.terminal-table thead th {
  font-family: 'Martian Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--teal); /* Teal headers for column names */
  padding: 0.8rem 0.75rem;
  text-align: left;
  border-bottom: 1.5px solid rgba(55, 156, 162, 0.3);
}

.terminal-table tbody tr {
  border-bottom: 1px dashed rgba(242, 247, 252, 0.06);
  transition: background 0.25s ease, transform 0.2s ease;
}

.terminal-table tbody tr:hover {
  background: rgba(242, 247, 252, 0.03);
  transform: scale(1.006) translateX(4px);
}

.terminal-table tbody tr:last-child {
  border-bottom: none;
}

.terminal-table tbody td {
  padding: 0.8rem 0.75rem;
  font-size: 0.82rem;
  vertical-align: middle;
}

/* Green Glow rank index for terminal styling */
.terminal-table .rank {
  color: var(--fg-muted);
  font-family: 'Martian Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
}

.terminal-table .rank.rank-1 { color: var(--gold); }
.terminal-table .rank.rank-2 { color: #c0c0c0; }
.terminal-table .rank.rank-3 { color: #cd7f32; }

.terminal-table .level-num {
  font-family: 'Martian Mono', monospace;
  font-weight: bold;
  font-size: 0.88rem;
  color: #39ff14; /* terminal green level output */
  background: rgba(57, 255, 20, 0.08);
  border: 1px solid rgba(57, 255, 20, 0.2);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.1);
}

/* ── Cbonsai ASCII Art styling ─────────────────────────────────────────── */

.bonsai-prompt-line {
  margin-top: auto; /* Single flex push to keep prompt, tree, and footer at the very bottom */
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.bonsai-container {
  align-self: flex-end;
  margin-top: 0.25rem; /* Standard separation, avoids auto-margin splitting */
  margin-bottom: 0.25rem;
  margin-right: 1.5rem;
  pointer-events: none;
  user-select: none;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.bonsai-container:hover {
  opacity: 1;
}

.bonsai-art {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.15;
  margin: 0;
  background: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

/* Procedural cbonsai output colors */
.bonsai-pot {
  color: var(--teal); /* terminal theme pot colors */
}

.bonsai-trunk {
  color: #a2704c; /* wood brown */
}

.bonsai-leaves {
  color: #39ff14; /* bright green */
  text-shadow: 0 0 6px rgba(57, 255, 20, 0.3);
}

