/* ─────────────────────────────────────────────────────────────
   Murder Mystery CTF — Complete Stylesheet
   Theme: Dark Noir Investigation
   ───────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Oswald:wght@400;600&display=swap');

/* ── Reset & Root ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0a0a0f;
  --bg2:         #0f0f1a;
  --bg3:         #141420;
  --border:      #1e1e2e;
  --accent:      #d97706;   /* amber */
  --green:       #22c55e;
  --red:         #ef4444;
  --blue:        #3b82f6;
  --purple:      #a855f7;
  --text:        #e2e2e8;
  --text-dim:    #6b7280;
  --text-muted:  #4b5563;
  --font-mono:   'Share Tech Mono', monospace;
  --font-head:   'Oswald', sans-serif;
  --radius:      6px;
  --sidebar-w:   260px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 3px; }

/* ── Nav bar ──────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1.25rem;
}
.nav-brand {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--accent);
  text-transform: uppercase;
}
.nav-case { font-size: .65rem; color: var(--text-dim); margin-left: .5rem; }
.nav-links { margin-left: auto; display: flex; gap: .75rem; align-items: center; }
.nav-links a, .nav-links form button {
  font-family: var(--font-mono); font-size: .7rem;
  color: var(--text-dim); background: none; border: none;
  cursor: pointer; padding: .25rem .5rem;
  border-radius: var(--radius);
  text-transform: uppercase; letter-spacing: .08em;
}
.nav-links a:hover, .nav-links form button:hover { color: var(--accent); background: rgba(217,119,6,.1); }
.nav-user { font-size: .7rem; color: var(--accent); }
.flash-box { background:#1f1a08; border:1px solid var(--accent); border-radius:var(--radius); padding:.4rem .8rem; font-size:.72rem; }

/* ── Game Layout ──────────────────────────────────────────── */
.game-layout {
  display: flex;
  height: calc(100vh - 45px);
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.game-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.sidebar-header {
  padding: .8rem .9rem .7rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.sidebar-label {
  display: block;
  font-size: .6rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--text-dim);
  margin-bottom: 2px;
}
.sidebar-score {
  font-family: var(--font-head);
  font-size: 1.5rem; font-weight: 600;
  color: var(--accent);
}
.sidebar-score-box { margin-bottom: .5rem; }
.sidebar-progress-box {}

.progress-bar-outer {
  height: 5px; background: var(--border);
  border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.progress-bar-inner {
  height: 100%; background: var(--green);
  border-radius: 3px; transition: width .5s ease;
  min-width: 3px;
}

/* Tier blocks */
.tier-block { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.tier-header {
  font-size: .6rem; text-transform: uppercase;
  letter-spacing: .1em; font-weight: 600;
  padding: .3rem .9rem; display: flex; align-items: center; gap: .4rem;
}
.tier-lock-icon { font-size: .75rem; }

.tier-challenges { padding: 0 .5rem; }

.challenge-item {
  display: flex; align-items: center; gap: .4rem;
  padding: .35rem .55rem; margin: 2px 0;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s;
  border-left: 3px solid transparent;
  font-size: .72rem;
}
.challenge-item.open {
  color: var(--text);
  border-left-color: var(--text-dim);
}
.challenge-item.open:hover { background: var(--bg3); border-color: var(--accent); }
.challenge-item.solved { color: var(--green); }
.challenge-item.solved:hover { background: rgba(34,197,94,.08); }
.challenge-item.locked { color: var(--text-muted); cursor: not-allowed; }
.challenge-item.active-ch { background: rgba(217,119,6,.12) !important; border-color: var(--accent) !important; }

.ch-status { font-size: .8rem; flex-shrink: 0; }
.ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pts { font-size: .6rem; color: var(--text-dim); flex-shrink: 0; }

.tier-unlock-hint {
  font-size: .58rem; color: var(--text-muted);
  padding: .2rem .9rem; font-style: italic;
}

.sidebar-lb-btn {
  display: block; text-align: center; margin: .8rem .9rem 0;
  padding: .4rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: .65rem;
  color: var(--text-dim); text-transform: uppercase;
}
.sidebar-lb-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Game Main Area ───────────────────────────────────────── */
.game-main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
}

/* ── Welcome Screen ───────────────────────────────────────── */
.welcome-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100%; padding: 2rem;
}
.welcome-content { max-width: 700px; text-align: center; }
.welcome-tape {
  background: repeating-linear-gradient(45deg,#1a0000,#1a0000 10px,#220000 10px,#220000 20px);
  color: var(--red); font-size: .72rem; letter-spacing: .15em;
  padding: .5rem 1rem; border-radius: var(--radius);
  text-transform: uppercase; font-weight: 600; margin-bottom: 1.5rem;
}
.welcome-title {
  font-family: var(--font-head); font-size: 3rem;
  font-weight: 600; letter-spacing: .15em;
  color: var(--accent); margin-bottom: .5rem;
  text-transform: uppercase;
}
.welcome-sub { font-size: .85rem; color: var(--text-dim); margin-bottom: 1.5rem; }
.welcome-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem;
  margin-bottom: 1.5rem;
}
.welcome-stat { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem .5rem; }
.welcome-stat span { display: block; font-family: var(--font-head); font-size: 1.6rem; color: var(--accent); }
.welcome-stat label { font-size: .65rem; color: var(--text-dim); text-transform: uppercase; }
.welcome-hint { font-size: .75rem; color: var(--text-dim); margin-bottom: 1rem; }
.announcement-box { margin-top: 1rem; background: rgba(217,119,6,.08); border: 1px solid var(--accent); border-radius: var(--radius); padding: .75rem 1rem; }
.announcement-item { font-size: .75rem; color: var(--accent); padding: .2rem 0; }

/* ── Challenge Panel ──────────────────────────────────────── */
.challenge-panel { padding: 1.25rem 1.5rem; max-width: 1400px; }

.ch-header-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .5rem;
}
.ch-header-left, .ch-header-right { display: flex; gap: .75rem; align-items: center; }
.ch-tier-badge {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 700; padding: .1rem .4rem;
  border: 1px solid currentColor; border-radius: 3px;
}
.ch-category, .ch-scene {
  font-size: .62rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .08em;
}
.ch-points-badge {
  background: var(--accent); color: #000;
  font-size: .65rem; font-weight: 700; padding: .2rem .6rem;
  border-radius: 20px;
}
.ch-first-blood {
  font-size: .65rem; color: var(--red);
  border: 1px solid var(--red); padding: .1rem .4rem; border-radius: 3px;
}

