:root {
  --bg: #000000;
  --moss: #4a7a2d;
  --moss-bright: #6dd03a;
  --moss-glow: #25ff00;
  --slime: #aaff33;
  --bone: #d9d2b8;
  --blood: #ff2a2a;
  --ink: #000000;
  --scan: rgba(37, 255, 0, 0.03);
  --sidebar-w: 280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--moss-bright);
  font-family: 'JetBrains Mono', monospace;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    var(--scan) 3px,
    var(--scan) 4px
  );
  pointer-events: none;
  z-index: 100;
}

body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.14 0 0 0 0 1 0 0 0 0 0 0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 99;
  opacity: 0.35;
  mix-blend-mode: overlay;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  border-right: 1px solid var(--moss);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
}

.brand {
  font-size: 14px;
  font-weight: 800;
  color: var(--moss-glow);
  letter-spacing: 0.15em;
  text-shadow: 0 0 8px rgba(37, 255, 0, 0.6);
}
.brand-sub {
  font-size: 11px;
  color: var(--moss-bright);
  letter-spacing: 0.2em;
  margin-top: 6px;
  opacity: 0.7;
}

.sb-section-label {
  font-size: 11px;
  color: var(--moss-bright);
  letter-spacing: 0.25em;
  margin-bottom: 14px;
  opacity: 0.7;
}
.sb-section-label::before { content: "// "; opacity: 0.6; }

.sb-section { display: flex; flex-direction: column; gap: 10px; }

.sb-link {
  display: block;
  padding: 8px 12px;
  color: var(--moss-glow);
  background: transparent;
  border: 1px solid var(--moss);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.sb-link::before { content: "[ "; opacity: 0.5; }
.sb-link::after { content: " ]"; opacity: 0.5; }
.sb-link:hover {
  background: var(--moss-glow);
  color: var(--ink);
  box-shadow: 0 0 12px var(--moss-glow);
}
.sb-link.active {
  background: var(--moss);
  color: var(--ink);
}
.sb-link.danger { color: var(--blood); border-color: var(--blood); }
.sb-link.danger:hover { background: var(--blood); color: var(--ink); }
.sb-link .blocky { background: var(--blood); color: var(--blood); padding: 0 2px; }
.sb-link:hover .blocky { background: transparent; }

.sb-contract {
  border: 1px dashed var(--moss);
  padding: 14px;
  background: rgba(10, 20, 5, 0.4);
}
.sb-ca {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--bone);
  word-break: break-all;
  line-height: 1.4;
  margin-bottom: 12px;
}
.copy-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--moss);
  color: var(--moss-glow);
  padding: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  letter-spacing: 0.15em;
  text-align: center;
  transition: all 0.15s ease;
}
.copy-btn::before { content: "[ "; opacity: 0.5; }
.copy-btn::after { content: " ]"; opacity: 0.5; }
.copy-btn:hover { background: var(--moss); color: var(--ink); }
.copy-btn.copied { background: var(--slime); color: var(--ink); border-color: var(--slime); }

.sb-status {
  margin-top: auto;
  padding-top: 20px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--moss-glow);
  border-top: 1px dashed rgba(74, 122, 45, 0.3);
}
.sb-status .line { display: block; padding: 2px 0; }
.sb-status .line::before { content: "> "; opacity: 0.6; }
.sb-status.compromised .line { color: var(--blood); }

/* ===== MAIN ===== */
main {
  margin-left: var(--sidebar-w);
  padding: 24px 64px 80px;
  min-height: 100vh;
}

.hero-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
}

.ascii-ogre {
  font-family: 'VT323', monospace;
  color: var(--moss-glow);
  font-size: 15px;
  line-height: 0.95;
  white-space: pre;
  text-shadow:
    0 0 3px var(--moss-glow),
    0 0 8px var(--moss-glow),
    0 0 16px rgba(37, 255, 0, 0.55);
  letter-spacing: 1px;
  animation: flicker 5s ease-in-out infinite;
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  48% { opacity: 0.85; }
  49% { opacity: 1; }
}

.ascii-wordmark {
  font-family: 'VT323', monospace;
  color: var(--moss-glow);
  font-size: clamp(11px, 1.4vw, 20px);
  line-height: 0.95;
  white-space: pre;
  letter-spacing: 1px;
  transform: skewX(-14deg);
  text-shadow:
    0 0 3px var(--moss-glow),
    0 0 10px var(--moss-glow),
    0 0 22px rgba(37, 255, 0, 0.75),
    0 0 40px rgba(37, 255, 0, 0.45);
  animation: flicker 3s ease-in-out infinite;
  user-select: none;
}

