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

:root {
  --bg: #0a0a14;
  --panel: #0e0e1a;
  --panel-alt: #111128;
  --border: #1a1a35;
  --border-light: #252550;
  --text: #c8c8d4;
  --text-dim: #555568;
  --text-muted: #88889a;
  --accent: #dd2222;
  --accent-glow: rgba(221,34,34,0.25);
  --accent-dim: #881515;
  --blue: #555577;
  --blue-glow: rgba(85,85,119,0.25);
  --green: #40a060;
  --amber: #c89840;
  --font: 'JetBrains Mono', 'Courier New', monospace;
}

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  padding-top: 48px;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

::selection { background: var(--accent-glow); color: #ff4444; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ── CRT OVERLAYS ── */
#crt { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }

#crt-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg, rgba(0,0,0,0.08) 0px, rgba(255,0,0,0.015) 1px,
    rgba(0,255,0,0.015) 2px, rgba(0,0,255,0.015) 3px, rgba(0,0,0,0.1) 4px
  );
  animation: scanlineMove 0.08s linear infinite; z-index: 2;
}
#crt-curve {
  position: absolute; inset: 0;
  border-radius: 50% / 8%; box-shadow: inset 0 0 80px 20px rgba(0,0,0,0.50); z-index: 3;
}
#crt-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 75%, rgba(0,0,0,0.65) 100%); z-index: 4;
}
#crt-phosphor {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(221,34,34,0.02) 0%, transparent 70%);
  animation: phosphorBreathing 4s ease-in-out infinite; z-index: 5;
}
#crt-noise {
  position: absolute; inset: 0; opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat; background-size: 128px 128px;
  animation: noiseMove 0.3s steps(4) infinite; z-index: 6;
}
#crt-flicker {
  position: absolute; inset: 0; animation: flicker 0.15s infinite; opacity: 0; z-index: 7;
}
#crt-jitter {
  position: absolute; inset: 0; animation: syncJitter 8s linear infinite;
  opacity: 0; background: rgba(0,0,0,0.03); z-index: 8;
}
#crt-chroma {
  position: absolute; inset: 0; animation: chromaLine 6s linear infinite; opacity: 0; z-index: 1;
}