.ch-title {
  font-family: var(--font-head); font-size: 1.5rem;
  font-weight: 600; color: var(--text); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 1rem;
  border-bottom: 1px solid var(--border); padding-bottom: .5rem;
}

.ch-content-cols {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.5rem;
}

.ch-left-col { display: flex; flex-direction: column; gap: .8rem; }
.ch-right-col {}

.ch-story {
  font-size: .8rem; color: var(--text-dim); line-height: 1.7;
  border-left: 3px solid var(--accent);
  padding-left: .75rem;
  background: rgba(217,119,6,.04);
  padding: .65rem .75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  white-space: pre-wrap;
}

.ch-instructions-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem;
}
.ch-instructions-label {
  font-size: .58rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: .4rem;
}
.ch-instructions {
  font-size: .77rem; color: var(--text); line-height: 1.65;
  white-space: pre-wrap;
}

.ch-vars-box {
  background: rgba(59,130,246,.07); border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius); padding: .5rem .75rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.ch-vars-label {
  font-size: .58rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--blue); flex-shrink: 0; padding-top: 2px;
}
.ch-vars-info { font-size: .72rem; color: var(--text-dim); }

/* Hints */
.hints-section { display: flex; flex-direction: column; gap: .4rem; }
.hints-label { font-size: .58rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); }
.hint-buttons { display: flex; flex-wrap: wrap; gap: .4rem; }
.hint-btn {
  font-family: var(--font-mono); font-size: .66rem;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text-dim); padding: .3rem .65rem;
  border-radius: var(--radius); cursor: pointer;
  transition: all .15s;
}
.hint-btn:hover { border-color: var(--accent); color: var(--accent); }
.hint-btn.used { border-color: var(--green); color: var(--green); }

