:root {
  --line-white: #fff;
  --node-bg: #000;
  --border-glow: 0 0 10px rgba(255, 0, 0, 0.3);
}

html, body * {
  cursor: url('https://kiunlo.neocities.org/cursors/misc/ausmagpie_cursor.png'), auto;
}

@font-face {
  font-family: "VCR OSD Mono";
  src: url("https://static.tumblr.com/nlxfn1e/7Pwqv8mt8/vcr_osd_mono_1.001.ttf") format("truetype");
}

/* =========================================
   BASE STRUCTURE
   ========================================= */

body {
  background-image: url('https://deadjackdaw.com/assets/images/background_tiles/purplestars.gif');
  background-repeat: repeat;
  color: red;
  font-family: 'VCR OSD Mono', monospace;
  margin: 0;
  display: block;
  padding: 50px 0;
  overflow-x: hidden;
  min-height: 100vh;
}

.map-container {
  width: 100%;
  overflow-x: auto; 
  padding-top: 30px;
  padding-bottom: 30px;
}

.tree-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
  padding: 0 40px;
  min-width: max-content; 
}

/* =========================================
   NODE STYLING
   ========================================= */

.card-node {
  background: var(--node-bg);
  border: 1px solid var(--line-white);
  padding: 0; 
  cursor: pointer;
  width: 50px;
  height: 50px;
  box-shadow: var(--border-glow);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  z-index: 2;
  margin-top: 20px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: border-rainbow 2s linear infinite alternate both, shadow-rainbow 2s linear infinite alternate both;
}

.tree-inner > .card-node {
  margin-top: 0;
}

.card-node:hover {
  background: red;
  box-shadow: 0 0 15px var(--line-white);
  animation: bg-rainbow 2s linear infinite alternate both, shadow-rainbow 2s linear infinite alternate both;
}

.node-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; 
}

#m-icon {
  animation: border-rainbow 2s linear infinite alternate both;
}

.sub-node {
  width: 25px; 
  height: 25px;
  border-style: dashed;
}

/* =========================================
   TREE CONNECTION LINES
   ========================================= */

.layer, .sub-layer {
  display: flex;
  justify-content: center;
  position: relative;
  margin: 0;
  padding: 0;
}

.layer { padding-top: 20px; }
.sub-layer { padding-top: 20px; }

.layer-wrap, .sub-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 0 10px;
}

.layer-wrap::before, 
.sub-wrap::before {
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 1px; background: var(--line-white);
}

.layer-wrap:first-child::before, 
.sub-wrap:first-child::before { left: 50%; width: 50%; }

.layer-wrap:last-child::before, 
.sub-wrap:last-child::before { left: 0; width: 50%; }

.layer-wrap::after, .sub-wrap::after {
  content: ''; position: absolute; top: 0; left: 50%; width: 1px; height: 20px; background: var(--line-white);
}

.has-children::after {
  content: ''; 
  position: absolute; 
  bottom: -20px; 
  left: 50%; 
  width: 1px; 
  height: 20px; 
  background: var(--line-white);
}

.layer-wrap::before, 
.sub-wrap::before,
.layer-wrap::after, 
.sub-wrap::after,
.has-children::after {
  animation: bg-rainbow 2s linear infinite alternate both;
}

/* =========================================
   MODAL STYLING
   ========================================= */
#system-modal {
  position: fixed; 
  inset: 0; 
  background: rgba(0,0,0,0.9);
  display: none; 
  justify-content: center; 
  align-items: center; 
  z-index: 1000;
}

.modal-inner {
  background: #000; 
  width: 90%; 
  max-width: 600px; 
  padding: 40px; 
  position: relative; 
  max-height: 90vh; 
  overflow-y: auto;
  border: 5px double var(--line-white);
  animation: border-rainbow 2s linear infinite alternate both;
}

.modal-close {
  position: absolute;
  top: 15px; 
  right: 20px; 
  cursor: pointer; 
  color: var(--line-white); 
  font-size: 1.2em; 
  font-weight: bold;
}

.collage-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px dashed var(--line-white);
  padding-top: 20px;
  justify-content: center;
  animation: border-rainbow 2s linear infinite alternate both;
}

.collage-gallery-image {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* =========================================
   PAGEDOLL
   ========================================= */
.pagedoll-container {
  position: fixed;
  bottom: 40px;
  right: 45px;
  z-index: 900;
  display: inline-block;
}

#pagedoll {
  max-width: 150px;
  height: auto;
  display: block;
  cursor: help;
}

#pagedoll:hover {
  animation: bounce 0.5s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Tooltip Logic */
.pagedoll-tooltip::after {
  content: attr(alt);
  position: absolute;
  bottom: 100%; 
  right: 0;
  margin-bottom: 10px;
  background-color: #000;
  color: #ff0000;
  padding: 5px 10px;
  border: 1px solid #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  pointer-events: none;
  font-family: "VCR OSD Mono", monospace;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  animation: border-rainbow 2s linear infinite alternate both, shadow-rainbow 2s linear infinite alternate both;
}

.pagedoll-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* =========================================
   NODE 999 OVERRIDES
   ========================================= */
#system-modal[data-node="999"] #m-icon,
#system-modal[data-node="999"] #m-relate {
  display: none !important;
}

#system-modal[data-node="999"] .modal-inner {
  border-style: dotted;
}

#system-modal[data-node="999"] .collage-gallery {
  border-top-width: 5px;
  border-top-style: double;
  padding-top: 25px;
}

/* =========================================
   KEYFRAMES
   ========================================= */
@-webkit-keyframes border-rainbow {
  0% { border-color: #19dcea; }
  100% { border-color: #b22cff; }
}
@keyframes border-rainbow {
  0% { border-color: #19dcea; }
  100% { border-color: #b22cff; }
}

@-webkit-keyframes bg-rainbow {
  0% { background-color: #19dcea; }
  100% { background-color: #b22cff; }
}
@keyframes bg-rainbow {
  0% { background-color: #19dcea; }
  100% { background-color: #b22cff; }
}

@-webkit-keyframes shadow-rainbow {
  0% { box-shadow: 0 0 10px #19dcea; }
  100% { box-shadow: 0 0 15px #b22cff; }
}
@keyframes shadow-rainbow {
  0% { box-shadow: 0 0 10px #19dcea; }
  100% { box-shadow: 0 0 15px #b22cff; }
}