@keyframes scanlineMove { 0% { background-position: 0 0; } 100% { background-position: 0 4px; } }
@keyframes phosphorBreathing { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

@keyframes noiseMove {
  0% { transform: translate(0,0); } 10% { transform: translate(-1px,-1px); }
  20% { transform: translate(1px,-1px); } 30% { transform: translate(-1px,1px); }
  40% { transform: translate(1px,1px); } 50% { transform: translate(-1px,0); }
  60% { transform: translate(0,1px); } 70% { transform: translate(1px,0); }
  80% { transform: translate(0,-1px); } 90% { transform: translate(-1px,1px); }
  100% { transform: translate(0,0); }
}

@keyframes flicker { 0%,94%,96%,100% { opacity: 0; } 95% { opacity: 0.025; } }
@keyframes syncJitter {
  0%,92%,94%,96%,100% { transform: translate(0,0); opacity: 0; }
  93% { transform: translate(3px,0); opacity: 0.08; }
  95% { transform: translate(-2px,0); opacity: 0.05; }
}
@keyframes chromaLine {
  0%,80%,82%,84%,86%,100% { opacity: 0; clip-path: inset(0 0 100% 0); }
  81% { opacity: 0.15; clip-path: inset(35% 0 60% 0); background: rgba(255,0,0,0.1); }
  83% { opacity: 0.1; clip-path: inset(40% 0 55% 0); background: rgba(0,255,0,0.1); }
  85% { opacity: 0.08; clip-path: inset(42% 0 53% 0); background: rgba(0,0,255,0.1); }
}

/* ── CRT POWER ON / OFF ── */
#crt-boot { position: fixed; inset: 0; z-index: 10000; pointer-events: none; background: var(--bg); }
#crt-boot.boot-hidden { display: none; }
#crt-boot.boot-active { display: block; }

@keyframes crtPowerOn {
  0% { background: #000; opacity: 1; transform: scaleY(0.005); }
  10% { background: #0a0202; opacity: 1; transform: scaleY(0.02); }
  25% { background: var(--bg); opacity: 1; transform: scaleY(1.02); }
  35% { background: var(--bg); opacity: 1; transform: scaleY(0.98); filter: brightness(1.3); }
  50% { background: var(--bg); opacity: 1; transform: scaleY(1); filter: brightness(1.1); }
  70% { background: var(--bg); opacity: 1; transform: scaleY(1); filter: brightness(1); }
  100% { background: var(--bg); opacity: 0; }
}
@keyframes crtGlitch {
  0% { background: transparent; opacity: 0; transform: scaleY(1); }
  5% { background: rgba(0,0,0,0.4); opacity: 1; transform: scaleY(1.005); clip-path: inset(0 0 0 0); }
  15% { background: rgba(0,0,0,0.5); opacity: 1; transform: scaleY(1); clip-path: inset(10% 0 85% 0); }
  25% { background: rgba(0,0,0,0.5); opacity: 1; transform: scaleY(0.995); clip-path: inset(0 0 0 0); }
  35% { background: rgba(0,0,0,0.05); opacity: 0.6; transform: scaleY(1); clip-path: inset(0 0 0 0); }
  50% { background: transparent; opacity: 0; }
  100% { background: transparent; opacity: 0; }
}
.crt-boot-on { animation: crtPowerOn 0.6s ease-out forwards; }
.crt-glitch { display: block; animation: crtGlitch 0.5s ease-out forwards; }

/* ── TOP BAR ── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 48px; z-index: 1000;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
}
#logo a {
  font-size: 14px; font-weight: 700; text-decoration: none;
  color: var(--accent); letter-spacing: 2px;
  margin-right: 32px;
}
#logo a span { color: var(--blue); }
#nav-links {
  list-style: none; display: flex; gap: 2px;
  flex: 1;
}
.nav-link {
  display: block; padding: 6px 14px;
  text-decoration: none; font-size: 11px; letter-spacing: 1px;
  color: var(--text-dim); text-transform: uppercase;
  border: 1px solid transparent;
  transition: all 0.2s;
  position: relative;
}
.nav-link:hover { color: var(--text); border-color: var(--border); background: var(--panel-alt); }
.nav-link.active { color: var(--accent); border-color: var(--accent); background: rgba(221,34,34,0.06); }
.nav-link.active::after {
  content: ''; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
  width: 60%; height: 1px; background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
#nav-right {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto;
}
#auth-group {
  display: inline-flex; flex-flow: row nowrap; align-items: center; gap: 6px;
  width: max-content;
}
#auth-group > a {
  display: inline-flex; align-items: center;
  flex-shrink: 0; white-space: nowrap;
}
#auth-link {
  font-size: 11px; letter-spacing: 1px; text-decoration: none;
  color: var(--text-muted); text-transform: uppercase;
  padding: 6px 12px; border: 1px solid var(--border);
  transition: all 0.2s;
}
#auth-link:hover { color: var(--accent); border-color: var(--accent); }
#logout-link {
  font-size: 11px; letter-spacing: 1px; text-decoration: none;
  color: var(--accent); text-transform: uppercase;
  padding: 6px 12px; border: 1px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
#logout-link:hover { border-color: var(--accent); background: rgba(221,34,34,0.08); }

/* ── DOT status ── */
.dot {
  width: 8px; height: 8px; display: inline-block;
  border-radius: 4px; vertical-align: middle;
  transition: all 0.3s;
}
.dot--online { background: var(--blue); box-shadow: 0 0 8px var(--blue-glow); animation: dotPulse 2s ease-in-out infinite; }
.dot--offline { background: var(--border); box-shadow: none; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(51,102,204,0.3); }
  50% { box-shadow: 0 0 12px rgba(51,102,204,0.8); }
}

/* ── CONTENT ── */
#content {
  max-width: 800px; margin: 0 auto; padding: 32px 24px;
  animation: pageEnter 0.4s ease-out;
}
#content.page-exit {
  animation: pageExit 0.15s ease-in forwards;
}

@keyframes pageEnter {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes pageExit {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-4px); }
}

/* ── TYPOGRAPHY ── */
h1 {
  font-size: 16px; font-weight: 500;
  color: var(--accent); letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 24px;
}
h1 span.hl { color: var(--blue); }
h2 {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 2px; margin-bottom: 16px; text-transform: uppercase;
}
h3 {
  font-size: 11px; font-weight: 500; color: var(--text-dim);
  letter-spacing: 1px; margin-bottom: 8px; text-transform: uppercase;
}
p { margin-bottom: 12px; line-height: 1.6; }
a { color: var(--blue); text-decoration: none; transition: all 0.2s; }
a:hover { text-shadow: 0 0 8px rgba(51,102,204,0.3); }
.text-muted { color: var(--text-dim); }