/* Flag section */
.flag-section {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .75rem;
}
.flag-label {
  font-size: .58rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); margin-bottom: .5rem;
}
.flag-row { display: flex; gap: .5rem; }
.flag-input {
  flex: 1; font-family: var(--font-mono); font-size: .82rem;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: .5rem .75rem;
  border-radius: var(--radius); outline: none;
  transition: border-color .15s;
}
.flag-input:focus { border-color: var(--accent); }
.flag-input.correct { border-color: var(--green); color: var(--green); }
.flag-input.shake { animation: shake .4s ease; }
.flag-btn {
  font-family: var(--font-mono); font-size: .72rem;
  background: var(--accent); color: #000; border: none;
  padding: .5rem 1rem; border-radius: var(--radius);
  cursor: pointer; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; transition: opacity .15s;
}
.flag-btn:hover:not(:disabled) { opacity: .85; }
.flag-btn:disabled { opacity: .5; cursor: not-allowed; }
.flag-feedback { font-size: .72rem; margin-top: .4rem; }
.flag-feedback.correct { color: var(--green); }
.flag-feedback.wrong { color: var(--red); }
.check-output-result { font-size: .7rem; margin-top: .3rem; }
.check-output-result.correct { color: var(--green); }
.check-output-result.wrong { color: #f59e0b; }

/* ── Python Terminal ──────────────────────────────────────── */
.terminal-container {
  background: #080810; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  height: 100%; min-height: 480px;
}
.terminal-topbar {
  display: flex; align-items: center; gap: .4rem;
  background: #101018; padding: .4rem .75rem;
  border-bottom: 1px solid var(--border);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-dot.red    { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green  { background: #27c93f; }
.terminal-title { font-size: .68rem; color: var(--text-dim); margin-left: .25rem; flex: 1; }
.pyodide-status {
  font-size: .62rem; color: var(--text-dim);
  border: 1px solid var(--border); padding: .1rem .4rem;
  border-radius: 3px;
}
.pyodide-status.ready { border-color: var(--green); color: var(--green); }
.pyodide-status.error { border-color: var(--red); color: var(--red); }

.editor-wrapper {
  display: flex; flex: 1; min-height: 200px;
  font-size: .8rem; border-bottom: 1px solid var(--border);
}
.line-numbers {
  background: #0d0d18; color: var(--text-muted);
  padding: .6rem .4rem; font-size: .75rem; line-height: 1.55;
  text-align: right; user-select: none; min-width: 32px;
  border-right: 1px solid var(--border);
  white-space: pre;
}
.code-editor {
  flex: 1; background: transparent; border: none;
  color: #e2e2e8; font-family: var(--font-mono); font-size: .8rem;
  line-height: 1.55; padding: .6rem .75rem;
  resize: none; outline: none; white-space: pre;
  tab-size: 4;
}

.terminal-actions {
  display: flex; gap: .4rem; padding: .4rem .6rem;
  background: #0d0d18; border-bottom: 1px solid var(--border);
}
.run-btn {
  font-family: var(--font-mono); font-size: .72rem;
  background: var(--green); color: #000; border: none;
  padding: .3rem .8rem; border-radius: var(--radius);
  cursor: pointer; font-weight: 700;
}
.run-btn:disabled { opacity: .5; cursor: not-allowed; }
.action-btn {
  font-family: var(--font-mono); font-size: .68rem;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); padding: .3rem .65rem;
  border-radius: var(--radius); cursor: pointer;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
kbd {
  font-size: .62rem; background: rgba(255,255,255,.08);
  border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 4px; margin-left: 4px;
}

.output-area {
  flex: 1; padding: .6rem .75rem; overflow-y: auto;
  font-size: .78rem; line-height: 1.55;
  min-height: 120px; max-height: 200px;
  white-space: pre-wrap; word-break: break-word;
}
.output-placeholder { color: var(--text-muted); font-style: italic; }
.output-stdout { color: #e2e2e8; }
.output-stderr { color: var(--red); }
.output-info   { color: var(--text-dim); }

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--accent);
  border-radius: 10px; padding: 2rem; max-width: 500px; width: 90%;
  text-align: center; box-shadow: 0 0 40px rgba(217,119,6,.25);
  animation: popIn .3s ease;
}
.modal-header {
  font-family: var(--font-head); font-size: 1.5rem;
  font-weight: 600; color: var(--accent); margin-bottom: .75rem;
  text-transform: uppercase; letter-spacing: .1em;
}
.modal-points {
  font-size: 2rem; font-weight: 700; color: var(--green);
  margin-bottom: .5rem;
}
.modal-first-blood {
  background: rgba(239,68,68,.15); border: 1px solid var(--red);
  color: var(--red); padding: .3rem .8rem;
  border-radius: var(--radius); font-size: .75rem; margin-bottom: .75rem;
  display: inline-block;
}
.modal-reveal-label {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-dim); margin-bottom: .4rem;
}
.modal-reveal-text {
  font-size: .8rem; color: var(--text-dim); line-height: 1.6;
  margin-bottom: 1rem;
}
.modal-new-unlocks { font-size: .75rem; color: var(--green); margin-bottom: .75rem; }
.modal-close-btn {
  font-family: var(--font-mono); font-size: .72rem;
  background: var(--accent); color: #000; border: none;
  padding: .6rem 1.5rem; border-radius: var(--radius);
  cursor: pointer; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase;
}
.modal-close-btn:hover { opacity: .85; }

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg);
  position: relative; overflow: hidden;
}
.login-box {
  background: rgba(15,15,26,.97); border: 1px solid var(--border);
  border-radius: 10px; padding: 2.5rem 2rem;
  width: 100%; max-width: 380px; position: relative; z-index: 2;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo-text {
  font-family: var(--font-head); font-size: 1.6rem;
  font-weight: 600; color: var(--accent); letter-spacing: .15em;
}
.login-logo-sub { font-size: .65rem; color: var(--text-dim); text-transform: uppercase; }
.login-tabs { display: flex; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.login-tab {
  flex: 1; font-family: var(--font-mono); font-size: .72rem;
  background: none; border: none; color: var(--text-dim);
  padding: .5rem; cursor: pointer; text-transform: uppercase;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.login-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.login-form { display: none; }
.login-form.active { display: block; }
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; font-size: .62rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-dim); margin-bottom: .35rem;
}
.form-input {
  width: 100%; font-family: var(--font-mono); font-size: .82rem;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: .55rem .75rem;
  border-radius: var(--radius); outline: none;
}
.form-input:focus { border-color: var(--accent); }
.form-submit {
  width: 100%; font-family: var(--font-mono); font-size: .8rem;
  background: var(--accent); color: #000; border: none;
  padding: .65rem; border-radius: var(--radius); cursor: pointer;
  font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  margin-top: .5rem;
}
.form-submit:hover { opacity: .9; }
.rain-container {
  position: absolute; inset: 0; overflow: hidden; z-index: 1; pointer-events: none;
}
.rain-drop {
  position: absolute; width: 1px; background: rgba(217,119,6,.18);
  border-radius: 1px; animation: rainFall linear infinite;
}

/* ── Leaderboard Page ─────────────────────────────────────── */
.lb-page { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }
.lb-title {
  font-family: var(--font-head); font-size: 2rem; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: .12em;
  margin-bottom: 1.5rem; text-align: center;
}
.lb-podium { display: flex; justify-content: center; align-items: flex-end; gap: 1rem; margin-bottom: 2rem; }
.podium-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem .75rem; text-align: center;
  min-width: 140px;
}
.podium-card.first  { border-color: #fbbf24; transform: translateY(-12px); }
.podium-card.second { border-color: #9ca3af; }
.podium-card.third  { border-color: #d97706; }
.podium-rank { font-size: 1.5rem; margin-bottom: .25rem; }
.podium-name { font-family: var(--font-head); font-size: .9rem; color: var(--text); }
.podium-score { font-size: .75rem; color: var(--accent); }

.lb-table-wrap { overflow-x: auto; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
  text-align: left; font-size: .62rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-dim);
  border-bottom: 1px solid var(--border); padding: .5rem .75rem;
}
.lb-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--border); font-size: .78rem; }
.lb-table tr:hover td { background: var(--bg2); }
.lb-rank { color: var(--text-dim); }
.lb-score-bar { height: 4px; background: var(--accent); border-radius: 2px; min-width: 2px; }
.lb-score-wrap { display: flex; align-items: center; gap: .5rem; }

