:root {
  --bg: #0e0e10;
  --ink: #e8e6e1;
  --muted: #8a8783;
  --rule: rgba(232, 230, 225, 0.15);
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cormorant Garamond', serif;
  min-height: 100vh;
  padding: 60px 24px;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(180, 50, 50, 0.06), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(40, 80, 120, 0.08), transparent 40%);
}

.intro {
  max-width: 900px;
  margin: 0 auto 80px;
  text-align: center;
}

.intro-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

.intro h1 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.05;
  margin-bottom: 28px;
  color: var(--ink);
}

.intro h1 em {
  font-style: normal;
  font-weight: 600;
}

.intro p {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
  opacity: 0.85;
  max-width: 640px;
  margin: 0 auto 16px;
}

.intro .signoff {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 40px;
}

.cards {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}

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

.card {
  position: relative;
  padding: 48px 40px;
  border-radius: 2px;
  overflow: hidden;
  transition: transform 0.4s ease;
}

.card:hover {
  transform: translateY(-4px);
}

.card-tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  padding: 6px 12px;
  margin-bottom: 24px;
  border: 1px solid;
}

.card-title {
  font-size: 2.25rem;
  line-height: 1.05;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.95rem;
  font-style: italic;
  margin-bottom: 32px;
  opacity: 0.8;
}

.section {
  margin-bottom: 24px;
}

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 10px;
  opacity: 0.6;
}

.section-body {
  font-size: 0.98rem;
  line-height: 1.55;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid;
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 0.92rem;
  line-height: 1.4;
}

.divider {
  height: 1px;
  margin: 24px 0;
  opacity: 0.2;
}

.archetypes {
  list-style: none;
  margin-top: 14px;
  padding: 0;
}

.archetypes li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.archetypes li::before {
  content: "—";
  position: absolute;
  left: 0;
  top: 6px;
  opacity: 0.6;
}

.archetypes strong {
  font-weight: 600;
}

.card-cyberpunk .archetypes li::before {
  content: ">";
  font-family: 'VT323', monospace;
  color: #00ffe5;
}

.card-deadlands .archetypes li::before {
  content: "♠";
  color: rgba(180, 80, 60, 0.7);
}

.card-twilight .archetypes li::before {
  content: "▸";
  color: #b8ba80;
}

.card-starfinder .archetypes li::before {
  content: "✦";
  color: #a8b8ff;
}

/* ============ DEADLANDS — weird west ============ */
.card-deadlands {
  background: #1a0e08;
  color: #e8d9b8;
  border: 1px solid rgba(180, 120, 50, 0.3);
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 40px,
      rgba(180, 120, 50, 0.02) 40px,
      rgba(180, 120, 50, 0.02) 41px
    );
}

.card-deadlands::before {
  content: "♠ ♥ ♦ ♣";
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 14px;
  letter-spacing: 8px;
  color: rgba(180, 80, 60, 0.4);
}

.card-deadlands .card-tag {
  border-color: rgba(180, 80, 60, 0.5);
  color: #c47860;
  font-family: 'Special Elite', monospace;
}

.card-deadlands .card-title {
  font-family: 'Rye', serif;
  color: #d4a574;
}

.card-deadlands .card-subtitle {
  font-family: 'Special Elite', monospace;
  color: #b8a585;
}

.card-deadlands .section-label {
  color: #c47860;
}

.card-deadlands .stats {
  border-color: rgba(180, 80, 60, 0.3);
}

/* ============ TWILIGHT: 2000 — gritty cold war ============ */
.card-twilight {
  background: #1b1f1a;
  color: #d4d6c8;
  border: 1px solid rgba(120, 130, 90, 0.3);
  background-image:
    linear-gradient(135deg, transparent 0%, rgba(80, 50, 30, 0.08) 100%);
}

.card-twilight::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #6b7340 0px,
    #6b7340 12px,
    #1b1f1a 12px,
    #1b1f1a 16px
  );
}

.card-twilight::after {
  content: "OPERATION: PALATE CLEANSE";
  position: absolute;
  top: 16px;
  right: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  color: rgba(180, 180, 140, 0.4);
}

.card-twilight .card-tag {
  border-color: rgba(180, 180, 100, 0.4);
  color: #c8c89a;
  font-family: 'JetBrains Mono', monospace;
}

.card-twilight .card-title {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 0.04em;
  font-size: 2.6rem;
  color: #d4d6c8;
}

.card-twilight .card-subtitle {
  font-family: 'JetBrains Mono', monospace;
  color: #a8aa90;
  font-style: normal;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

.card-twilight .section-label {
  color: #b8ba80;
}

.card-twilight .stats {
  border-color: rgba(180, 180, 100, 0.25);
}

/* ============ STARFINDER 2E — sleek space opera ============ */
.card-starfinder {
  background: linear-gradient(160deg, #0a0e1f 0%, #1a1438 100%);
  color: #d8dcf0;
  border: 1px solid rgba(120, 140, 220, 0.3);
}

.card-starfinder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(220, 220, 255, 0.6), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(180, 200, 255, 0.5), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 40% 80%, rgba(200, 180, 255, 0.5), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(220, 220, 255, 0.4), transparent);
  pointer-events: none;
}

.card-starfinder > * {
  position: relative;
  z-index: 1;
}

.card-starfinder .card-tag {
  border-color: rgba(180, 200, 255, 0.5);
  color: #a8b8ff;
  font-family: 'Orbitron', sans-serif;
  font-weight: 500;
}

.card-starfinder .card-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(120, 150, 255, 0.4);
}

.card-starfinder .card-subtitle {
  color: #a0b0d8;
}

.card-starfinder .section-label {
  color: #8a9cd8;
}

.card-starfinder .stats {
  border-color: rgba(180, 200, 255, 0.2);
}