/* ── BOX TITLES (┌── ──┐) ── */
.box-title {
  display: flex; align-items: center; gap: 0.5rem;
}
.box-title::before {
  content: "┌── ";
  color: var(--text-dim);
  font-size: 11px;
}
.box-title::after {
  content: " ──┐";
  color: var(--text-dim);
  font-size: 11px;
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}
.box-title-left::before {
  content: "├── ";
}
.box-title-left::after {
  content: " ──┤";
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.page-header h1 { margin-bottom: 0; }

/* ── TIMER ── */
#timer-container {
  border: 1px solid var(--border);
  padding: 24px; margin-bottom: 24px;
  background: var(--panel);
  position: relative; overflow: hidden;
}
#timer-container::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}
#timer-display {
  font-size: 42px; font-weight: 700; letter-spacing: 6px;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(221,34,34,0.25);
  text-align: center; padding: 16px 0;
  font-variant-numeric: tabular-nums;
  animation: timerGlow 3s ease-in-out infinite;
}
@keyframes timerGlow {
  0%, 100% { text-shadow: 0 0 15px rgba(221,34,34,0.2); }
  50% { text-shadow: 0 0 30px rgba(221,34,34,0.5); }
}
.timer-label {
  font-size: 9px; color: var(--text-dim); letter-spacing: 3px; text-transform: uppercase;
  text-align: center; margin-bottom: 8px;
}

/* ── THEME ── */
#theme-display {
  border: 1px solid var(--border);
  padding: 20px; margin-bottom: 24px;
  background: var(--panel);
}
.theme-label {
  font-size: 9px; color: var(--text-dim); letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 8px;
}
#theme-text {
  font-size: 20px; color: var(--accent);
  min-height: 28px;
  border-right: 2px solid var(--accent);
  animation: cursorBlink 1s step-end infinite;
  display: inline;
}
@keyframes cursorBlink {
  0%, 100% { border-color: var(--accent); }
  50% { border-color: transparent; }
}

/* ── PHASE / STATUS LABEL ── */
#jam-phase, .status-label {
  display: inline-block;
  font-size: 9px; letter-spacing: 2px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  color: var(--text-muted); margin-bottom: 8px;
}

/* ── THEME VOTE CARDS ── */
#themes-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card {
  border: 1px solid var(--border); padding: 14px;
  background: var(--panel);
  display: flex; flex-direction: column; gap: 8px;
  transition: all 0.2s;
}
.theme-card:hover { border-color: var(--text-dim); }
.theme-card--winner {
  border-color: var(--accent);
  background: rgba(221,34,34,0.06);
  box-shadow: 0 0 12px rgba(221,34,34,0.1);
}
.theme-card-text { font-size: 13px; color: var(--text); }
.theme-card-badge {
  font-size: 8px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent);
  padding: 2px 6px; display: inline-block; width: fit-content;
}
.theme-vote-radio {
  appearance: none; width: 14px; height: 14px;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; flex-shrink: 0; position: relative;
}
.theme-vote-radio:hover { border-color: var(--accent); }
.theme-vote-radio:checked {
  border-color: var(--accent); background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.theme-vote-radio:checked::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 6px; height: 6px; background: var(--bg);
}
.theme-vote-radio:disabled { opacity: 0.25; cursor: not-allowed; }
.theme-card label {
  color: var(--text); flex: 1; display: flex; align-items: center; gap: 10px;
}
.theme-card label:hover .theme-card-text { color: var(--accent); }

/* ── QUICK ACTIONS ── */
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 32px 0; }
.action-card {
  flex: 1; min-width: 160px;
  border: 1px solid var(--border); padding: 20px;
  text-decoration: none; color: var(--text-muted);
  transition: all 0.25s;
  background: var(--panel);
  position: relative; overflow: hidden;
}
.action-card:hover {
  border-color: var(--accent);
  background: var(--panel-alt);
  transform: translateY(-2px);
}
.action-card:hover .action-title { color: var(--accent); }
.action-card::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(221,34,34,0.04), transparent);
  transition: left 0.5s;
}
.action-card:hover::before { left: 100%; }
.action-icon {
  font-size: 16px; display: block; margin-bottom: 10px;
  color: var(--text-dim);
  transition: all 0.25s;
}
.action-card:hover .action-icon { color: var(--accent); }
.action-title { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 4px; display: block; text-transform: uppercase; }
.action-desc { font-size: 10px; color: var(--text-dim); display: block; }