/* ── Admin Layout ─────────────────────────────────────────── */
.admin-layout { padding: 1.25rem 1.5rem; max-width: 1400px; margin: 0 auto; }
.admin-topbar { margin-bottom: 1.25rem; }
.admin-title {
  font-family: var(--font-head); font-size: 1.5rem; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: .75rem;
}
.admin-stats-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.admin-stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .65rem .9rem; min-width: 130px;
}
.admin-stat-card.live { border-color: var(--green); }
.admin-stat-card span {
  display: block; font-family: var(--font-head);
  font-size: 1.4rem; color: var(--accent);
}
.admin-stat-card.live span { color: var(--green); }
.admin-stat-card label {
  font-size: .62rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text-dim);
}

/* Admin tabs */
.admin-tabs {
  display: flex; flex-wrap: wrap; gap: .25rem;
  border-bottom: 1px solid var(--border); margin-bottom: 1.25rem;
}
.admin-tab {
  font-family: var(--font-mono); font-size: .68rem;
  background: none; border: 1px solid transparent;
  color: var(--text-dim); padding: .4rem .8rem;
  cursor: pointer; text-transform: uppercase; letter-spacing: .08em;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
.admin-tab:hover { color: var(--accent); }
.admin-tab.active {
  color: var(--accent); border-color: var(--border);
  border-bottom: 1px solid var(--bg);
  background: var(--bg);
}
.alert-badge {
  background: var(--red); color: #fff;
  font-size: .6rem; padding: 1px 5px; border-radius: 10px;
  margin-left: .2rem;
}

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.section-title {
  font-family: var(--font-head); font-size: 1.1rem;
  color: var(--text); text-transform: uppercase;
  letter-spacing: .08em; margin-bottom: .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.section-hint { font-size: .7rem; color: var(--text-dim); margin-bottom: .75rem; }

/* Live dot */
.live-dot {
  display: inline-block; width: 7px; height: 7px;
  background: var(--green); border-radius: 50%;
  animation: blink 1.2s ease infinite;
}

/* Monitor table */
.monitor-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  font-size: .6rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); border-bottom: 1px solid var(--border);
  padding: .4rem .65rem; text-align: left; white-space: nowrap;
}
.admin-table td {
  padding: .45rem .65rem; border-bottom: 1px solid var(--border);
  font-size: .74rem;
}
.admin-table tr:hover td { background: var(--bg2); }
.tbl-empty { text-align: center; color: var(--text-dim); font-size: .75rem; padding: 1.5rem; }
.ip-tag {
  font-size: .65rem; background: var(--bg3);
  border: 1px solid var(--border); padding: 1px 5px;
  border-radius: 3px; color: var(--text-dim);
}
.warn-text { color: var(--red) !important; font-weight: 700; }

