/* ══════════════════════════════════════════
   VARIABLES — Dark Mode (default)
══════════════════════════════════════════ */
:root {
  --green:      #00ff41;
  --green-dim:  #00cc33;
  --green-dark: #003311;
  --bg:         #0a0a0a;
  --surface:    #0d1a0d;
  --surface2:   #0a0f0a;
  --border:     #1a3d1a;
  --text:       #c8ffc8;
  --text-dim:   #7aab7a;
  --red:        #ff3333;
  --yellow:     #ffdd00;
  --cyan:       #00ffff;
  --orange:     #ff8c00;
  --sidebar-bg: #080f08;
  --topbar-bg:  #080f08;
  --cmd-bg:     #050f05;
  --sidebar-w:  224px;
  --topbar-h:   52px;
}

/* ── Light Mode overrides ── */
body.light {
  --green:      #006622;
  --green-dim:  #004d1a;
  --green-dark: #002200;
  --bg:         #f0f4f0;
  --surface:    #e4ede4;
  --surface2:   #dde8dd;
  --border:     #99bb99;
  --text:       #112211;
  --text-dim:   #446644;
  --red:        #cc0000;
  --yellow:     #886600;
  --cyan:       #006688;
  --orange:     #bb5500;
  --sidebar-bg: #ddeadd;
  --topbar-bg:  #ddeadd;
  --cmd-bg:     #d4e8d4;
}

body.light .glitch {
  text-shadow: 0 0 6px var(--green), 0 0 12px var(--green-dim);
  animation: none;
}

body.light body::before { opacity: 0.03; }

body.light .cmd        { color: var(--green-dark); }
body.light .cmd.red    { color: #880000; }
body.light .cmd.cyan   { color: #004466; }
body.light .cmd.yellow { color: #664400; }
body.light .cmd.orange { color: #883300; }
body.light .cmd.purple { color: #440088; }
body.light .cmd-wrap   { border-color: var(--border); background: var(--cmd-bg); }
body.light .cmd-wrap .cmd { background: transparent; }
body.light .copy-btn   { background: var(--cmd-bg); border-left-color: var(--border); }

body.light .search-wrap { background: var(--surface2); }
body.light .card:hover  { box-shadow: 0 0 12px #00662215, inset 0 0 10px #00662208; }

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 0%,   #001a0055 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, #003311aa 0%, transparent 50%);
  transition: background 0.3s, color 0.3s;
}

body.light {
  background-image:
    radial-gradient(ellipse at 20% 0%,   #c8e8c820 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, #aad8aa30 0%, transparent 50%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.07) 2px, rgba(0,0,0,0.07) 4px
  );
  pointer-events: none;
  z-index: 200;
}

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 150;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  transition: background 0.3s, border-color 0.3s;
}

.sidebar::-webkit-scrollbar       { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); }

.main-content {
  margin-left: var(--sidebar-w);
  padding: 28px 28px 60px;
}

.mobile-topbar { display: none; }

/* ══════════════════════════════════════════
   SIDEBAR INTERNALS
══════════════════════════════════════════ */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 10px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65em;
  letter-spacing: 3px;
  color: var(--green-dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1em;
  padding: 2px 4px;
  line-height: 1;
}

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85em;
  padding: 3px 6px;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover { color: var(--yellow); border-color: var(--yellow); }

/* ── Search ── */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--cmd-bg);
  border: 1px solid var(--border);
  padding: 5px 8px;
  transition: background 0.3s, border-color 0.3s;
}

.sidebar-search { margin: 10px 10px 4px; flex-shrink: 0; }

.search-icon { width: 12px; height: 12px; fill: var(--text-dim); flex-shrink: 0; }

.search-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.82em;
  min-width: 0;
}

.search-wrap input::placeholder { color: var(--text-dim); opacity: 0.6; }