/* ── BUTTONS ── */
.btn {
  font-family: var(--font);
  font-size: 10px; letter-spacing: 1px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer; text-transform: uppercase;
  transition: all 0.2s;
  position: relative;
}
.btn:hover { border-color: var(--text); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn--primary { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn--primary:hover { background: rgba(221,34,34,0.1); box-shadow: 0 0 12px rgba(221,34,34,0.15); }
.btn--danger { border-color: var(--accent); color: var(--accent); }
.btn--danger:hover { background: rgba(221,34,34,0.1); box-shadow: 0 0 12px rgba(221,34,34,0.15); }
.btn--sm { padding: 4px 10px; font-size: 9px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn:disabled:hover { border-color: var(--border); color: var(--text-dim); background: transparent; box-shadow: none; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 9px; color: var(--text-dim);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px;
}
input, textarea, select {
  font-family: var(--font);
  font-size: 12px;
  width: 100%; padding: 8px 12px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); outline: none;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(221,34,34,0.1); }
textarea { resize: vertical; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease-out;
}
.modal {
  background: var(--panel); border: 1px solid var(--border);
  min-width: 360px; max-width: 480px; width: 90%;
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  0% { opacity: 0; transform: scale(0.95) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 11px; color: var(--accent); }
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 18px; cursor: pointer; font-family: inherit; transition: color 0.2s;
}
.modal-close:hover { color: var(--accent); }
.modal-body { padding: 16px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 16px; border-top: 1px solid var(--border);
}

/* ── TEAMS ── */
.teams-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.team-card {
  border: 1px solid var(--border); padding: 14px;
  background: var(--panel); cursor: pointer;
  transition: all 0.25s;
  display: flex; flex-direction: column; gap: 4px;
}
.team-card:hover { border-color: var(--accent); transform: translateY(-1px); background: var(--panel-alt); }
.team-card-name { font-size: 13px; color: var(--text); }
.team-card-count { font-size: 9px; color: var(--blue); }
.team-card-desc { font-size: 10px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card-members-list { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; }
.team-card-member-name { font-size: 9px; padding: 1px 6px; border: 1px solid var(--border); color: var(--text-muted); }
.team-card-ach-row { margin-top: 4px; min-height: 16px; }
.team-detail { border: 1px solid var(--border); padding: 24px; background: var(--panel); }
.team-detail h1 { margin-bottom: 4px; }
.team-avatar { width: 48px; height: 48px; border-radius: 4px; border: 1px solid var(--border); margin-right: 12px; object-fit: cover; vertical-align: middle; }
.team-avatar-small { width: 32px; height: 32px; border-radius: 3px; border: 1px solid var(--border); margin-right: 8px; object-fit: cover; float: left; }
.team-desc { color: var(--text-muted); font-size: 12px; margin-bottom: 16px; }
.member-list { list-style: none; margin-bottom: 16px; }
.member-list li {
  padding: 8px 12px; border: 1px solid var(--border); margin-bottom: 4px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.member-role {
  font-size: 9px; color: var(--text-dim); letter-spacing: 1px;
  padding: 2px 6px; border: 1px solid var(--border);
}
.detail-links { display: flex; gap: 12px; }
.detail-links a {
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid var(--border);
}

/* ── NOMINATIONS ── */
.nom-card {
  border: 1px solid var(--border); padding: 18px; margin-bottom: 12px;
  background: var(--panel);
  transition: border-color 0.2s;
}
.nom-card--done {
  border-color: var(--green);
  background: rgba(64,160,96,0.04);
}
.nom-text { font-size: 13px; color: var(--text); margin-bottom: 10px; line-height: 1.5; }
.nom-meta { font-size: 10px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nom-arrow { color: var(--text-muted); font-size: 12px; }
.nom-winner-tag { color: var(--green); border: 1px solid var(--green); padding: 1px 6px; font-size: 9px; letter-spacing: 1px; }
.nom-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── ADMIN ── */
.admin-grid { display: grid; gap: 16px; }
.admin-card {
  border: 1px solid var(--border); padding: 20px;
  background: var(--panel);
}
.admin-card h2 { font-size: 11px; color: var(--accent); margin-bottom: 16px; letter-spacing: 2px; }
.btn-group { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.jam-info { padding: 12px; border: 1px solid var(--border); font-size: 11px; background: var(--bg); }
.jam-info p { margin-bottom: 4px; }
.jam-info strong { color: var(--text-dim); }

.admin-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.admin-table th {
  text-align: left; padding: 8px 12px;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
  letter-spacing: 1px; text-transform: uppercase; font-weight: 400;
}
.admin-table td { padding: 8px 12px; border-bottom: 1px solid var(--panel-alt); }
.admin-table tr:hover td { background: var(--panel-alt); }

.admin-history-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--panel-alt);
  font-size: 11px;
}
.admin-history-row:last-child { border-bottom: none; }
.admin-history-name { flex: 1; color: var(--text); }
.admin-history-date { color: var(--text-dim); font-size: 10px; min-width: 70px; }

.log-container {
  font-size: 10px; max-height: 240px; overflow-y: auto;
  background: var(--bg); padding: 12px;
  border: 1px solid var(--border);
}
.log-line { color: var(--text-dim); padding: 2px 0; }
.log-line .ts { color: var(--text-dim); }
.log-line .action { color: var(--blue); }
.log-line .error { color: var(--accent); }

/* ── LOADING ── */
.loading {
  text-align: center; padding: 32px; color: var(--text-dim);
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  animation: loadingPulse 1.5s ease-in-out infinite;
}
@keyframes loadingPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 48px 24px;
  border: 1px solid var(--border); background: var(--panel);
}
.empty-state .empty-icon { font-size: 24px; color: var(--text-dim); margin-bottom: 12px; display: block; }
.empty-state .empty-text { color: var(--text-dim); font-size: 11px; }
.empty-state .empty-desc { color: var(--text-dim); font-size: 10px; margin-top: 8px; }

.hidden { display: none !important; }

/* ── PHASE NOTIFICATION (terminal boot) ── */
#phase-notification {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  background: #0a0a0a;
}
#phase-notification::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(221,34,34,0.025) 0px,
    rgba(221,34,34,0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}
.phase-notif--active {
  animation: termBootFlicker 0.15s ease-out;
}
.phase-notif-inner {
  text-align: left;
  position: relative;
  z-index: 1;
}
.phase-notif-badge {
  font-size: 11px; letter-spacing: 0; color: #dd2222;
  margin-bottom: 12px; display: block;
  font-weight: 400;
}
.phase-notif-badge::before {
  content: '> ';
  color: #dd2222;
}
.phase-notif-title {
  font-size: 32px; font-weight: 400; letter-spacing: 2px;
  color: #dd2222;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  min-height: 1.2em;
}
.phase-notif-title::after {
  content: '_'; display: inline-block;
  animation: termCursor 0.6s step-end infinite;
  color: #dd2222; margin-left: 4px;
}
.phase-notif-desc {
  font-size: 11px; letter-spacing: 0; color: #881515;
  font-family: 'JetBrains Mono', monospace;
  min-height: 1.2em;
}
@keyframes termBootFlicker {
  0% { opacity: 0; }
  20% { opacity: 1; }
  40% { opacity: 0.7; }
  60% { opacity: 1; }
  80% { opacity: 0.8; }
  100% { opacity: 1; }
}
@keyframes termCursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── LED DOTS ── */
.led {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 4px; vertical-align: middle;
}
.led-red { background: var(--accent); box-shadow: 0 0 4px var(--accent); }
.led-green { background: var(--green); box-shadow: 0 0 4px var(--green); }
.led-amber { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.led-off { background: var(--text-dim); box-shadow: none; }

/* ── PHOSPHOR GLOW ── */
@keyframes phosphorPulse {
  0%, 100% { text-shadow: 0 0 6px rgba(221,34,34,0.3), 0 0 12px rgba(221,34,34,0.1); }
  50% { text-shadow: 0 0 10px rgba(221,34,34,0.5), 0 0 20px rgba(221,34,34,0.2); }
}
.glow-accent {
  animation: phosphorPulse 3s ease-in-out infinite;
}

/* ── GLITCH HOVER ── */
.glitch-hover {
  position: relative;
  transition: color 0.15s;
}
.glitch-hover:hover {
  color: var(--text);
}
.glitch-hover:hover::before,
.glitch-hover:hover::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.glitch-hover:hover::before {
  color: rgba(255, 50, 50, 0.4);
  animation: glitchShift 0.3s infinite;
  clip-path: inset(20% 0 40% 0);
}
.glitch-hover:hover::after {
  color: rgba(50, 200, 255, 0.3);
  animation: glitchShift 0.3s infinite reverse;
  clip-path: inset(50% 0 10% 0);
}
@keyframes glitchShift {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-2px, 1px); }
  94% { transform: translate(2px, -1px); }
  96% { transform: translate(-1px, 2px); }
  98% { transform: translate(1px, -2px); }
}

/* ── STAMP ANIMATION ── */
@keyframes stampSlam {
  0% { transform: translateY(-40px) rotate(-15deg) scale(1.5); opacity: 0; }
  60% { transform: translateY(5px) rotate(-10deg) scale(0.95); opacity: 1; }
  80% { transform: translateY(-2px) rotate(-10deg) scale(1.02); }
  100% { transform: translateY(0) rotate(-10deg) scale(1); opacity: 1; }
}
.stamp-animate {
  animation: stampSlam 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── SCREEN RATTLE ── */
@keyframes screenRattle {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(1px, -1px); }
  20% { transform: translate(-2px, 1px); }
  30% { transform: translate(1px, 2px); }
  40% { transform: translate(-1px, -1px); }
  50% { transform: translate(2px, -2px); }
  60% { transform: translate(-2px, 0); }
  70% { transform: translate(1px, -2px); }
  80% { transform: translate(-1px, 2px); }
  90% { transform: translate(2px, 1px); }
}
.screen-rattle {
  animation: screenRattle 0.2s ease-in-out;
}

/* ── SCANNER GLOW (nominations during phase 4) ── */
.scanner-active {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  position: relative; overflow: hidden;
}
.scanner-active::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(221,34,34,0.02) 15%,
    rgba(221,34,34,0.10) 45%,
    rgba(221,34,34,0.02) 75%,
    transparent 100%
  );
  animation: scannerSweep 2s ease-in-out infinite;
  pointer-events: none; z-index: 0;
}
.scanner-active::after {
  content: ''; position: absolute; top: 0; width: 2px; height: 100%;
  background: var(--accent);
  box-shadow:
    0 0 4px var(--accent),
    0 0 12px var(--accent),
    0 0 30px rgba(221,34,34,0.4);
  animation: scannerBeam 2s ease-in-out infinite;
  pointer-events: none; z-index: 1;
}
@keyframes scannerSweep {
  0%, 100% { left: -30%; }
  50% { left: 100%; }
}
@keyframes scannerBeam {
  0%, 100% { left: -2px; opacity: 0.2; }
  8% { opacity: 1; }
  42% { left: calc(100% - 2px); opacity: 1; }
  50% { left: calc(100% - 2px); opacity: 0.2; }
  58% { opacity: 1; }
  92% { left: -2px; opacity: 1; }
  100% { left: -2px; opacity: 0.2; }
}