/* Activity feed */
.activity-feed {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); max-height: 320px; overflow-y: auto;
  padding: .5rem;
}
.feed-placeholder { color: var(--text-muted); font-size: .72rem; text-align: center; padding: 1rem; }
.feed-item {
  font-size: .72rem; padding: .35rem .5rem;
  border-bottom: 1px solid var(--border); line-height: 1.5;
}
.feed-item code { background: var(--bg3); padding: 1px 4px; border-radius: 3px; font-size: .68rem; }
.feed-time { color: var(--text-muted); font-size: .65rem; margin-right: .5rem; }
.feed-solve { background: rgba(34,197,94,.04); }
.feed-wrong { background: rgba(239,68,68,.04); }
.feed-code  { background: rgba(59,130,246,.04); }

/* Alert cards */
.alert-card {
  background: rgba(239,68,68,.07); border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .5rem;
  position: relative;
}
.alert-card.tab_switch { border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.05); }
.alert-card.flag_sharing { border-color: rgba(239,68,68,.5); }
.alert-card.rapid_attempts { border-color: rgba(168,85,247,.4); background: rgba(168,85,247,.05); }
.alert-type { font-size: .62rem; text-transform: uppercase; letter-spacing: .1em; color: var(--red); font-weight: 700; margin-bottom: .25rem; }
.alert-msg { font-size: .78rem; color: var(--text); }
.alert-time { font-size: .65rem; color: var(--text-dim); margin-top: .25rem; }
.alert-dismiss {
  position: absolute; top: .5rem; right: .5rem;
  font-family: var(--font-mono); font-size: .6rem;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-dim); padding: 2px 8px; border-radius: 3px;
  cursor: pointer;
}
.alert-dismiss:hover { border-color: var(--accent); color: var(--accent); }