/* ===== BURN TRACKER ===== */
.burn-tracker { margin-bottom: 60px; }
.bt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(74, 122, 45, 0.4);
  margin-bottom: 24px;
}
.bt-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--moss-glow);
  font-size: 14px;
  letter-spacing: 0.2em;
  font-weight: 700;
}
.bt-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--slime);
  box-shadow: 0 0 10px var(--slime);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.bt-updated {
  font-size: 11px;
  color: var(--moss);
  letter-spacing: 0.2em;
}
.bt-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.bt-bar-label {
  font-size: 11px;
  color: var(--moss-bright);
  letter-spacing: 0.25em;
  opacity: 0.7;
}
.bt-bar-pct {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--moss-glow);
  text-shadow: 0 0 8px rgba(37, 255, 0, 0.6);
}
.bt-bar-track {
  height: 6px;
  background: rgba(74, 122, 45, 0.2);
  border: 1px solid rgba(74, 122, 45, 0.4);
  position: relative;
  overflow: hidden;
  margin-bottom: 6px;
}
.bt-bar-fill {
  height: 100%;
  width: 28.94%;
  background: var(--moss-glow);
  box-shadow: 0 0 12px var(--moss-glow), 0 0 20px var(--moss-glow);
  position: relative;
}
.bt-bar-fill::after {
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--slime);
  box-shadow: 0 0 8px var(--slime);
}
.bt-bar-ends {
  display: flex;
  justify-content: space-between;
  font-family: 'VT323', monospace;
  font-size: 12px;
  color: var(--moss);
  letter-spacing: 0.15em;
  margin-bottom: 32px;
}
.bt-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
.bt-card {
  border: 1px solid var(--moss);
  background: rgba(10, 20, 5, 0.4);
  padding: 14px 16px;
}
.bt-card .lbl {
  font-size: 10px;
  color: var(--moss-bright);
  letter-spacing: 0.2em;
  opacity: 0.7;
  margin-bottom: 10px;
}
.bt-card .lbl::before { content: "// "; opacity: 0.6; }
.bt-card .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  color: var(--moss-glow);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(37, 255, 0, 0.5);
  line-height: 1.1;
  margin-bottom: 8px;
}
.bt-card .sub {
  font-size: 9px;
  color: var(--moss);
  letter-spacing: 0.15em;
  opacity: 0.7;
}

/* ===== LORE ===== */
.lore-block {
  border-top: 1px solid rgba(74, 122, 45, 0.4);
  padding-top: 36px;
  max-width: 760px;
}
.lore-label {
  font-size: 11px;
  color: var(--moss-bright);
  letter-spacing: 0.25em;
  opacity: 0.7;
  margin-bottom: 28px;
}
.lore-label::before { content: "// "; opacity: 0.6; }
.lore-block p {
  color: var(--bone);
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 22px;
  opacity: 0.88;
}
.lore-block p strong { color: var(--moss-glow); font-weight: 700; }
.lore-quote {
  border-left: 3px solid var(--slime);
  padding: 18px 22px;
  margin-top: 28px;
  background: rgba(26, 42, 10, 0.4);
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--slime);
  line-height: 1.4;
}
.lore-quote span { display: block; }
.lore-quote span::before { content: "> "; opacity: 0.6; }

footer {
  margin-top: 80px;
  padding: 32px 0 0;
  border-top: 1px dashed rgba(74, 122, 45, 0.4);
  font-size: 10px;
  color: var(--moss);
  letter-spacing: 0.15em;
}

/* ===== OGRIFY PAGE ===== */
.page-title {
  font-family: 'VT323', monospace;
  font-size: 44px;
  color: var(--moss-glow);
  letter-spacing: 0.05em;
  text-shadow: 0 0 12px rgba(37, 255, 0, 0.6);
  margin-bottom: 12px;
}
.page-intro {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: var(--moss-bright);
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 700px;
}
.page-intro .line { display: block; }
.page-intro .line::before { content: "> "; opacity: 0.6; }

.tool-section { margin-bottom: 60px; }
.tool-label {
  font-size: 11px;
  color: var(--moss-bright);
  letter-spacing: 0.25em;
  opacity: 0.8;
  margin-bottom: 16px;
}
.tool-label::before { content: "// "; opacity: 0.6; }