/* ── PHASE LOCK (nominations page when phase < 4) ── */
.phase-lock {
  text-align: center; padding: 48px 24px;
  border: 1px solid var(--border); background: var(--panel);
}
.phase-lock-icon { font-size: 24px; color: var(--text-dim); display: block; margin-bottom: 12px; }
.phase-lock-text { color: var(--text-dim); font-size: 11px; display: block; }
.phase-lock-desc { color: var(--text-dim); font-size: 10px; margin-top: 8px; }

/* ── MUSEUM ── */
.museum-list { display: grid; gap: 12px; }
.museum-card {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border); padding: 16px 20px;
  background: var(--panel); text-decoration: none;
  transition: all 0.25s;
}
.museum-card:hover { border-color: var(--accent); background: var(--panel-alt); transform: translateY(-1px); }
.museum-card-name { font-size: 13px; color: var(--text); }
.museum-card-date { font-size: 10px; color: var(--text-dim); }

.museum-detail { border: 1px solid var(--border); padding: 20px; background: var(--panel); }
.museum-detail-meta { display: flex; gap: 12px; margin-bottom: 8px; font-size: 11px; }
.museum-detail-label { color: var(--text-dim); min-width: 80px; }
.museum-detail-value { color: var(--text); }
.museum-detail-winner { display: flex; gap: 12px; margin-bottom: 8px; font-size: 11px; padding: 8px 12px; border: 1px solid var(--accent); background: rgba(221,34,34,0.04); }
.museum-winner-name { color: var(--accent); font-weight: 700; }