/* ============ CYBERPUNK RED — neon dystopia ============ */
.card-cyberpunk {
  background: #0d0612;
  color: #f0e8f8;
  border: 1px solid #ff2e88;
  box-shadow:
    0 0 0 1px rgba(255, 46, 136, 0.1),
    inset 0 0 80px rgba(255, 46, 136, 0.04);
}

.card-cyberpunk::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 46, 136, 0.02) 2px,
      rgba(255, 46, 136, 0.02) 4px
    );
  pointer-events: none;
}

.card-cyberpunk::after {
  content: "//NIGHT_CITY.EXE";
  position: absolute;
  top: 16px;
  right: 20px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #00ffe5;
  letter-spacing: 0.1em;
}

.card-cyberpunk > * {
  position: relative;
  z-index: 1;
}

.card-cyberpunk .card-tag {
  border-color: #00ffe5;
  color: #00ffe5;
  font-family: 'VT323', monospace;
  font-size: 13px;
}

.card-cyberpunk .card-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  color: #ff2e88;
  text-shadow:
    2px 0 0 rgba(0, 255, 229, 0.4),
    -2px 0 0 rgba(255, 200, 0, 0.3);
  letter-spacing: 0.02em;
}

.card-cyberpunk .card-subtitle {
  font-family: 'VT323', monospace;
  font-size: 1.15rem;
  color: #00ffe5;
  font-style: normal;
}

.card-cyberpunk .section-label {
  color: #ff2e88;
}

.card-cyberpunk .stats {
  border-color: rgba(255, 46, 136, 0.3);
}

/* ============ Footer ============ */
.footer {
  max-width: 900px;
  margin: 80px auto 0;
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.footer p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.8;
}

.footer .question {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.5rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  body {
    padding: 40px 16px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .card {
    padding: 36px 28px;
  }
}

/* ============ Utility ============ */
.hidden {
  display: none !important;
}

/* ============ Ranking Section ============ */
.ranking-section {
  max-width: 680px;
  margin: 100px auto 0;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.ranking-section.revealed {
  opacity: 1;
  transform: translateY(0);
}

.ranking-header {
  text-align: center;
  margin-bottom: 48px;
}

.ranking-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.ranking-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 12px;
}

.ranking-header p {
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---- Sortable list ---- */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 48px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 2px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.2s;
}

.rank-item:active {
  cursor: grabbing;
}

.rank-item.dragging {
  opacity: 0.35;
  box-shadow: none;
}

.rank-placeholder {
  border-radius: 2px;
  background: rgba(232, 230, 225, 0.06);
  border: 1px dashed rgba(232, 230, 225, 0.2);
}

.rank-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.6;
}

.rank-handle {
  font-size: 20px;
  opacity: 0.25;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -3px;
}

.rank-info {
  flex: 1;
  min-width: 0;
}

.rank-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
}

.rank-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.45;
}

.rank-pts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  opacity: 0.55;
  flex-shrink: 0;
}

/* Mini card themes */
.rank-deadlands {
  background: #1a0e08;
  color: #e8d9b8;
  border: 1px solid rgba(180, 120, 50, 0.4);
}

.rank-twilight2000 {
  background: #1b1f1a;
  color: #d4d6c8;
  border: 1px solid rgba(120, 130, 90, 0.4);
}

.rank-starfinder2e {
  background: linear-gradient(135deg, #0a0e1f 0%, #1a1438 100%);
  color: #d8dcf0;
  border: 1px solid rgba(120, 140, 220, 0.4);
}

.rank-cyberpunk_red {
  background: #0d0612;
  color: #f0e8f8;
  border: 1px solid rgba(255, 46, 136, 0.45);
}

/* ---- Vote form ---- */
.vote-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.code-field {
  width: 100%;
  max-width: 320px;
}

.code-field label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.code-field input {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(232, 230, 225, 0.2);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  padding: 12px 16px;
  letter-spacing: 0.08em;
  outline: none;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.code-field input:focus {
  border-color: rgba(232, 230, 225, 0.55);
}

.submit-btn {
  background: transparent;
  border: 1px solid rgba(232, 230, 225, 0.5);
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  padding: 14px 36px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.submit-btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.submit-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.vote-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #ff6b6b;
  text-align: center;
}

.vote-note {
  margin-top: 0.9rem;
  font-size: 0.82rem;
  opacity: 0.62;
  letter-spacing: 0.02em;
}

/* ============ Results Section ============ */
.results-section {
  max-width: 680px;
  margin: 100px auto 0;
}

.results-header {
  text-align: center;
  margin-bottom: 56px;
}

.results-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.results-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 12px;
}

.votes-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.votes-count p {
  margin: 0;
}

.voted-list {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 12px;
}

.results-chart {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 48px;
}

.chart-row {
  display: grid;
  grid-template-columns: 180px 1fr 52px;
  align-items: center;
  gap: 16px;
}

.chart-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  width: 18px;
  flex-shrink: 0;
}

.chart-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-bar-wrap {
  height: 24px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
}

.chart-bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-bar.animate {
  width: var(--pct);
}

.chart-pts {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.refresh-btn {
  display: block;
  margin: 0 auto;
  background: transparent;
  border: 1px solid rgba(232, 230, 225, 0.15);
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: 10px 28px;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.2s, color 0.2s;
}

.refresh-btn:hover {
  border-color: rgba(232, 230, 225, 0.5);
  color: var(--ink);
}

.chart-loading,
.chart-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-align: center;
  padding: 40px 0;
}

.chart-error {
  color: #ff6b6b;
}

@media (max-width: 640px) {
  .chart-row {
    grid-template-columns: 130px 1fr 44px;
    gap: 10px;
  }

  .rank-item {
    padding: 14px 16px;
  }
}