/* Code log */
.codelog-filters { display: flex; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap; }
.filter-input {
  font-family: var(--font-mono); font-size: .75rem;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: .35rem .6rem; border-radius: var(--radius);
  outline: none;
}
.filter-input:focus { border-color: var(--accent); }
.codelog-results { display: flex; flex-direction: column; gap: .75rem; }
.codelog-entry {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.codelog-meta {
  display: flex; justify-content: space-between;
  align-items: center; padding: .4rem .65rem;
  background: var(--bg3); font-size: .7rem;
  border-bottom: 1px solid var(--border);
}
.codelog-time { font-size: .65rem; color: var(--text-dim); }
.codelog-code {
  padding: .5rem .65rem; font-size: .72rem; font-family: var(--font-mono);
  color: #c9d1d9; overflow-x: auto; white-space: pre-wrap; word-break: break-all;
  max-height: 180px;
}
.codelog-output {
  padding: .35rem .65rem; font-size: .7rem;
  border-top: 1px solid var(--border); color: var(--green); background: rgba(34,197,94,.04);
}

/* User management */
.tbl-btn {
  font-family: var(--font-mono); font-size: .62rem;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-dim); padding: 2px 8px; border-radius: 3px;
  cursor: pointer; margin-right: 3px;
}
.tbl-btn:hover { border-color: var(--accent); color: var(--accent); }
.tbl-btn.reset:hover { border-color: #f59e0b; color: #f59e0b; }
.tbl-btn.delete { }
.tbl-btn.delete:hover { border-color: var(--red); color: var(--red); }

/* Announce */
.announce-form { margin-bottom: 1rem; }
.announce-input {
  width: 100%; font-family: var(--font-mono); font-size: .8rem;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: .6rem .75rem; border-radius: var(--radius);
  resize: vertical; outline: none; margin-bottom: .5rem;
}
.announce-input:focus { border-color: var(--accent); }
.announce-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem .75rem;
  font-size: .77rem; margin-bottom: .4rem; color: var(--accent);
}
.announce-time { color: var(--text-dim); font-size: .65rem; margin-left: .5rem; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes rainFall {
  0%   { transform: translateY(-100px); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(110vh); opacity: 0; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes popIn {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .3; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .ch-content-cols { grid-template-columns: 1fr; }
  .terminal-container { min-height: 350px; }
}
@media (max-width: 640px) {
  .game-layout { flex-direction: column; height: auto; }
  .game-sidebar { width: 100%; min-width: unset; height: auto; overflow-x: auto; }
  .tier-challenges { display: flex; flex-wrap: wrap; gap: .25rem; }
}

/* ═══════════════════════════════════════════════════════════════
   VISUAL ENHANCEMENT PACK — Animations, Glow, Polish
   ═══════════════════════════════════════════════════════════════ */

/* ── Animated background grid on game page ──────────────────── */
.game-main {
  background:
    linear-gradient(rgba(217,119,6,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217,119,6,.025) 1px, transparent 1px),
    var(--bg);
  background-size: 40px 40px, 40px 40px;
  animation: gridPan 30s linear infinite;
}
@keyframes gridPan {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 40px 40px, 40px 40px; }
}

/* ── Glowing nav bar ────────────────────────────────────────── */
.nav {
  box-shadow: 0 1px 0 #1e1e2e, 0 0 20px rgba(0,0,0,.5);
}
.nav-brand {
  background: linear-gradient(90deg, #d97706, #f59e0b);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 8px rgba(217,119,6,.3));
}

/* ── Sidebar glow effect ────────────────────────────────────── */
.game-sidebar {
  box-shadow: inset -1px 0 0 #1e1e2e, 4px 0 20px rgba(0,0,0,.3);
}
.tier-header {
  position: relative;
  text-shadow: 0 0 10px currentColor;
}
.tier-header::after {
  content: '';
  position: absolute; left: 0; bottom: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, currentColor, transparent);
  opacity: .2;
}

/* ── Challenge item enhancements ────────────────────────────── */
.challenge-item {
  transition: all .18s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.challenge-item.open:hover {
  background: linear-gradient(90deg, rgba(217,119,6,.08), transparent);
  transform: translateX(2px);
  box-shadow: inset 0 0 0 1px rgba(217,119,6,.2);
}
.challenge-item.solved {
  background: linear-gradient(90deg, rgba(34,197,94,.05), transparent);
}
.challenge-item.active-ch {
  background: linear-gradient(90deg, rgba(217,119,6,.15), rgba(217,119,6,.03)) !important;
  box-shadow: inset 0 0 0 1px rgba(217,119,6,.3), 0 0 15px rgba(217,119,6,.08) !important;
}

/* Score pulse on update */
@keyframes scorePulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); color: #22c55e; }
  100% { transform: scale(1); }
}
.score-updated { animation: scorePulse .5s ease; }

/* ── Welcome screen improvements ────────────────────────────── */
.welcome-screen {
  background: radial-gradient(ellipse at 50% 30%, rgba(217,119,6,.04) 0%, transparent 60%);
}
.welcome-title {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #d97706 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 20px rgba(217,119,6,.3));
  animation: titlePulse 4s ease infinite;
}
@keyframes titlePulse {
  0%,100% { filter: drop-shadow(0 0 20px rgba(217,119,6,.3)); }
  50%      { filter: drop-shadow(0 0 35px rgba(217,119,6,.5)); }
}
.welcome-tape {
  animation: tapePulse 2s ease infinite;
}
@keyframes tapePulse {
  0%,100% { box-shadow: none; }
  50%      { box-shadow: 0 0 12px rgba(239,68,68,.2); }
}
.welcome-stat {
  transition: all .2s; cursor: default;
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
}
.welcome-stat:hover {
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(217,119,6,.15);
  transform: translateY(-2px);
}

/* ── Challenge header polish ─────────────────────────────────── */
.ch-title {
  background: linear-gradient(90deg, var(--text) 60%, transparent);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.ch-points-badge {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 0 10px rgba(217,119,6,.3);
  animation: badgePulse 3s ease infinite;
}
@keyframes badgePulse {
  0%,100% { box-shadow: 0 0 8px rgba(217,119,6,.3); }
  50%      { box-shadow: 0 0 16px rgba(217,119,6,.5); }
}

/* ── Story box polish ────────────────────────────────────────── */
.ch-story {
  position: relative;
  background: linear-gradient(135deg, rgba(217,119,6,.04), rgba(217,119,6,.01));
  border-left: 2px solid var(--accent);
  box-shadow: inset 0 0 30px rgba(217,119,6,.02);
}
.ch-story::before {
  content: '"';
  position: absolute; top: -.3rem; left: .5rem;
  font-size: 2.5rem; color: rgba(217,119,6,.15);
  font-family: serif; line-height: 1;
}

/* ── Terminal glow ───────────────────────────────────────────── */
.terminal-container {
  box-shadow: 0 0 0 1px #1e1e2e, 0 0 30px rgba(0,0,0,.4), inset 0 0 60px rgba(0,0,0,.2);
}
.terminal-topbar {
  background: linear-gradient(180deg, #141420, #101018);
}
.run-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 0 10px rgba(34,197,94,.2);
  transition: all .15s;
}
.run-btn:not(:disabled):hover {
  box-shadow: 0 0 20px rgba(34,197,94,.4);
  transform: translateY(-1px);
}

/* ── Output area syntax tinting ─────────────────────────────── */
.output-area {
  background: linear-gradient(180deg, #050508, #080810);
  border-top: 1px solid #0d0d18;
}

/* ── Flag section glow on correct ───────────────────────────── */
.flag-input:focus {
  box-shadow: 0 0 0 2px rgba(217,119,6,.15), 0 0 15px rgba(217,119,6,.08);
}
.flag-input.correct {
  box-shadow: 0 0 0 2px rgba(34,197,94,.2), 0 0 20px rgba(34,197,94,.1);
  animation: correctGlow .5s ease;
}
@keyframes correctGlow {
  0%   { box-shadow: 0 0 0 2px rgba(34,197,94,.5), 0 0 40px rgba(34,197,94,.3); }
  100% { box-shadow: 0 0 0 2px rgba(34,197,94,.2), 0 0 20px rgba(34,197,94,.1); }
}
.flag-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 0 10px rgba(217,119,6,.2);
  transition: all .15s;
}
.flag-btn:not(:disabled):hover {
  box-shadow: 0 0 20px rgba(217,119,6,.4);
  transform: translateY(-1px);
}

/* ── Modal glow ─────────────────────────────────────────────── */
.modal-overlay {
  background: rgba(0,0,0,.85);
}
.modal-box {
  box-shadow: 0 0 0 1px rgba(217,119,6,.3), 0 0 60px rgba(217,119,6,.15), 0 20px 80px rgba(0,0,0,.8);
  animation: modalPop .35s cubic-bezier(.16,1,.3,1);
  background: linear-gradient(135deg, #0f0f1a, #0a0a12);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-points {
  text-shadow: 0 0 20px rgba(34,197,94,.5);
}
.modal-close-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  box-shadow: 0 0 15px rgba(217,119,6,.3);
  transition: all .2s;
}
.modal-close-btn:hover {
  box-shadow: 0 0 25px rgba(217,119,6,.5);
  transform: translateY(-1px);
}

/* ── Hint toast animation ───────────────────────────────────── */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Progress bar animated stripe ───────────────────────────── */
.progress-bar-inner {
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 50%, #22c55e 100%);
  background-size: 200% 100%;
  animation: progressShine 2s linear infinite;
}
@keyframes progressShine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Nav score/user area ────────────────────────────────────── */
.nav-user {
  background: rgba(217,119,6,.08);
  border: 1px solid rgba(217,119,6,.2);
  padding: .2rem .5rem; border-radius: 4px;
  font-size: .68rem;
}

/* ── Leaderboard rank glow for top 3 ───────────────────────── */
.lb-table tbody tr:nth-child(1) td { color: #fbbf24; }
.lb-table tbody tr:nth-child(2) td { color: #d1d5db; }
.lb-table tbody tr:nth-child(3) td { color: #d97706; }

/* ── Podium card glow ───────────────────────────────────────── */
.podium-card { transition: transform .2s; }
.podium-card:hover { transform: translateY(-4px) scale(1.02); }
.podium-card.first {
  box-shadow: 0 0 30px rgba(251,191,36,.15);
  background: linear-gradient(135deg, #111108, #0a0a05);
}

/* ── Admin live dot pulse ───────────────────────────────────── */
.live-dot { box-shadow: 0 0 6px rgba(34,197,94,.6); }

/* ── Feed item hover ────────────────────────────────────────── */
.feed-item { transition: background .15s; }
.feed-item:hover { background: rgba(255,255,255,.02); }

/* ── Alert card pulse ───────────────────────────────────────── */
.alert-card.flag_sharing {
  animation: alertPulse 2s ease infinite;
}
@keyframes alertPulse {
  0%,100% { box-shadow: none; }
  50%      { box-shadow: 0 0 15px rgba(239,68,68,.15); }
}

/* ── Scroll reveal for challenge panel ──────────────────────── */
.challenge-panel { animation: panelSlide .3s cubic-bezier(.16,1,.3,1) both; }
@keyframes panelSlide {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Solved challenge shine ─────────────────────────────────── */
.challenge-item.solved .ch-name {
  background: linear-gradient(90deg, #22c55e, #86efac);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