.museum-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.museum-team-card { border: 1px solid var(--border); padding: 12px; background: var(--panel); }
.museum-team-name { font-size: 12px; color: var(--text); display: block; margin-bottom: 4px; }
.museum-team-members { font-size: 10px; color: var(--text-dim); }
.museum-team-members-list { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.museum-team-member-name { font-size: 9px; padding: 1px 6px; border: 1px solid var(--border); color: var(--text-muted); }

.museum-noms { display: grid; gap: 8px; }
.museum-nom-card { border: 1px solid var(--border); padding: 12px; background: var(--panel); }
.museum-nom-card--winner { border-color: var(--green); background: rgba(64,160,96,0.04); }
.museum-nom-text { font-size: 12px; color: var(--text); display: block; margin-bottom: 4px; }
.museum-nom-winner { font-size: 10px; color: var(--green); }

.museum-builds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.museum-build-card { border: 1px solid var(--border); padding: 12px; background: var(--panel); display: flex; justify-content: space-between; align-items: center; }
.museum-build-name { font-size: 12px; color: var(--text); }
.museum-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.museum-stat { text-align: center; padding: 8px; border: 1px solid var(--border); background: var(--bg); }
.museum-stat-num { display: block; font-size: 22px; color: var(--accent); font-weight: 700; }
.museum-stat-lbl { display: block; font-size: 9px; color: var(--text-dim); margin-top: 2px; letter-spacing: 1px; }

/* ── FADE IN DELAYS ── */
.fade-in {
  animation: fadeInUp 0.4s ease-out forwards;
}
.fade-in-d1 { animation-delay: 0.05s; }
.fade-in-d2 { animation-delay: 0.1s; }
.fade-in-d3 { animation-delay: 0.15s; }
.fade-in-d4 { animation-delay: 0.2s; }
.fade-in-d5 { animation-delay: 0.25s; }
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ── PROGRESS FILL ── */
@keyframes progressFill {
  0% { width: 0%; }
}
.progress-fill {
  animation: progressFill 1s ease-out forwards;
}

/* ── OLD GLITCH FALLBACK ── */
.glitch-hover-old {
  position: relative;
}
.glitch-hover-old:hover {
  animation: glitchOld 0.3s steps(2) 1;
}
@keyframes glitchOld {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); clip-path: inset(20% 0 60% 0); }
  40% { transform: translate(2px, -1px); clip-path: inset(40% 0 40% 0); }
  60% { transform: translate(-1px, 2px); clip-path: inset(60% 0 20% 0); }
  80% { transform: translate(1px, -2px); clip-path: inset(10% 0 70% 0); }
  100% { transform: translate(0); }
}