.search-clear {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75em;
  padding: 0 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.search-clear.visible { opacity: 1; pointer-events: auto; }
.search-clear:hover   { color: var(--red); }

/* ── Search options (mode + hint) ── */
.search-options {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.search-mode-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65em;
  letter-spacing: 1px;
  padding: 2px 7px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.search-mode-btn.active {
  color: var(--green);
  border-color: var(--green-dim);
  background: #00ff4110;
}

.search-mode-btn:hover { color: var(--text); }

.search-hint {
  font-size: 0.62em;
  color: var(--text-dim);
  opacity: 0.5;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Results count */
.nav-results-count {
  padding: 2px 12px 6px;
  font-size: 0.7em;
  color: var(--green-dim);
  letter-spacing: 1px;
  min-height: 20px;
}

/* ── Nav list ── */
.nav-list { list-style: none; padding: 4px 0 20px; flex: 1; }

.nav-section-label {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.52em;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 10px 12px 3px;
  opacity: 0.55;
}

.nav-link {
  display: block;
  padding: 4px 12px 4px 16px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.78em;
  letter-spacing: 0.5px;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover  { color: var(--text); background: #0d1f0d; border-left-color: var(--green-dim); }
.nav-link.active { color: var(--green); border-left-color: var(--green); background: #0a1a0a; }

body.light .nav-link:hover  { background: #c8e0c8; }
body.light .nav-link.active { background: #b8d8b8; }

/* ══════════════════════════════════════════
   BACK TO TOP
══════════════════════════════════════════ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 38px;
  height: 38px;
  background: var(--sidebar-bg);
  border: 1px solid var(--green-dim);
  color: var(--green-dim);
  font-size: 0.85em;
  cursor: pointer;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover   { color: var(--green); background: #0d1f0d; }

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.glitch {
  font-family: 'Orbitron', sans-serif;
  font-size: 2.2em;
  font-weight: 900;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 6px;
  text-shadow: 0 0 10px var(--green), 0 0 30px var(--green-dim), 0 0 60px #00331166;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { text-shadow: 0 0 10px var(--green), 0 0 30px var(--green-dim); }
  50%       { text-shadow: 0 0 20px var(--green), 0 0 50px var(--green-dim), 0 0 80px #00ff4133; }
}

.cheat-sheet-sub {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9em;
  color: var(--green-dim);
  letter-spacing: 4px;
  margin-top: 4px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.85em;
  margin-top: 6px;
  letter-spacing: 3px;
}

.badge {
  display: inline-block;
  background: #1a0000;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 3px 12px;
  font-size: 0.75em;
  letter-spacing: 2px;
  margin-top: 10px;
  text-transform: uppercase;
}

body.light .badge { background: #ffeaea; }

/* ══════════════════════════════════════════
   PHASE PILLS
══════════════════════════════════════════ */
.phases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  justify-content: center;
}

.phase-pill {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.6em;
  letter-spacing: 1.5px;
  padding: 5px 12px;
  border: 1px solid;
  text-transform: uppercase;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s, box-shadow 0.15s;
}

.phase-pill:hover { opacity: 1; box-shadow: 0 0 8px currentColor; }

/* ══════════════════════════════════════════
   GRID & CARDS
══════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--green-dim);
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s;
}

.card:hover {
  border-color: var(--green-dim);
  box-shadow: 0 0 20px #00ff4115, inset 0 0 20px #00ff410a;
}

.card[data-cat="recon"]   { border-top-color: var(--cyan); }
.card[data-cat="scan"]    { border-top-color: var(--yellow); }
.card[data-cat="exploit"] { border-top-color: var(--red); }
.card[data-cat="post"]    { border-top-color: var(--orange); }
.card[data-cat="web"]     { border-top-color: #aa44ff; }
.card[data-cat="defense"] { border-top-color: var(--green); }

.card.search-hidden,
.phase-banner.search-hidden { display: none; }

/* ── Match count badge ── */
.match-badge {
  margin-left: auto;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.65em;
  padding: 1px 7px;
  background: #ffdd0022;
  border: 1px solid #ffdd0055;
  color: var(--yellow);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ── Search highlight ── */
.search-highlight {
  background: #ffdd0033;
  color: var(--yellow);
  border-radius: 2px;
  padding: 0 1px;
}

body.light .search-highlight { background: #ffdd0066; color: #664400; }

/* ══════════════════════════════════════════
   CARD TITLES
══════════════════════════════════════════ */
.card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.card-title .icon { font-size: 1.1em; }

.card-title.red    { color: var(--red);    border-bottom: 1px solid #3d0000;       padding-bottom: 8px; }
.card-title.green  { color: var(--green);  border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.card-title.cyan   { color: var(--cyan);   border-bottom: 1px solid #003333;       padding-bottom: 8px; }
.card-title.yellow { color: var(--yellow); border-bottom: 1px solid #333300;       padding-bottom: 8px; }
.card-title.orange { color: var(--orange); border-bottom: 1px solid #332200;       padding-bottom: 8px; }

/* Collapse chevron injected by JS */
.collapse-chevron {
  margin-left: auto;
  font-size: 0.8em;
  opacity: 0.5;
  transition: transform 0.25s ease;
  flex-shrink: 0;
  font-family: monospace;
}

.card.collapsed .collapse-chevron { transform: rotate(-90deg); }

/* Card body — JS wraps entries here */
.card-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  max-height: 2000px;
  opacity: 1;
}

.card.collapsed .card-body {
  max-height: 0;
  opacity: 0;
}

/* ══════════════════════════════════════════
   ENTRIES & DIFFICULTY BADGES
══════════════════════════════════════════ */
.entry {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #0d1f0d;
}
.entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

body.light .entry { border-bottom-color: #c8ddc8; }

.entry-label {
  color: var(--text-dim);
  font-size: 0.78em;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Difficulty badge */
.level-badge {
  font-size: 0.72em;
  padding: 0px 5px;
  border-radius: 2px;
  letter-spacing: 0.5px;
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  opacity: 0.85;
}

.level-badge.beginner     { background: #002200; color: #44dd44; border: 1px solid #224422; }
.level-badge.intermediate { background: #221a00; color: #ffaa00; border: 1px solid #443300; }
.level-badge.advanced     { background: #220000; color: #ff4444; border: 1px solid #440000; }

body.light .level-badge.beginner     { background: #d8f0d8; color: #226622; border-color: #99cc99; }
body.light .level-badge.intermediate { background: #f0e8cc; color: #886600; border-color: #ccaa44; }
body.light .level-badge.advanced     { background: #f0d8d8; color: #cc2222; border-color: #cc8888; }

/* ══════════════════════════════════════════
   COMMANDS & COPY BUTTON
══════════════════════════════════════════ */
.cmd {
  background: var(--cmd-bg);
  border-left: 3px solid var(--green-dim);
  padding: 5px 10px;
  color: var(--green);
  font-size: 0.82em;
  overflow-x: auto;
  white-space: nowrap;
  margin: 3px 0;
  display: block;
  transition: background 0.3s;
}

.cmd.red    { border-left-color: var(--red);    color: #ff8888; }
.cmd.cyan   { border-left-color: var(--cyan);   color: #88ffff; }
.cmd.yellow { border-left-color: var(--yellow); color: #ffee88; }
.cmd.orange { border-left-color: var(--orange); color: #ffbb66; }
.cmd.purple { border-left-color: #aa44ff;       color: #cc88ff; }

.prompt::before { content: '$ '; color: var(--text-dim); }

.cmd-wrap {
  display: flex;
  align-items: stretch;
  margin: 3px 0;
  border: 1px solid #1a3d1a;
  background: var(--cmd-bg);
  transition: background 0.3s, border-color 0.3s;
}

.cmd-wrap .cmd {
  margin: 0;
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  cursor: default;
  white-space: pre;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #1a3d1a transparent;
}

.cmd-wrap .cmd::-webkit-scrollbar       { height: 3px; }
.cmd-wrap .cmd::-webkit-scrollbar-thumb { background: #1a3d1a; }
.cmd-wrap:hover .cmd                    { background: #0a1f0a; }

body.light .cmd-wrap:hover .cmd { background: #c4dcc4; }

.copy-btn {
  flex-shrink: 0;
  width: 58px;
  padding: 0 8px;
  background: var(--cmd-bg);
  border: none;
  border-left: 1px solid #1a3d1a;
  color: var(--text-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.68em;
  cursor: pointer;
  letter-spacing: 1px;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover,
.copy-btn:active { color: var(--green); background: #0d1f0d; }

body.light .copy-btn:hover,
body.light .copy-btn:active { background: #b8d4b8; }

.copy-btn.copied { color: var(--green); background: #0a1a0a; }

body.light .copy-btn.copied { background: #b8d8b8; }

.copy-btn svg { width: 11px; height: 11px; fill: currentColor; flex-shrink: 0; }

@media (max-width: 600px) {
  .copy-btn { width: 38px; font-size: 0; gap: 0; }
  .copy-btn svg { width: 14px; height: 14px; }
  .copy-btn.copied svg { display: none; }
  .copy-btn.copied::after { content: '✓'; font-size: 14px; color: var(--green); }
}

/* ══════════════════════════════════════════
   PHASE BANNERS
══════════════════════════════════════════ */
.phase-banner {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  margin: 8px 0 4px;
  font-family: 'Orbitron', sans-serif;
  font-size: 0.7em;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
}

.phase-banner::before,
.phase-banner::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ══════════════════════════════════════════
   MISC
══════════════════════════════════════════ */
.tag {
  display: inline-block;
  font-size: 0.7em;
  padding: 1px 6px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
}

.tag-tool { background: #001a33; color: #66aaff; border: 1px solid #003366; }
body.light .tag-tool { background: #cce0f8; color: #004488; border-color: #99bbdd; }

.tip {
  color: var(--text-dim);
  font-size: 0.78em;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.note-box {
  background: #0d0d00;
  border: 1px solid #333300;
  border-left: 3px solid var(--yellow);
  padding: 10px 12px;
  color: #cccc88;
  font-size: 0.82em;
  margin-bottom: 4px;
}

body.light .note-box { background: #fffacc; color: #664400; border-color: #ccaa44; }

footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.75em;
  letter-spacing: 2px;
}

/* ══════════════════════════════════════════
   NO-RESULTS
══════════════════════════════════════════ */
.no-results {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 0.9em;
  letter-spacing: 1px;
}

.no-results.visible { display: block; }
.no-results-icon    { font-size: 2.5em; margin-bottom: 12px; opacity: 0.4; }
.no-results-sub     { font-size: 0.8em; margin-top: 6px; opacity: 0.5; }

/* ══════════════════════════════════════════
   MOBILE — sidebar becomes slide-in drawer
══════════════════════════════════════════ */
@media (max-width: 860px) {

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 10px;
    z-index: 160;
    transition: background 0.3s, border-color 0.3s;
  }

  .mobile-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65em;
    letter-spacing: 3px;
    color: var(--green-dim);
    white-space: nowrap;
  }

  .mobile-search { flex: 1; }

  .hamburger {
    background: none;
    border: 1px solid var(--border);
    padding: 6px 7px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--green-dim);
    transition: transform 0.2s, opacity 0.2s;
  }

  .sidebar {
    width: 270px;
    transform: translateX(-100%);
    transition: transform 0.25s ease, background 0.3s;
    top: 0;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px #00000088;
  }

  .sidebar-close { display: block; }

  .drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 140;
  }

  .drawer-overlay.visible { display: block; }

  .main-content {
    margin-left: 0;
    padding: calc(var(--topbar-h) + 16px) 12px 60px;
  }

  .sidebar-search { display: none; }
  .search-options  { display: none; }

  .back-to-top { bottom: 16px; right: 16px; }
}