.dropzone {
  border: 2px dashed var(--moss);
  background: rgba(10, 20, 5, 0.3);
  padding: 64px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 260px;
  position: relative;
  max-width: 760px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--moss-glow);
  background: rgba(37, 255, 0, 0.05);
  box-shadow: 0 0 20px rgba(37, 255, 0, 0.2) inset;
}
.dropzone .plus {
  font-family: 'VT323', monospace;
  font-size: 64px;
  color: var(--moss-glow);
  line-height: 1;
  text-shadow: 0 0 12px rgba(37, 255, 0, 0.6);
}
.dropzone .label {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--moss-bright);
}
.dropzone .formats {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--moss);
  opacity: 0.7;
}
.dropzone img.preview {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(37, 255, 0, 0.4));
}

.output-box {
  border: 1px solid var(--moss);
  background: rgba(5, 12, 2, 0.5);
  padding: 32px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: var(--moss-glow);
  max-width: 760px;
  position: relative;
}
.output-box .cursor::after {
  content: "_";
  animation: cursor 1s steps(2) infinite;
}
@keyframes cursor { 50% { opacity: 0; } }

.action-btn {
  margin-top: 18px;
  padding: 14px 24px;
  background: var(--moss-glow);
  color: var(--ink);
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.action-btn::before { content: "[ "; }
.action-btn::after { content: " ]"; }
.action-btn:hover {
  background: var(--slime);
  box-shadow: 0 0 20px var(--slime);
}
.action-btn:disabled {
  background: var(--moss);
  opacity: 0.5;
  cursor: not-allowed;
}

canvas.matrix-canvas {
  display: block;
  max-width: 100%;
  filter: drop-shadow(0 0 14px rgba(37, 255, 0, 0.5));
}

/* ===== ARCHIVES PAGE ===== */
.archives-title {
  font-family: 'VT323', monospace;
  font-size: 48px;
  color: var(--blood);
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(255, 42, 42, 0.6);
  margin-bottom: 12px;
}
.archives-title .redacted {
  background: var(--blood);
  color: var(--blood);
  user-select: none;
}
.archives-title::before { content: "// "; opacity: 0.6; }

.archives-meta {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--moss-bright);
  letter-spacing: 0.15em;
  margin-bottom: 36px;
}
.archives-meta .redacted {
  background: var(--blood);
  color: var(--blood);
  padding: 0 4px;
  user-select: none;
}

.archives-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.artifact {
  border: 1px solid rgba(255, 42, 42, 0.4);
  background: rgba(20, 0, 0, 0.3);
  padding: 18px;
  min-height: 180px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}
.artifact:hover {
  border-color: var(--blood);
  box-shadow: 0 0 16px rgba(255, 42, 42, 0.3);
}
.artifact .label {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--moss-bright);
  letter-spacing: 0.15em;
  margin-bottom: 10px;
  word-break: break-all;
}
.artifact .glyph {
  font-family: 'VT323', monospace;
  font-size: 48px;
  color: var(--blood);
  text-align: center;
  line-height: 1;
  margin: 16px 0;
  text-shadow: 0 0 10px rgba(255, 42, 42, 0.5);
}
.artifact .status {
  font-size: 10px;
  color: var(--blood);
  letter-spacing: 0.2em;
  margin-top: auto;
}
.artifact .redacted {
  background: var(--blood);
  color: var(--blood);
  padding: 0 4px;
  user-select: none;
}
.artifact.glitch {
  animation: glitch 0.3s ease-in-out infinite alternate;
}
@keyframes glitch {
  0% { transform: translate(0); }
  100% { transform: translate(-1px, 1px); }
}

.archives-foot {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--moss-glow);
  letter-spacing: 0.1em;
  margin-top: 32px;
  opacity: 0.7;
}
.archives-foot::before { content: "> "; opacity: 0.6; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .bt-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .sidebar {
    position: relative;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--moss);
  }
  main { margin-left: 0; padding: 40px 24px; }
  .bt-grid { grid-template-columns: repeat(2, 1fr); }
  .ascii-ogre { font-size: 11px; }
  .ascii-wordmark { font-size: 11px; }
}
@media (max-width: 500px) {
  .ascii-ogre { font-size: 9px; }
  .ascii-wordmark { font-size: 9px; }
  .bt-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 32px; }
  .archives-title { font-size: 32px; }
}

::selection { background: var(--moss-glow); color: var(--ink); }