/* ── NAV TOGGLES ── */
#nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
#nav-toggles {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--border); padding: 1px; background: var(--panel);
}
.nav-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 1px solid transparent;
  color: var(--text-dim); cursor: pointer;
  font-size: 9px; padding: 3px 8px; letter-spacing: 1px;
  transition: all 0.15s; font-family: var(--font);
}
.nav-toggle:hover { border-color: var(--border); color: var(--text); }
.nav-toggle.off { color: var(--accent-dim); }
.toggle-icon { display: block; width: 10px; height: 10px; }
.toggle-icon--sfx { border: 1.5px solid currentColor; border-radius: 1px; position: relative; }
.toggle-icon--sfx::after {
  content: ''; position: absolute; right: -4px; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 3px solid transparent; border-bottom: 3px solid transparent; border-left: 4px solid currentColor;
}
.toggle-icon--crt { border: 1.5px solid currentColor; border-radius: 1px; position: relative; }
.toggle-icon--crt::after {
  content: ''; position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 2px solid transparent; border-right: 2px solid transparent; border-top: 3px solid currentColor;
}
.toggle-label { font-size: 8px; letter-spacing: 1px; }
.toggle-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 4px var(--green); transition: all 0.2s; }
.nav-toggle.off .toggle-dot { background: transparent; box-shadow: inset 0 0 0 1px var(--text-dim); }
.crt-disabled { display: none !important; }

/* ── AUTH GROUP ── */
#auth-group { display: inline-flex; flex-flow: row nowrap; align-items: center; gap: 6px; width: max-content; }
#auth-group > a { display: inline-flex; align-items: center; flex-shrink: 0; white-space: nowrap; }

/* ── ACHIEVEMENTS ── */
.ach-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px; vertical-align: middle; }
.ach-dot-count { font-size: 8px; color: var(--text-dim); vertical-align: middle; }
.ach-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; padding: 2px 8px; margin: 2px; border: 1px solid var(--border); letter-spacing: 1px; }
.ach-badge .ach-dot { width: 6px; height: 6px; }
.ach-count { font-size: 7px; color: var(--text-dim); }
.ach-row-group { display: flex; flex-wrap: wrap; gap: 4px; }

/* rank borders */
.rank-mvp { box-shadow: 0 0 12px rgba(221,34,34,0.15), inset 0 0 12px rgba(221,34,34,0.05) !important; border-color: var(--accent) !important; }
.rank-active { border-color: var(--blue) !important; }
.rank-participant { border-color: var(--text-dim) !important; }
.rank-lurker { opacity: 0.5; }

/* ── KONAMI MODE ── */
body.konami-mode { animation: screenRattle 0.08s ease-in-out infinite !important; }
body.konami-mode #crt-scanlines {
  background: repeating-linear-gradient(0deg,
    rgba(255,0,0,0.04) 0px, rgba(0,255,0,0.04) 1px,
    rgba(0,0,255,0.04) 2px, rgba(255,0,0,0.04) 3px, rgba(0,0,0,0.15) 4px
  ) !important;
}
body.konami-mode #crt-noise { opacity: 0.08 !important; }
body.konami-mode #crt-flicker { animation-duration: 0.05s !important; }
body.konami-mode #crt-phosphor {
  background: radial-gradient(ellipse at center, rgba(221,34,34,0.06) 0%, rgba(51,102,204,0.03) 50%, transparent 80%) !important;
  animation: phosphorBreathing 0.3s ease-in-out infinite !important;
}
body.konami-mode #crt-chroma { opacity: 0.3 !important; animation-duration: 0.4s !important; }
body.konami-mode #crt-jitter { animation-duration: 0.5s !important; }

/* ── PARTICIPANTS ── */
.participants-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.participant-chip { font-size: 10px; padding: 3px 10px; border: 1px solid var(--border); text-decoration: none; color: var(--text-muted); transition: all 0.15s; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.participant-avatar { width: 16px; height: 16px; border-radius: 4px; object-fit: cover; }
.participant-avatar-placeholder { width: 16px; height: 16px; border-radius: 4px; background: var(--accent); color: var(--bg); font-size: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.profile-avatar { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; border: 1px solid var(--border); }
.profile-avatar-placeholder { width: 48px; height: 48px; border-radius: 4px; background: var(--accent); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
#popup-avatar { margin-right: 8px; }
#popup-avatar .profile-avatar, #popup-avatar .profile-avatar-placeholder { width: 32px; height: 32px; font-size: 14px; }
.participant-chip:hover { border-color: var(--accent); color: var(--accent); background: rgba(221,34,34,0.05); }

/* ── MEMBER POPUP ── */
.member-popup {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
}
.member-popup-card {
  background: var(--panel); border: 1px solid var(--accent);
  min-width: 260px; max-width: 360px; padding: 16px;
  animation: terminalOpen 0.35s steps(8) forwards;
  box-shadow: 0 0 30px rgba(221,34,34,0.1);
}
@keyframes terminalOpen {
  0% { transform: scaleY(0.01); opacity: 0; clip-path: inset(50% 0 50% 0); }
  40% { transform: scaleY(1.02); opacity: 1; clip-path: inset(0 0 0 0); }
  60% { transform: scaleY(0.98); }
  100% { transform: scaleY(1); opacity: 1; }
}
.member-popup-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px;
}
.member-popup-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; font-family: var(--font);
}
.member-popup-close:hover { color: var(--accent); }
.screenshot-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 33px; padding: 0; font-size: 16px; line-height: 1;
  border: 1px solid var(--border); border-radius: 3px;
  background: var(--panel); cursor: pointer; vertical-align: middle;
  color: var(--text-dim);
}
.screenshot-btn:hover { border-color: var(--accent); color: var(--accent); }
.screenshot-added { border-color: var(--green) !important; color: var(--green) !important; }
.member-name-link:hover { color: var(--accent); text-shadow: 0 0 6px var(--accent-glow); }

/* ── PARTICLE FADE ── */
@keyframes particleFade { 0% { opacity: 1; } 80% { opacity: 0.3; } 100% { opacity: 0; transform: scale(0.3); } }
#particles-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9990; }

/* ── VISUAL EFFECTS ── */
a:hover, button:hover, .nav-link:hover { text-shadow: 0 0 6px rgba(221,34,34,0.2), 0 0 12px rgba(221,34,34,0.1); }
#content { text-shadow: 0 0 1px rgba(200,200,212,0.08); }

/* 3D hover on cards */
body:not(.fx-disabled) .team-card:hover,
body:not(.fx-disabled) .action-card:hover,
body:not(.fx-disabled) .theme-card:hover,
body:not(.fx-disabled) .museum-team-card:hover {
  transform: perspective(600px) rotateY(2deg) rotateX(1deg) translateY(-3px);
  transition: transform 0.3s ease-out;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

/* Neon cursor trail */
body:not(.fx-disabled) .neon-trail-particle {
  filter: blur(2px) !important;
  box-shadow: 0 0 8px currentColor, 0 0 16px currentColor !important;
}

/* Text glitch */
body:not(.fx-disabled) h1.glow-accent {
  animation: phosphorPulse 3s ease-in-out infinite, textGlitch 8s linear infinite;
}
@keyframes textGlitch {
  0%, 91%, 93%, 95%, 97%, 100% { transform: translate(0); clip-path: inset(0 0 0 0); }
  92% { transform: translate(-2px, 1px); clip-path: inset(20% 0 60% 0); }
  94% { transform: translate(2px, -1px); clip-path: inset(40% 0 40% 0); }
  96% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
}

/* Parallax background */
#parallax-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.03;
  background:
    radial-gradient(circle at 20% 30%, var(--accent) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, var(--blue) 0%, transparent 50%);
  animation: parallaxShift 30s linear infinite;
}
body.fx-disabled #parallax-bg { display: none; }
body.crt-disabled #parallax-bg { display: none; }
@keyframes parallaxShift {
  0% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-2%, 1%) scale(1.05); }
  50% { transform: translate(1%, -2%) scale(0.95); }
  75% { transform: translate(2%, 2%) scale(1.02); }
  100% { transform: translate(0, 0) scale(1); }
}
